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.

28549 lines
729KB

  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. #undef MAC_OS_X_VERSION_MAX_ALLOWED
  79. #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_4
  80. #else
  81. #define JUCE_INTEL 1
  82. #endif
  83. #ifdef __LP64__
  84. #define JUCE_64BIT 1
  85. #else
  86. #define JUCE_32BIT 1
  87. #endif
  88. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  89. #error "Building for OSX 10.3 is no longer supported!"
  90. #endif
  91. #ifndef MAC_OS_X_VERSION_10_5
  92. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  93. #endif
  94. #endif
  95. #if JUCE_IPHONE
  96. #ifndef NDEBUG
  97. #define JUCE_DEBUG 1
  98. #endif
  99. #ifdef __LITTLE_ENDIAN__
  100. #define JUCE_LITTLE_ENDIAN 1
  101. #else
  102. #define JUCE_BIG_ENDIAN 1
  103. #endif
  104. #endif
  105. #if JUCE_LINUX
  106. #ifdef _DEBUG
  107. #define JUCE_DEBUG 1
  108. #endif
  109. // Allow override for big-endian Linux platforms
  110. #ifndef JUCE_BIG_ENDIAN
  111. #define JUCE_LITTLE_ENDIAN 1
  112. #endif
  113. #if defined (__LP64__) || defined (_LP64)
  114. #define JUCE_64BIT 1
  115. #else
  116. #define JUCE_32BIT 1
  117. #endif
  118. #define JUCE_INTEL 1
  119. #endif
  120. // Compiler type macros.
  121. #ifdef __GNUC__
  122. #define JUCE_GCC 1
  123. #elif defined (_MSC_VER)
  124. #define JUCE_MSVC 1
  125. #if _MSC_VER >= 1400
  126. #define JUCE_USE_INTRINSICS 1
  127. #endif
  128. #else
  129. #error unknown compiler
  130. #endif
  131. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  132. /*** End of inlined file: juce_TargetPlatform.h ***/
  133. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  134. /*** Start of inlined file: juce_Config.h ***/
  135. #ifndef __JUCE_CONFIG_JUCEHEADER__
  136. #define __JUCE_CONFIG_JUCEHEADER__
  137. #ifndef JUCE_NAMESPACE
  138. #define JUCE_NAMESPACE juce
  139. #endif
  140. #ifndef JUCE_FORCE_DEBUG
  141. //#define JUCE_FORCE_DEBUG 1
  142. #endif
  143. #ifndef JUCE_LOG_ASSERTIONS
  144. // #define JUCE_LOG_ASSERTIONS 1
  145. #endif
  146. #ifndef JUCE_ASIO
  147. #define JUCE_ASIO 1
  148. #endif
  149. #ifndef JUCE_WASAPI
  150. // #define JUCE_WASAPI 1
  151. #endif
  152. #ifndef JUCE_DIRECTSOUND
  153. #define JUCE_DIRECTSOUND 1
  154. #endif
  155. #ifndef JUCE_ALSA
  156. #define JUCE_ALSA 1
  157. #endif
  158. #ifndef JUCE_JACK
  159. #define JUCE_JACK 1
  160. #endif
  161. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  162. #define JUCE_QUICKTIME 1
  163. #endif
  164. #ifndef JUCE_OPENGL
  165. #define JUCE_OPENGL 1
  166. #endif
  167. #ifndef JUCE_USE_FLAC
  168. #define JUCE_USE_FLAC 1
  169. #endif
  170. #ifndef JUCE_USE_OGGVORBIS
  171. #define JUCE_USE_OGGVORBIS 1
  172. #endif
  173. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  174. #define JUCE_USE_CDBURNER 1
  175. #endif
  176. #ifndef JUCE_USE_CDREADER
  177. #define JUCE_USE_CDREADER 1
  178. #endif
  179. #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
  180. // #define JUCE_USE_CAMERA 1
  181. #endif
  182. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  183. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  184. #endif
  185. #ifndef JUCE_USE_XINERAMA
  186. #define JUCE_USE_XINERAMA 1
  187. #endif
  188. #ifndef JUCE_USE_XSHM
  189. #define JUCE_USE_XSHM 1
  190. #endif
  191. #ifndef JUCE_PLUGINHOST_VST
  192. // #define JUCE_PLUGINHOST_VST 1
  193. #endif
  194. #ifndef JUCE_PLUGINHOST_AU
  195. // #define JUCE_PLUGINHOST_AU 1
  196. #endif
  197. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  198. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  199. #endif
  200. #ifndef JUCE_WEB_BROWSER
  201. #define JUCE_WEB_BROWSER 1
  202. #endif
  203. #ifndef JUCE_SUPPORT_CARBON
  204. #define JUCE_SUPPORT_CARBON 1
  205. #endif
  206. #ifndef JUCE_INCLUDE_ZLIB_CODE
  207. #define JUCE_INCLUDE_ZLIB_CODE 1
  208. #endif
  209. #ifndef JUCE_INCLUDE_FLAC_CODE
  210. #define JUCE_INCLUDE_FLAC_CODE 1
  211. #endif
  212. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  213. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  214. #endif
  215. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  216. #define JUCE_INCLUDE_PNGLIB_CODE 1
  217. #endif
  218. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  219. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  220. #endif
  221. #ifndef JUCE_CHECK_MEMORY_LEAKS
  222. #define JUCE_CHECK_MEMORY_LEAKS 1
  223. #endif
  224. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  225. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  226. #endif
  227. #ifndef JUCE_STRINGS_ARE_UNICODE
  228. #define JUCE_STRINGS_ARE_UNICODE 1
  229. #endif
  230. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  231. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  232. #undef JUCE_QUICKTIME
  233. #define JUCE_QUICKTIME 0
  234. #undef JUCE_OPENGL
  235. #define JUCE_OPENGL 0
  236. #undef JUCE_USE_CDBURNER
  237. #define JUCE_USE_CDBURNER 0
  238. #undef JUCE_USE_CDREADER
  239. #define JUCE_USE_CDREADER 0
  240. #undef JUCE_WEB_BROWSER
  241. #define JUCE_WEB_BROWSER 0
  242. #undef JUCE_PLUGINHOST_AU
  243. #define JUCE_PLUGINHOST_AU 0
  244. #undef JUCE_PLUGINHOST_VST
  245. #define JUCE_PLUGINHOST_VST 0
  246. #endif
  247. #endif
  248. /*** End of inlined file: juce_Config.h ***/
  249. #ifdef JUCE_NAMESPACE
  250. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  251. #define END_JUCE_NAMESPACE }
  252. #else
  253. #define BEGIN_JUCE_NAMESPACE
  254. #define END_JUCE_NAMESPACE
  255. #endif
  256. /*** Start of inlined file: juce_PlatformDefs.h ***/
  257. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  258. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  259. #ifdef JUCE_FORCE_DEBUG
  260. #undef JUCE_DEBUG
  261. #if JUCE_FORCE_DEBUG
  262. #define JUCE_DEBUG 1
  263. #endif
  264. #endif
  265. #if JUCE_MSVC
  266. #define JUCE_CALLTYPE __stdcall
  267. #else
  268. #define JUCE_CALLTYPE
  269. #endif
  270. // Debugging and assertion macros
  271. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  272. #if JUCE_LOG_ASSERTIONS
  273. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  274. #elif defined (JUCE_DEBUG)
  275. #define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
  276. #else
  277. #define juce_LogCurrentAssertion
  278. #endif
  279. #ifdef JUCE_DEBUG
  280. // If debugging is enabled..
  281. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  282. #define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
  283. // Assertions..
  284. #if JUCE_WINDOWS || DOXYGEN
  285. #if JUCE_USE_INTRINSICS
  286. #pragma intrinsic (__debugbreak)
  287. #define juce_breakDebugger __debugbreak();
  288. #elif JUCE_GCC
  289. #define juce_breakDebugger asm("int $3");
  290. #else
  291. #define juce_breakDebugger { __asm int 3 }
  292. #endif
  293. #elif JUCE_MAC
  294. #define juce_breakDebugger Debugger();
  295. #elif JUCE_IPHONE
  296. #define juce_breakDebugger kill (0, SIGTRAP);
  297. #elif JUCE_LINUX
  298. #define juce_breakDebugger kill (0, SIGTRAP);
  299. #endif
  300. /** This will always cause an assertion failure.
  301. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  302. in juce_Config.h).
  303. @see jassert()
  304. */
  305. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  306. /** Platform-independent assertion macro.
  307. This gets optimised out when not being built with debugging turned on.
  308. Be careful not to call any functions within its arguments that are vital to
  309. the behaviour of the program, because these won't get called in the release
  310. build.
  311. @see jassertfalse
  312. */
  313. #define jassert(expression) { if (! (expression)) jassertfalse }
  314. #else
  315. // If debugging is disabled, these dummy debug and assertion macros are used..
  316. #define DBG(dbgtext)
  317. #define DBG_PRINTF(dbgprintf)
  318. #define jassertfalse { juce_LogCurrentAssertion }
  319. #if JUCE_LOG_ASSERTIONS
  320. #define jassert(expression) { if (! (expression)) jassertfalse }
  321. #else
  322. #define jassert(a) { }
  323. #endif
  324. #endif
  325. #ifndef DOXYGEN
  326. template <bool b> struct JuceStaticAssert;
  327. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  328. #endif
  329. /** A compile-time assertion macro.
  330. If the expression parameter is false, the macro will cause a compile error.
  331. */
  332. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  333. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  334. #define JUCE_TRY try
  335. #define JUCE_CATCH_EXCEPTION \
  336. catch (const std::exception& e) \
  337. { \
  338. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  339. } \
  340. catch (...) \
  341. { \
  342. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  343. }
  344. #define JUCE_CATCH_ALL catch (...) {}
  345. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  346. #else
  347. #define JUCE_TRY
  348. #define JUCE_CATCH_EXCEPTION
  349. #define JUCE_CATCH_ALL
  350. #define JUCE_CATCH_ALL_ASSERT
  351. #endif
  352. // Macros for inlining.
  353. #if JUCE_MSVC
  354. #ifndef JUCE_DEBUG
  355. #define forcedinline __forceinline
  356. #else
  357. #define forcedinline inline
  358. #endif
  359. #else
  360. #ifndef JUCE_DEBUG
  361. #define forcedinline inline __attribute__((always_inline))
  362. #else
  363. #define forcedinline inline
  364. #endif
  365. #endif
  366. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  367. /*** End of inlined file: juce_PlatformDefs.h ***/
  368. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  369. #if JUCE_MSVC
  370. #pragma warning (push)
  371. #pragma warning (disable: 4514 4245 4100)
  372. #endif
  373. #include <cstdlib>
  374. #include <cstdarg>
  375. #include <climits>
  376. #include <limits>
  377. #include <cmath>
  378. #include <cwchar>
  379. #include <stdexcept>
  380. #include <typeinfo>
  381. #include <cstring>
  382. #include <cstdio>
  383. #include <iostream>
  384. #if JUCE_USE_INTRINSICS
  385. #include <intrin.h>
  386. #endif
  387. #if JUCE_MAC || JUCE_IPHONE
  388. #include <libkern/OSAtomic.h>
  389. #endif
  390. #if JUCE_LINUX
  391. #include <signal.h>
  392. #endif
  393. #if JUCE_MSVC && JUCE_DEBUG
  394. #include <crtdbg.h>
  395. #endif
  396. #if JUCE_MSVC
  397. #include <malloc.h>
  398. #pragma warning (pop)
  399. #if ! JUCE_PUBLIC_INCLUDES
  400. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  401. #endif
  402. #endif
  403. // DLL building settings on Win32
  404. #if JUCE_MSVC
  405. #ifdef JUCE_DLL_BUILD
  406. #define JUCE_API __declspec (dllexport)
  407. #pragma warning (disable: 4251)
  408. #elif defined (JUCE_DLL)
  409. #define JUCE_API __declspec (dllimport)
  410. #pragma warning (disable: 4251)
  411. #endif
  412. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  413. #ifdef JUCE_DLL_BUILD
  414. #define JUCE_API __attribute__ ((visibility("default")))
  415. #endif
  416. #endif
  417. #ifndef JUCE_API
  418. #define JUCE_API
  419. #endif
  420. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  421. // Now include some basics that are needed by most of the Juce classes...
  422. BEGIN_JUCE_NAMESPACE
  423. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  424. #if JUCE_LOG_ASSERTIONS
  425. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  426. #endif
  427. /*** Start of inlined file: juce_Memory.h ***/
  428. #ifndef __JUCE_MEMORY_JUCEHEADER__
  429. #define __JUCE_MEMORY_JUCEHEADER__
  430. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  431. #ifndef JUCE_DLL
  432. // Win32 debug non-DLL versions..
  433. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  434. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  435. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  436. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  437. #else
  438. // Win32 debug DLL versions..
  439. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  440. // way all juce calls in the DLL and in the host API will all use the same allocator.
  441. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  442. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  443. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  444. extern JUCE_API void juce_DebugFree (void* const block);
  445. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  446. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  447. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  448. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  449. #endif
  450. #if ! defined (_AFXDLL)
  451. #define juce_UseDebuggingNewOperator \
  452. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  453. static void* operator new (size_t, void* p) { return p; } \
  454. static void operator delete (void* p) { juce_free (p); } \
  455. static void operator delete (void*, void*) { }
  456. #endif
  457. #elif defined (JUCE_DLL)
  458. // Win32 DLL (release) versions..
  459. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  460. // way all juce calls in the DLL and in the host API will all use the same allocator.
  461. extern JUCE_API void* juce_Malloc (const int size);
  462. extern JUCE_API void* juce_Calloc (const int size);
  463. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  464. extern JUCE_API void juce_Free (void* const block);
  465. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  466. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  467. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  468. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  469. #define juce_UseDebuggingNewOperator \
  470. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  471. static void* operator new (size_t, void* p) { return p; } \
  472. static void operator delete (void* p) { juce_free (p); } \
  473. static void operator delete (void*, void*) { }
  474. #else
  475. // Mac, Linux and Win32 (release) versions..
  476. #define juce_malloc(numBytes) malloc (numBytes)
  477. #define juce_calloc(numBytes) calloc (1, numBytes)
  478. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  479. #define juce_free(location) free (location)
  480. #endif
  481. #ifndef juce_UseDebuggingNewOperator
  482. #define juce_UseDebuggingNewOperator
  483. #endif
  484. #if JUCE_MSVC
  485. #define juce_ThreadLocal __declspec(thread)
  486. #else
  487. #define juce_ThreadLocal __thread
  488. #endif
  489. #if JUCE_MINGW
  490. #define alloca __builtin_alloca
  491. #endif
  492. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  493. template <typename Type>
  494. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  495. template <typename Type>
  496. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  497. #endif // __JUCE_MEMORY_JUCEHEADER__
  498. /*** End of inlined file: juce_Memory.h ***/
  499. /*** Start of inlined file: juce_MathsFunctions.h ***/
  500. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  501. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  502. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  503. typedef signed char int8;
  504. typedef unsigned char uint8;
  505. typedef signed short int16;
  506. typedef unsigned short uint16;
  507. typedef signed int int32;
  508. typedef unsigned int uint32;
  509. #if JUCE_MSVC
  510. typedef __int64 int64;
  511. typedef unsigned __int64 uint64;
  512. #define literal64bit(longLiteral) ((__int64) longLiteral)
  513. #else
  514. typedef long long int64;
  515. typedef unsigned long long uint64;
  516. #define literal64bit(longLiteral) (longLiteral##LL)
  517. #endif
  518. #if JUCE_64BIT
  519. typedef int64 pointer_sized_int;
  520. typedef uint64 pointer_sized_uint;
  521. #elif _MSC_VER >= 1300
  522. typedef _W64 int pointer_sized_int;
  523. typedef _W64 unsigned int pointer_sized_uint;
  524. #else
  525. typedef int pointer_sized_int;
  526. typedef unsigned int pointer_sized_uint;
  527. #endif
  528. typedef wchar_t juce_wchar;
  529. // Some indispensible min/max functions
  530. template <typename Type>
  531. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  532. template <typename Type>
  533. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  534. template <typename Type>
  535. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  536. template <typename Type>
  537. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  538. template <typename Type>
  539. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  540. template <typename Type>
  541. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  542. template <typename Type>
  543. inline Type jlimit (const Type lowerLimit,
  544. const Type upperLimit,
  545. const Type valueToConstrain) throw()
  546. {
  547. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  548. return (valueToConstrain < lowerLimit) ? lowerLimit
  549. : ((valueToConstrain > upperLimit) ? upperLimit
  550. : valueToConstrain);
  551. }
  552. template <typename Type>
  553. inline void swapVariables (Type& variable1, Type& variable2)
  554. {
  555. const Type tempVal = variable1;
  556. variable1 = variable2;
  557. variable2 = tempVal;
  558. }
  559. template <typename Type>
  560. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  561. // Some useful maths functions that aren't always present with all compilers and build settings.
  562. inline double juce_hypot (double a, double b)
  563. {
  564. #if JUCE_WINDOWS
  565. return _hypot (a, b);
  566. #else
  567. return hypot (a, b);
  568. #endif
  569. }
  570. inline float juce_hypotf (float a, float b)
  571. {
  572. #if JUCE_WINDOWS
  573. return (float) _hypot (a, b);
  574. #else
  575. return hypotf (a, b);
  576. #endif
  577. }
  578. inline int64 abs64 (const int64 n)
  579. {
  580. return (n >= 0) ? n : -n;
  581. }
  582. const double double_Pi = 3.1415926535897932384626433832795;
  583. const float float_Pi = 3.14159265358979323846f;
  584. template <typename FloatingPointType>
  585. inline bool juce_isfinite (FloatingPointType value)
  586. {
  587. #if JUCE_WINDOWS
  588. return _finite (value);
  589. #else
  590. return std::isfinite (value);
  591. #endif
  592. }
  593. template <typename FloatType>
  594. inline int roundToInt (const FloatType value) throw()
  595. {
  596. union { int asInt[2]; double asDouble; } n;
  597. n.asDouble = ((double) value) + 6755399441055744.0;
  598. #if JUCE_BIG_ENDIAN
  599. return n.asInt [1];
  600. #else
  601. return n.asInt [0];
  602. #endif
  603. }
  604. inline int roundToIntAccurate (const double value) throw()
  605. {
  606. return roundToInt (value + 1.5e-8);
  607. }
  608. inline int roundDoubleToInt (const double value) throw()
  609. {
  610. return roundToInt (value);
  611. }
  612. inline int roundFloatToInt (const float value) throw()
  613. {
  614. return roundToInt (value);
  615. }
  616. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  617. /*** End of inlined file: juce_MathsFunctions.h ***/
  618. /*** Start of inlined file: juce_ByteOrder.h ***/
  619. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  620. #define __JUCE_BYTEORDER_JUCEHEADER__
  621. class JUCE_API ByteOrder
  622. {
  623. public:
  624. static uint16 swap (uint16 value);
  625. static uint32 swap (uint32 value);
  626. static uint64 swap (uint64 value);
  627. static uint16 swapIfBigEndian (const uint16 value);
  628. static uint32 swapIfBigEndian (const uint32 value);
  629. static uint64 swapIfBigEndian (const uint64 value);
  630. static uint16 swapIfLittleEndian (const uint16 value);
  631. static uint32 swapIfLittleEndian (const uint32 value);
  632. static uint64 swapIfLittleEndian (const uint64 value);
  633. static uint32 littleEndianInt (const char* const bytes);
  634. static uint16 littleEndianShort (const char* const bytes);
  635. static uint32 bigEndianInt (const char* const bytes);
  636. static uint16 bigEndianShort (const char* const bytes);
  637. static int littleEndian24Bit (const char* const bytes);
  638. static int bigEndian24Bit (const char* const bytes);
  639. static void littleEndian24BitToChars (const int value, char* const destBytes);
  640. static void bigEndian24BitToChars (const int value, char* const destBytes);
  641. static bool isBigEndian();
  642. };
  643. #if JUCE_USE_INTRINSICS
  644. #pragma intrinsic (_byteswap_ulong)
  645. #endif
  646. inline uint16 ByteOrder::swap (uint16 n)
  647. {
  648. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  649. return (uint16) _byteswap_ushort (n);
  650. #else
  651. return (uint16) ((n << 8) | (n >> 8));
  652. #endif
  653. }
  654. inline uint32 ByteOrder::swap (uint32 n)
  655. {
  656. #if JUCE_MAC || JUCE_IPHONE
  657. return OSSwapInt32 (n);
  658. #elif JUCE_GCC
  659. asm("bswap %%eax" : "=a"(n) : "a"(n));
  660. return n;
  661. #elif JUCE_USE_INTRINSICS
  662. return _byteswap_ulong (n);
  663. #else
  664. __asm {
  665. mov eax, n
  666. bswap eax
  667. mov n, eax
  668. }
  669. return n;
  670. #endif
  671. }
  672. inline uint64 ByteOrder::swap (uint64 value)
  673. {
  674. #if JUCE_MAC || JUCE_IPHONE
  675. return OSSwapInt64 (value);
  676. #elif JUCE_USE_INTRINSICS
  677. return _byteswap_uint64 (value);
  678. #else
  679. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  680. #endif
  681. }
  682. #if JUCE_LITTLE_ENDIAN
  683. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  684. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  685. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  686. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  687. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  688. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  689. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  690. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  691. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  692. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  693. inline bool ByteOrder::isBigEndian() { return false; }
  694. #else
  695. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  696. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  697. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  698. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  699. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  700. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  701. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  702. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  703. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  704. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  705. inline bool ByteOrder::isBigEndian() { return true; }
  706. #endif
  707. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  708. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  709. 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); }
  710. 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); }
  711. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  712. /*** End of inlined file: juce_ByteOrder.h ***/
  713. /*** Start of inlined file: juce_Logger.h ***/
  714. #ifndef __JUCE_LOGGER_JUCEHEADER__
  715. #define __JUCE_LOGGER_JUCEHEADER__
  716. /*** Start of inlined file: juce_String.h ***/
  717. #ifndef __JUCE_STRING_JUCEHEADER__
  718. #define __JUCE_STRING_JUCEHEADER__
  719. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  720. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  721. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  722. #if JUCE_STRINGS_ARE_UNICODE
  723. #define JUCE_T(stringLiteral) (L##stringLiteral)
  724. typedef juce_wchar tchar;
  725. #define juce_tcharToWideChar(c) (c)
  726. #else
  727. #define JUCE_T(stringLiteral) (stringLiteral)
  728. typedef char tchar;
  729. #define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
  730. #endif
  731. #if ! JUCE_DONT_DEFINE_MACROS
  732. #define T(stringLiteral) JUCE_T(stringLiteral)
  733. #endif
  734. class JUCE_API CharacterFunctions
  735. {
  736. public:
  737. static int length (const char* const s) throw();
  738. static int length (const juce_wchar* const s) throw();
  739. static void copy (char* dest, const char* src, const int maxBytes) throw();
  740. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  741. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  742. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  743. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  744. static void append (char* dest, const char* src) throw();
  745. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  746. static int compare (const char* const s1, const char* const s2) throw();
  747. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  748. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  749. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  750. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  751. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  752. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  753. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  754. static const char* find (const char* const haystack, const char* const needle) throw();
  755. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  756. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  757. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  758. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  759. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  760. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  761. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  762. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  763. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  764. static int getIntValue (const char* const s) throw();
  765. static int getIntValue (const juce_wchar* s) throw();
  766. static int64 getInt64Value (const char* s) throw();
  767. static int64 getInt64Value (const juce_wchar* s) throw();
  768. static double getDoubleValue (const char* const s) throw();
  769. static double getDoubleValue (const juce_wchar* const s) throw();
  770. static char toUpperCase (const char character) throw();
  771. static juce_wchar toUpperCase (const juce_wchar character) throw();
  772. static void toUpperCase (char* s) throw();
  773. static void toUpperCase (juce_wchar* s) throw();
  774. static bool isUpperCase (const char character) throw();
  775. static bool isUpperCase (const juce_wchar character) throw();
  776. static char toLowerCase (const char character) throw();
  777. static juce_wchar toLowerCase (const juce_wchar character) throw();
  778. static void toLowerCase (char* s) throw();
  779. static void toLowerCase (juce_wchar* s) throw();
  780. static bool isLowerCase (const char character) throw();
  781. static bool isLowerCase (const juce_wchar character) throw();
  782. static bool isWhitespace (const char character) throw();
  783. static bool isWhitespace (const juce_wchar character) throw();
  784. static bool isDigit (const char character) throw();
  785. static bool isDigit (const juce_wchar character) throw();
  786. static bool isLetter (const char character) throw();
  787. static bool isLetter (const juce_wchar character) throw();
  788. static bool isLetterOrDigit (const char character) throw();
  789. static bool isLetterOrDigit (const juce_wchar character) throw();
  790. static int getHexDigitValue (const tchar digit) throw();
  791. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  792. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  793. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  794. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  795. };
  796. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  797. /*** End of inlined file: juce_CharacterFunctions.h ***/
  798. class JUCE_API String
  799. {
  800. public:
  801. String() throw();
  802. String (const String& other) throw();
  803. String (const char* const text) throw();
  804. String (const char* const text,
  805. const size_t maxChars) throw();
  806. String (const juce_wchar* const unicodeText) throw();
  807. String (const juce_wchar* const unicodeText,
  808. const size_t maxChars) throw();
  809. static const String charToString (const tchar character) throw();
  810. ~String() throw();
  811. static const String empty;
  812. int hashCode() const throw();
  813. int64 hashCode64() const throw();
  814. int length() const throw();
  815. // Assignment and concatenation operators..
  816. const String& operator= (const tchar* const other) throw();
  817. const String& operator= (const String& other) throw();
  818. const String& operator+= (const tchar* const textToAppend) throw();
  819. const String& operator+= (const String& stringToAppend) throw();
  820. const String& operator+= (const char characterToAppend) throw();
  821. const String& operator+= (const juce_wchar characterToAppend) throw();
  822. void append (const tchar* const textToAppend,
  823. const int maxCharsToTake) throw();
  824. const String operator+ (const String& stringToAppend) const throw();
  825. const String operator+ (const tchar* const textToAppend) const throw();
  826. const String operator+ (const tchar characterToAppend) const throw();
  827. String& operator<< (const char n) throw();
  828. String& operator<< (const juce_wchar n) throw();
  829. String& operator<< (const char* const text) throw();
  830. String& operator<< (const juce_wchar* const text) throw();
  831. String& operator<< (const String& text) throw();
  832. String& operator<< (const short number) throw();
  833. String& operator<< (const int number) throw();
  834. String& operator<< (const unsigned int number) throw();
  835. String& operator<< (const long number) throw();
  836. String& operator<< (const unsigned long number) throw();
  837. String& operator<< (const float number) throw();
  838. String& operator<< (const double number) throw();
  839. // Comparison methods..
  840. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  841. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  842. bool operator== (const String& other) const throw();
  843. bool operator== (const tchar* const other) const throw();
  844. bool operator!= (const String& other) const throw();
  845. bool operator!= (const tchar* const other) const throw();
  846. bool equalsIgnoreCase (const String& other) const throw();
  847. bool equalsIgnoreCase (const tchar* const other) const throw();
  848. bool operator> (const String& other) const throw();
  849. bool operator< (const tchar* const other) const throw();
  850. bool operator>= (const String& other) const throw();
  851. bool operator<= (const tchar* const other) const throw();
  852. int compare (const tchar* const other) const throw();
  853. int compareIgnoreCase (const tchar* const other) const throw();
  854. int compareLexicographically (const tchar* const other) const throw();
  855. bool startsWith (const tchar* const text) const throw();
  856. bool startsWithChar (const tchar character) const throw();
  857. bool startsWithIgnoreCase (const tchar* const text) const throw();
  858. bool endsWith (const tchar* const text) const throw();
  859. bool endsWithChar (const tchar character) const throw();
  860. bool endsWithIgnoreCase (const tchar* const text) const throw();
  861. bool contains (const tchar* const text) const throw();
  862. bool containsChar (const tchar character) const throw();
  863. bool containsIgnoreCase (const tchar* const text) const throw();
  864. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  865. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  866. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  867. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  868. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  869. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  870. bool containsNonWhitespaceChars() const throw();
  871. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  872. // Substring location methods..
  873. int indexOfChar (const tchar characterToLookFor) const throw();
  874. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  875. int indexOfAnyOf (const tchar* const charactersToLookFor,
  876. const int startIndex = 0,
  877. const bool ignoreCase = false) const throw();
  878. int indexOf (const tchar* const text) const throw();
  879. int indexOf (const int startIndex,
  880. const tchar* const textToLookFor) const throw();
  881. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  882. int indexOfIgnoreCase (const int startIndex,
  883. const tchar* const textToLookFor) const throw();
  884. int lastIndexOfChar (const tchar character) const throw();
  885. int lastIndexOf (const tchar* const textToLookFor) const throw();
  886. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  887. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  888. const bool ignoreCase = false) const throw();
  889. // Substring extraction and manipulation methods..
  890. /** Returns the character at this index in the string.
  891. No checks are made to see if the index is within a valid range, so be careful!
  892. */
  893. inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  894. tchar& operator[] (const int index) throw();
  895. tchar getLastCharacter() const throw();
  896. const String substring (int startIndex,
  897. int endIndex) const throw();
  898. const String substring (const int startIndex) const throw();
  899. const String dropLastCharacters (const int numberToDrop) const throw();
  900. const String getLastCharacters (const int numCharacters) const throw();
  901. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  902. const bool includeSubStringInResult,
  903. const bool ignoreCase) const throw();
  904. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  905. const bool includeSubStringInResult,
  906. const bool ignoreCase) const throw();
  907. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  908. const bool includeSubStringInResult,
  909. const bool ignoreCase) const throw();
  910. const String upToLastOccurrenceOf (const tchar* substringToFind,
  911. const bool includeSubStringInResult,
  912. const bool ignoreCase) const throw();
  913. const String trim() const throw();
  914. const String trimStart() const throw();
  915. const String trimEnd() const throw();
  916. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  917. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  918. const String toUpperCase() const throw();
  919. const String toLowerCase() const throw();
  920. const String replaceSection (int startIndex,
  921. int numCharactersToReplace,
  922. const tchar* const stringToInsert) const throw();
  923. const String replace (const tchar* const stringToReplace,
  924. const tchar* const stringToInsertInstead,
  925. const bool ignoreCase = false) const throw();
  926. const String replaceCharacter (const tchar characterToReplace,
  927. const tchar characterToInsertInstead) const throw();
  928. const String replaceCharacters (const String& charactersToReplace,
  929. const tchar* const charactersToInsertInstead) const throw();
  930. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  931. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  932. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  933. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  934. bool isQuotedString() const throw();
  935. const String unquoted() const throw();
  936. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  937. void printf (const tchar* const format, ...) throw();
  938. static const String formatted (const tchar* const format, ...) throw();
  939. void vprintf (const tchar* const format, va_list& args) throw();
  940. static const String repeatedString (const tchar* const stringToRepeat,
  941. int numberOfTimesToRepeat) throw();
  942. static const String createStringFromData (const void* const data,
  943. const int size) throw();
  944. // Numeric conversions..
  945. explicit String (const int decimalInteger) throw();
  946. explicit String (const unsigned int decimalInteger) throw();
  947. explicit String (const short decimalInteger) throw();
  948. explicit String (const unsigned short decimalInteger) throw();
  949. explicit String (const int64 largeIntegerValue) throw();
  950. explicit String (const uint64 largeIntegerValue) throw();
  951. explicit String (const float floatValue,
  952. const int numberOfDecimalPlaces = 0) throw();
  953. explicit String (const double doubleValue,
  954. const int numberOfDecimalPlaces = 0) throw();
  955. int getIntValue() const throw();
  956. int64 getLargeIntValue() const throw();
  957. int getTrailingIntValue() const throw();
  958. float getFloatValue() const throw();
  959. double getDoubleValue() const throw();
  960. int getHexValue32() const throw();
  961. int64 getHexValue64() const throw();
  962. static const String toHexString (const int number) throw();
  963. static const String toHexString (const int64 number) throw();
  964. static const String toHexString (const short number) throw();
  965. static const String toHexString (const unsigned char* data,
  966. const int size,
  967. const int groupSize = 1) throw();
  968. // Casting to character arrays..
  969. #if JUCE_STRINGS_ARE_UNICODE
  970. operator const char*() const throw();
  971. inline operator const juce_wchar*() const throw() { return text->text; }
  972. #else
  973. inline operator const char*() const throw() { return text->text; }
  974. operator const juce_wchar*() const throw();
  975. #endif
  976. void copyToBuffer (char* const destBuffer,
  977. const int maxCharsToCopy) const throw();
  978. void copyToBuffer (juce_wchar* const destBuffer,
  979. const int maxCharsToCopy) const throw();
  980. int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
  981. const char* toUTF8() const throw();
  982. static const String fromUTF8 (const uint8* const utf8buffer,
  983. int bufferSizeBytes = -1) throw();
  984. void preallocateStorage (const size_t numCharsNeeded) throw();
  985. class JUCE_API Concatenator
  986. {
  987. public:
  988. Concatenator (String& stringToAppendTo);
  989. ~Concatenator();
  990. void append (const String& s);
  991. private:
  992. String& result;
  993. int nextIndex;
  994. Concatenator (const Concatenator&);
  995. const Concatenator& operator= (const Concatenator&);
  996. };
  997. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  998. private:
  999. struct InternalRefCountedStringHolder
  1000. {
  1001. int refCount;
  1002. int allocatedNumChars;
  1003. #if JUCE_STRINGS_ARE_UNICODE
  1004. wchar_t text[1];
  1005. #else
  1006. char text[1];
  1007. #endif
  1008. };
  1009. InternalRefCountedStringHolder* text;
  1010. static InternalRefCountedStringHolder emptyString;
  1011. // internal constructor that preallocates a certain amount of memory
  1012. String (const int numChars, const int dummyVariable) throw();
  1013. void createInternal (const int numChars) throw();
  1014. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  1015. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  1016. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  1017. void dupeInternalIfMultiplyReferenced() throw();
  1018. };
  1019. const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
  1020. const String& string2) throw();
  1021. const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
  1022. const String& string2) throw();
  1023. #endif // __JUCE_STRING_JUCEHEADER__
  1024. /*** End of inlined file: juce_String.h ***/
  1025. class JUCE_API Logger
  1026. {
  1027. public:
  1028. virtual ~Logger();
  1029. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1030. const bool deleteOldLogger = false);
  1031. static void JUCE_CALLTYPE writeToLog (const String& message);
  1032. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1033. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1034. protected:
  1035. Logger();
  1036. virtual void logMessage (const String& message) = 0;
  1037. };
  1038. #endif // __JUCE_LOGGER_JUCEHEADER__
  1039. /*** End of inlined file: juce_Logger.h ***/
  1040. END_JUCE_NAMESPACE
  1041. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1042. /*** End of inlined file: juce_StandardHeader.h ***/
  1043. BEGIN_JUCE_NAMESPACE
  1044. #if JUCE_MSVC
  1045. // this is set explicitly in case the app is using a different packing size.
  1046. #pragma pack (push, 8)
  1047. #pragma warning (push)
  1048. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1049. #endif
  1050. // this is where all the class header files get brought in..
  1051. /*** Start of inlined file: juce_core_includes.h ***/
  1052. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1053. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1054. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1055. /*** Start of inlined file: juce_Array.h ***/
  1056. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1057. #define __JUCE_ARRAY_JUCEHEADER__
  1058. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1059. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1060. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1061. /*** Start of inlined file: juce_HeapBlock.h ***/
  1062. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1063. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1064. template <class ElementType>
  1065. class HeapBlock
  1066. {
  1067. public:
  1068. HeapBlock() throw() : data (0)
  1069. {
  1070. }
  1071. HeapBlock (const size_t numElements)
  1072. : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType)))
  1073. {
  1074. }
  1075. ~HeapBlock()
  1076. {
  1077. ::juce_free (data);
  1078. }
  1079. inline operator ElementType*() const throw() { return data; }
  1080. inline operator void*() const throw() { return (void*) data; }
  1081. inline ElementType* operator->() const throw() { return data; }
  1082. template <class CastType>
  1083. inline operator CastType*() const throw() { return (CastType*) data; }
  1084. template <typename IndexType>
  1085. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1086. template <typename IndexType>
  1087. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1088. inline ElementType** operator&() const throw() { return (ElementType**) &data; }
  1089. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1090. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1091. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1092. {
  1093. ::juce_free (data);
  1094. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1095. }
  1096. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1097. {
  1098. ::juce_free (data);
  1099. data = (ElementType*) ::juce_calloc (newNumElements * elementSize);
  1100. }
  1101. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1102. {
  1103. ::juce_free (data);
  1104. if (initialiseToZero)
  1105. data = (ElementType*) ::juce_calloc (newNumElements * sizeof (ElementType));
  1106. else
  1107. data = (ElementType*) ::juce_malloc (newNumElements * sizeof (ElementType));
  1108. }
  1109. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1110. {
  1111. if (data == 0)
  1112. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1113. else
  1114. data = (ElementType*) ::juce_realloc (data, newNumElements * elementSize);
  1115. }
  1116. void free()
  1117. {
  1118. ::juce_free (data);
  1119. data = 0;
  1120. }
  1121. void swapWith (HeapBlock <ElementType>& other) throw()
  1122. {
  1123. swapVariables (data, other.data);
  1124. }
  1125. private:
  1126. ElementType* data;
  1127. HeapBlock (const HeapBlock&);
  1128. const HeapBlock& operator= (const HeapBlock&);
  1129. };
  1130. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1131. /*** End of inlined file: juce_HeapBlock.h ***/
  1132. template <class ElementType, class TypeOfCriticalSectionToUse>
  1133. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1134. {
  1135. public:
  1136. ArrayAllocationBase() throw()
  1137. : numAllocated (0)
  1138. {
  1139. }
  1140. ~ArrayAllocationBase()
  1141. {
  1142. }
  1143. void setAllocatedSize (const int numElements)
  1144. {
  1145. if (numAllocated != numElements)
  1146. {
  1147. if (numElements > 0)
  1148. elements.realloc (numElements);
  1149. else
  1150. elements.free();
  1151. numAllocated = numElements;
  1152. }
  1153. }
  1154. void ensureAllocatedSize (const int minNumElements)
  1155. {
  1156. if (minNumElements > numAllocated)
  1157. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1158. }
  1159. void shrinkToNoMoreThan (const int maxNumElements)
  1160. {
  1161. if (maxNumElements < numAllocated)
  1162. setAllocatedSize (maxNumElements);
  1163. }
  1164. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1165. {
  1166. elements.swapWith (other.elements);
  1167. swapVariables (numAllocated, other.numAllocated);
  1168. }
  1169. HeapBlock <ElementType> elements;
  1170. int numAllocated;
  1171. private:
  1172. ArrayAllocationBase (const ArrayAllocationBase&);
  1173. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1174. };
  1175. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1176. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1177. /*** Start of inlined file: juce_ElementComparator.h ***/
  1178. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1179. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1180. template <class ElementType, class ElementComparator>
  1181. static void sortArray (ElementComparator& comparator,
  1182. ElementType* const array,
  1183. int firstElement,
  1184. int lastElement,
  1185. const bool retainOrderOfEquivalentItems)
  1186. {
  1187. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1188. // avoids getting warning messages about the parameter being unused
  1189. if (lastElement > firstElement)
  1190. {
  1191. if (retainOrderOfEquivalentItems)
  1192. {
  1193. for (int i = firstElement; i < lastElement; ++i)
  1194. {
  1195. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1196. {
  1197. const ElementType temp = array [i];
  1198. array [i] = array[i + 1];
  1199. array [i + 1] = temp;
  1200. if (i > firstElement)
  1201. i -= 2;
  1202. }
  1203. }
  1204. }
  1205. else
  1206. {
  1207. int fromStack[30], toStack[30];
  1208. int stackIndex = 0;
  1209. for (;;)
  1210. {
  1211. const int size = (lastElement - firstElement) + 1;
  1212. if (size <= 8)
  1213. {
  1214. int j = lastElement;
  1215. int maxIndex;
  1216. while (j > firstElement)
  1217. {
  1218. maxIndex = firstElement;
  1219. for (int k = firstElement + 1; k <= j; ++k)
  1220. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1221. maxIndex = k;
  1222. const ElementType temp = array [maxIndex];
  1223. array [maxIndex] = array[j];
  1224. array [j] = temp;
  1225. --j;
  1226. }
  1227. }
  1228. else
  1229. {
  1230. const int mid = firstElement + (size >> 1);
  1231. ElementType temp = array [mid];
  1232. array [mid] = array [firstElement];
  1233. array [firstElement] = temp;
  1234. int i = firstElement;
  1235. int j = lastElement + 1;
  1236. for (;;)
  1237. {
  1238. while (++i <= lastElement
  1239. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1240. {}
  1241. while (--j > firstElement
  1242. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1243. {}
  1244. if (j < i)
  1245. break;
  1246. temp = array[i];
  1247. array[i] = array[j];
  1248. array[j] = temp;
  1249. }
  1250. temp = array [firstElement];
  1251. array [firstElement] = array[j];
  1252. array [j] = temp;
  1253. if (j - 1 - firstElement >= lastElement - i)
  1254. {
  1255. if (firstElement + 1 < j)
  1256. {
  1257. fromStack [stackIndex] = firstElement;
  1258. toStack [stackIndex] = j - 1;
  1259. ++stackIndex;
  1260. }
  1261. if (i < lastElement)
  1262. {
  1263. firstElement = i;
  1264. continue;
  1265. }
  1266. }
  1267. else
  1268. {
  1269. if (i < lastElement)
  1270. {
  1271. fromStack [stackIndex] = i;
  1272. toStack [stackIndex] = lastElement;
  1273. ++stackIndex;
  1274. }
  1275. if (firstElement + 1 < j)
  1276. {
  1277. lastElement = j - 1;
  1278. continue;
  1279. }
  1280. }
  1281. }
  1282. if (--stackIndex < 0)
  1283. break;
  1284. jassert (stackIndex < numElementsInArray (fromStack));
  1285. firstElement = fromStack [stackIndex];
  1286. lastElement = toStack [stackIndex];
  1287. }
  1288. }
  1289. }
  1290. }
  1291. template <class ElementType, class ElementComparator>
  1292. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1293. ElementType* const array,
  1294. const ElementType newElement,
  1295. int firstElement,
  1296. int lastElement)
  1297. {
  1298. jassert (firstElement <= lastElement);
  1299. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1300. // avoids getting warning messages about the parameter being unused
  1301. while (firstElement < lastElement)
  1302. {
  1303. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1304. {
  1305. ++firstElement;
  1306. break;
  1307. }
  1308. else
  1309. {
  1310. const int halfway = (firstElement + lastElement) >> 1;
  1311. if (halfway == firstElement)
  1312. {
  1313. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1314. ++firstElement;
  1315. break;
  1316. }
  1317. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1318. {
  1319. firstElement = halfway;
  1320. }
  1321. else
  1322. {
  1323. lastElement = halfway;
  1324. }
  1325. }
  1326. }
  1327. return firstElement;
  1328. }
  1329. template <class ElementType>
  1330. class IntegerElementComparator
  1331. {
  1332. public:
  1333. static int compareElements (const ElementType first,
  1334. const ElementType second) throw()
  1335. {
  1336. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1337. }
  1338. };
  1339. template <class ElementType>
  1340. class FloatElementComparator
  1341. {
  1342. public:
  1343. static int compareElements (const ElementType first,
  1344. const ElementType second) throw()
  1345. {
  1346. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1347. }
  1348. };
  1349. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1350. /*** End of inlined file: juce_ElementComparator.h ***/
  1351. /*** Start of inlined file: juce_CriticalSection.h ***/
  1352. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1353. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1354. class JUCE_API CriticalSection
  1355. {
  1356. public:
  1357. CriticalSection() throw();
  1358. ~CriticalSection() throw();
  1359. void enter() const throw();
  1360. bool tryEnter() const throw();
  1361. void exit() const throw();
  1362. juce_UseDebuggingNewOperator
  1363. private:
  1364. #if JUCE_WIN32
  1365. #if JUCE_64BIT
  1366. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1367. // block of memory here that's big enough to be used internally as a windows critical
  1368. // section object.
  1369. uint8 internal [44];
  1370. #else
  1371. uint8 internal [24];
  1372. #endif
  1373. #else
  1374. mutable pthread_mutex_t internal;
  1375. #endif
  1376. CriticalSection (const CriticalSection&);
  1377. const CriticalSection& operator= (const CriticalSection&);
  1378. };
  1379. class JUCE_API DummyCriticalSection
  1380. {
  1381. public:
  1382. inline DummyCriticalSection() throw() {}
  1383. inline ~DummyCriticalSection() throw() {}
  1384. inline void enter() const throw() {}
  1385. inline void exit() const throw() {}
  1386. };
  1387. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1388. /*** End of inlined file: juce_CriticalSection.h ***/
  1389. template <typename ElementType,
  1390. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1391. class Array
  1392. {
  1393. public:
  1394. Array() throw()
  1395. : numUsed (0)
  1396. {
  1397. }
  1398. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1399. {
  1400. other.lockArray();
  1401. numUsed = other.numUsed;
  1402. data.setAllocatedSize (other.numUsed);
  1403. for (int i = 0; i < numUsed; ++i)
  1404. new (data.elements + i) ElementType (other.data.elements[i]);
  1405. other.unlockArray();
  1406. }
  1407. explicit Array (const ElementType* values)
  1408. : numUsed (0)
  1409. {
  1410. while (*values != 0)
  1411. add (*values++);
  1412. }
  1413. Array (const ElementType* values, int numValues)
  1414. : numUsed (numValues)
  1415. {
  1416. data.setAllocatedSize (numValues);
  1417. for (int i = 0; i < numValues; ++i)
  1418. new (data.elements + i) ElementType (values[i]);
  1419. }
  1420. ~Array()
  1421. {
  1422. for (int i = 0; i < numUsed; ++i)
  1423. data.elements[i].~ElementType();
  1424. }
  1425. Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
  1426. {
  1427. if (this != &other)
  1428. {
  1429. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1430. swapWithArray (otherCopy);
  1431. }
  1432. return *this;
  1433. }
  1434. template <class OtherArrayType>
  1435. bool operator== (const OtherArrayType& other) const
  1436. {
  1437. data.enter();
  1438. if (numUsed != other.numUsed)
  1439. {
  1440. data.exit();
  1441. return false;
  1442. }
  1443. for (int i = numUsed; --i >= 0;)
  1444. {
  1445. if (data.elements [i] != other.data.elements [i])
  1446. {
  1447. data.exit();
  1448. return false;
  1449. }
  1450. }
  1451. data.exit();
  1452. return true;
  1453. }
  1454. template <class OtherArrayType>
  1455. bool operator!= (const OtherArrayType& other) const
  1456. {
  1457. return ! operator== (other);
  1458. }
  1459. void clear()
  1460. {
  1461. data.enter();
  1462. for (int i = 0; i < numUsed; ++i)
  1463. data.elements[i].~ElementType();
  1464. data.setAllocatedSize (0);
  1465. numUsed = 0;
  1466. data.exit();
  1467. }
  1468. void clearQuick()
  1469. {
  1470. data.enter();
  1471. for (int i = 0; i < numUsed; ++i)
  1472. data.elements[i].~ElementType();
  1473. numUsed = 0;
  1474. data.exit();
  1475. }
  1476. inline int size() const throw()
  1477. {
  1478. return numUsed;
  1479. }
  1480. inline ElementType operator[] (const int index) const
  1481. {
  1482. data.enter();
  1483. const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
  1484. ? data.elements [index]
  1485. : ElementType());
  1486. data.exit();
  1487. return result;
  1488. }
  1489. inline const ElementType getUnchecked (const int index) const
  1490. {
  1491. data.enter();
  1492. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1493. const ElementType result (data.elements [index]);
  1494. data.exit();
  1495. return result;
  1496. }
  1497. inline ElementType& getReference (const int index) const throw()
  1498. {
  1499. data.enter();
  1500. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1501. ElementType& result = data.elements [index];
  1502. data.exit();
  1503. return result;
  1504. }
  1505. inline ElementType getFirst() const
  1506. {
  1507. data.enter();
  1508. const ElementType result ((numUsed > 0) ? data.elements [0]
  1509. : ElementType());
  1510. data.exit();
  1511. return result;
  1512. }
  1513. inline ElementType getLast() const
  1514. {
  1515. data.enter();
  1516. const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
  1517. : ElementType());
  1518. data.exit();
  1519. return result;
  1520. }
  1521. int indexOf (const ElementType& elementToLookFor) const
  1522. {
  1523. int result = -1;
  1524. data.enter();
  1525. const ElementType* e = data.elements;
  1526. for (int i = numUsed; --i >= 0;)
  1527. {
  1528. if (elementToLookFor == *e)
  1529. {
  1530. result = (int) (e - data.elements);
  1531. break;
  1532. }
  1533. ++e;
  1534. }
  1535. data.exit();
  1536. return result;
  1537. }
  1538. bool contains (const ElementType& elementToLookFor) const
  1539. {
  1540. data.enter();
  1541. const ElementType* e = data.elements;
  1542. int num = numUsed;
  1543. while (num > 0)
  1544. {
  1545. if (elementToLookFor == *e)
  1546. {
  1547. data.exit();
  1548. return true;
  1549. }
  1550. --num;
  1551. ++e;
  1552. }
  1553. data.exit();
  1554. return false;
  1555. }
  1556. void add (const ElementType& newElement)
  1557. {
  1558. data.enter();
  1559. data.ensureAllocatedSize (numUsed + 1);
  1560. new (data.elements + numUsed++) ElementType (newElement);
  1561. data.exit();
  1562. }
  1563. void insert (int indexToInsertAt, const ElementType& newElement)
  1564. {
  1565. data.enter();
  1566. data.ensureAllocatedSize (numUsed + 1);
  1567. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1568. {
  1569. ElementType* const insertPos = data.elements + indexToInsertAt;
  1570. const int numberToMove = numUsed - indexToInsertAt;
  1571. if (numberToMove > 0)
  1572. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1573. new (insertPos) ElementType (newElement);
  1574. ++numUsed;
  1575. }
  1576. else
  1577. {
  1578. new (data.elements + numUsed++) ElementType (newElement);
  1579. }
  1580. data.exit();
  1581. }
  1582. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1583. int numberOfTimesToInsertIt)
  1584. {
  1585. if (numberOfTimesToInsertIt > 0)
  1586. {
  1587. data.enter();
  1588. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1589. ElementType* insertPos;
  1590. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1591. {
  1592. insertPos = data.elements + indexToInsertAt;
  1593. const int numberToMove = numUsed - indexToInsertAt;
  1594. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1595. }
  1596. else
  1597. {
  1598. insertPos = data.elements + numUsed;
  1599. }
  1600. numUsed += numberOfTimesToInsertIt;
  1601. while (--numberOfTimesToInsertIt >= 0)
  1602. new (insertPos++) ElementType (newElement);
  1603. data.exit();
  1604. }
  1605. }
  1606. void insertArray (int indexToInsertAt,
  1607. const ElementType* newElements,
  1608. int numberOfElements)
  1609. {
  1610. if (numberOfElements > 0)
  1611. {
  1612. data.enter();
  1613. data.ensureAllocatedSize (numUsed + numberOfElements);
  1614. ElementType* insertPos;
  1615. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1616. {
  1617. insertPos = data.elements + indexToInsertAt;
  1618. const int numberToMove = numUsed - indexToInsertAt;
  1619. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1620. }
  1621. else
  1622. {
  1623. insertPos = data.elements + numUsed;
  1624. }
  1625. numUsed += numberOfElements;
  1626. while (--numberOfElements >= 0)
  1627. new (insertPos++) ElementType (*newElements++);
  1628. data.exit();
  1629. }
  1630. }
  1631. void addIfNotAlreadyThere (const ElementType& newElement)
  1632. {
  1633. data.enter();
  1634. if (! contains (newElement))
  1635. add (newElement);
  1636. data.exit();
  1637. }
  1638. void set (const int indexToChange, const ElementType& newValue)
  1639. {
  1640. jassert (indexToChange >= 0);
  1641. data.enter();
  1642. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1643. {
  1644. data.elements [indexToChange] = newValue;
  1645. }
  1646. else if (indexToChange >= 0)
  1647. {
  1648. data.ensureAllocatedSize (numUsed + 1);
  1649. new (data.elements + numUsed++) ElementType (newValue);
  1650. }
  1651. data.exit();
  1652. }
  1653. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1654. {
  1655. data.enter();
  1656. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1657. data.elements [indexToChange] = newValue;
  1658. data.exit();
  1659. }
  1660. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1661. {
  1662. data.enter();
  1663. if (numElementsToAdd > 0)
  1664. {
  1665. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1666. while (--numElementsToAdd >= 0)
  1667. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1668. }
  1669. data.exit();
  1670. }
  1671. void swapWithArray (Array <ElementType>& otherArray) throw()
  1672. {
  1673. data.enter();
  1674. otherArray.data.enter();
  1675. data.swapWith (otherArray.data);
  1676. swapVariables (numUsed, otherArray.numUsed);
  1677. otherArray.data.exit();
  1678. data.exit();
  1679. }
  1680. template <class OtherArrayType>
  1681. void addArray (const OtherArrayType& arrayToAddFrom,
  1682. int startIndex = 0,
  1683. int numElementsToAdd = -1)
  1684. {
  1685. arrayToAddFrom.lockArray();
  1686. data.enter();
  1687. if (startIndex < 0)
  1688. {
  1689. jassertfalse
  1690. startIndex = 0;
  1691. }
  1692. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1693. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1694. while (--numElementsToAdd >= 0)
  1695. add (arrayToAddFrom.getUnchecked (startIndex++));
  1696. data.exit();
  1697. arrayToAddFrom.unlockArray();
  1698. }
  1699. template <class ElementComparator>
  1700. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1701. {
  1702. data.enter();
  1703. insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
  1704. data.exit();
  1705. }
  1706. template <class ElementComparator>
  1707. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1708. {
  1709. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1710. // avoids getting warning messages about the parameter being unused
  1711. data.enter();
  1712. int start = 0;
  1713. int end = numUsed;
  1714. for (;;)
  1715. {
  1716. if (start >= end)
  1717. {
  1718. data.exit();
  1719. return -1;
  1720. }
  1721. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1722. {
  1723. data.exit();
  1724. return start;
  1725. }
  1726. else
  1727. {
  1728. const int halfway = (start + end) >> 1;
  1729. if (halfway == start)
  1730. {
  1731. data.exit();
  1732. return -1;
  1733. }
  1734. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1735. start = halfway;
  1736. else
  1737. end = halfway;
  1738. }
  1739. }
  1740. }
  1741. ElementType remove (const int indexToRemove)
  1742. {
  1743. data.enter();
  1744. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1745. {
  1746. --numUsed;
  1747. ElementType* const e = data.elements + indexToRemove;
  1748. ElementType removed (*e);
  1749. e->~ElementType();
  1750. const int numberToShift = numUsed - indexToRemove;
  1751. if (numberToShift > 0)
  1752. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1753. if ((numUsed << 1) < data.numAllocated)
  1754. minimiseStorageOverheads();
  1755. data.exit();
  1756. return removed;
  1757. }
  1758. else
  1759. {
  1760. data.exit();
  1761. return ElementType();
  1762. }
  1763. }
  1764. void removeValue (const ElementType& valueToRemove)
  1765. {
  1766. data.enter();
  1767. ElementType* e = data.elements;
  1768. for (int i = numUsed; --i >= 0;)
  1769. {
  1770. if (valueToRemove == *e)
  1771. {
  1772. remove ((int) (e - data.elements));
  1773. break;
  1774. }
  1775. ++e;
  1776. }
  1777. data.exit();
  1778. }
  1779. void removeRange (int startIndex, int numberToRemove)
  1780. {
  1781. data.enter();
  1782. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1783. startIndex = jlimit (0, numUsed, startIndex);
  1784. if (endIndex > startIndex)
  1785. {
  1786. ElementType* e = data.elements + startIndex;
  1787. numberToRemove = endIndex - startIndex;
  1788. for (int i = 0; i < numberToRemove; ++i)
  1789. e[i].~ElementType();
  1790. const int numToShift = numUsed - endIndex;
  1791. if (numToShift > 0)
  1792. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1793. numUsed -= numberToRemove;
  1794. if ((numUsed << 1) < data.numAllocated)
  1795. minimiseStorageOverheads();
  1796. }
  1797. data.exit();
  1798. }
  1799. void removeLast (int howManyToRemove = 1)
  1800. {
  1801. data.enter();
  1802. if (howManyToRemove > numUsed)
  1803. howManyToRemove = numUsed;
  1804. for (int i = 0; i < howManyToRemove; ++i)
  1805. data.elements [numUsed - i].~ElementType();
  1806. numUsed -= howManyToRemove;
  1807. if ((numUsed << 1) < data.numAllocated)
  1808. minimiseStorageOverheads();
  1809. data.exit();
  1810. }
  1811. template <class OtherArrayType>
  1812. void removeValuesIn (const OtherArrayType& otherArray)
  1813. {
  1814. otherArray.lockArray();
  1815. data.enter();
  1816. if (this == &otherArray)
  1817. {
  1818. clear();
  1819. }
  1820. else
  1821. {
  1822. if (otherArray.size() > 0)
  1823. {
  1824. for (int i = numUsed; --i >= 0;)
  1825. if (otherArray.contains (data.elements [i]))
  1826. remove (i);
  1827. }
  1828. }
  1829. data.exit();
  1830. otherArray.unlockArray();
  1831. }
  1832. template <class OtherArrayType>
  1833. void removeValuesNotIn (const OtherArrayType& otherArray)
  1834. {
  1835. otherArray.lockArray();
  1836. data.enter();
  1837. if (this != &otherArray)
  1838. {
  1839. if (otherArray.size() <= 0)
  1840. {
  1841. clear();
  1842. }
  1843. else
  1844. {
  1845. for (int i = numUsed; --i >= 0;)
  1846. if (! otherArray.contains (data.elements [i]))
  1847. remove (i);
  1848. }
  1849. }
  1850. data.exit();
  1851. otherArray.unlockArray();
  1852. }
  1853. void swap (const int index1,
  1854. const int index2)
  1855. {
  1856. data.enter();
  1857. if (((unsigned int) index1) < (unsigned int) numUsed
  1858. && ((unsigned int) index2) < (unsigned int) numUsed)
  1859. {
  1860. swapVariables (data.elements [index1],
  1861. data.elements [index2]);
  1862. }
  1863. data.exit();
  1864. }
  1865. void move (const int currentIndex, int newIndex) throw()
  1866. {
  1867. if (currentIndex != newIndex)
  1868. {
  1869. data.enter();
  1870. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1871. {
  1872. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1873. newIndex = numUsed - 1;
  1874. char tempCopy [sizeof (ElementType)];
  1875. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1876. if (newIndex > currentIndex)
  1877. {
  1878. memmove (data.elements + currentIndex,
  1879. data.elements + currentIndex + 1,
  1880. (newIndex - currentIndex) * sizeof (ElementType));
  1881. }
  1882. else
  1883. {
  1884. memmove (data.elements + newIndex + 1,
  1885. data.elements + newIndex,
  1886. (currentIndex - newIndex) * sizeof (ElementType));
  1887. }
  1888. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1889. }
  1890. data.exit();
  1891. }
  1892. }
  1893. void minimiseStorageOverheads()
  1894. {
  1895. data.enter();
  1896. data.shrinkToNoMoreThan (numUsed);
  1897. data.exit();
  1898. }
  1899. void ensureStorageAllocated (const int minNumElements)
  1900. {
  1901. data.enter();
  1902. data.ensureAllocatedSize (minNumElements);
  1903. data.exit();
  1904. }
  1905. template <class ElementComparator>
  1906. void sort (ElementComparator& comparator,
  1907. const bool retainOrderOfEquivalentItems = false) const
  1908. {
  1909. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1910. // avoids getting warning messages about the parameter being unused
  1911. data.enter();
  1912. sortArray (comparator, (ElementType*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  1913. data.exit();
  1914. }
  1915. void lockArray() const throw()
  1916. {
  1917. data.enter();
  1918. }
  1919. void unlockArray() const throw()
  1920. {
  1921. data.exit();
  1922. }
  1923. juce_UseDebuggingNewOperator
  1924. private:
  1925. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1926. int numUsed;
  1927. };
  1928. #endif // __JUCE_ARRAY_JUCEHEADER__
  1929. /*** End of inlined file: juce_Array.h ***/
  1930. #endif
  1931. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1932. #endif
  1933. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1934. /*** Start of inlined file: juce_BitArray.h ***/
  1935. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1936. #define __JUCE_BITARRAY_JUCEHEADER__
  1937. class MemoryBlock;
  1938. class JUCE_API BitArray
  1939. {
  1940. public:
  1941. BitArray() throw();
  1942. BitArray (const unsigned int value) throw();
  1943. BitArray (const int value) throw();
  1944. BitArray (int64 value) throw();
  1945. BitArray (const BitArray& other) throw();
  1946. ~BitArray() throw();
  1947. BitArray& operator= (const BitArray& other) throw();
  1948. bool operator== (const BitArray& other) const throw();
  1949. bool operator!= (const BitArray& other) const throw();
  1950. void clear() throw();
  1951. void clearBit (const int bitNumber) throw();
  1952. void setBit (const int bitNumber) throw();
  1953. void setBit (const int bitNumber,
  1954. const bool shouldBeSet) throw();
  1955. void setRange (int startBit,
  1956. int numBits,
  1957. const bool shouldBeSet) throw();
  1958. void insertBit (const int bitNumber,
  1959. const bool shouldBeSet) throw();
  1960. bool operator[] (const int bit) const throw();
  1961. bool isEmpty() const throw();
  1962. const BitArray getBitRange (int startBit, int numBits) const throw();
  1963. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1964. void setBitRangeAsInt (int startBit, int numBits,
  1965. unsigned int valueToSet) throw();
  1966. void orWith (const BitArray& other) throw();
  1967. void andWith (const BitArray& other) throw();
  1968. void xorWith (const BitArray& other) throw();
  1969. void add (const BitArray& other) throw();
  1970. void subtract (const BitArray& other) throw();
  1971. void multiplyBy (const BitArray& other) throw();
  1972. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1973. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1974. void modulo (const BitArray& divisor) throw();
  1975. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1976. void inverseModulo (const BitArray& modulus) throw();
  1977. void shiftBits (int howManyBitsLeft,
  1978. int startBit = 0) throw();
  1979. int compare (const BitArray& other) const throw();
  1980. int compareAbsolute (const BitArray& other) const throw();
  1981. bool isNegative() const throw();
  1982. void setNegative (const bool shouldBeNegative) throw();
  1983. void negate() throw();
  1984. int countNumberOfSetBits() const throw();
  1985. int findNextSetBit (int startIndex = 0) const throw();
  1986. int findNextClearBit (int startIndex = 0) const throw();
  1987. int getHighestBit() const throw();
  1988. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1989. void parseString (const String& text,
  1990. const int base) throw();
  1991. const MemoryBlock toMemoryBlock() const throw();
  1992. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1993. juce_UseDebuggingNewOperator
  1994. private:
  1995. void ensureSize (const int numVals) throw();
  1996. HeapBlock <unsigned int> values;
  1997. int numValues, highestBit;
  1998. bool negative;
  1999. };
  2000. #endif // __JUCE_BITARRAY_JUCEHEADER__
  2001. /*** End of inlined file: juce_BitArray.h ***/
  2002. #endif
  2003. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2004. /*** Start of inlined file: juce_DynamicObject.h ***/
  2005. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2006. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2007. /*** Start of inlined file: juce_NamedValueSet.h ***/
  2008. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2009. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  2010. /*** Start of inlined file: juce_Variant.h ***/
  2011. #ifndef __JUCE_VARIANT_JUCEHEADER__
  2012. #define __JUCE_VARIANT_JUCEHEADER__
  2013. /*** Start of inlined file: juce_OutputStream.h ***/
  2014. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2015. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2016. /*** Start of inlined file: juce_InputStream.h ***/
  2017. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2018. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2019. /*** Start of inlined file: juce_MemoryBlock.h ***/
  2020. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2021. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2022. class JUCE_API MemoryBlock
  2023. {
  2024. public:
  2025. MemoryBlock() throw();
  2026. MemoryBlock (const size_t initialSize,
  2027. const bool initialiseToZero = false) throw();
  2028. MemoryBlock (const MemoryBlock& other) throw();
  2029. MemoryBlock (const void* const dataToInitialiseFrom,
  2030. const size_t sizeInBytes) throw();
  2031. ~MemoryBlock() throw();
  2032. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2033. bool operator== (const MemoryBlock& other) const throw();
  2034. bool operator!= (const MemoryBlock& other) const throw();
  2035. bool matches (const void* data, size_t dataSize) const throw();
  2036. template <class DataType>
  2037. operator DataType*() const throw() { return (DataType*) data; }
  2038. void* getData() const throw() { return data; }
  2039. template <typename Type>
  2040. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2041. size_t getSize() const throw() { return size; }
  2042. void setSize (const size_t newSize,
  2043. const bool initialiseNewSpaceToZero = false) throw();
  2044. void ensureSize (const size_t minimumSize,
  2045. const bool initialiseNewSpaceToZero = false) throw();
  2046. void fillWith (const uint8 valueToUse) throw();
  2047. void append (const void* const data,
  2048. const size_t numBytes) throw();
  2049. void swapWith (MemoryBlock& other) throw();
  2050. void copyFrom (const void* srcData,
  2051. int destinationOffset,
  2052. size_t numBytes) throw();
  2053. void copyTo (void* destData,
  2054. int sourceOffset,
  2055. size_t numBytes) const throw();
  2056. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2057. const String toString() const throw();
  2058. void loadFromHexString (const String& sourceHexString) throw();
  2059. void setBitRange (size_t bitRangeStart,
  2060. size_t numBits,
  2061. int binaryNumberToApply) throw();
  2062. int getBitRange (size_t bitRangeStart,
  2063. size_t numBitsToRead) const throw();
  2064. const String toBase64Encoding() const throw();
  2065. bool fromBase64Encoding (const String& encodedString) throw();
  2066. juce_UseDebuggingNewOperator
  2067. private:
  2068. HeapBlock <char> data;
  2069. size_t size;
  2070. };
  2071. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2072. /*** End of inlined file: juce_MemoryBlock.h ***/
  2073. class JUCE_API InputStream
  2074. {
  2075. public:
  2076. virtual ~InputStream() {}
  2077. virtual int64 getTotalLength() = 0;
  2078. virtual bool isExhausted() = 0;
  2079. virtual int read (void* destBuffer,
  2080. int maxBytesToRead) = 0;
  2081. virtual char readByte();
  2082. virtual bool readBool();
  2083. virtual short readShort();
  2084. virtual short readShortBigEndian();
  2085. virtual int readInt();
  2086. virtual int readIntBigEndian();
  2087. virtual int64 readInt64();
  2088. virtual int64 readInt64BigEndian();
  2089. virtual float readFloat();
  2090. virtual float readFloatBigEndian();
  2091. virtual double readDouble();
  2092. virtual double readDoubleBigEndian();
  2093. virtual int readCompressedInt();
  2094. virtual const String readNextLine();
  2095. virtual const String readString();
  2096. virtual const String readEntireStreamAsString();
  2097. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2098. int maxNumBytesToRead = -1);
  2099. virtual int64 getPosition() = 0;
  2100. virtual bool setPosition (int64 newPosition) = 0;
  2101. virtual void skipNextBytes (int64 numBytesToSkip);
  2102. juce_UseDebuggingNewOperator
  2103. protected:
  2104. InputStream() throw() {}
  2105. };
  2106. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2107. /*** End of inlined file: juce_InputStream.h ***/
  2108. class JUCE_API OutputStream
  2109. {
  2110. public:
  2111. virtual ~OutputStream();
  2112. virtual void flush() = 0;
  2113. virtual bool setPosition (int64 newPosition) = 0;
  2114. virtual int64 getPosition() = 0;
  2115. virtual bool write (const void* dataToWrite,
  2116. int howManyBytes) = 0;
  2117. virtual void writeByte (char byte);
  2118. virtual void writeBool (bool boolValue);
  2119. virtual void writeShort (short value);
  2120. virtual void writeShortBigEndian (short value);
  2121. virtual void writeInt (int value);
  2122. virtual void writeIntBigEndian (int value);
  2123. virtual void writeInt64 (int64 value);
  2124. virtual void writeInt64BigEndian (int64 value);
  2125. virtual void writeFloat (float value);
  2126. virtual void writeFloatBigEndian (float value);
  2127. virtual void writeDouble (double value);
  2128. virtual void writeDoubleBigEndian (double value);
  2129. virtual void writeCompressedInt (int value);
  2130. virtual void writeString (const String& text);
  2131. virtual void writeText (const String& text,
  2132. const bool asUnicode,
  2133. const bool writeUnicodeHeaderBytes);
  2134. virtual void printf (const char* format, ...);
  2135. virtual int writeFromInputStream (InputStream& source,
  2136. int maxNumBytesToWrite);
  2137. virtual OutputStream& operator<< (const int number);
  2138. virtual OutputStream& operator<< (const double number);
  2139. virtual OutputStream& operator<< (const char character);
  2140. virtual OutputStream& operator<< (const char* const text);
  2141. virtual OutputStream& operator<< (const juce_wchar* const text);
  2142. virtual OutputStream& operator<< (const String& text);
  2143. juce_UseDebuggingNewOperator
  2144. protected:
  2145. OutputStream() throw();
  2146. };
  2147. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2148. /*** End of inlined file: juce_OutputStream.h ***/
  2149. class JUCE_API DynamicObject;
  2150. class JUCE_API var
  2151. {
  2152. public:
  2153. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2154. var() throw();
  2155. ~var() throw();
  2156. static const var null;
  2157. var (const var& valueToCopy);
  2158. var (const int value) throw();
  2159. var (const bool value) throw();
  2160. var (const double value) throw();
  2161. var (const char* const value);
  2162. var (const juce_wchar* const value);
  2163. var (const String& value);
  2164. var (DynamicObject* const object);
  2165. var (MethodFunction method) throw();
  2166. var& operator= (const var& valueToCopy);
  2167. var& operator= (int value);
  2168. var& operator= (bool value);
  2169. var& operator= (double value);
  2170. var& operator= (const char* value);
  2171. var& operator= (const juce_wchar* value);
  2172. var& operator= (const String& value);
  2173. var& operator= (DynamicObject* object);
  2174. var& operator= (MethodFunction method);
  2175. void swapWith (var& other) throw();
  2176. operator int() const;
  2177. operator bool() const;
  2178. operator float() const;
  2179. operator double() const;
  2180. operator const String() const;
  2181. const String toString() const;
  2182. DynamicObject* getObject() const;
  2183. bool isVoid() const throw() { return type == voidType; }
  2184. bool isInt() const throw() { return type == intType; }
  2185. bool isBool() const throw() { return type == boolType; }
  2186. bool isDouble() const throw() { return type == doubleType; }
  2187. bool isString() const throw() { return type == stringType; }
  2188. bool isObject() const throw() { return type == objectType; }
  2189. bool isMethod() const throw() { return type == methodType; }
  2190. bool operator== (const var& other) const throw();
  2191. bool operator!= (const var& other) const throw();
  2192. void writeToStream (OutputStream& output) const;
  2193. static const var readFromStream (InputStream& input);
  2194. class JUCE_API identifier
  2195. {
  2196. public:
  2197. identifier() throw();
  2198. identifier (const char* const name);
  2199. identifier (const String& name);
  2200. ~identifier();
  2201. bool operator== (const identifier& other) const throw()
  2202. {
  2203. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2204. return hashCode == other.hashCode;
  2205. }
  2206. String name;
  2207. int hashCode;
  2208. };
  2209. const var operator[] (const identifier& propertyName) const;
  2210. const var call (const identifier& method) const;
  2211. const var call (const identifier& method, const var& arg1) const;
  2212. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2213. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2214. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2215. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2216. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2217. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2218. juce_UseDebuggingNewOperator
  2219. private:
  2220. enum Type
  2221. {
  2222. voidType = 0,
  2223. intType,
  2224. boolType,
  2225. doubleType,
  2226. stringType,
  2227. objectType,
  2228. methodType
  2229. };
  2230. union ValueUnion
  2231. {
  2232. int intValue;
  2233. bool boolValue;
  2234. double doubleValue;
  2235. String* stringValue;
  2236. DynamicObject* objectValue;
  2237. MethodFunction methodValue;
  2238. };
  2239. Type type;
  2240. ValueUnion value;
  2241. };
  2242. #endif // __JUCE_VARIANT_JUCEHEADER__
  2243. /*** End of inlined file: juce_Variant.h ***/
  2244. class JUCE_API NamedValueSet
  2245. {
  2246. public:
  2247. NamedValueSet() throw();
  2248. NamedValueSet (const NamedValueSet& other);
  2249. NamedValueSet& operator= (const NamedValueSet& other);
  2250. ~NamedValueSet();
  2251. int size() const throw();
  2252. const var& operator[] (const var::identifier& name) const;
  2253. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2254. var* getItem (const var::identifier& name) const;
  2255. bool set (const var::identifier& name, const var& newValue);
  2256. bool contains (const var::identifier& name) const;
  2257. bool remove (const var::identifier& name);
  2258. const var::identifier getName (int index) const;
  2259. void clear();
  2260. juce_UseDebuggingNewOperator
  2261. private:
  2262. struct NamedValue
  2263. {
  2264. NamedValue() throw();
  2265. NamedValue (const var::identifier& name, const var& value);
  2266. var::identifier name;
  2267. var value;
  2268. };
  2269. Array <NamedValue> values;
  2270. };
  2271. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2272. /*** End of inlined file: juce_NamedValueSet.h ***/
  2273. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2274. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2275. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2276. /*** Start of inlined file: juce_Atomic.h ***/
  2277. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2278. #define __JUCE_ATOMIC_JUCEHEADER__
  2279. class JUCE_API Atomic
  2280. {
  2281. public:
  2282. static void increment (int32& variable);
  2283. static int32 incrementAndReturn (int32& variable);
  2284. static void decrement (int32& variable);
  2285. static int32 decrementAndReturn (int32& variable);
  2286. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2287. static void* swapPointers (void* volatile* value1, void* value2);
  2288. };
  2289. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2290. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2291. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2292. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2293. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2294. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2295. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2296. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2297. {
  2298. void* currentVal = *value1;
  2299. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2300. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2301. #else
  2302. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2303. #endif
  2304. return currentVal;
  2305. }
  2306. #elif JUCE_LINUX // Linux...
  2307. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2308. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2309. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2310. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2311. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2312. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2313. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2314. {
  2315. void* currentVal = *value1;
  2316. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2317. return currentVal;
  2318. }
  2319. #elif JUCE_USE_INTRINSICS // Windows...
  2320. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2321. // declared in juce_win32_Threads.cpp)
  2322. #pragma intrinsic (_InterlockedIncrement)
  2323. #pragma intrinsic (_InterlockedDecrement)
  2324. #pragma intrinsic (_InterlockedCompareExchange)
  2325. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2326. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2327. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2328. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2329. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2330. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2331. #endif
  2332. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2333. /*** End of inlined file: juce_Atomic.h ***/
  2334. class JUCE_API ReferenceCountedObject
  2335. {
  2336. public:
  2337. inline void incReferenceCount() throw()
  2338. {
  2339. Atomic::increment (refCounts);
  2340. jassert (refCounts > 0);
  2341. }
  2342. inline void decReferenceCount() throw()
  2343. {
  2344. jassert (refCounts > 0);
  2345. if (Atomic::decrementAndReturn (refCounts) == 0)
  2346. delete this;
  2347. }
  2348. inline int getReferenceCount() const throw()
  2349. {
  2350. return refCounts;
  2351. }
  2352. protected:
  2353. ReferenceCountedObject()
  2354. : refCounts (0)
  2355. {
  2356. }
  2357. virtual ~ReferenceCountedObject()
  2358. {
  2359. // it's dangerous to delete an object that's still referenced by something else!
  2360. jassert (refCounts == 0);
  2361. }
  2362. private:
  2363. int refCounts;
  2364. };
  2365. template <class ReferenceCountedObjectClass>
  2366. class ReferenceCountedObjectPtr
  2367. {
  2368. public:
  2369. inline ReferenceCountedObjectPtr() throw()
  2370. : referencedObject (0)
  2371. {
  2372. }
  2373. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2374. : referencedObject (refCountedObject)
  2375. {
  2376. if (refCountedObject != 0)
  2377. refCountedObject->incReferenceCount();
  2378. }
  2379. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2380. : referencedObject (other.referencedObject)
  2381. {
  2382. if (referencedObject != 0)
  2383. referencedObject->incReferenceCount();
  2384. }
  2385. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2386. {
  2387. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2388. if (newObject != referencedObject)
  2389. {
  2390. if (newObject != 0)
  2391. newObject->incReferenceCount();
  2392. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2393. referencedObject = newObject;
  2394. if (oldObject != 0)
  2395. oldObject->decReferenceCount();
  2396. }
  2397. return *this;
  2398. }
  2399. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2400. {
  2401. if (referencedObject != newObject)
  2402. {
  2403. if (newObject != 0)
  2404. newObject->incReferenceCount();
  2405. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2406. referencedObject = newObject;
  2407. if (oldObject != 0)
  2408. oldObject->decReferenceCount();
  2409. }
  2410. return *this;
  2411. }
  2412. inline ~ReferenceCountedObjectPtr()
  2413. {
  2414. if (referencedObject != 0)
  2415. referencedObject->decReferenceCount();
  2416. }
  2417. inline operator ReferenceCountedObjectClass*() const throw()
  2418. {
  2419. return referencedObject;
  2420. }
  2421. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2422. {
  2423. return referencedObject == object;
  2424. }
  2425. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2426. {
  2427. return referencedObject != object;
  2428. }
  2429. // the -> operator is called on the referenced object
  2430. inline ReferenceCountedObjectClass* operator->() const throw()
  2431. {
  2432. return referencedObject;
  2433. }
  2434. private:
  2435. ReferenceCountedObjectClass* referencedObject;
  2436. };
  2437. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2438. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2439. class JUCE_API DynamicObject : public ReferenceCountedObject
  2440. {
  2441. public:
  2442. DynamicObject();
  2443. virtual ~DynamicObject();
  2444. virtual bool hasProperty (const var::identifier& propertyName) const;
  2445. virtual const var getProperty (const var::identifier& propertyName) const;
  2446. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2447. virtual void removeProperty (const var::identifier& propertyName);
  2448. virtual bool hasMethod (const var::identifier& methodName) const;
  2449. virtual const var invokeMethod (const var::identifier& methodName,
  2450. const var* parameters,
  2451. int numParameters);
  2452. void setMethod (const var::identifier& methodName,
  2453. var::MethodFunction methodFunction);
  2454. void clear();
  2455. juce_UseDebuggingNewOperator
  2456. private:
  2457. NamedValueSet properties;
  2458. };
  2459. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2460. /*** End of inlined file: juce_DynamicObject.h ***/
  2461. #endif
  2462. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2463. #endif
  2464. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2465. #endif
  2466. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2467. #endif
  2468. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2469. #endif
  2470. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2471. /*** Start of inlined file: juce_OwnedArray.h ***/
  2472. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2473. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2474. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2475. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2476. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2477. template <class ObjectType>
  2478. class JUCE_API ScopedPointer
  2479. {
  2480. public:
  2481. inline ScopedPointer() throw() : object (0)
  2482. {
  2483. }
  2484. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2485. : object (objectToTakePossessionOf)
  2486. {
  2487. }
  2488. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2489. : object (objectToTransferFrom.object)
  2490. {
  2491. objectToTransferFrom.object = 0;
  2492. }
  2493. inline ~ScopedPointer() { delete object; }
  2494. const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2495. {
  2496. if (this != objectToTransferFrom.getAddress())
  2497. {
  2498. // Two ScopedPointers should never be able to refer to the same object - if
  2499. // this happens, you must have done something dodgy!
  2500. jassert (object != objectToTransferFrom.object);
  2501. ObjectType* const oldObject = object;
  2502. object = objectToTransferFrom.object;
  2503. objectToTransferFrom.object = 0;
  2504. delete oldObject;
  2505. }
  2506. return *this;
  2507. }
  2508. const ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2509. {
  2510. if (object != newObjectToTakePossessionOf)
  2511. {
  2512. ObjectType* const oldObject = object;
  2513. object = newObjectToTakePossessionOf;
  2514. delete oldObject;
  2515. }
  2516. return *this;
  2517. }
  2518. inline operator ObjectType*() const throw() { return object; }
  2519. inline ObjectType& operator*() const throw() { return *object; }
  2520. inline ObjectType* operator->() const throw() { return object; }
  2521. template <class CastType>
  2522. inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
  2523. inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
  2524. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2525. inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
  2526. inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
  2527. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2528. {
  2529. // Two ScopedPointers should never be able to refer to the same object - if
  2530. // this happens, you must have done something dodgy!
  2531. jassert (object != other.object);
  2532. swapVariables (object, other.object);
  2533. }
  2534. private:
  2535. ObjectType* object;
  2536. // (Required as an alternative to the overloaded & operator).
  2537. const ScopedPointer* getAddress() const throw() { return this; }
  2538. };
  2539. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2540. /*** End of inlined file: juce_ScopedPointer.h ***/
  2541. template <class ObjectClass,
  2542. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2543. class OwnedArray
  2544. {
  2545. public:
  2546. OwnedArray() throw()
  2547. : numUsed (0)
  2548. {
  2549. }
  2550. ~OwnedArray()
  2551. {
  2552. clear (true);
  2553. }
  2554. void clear (const bool deleteObjects = true)
  2555. {
  2556. data.enter();
  2557. if (deleteObjects)
  2558. {
  2559. while (numUsed > 0)
  2560. delete data.elements [--numUsed];
  2561. }
  2562. data.setAllocatedSize (0);
  2563. numUsed = 0;
  2564. data.exit();
  2565. }
  2566. inline int size() const throw()
  2567. {
  2568. return numUsed;
  2569. }
  2570. inline ObjectClass* operator[] (const int index) const throw()
  2571. {
  2572. data.enter();
  2573. ObjectClass* const result = (((unsigned int) index) < (unsigned int) numUsed)
  2574. ? data.elements [index]
  2575. : (ObjectClass*) 0;
  2576. data.exit();
  2577. return result;
  2578. }
  2579. inline ObjectClass* getUnchecked (const int index) const throw()
  2580. {
  2581. data.enter();
  2582. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2583. ObjectClass* const result = data.elements [index];
  2584. data.exit();
  2585. return result;
  2586. }
  2587. inline ObjectClass* getFirst() const throw()
  2588. {
  2589. data.enter();
  2590. ObjectClass* const result = (numUsed > 0) ? data.elements [0]
  2591. : (ObjectClass*) 0;
  2592. data.exit();
  2593. return result;
  2594. }
  2595. inline ObjectClass* getLast() const throw()
  2596. {
  2597. data.enter();
  2598. ObjectClass* const result = (numUsed > 0) ? data.elements [numUsed - 1]
  2599. : (ObjectClass*) 0;
  2600. data.exit();
  2601. return result;
  2602. }
  2603. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2604. {
  2605. int result = -1;
  2606. data.enter();
  2607. ObjectClass* const* e = data.elements;
  2608. for (int i = numUsed; --i >= 0;)
  2609. {
  2610. if (objectToLookFor == *e)
  2611. {
  2612. result = (int) (e - data.elements);
  2613. break;
  2614. }
  2615. ++e;
  2616. }
  2617. data.exit();
  2618. return result;
  2619. }
  2620. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2621. {
  2622. data.enter();
  2623. ObjectClass* const* e = data.elements;
  2624. int i = numUsed;
  2625. while (i >= 4)
  2626. {
  2627. if (objectToLookFor == *e
  2628. || objectToLookFor == *++e
  2629. || objectToLookFor == *++e
  2630. || objectToLookFor == *++e)
  2631. {
  2632. data.exit();
  2633. return true;
  2634. }
  2635. i -= 4;
  2636. ++e;
  2637. }
  2638. while (i > 0)
  2639. {
  2640. if (objectToLookFor == *e)
  2641. {
  2642. data.exit();
  2643. return true;
  2644. }
  2645. --i;
  2646. ++e;
  2647. }
  2648. data.exit();
  2649. return false;
  2650. }
  2651. void add (const ObjectClass* const newObject) throw()
  2652. {
  2653. data.enter();
  2654. data.ensureAllocatedSize (numUsed + 1);
  2655. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2656. data.exit();
  2657. }
  2658. void insert (int indexToInsertAt,
  2659. const ObjectClass* const newObject) throw()
  2660. {
  2661. if (indexToInsertAt >= 0)
  2662. {
  2663. data.enter();
  2664. if (indexToInsertAt > numUsed)
  2665. indexToInsertAt = numUsed;
  2666. data.ensureAllocatedSize (numUsed + 1);
  2667. ObjectClass** const e = data.elements + indexToInsertAt;
  2668. const int numToMove = numUsed - indexToInsertAt;
  2669. if (numToMove > 0)
  2670. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2671. *e = const_cast <ObjectClass*> (newObject);
  2672. ++numUsed;
  2673. data.exit();
  2674. }
  2675. else
  2676. {
  2677. add (newObject);
  2678. }
  2679. }
  2680. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2681. {
  2682. data.enter();
  2683. if (! contains (newObject))
  2684. add (newObject);
  2685. data.exit();
  2686. }
  2687. void set (const int indexToChange,
  2688. const ObjectClass* const newObject,
  2689. const bool deleteOldElement = true)
  2690. {
  2691. if (indexToChange >= 0)
  2692. {
  2693. ScopedPointer <ObjectClass> toDelete;
  2694. data.enter();
  2695. if (indexToChange < numUsed)
  2696. {
  2697. if (deleteOldElement)
  2698. {
  2699. toDelete = data.elements [indexToChange];
  2700. if (toDelete == newObject)
  2701. toDelete = 0;
  2702. }
  2703. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2704. }
  2705. else
  2706. {
  2707. data.ensureAllocatedSize (numUsed + 1);
  2708. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2709. }
  2710. data.exit();
  2711. }
  2712. }
  2713. template <class ElementComparator>
  2714. void addSorted (ElementComparator& comparator,
  2715. ObjectClass* const newObject) throw()
  2716. {
  2717. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2718. // avoids getting warning messages about the parameter being unused
  2719. data.enter();
  2720. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  2721. data.exit();
  2722. }
  2723. template <class ElementComparator>
  2724. int indexOfSorted (ElementComparator& comparator,
  2725. const ObjectClass* const objectToLookFor) const throw()
  2726. {
  2727. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2728. // avoids getting warning messages about the parameter being unused
  2729. data.enter();
  2730. int start = 0;
  2731. int end = numUsed;
  2732. for (;;)
  2733. {
  2734. if (start >= end)
  2735. {
  2736. data.exit();
  2737. return -1;
  2738. }
  2739. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2740. {
  2741. data.exit();
  2742. return start;
  2743. }
  2744. else
  2745. {
  2746. const int halfway = (start + end) >> 1;
  2747. if (halfway == start)
  2748. {
  2749. data.exit();
  2750. return -1;
  2751. }
  2752. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2753. start = halfway;
  2754. else
  2755. end = halfway;
  2756. }
  2757. }
  2758. }
  2759. void remove (const int indexToRemove,
  2760. const bool deleteObject = true)
  2761. {
  2762. ScopedPointer <ObjectClass> toDelete;
  2763. data.enter();
  2764. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2765. {
  2766. ObjectClass** const e = data.elements + indexToRemove;
  2767. if (deleteObject)
  2768. toDelete = *e;
  2769. --numUsed;
  2770. const int numToShift = numUsed - indexToRemove;
  2771. if (numToShift > 0)
  2772. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2773. if ((numUsed << 1) < data.numAllocated)
  2774. minimiseStorageOverheads();
  2775. }
  2776. data.exit();
  2777. }
  2778. void removeObject (const ObjectClass* const objectToRemove,
  2779. const bool deleteObject = true)
  2780. {
  2781. data.enter();
  2782. ObjectClass** e = data.elements;
  2783. for (int i = numUsed; --i >= 0;)
  2784. {
  2785. if (objectToRemove == *e)
  2786. {
  2787. remove ((int) (e - data.elements), deleteObject);
  2788. break;
  2789. }
  2790. ++e;
  2791. }
  2792. data.exit();
  2793. }
  2794. void removeRange (int startIndex,
  2795. const int numberToRemove,
  2796. const bool deleteObjects = true)
  2797. {
  2798. data.enter();
  2799. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2800. startIndex = jlimit (0, numUsed, startIndex);
  2801. if (endIndex > startIndex)
  2802. {
  2803. if (deleteObjects)
  2804. {
  2805. for (int i = startIndex; i < endIndex; ++i)
  2806. {
  2807. delete data.elements [i];
  2808. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2809. }
  2810. }
  2811. const int rangeSize = endIndex - startIndex;
  2812. ObjectClass** e = data.elements + startIndex;
  2813. int numToShift = numUsed - endIndex;
  2814. numUsed -= rangeSize;
  2815. while (--numToShift >= 0)
  2816. {
  2817. *e = e [rangeSize];
  2818. ++e;
  2819. }
  2820. if ((numUsed << 1) < data.numAllocated)
  2821. minimiseStorageOverheads();
  2822. }
  2823. data.exit();
  2824. }
  2825. void removeLast (int howManyToRemove = 1,
  2826. const bool deleteObjects = true)
  2827. {
  2828. data.enter();
  2829. if (howManyToRemove >= numUsed)
  2830. {
  2831. clear (deleteObjects);
  2832. }
  2833. else
  2834. {
  2835. while (--howManyToRemove >= 0)
  2836. remove (numUsed - 1, deleteObjects);
  2837. }
  2838. data.exit();
  2839. }
  2840. void swap (const int index1,
  2841. const int index2) throw()
  2842. {
  2843. data.enter();
  2844. if (((unsigned int) index1) < (unsigned int) numUsed
  2845. && ((unsigned int) index2) < (unsigned int) numUsed)
  2846. {
  2847. swapVariables (data.elements [index1],
  2848. data.elements [index2]);
  2849. }
  2850. data.exit();
  2851. }
  2852. void move (const int currentIndex,
  2853. int newIndex) throw()
  2854. {
  2855. if (currentIndex != newIndex)
  2856. {
  2857. data.enter();
  2858. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2859. {
  2860. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2861. newIndex = numUsed - 1;
  2862. ObjectClass* const value = data.elements [currentIndex];
  2863. if (newIndex > currentIndex)
  2864. {
  2865. memmove (data.elements + currentIndex,
  2866. data.elements + currentIndex + 1,
  2867. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2868. }
  2869. else
  2870. {
  2871. memmove (data.elements + newIndex + 1,
  2872. data.elements + newIndex,
  2873. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2874. }
  2875. data.elements [newIndex] = value;
  2876. }
  2877. data.exit();
  2878. }
  2879. }
  2880. void swapWithArray (OwnedArray <ObjectClass>& otherArray) throw()
  2881. {
  2882. data.enter();
  2883. otherArray.data.enter();
  2884. data.swapWith (otherArray.data);
  2885. swapVariables (numUsed, otherArray.numUsed);
  2886. otherArray.data.exit();
  2887. data.exit();
  2888. }
  2889. void minimiseStorageOverheads() throw()
  2890. {
  2891. data.enter();
  2892. data.shrinkToNoMoreThan (numUsed);
  2893. data.exit();
  2894. }
  2895. void ensureStorageAllocated (const int minNumElements) throw()
  2896. {
  2897. data.enter();
  2898. data.ensureAllocatedSize (minNumElements);
  2899. data.exit();
  2900. }
  2901. template <class ElementComparator>
  2902. void sort (ElementComparator& comparator,
  2903. const bool retainOrderOfEquivalentItems = false) const throw()
  2904. {
  2905. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2906. // avoids getting warning messages about the parameter being unused
  2907. data.enter();
  2908. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  2909. data.exit();
  2910. }
  2911. void lockArray() const throw()
  2912. {
  2913. data.enter();
  2914. }
  2915. void unlockArray() const throw()
  2916. {
  2917. data.exit();
  2918. }
  2919. juce_UseDebuggingNewOperator
  2920. private:
  2921. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2922. int numUsed;
  2923. // disallow copy constructor and assignment
  2924. OwnedArray (const OwnedArray&);
  2925. OwnedArray& operator= (const OwnedArray&);
  2926. };
  2927. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2928. /*** End of inlined file: juce_OwnedArray.h ***/
  2929. #endif
  2930. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2931. /*** Start of inlined file: juce_PropertySet.h ***/
  2932. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2933. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2934. /*** Start of inlined file: juce_StringPairArray.h ***/
  2935. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2936. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2937. /*** Start of inlined file: juce_StringArray.h ***/
  2938. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2939. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2940. #ifndef DOXYGEN
  2941. // (used in StringArray::appendNumbersToDuplicates)
  2942. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2943. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2944. #endif
  2945. class JUCE_API StringArray
  2946. {
  2947. public:
  2948. StringArray() throw();
  2949. StringArray (const StringArray& other);
  2950. StringArray (const juce_wchar** const strings,
  2951. const int numberOfStrings);
  2952. StringArray (const char** const strings,
  2953. const int numberOfStrings);
  2954. explicit StringArray (const juce_wchar** const strings);
  2955. explicit StringArray (const char** const strings);
  2956. ~StringArray();
  2957. const StringArray& operator= (const StringArray& other);
  2958. bool operator== (const StringArray& other) const;
  2959. bool operator!= (const StringArray& other) const;
  2960. inline int size() const throw() { return strings.size(); };
  2961. const String& operator[] (const int index) const throw();
  2962. bool contains (const String& stringToLookFor,
  2963. const bool ignoreCase = false) const;
  2964. int indexOf (const String& stringToLookFor,
  2965. const bool ignoreCase = false,
  2966. int startIndex = 0) const;
  2967. void add (const String& stringToAdd);
  2968. void insert (const int index, const String& stringToAdd);
  2969. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2970. void set (const int index, const String& newString);
  2971. void addArray (const StringArray& other,
  2972. int startIndex = 0,
  2973. int numElementsToAdd = -1);
  2974. int addTokens (const tchar* const stringToTokenise,
  2975. const bool preserveQuotedStrings);
  2976. int addTokens (const tchar* const stringToTokenise,
  2977. const tchar* breakCharacters,
  2978. const tchar* quoteCharacters);
  2979. int addLines (const tchar* stringToBreakUp);
  2980. void clear();
  2981. void remove (const int index);
  2982. void removeString (const String& stringToRemove,
  2983. const bool ignoreCase = false);
  2984. void removeDuplicates (const bool ignoreCase);
  2985. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2986. void move (const int currentIndex, int newIndex) throw();
  2987. void trim();
  2988. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2989. const bool appendNumberToFirstInstance,
  2990. const tchar* const preNumberString = defaultPreNumberString,
  2991. const tchar* const postNumberString = defaultPostNumberString);
  2992. const String joinIntoString (const String& separatorString,
  2993. int startIndex = 0,
  2994. int numberOfElements = -1) const;
  2995. void sort (const bool ignoreCase);
  2996. void minimiseStorageOverheads();
  2997. juce_UseDebuggingNewOperator
  2998. private:
  2999. Array <String> strings;
  3000. };
  3001. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  3002. /*** End of inlined file: juce_StringArray.h ***/
  3003. class JUCE_API StringPairArray
  3004. {
  3005. public:
  3006. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  3007. StringPairArray (const StringPairArray& other) throw();
  3008. ~StringPairArray() throw();
  3009. const StringPairArray& operator= (const StringPairArray& other) throw();
  3010. bool operator== (const StringPairArray& other) const throw();
  3011. bool operator!= (const StringPairArray& other) const throw();
  3012. const String& operator[] (const String& key) const throw();
  3013. const String getValue (const String& key, const String& defaultReturnValue) const;
  3014. const StringArray& getAllKeys() const throw() { return keys; }
  3015. const StringArray& getAllValues() const throw() { return values; }
  3016. inline int size() const throw() { return keys.size(); };
  3017. void set (const String& key,
  3018. const String& value) throw();
  3019. void addArray (const StringPairArray& other);
  3020. void clear() throw();
  3021. void remove (const String& key) throw();
  3022. void remove (const int index) throw();
  3023. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  3024. const String getDescription() const;
  3025. void minimiseStorageOverheads() throw();
  3026. juce_UseDebuggingNewOperator
  3027. private:
  3028. StringArray keys, values;
  3029. bool ignoreCase;
  3030. };
  3031. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3032. /*** End of inlined file: juce_StringPairArray.h ***/
  3033. /*** Start of inlined file: juce_XmlElement.h ***/
  3034. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3035. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3036. /*** Start of inlined file: juce_File.h ***/
  3037. #ifndef __JUCE_FILE_JUCEHEADER__
  3038. #define __JUCE_FILE_JUCEHEADER__
  3039. /*** Start of inlined file: juce_Time.h ***/
  3040. #ifndef __JUCE_TIME_JUCEHEADER__
  3041. #define __JUCE_TIME_JUCEHEADER__
  3042. /*** Start of inlined file: juce_RelativeTime.h ***/
  3043. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3044. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3045. class JUCE_API RelativeTime
  3046. {
  3047. public:
  3048. explicit RelativeTime (const double seconds = 0.0) throw();
  3049. RelativeTime (const RelativeTime& other) throw();
  3050. const RelativeTime& operator= (const RelativeTime& other) throw();
  3051. ~RelativeTime() throw();
  3052. static const RelativeTime milliseconds (const int milliseconds) throw();
  3053. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  3054. static const RelativeTime minutes (const double numberOfMinutes) throw();
  3055. static const RelativeTime hours (const double numberOfHours) throw();
  3056. static const RelativeTime days (const double numberOfDays) throw();
  3057. static const RelativeTime weeks (const double numberOfWeeks) throw();
  3058. int64 inMilliseconds() const throw();
  3059. double inSeconds() const throw() { return seconds; }
  3060. double inMinutes() const throw();
  3061. double inHours() const throw();
  3062. double inDays() const throw();
  3063. double inWeeks() const throw();
  3064. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  3065. bool operator== (const RelativeTime& other) const throw();
  3066. bool operator!= (const RelativeTime& other) const throw();
  3067. bool operator> (const RelativeTime& other) const throw();
  3068. bool operator< (const RelativeTime& other) const throw();
  3069. bool operator>= (const RelativeTime& other) const throw();
  3070. bool operator<= (const RelativeTime& other) const throw();
  3071. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3072. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3073. const RelativeTime operator+ (const double secondsToAdd) const throw();
  3074. const RelativeTime operator- (const double secondsToSubtract) const throw();
  3075. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3076. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3077. const RelativeTime& operator+= (const double secondsToAdd) throw();
  3078. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  3079. juce_UseDebuggingNewOperator
  3080. private:
  3081. double seconds;
  3082. };
  3083. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3084. /*** End of inlined file: juce_RelativeTime.h ***/
  3085. class JUCE_API Time
  3086. {
  3087. public:
  3088. Time() throw();
  3089. Time (const Time& other) throw();
  3090. Time (const int64 millisecondsSinceEpoch) throw();
  3091. Time (const int year,
  3092. const int month,
  3093. const int day,
  3094. const int hours,
  3095. const int minutes,
  3096. const int seconds = 0,
  3097. const int milliseconds = 0,
  3098. const bool useLocalTime = true) throw();
  3099. ~Time() throw();
  3100. const Time& operator= (const Time& other) throw();
  3101. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3102. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3103. int getYear() const throw();
  3104. int getMonth() const throw();
  3105. const String getMonthName (const bool threeLetterVersion) const throw();
  3106. int getDayOfMonth() const throw();
  3107. int getDayOfWeek() const throw();
  3108. const String getWeekdayName (const bool threeLetterVersion) const throw();
  3109. int getHours() const throw();
  3110. bool isAfternoon() const throw();
  3111. int getHoursInAmPmFormat() const throw();
  3112. int getMinutes() const throw();
  3113. int getSeconds() const throw();
  3114. int getMilliseconds() const throw();
  3115. bool isDaylightSavingTime() const throw();
  3116. const String getTimeZone() const throw();
  3117. const String toString (const bool includeDate,
  3118. const bool includeTime,
  3119. const bool includeSeconds = true,
  3120. const bool use24HourClock = false) const throw();
  3121. const String formatted (const tchar* const format) const throw();
  3122. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3123. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3124. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3125. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3126. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3127. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3128. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3129. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3130. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3131. bool setSystemTimeToThisTime() const throw();
  3132. static const String getWeekdayName (int dayNumber,
  3133. const bool threeLetterVersion) throw();
  3134. static const String getMonthName (int monthNumber,
  3135. const bool threeLetterVersion) throw();
  3136. // Static methods for getting system timers directly..
  3137. static int64 currentTimeMillis() throw();
  3138. static uint32 getMillisecondCounter() throw();
  3139. static double getMillisecondCounterHiRes() throw();
  3140. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  3141. static uint32 getApproximateMillisecondCounter() throw();
  3142. // High-resolution timers..
  3143. static int64 getHighResolutionTicks() throw();
  3144. static int64 getHighResolutionTicksPerSecond() throw();
  3145. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  3146. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  3147. private:
  3148. int64 millisSinceEpoch;
  3149. };
  3150. #endif // __JUCE_TIME_JUCEHEADER__
  3151. /*** End of inlined file: juce_Time.h ***/
  3152. class FileInputStream;
  3153. class FileOutputStream;
  3154. class JUCE_API File
  3155. {
  3156. public:
  3157. File() {}
  3158. File (const String& path);
  3159. File (const File& other);
  3160. ~File() {}
  3161. const File& operator= (const String& newFilePath);
  3162. const File& operator= (const File& otherFile);
  3163. static const File nonexistent;
  3164. bool exists() const;
  3165. bool existsAsFile() const;
  3166. bool isDirectory() const;
  3167. int64 getSize() const;
  3168. static const String descriptionOfSizeInBytes (const int64 bytes);
  3169. const String& getFullPathName() const { return fullPath; }
  3170. const String getFileName() const;
  3171. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3172. const String getFileExtension() const;
  3173. bool hasFileExtension (const String& extensionToTest) const;
  3174. const File withFileExtension (const String& newExtension) const;
  3175. const String getFileNameWithoutExtension() const;
  3176. int hashCode() const;
  3177. int64 hashCode64() const;
  3178. const File getChildFile (String relativePath) const;
  3179. const File getSiblingFile (const String& siblingFileName) const;
  3180. const File getParentDirectory() const;
  3181. bool isAChildOf (const File& potentialParentDirectory) const;
  3182. const File getNonexistentChildFile (const String& prefix,
  3183. const String& suffix,
  3184. bool putNumbersInBrackets = true) const;
  3185. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3186. bool operator== (const File& otherFile) const;
  3187. bool operator!= (const File& otherFile) const;
  3188. bool hasWriteAccess() const;
  3189. bool setReadOnly (const bool shouldBeReadOnly,
  3190. const bool applyRecursively = false) const;
  3191. bool isHidden() const;
  3192. const File getLinkedTarget() const;
  3193. const Time getLastModificationTime() const;
  3194. const Time getLastAccessTime() const;
  3195. const Time getCreationTime() const;
  3196. bool setLastModificationTime (const Time& newTime) const;
  3197. bool setLastAccessTime (const Time& newTime) const;
  3198. bool setCreationTime (const Time& newTime) const;
  3199. const String getVersion() const;
  3200. bool create() const;
  3201. bool createDirectory() const;
  3202. bool deleteFile() const;
  3203. bool deleteRecursively() const;
  3204. bool moveToTrash() const;
  3205. bool moveFileTo (const File& targetLocation) const;
  3206. bool copyFileTo (const File& targetLocation) const;
  3207. bool copyDirectoryTo (const File& newDirectory) const;
  3208. enum TypesOfFileToFind
  3209. {
  3210. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3211. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3212. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3213. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3214. };
  3215. int findChildFiles (Array<File>& results,
  3216. const int whatToLookFor,
  3217. const bool searchRecursively,
  3218. const String& wildCardPattern = JUCE_T("*")) const;
  3219. int getNumberOfChildFiles (const int whatToLookFor,
  3220. const String& wildCardPattern = JUCE_T("*")) const;
  3221. bool containsSubDirectories() const;
  3222. FileInputStream* createInputStream() const;
  3223. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3224. bool loadFileAsData (MemoryBlock& result) const;
  3225. const String loadFileAsString() const;
  3226. bool appendData (const void* const dataToAppend,
  3227. const int numberOfBytes) const;
  3228. bool replaceWithData (const void* const dataToWrite,
  3229. const int numberOfBytes) const;
  3230. bool appendText (const String& textToAppend,
  3231. const bool asUnicode = false,
  3232. const bool writeUnicodeHeaderBytes = false) const;
  3233. bool replaceWithText (const String& textToWrite,
  3234. const bool asUnicode = false,
  3235. const bool writeUnicodeHeaderBytes = false) const;
  3236. static void findFileSystemRoots (Array<File>& results);
  3237. const String getVolumeLabel() const;
  3238. int getVolumeSerialNumber() const;
  3239. int64 getBytesFreeOnVolume() const;
  3240. int64 getVolumeTotalSize() const;
  3241. bool isOnCDRomDrive() const;
  3242. bool isOnHardDisk() const;
  3243. bool isOnRemovableDrive() const;
  3244. bool startAsProcess (const String& parameters = String::empty) const;
  3245. void revealToUser() const;
  3246. enum SpecialLocationType
  3247. {
  3248. userHomeDirectory,
  3249. userDocumentsDirectory,
  3250. userDesktopDirectory,
  3251. userApplicationDataDirectory,
  3252. commonApplicationDataDirectory,
  3253. tempDirectory,
  3254. currentExecutableFile,
  3255. currentApplicationFile,
  3256. invokedExecutableFile,
  3257. globalApplicationsDirectory,
  3258. userMusicDirectory,
  3259. userMoviesDirectory,
  3260. };
  3261. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3262. static const File createTempFile (const String& fileNameEnding);
  3263. static const File getCurrentWorkingDirectory();
  3264. bool setAsCurrentWorkingDirectory() const;
  3265. static const tchar separator;
  3266. static const tchar* separatorString;
  3267. static const String createLegalFileName (const String& fileNameToFix);
  3268. static const String createLegalPathName (const String& pathNameToFix);
  3269. static bool areFileNamesCaseSensitive();
  3270. static bool isAbsolutePath (const String& path);
  3271. static const File createFileWithoutCheckingPath (const String& path);
  3272. juce_UseDebuggingNewOperator
  3273. private:
  3274. String fullPath;
  3275. // internal way of contructing a file without checking the path
  3276. friend class DirectoryIterator;
  3277. File (const String&, int);
  3278. const String getPathUpToLastSlash() const;
  3279. };
  3280. #endif // __JUCE_FILE_JUCEHEADER__
  3281. /*** End of inlined file: juce_File.h ***/
  3282. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3283. \
  3284. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3285. childElementVariableName != 0; \
  3286. childElementVariableName = childElementVariableName->getNextElement())
  3287. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3288. \
  3289. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3290. childElementVariableName != 0; \
  3291. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3292. class JUCE_API XmlElement
  3293. {
  3294. public:
  3295. XmlElement (const String& tagName) throw();
  3296. XmlElement (const XmlElement& other) throw();
  3297. const XmlElement& operator= (const XmlElement& other) throw();
  3298. ~XmlElement() throw();
  3299. bool isEquivalentTo (const XmlElement* const other,
  3300. const bool ignoreOrderOfAttributes) const throw();
  3301. const String createDocument (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. void writeToStream (OutputStream& output,
  3307. const String& dtdToUse,
  3308. const bool allOnOneLine = false,
  3309. const bool includeXmlHeader = true,
  3310. const String& encodingType = JUCE_T("UTF-8"),
  3311. const int lineWrapLength = 60) const throw();
  3312. bool writeToFile (const File& destinationFile,
  3313. const String& dtdToUse,
  3314. const String& encodingType = JUCE_T("UTF-8"),
  3315. const int lineWrapLength = 60) const throw();
  3316. inline const String& getTagName() const throw() { return tagName; }
  3317. bool hasTagName (const String& possibleTagName) const throw();
  3318. int getNumAttributes() const throw();
  3319. const String& getAttributeName (const int attributeIndex) const throw();
  3320. const String& getAttributeValue (const int attributeIndex) const throw();
  3321. // Attribute-handling methods..
  3322. bool hasAttribute (const String& attributeName) const throw();
  3323. const String getStringAttribute (const String& attributeName,
  3324. const String& defaultReturnValue = String::empty) const throw();
  3325. bool compareAttribute (const String& attributeName,
  3326. const String& stringToCompareAgainst,
  3327. const bool ignoreCase = false) const throw();
  3328. int getIntAttribute (const String& attributeName,
  3329. const int defaultReturnValue = 0) const throw();
  3330. double getDoubleAttribute (const String& attributeName,
  3331. const double defaultReturnValue = 0.0) const throw();
  3332. bool getBoolAttribute (const String& attributeName,
  3333. const bool defaultReturnValue = false) const throw();
  3334. void setAttribute (const String& attributeName,
  3335. const String& newValue) throw();
  3336. void setAttribute (const String& attributeName,
  3337. const int newValue) throw();
  3338. void setAttribute (const String& attributeName,
  3339. const double newValue) throw();
  3340. void removeAttribute (const String& attributeName) throw();
  3341. void removeAllAttributes() throw();
  3342. // Child element methods..
  3343. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3344. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3345. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3346. int getNumChildElements() const throw();
  3347. XmlElement* getChildElement (const int index) const throw();
  3348. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3349. void addChildElement (XmlElement* const newChildElement) throw();
  3350. void insertChildElement (XmlElement* const newChildNode,
  3351. int indexToInsertAt) throw();
  3352. XmlElement* createNewChildElement (const String& tagName);
  3353. bool replaceChildElement (XmlElement* const currentChildElement,
  3354. XmlElement* const newChildNode) throw();
  3355. void removeChildElement (XmlElement* const childToRemove,
  3356. const bool shouldDeleteTheChild) throw();
  3357. void deleteAllChildElements() throw();
  3358. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3359. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3360. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3361. template <class ElementComparator>
  3362. void sortChildElements (ElementComparator& comparator,
  3363. const bool retainOrderOfEquivalentItems = false) throw()
  3364. {
  3365. const int num = getNumChildElements();
  3366. if (num > 1)
  3367. {
  3368. HeapBlock <XmlElement*> elems (num);
  3369. getChildElementsAsArray (elems);
  3370. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3371. reorderChildElements (elems, num);
  3372. }
  3373. }
  3374. bool isTextElement() const throw();
  3375. const String getText() const throw();
  3376. void setText (const String& newText) throw();
  3377. const String getAllSubText() const throw();
  3378. const String getChildElementAllSubText (const String& childTagName,
  3379. const String& defaultReturnValue) const throw();
  3380. void addTextElement (const String& text) throw();
  3381. void deleteAllTextElements() throw();
  3382. static XmlElement* createTextElement (const String& text) throw();
  3383. juce_UseDebuggingNewOperator
  3384. private:
  3385. friend class XmlDocument;
  3386. String tagName;
  3387. XmlElement* firstChildElement;
  3388. XmlElement* nextElement;
  3389. struct XmlAttributeNode
  3390. {
  3391. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3392. XmlAttributeNode (const String& name, const String& value) throw();
  3393. String name, value;
  3394. XmlAttributeNode* next;
  3395. private:
  3396. const XmlAttributeNode& operator= (const XmlAttributeNode&);
  3397. };
  3398. XmlAttributeNode* attributes;
  3399. XmlElement (int) throw(); // for internal use
  3400. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3401. void writeElementAsText (OutputStream& out,
  3402. const int indentationLevel,
  3403. const int lineWrapLength) const throw();
  3404. void getChildElementsAsArray (XmlElement**) const throw();
  3405. void reorderChildElements (XmlElement** const, const int) throw();
  3406. };
  3407. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3408. /*** End of inlined file: juce_XmlElement.h ***/
  3409. class JUCE_API PropertySet
  3410. {
  3411. public:
  3412. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3413. PropertySet (const PropertySet& other) throw();
  3414. const PropertySet& operator= (const PropertySet& other) throw();
  3415. virtual ~PropertySet();
  3416. const String getValue (const String& keyName,
  3417. const String& defaultReturnValue = String::empty) const throw();
  3418. int getIntValue (const String& keyName,
  3419. const int defaultReturnValue = 0) const throw();
  3420. double getDoubleValue (const String& keyName,
  3421. const double defaultReturnValue = 0.0) const throw();
  3422. bool getBoolValue (const String& keyName,
  3423. const bool defaultReturnValue = false) const throw();
  3424. XmlElement* getXmlValue (const String& keyName) const;
  3425. void setValue (const String& keyName, const String& value) throw();
  3426. void setValue (const String& keyName, const tchar* const value) throw();
  3427. void setValue (const String& keyName, const int value) throw();
  3428. void setValue (const String& keyName, const double value) throw();
  3429. void setValue (const String& keyName, const bool value) throw();
  3430. void setValue (const String& keyName, const XmlElement* const xml);
  3431. void removeValue (const String& keyName) throw();
  3432. bool containsKey (const String& keyName) const throw();
  3433. void clear();
  3434. StringPairArray& getAllProperties() throw() { return properties; }
  3435. const CriticalSection& getLock() const throw() { return lock; }
  3436. XmlElement* createXml (const String& nodeName) const throw();
  3437. void restoreFromXml (const XmlElement& xml) throw();
  3438. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3439. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3440. juce_UseDebuggingNewOperator
  3441. protected:
  3442. virtual void propertyChanged();
  3443. private:
  3444. StringPairArray properties;
  3445. PropertySet* fallbackProperties;
  3446. CriticalSection lock;
  3447. bool ignoreCaseOfKeys;
  3448. };
  3449. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3450. /*** End of inlined file: juce_PropertySet.h ***/
  3451. #endif
  3452. #ifndef __JUCE_RANGE_JUCEHEADER__
  3453. /*** Start of inlined file: juce_Range.h ***/
  3454. #ifndef __JUCE_RANGE_JUCEHEADER__
  3455. #define __JUCE_RANGE_JUCEHEADER__
  3456. template <typename ValueType>
  3457. class Range
  3458. {
  3459. public:
  3460. Range() throw()
  3461. : start (ValueType()), end (ValueType())
  3462. {
  3463. }
  3464. Range (const ValueType start_, const ValueType end_) throw()
  3465. : start (start_), end (jmax (start_, end_))
  3466. {
  3467. }
  3468. Range (const Range& other) throw()
  3469. : start (other.start), end (other.end)
  3470. {
  3471. }
  3472. Range& operator= (const Range& other) throw()
  3473. {
  3474. start = other.start;
  3475. end = other.end;
  3476. return *this;
  3477. }
  3478. ~Range() throw()
  3479. {
  3480. }
  3481. static const Range between (const ValueType position1, const ValueType position2) throw()
  3482. {
  3483. return (position1 < position2) ? Range (position1, position2)
  3484. : Range (position2, position1);
  3485. }
  3486. static const Range emptyRange (const ValueType start) throw()
  3487. {
  3488. return Range (start, start);
  3489. }
  3490. inline ValueType getStart() const throw() { return start; }
  3491. inline ValueType getLength() const throw() { return end - start; }
  3492. inline ValueType getEnd() const throw() { return end; }
  3493. inline bool isEmpty() const throw() { return start == end; }
  3494. void setStart (const ValueType newStart) throw()
  3495. {
  3496. start = newStart;
  3497. if (newStart > end)
  3498. end = newStart;
  3499. }
  3500. void setEnd (const ValueType newEnd) throw()
  3501. {
  3502. end = newEnd;
  3503. if (newEnd < start)
  3504. start = newEnd;
  3505. }
  3506. void setLength (const ValueType newLength) throw()
  3507. {
  3508. end = start + jmax (ValueType(), newLength);
  3509. }
  3510. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3511. {
  3512. start += amountToAdd;
  3513. end += amountToAdd;
  3514. return *this;
  3515. }
  3516. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3517. {
  3518. start -= amountToSubtract;
  3519. end -= amountToSubtract;
  3520. return *this;
  3521. }
  3522. const Range operator+ (const ValueType amountToAdd) const throw()
  3523. {
  3524. return Range (start + amountToAdd, end + amountToAdd);
  3525. }
  3526. const Range operator- (const ValueType amountToSubtract) const throw()
  3527. {
  3528. return Range (start - amountToSubtract, end - amountToSubtract);
  3529. }
  3530. bool contains (const ValueType position) const throw()
  3531. {
  3532. return position >= start && position < end;
  3533. }
  3534. ValueType clipValue (const ValueType value) const throw()
  3535. {
  3536. return jlimit (start, end, value);
  3537. }
  3538. bool intersects (const Range& other) const throw()
  3539. {
  3540. return other.start < end && other.end > start;
  3541. }
  3542. const Range getIntersectionWith (const Range& other) const throw()
  3543. {
  3544. return Range (jmax (start, other.start),
  3545. jmin (end, other.end));
  3546. }
  3547. const Range getUnionWith (const Range& other) const throw()
  3548. {
  3549. return Range (jmin (start, other.start),
  3550. jmax (end, other.end));
  3551. }
  3552. juce_UseDebuggingNewOperator
  3553. private:
  3554. ValueType start, end;
  3555. };
  3556. #endif // __JUCE_RANGE_JUCEHEADER__
  3557. /*** End of inlined file: juce_Range.h ***/
  3558. #endif
  3559. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3560. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3561. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3562. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3563. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3564. class ReferenceCountedArray
  3565. {
  3566. public:
  3567. ReferenceCountedArray() throw()
  3568. : numUsed (0)
  3569. {
  3570. }
  3571. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3572. {
  3573. other.lockArray();
  3574. numUsed = other.numUsed;
  3575. data.setAllocatedSize (numUsed);
  3576. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3577. for (int i = numUsed; --i >= 0;)
  3578. if (data.elements[i] != 0)
  3579. data.elements[i]->incReferenceCount();
  3580. other.unlockArray();
  3581. }
  3582. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3583. {
  3584. if (this != &other)
  3585. {
  3586. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3587. swapWithArray (other);
  3588. }
  3589. return *this;
  3590. }
  3591. ~ReferenceCountedArray()
  3592. {
  3593. clear();
  3594. }
  3595. void clear()
  3596. {
  3597. data.enter();
  3598. while (numUsed > 0)
  3599. if (data.elements [--numUsed] != 0)
  3600. data.elements [numUsed]->decReferenceCount();
  3601. jassert (numUsed == 0);
  3602. data.setAllocatedSize (0);
  3603. data.exit();
  3604. }
  3605. inline int size() const throw()
  3606. {
  3607. return numUsed;
  3608. }
  3609. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3610. {
  3611. data.enter();
  3612. const ReferenceCountedObjectPtr<ObjectClass> result ((((unsigned int) index) < (unsigned int) numUsed)
  3613. ? data.elements [index]
  3614. : (ObjectClass*) 0);
  3615. data.exit();
  3616. return result;
  3617. }
  3618. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3619. {
  3620. data.enter();
  3621. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3622. const ReferenceCountedObjectPtr<ObjectClass> result (data.elements [index]);
  3623. data.exit();
  3624. return result;
  3625. }
  3626. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3627. {
  3628. data.enter();
  3629. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [0]
  3630. : (ObjectClass*) 0);
  3631. data.exit();
  3632. return result;
  3633. }
  3634. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3635. {
  3636. data.enter();
  3637. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [numUsed - 1]
  3638. : (ObjectClass*) 0);
  3639. data.exit();
  3640. return result;
  3641. }
  3642. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3643. {
  3644. int result = -1;
  3645. data.enter();
  3646. ObjectClass** e = data.elements;
  3647. for (int i = numUsed; --i >= 0;)
  3648. {
  3649. if (objectToLookFor == *e)
  3650. {
  3651. result = (int) (e - data.elements);
  3652. break;
  3653. }
  3654. ++e;
  3655. }
  3656. data.exit();
  3657. return result;
  3658. }
  3659. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3660. {
  3661. data.enter();
  3662. ObjectClass** e = data.elements;
  3663. for (int i = numUsed; --i >= 0;)
  3664. {
  3665. if (objectToLookFor == *e)
  3666. {
  3667. data.exit();
  3668. return true;
  3669. }
  3670. ++e;
  3671. }
  3672. data.exit();
  3673. return false;
  3674. }
  3675. void add (ObjectClass* const newObject) throw()
  3676. {
  3677. data.enter();
  3678. data.ensureAllocatedSize (numUsed + 1);
  3679. data.elements [numUsed++] = newObject;
  3680. if (newObject != 0)
  3681. newObject->incReferenceCount();
  3682. data.exit();
  3683. }
  3684. void insert (int indexToInsertAt,
  3685. ObjectClass* const newObject) throw()
  3686. {
  3687. if (indexToInsertAt >= 0)
  3688. {
  3689. data.enter();
  3690. if (indexToInsertAt > numUsed)
  3691. indexToInsertAt = numUsed;
  3692. data.ensureAllocatedSize (numUsed + 1);
  3693. ObjectClass** const e = data.elements + indexToInsertAt;
  3694. const int numToMove = numUsed - indexToInsertAt;
  3695. if (numToMove > 0)
  3696. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3697. *e = newObject;
  3698. if (newObject != 0)
  3699. newObject->incReferenceCount();
  3700. ++numUsed;
  3701. data.exit();
  3702. }
  3703. else
  3704. {
  3705. add (newObject);
  3706. }
  3707. }
  3708. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3709. {
  3710. data.enter();
  3711. if (! contains (newObject))
  3712. add (newObject);
  3713. data.exit();
  3714. }
  3715. void set (const int indexToChange,
  3716. ObjectClass* const newObject)
  3717. {
  3718. if (indexToChange >= 0)
  3719. {
  3720. data.enter();
  3721. if (newObject != 0)
  3722. newObject->incReferenceCount();
  3723. if (indexToChange < numUsed)
  3724. {
  3725. if (data.elements [indexToChange] != 0)
  3726. data.elements [indexToChange]->decReferenceCount();
  3727. data.elements [indexToChange] = newObject;
  3728. }
  3729. else
  3730. {
  3731. data.ensureAllocatedSize (numUsed + 1);
  3732. data.elements [numUsed++] = newObject;
  3733. }
  3734. data.exit();
  3735. }
  3736. }
  3737. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3738. int startIndex = 0,
  3739. int numElementsToAdd = -1) throw()
  3740. {
  3741. arrayToAddFrom.lockArray();
  3742. data.enter();
  3743. if (startIndex < 0)
  3744. {
  3745. jassertfalse
  3746. startIndex = 0;
  3747. }
  3748. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3749. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3750. if (numElementsToAdd > 0)
  3751. {
  3752. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3753. while (--numElementsToAdd >= 0)
  3754. add (arrayToAddFrom.getUnchecked (startIndex++));
  3755. }
  3756. data.exit();
  3757. arrayToAddFrom.unlockArray();
  3758. }
  3759. template <class ElementComparator>
  3760. void addSorted (ElementComparator& comparator,
  3761. ObjectClass* newObject) throw()
  3762. {
  3763. data.enter();
  3764. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  3765. data.exit();
  3766. }
  3767. template <class ElementComparator>
  3768. void addOrReplaceSorted (ElementComparator& comparator,
  3769. ObjectClass* newObject) throw()
  3770. {
  3771. data.enter();
  3772. const int index = findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed);
  3773. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3774. set (index - 1, newObject); // replace an existing object that matches
  3775. else
  3776. insert (index, newObject); // no match, so insert the new one
  3777. data.exit();
  3778. }
  3779. void remove (const int indexToRemove)
  3780. {
  3781. data.enter();
  3782. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3783. {
  3784. ObjectClass** const e = data.elements + indexToRemove;
  3785. if (*e != 0)
  3786. (*e)->decReferenceCount();
  3787. --numUsed;
  3788. const int numberToShift = numUsed - indexToRemove;
  3789. if (numberToShift > 0)
  3790. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3791. if ((numUsed << 1) < data.numAllocated)
  3792. minimiseStorageOverheads();
  3793. }
  3794. data.exit();
  3795. }
  3796. void removeObject (ObjectClass* const objectToRemove)
  3797. {
  3798. data.enter();
  3799. remove (indexOf (objectToRemove));
  3800. data.exit();
  3801. }
  3802. void removeRange (const int startIndex,
  3803. const int numberToRemove)
  3804. {
  3805. data.enter();
  3806. const int start = jlimit (0, numUsed, startIndex);
  3807. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3808. if (end > start)
  3809. {
  3810. int i;
  3811. for (i = start; i < end; ++i)
  3812. {
  3813. if (data.elements[i] != 0)
  3814. {
  3815. data.elements[i]->decReferenceCount();
  3816. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3817. }
  3818. }
  3819. const int rangeSize = end - start;
  3820. ObjectClass** e = data.elements + start;
  3821. i = numUsed - end;
  3822. numUsed -= rangeSize;
  3823. while (--i >= 0)
  3824. {
  3825. *e = e [rangeSize];
  3826. ++e;
  3827. }
  3828. if ((numUsed << 1) < data.numAllocated)
  3829. minimiseStorageOverheads();
  3830. }
  3831. data.exit();
  3832. }
  3833. void removeLast (int howManyToRemove = 1)
  3834. {
  3835. data.enter();
  3836. if (howManyToRemove > numUsed)
  3837. howManyToRemove = numUsed;
  3838. while (--howManyToRemove >= 0)
  3839. remove (numUsed - 1);
  3840. data.exit();
  3841. }
  3842. void swap (const int index1,
  3843. const int index2) throw()
  3844. {
  3845. data.enter();
  3846. if (((unsigned int) index1) < (unsigned int) numUsed
  3847. && ((unsigned int) index2) < (unsigned int) numUsed)
  3848. {
  3849. swapVariables (data.elements [index1],
  3850. data.elements [index2]);
  3851. }
  3852. data.exit();
  3853. }
  3854. void move (const int currentIndex,
  3855. int newIndex) throw()
  3856. {
  3857. if (currentIndex != newIndex)
  3858. {
  3859. data.enter();
  3860. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3861. {
  3862. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3863. newIndex = numUsed - 1;
  3864. ObjectClass* const value = data.elements [currentIndex];
  3865. if (newIndex > currentIndex)
  3866. {
  3867. memmove (data.elements + currentIndex,
  3868. data.elements + currentIndex + 1,
  3869. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3870. }
  3871. else
  3872. {
  3873. memmove (data.elements + newIndex + 1,
  3874. data.elements + newIndex,
  3875. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3876. }
  3877. data.elements [newIndex] = value;
  3878. }
  3879. data.exit();
  3880. }
  3881. }
  3882. void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
  3883. {
  3884. data.enter();
  3885. otherArray.data.enter();
  3886. data.swapWith (otherArray.data);
  3887. swapVariables (numUsed, otherArray.numUsed);
  3888. otherArray.data.exit();
  3889. data.exit();
  3890. }
  3891. bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3892. {
  3893. other.lockArray();
  3894. data.enter();
  3895. bool result = numUsed == other.numUsed;
  3896. if (result)
  3897. {
  3898. for (int i = numUsed; --i >= 0;)
  3899. {
  3900. if (data.elements [i] != other.data.elements [i])
  3901. {
  3902. result = false;
  3903. break;
  3904. }
  3905. }
  3906. }
  3907. data.exit();
  3908. other.unlockArray();
  3909. return result;
  3910. }
  3911. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3912. {
  3913. return ! operator== (other);
  3914. }
  3915. template <class ElementComparator>
  3916. void sort (ElementComparator& comparator,
  3917. const bool retainOrderOfEquivalentItems = false) const throw()
  3918. {
  3919. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3920. // avoids getting warning messages about the parameter being unused
  3921. data.enter();
  3922. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  3923. data.exit();
  3924. }
  3925. void minimiseStorageOverheads() throw()
  3926. {
  3927. data.enter();
  3928. data.shrinkToNoMoreThan (numUsed);
  3929. data.exit();
  3930. }
  3931. void lockArray() const throw()
  3932. {
  3933. data.enter();
  3934. }
  3935. void unlockArray() const throw()
  3936. {
  3937. data.exit();
  3938. }
  3939. juce_UseDebuggingNewOperator
  3940. private:
  3941. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3942. int numUsed;
  3943. };
  3944. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3945. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3946. #endif
  3947. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3948. #endif
  3949. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3950. #endif
  3951. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3952. /*** Start of inlined file: juce_SortedSet.h ***/
  3953. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3954. #define __JUCE_SORTEDSET_JUCEHEADER__
  3955. #if JUCE_MSVC
  3956. #pragma warning (push)
  3957. #pragma warning (disable: 4512)
  3958. #endif
  3959. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3960. class SortedSet
  3961. {
  3962. public:
  3963. SortedSet() throw()
  3964. : numUsed (0)
  3965. {
  3966. }
  3967. SortedSet (const SortedSet<ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3968. {
  3969. other.lockSet();
  3970. numUsed = other.numUsed;
  3971. data.setAllocatedSize (other.numUsed);
  3972. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3973. other.unlockSet();
  3974. }
  3975. ~SortedSet() throw()
  3976. {
  3977. }
  3978. SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3979. {
  3980. if (this != &other)
  3981. {
  3982. other.lockSet();
  3983. data.enter();
  3984. data.ensureAllocatedSize (other.size());
  3985. numUsed = other.numUsed;
  3986. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3987. minimiseStorageOverheads();
  3988. data.exit();
  3989. other.unlockSet();
  3990. }
  3991. return *this;
  3992. }
  3993. bool operator== (const SortedSet<ElementType>& other) const throw()
  3994. {
  3995. data.enter();
  3996. if (numUsed != other.numUsed)
  3997. {
  3998. data.exit();
  3999. return false;
  4000. }
  4001. for (int i = numUsed; --i >= 0;)
  4002. {
  4003. if (data.elements [i] != other.data.elements [i])
  4004. {
  4005. data.exit();
  4006. return false;
  4007. }
  4008. }
  4009. data.exit();
  4010. return true;
  4011. }
  4012. bool operator!= (const SortedSet<ElementType>& other) const throw()
  4013. {
  4014. return ! operator== (other);
  4015. }
  4016. void clear() throw()
  4017. {
  4018. data.enter();
  4019. data.setAllocatedSize (0);
  4020. numUsed = 0;
  4021. data.exit();
  4022. }
  4023. void clearQuick() throw()
  4024. {
  4025. data.enter();
  4026. numUsed = 0;
  4027. data.exit();
  4028. }
  4029. inline int size() const throw()
  4030. {
  4031. return numUsed;
  4032. }
  4033. inline ElementType operator[] (const int index) const throw()
  4034. {
  4035. data.enter();
  4036. const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
  4037. ? data.elements [index]
  4038. : (ElementType) 0;
  4039. data.exit();
  4040. return result;
  4041. }
  4042. inline ElementType getUnchecked (const int index) const throw()
  4043. {
  4044. data.enter();
  4045. jassert (((unsigned int) index) < (unsigned int) numUsed);
  4046. const ElementType result = data.elements [index];
  4047. data.exit();
  4048. return result;
  4049. }
  4050. inline ElementType getFirst() const throw()
  4051. {
  4052. data.enter();
  4053. const ElementType result = (numUsed > 0) ? data.elements [0]
  4054. : (ElementType) 0;
  4055. data.exit();
  4056. return result;
  4057. }
  4058. inline ElementType getLast() const throw()
  4059. {
  4060. data.enter();
  4061. const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
  4062. : (ElementType) 0;
  4063. data.exit();
  4064. return result;
  4065. }
  4066. int indexOf (const ElementType elementToLookFor) const throw()
  4067. {
  4068. data.enter();
  4069. int start = 0;
  4070. int end = numUsed;
  4071. for (;;)
  4072. {
  4073. if (start >= end)
  4074. {
  4075. data.exit();
  4076. return -1;
  4077. }
  4078. else if (elementToLookFor == data.elements [start])
  4079. {
  4080. data.exit();
  4081. return start;
  4082. }
  4083. else
  4084. {
  4085. const int halfway = (start + end) >> 1;
  4086. if (halfway == start)
  4087. {
  4088. data.exit();
  4089. return -1;
  4090. }
  4091. else if (elementToLookFor >= data.elements [halfway])
  4092. start = halfway;
  4093. else
  4094. end = halfway;
  4095. }
  4096. }
  4097. }
  4098. bool contains (const ElementType elementToLookFor) const throw()
  4099. {
  4100. data.enter();
  4101. int start = 0;
  4102. int end = numUsed;
  4103. for (;;)
  4104. {
  4105. if (start >= end)
  4106. {
  4107. data.exit();
  4108. return false;
  4109. }
  4110. else if (elementToLookFor == data.elements [start])
  4111. {
  4112. data.exit();
  4113. return true;
  4114. }
  4115. else
  4116. {
  4117. const int halfway = (start + end) >> 1;
  4118. if (halfway == start)
  4119. {
  4120. data.exit();
  4121. return false;
  4122. }
  4123. else if (elementToLookFor >= data.elements [halfway])
  4124. start = halfway;
  4125. else
  4126. end = halfway;
  4127. }
  4128. }
  4129. }
  4130. void add (const ElementType newElement) throw()
  4131. {
  4132. data.enter();
  4133. int start = 0;
  4134. int end = numUsed;
  4135. for (;;)
  4136. {
  4137. if (start >= end)
  4138. {
  4139. jassert (start <= end);
  4140. insertInternal (start, newElement);
  4141. break;
  4142. }
  4143. else if (newElement == data.elements [start])
  4144. {
  4145. break;
  4146. }
  4147. else
  4148. {
  4149. const int halfway = (start + end) >> 1;
  4150. if (halfway == start)
  4151. {
  4152. if (newElement >= data.elements [halfway])
  4153. insertInternal (start + 1, newElement);
  4154. else
  4155. insertInternal (start, newElement);
  4156. break;
  4157. }
  4158. else if (newElement >= data.elements [halfway])
  4159. start = halfway;
  4160. else
  4161. end = halfway;
  4162. }
  4163. }
  4164. data.exit();
  4165. }
  4166. void addArray (const ElementType* elementsToAdd,
  4167. int numElementsToAdd) throw()
  4168. {
  4169. data.enter();
  4170. while (--numElementsToAdd >= 0)
  4171. add (*elementsToAdd++);
  4172. data.exit();
  4173. }
  4174. template <class OtherSetType>
  4175. void addSet (const OtherSetType& setToAddFrom,
  4176. int startIndex = 0,
  4177. int numElementsToAdd = -1) throw()
  4178. {
  4179. setToAddFrom.lockSet();
  4180. data.enter();
  4181. jassert (this != &setToAddFrom);
  4182. if (this != &setToAddFrom)
  4183. {
  4184. if (startIndex < 0)
  4185. {
  4186. jassertfalse
  4187. startIndex = 0;
  4188. }
  4189. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4190. numElementsToAdd = setToAddFrom.size() - startIndex;
  4191. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4192. }
  4193. data.exit();
  4194. setToAddFrom.unlockSet();
  4195. }
  4196. ElementType remove (const int indexToRemove) throw()
  4197. {
  4198. data.enter();
  4199. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4200. {
  4201. --numUsed;
  4202. ElementType* const e = data.elements + indexToRemove;
  4203. ElementType const removed = *e;
  4204. const int numberToShift = numUsed - indexToRemove;
  4205. if (numberToShift > 0)
  4206. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4207. if ((numUsed << 1) < data.numAllocated)
  4208. minimiseStorageOverheads();
  4209. data.exit();
  4210. return removed;
  4211. }
  4212. else
  4213. {
  4214. data.exit();
  4215. return 0;
  4216. }
  4217. }
  4218. void removeValue (const ElementType valueToRemove) throw()
  4219. {
  4220. data.enter();
  4221. remove (indexOf (valueToRemove));
  4222. data.exit();
  4223. }
  4224. template <class OtherSetType>
  4225. void removeValuesIn (const OtherSetType& otherSet) throw()
  4226. {
  4227. otherSet.lockSet();
  4228. data.enter();
  4229. if (this == &otherSet)
  4230. {
  4231. clear();
  4232. }
  4233. else
  4234. {
  4235. if (otherSet.size() > 0)
  4236. {
  4237. for (int i = numUsed; --i >= 0;)
  4238. if (otherSet.contains (data.elements [i]))
  4239. remove (i);
  4240. }
  4241. }
  4242. data.exit();
  4243. otherSet.unlockSet();
  4244. }
  4245. template <class OtherSetType>
  4246. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4247. {
  4248. otherSet.lockSet();
  4249. data.enter();
  4250. if (this != &otherSet)
  4251. {
  4252. if (otherSet.size() <= 0)
  4253. {
  4254. clear();
  4255. }
  4256. else
  4257. {
  4258. for (int i = numUsed; --i >= 0;)
  4259. if (! otherSet.contains (data.elements [i]))
  4260. remove (i);
  4261. }
  4262. }
  4263. data.exit();
  4264. otherSet.lockSet();
  4265. }
  4266. void minimiseStorageOverheads() throw()
  4267. {
  4268. data.enter();
  4269. data.shrinkToNoMoreThan (numUsed);
  4270. data.exit();
  4271. }
  4272. void lockSet() const throw()
  4273. {
  4274. data.enter();
  4275. }
  4276. void unlockSet() const throw()
  4277. {
  4278. data.exit();
  4279. }
  4280. juce_UseDebuggingNewOperator
  4281. private:
  4282. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4283. int numUsed;
  4284. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4285. {
  4286. data.ensureAllocatedSize (numUsed + 1);
  4287. ElementType* const insertPos = data.elements + indexToInsertAt;
  4288. const int numberToMove = numUsed - indexToInsertAt;
  4289. if (numberToMove > 0)
  4290. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4291. *insertPos = newElement;
  4292. ++numUsed;
  4293. }
  4294. };
  4295. #if JUCE_MSVC
  4296. #pragma warning (pop)
  4297. #endif
  4298. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4299. /*** End of inlined file: juce_SortedSet.h ***/
  4300. #endif
  4301. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4302. /*** Start of inlined file: juce_SparseSet.h ***/
  4303. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4304. #define __JUCE_SPARSESET_JUCEHEADER__
  4305. template <class Type>
  4306. class SparseSet
  4307. {
  4308. public:
  4309. SparseSet() throw()
  4310. {
  4311. }
  4312. SparseSet (const SparseSet<Type>& other) throw()
  4313. : values (other.values)
  4314. {
  4315. }
  4316. ~SparseSet() throw()
  4317. {
  4318. }
  4319. void clear() throw()
  4320. {
  4321. values.clear();
  4322. }
  4323. bool isEmpty() const throw()
  4324. {
  4325. return values.size() == 0;
  4326. }
  4327. Type size() const throw()
  4328. {
  4329. Type num = 0;
  4330. for (int i = 0; i < values.size(); i += 2)
  4331. num += values[i + 1] - values[i];
  4332. return num;
  4333. }
  4334. Type operator[] (int index) const throw()
  4335. {
  4336. for (int i = 0; i < values.size(); i += 2)
  4337. {
  4338. const Type s = values.getUnchecked(i);
  4339. const Type e = values.getUnchecked(i + 1);
  4340. if (index < e - s)
  4341. return s + index;
  4342. index -= e - s;
  4343. }
  4344. return (Type) 0;
  4345. }
  4346. bool contains (const Type valueToLookFor) const throw()
  4347. {
  4348. bool on = false;
  4349. for (int i = 0; i < values.size(); ++i)
  4350. {
  4351. if (values.getUnchecked(i) > valueToLookFor)
  4352. return on;
  4353. on = ! on;
  4354. }
  4355. return false;
  4356. }
  4357. int getNumRanges() const throw()
  4358. {
  4359. return values.size() >> 1;
  4360. }
  4361. bool getRange (const int rangeIndex,
  4362. Type& startValue,
  4363. Type& numValues) const throw()
  4364. {
  4365. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4366. {
  4367. startValue = values [rangeIndex << 1];
  4368. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4369. return true;
  4370. }
  4371. return false;
  4372. }
  4373. bool getTotalRange (Type& lowestValue,
  4374. Type& highestValue) const throw()
  4375. {
  4376. if (values.size() > 0)
  4377. {
  4378. lowestValue = values.getUnchecked (0);
  4379. highestValue = values.getUnchecked (values.size() - 1);
  4380. return true;
  4381. }
  4382. return false;
  4383. }
  4384. void addRange (const Type firstValue,
  4385. const Type numValuesToAdd) throw()
  4386. {
  4387. jassert (numValuesToAdd >= 0);
  4388. if (numValuesToAdd > 0)
  4389. {
  4390. removeRange (firstValue, numValuesToAdd);
  4391. IntegerElementComparator<Type> sorter;
  4392. values.addSorted (sorter, firstValue);
  4393. values.addSorted (sorter, firstValue + numValuesToAdd);
  4394. simplify();
  4395. }
  4396. }
  4397. void removeRange (const Type firstValue,
  4398. const Type numValuesToRemove) throw()
  4399. {
  4400. jassert (numValuesToRemove >= 0);
  4401. if (numValuesToRemove >= 0
  4402. && firstValue < values.getLast())
  4403. {
  4404. const bool onAtStart = contains (firstValue - 1);
  4405. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4406. const bool onAtEnd = contains (lastValue);
  4407. for (int i = values.size(); --i >= 0;)
  4408. {
  4409. if (values.getUnchecked(i) <= lastValue)
  4410. {
  4411. while (values.getUnchecked(i) >= firstValue)
  4412. {
  4413. values.remove (i);
  4414. if (--i < 0)
  4415. break;
  4416. }
  4417. break;
  4418. }
  4419. }
  4420. IntegerElementComparator<Type> sorter;
  4421. if (onAtStart)
  4422. values.addSorted (sorter, firstValue);
  4423. if (onAtEnd)
  4424. values.addSorted (sorter, lastValue);
  4425. simplify();
  4426. }
  4427. }
  4428. void invertRange (const Type firstValue,
  4429. const Type numValues)
  4430. {
  4431. SparseSet newItems;
  4432. newItems.addRange (firstValue, numValues);
  4433. int i;
  4434. for (i = getNumRanges(); --i >= 0;)
  4435. {
  4436. const int start = values [i << 1];
  4437. const int end = values [(i << 1) + 1];
  4438. newItems.removeRange (start, end);
  4439. }
  4440. removeRange (firstValue, numValues);
  4441. for (i = newItems.getNumRanges(); --i >= 0;)
  4442. {
  4443. const int start = newItems.values [i << 1];
  4444. const int end = newItems.values [(i << 1) + 1];
  4445. addRange (start, end);
  4446. }
  4447. }
  4448. bool overlapsRange (const Type firstValue,
  4449. const Type numValues) throw()
  4450. {
  4451. jassert (numValues >= 0);
  4452. if (numValues > 0)
  4453. {
  4454. for (int i = getNumRanges(); --i >= 0;)
  4455. {
  4456. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4457. return false;
  4458. if (firstValue + numValues > values.getUnchecked (i << 1))
  4459. return true;
  4460. }
  4461. }
  4462. return false;
  4463. }
  4464. bool containsRange (const Type firstValue,
  4465. const Type numValues) throw()
  4466. {
  4467. jassert (numValues >= 0);
  4468. if (numValues > 0)
  4469. {
  4470. for (int i = getNumRanges(); --i >= 0;)
  4471. {
  4472. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4473. return false;
  4474. if (firstValue >= values.getUnchecked (i << 1)
  4475. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4476. return true;
  4477. }
  4478. }
  4479. return false;
  4480. }
  4481. bool operator== (const SparseSet<Type>& other) throw()
  4482. {
  4483. return values == other.values;
  4484. }
  4485. bool operator!= (const SparseSet<Type>& other) throw()
  4486. {
  4487. return values != other.values;
  4488. }
  4489. juce_UseDebuggingNewOperator
  4490. private:
  4491. // alternating start/end values of ranges of values that are present.
  4492. Array<Type, DummyCriticalSection> values;
  4493. void simplify() throw()
  4494. {
  4495. jassert ((values.size() & 1) == 0);
  4496. for (int i = values.size(); --i > 0;)
  4497. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4498. values.removeRange (i - 1, 2);
  4499. }
  4500. };
  4501. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4502. /*** End of inlined file: juce_SparseSet.h ***/
  4503. #endif
  4504. #ifndef __JUCE_VALUE_JUCEHEADER__
  4505. /*** Start of inlined file: juce_Value.h ***/
  4506. #ifndef __JUCE_VALUE_JUCEHEADER__
  4507. #define __JUCE_VALUE_JUCEHEADER__
  4508. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4509. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4510. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4511. /*** Start of inlined file: juce_MessageListener.h ***/
  4512. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4513. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4514. /*** Start of inlined file: juce_Message.h ***/
  4515. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4516. #define __JUCE_MESSAGE_JUCEHEADER__
  4517. class MessageListener;
  4518. class MessageManager;
  4519. class JUCE_API Message
  4520. {
  4521. public:
  4522. Message() throw();
  4523. Message (const int intParameter1,
  4524. const int intParameter2,
  4525. const int intParameter3,
  4526. void* const pointerParameter) throw();
  4527. virtual ~Message() throw();
  4528. // These values can be used for carrying simple data that the application needs to
  4529. // pass around. For more complex messages, just create a subclass.
  4530. int intParameter1; /**< user-defined integer value. */
  4531. int intParameter2; /**< user-defined integer value. */
  4532. int intParameter3; /**< user-defined integer value. */
  4533. void* pointerParameter; /**< user-defined pointer value. */
  4534. juce_UseDebuggingNewOperator
  4535. private:
  4536. friend class MessageListener;
  4537. friend class MessageManager;
  4538. MessageListener* messageRecipient;
  4539. Message (const Message&);
  4540. const Message& operator= (const Message&);
  4541. };
  4542. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4543. /*** End of inlined file: juce_Message.h ***/
  4544. class JUCE_API MessageListener
  4545. {
  4546. protected:
  4547. MessageListener() throw();
  4548. public:
  4549. virtual ~MessageListener();
  4550. virtual void handleMessage (const Message& message) = 0;
  4551. void postMessage (Message* const message) const throw();
  4552. bool isValidMessageListener() const throw();
  4553. };
  4554. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4555. /*** End of inlined file: juce_MessageListener.h ***/
  4556. class JUCE_API AsyncUpdater
  4557. {
  4558. public:
  4559. AsyncUpdater() throw();
  4560. virtual ~AsyncUpdater();
  4561. void triggerAsyncUpdate() throw();
  4562. void cancelPendingUpdate() throw();
  4563. void handleUpdateNowIfNeeded();
  4564. virtual void handleAsyncUpdate() = 0;
  4565. private:
  4566. class AsyncUpdaterInternal : public MessageListener
  4567. {
  4568. public:
  4569. AsyncUpdaterInternal() throw() {}
  4570. ~AsyncUpdaterInternal() {}
  4571. void handleMessage (const Message&);
  4572. AsyncUpdater* owner;
  4573. private:
  4574. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4575. const AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4576. };
  4577. AsyncUpdaterInternal internalAsyncHandler;
  4578. bool asyncMessagePending;
  4579. };
  4580. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4581. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4582. class JUCE_API Value
  4583. {
  4584. public:
  4585. Value();
  4586. Value (const Value& other);
  4587. Value (const var& initialValue);
  4588. ~Value();
  4589. const var getValue() const;
  4590. operator const var() const;
  4591. const String toString() const;
  4592. void setValue (const var& newValue);
  4593. const Value& operator= (const var& newValue);
  4594. void referTo (const Value& valueToReferTo);
  4595. bool refersToSameSourceAs (const Value& other) const;
  4596. bool operator== (const Value& other) const;
  4597. bool operator!= (const Value& other) const;
  4598. class JUCE_API Listener
  4599. {
  4600. public:
  4601. Listener() {}
  4602. virtual ~Listener() {}
  4603. virtual void valueChanged (Value& value) = 0;
  4604. };
  4605. void addListener (Listener* const listener);
  4606. void removeListener (Listener* const listener);
  4607. class JUCE_API ValueSource : public ReferenceCountedObject,
  4608. public AsyncUpdater
  4609. {
  4610. public:
  4611. ValueSource();
  4612. virtual ~ValueSource();
  4613. virtual const var getValue() const = 0;
  4614. virtual void setValue (const var& newValue) = 0;
  4615. void sendChangeMessage (const bool dispatchSynchronously);
  4616. juce_UseDebuggingNewOperator
  4617. protected:
  4618. friend class Value;
  4619. SortedSet <Value*> valuesWithListeners;
  4620. void handleAsyncUpdate();
  4621. ValueSource (const ValueSource&);
  4622. const ValueSource& operator= (const ValueSource&);
  4623. };
  4624. explicit Value (ValueSource* const valueSource);
  4625. ValueSource& getValueSource() { return *value; }
  4626. juce_UseDebuggingNewOperator
  4627. private:
  4628. friend class ValueSource;
  4629. ReferenceCountedObjectPtr <ValueSource> value;
  4630. SortedSet <Listener*> listeners;
  4631. void callListeners();
  4632. // This is disallowed to avoid confusion about whether it should
  4633. // do a by-value or by-reference copy.
  4634. const Value& operator= (const Value& other);
  4635. };
  4636. #endif // __JUCE_VALUE_JUCEHEADER__
  4637. /*** End of inlined file: juce_Value.h ***/
  4638. #endif
  4639. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4640. /*** Start of inlined file: juce_ValueTree.h ***/
  4641. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4642. #define __JUCE_VALUETREE_JUCEHEADER__
  4643. /*** Start of inlined file: juce_UndoManager.h ***/
  4644. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4645. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4646. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4647. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4648. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4649. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4650. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4651. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4652. /*** Start of inlined file: juce_ChangeListener.h ***/
  4653. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4654. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4655. class JUCE_API ChangeListener
  4656. {
  4657. public:
  4658. virtual ~ChangeListener() {}
  4659. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4660. };
  4661. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4662. /*** End of inlined file: juce_ChangeListener.h ***/
  4663. /*** Start of inlined file: juce_ScopedLock.h ***/
  4664. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4665. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4666. class JUCE_API ScopedLock
  4667. {
  4668. public:
  4669. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4670. inline ~ScopedLock() throw() { lock_.exit(); }
  4671. private:
  4672. const CriticalSection& lock_;
  4673. ScopedLock (const ScopedLock&);
  4674. const ScopedLock& operator= (const ScopedLock&);
  4675. };
  4676. class ScopedUnlock
  4677. {
  4678. public:
  4679. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4680. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4681. private:
  4682. const CriticalSection& lock_;
  4683. ScopedUnlock (const ScopedLock&);
  4684. const ScopedUnlock& operator= (const ScopedUnlock&);
  4685. };
  4686. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4687. /*** End of inlined file: juce_ScopedLock.h ***/
  4688. class JUCE_API ChangeListenerList : public MessageListener
  4689. {
  4690. public:
  4691. ChangeListenerList() throw();
  4692. ~ChangeListenerList() throw();
  4693. void addChangeListener (ChangeListener* const listener) throw();
  4694. void removeChangeListener (ChangeListener* const listener) throw();
  4695. void removeAllChangeListeners() throw();
  4696. void sendChangeMessage (void* objectThatHasChanged) throw();
  4697. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4698. void dispatchPendingMessages();
  4699. void handleMessage (const Message&);
  4700. juce_UseDebuggingNewOperator
  4701. private:
  4702. SortedSet <void*> listeners;
  4703. CriticalSection lock;
  4704. void* lastChangedObject;
  4705. bool messagePending;
  4706. ChangeListenerList (const ChangeListenerList&);
  4707. const ChangeListenerList& operator= (const ChangeListenerList&);
  4708. };
  4709. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4710. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4711. class JUCE_API ChangeBroadcaster
  4712. {
  4713. public:
  4714. ChangeBroadcaster() throw();
  4715. virtual ~ChangeBroadcaster();
  4716. void addChangeListener (ChangeListener* const listener) throw();
  4717. void removeChangeListener (ChangeListener* const listener) throw();
  4718. void removeAllChangeListeners() throw();
  4719. void sendChangeMessage (void* objectThatHasChanged) throw();
  4720. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4721. void dispatchPendingMessages();
  4722. private:
  4723. ChangeListenerList changeListenerList;
  4724. ChangeBroadcaster (const ChangeBroadcaster&);
  4725. const ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4726. };
  4727. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4728. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4729. /*** Start of inlined file: juce_UndoableAction.h ***/
  4730. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4731. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4732. class JUCE_API UndoableAction
  4733. {
  4734. protected:
  4735. UndoableAction() throw() {}
  4736. public:
  4737. virtual ~UndoableAction() {}
  4738. virtual bool perform() = 0;
  4739. virtual bool undo() = 0;
  4740. virtual int getSizeInUnits() { return 10; }
  4741. };
  4742. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4743. /*** End of inlined file: juce_UndoableAction.h ***/
  4744. class JUCE_API UndoManager : public ChangeBroadcaster
  4745. {
  4746. public:
  4747. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4748. const int minimumTransactionsToKeep = 30);
  4749. ~UndoManager();
  4750. void clearUndoHistory();
  4751. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4752. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4753. const int minimumTransactionsToKeep);
  4754. bool perform (UndoableAction* const action,
  4755. const String& actionName = String::empty);
  4756. void beginNewTransaction (const String& actionName = String::empty);
  4757. void setCurrentTransactionName (const String& newName);
  4758. bool canUndo() const;
  4759. const String getUndoDescription() const;
  4760. bool undo();
  4761. bool undoCurrentTransactionOnly();
  4762. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4763. int getNumActionsInCurrentTransaction() const;
  4764. bool canRedo() const;
  4765. const String getRedoDescription() const;
  4766. bool redo();
  4767. juce_UseDebuggingNewOperator
  4768. private:
  4769. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4770. StringArray transactionNames;
  4771. String currentTransactionName;
  4772. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4773. bool newTransaction, reentrancyCheck;
  4774. // disallow copy constructor
  4775. UndoManager (const UndoManager&);
  4776. const UndoManager& operator= (const UndoManager&);
  4777. };
  4778. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4779. /*** End of inlined file: juce_UndoManager.h ***/
  4780. class JUCE_API ValueTree
  4781. {
  4782. public:
  4783. ValueTree (const String& type);
  4784. ValueTree (const ValueTree& other);
  4785. const ValueTree& operator= (const ValueTree& other);
  4786. ~ValueTree();
  4787. bool operator== (const ValueTree& other) const;
  4788. bool operator!= (const ValueTree& other) const;
  4789. bool isValid() const { return object != 0; }
  4790. ValueTree createCopy() const;
  4791. const String getType() const;
  4792. bool hasType (const String& typeName) const;
  4793. const var& getProperty (const var::identifier& name) const;
  4794. const var& operator[] (const var::identifier& name) const;
  4795. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4796. bool hasProperty (const var::identifier& name) const;
  4797. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4798. void removeAllProperties (UndoManager* const undoManager);
  4799. int getNumProperties() const;
  4800. const var::identifier getPropertyName (int index) const;
  4801. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4802. int getNumChildren() const;
  4803. ValueTree getChild (int index) const;
  4804. ValueTree getChildWithName (const String& type) const;
  4805. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4806. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4807. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4808. void removeChild (const int childIndex, UndoManager* const undoManager);
  4809. void removeAllChildren (UndoManager* const undoManager);
  4810. bool isAChildOf (const ValueTree& possibleParent) const;
  4811. ValueTree getParent() const;
  4812. XmlElement* createXml() const;
  4813. static ValueTree fromXml (const XmlElement& xml);
  4814. void writeToStream (OutputStream& output);
  4815. static ValueTree readFromStream (InputStream& input);
  4816. class JUCE_API Listener
  4817. {
  4818. public:
  4819. virtual ~Listener() {}
  4820. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4821. const var::identifier& property) = 0;
  4822. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4823. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4824. };
  4825. void addListener (Listener* listener);
  4826. void removeListener (Listener* listener);
  4827. template <typename ElementComparator>
  4828. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4829. {
  4830. if (object != 0)
  4831. {
  4832. ComparatorAdapter <ElementComparator> adapter (comparator);
  4833. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4834. object->sendChildChangeMessage();
  4835. }
  4836. }
  4837. juce_UseDebuggingNewOperator
  4838. private:
  4839. friend class ValueTreeSetPropertyAction;
  4840. friend class ValueTreeChildChangeAction;
  4841. class JUCE_API SharedObject : public ReferenceCountedObject
  4842. {
  4843. public:
  4844. SharedObject (const String& type);
  4845. SharedObject (const SharedObject& other);
  4846. ~SharedObject();
  4847. const String type;
  4848. NamedValueSet properties;
  4849. ReferenceCountedArray <SharedObject> children;
  4850. SortedSet <ValueTree*> valueTreesWithListeners;
  4851. SharedObject* parent;
  4852. void sendPropertyChangeMessage (const var::identifier& property);
  4853. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4854. void sendChildChangeMessage();
  4855. void sendChildChangeMessage (ValueTree& tree);
  4856. void sendParentChangeMessage();
  4857. const var& getProperty (const var::identifier& name) const;
  4858. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4859. bool hasProperty (const var::identifier& name) const;
  4860. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4861. void removeAllProperties (UndoManager* const undoManager);
  4862. bool isAChildOf (const SharedObject* const possibleParent) const;
  4863. ValueTree getChildWithName (const String& type) const;
  4864. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4865. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4866. void removeChild (const int childIndex, UndoManager* const undoManager);
  4867. void removeAllChildren (UndoManager* const undoManager);
  4868. XmlElement* createXml() const;
  4869. juce_UseDebuggingNewOperator
  4870. private:
  4871. const SharedObject& operator= (const SharedObject&);
  4872. };
  4873. template <typename ElementComparator>
  4874. class ComparatorAdapter
  4875. {
  4876. public:
  4877. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4878. int compareElements (SharedObject* const first, SharedObject* const second)
  4879. {
  4880. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4881. }
  4882. private:
  4883. ElementComparator& comparator;
  4884. };
  4885. friend class SharedObject;
  4886. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4887. ReferenceCountedObjectPtr <SharedObject> object;
  4888. SortedSet <Listener*> listeners;
  4889. void deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4890. void deliverChildChangeMessage (ValueTree& tree);
  4891. void deliverParentChangeMessage (ValueTree& tree);
  4892. ValueTree (SharedObject* const object_);
  4893. };
  4894. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4895. /*** End of inlined file: juce_ValueTree.h ***/
  4896. #endif
  4897. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4898. #endif
  4899. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4900. /*** Start of inlined file: juce_VoidArray.h ***/
  4901. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4902. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4903. typedef Array <void*> VoidArray;
  4904. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4905. /*** End of inlined file: juce_VoidArray.h ***/
  4906. #endif
  4907. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4908. #endif
  4909. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4910. #endif
  4911. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4912. /*** Start of inlined file: juce_FileLogger.h ***/
  4913. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4914. #define __JUCE_FILELOGGER_JUCEHEADER__
  4915. class JUCE_API FileLogger : public Logger
  4916. {
  4917. public:
  4918. FileLogger (const File& fileToWriteTo,
  4919. const String& welcomeMessage,
  4920. const int maxInitialFileSizeBytes = 128 * 1024);
  4921. ~FileLogger();
  4922. void logMessage (const String& message);
  4923. const File getLogFile() const { return logFile; }
  4924. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4925. const String& logFileName,
  4926. const String& welcomeMessage,
  4927. const int maxInitialFileSizeBytes = 128 * 1024);
  4928. juce_UseDebuggingNewOperator
  4929. private:
  4930. File logFile;
  4931. CriticalSection logLock;
  4932. ScopedPointer <FileOutputStream> logStream;
  4933. void trimFileSize (int maxFileSizeBytes) const;
  4934. FileLogger (const FileLogger&);
  4935. const FileLogger& operator= (const FileLogger&);
  4936. };
  4937. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4938. /*** End of inlined file: juce_FileLogger.h ***/
  4939. #endif
  4940. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4941. /*** Start of inlined file: juce_Initialisation.h ***/
  4942. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4943. #define __JUCE_INITIALISATION_JUCEHEADER__
  4944. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4945. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4946. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4947. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4948. class ScopedJuceInitialiser_NonGUI
  4949. {
  4950. public:
  4951. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4952. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4953. };
  4954. class ScopedJuceInitialiser_GUI
  4955. {
  4956. public:
  4957. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4958. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4959. };
  4960. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4961. /*** End of inlined file: juce_Initialisation.h ***/
  4962. #endif
  4963. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4964. #endif
  4965. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4966. #endif
  4967. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4968. #endif
  4969. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4970. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4971. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4972. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4973. class JUCE_API PerformanceCounter
  4974. {
  4975. public:
  4976. PerformanceCounter (const String& counterName,
  4977. int runsPerPrintout = 100,
  4978. const File& loggingFile = File::nonexistent);
  4979. ~PerformanceCounter();
  4980. void start();
  4981. void stop();
  4982. void printStatistics();
  4983. juce_UseDebuggingNewOperator
  4984. private:
  4985. String name;
  4986. int numRuns, runsPerPrint;
  4987. double totalTime;
  4988. int64 started;
  4989. File outputFile;
  4990. };
  4991. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4992. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4993. #endif
  4994. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4995. #endif
  4996. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4997. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4998. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4999. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5000. class JUCE_API PlatformUtilities
  5001. {
  5002. public:
  5003. static void beep();
  5004. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  5005. const String& emailSubject,
  5006. const String& bodyText,
  5007. const StringArray& filesToAttach);
  5008. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  5009. static const String cfStringToJuceString (CFStringRef cfString);
  5010. static CFStringRef juceStringToCFString (const String& s);
  5011. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5012. static const String makePathFromFSRef (FSRef* file);
  5013. static const String convertToPrecomposedUnicode (const String& s);
  5014. static OSType getTypeOfFile (const String& filename);
  5015. static bool isBundle (const String& filename);
  5016. static void addItemToDock (const File& file);
  5017. static int getOSXMinorVersionNumber();
  5018. #endif
  5019. #if JUCE_WINDOWS || DOXYGEN
  5020. // Some registry helper functions:
  5021. static const String getRegistryValue (const String& regValuePath,
  5022. const String& defaultValue = String::empty);
  5023. static void setRegistryValue (const String& regValuePath,
  5024. const String& value);
  5025. static bool registryValueExists (const String& regValuePath);
  5026. static void deleteRegistryValue (const String& regValuePath);
  5027. static void deleteRegistryKey (const String& regKeyPath);
  5028. static void registerFileAssociation (const String& fileExtension,
  5029. const String& symbolicDescription,
  5030. const String& fullDescription,
  5031. const File& targetExecutable,
  5032. int iconResourceNumber);
  5033. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5034. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5035. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5036. #endif
  5037. static void fpuReset();
  5038. #if JUCE_LINUX || JUCE_WINDOWS
  5039. static void* loadDynamicLibrary (const String& pathOrFilename);
  5040. static void freeDynamicLibrary (void* libraryHandle);
  5041. static void* getProcedureEntryPoint (void* libraryHandle,
  5042. const String& procedureName);
  5043. #endif
  5044. #if JUCE_LINUX || DOXYGEN
  5045. #endif
  5046. };
  5047. #if JUCE_MAC || JUCE_IPHONE
  5048. class ScopedAutoReleasePool
  5049. {
  5050. public:
  5051. ScopedAutoReleasePool();
  5052. ~ScopedAutoReleasePool();
  5053. private:
  5054. void* pool;
  5055. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5056. const ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5057. };
  5058. #endif
  5059. #if JUCE_LINUX
  5060. class ScopedXLock
  5061. {
  5062. public:
  5063. ScopedXLock();
  5064. ~ScopedXLock();
  5065. };
  5066. #endif
  5067. #if JUCE_MAC
  5068. class JUCE_API AppleRemoteDevice
  5069. {
  5070. public:
  5071. AppleRemoteDevice();
  5072. virtual ~AppleRemoteDevice();
  5073. enum ButtonType
  5074. {
  5075. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5076. playButton, /**< The play button. */
  5077. plusButton, /**< The plus or volume-up button. */
  5078. minusButton, /**< The minus or volume-down button. */
  5079. rightButton, /**< The right button (if it's held for a short time). */
  5080. leftButton, /**< The left button (if it's held for a short time). */
  5081. rightButton_Long, /**< The right button (if it's held for a long time). */
  5082. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5083. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5084. playButtonSleepMode,
  5085. switched
  5086. };
  5087. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5088. bool start (const bool inExclusiveMode);
  5089. void stop();
  5090. bool isActive() const;
  5091. int getRemoteId() const { return remoteId; }
  5092. juce_UseDebuggingNewOperator
  5093. void handleCallbackInternal();
  5094. private:
  5095. void* device;
  5096. void* queue;
  5097. int remoteId;
  5098. bool open (const bool openInExclusiveMode);
  5099. AppleRemoteDevice (const AppleRemoteDevice&);
  5100. const AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5101. };
  5102. #endif
  5103. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5104. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5105. #endif
  5106. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5107. /*** Start of inlined file: juce_Random.h ***/
  5108. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5109. #define __JUCE_RANDOM_JUCEHEADER__
  5110. class JUCE_API Random
  5111. {
  5112. public:
  5113. Random (const int64 seedValue) throw();
  5114. ~Random() throw();
  5115. int nextInt() throw();
  5116. int nextInt (const int maxValue) throw();
  5117. int64 nextInt64() throw();
  5118. float nextFloat() throw();
  5119. double nextDouble() throw();
  5120. bool nextBool() throw();
  5121. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  5122. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  5123. static Random& getSystemRandom() throw();
  5124. void setSeed (const int64 newSeed) throw();
  5125. void combineSeed (const int64 seedValue) throw();
  5126. void setSeedRandomly();
  5127. juce_UseDebuggingNewOperator
  5128. private:
  5129. int64 seed;
  5130. };
  5131. #endif // __JUCE_RANDOM_JUCEHEADER__
  5132. /*** End of inlined file: juce_Random.h ***/
  5133. #endif
  5134. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5135. #endif
  5136. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5137. /*** Start of inlined file: juce_Singleton.h ***/
  5138. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5139. #define __JUCE_SINGLETON_JUCEHEADER__
  5140. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5141. \
  5142. static classname* _singletonInstance; \
  5143. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5144. \
  5145. static classname* getInstance() \
  5146. { \
  5147. if (_singletonInstance == 0) \
  5148. {\
  5149. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5150. \
  5151. if (_singletonInstance == 0) \
  5152. { \
  5153. static bool alreadyInside = false; \
  5154. static bool createdOnceAlready = false; \
  5155. \
  5156. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5157. jassert (! problem); \
  5158. if (! problem) \
  5159. { \
  5160. createdOnceAlready = true; \
  5161. alreadyInside = true; \
  5162. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5163. alreadyInside = false; \
  5164. \
  5165. _singletonInstance = newObject; \
  5166. } \
  5167. } \
  5168. } \
  5169. \
  5170. return _singletonInstance; \
  5171. } \
  5172. \
  5173. static inline classname* getInstanceWithoutCreating() throw() \
  5174. { \
  5175. return _singletonInstance; \
  5176. } \
  5177. \
  5178. static void deleteInstance() \
  5179. { \
  5180. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5181. if (_singletonInstance != 0) \
  5182. { \
  5183. classname* const old = _singletonInstance; \
  5184. _singletonInstance = 0; \
  5185. delete old; \
  5186. } \
  5187. } \
  5188. \
  5189. void clearSingletonInstance() throw() \
  5190. { \
  5191. if (_singletonInstance == this) \
  5192. _singletonInstance = 0; \
  5193. }
  5194. #define juce_ImplementSingleton(classname) \
  5195. \
  5196. classname* classname::_singletonInstance = 0; \
  5197. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5198. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5199. \
  5200. static classname* _singletonInstance; \
  5201. \
  5202. static classname* getInstance() \
  5203. { \
  5204. if (_singletonInstance == 0) \
  5205. { \
  5206. static bool alreadyInside = false; \
  5207. static bool createdOnceAlready = false; \
  5208. \
  5209. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5210. jassert (! problem); \
  5211. if (! problem) \
  5212. { \
  5213. createdOnceAlready = true; \
  5214. alreadyInside = true; \
  5215. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5216. alreadyInside = false; \
  5217. \
  5218. _singletonInstance = newObject; \
  5219. } \
  5220. } \
  5221. \
  5222. return _singletonInstance; \
  5223. } \
  5224. \
  5225. static inline classname* getInstanceWithoutCreating() throw() \
  5226. { \
  5227. return _singletonInstance; \
  5228. } \
  5229. \
  5230. static void deleteInstance() \
  5231. { \
  5232. if (_singletonInstance != 0) \
  5233. { \
  5234. classname* const old = _singletonInstance; \
  5235. _singletonInstance = 0; \
  5236. delete old; \
  5237. } \
  5238. } \
  5239. \
  5240. void clearSingletonInstance() throw() \
  5241. { \
  5242. if (_singletonInstance == this) \
  5243. _singletonInstance = 0; \
  5244. }
  5245. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5246. \
  5247. static classname* _singletonInstance; \
  5248. \
  5249. static classname* getInstance() \
  5250. { \
  5251. if (_singletonInstance == 0) \
  5252. _singletonInstance = new classname(); \
  5253. \
  5254. return _singletonInstance; \
  5255. } \
  5256. \
  5257. static inline classname* getInstanceWithoutCreating() throw() \
  5258. { \
  5259. return _singletonInstance; \
  5260. } \
  5261. \
  5262. static void deleteInstance() \
  5263. { \
  5264. if (_singletonInstance != 0) \
  5265. { \
  5266. classname* const old = _singletonInstance; \
  5267. _singletonInstance = 0; \
  5268. delete old; \
  5269. } \
  5270. } \
  5271. \
  5272. void clearSingletonInstance() throw() \
  5273. { \
  5274. if (_singletonInstance == this) \
  5275. _singletonInstance = 0; \
  5276. }
  5277. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5278. \
  5279. classname* classname::_singletonInstance = 0;
  5280. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5281. /*** End of inlined file: juce_Singleton.h ***/
  5282. #endif
  5283. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5284. #endif
  5285. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5286. /*** Start of inlined file: juce_SystemStats.h ***/
  5287. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5288. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5289. class JUCE_API SystemStats
  5290. {
  5291. public:
  5292. static const String getJUCEVersion() throw();
  5293. enum OperatingSystemType
  5294. {
  5295. UnknownOS = 0,
  5296. MacOSX = 0x1000,
  5297. Linux = 0x2000,
  5298. Win95 = 0x4001,
  5299. Win98 = 0x4002,
  5300. WinNT351 = 0x4103,
  5301. WinNT40 = 0x4104,
  5302. Win2000 = 0x4105,
  5303. WinXP = 0x4106,
  5304. WinVista = 0x4107,
  5305. Windows7 = 0x4108,
  5306. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5307. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5308. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5309. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5310. };
  5311. static OperatingSystemType getOperatingSystemType() throw();
  5312. static const String getOperatingSystemName() throw();
  5313. static bool isOperatingSystem64Bit() throw();
  5314. static const String getLogonName();
  5315. static const String getFullUserName();
  5316. // CPU and memory information..
  5317. static int getCpuSpeedInMegaherz() throw();
  5318. static const String getCpuVendor() throw();
  5319. static bool hasMMX() throw();
  5320. static bool hasSSE() throw();
  5321. static bool hasSSE2() throw();
  5322. static bool has3DNow() throw();
  5323. static int getNumCpus() throw();
  5324. static int64 getClockCycleCounter() throw();
  5325. static int getMemorySizeInMegabytes() throw();
  5326. static int getPageSize() throw();
  5327. static int getMACAddresses (int64* addresses, int maxNum,
  5328. #if JUCE_MAC
  5329. const bool littleEndian = true) throw();
  5330. #else
  5331. const bool littleEndian = false) throw();
  5332. #endif
  5333. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5334. static void initialiseStats() throw();
  5335. };
  5336. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5337. /*** End of inlined file: juce_SystemStats.h ***/
  5338. #endif
  5339. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5340. #endif
  5341. #ifndef __JUCE_TIME_JUCEHEADER__
  5342. #endif
  5343. #ifndef __JUCE_UUID_JUCEHEADER__
  5344. /*** Start of inlined file: juce_Uuid.h ***/
  5345. #ifndef __JUCE_UUID_JUCEHEADER__
  5346. #define __JUCE_UUID_JUCEHEADER__
  5347. class JUCE_API Uuid
  5348. {
  5349. public:
  5350. Uuid();
  5351. ~Uuid() throw();
  5352. Uuid (const Uuid& other);
  5353. Uuid& operator= (const Uuid& other);
  5354. bool isNull() const throw();
  5355. bool operator== (const Uuid& other) const;
  5356. bool operator!= (const Uuid& other) const;
  5357. const String toString() const;
  5358. Uuid (const String& uuidString);
  5359. Uuid& operator= (const String& uuidString);
  5360. const uint8* getRawData() const throw() { return value.asBytes; }
  5361. Uuid (const uint8* const rawData);
  5362. Uuid& operator= (const uint8* const rawData);
  5363. juce_UseDebuggingNewOperator
  5364. private:
  5365. union
  5366. {
  5367. uint8 asBytes [16];
  5368. int asInt[4];
  5369. int64 asInt64[2];
  5370. } value;
  5371. };
  5372. #endif // __JUCE_UUID_JUCEHEADER__
  5373. /*** End of inlined file: juce_Uuid.h ***/
  5374. #endif
  5375. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5376. /*** Start of inlined file: juce_BlowFish.h ***/
  5377. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5378. #define __JUCE_BLOWFISH_JUCEHEADER__
  5379. class JUCE_API BlowFish
  5380. {
  5381. public:
  5382. BlowFish (const uint8* keyData, int keyBytes);
  5383. BlowFish (const BlowFish& other);
  5384. const BlowFish& operator= (const BlowFish& other);
  5385. ~BlowFish();
  5386. void encrypt (uint32& data1, uint32& data2) const;
  5387. void decrypt (uint32& data1, uint32& data2) const;
  5388. juce_UseDebuggingNewOperator
  5389. private:
  5390. uint32 p[18];
  5391. HeapBlock <uint32> s[4];
  5392. uint32 F (uint32 x) const;
  5393. };
  5394. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5395. /*** End of inlined file: juce_BlowFish.h ***/
  5396. #endif
  5397. #ifndef __JUCE_MD5_JUCEHEADER__
  5398. /*** Start of inlined file: juce_MD5.h ***/
  5399. #ifndef __JUCE_MD5_JUCEHEADER__
  5400. #define __JUCE_MD5_JUCEHEADER__
  5401. class JUCE_API MD5
  5402. {
  5403. public:
  5404. MD5();
  5405. MD5 (const MD5& other);
  5406. const MD5& operator= (const MD5& other);
  5407. MD5 (const MemoryBlock& data);
  5408. MD5 (const char* data, const size_t numBytes);
  5409. MD5 (const String& text);
  5410. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5411. MD5 (const File& file);
  5412. ~MD5();
  5413. const MemoryBlock getRawChecksumData() const;
  5414. const String toHexString() const;
  5415. bool operator== (const MD5& other) const;
  5416. bool operator!= (const MD5& other) const;
  5417. juce_UseDebuggingNewOperator
  5418. private:
  5419. uint8 result [16];
  5420. struct ProcessContext
  5421. {
  5422. uint8 buffer [64];
  5423. uint32 state [4];
  5424. uint32 count [2];
  5425. ProcessContext();
  5426. void processBlock (const uint8* const data, size_t dataSize);
  5427. void transform (const uint8* const buffer);
  5428. void finish (uint8* const result);
  5429. };
  5430. void processStream (InputStream& input, int64 numBytesToRead);
  5431. };
  5432. #endif // __JUCE_MD5_JUCEHEADER__
  5433. /*** End of inlined file: juce_MD5.h ***/
  5434. #endif
  5435. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5436. /*** Start of inlined file: juce_Primes.h ***/
  5437. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5438. #define __JUCE_PRIMES_JUCEHEADER__
  5439. class JUCE_API Primes
  5440. {
  5441. public:
  5442. static const BitArray createProbablePrime (int bitLength,
  5443. int certainty,
  5444. const int* randomSeeds = 0,
  5445. int numRandomSeeds = 0) throw();
  5446. static bool isProbablyPrime (const BitArray& number,
  5447. int certainty) throw();
  5448. };
  5449. #endif // __JUCE_PRIMES_JUCEHEADER__
  5450. /*** End of inlined file: juce_Primes.h ***/
  5451. #endif
  5452. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5453. /*** Start of inlined file: juce_RSAKey.h ***/
  5454. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5455. #define __JUCE_RSAKEY_JUCEHEADER__
  5456. class JUCE_API RSAKey
  5457. {
  5458. public:
  5459. RSAKey() throw();
  5460. RSAKey (const String& stringRepresentation) throw();
  5461. ~RSAKey() throw();
  5462. const String toString() const throw();
  5463. bool applyToValue (BitArray& value) const throw();
  5464. static void createKeyPair (RSAKey& publicKey,
  5465. RSAKey& privateKey,
  5466. const int numBits,
  5467. const int* randomSeeds = 0,
  5468. const int numRandomSeeds = 0) throw();
  5469. juce_UseDebuggingNewOperator
  5470. protected:
  5471. BitArray part1, part2;
  5472. };
  5473. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5474. /*** End of inlined file: juce_RSAKey.h ***/
  5475. #endif
  5476. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5477. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5478. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5479. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5480. class JUCE_API DirectoryIterator
  5481. {
  5482. public:
  5483. DirectoryIterator (const File& directory,
  5484. bool isRecursive,
  5485. const String& wildCard = JUCE_T("*"),
  5486. const int whatToLookFor = File::findFiles);
  5487. ~DirectoryIterator();
  5488. bool next();
  5489. const File getFile() const;
  5490. float getEstimatedProgress() const;
  5491. juce_UseDebuggingNewOperator
  5492. private:
  5493. Array <File> filesFound;
  5494. Array <File> dirsFound;
  5495. String wildCard;
  5496. int index;
  5497. const int whatToLookFor;
  5498. ScopedPointer <DirectoryIterator> subIterator;
  5499. DirectoryIterator (const DirectoryIterator&);
  5500. const DirectoryIterator& operator= (const DirectoryIterator&);
  5501. };
  5502. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5503. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5504. #endif
  5505. #ifndef __JUCE_FILE_JUCEHEADER__
  5506. #endif
  5507. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5508. /*** Start of inlined file: juce_FileInputStream.h ***/
  5509. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5510. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5511. class JUCE_API FileInputStream : public InputStream
  5512. {
  5513. public:
  5514. FileInputStream (const File& fileToRead);
  5515. ~FileInputStream();
  5516. const File& getFile() const throw() { return file; }
  5517. int64 getTotalLength();
  5518. int read (void* destBuffer, int maxBytesToRead);
  5519. bool isExhausted();
  5520. int64 getPosition();
  5521. bool setPosition (int64 pos);
  5522. juce_UseDebuggingNewOperator
  5523. private:
  5524. File file;
  5525. void* fileHandle;
  5526. int64 currentPosition, totalSize;
  5527. bool needToSeek;
  5528. FileInputStream (const FileInputStream&);
  5529. const FileInputStream& operator= (const FileInputStream&);
  5530. };
  5531. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5532. /*** End of inlined file: juce_FileInputStream.h ***/
  5533. #endif
  5534. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5535. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5536. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5537. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5538. class JUCE_API FileOutputStream : public OutputStream
  5539. {
  5540. public:
  5541. FileOutputStream (const File& fileToWriteTo,
  5542. const int bufferSizeToUse = 16384);
  5543. ~FileOutputStream();
  5544. const File& getFile() const { return file; }
  5545. bool failedToOpen() const { return fileHandle == 0; }
  5546. void flush();
  5547. int64 getPosition();
  5548. bool setPosition (int64 pos);
  5549. bool write (const void* data, int numBytes);
  5550. juce_UseDebuggingNewOperator
  5551. private:
  5552. File file;
  5553. void* fileHandle;
  5554. int64 currentPosition;
  5555. int bufferSize, bytesInBuffer;
  5556. HeapBlock <char> buffer;
  5557. };
  5558. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5559. /*** End of inlined file: juce_FileOutputStream.h ***/
  5560. #endif
  5561. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5562. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5563. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5564. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5565. class JUCE_API FileSearchPath
  5566. {
  5567. public:
  5568. FileSearchPath();
  5569. FileSearchPath (const String& path);
  5570. FileSearchPath (const FileSearchPath& other);
  5571. ~FileSearchPath();
  5572. const FileSearchPath& operator= (const String& path);
  5573. int getNumPaths() const;
  5574. const File operator[] (const int index) const;
  5575. const String toString() const;
  5576. void add (const File& directoryToAdd,
  5577. const int insertIndex = -1);
  5578. void addIfNotAlreadyThere (const File& directoryToAdd);
  5579. void remove (const int indexToRemove);
  5580. void addPath (const FileSearchPath& other);
  5581. void removeRedundantPaths();
  5582. void removeNonExistentPaths();
  5583. int findChildFiles (Array<File>& results,
  5584. const int whatToLookFor,
  5585. const bool searchRecursively,
  5586. const String& wildCardPattern = JUCE_T("*")) const;
  5587. bool isFileInPath (const File& fileToCheck,
  5588. const bool checkRecursively) const;
  5589. juce_UseDebuggingNewOperator
  5590. private:
  5591. StringArray directories;
  5592. void init (const String& path);
  5593. };
  5594. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5595. /*** End of inlined file: juce_FileSearchPath.h ***/
  5596. #endif
  5597. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5598. /*** Start of inlined file: juce_NamedPipe.h ***/
  5599. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5600. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5601. class JUCE_API NamedPipe
  5602. {
  5603. public:
  5604. NamedPipe();
  5605. ~NamedPipe();
  5606. bool openExisting (const String& pipeName);
  5607. bool createNewPipe (const String& pipeName);
  5608. void close();
  5609. bool isOpen() const;
  5610. const String getName() const;
  5611. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5612. int write (const void* sourceBuffer, int numBytesToWrite,
  5613. int timeOutMilliseconds = 2000);
  5614. void cancelPendingReads();
  5615. juce_UseDebuggingNewOperator
  5616. private:
  5617. void* internal;
  5618. String currentPipeName;
  5619. NamedPipe (const NamedPipe&);
  5620. const NamedPipe& operator= (const NamedPipe&);
  5621. bool openInternal (const String& pipeName, const bool createPipe);
  5622. };
  5623. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5624. /*** End of inlined file: juce_NamedPipe.h ***/
  5625. #endif
  5626. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5627. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5628. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5629. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5630. class JUCE_API TemporaryFile
  5631. {
  5632. public:
  5633. enum OptionFlags
  5634. {
  5635. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5636. i.e. its name should start with a dot. */
  5637. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5638. the file is unique, they should go in brackets rather
  5639. than just being appended (see File::getNonexistentSibling() )*/
  5640. };
  5641. TemporaryFile (const String& suffix = String::empty,
  5642. const int optionFlags = 0);
  5643. TemporaryFile (const File& targetFile,
  5644. const int optionFlags = 0);
  5645. ~TemporaryFile();
  5646. const File getFile() const { return temporaryFile; }
  5647. const File getTargetFile() const { return targetFile; }
  5648. bool overwriteTargetFileWithTemporary() const;
  5649. juce_UseDebuggingNewOperator
  5650. private:
  5651. File temporaryFile, targetFile;
  5652. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5653. TemporaryFile (const TemporaryFile&);
  5654. const TemporaryFile& operator= (const TemporaryFile&);
  5655. };
  5656. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5657. /*** End of inlined file: juce_TemporaryFile.h ***/
  5658. #endif
  5659. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5660. /*** Start of inlined file: juce_ZipFile.h ***/
  5661. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5662. #define __JUCE_ZIPFILE_JUCEHEADER__
  5663. /*** Start of inlined file: juce_InputSource.h ***/
  5664. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5665. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5666. class JUCE_API InputSource
  5667. {
  5668. public:
  5669. InputSource() throw() {}
  5670. virtual ~InputSource() {}
  5671. virtual InputStream* createInputStream() = 0;
  5672. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5673. virtual int64 hashCode() const = 0;
  5674. juce_UseDebuggingNewOperator
  5675. };
  5676. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5677. /*** End of inlined file: juce_InputSource.h ***/
  5678. class JUCE_API ZipFile
  5679. {
  5680. public:
  5681. ZipFile (InputStream* const inputStream,
  5682. const bool deleteStreamWhenDestroyed) throw();
  5683. ZipFile (const File& file);
  5684. ZipFile (InputSource* const inputSource);
  5685. ~ZipFile() throw();
  5686. struct ZipEntry
  5687. {
  5688. String filename;
  5689. unsigned int uncompressedSize;
  5690. Time fileTime;
  5691. };
  5692. int getNumEntries() const throw();
  5693. const ZipEntry* getEntry (const int index) const throw();
  5694. int getIndexOfFileName (const String& fileName) const throw();
  5695. const ZipEntry* getEntry (const String& fileName) const throw();
  5696. void sortEntriesByFilename();
  5697. InputStream* createStreamForEntry (const int index);
  5698. void uncompressTo (const File& targetDirectory,
  5699. const bool shouldOverwriteFiles = true);
  5700. juce_UseDebuggingNewOperator
  5701. private:
  5702. class ZipInputStream;
  5703. class ZipFilenameComparator;
  5704. class ZipEntryInfo;
  5705. OwnedArray <ZipEntryInfo> entries;
  5706. CriticalSection lock;
  5707. InputStream* inputStream;
  5708. ScopedPointer <InputStream> streamToDelete;
  5709. ScopedPointer <InputSource> inputSource;
  5710. #ifdef JUCE_DEBUG
  5711. int numOpenStreams;
  5712. #endif
  5713. void init();
  5714. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5715. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5716. ZipFile (const ZipFile&);
  5717. const ZipFile& operator= (const ZipFile&);
  5718. };
  5719. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5720. /*** End of inlined file: juce_ZipFile.h ***/
  5721. #endif
  5722. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5723. /*** Start of inlined file: juce_Socket.h ***/
  5724. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5725. #define __JUCE_SOCKET_JUCEHEADER__
  5726. class JUCE_API StreamingSocket
  5727. {
  5728. public:
  5729. StreamingSocket();
  5730. ~StreamingSocket();
  5731. bool bindToPort (const int localPortNumber);
  5732. bool connect (const String& remoteHostname,
  5733. const int remotePortNumber,
  5734. const int timeOutMillisecs = 3000);
  5735. bool isConnected() const throw() { return connected; }
  5736. void close();
  5737. const String& getHostName() const throw() { return hostName; }
  5738. int getPort() const throw() { return portNumber; }
  5739. bool isLocal() const throw();
  5740. int waitUntilReady (const bool readyForReading,
  5741. const int timeoutMsecs) const;
  5742. int read (void* destBuffer, const int maxBytesToRead,
  5743. const bool blockUntilSpecifiedAmountHasArrived);
  5744. int write (const void* sourceBuffer, const int numBytesToWrite);
  5745. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5746. StreamingSocket* waitForNextConnection() const;
  5747. juce_UseDebuggingNewOperator
  5748. private:
  5749. String hostName;
  5750. int volatile portNumber, handle;
  5751. bool connected, isListener;
  5752. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5753. StreamingSocket (const StreamingSocket&);
  5754. const StreamingSocket& operator= (const StreamingSocket&);
  5755. };
  5756. class JUCE_API DatagramSocket
  5757. {
  5758. public:
  5759. DatagramSocket (const int localPortNumber,
  5760. const bool enableBroadcasting = false);
  5761. ~DatagramSocket();
  5762. bool bindToPort (const int localPortNumber);
  5763. bool connect (const String& remoteHostname,
  5764. const int remotePortNumber,
  5765. const int timeOutMillisecs = 3000);
  5766. bool isConnected() const throw() { return connected; }
  5767. void close();
  5768. const String& getHostName() const throw() { return hostName; }
  5769. int getPort() const throw() { return portNumber; }
  5770. bool isLocal() const throw();
  5771. int waitUntilReady (const bool readyForReading,
  5772. const int timeoutMsecs) const;
  5773. int read (void* destBuffer, const int maxBytesToRead,
  5774. const bool blockUntilSpecifiedAmountHasArrived);
  5775. int write (const void* sourceBuffer, const int numBytesToWrite);
  5776. DatagramSocket* waitForNextConnection() const;
  5777. juce_UseDebuggingNewOperator
  5778. private:
  5779. String hostName;
  5780. int volatile portNumber, handle;
  5781. bool connected, allowBroadcast;
  5782. void* serverAddress;
  5783. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5784. DatagramSocket (const DatagramSocket&);
  5785. const DatagramSocket& operator= (const DatagramSocket&);
  5786. };
  5787. #endif // __JUCE_SOCKET_JUCEHEADER__
  5788. /*** End of inlined file: juce_Socket.h ***/
  5789. #endif
  5790. #ifndef __JUCE_URL_JUCEHEADER__
  5791. /*** Start of inlined file: juce_URL.h ***/
  5792. #ifndef __JUCE_URL_JUCEHEADER__
  5793. #define __JUCE_URL_JUCEHEADER__
  5794. class JUCE_API URL
  5795. {
  5796. public:
  5797. URL();
  5798. URL (const String& url);
  5799. URL (const URL& other);
  5800. ~URL();
  5801. const URL& operator= (const URL& other);
  5802. const String toString (const bool includeGetParameters) const;
  5803. bool isWellFormed() const;
  5804. const String getDomain() const;
  5805. const String getSubPath() const;
  5806. const String getScheme() const;
  5807. const URL withNewSubPath (const String& newPath) const;
  5808. const URL withParameter (const String& parameterName,
  5809. const String& parameterValue) const;
  5810. const URL withFileToUpload (const String& parameterName,
  5811. const File& fileToUpload,
  5812. const String& mimeType) const;
  5813. const StringPairArray& getParameters() const;
  5814. const StringPairArray& getFilesToUpload() const;
  5815. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5816. const URL withPOSTData (const String& postData) const;
  5817. const String getPostData() const { return postData; }
  5818. bool launchInDefaultBrowser() const;
  5819. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5820. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5821. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5822. InputStream* createInputStream (const bool usePostCommand,
  5823. OpenStreamProgressCallback* const progressCallback = 0,
  5824. void* const progressCallbackContext = 0,
  5825. const String& extraHeaders = String::empty,
  5826. const int connectionTimeOutMs = 0) const;
  5827. bool readEntireBinaryStream (MemoryBlock& destData,
  5828. const bool usePostCommand = false) const;
  5829. const String readEntireTextStream (const bool usePostCommand = false) const;
  5830. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5831. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5832. const bool isParameter);
  5833. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5834. juce_UseDebuggingNewOperator
  5835. private:
  5836. String url, postData;
  5837. StringPairArray parameters, filesToUpload, mimeTypes;
  5838. };
  5839. #endif // __JUCE_URL_JUCEHEADER__
  5840. /*** End of inlined file: juce_URL.h ***/
  5841. #endif
  5842. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5843. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5844. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5845. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5846. class JUCE_API BufferedInputStream : public InputStream
  5847. {
  5848. public:
  5849. BufferedInputStream (InputStream* const sourceStream,
  5850. const int bufferSize,
  5851. const bool deleteSourceWhenDestroyed);
  5852. ~BufferedInputStream();
  5853. int64 getTotalLength();
  5854. int64 getPosition();
  5855. bool setPosition (int64 newPosition);
  5856. int read (void* destBuffer, int maxBytesToRead);
  5857. const String readString();
  5858. bool isExhausted();
  5859. juce_UseDebuggingNewOperator
  5860. private:
  5861. InputStream* const source;
  5862. ScopedPointer <InputStream> sourceToDelete;
  5863. int bufferSize;
  5864. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5865. HeapBlock <char> buffer;
  5866. void ensureBuffered();
  5867. BufferedInputStream (const BufferedInputStream&);
  5868. const BufferedInputStream& operator= (const BufferedInputStream&);
  5869. };
  5870. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5871. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5872. #endif
  5873. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5874. /*** Start of inlined file: juce_FileInputSource.h ***/
  5875. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5876. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5877. class JUCE_API FileInputSource : public InputSource
  5878. {
  5879. public:
  5880. FileInputSource (const File& file);
  5881. ~FileInputSource();
  5882. InputStream* createInputStream();
  5883. InputStream* createInputStreamFor (const String& relatedItemPath);
  5884. int64 hashCode() const;
  5885. juce_UseDebuggingNewOperator
  5886. private:
  5887. const File file;
  5888. FileInputSource (const FileInputSource&);
  5889. const FileInputSource& operator= (const FileInputSource&);
  5890. };
  5891. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5892. /*** End of inlined file: juce_FileInputSource.h ***/
  5893. #endif
  5894. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5895. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5896. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5897. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5898. class GZIPCompressorHelper;
  5899. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5900. {
  5901. public:
  5902. GZIPCompressorOutputStream (OutputStream* const destStream,
  5903. int compressionLevel = 0,
  5904. const bool deleteDestStreamWhenDestroyed = false,
  5905. const bool noWrap = false);
  5906. ~GZIPCompressorOutputStream();
  5907. void flush();
  5908. int64 getPosition();
  5909. bool setPosition (int64 newPosition);
  5910. bool write (const void* destBuffer, int howMany);
  5911. juce_UseDebuggingNewOperator
  5912. private:
  5913. OutputStream* const destStream;
  5914. ScopedPointer <OutputStream> streamToDelete;
  5915. HeapBlock <uint8> buffer;
  5916. ScopedPointer <GZIPCompressorHelper> helper;
  5917. bool doNextBlock();
  5918. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5919. const GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5920. };
  5921. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5922. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5923. #endif
  5924. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5925. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5926. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5927. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5928. class GZIPDecompressHelper;
  5929. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5930. {
  5931. public:
  5932. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5933. const bool deleteSourceWhenDestroyed,
  5934. const bool noWrap = false,
  5935. const int64 uncompressedStreamLength = -1);
  5936. ~GZIPDecompressorInputStream();
  5937. int64 getPosition();
  5938. bool setPosition (int64 pos);
  5939. int64 getTotalLength();
  5940. bool isExhausted();
  5941. int read (void* destBuffer, int maxBytesToRead);
  5942. juce_UseDebuggingNewOperator
  5943. private:
  5944. InputStream* const sourceStream;
  5945. ScopedPointer <InputStream> streamToDelete;
  5946. const int64 uncompressedStreamLength;
  5947. const bool noWrap;
  5948. bool isEof;
  5949. int activeBufferSize;
  5950. int64 originalSourcePos, currentPos;
  5951. HeapBlock <uint8> buffer;
  5952. ScopedPointer <GZIPDecompressHelper> helper;
  5953. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5954. const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5955. };
  5956. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5957. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5958. #endif
  5959. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5960. #endif
  5961. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5962. #endif
  5963. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5964. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5965. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5966. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5967. class JUCE_API MemoryInputStream : public InputStream
  5968. {
  5969. public:
  5970. MemoryInputStream (const void* const sourceData,
  5971. const size_t sourceDataSize,
  5972. const bool keepInternalCopyOfData);
  5973. ~MemoryInputStream();
  5974. int64 getPosition();
  5975. bool setPosition (int64 pos);
  5976. int64 getTotalLength();
  5977. bool isExhausted();
  5978. int read (void* destBuffer, int maxBytesToRead);
  5979. juce_UseDebuggingNewOperator
  5980. private:
  5981. const char* data;
  5982. size_t dataSize, position;
  5983. MemoryBlock internalCopy;
  5984. };
  5985. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5986. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5987. #endif
  5988. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5989. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5990. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5991. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5992. class JUCE_API MemoryOutputStream : public OutputStream
  5993. {
  5994. public:
  5995. MemoryOutputStream (const size_t initialSize = 256,
  5996. const size_t granularity = 256,
  5997. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5998. ~MemoryOutputStream() throw();
  5999. const char* getData() const throw();
  6000. size_t getDataSize() const throw();
  6001. void reset() throw();
  6002. void flush();
  6003. bool write (const void* buffer, int howMany);
  6004. int64 getPosition();
  6005. bool setPosition (int64 newPosition);
  6006. juce_UseDebuggingNewOperator
  6007. private:
  6008. MemoryBlock* data;
  6009. ScopedPointer <MemoryBlock> dataToDelete;
  6010. size_t position, size, blockSize;
  6011. };
  6012. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6013. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6014. #endif
  6015. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6016. #endif
  6017. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6018. /*** Start of inlined file: juce_SubregionStream.h ***/
  6019. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6020. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6021. class JUCE_API SubregionStream : public InputStream
  6022. {
  6023. public:
  6024. SubregionStream (InputStream* const sourceStream,
  6025. const int64 startPositionInSourceStream,
  6026. const int64 lengthOfSourceStream,
  6027. const bool deleteSourceWhenDestroyed) throw();
  6028. ~SubregionStream() throw();
  6029. int64 getTotalLength();
  6030. int64 getPosition();
  6031. bool setPosition (int64 newPosition);
  6032. int read (void* destBuffer, int maxBytesToRead);
  6033. bool isExhausted();
  6034. juce_UseDebuggingNewOperator
  6035. private:
  6036. InputStream* const source;
  6037. ScopedPointer <InputStream> sourceToDelete;
  6038. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6039. SubregionStream (const SubregionStream&);
  6040. const SubregionStream& operator= (const SubregionStream&);
  6041. };
  6042. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6043. /*** End of inlined file: juce_SubregionStream.h ***/
  6044. #endif
  6045. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6046. #endif
  6047. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6048. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6049. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6050. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6051. #define TRANS(stringLiteral) \
  6052. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6053. class JUCE_API LocalisedStrings
  6054. {
  6055. public:
  6056. LocalisedStrings (const String& fileContents);
  6057. LocalisedStrings (const File& fileToLoad);
  6058. ~LocalisedStrings();
  6059. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6060. static LocalisedStrings* getCurrentMappings();
  6061. static const String translateWithCurrentMappings (const String& text);
  6062. static const String translateWithCurrentMappings (const char* text);
  6063. const String translate (const String& text) const;
  6064. const String getLanguageName() const { return languageName; }
  6065. const StringArray getCountryCodes() const { return countryCodes; }
  6066. void setIgnoresCase (const bool shouldIgnoreCase);
  6067. juce_UseDebuggingNewOperator
  6068. private:
  6069. String languageName;
  6070. StringArray countryCodes;
  6071. StringPairArray translations;
  6072. void loadFromText (const String& fileContents);
  6073. };
  6074. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6075. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6076. #endif
  6077. #ifndef __JUCE_STRING_JUCEHEADER__
  6078. #endif
  6079. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6080. #endif
  6081. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6082. #endif
  6083. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6084. /*** Start of inlined file: juce_XmlDocument.h ***/
  6085. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6086. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6087. class JUCE_API XmlDocument
  6088. {
  6089. public:
  6090. XmlDocument (const String& documentText) throw();
  6091. XmlDocument (const File& file);
  6092. ~XmlDocument() throw();
  6093. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6094. const String& getLastParseError() const throw();
  6095. void setInputSource (InputSource* const newSource) throw();
  6096. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6097. juce_UseDebuggingNewOperator
  6098. private:
  6099. String originalText;
  6100. const tchar* input;
  6101. bool outOfData, errorOccurred;
  6102. bool identifierLookupTable [128];
  6103. String lastError, dtdText;
  6104. StringArray tokenisedDTD;
  6105. bool needToLoadDTD, ignoreEmptyTextElements;
  6106. ScopedPointer <InputSource> inputSource;
  6107. void setLastError (const String& desc, const bool carryOn) throw();
  6108. void skipHeader() throw();
  6109. void skipNextWhiteSpace() throw();
  6110. tchar readNextChar() throw();
  6111. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  6112. void readChildElements (XmlElement* parent) throw();
  6113. int findNextTokenLength() throw();
  6114. void readQuotedString (String& result) throw();
  6115. void readEntity (String& result) throw();
  6116. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  6117. bool isXmlIdentifierChar (const tchar c) const throw();
  6118. const String getFileContents (const String& filename) const;
  6119. const String expandEntity (const String& entity);
  6120. const String expandExternalEntity (const String& entity);
  6121. const String getParameterEntity (const String& entity);
  6122. };
  6123. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6124. /*** End of inlined file: juce_XmlDocument.h ***/
  6125. #endif
  6126. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6127. #endif
  6128. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6129. #endif
  6130. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6131. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6132. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6133. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6134. class JUCE_API InterProcessLock
  6135. {
  6136. public:
  6137. InterProcessLock (const String& name);
  6138. ~InterProcessLock();
  6139. bool enter (int timeOutMillisecs = -1);
  6140. void exit();
  6141. juce_UseDebuggingNewOperator
  6142. private:
  6143. #if JUCE_WINDOWS
  6144. void* internal;
  6145. // #elif JUCE_64BIT
  6146. // long long internal;
  6147. #else
  6148. int internal;
  6149. #endif
  6150. String name;
  6151. int reentrancyLevel;
  6152. InterProcessLock (const InterProcessLock&);
  6153. const InterProcessLock& operator= (const InterProcessLock&);
  6154. };
  6155. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6156. /*** End of inlined file: juce_InterProcessLock.h ***/
  6157. #endif
  6158. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6159. /*** Start of inlined file: juce_Process.h ***/
  6160. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6161. #define __JUCE_PROCESS_JUCEHEADER__
  6162. class JUCE_API Process
  6163. {
  6164. public:
  6165. enum ProcessPriority
  6166. {
  6167. LowPriority = 0,
  6168. NormalPriority = 1,
  6169. HighPriority = 2,
  6170. RealtimePriority = 3
  6171. };
  6172. static void setPriority (const ProcessPriority priority);
  6173. static void terminate();
  6174. static bool isForegroundProcess();
  6175. static void raisePrivilege();
  6176. static void lowerPrivilege();
  6177. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6178. };
  6179. #endif // __JUCE_PROCESS_JUCEHEADER__
  6180. /*** End of inlined file: juce_Process.h ***/
  6181. #endif
  6182. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6183. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6184. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6185. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6186. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6187. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6188. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6189. class JUCE_API WaitableEvent
  6190. {
  6191. public:
  6192. WaitableEvent() throw();
  6193. ~WaitableEvent() throw();
  6194. bool wait (const int timeOutMilliseconds = -1) const throw();
  6195. void signal() const throw();
  6196. void reset() const throw();
  6197. juce_UseDebuggingNewOperator
  6198. private:
  6199. void* internal;
  6200. WaitableEvent (const WaitableEvent&);
  6201. const WaitableEvent& operator= (const WaitableEvent&);
  6202. };
  6203. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6204. /*** End of inlined file: juce_WaitableEvent.h ***/
  6205. /*** Start of inlined file: juce_Thread.h ***/
  6206. #ifndef __JUCE_THREAD_JUCEHEADER__
  6207. #define __JUCE_THREAD_JUCEHEADER__
  6208. class JUCE_API Thread
  6209. {
  6210. public:
  6211. Thread (const String& threadName);
  6212. virtual ~Thread();
  6213. virtual void run() = 0;
  6214. // Thread control functions..
  6215. void startThread();
  6216. void startThread (const int priority);
  6217. void stopThread (const int timeOutMilliseconds);
  6218. bool isThreadRunning() const;
  6219. void signalThreadShouldExit();
  6220. inline bool threadShouldExit() const { return threadShouldExit_; }
  6221. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6222. bool setPriority (const int priority);
  6223. static bool setCurrentThreadPriority (const int priority);
  6224. void setAffinityMask (const uint32 affinityMask);
  6225. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6226. // this can be called from any thread that needs to pause..
  6227. static void JUCE_CALLTYPE sleep (int milliseconds);
  6228. static void JUCE_CALLTYPE yield();
  6229. bool wait (const int timeOutMilliseconds) const;
  6230. void notify() const;
  6231. typedef void* ThreadID;
  6232. static ThreadID getCurrentThreadId();
  6233. static Thread* getCurrentThread();
  6234. ThreadID getThreadId() const { return threadId_; }
  6235. const String getThreadName() const { return threadName_; }
  6236. static int getNumRunningThreads();
  6237. static void stopAllThreads (const int timeoutInMillisecs);
  6238. juce_UseDebuggingNewOperator
  6239. private:
  6240. const String threadName_;
  6241. void* volatile threadHandle_;
  6242. CriticalSection startStopLock;
  6243. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6244. int threadPriority_;
  6245. ThreadID threadId_;
  6246. uint32 affinityMask_;
  6247. bool volatile threadShouldExit_;
  6248. friend void JUCE_API juce_threadEntryPoint (void*);
  6249. static void threadEntryPoint (Thread* thread);
  6250. Thread (const Thread&);
  6251. const Thread& operator= (const Thread&);
  6252. };
  6253. #endif // __JUCE_THREAD_JUCEHEADER__
  6254. /*** End of inlined file: juce_Thread.h ***/
  6255. class JUCE_API ReadWriteLock
  6256. {
  6257. public:
  6258. ReadWriteLock() throw();
  6259. ~ReadWriteLock() throw();
  6260. void enterRead() const throw();
  6261. void exitRead() const throw();
  6262. void enterWrite() const throw();
  6263. bool tryEnterWrite() const throw();
  6264. void exitWrite() const throw();
  6265. juce_UseDebuggingNewOperator
  6266. private:
  6267. CriticalSection accessLock;
  6268. WaitableEvent waitEvent;
  6269. mutable int numWaitingWriters, numWriters;
  6270. mutable Thread::ThreadID writerThreadId;
  6271. mutable Array <Thread::ThreadID> readerThreads;
  6272. ReadWriteLock (const ReadWriteLock&);
  6273. const ReadWriteLock& operator= (const ReadWriteLock&);
  6274. };
  6275. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6276. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6277. #endif
  6278. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6279. #endif
  6280. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6281. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6282. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6283. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6284. class JUCE_API ScopedReadLock
  6285. {
  6286. public:
  6287. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6288. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6289. private:
  6290. const ReadWriteLock& lock_;
  6291. ScopedReadLock (const ScopedReadLock&);
  6292. const ScopedReadLock& operator= (const ScopedReadLock&);
  6293. };
  6294. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6295. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6296. #endif
  6297. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6298. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6299. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6300. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6301. class JUCE_API ScopedTryLock
  6302. {
  6303. public:
  6304. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6305. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6306. bool isLocked() const throw() { return lockWasSuccessful; }
  6307. private:
  6308. const CriticalSection& lock_;
  6309. const bool lockWasSuccessful;
  6310. ScopedTryLock (const ScopedTryLock&);
  6311. const ScopedTryLock& operator= (const ScopedTryLock&);
  6312. };
  6313. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6314. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6315. #endif
  6316. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6317. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6318. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6319. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6320. class JUCE_API ScopedWriteLock
  6321. {
  6322. public:
  6323. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6324. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6325. private:
  6326. const ReadWriteLock& lock_;
  6327. ScopedWriteLock (const ScopedWriteLock&);
  6328. const ScopedWriteLock& operator= (const ScopedWriteLock&);
  6329. };
  6330. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6331. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6332. #endif
  6333. #ifndef __JUCE_THREAD_JUCEHEADER__
  6334. #endif
  6335. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6336. /*** Start of inlined file: juce_ThreadPool.h ***/
  6337. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6338. #define __JUCE_THREADPOOL_JUCEHEADER__
  6339. class ThreadPool;
  6340. class ThreadPoolThread;
  6341. class JUCE_API ThreadPoolJob
  6342. {
  6343. public:
  6344. ThreadPoolJob (const String& name);
  6345. virtual ~ThreadPoolJob();
  6346. const String getJobName() const;
  6347. void setJobName (const String& newName);
  6348. enum JobStatus
  6349. {
  6350. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6351. removed from the pool. */
  6352. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6353. should be automatically deleted by the pool. */
  6354. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6355. again when a thread is free. */
  6356. };
  6357. virtual JobStatus runJob() = 0;
  6358. bool isRunning() const { return isActive; }
  6359. bool shouldExit() const { return shouldStop; }
  6360. void signalJobShouldExit();
  6361. juce_UseDebuggingNewOperator
  6362. private:
  6363. friend class ThreadPool;
  6364. friend class ThreadPoolThread;
  6365. String jobName;
  6366. ThreadPool* pool;
  6367. bool shouldStop, isActive, shouldBeDeleted;
  6368. ThreadPoolJob (const ThreadPoolJob&);
  6369. const ThreadPoolJob& operator= (const ThreadPoolJob&);
  6370. };
  6371. class JUCE_API ThreadPool
  6372. {
  6373. public:
  6374. ThreadPool (const int numberOfThreads,
  6375. const bool startThreadsOnlyWhenNeeded = true,
  6376. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6377. ~ThreadPool();
  6378. class JUCE_API JobSelector
  6379. {
  6380. public:
  6381. virtual ~JobSelector() {}
  6382. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6383. };
  6384. void addJob (ThreadPoolJob* const job);
  6385. bool removeJob (ThreadPoolJob* const job,
  6386. const bool interruptIfRunning,
  6387. const int timeOutMilliseconds);
  6388. bool removeAllJobs (const bool interruptRunningJobs,
  6389. const int timeOutMilliseconds,
  6390. const bool deleteInactiveJobs = false,
  6391. JobSelector* selectedJobsToRemove = 0);
  6392. int getNumJobs() const;
  6393. ThreadPoolJob* getJob (const int index) const;
  6394. bool contains (const ThreadPoolJob* const job) const;
  6395. bool isJobRunning (const ThreadPoolJob* const job) const;
  6396. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6397. const int timeOutMilliseconds) const;
  6398. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6399. bool setThreadPriorities (const int newPriority);
  6400. juce_UseDebuggingNewOperator
  6401. private:
  6402. const int threadStopTimeout;
  6403. int priority;
  6404. class ThreadPoolThread;
  6405. OwnedArray <ThreadPoolThread> threads;
  6406. Array <ThreadPoolJob*> jobs;
  6407. CriticalSection lock;
  6408. uint32 lastJobEndTime;
  6409. WaitableEvent jobFinishedSignal;
  6410. friend class ThreadPoolThread;
  6411. bool runNextJob();
  6412. ThreadPool (const ThreadPool&);
  6413. const ThreadPool& operator= (const ThreadPool&);
  6414. };
  6415. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6416. /*** End of inlined file: juce_ThreadPool.h ***/
  6417. #endif
  6418. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6419. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6420. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6421. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6422. class JUCE_API TimeSliceClient
  6423. {
  6424. public:
  6425. virtual ~TimeSliceClient() {}
  6426. virtual bool useTimeSlice() = 0;
  6427. };
  6428. class JUCE_API TimeSliceThread : public Thread
  6429. {
  6430. public:
  6431. TimeSliceThread (const String& threadName);
  6432. ~TimeSliceThread();
  6433. void addTimeSliceClient (TimeSliceClient* const client);
  6434. void removeTimeSliceClient (TimeSliceClient* const client);
  6435. int getNumClients() const;
  6436. TimeSliceClient* getClient (const int index) const;
  6437. void run();
  6438. juce_UseDebuggingNewOperator
  6439. private:
  6440. CriticalSection callbackLock, listLock;
  6441. Array <TimeSliceClient*> clients;
  6442. int index;
  6443. TimeSliceClient* clientBeingCalled;
  6444. bool clientsChanged;
  6445. TimeSliceThread (const TimeSliceThread&);
  6446. const TimeSliceThread& operator= (const TimeSliceThread&);
  6447. };
  6448. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6449. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6450. #endif
  6451. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6452. #endif
  6453. #endif
  6454. /*** End of inlined file: juce_core_includes.h ***/
  6455. // if you're compiling a command-line app, you might want to just include the core headers,
  6456. // so you can set this macro before including juce.h
  6457. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6458. /*** Start of inlined file: juce_app_includes.h ***/
  6459. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6460. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6461. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6462. /*** Start of inlined file: juce_Application.h ***/
  6463. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6464. #define __JUCE_APPLICATION_JUCEHEADER__
  6465. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6466. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6467. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6468. /*** Start of inlined file: juce_Component.h ***/
  6469. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6470. #define __JUCE_COMPONENT_JUCEHEADER__
  6471. /*** Start of inlined file: juce_MouseCursor.h ***/
  6472. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6473. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6474. class Image;
  6475. class SharedMouseCursorInternal;
  6476. class ComponentPeer;
  6477. class Component;
  6478. class JUCE_API MouseCursor
  6479. {
  6480. public:
  6481. enum StandardCursorType
  6482. {
  6483. NoCursor = 0, /**< An invisible cursor. */
  6484. NormalCursor, /**< The stardard arrow cursor. */
  6485. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6486. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6487. CrosshairCursor, /**< A pair of crosshairs. */
  6488. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6489. that you're dragging a copy of something. */
  6490. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6491. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6492. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6493. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6494. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6495. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6496. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6497. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6498. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6499. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6500. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6501. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6502. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6503. };
  6504. MouseCursor() throw();
  6505. MouseCursor (const StandardCursorType type) throw();
  6506. MouseCursor (const Image& image,
  6507. const int hotSpotX,
  6508. const int hotSpotY) throw();
  6509. MouseCursor (const MouseCursor& other) throw();
  6510. const MouseCursor& operator= (const MouseCursor& other) throw();
  6511. ~MouseCursor() throw();
  6512. bool operator== (const MouseCursor& other) const throw();
  6513. bool operator!= (const MouseCursor& other) const throw();
  6514. static void showWaitCursor() throw();
  6515. static void hideWaitCursor() throw();
  6516. juce_UseDebuggingNewOperator
  6517. private:
  6518. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6519. friend class Component;
  6520. void showInWindow (ComponentPeer* window) const throw();
  6521. void showInAllWindows() const throw();
  6522. void* getHandle() const throw();
  6523. };
  6524. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6525. /*** End of inlined file: juce_MouseCursor.h ***/
  6526. /*** Start of inlined file: juce_MouseListener.h ***/
  6527. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6528. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6529. /*** Start of inlined file: juce_MouseEvent.h ***/
  6530. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6531. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6532. class Component;
  6533. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6534. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6535. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6536. class JUCE_API ModifierKeys
  6537. {
  6538. public:
  6539. ModifierKeys (const int flags = 0) throw();
  6540. ModifierKeys (const ModifierKeys& other) throw();
  6541. const ModifierKeys& operator= (const ModifierKeys& other) throw();
  6542. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6543. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6544. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6545. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6546. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6547. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6548. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6549. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6550. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6551. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6552. enum Flags
  6553. {
  6554. shiftModifier = 1,
  6555. ctrlModifier = 2,
  6556. altModifier = 4,
  6557. leftButtonModifier = 16,
  6558. rightButtonModifier = 32,
  6559. middleButtonModifier = 64,
  6560. #if JUCE_MAC
  6561. commandModifier = 8,
  6562. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6563. #else
  6564. commandModifier = ctrlModifier,
  6565. popupMenuClickModifier = rightButtonModifier,
  6566. #endif
  6567. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6568. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6569. };
  6570. inline int getRawFlags() const throw() { return flags; }
  6571. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6572. int getNumMouseButtonsDown() const throw();
  6573. static const ModifierKeys getCurrentModifiers() throw();
  6574. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6575. private:
  6576. int flags;
  6577. static int currentModifierFlags;
  6578. friend class ComponentPeer;
  6579. static void updateCurrentModifiers() throw();
  6580. };
  6581. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6582. /*** End of inlined file: juce_ModifierKeys.h ***/
  6583. /*** Start of inlined file: juce_Point.h ***/
  6584. #ifndef __JUCE_POINT_JUCEHEADER__
  6585. #define __JUCE_POINT_JUCEHEADER__
  6586. /*** Start of inlined file: juce_AffineTransform.h ***/
  6587. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6588. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6589. class JUCE_API AffineTransform
  6590. {
  6591. public:
  6592. AffineTransform() throw();
  6593. AffineTransform (const AffineTransform& other) throw();
  6594. AffineTransform (const float mat00, const float mat01, const float mat02,
  6595. const float mat10, const float mat11, const float mat12) throw();
  6596. const AffineTransform& operator= (const AffineTransform& other) throw();
  6597. bool operator== (const AffineTransform& other) const throw();
  6598. bool operator!= (const AffineTransform& other) const throw();
  6599. static const AffineTransform identity;
  6600. void transformPoint (float& x,
  6601. float& y) const throw();
  6602. void transformPoint (double& x,
  6603. double& y) const throw();
  6604. const AffineTransform translated (const float deltaX,
  6605. const float deltaY) const throw();
  6606. static const AffineTransform translation (const float deltaX,
  6607. const float deltaY) throw();
  6608. const AffineTransform rotated (const float angleInRadians) const throw();
  6609. const AffineTransform rotated (const float angleInRadians,
  6610. const float pivotX,
  6611. const float pivotY) const throw();
  6612. static const AffineTransform rotation (const float angleInRadians) throw();
  6613. static const AffineTransform rotation (const float angleInRadians,
  6614. const float pivotX,
  6615. const float pivotY) throw();
  6616. const AffineTransform scaled (const float factorX,
  6617. const float factorY) const throw();
  6618. static const AffineTransform scale (const float factorX,
  6619. const float factorY) throw();
  6620. const AffineTransform sheared (const float shearX,
  6621. const float shearY) const throw();
  6622. const AffineTransform inverted() const throw();
  6623. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6624. bool isIdentity() const throw();
  6625. bool isSingularity() const throw();
  6626. bool isOnlyTranslation() const throw();
  6627. float getTranslationX() const throw() { return mat02; }
  6628. float getTranslationY() const throw() { return mat12; }
  6629. juce_UseDebuggingNewOperator
  6630. float mat00, mat01, mat02;
  6631. float mat10, mat11, mat12;
  6632. private:
  6633. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6634. const float mat10, const float mat11, const float mat12) const throw();
  6635. };
  6636. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6637. /*** End of inlined file: juce_AffineTransform.h ***/
  6638. template <typename ValueType>
  6639. class Point
  6640. {
  6641. public:
  6642. Point() throw() : x (0), y (0) {}
  6643. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6644. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6645. ~Point() throw() {}
  6646. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6647. inline ValueType getX() const throw() { return x; }
  6648. inline ValueType getY() const throw() { return y; }
  6649. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6650. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6651. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6652. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6653. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6654. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6655. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6656. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6657. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6658. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6659. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6660. juce_UseDebuggingNewOperator
  6661. private:
  6662. ValueType x, y;
  6663. };
  6664. #endif // __JUCE_POINT_JUCEHEADER__
  6665. /*** End of inlined file: juce_Point.h ***/
  6666. class JUCE_API MouseEvent
  6667. {
  6668. public:
  6669. MouseEvent (const Point<int>& position,
  6670. const ModifierKeys& modifiers,
  6671. Component* const originator,
  6672. const Time& eventTime,
  6673. const Point<int> mouseDownPos,
  6674. const Time& mouseDownTime,
  6675. const int numberOfClicks,
  6676. const bool mouseWasDragged) throw();
  6677. ~MouseEvent() throw();
  6678. int x;
  6679. int y;
  6680. ModifierKeys mods;
  6681. Component* eventComponent;
  6682. Component* originalComponent;
  6683. Time eventTime;
  6684. int getMouseDownX() const throw();
  6685. int getMouseDownY() const throw();
  6686. const Point<int> getMouseDownPosition() const throw();
  6687. int getDistanceFromDragStart() const throw();
  6688. int getDistanceFromDragStartX() const throw();
  6689. int getDistanceFromDragStartY() const throw();
  6690. bool mouseWasClicked() const throw();
  6691. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6692. int getLengthOfMousePress() const throw();
  6693. const Point<int> getPosition() const throw();
  6694. int getScreenX() const;
  6695. int getScreenY() const;
  6696. const Point<int> getScreenPosition() const;
  6697. int getMouseDownScreenX() const;
  6698. int getMouseDownScreenY() const;
  6699. const Point<int> getMouseDownScreenPosition() const;
  6700. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6701. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6702. static int getDoubleClickTimeout() throw();
  6703. juce_UseDebuggingNewOperator
  6704. private:
  6705. Point<int> mouseDownPos;
  6706. Time mouseDownTime;
  6707. int numberOfClicks;
  6708. bool wasMovedSinceMouseDown;
  6709. };
  6710. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6711. /*** End of inlined file: juce_MouseEvent.h ***/
  6712. class JUCE_API MouseListener
  6713. {
  6714. public:
  6715. virtual ~MouseListener() {}
  6716. virtual void mouseMove (const MouseEvent& e);
  6717. virtual void mouseEnter (const MouseEvent& e);
  6718. virtual void mouseExit (const MouseEvent& e);
  6719. virtual void mouseDown (const MouseEvent& e);
  6720. virtual void mouseDrag (const MouseEvent& e);
  6721. virtual void mouseUp (const MouseEvent& e);
  6722. virtual void mouseDoubleClick (const MouseEvent& e);
  6723. virtual void mouseWheelMove (const MouseEvent& e,
  6724. float wheelIncrementX,
  6725. float wheelIncrementY);
  6726. };
  6727. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6728. /*** End of inlined file: juce_MouseListener.h ***/
  6729. /*** Start of inlined file: juce_ComponentListener.h ***/
  6730. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6731. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6732. class Component;
  6733. class JUCE_API ComponentListener
  6734. {
  6735. public:
  6736. virtual ~ComponentListener() {}
  6737. virtual void componentMovedOrResized (Component& component,
  6738. bool wasMoved,
  6739. bool wasResized);
  6740. virtual void componentBroughtToFront (Component& component);
  6741. virtual void componentVisibilityChanged (Component& component);
  6742. virtual void componentChildrenChanged (Component& component);
  6743. virtual void componentParentHierarchyChanged (Component& component);
  6744. virtual void componentNameChanged (Component& component);
  6745. };
  6746. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6747. /*** End of inlined file: juce_ComponentListener.h ***/
  6748. /*** Start of inlined file: juce_KeyListener.h ***/
  6749. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6750. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6751. /*** Start of inlined file: juce_KeyPress.h ***/
  6752. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6753. #define __JUCE_KEYPRESS_JUCEHEADER__
  6754. class JUCE_API KeyPress
  6755. {
  6756. public:
  6757. KeyPress() throw();
  6758. KeyPress (const int keyCode,
  6759. const ModifierKeys& modifiers,
  6760. const juce_wchar textCharacter) throw();
  6761. KeyPress (const int keyCode) throw();
  6762. KeyPress (const KeyPress& other) throw();
  6763. const KeyPress& operator= (const KeyPress& other) throw();
  6764. bool operator== (const KeyPress& other) const throw();
  6765. bool operator!= (const KeyPress& other) const throw();
  6766. bool isValid() const throw() { return keyCode != 0; }
  6767. int getKeyCode() const throw() { return keyCode; }
  6768. const ModifierKeys getModifiers() const throw() { return mods; }
  6769. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6770. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6771. static const KeyPress createFromDescription (const String& textVersion) throw();
  6772. const String getTextDescription() const throw();
  6773. bool isCurrentlyDown() const throw();
  6774. static bool isKeyCurrentlyDown (int keyCode) throw();
  6775. // Key codes
  6776. //
  6777. // Note that the actual values of these are platform-specific and may change
  6778. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6779. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6780. //
  6781. static const int spaceKey; /**< key-code for the space bar */
  6782. static const int escapeKey; /**< key-code for the escape key */
  6783. static const int returnKey; /**< key-code for the return key*/
  6784. static const int tabKey; /**< key-code for the tab key*/
  6785. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6786. static const int backspaceKey; /**< key-code for the backspace key */
  6787. static const int insertKey; /**< key-code for the insert key */
  6788. static const int upKey; /**< key-code for the cursor-up key */
  6789. static const int downKey; /**< key-code for the cursor-down key */
  6790. static const int leftKey; /**< key-code for the cursor-left key */
  6791. static const int rightKey; /**< key-code for the cursor-right key */
  6792. static const int pageUpKey; /**< key-code for the page-up key */
  6793. static const int pageDownKey; /**< key-code for the page-down key */
  6794. static const int homeKey; /**< key-code for the home key */
  6795. static const int endKey; /**< key-code for the end key */
  6796. static const int F1Key; /**< key-code for the F1 key */
  6797. static const int F2Key; /**< key-code for the F2 key */
  6798. static const int F3Key; /**< key-code for the F3 key */
  6799. static const int F4Key; /**< key-code for the F4 key */
  6800. static const int F5Key; /**< key-code for the F5 key */
  6801. static const int F6Key; /**< key-code for the F6 key */
  6802. static const int F7Key; /**< key-code for the F7 key */
  6803. static const int F8Key; /**< key-code for the F8 key */
  6804. static const int F9Key; /**< key-code for the F9 key */
  6805. static const int F10Key; /**< key-code for the F10 key */
  6806. static const int F11Key; /**< key-code for the F11 key */
  6807. static const int F12Key; /**< key-code for the F12 key */
  6808. static const int F13Key; /**< key-code for the F13 key */
  6809. static const int F14Key; /**< key-code for the F14 key */
  6810. static const int F15Key; /**< key-code for the F15 key */
  6811. static const int F16Key; /**< key-code for the F16 key */
  6812. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6813. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6814. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6815. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6816. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6817. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6818. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6819. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6820. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6821. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6822. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6823. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6824. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6825. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6826. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6827. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6828. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6829. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6830. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6831. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6832. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6833. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6834. juce_UseDebuggingNewOperator
  6835. private:
  6836. int keyCode;
  6837. ModifierKeys mods;
  6838. juce_wchar textCharacter;
  6839. };
  6840. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6841. /*** End of inlined file: juce_KeyPress.h ***/
  6842. class Component;
  6843. class JUCE_API KeyListener
  6844. {
  6845. public:
  6846. virtual ~KeyListener() {}
  6847. virtual bool keyPressed (const KeyPress& key,
  6848. Component* originatingComponent) = 0;
  6849. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6850. };
  6851. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6852. /*** End of inlined file: juce_KeyListener.h ***/
  6853. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6854. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6855. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6856. class Component;
  6857. class JUCE_API KeyboardFocusTraverser
  6858. {
  6859. public:
  6860. KeyboardFocusTraverser();
  6861. virtual ~KeyboardFocusTraverser();
  6862. virtual Component* getNextComponent (Component* current);
  6863. virtual Component* getPreviousComponent (Component* current);
  6864. virtual Component* getDefaultComponent (Component* parentComponent);
  6865. };
  6866. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6867. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6868. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6869. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6870. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6871. /*** Start of inlined file: juce_Graphics.h ***/
  6872. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6873. #define __JUCE_GRAPHICS_JUCEHEADER__
  6874. /*** Start of inlined file: juce_Font.h ***/
  6875. #ifndef __JUCE_FONT_JUCEHEADER__
  6876. #define __JUCE_FONT_JUCEHEADER__
  6877. /*** Start of inlined file: juce_Typeface.h ***/
  6878. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6879. #define __JUCE_TYPEFACE_JUCEHEADER__
  6880. /*** Start of inlined file: juce_Path.h ***/
  6881. #ifndef __JUCE_PATH_JUCEHEADER__
  6882. #define __JUCE_PATH_JUCEHEADER__
  6883. /*** Start of inlined file: juce_Rectangle.h ***/
  6884. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6885. #define __JUCE_RECTANGLE_JUCEHEADER__
  6886. class RectangleList;
  6887. template <typename ValueType>
  6888. class Rectangle
  6889. {
  6890. public:
  6891. Rectangle() throw()
  6892. : x (0), y (0), w (0), h (0)
  6893. {
  6894. }
  6895. Rectangle (const Rectangle& other) throw()
  6896. : x (other.x), y (other.y),
  6897. w (other.w), h (other.h)
  6898. {
  6899. }
  6900. Rectangle (const ValueType initialX, const ValueType initialY,
  6901. const ValueType width, const ValueType height) throw()
  6902. : x (initialX), y (initialY),
  6903. w (width), h (height)
  6904. {
  6905. }
  6906. Rectangle (const ValueType width, const ValueType height) throw()
  6907. : x (0), y (0), w (width), h (height)
  6908. {
  6909. }
  6910. Rectangle& operator= (const Rectangle& other) throw()
  6911. {
  6912. x = other.x; y = other.y;
  6913. w = other.w; h = other.h;
  6914. return *this;
  6915. }
  6916. ~Rectangle() throw() {}
  6917. inline ValueType getX() const throw() { return x; }
  6918. inline ValueType getY() const throw() { return y; }
  6919. inline ValueType getWidth() const throw() { return w; }
  6920. inline ValueType getHeight() const throw() { return h; }
  6921. inline ValueType getRight() const throw() { return x + w; }
  6922. inline ValueType getBottom() const throw() { return y + h; }
  6923. inline ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6924. inline ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6925. inline const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6926. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6927. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6928. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6929. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6930. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6931. void setBounds (const ValueType newX, const ValueType newY,
  6932. const ValueType newWidth, const ValueType newHeight) throw()
  6933. {
  6934. x = newX; y = newY; w = newWidth; h = newHeight;
  6935. }
  6936. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6937. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6938. void setLeft (const ValueType newLeft) throw()
  6939. {
  6940. w = jmax (ValueType(), x + w - newLeft);
  6941. x = newLeft;
  6942. }
  6943. void setTop (const ValueType newTop) throw()
  6944. {
  6945. h = jmax (ValueType(), y + h - newTop);
  6946. y = newTop;
  6947. }
  6948. void setRight (const ValueType newRight) throw()
  6949. {
  6950. x = jmin (x, newRight);
  6951. w = newRight - x;
  6952. }
  6953. void setBottom (const ValueType newBottom) throw()
  6954. {
  6955. y = jmin (y, newBottom);
  6956. h = newBottom - y;
  6957. }
  6958. void translate (const ValueType deltaX,
  6959. const ValueType deltaY) throw()
  6960. {
  6961. x += deltaX;
  6962. y += deltaY;
  6963. }
  6964. const Rectangle translated (const ValueType deltaX,
  6965. const ValueType deltaY) const throw()
  6966. {
  6967. return Rectangle (x + deltaX, y + deltaY, w, h);
  6968. }
  6969. void expand (const ValueType deltaX,
  6970. const ValueType deltaY) throw()
  6971. {
  6972. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6973. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6974. setBounds (x - deltaX, y - deltaY, nw, nh);
  6975. }
  6976. const Rectangle expanded (const ValueType deltaX,
  6977. const ValueType deltaY) const throw()
  6978. {
  6979. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6980. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6981. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  6982. }
  6983. void reduce (const ValueType deltaX,
  6984. const ValueType deltaY) throw()
  6985. {
  6986. expand (-deltaX, -deltaY);
  6987. }
  6988. const Rectangle reduced (const ValueType deltaX,
  6989. const ValueType deltaY) const throw()
  6990. {
  6991. return expanded (-deltaX, -deltaY);
  6992. }
  6993. bool operator== (const Rectangle& other) const throw()
  6994. {
  6995. return x == other.x && y == other.y
  6996. && w == other.w && h == other.h;
  6997. }
  6998. bool operator!= (const Rectangle& other) const throw()
  6999. {
  7000. return x != other.x || y != other.y
  7001. || w != other.w || h != other.h;
  7002. }
  7003. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7004. {
  7005. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7006. }
  7007. bool contains (const Point<ValueType> point) const throw()
  7008. {
  7009. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7010. }
  7011. bool contains (const Rectangle& other) const throw()
  7012. {
  7013. return x <= other.x && y <= other.y
  7014. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7015. }
  7016. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7017. {
  7018. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7019. jlimit (y, y + h, point.getY()));
  7020. }
  7021. bool intersects (const Rectangle& other) const throw()
  7022. {
  7023. return x + w > other.x
  7024. && y + h > other.y
  7025. && x < other.x + other.w
  7026. && y < other.y + other.h
  7027. && w > ValueType() && h > ValueType();
  7028. }
  7029. const Rectangle getIntersection (const Rectangle& other) const throw()
  7030. {
  7031. const ValueType nx = jmax (x, other.x);
  7032. const ValueType ny = jmax (y, other.y);
  7033. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7034. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7035. if (nw >= ValueType() && nh >= ValueType())
  7036. return Rectangle (nx, ny, nw, nh);
  7037. return Rectangle();
  7038. }
  7039. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7040. {
  7041. const int maxX = jmax (otherX, x);
  7042. otherW = jmin (otherX + otherW, x + w) - maxX;
  7043. if (otherW > 0)
  7044. {
  7045. const int maxY = jmax (otherY, y);
  7046. otherH = jmin (otherY + otherH, y + h) - maxY;
  7047. if (otherH > 0)
  7048. {
  7049. otherX = maxX; otherY = maxY;
  7050. return true;
  7051. }
  7052. }
  7053. return false;
  7054. }
  7055. const Rectangle getUnion (const Rectangle& other) const throw()
  7056. {
  7057. const ValueType newX = jmin (x, other.x);
  7058. const ValueType newY = jmin (y, other.y);
  7059. return Rectangle (newX, newY,
  7060. jmax (x + w, other.x + other.w) - newX,
  7061. jmax (y + h, other.y + other.h) - newY);
  7062. }
  7063. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7064. {
  7065. if (x == other.x && getRight() == other.getRight()
  7066. && (other.getBottom() >= y && other.y <= getBottom()))
  7067. {
  7068. const ValueType newY = jmin (y, other.y);
  7069. h = jmax (getBottom(), other.getBottom()) - newY;
  7070. y = newY;
  7071. return true;
  7072. }
  7073. else if (y == other.y && getBottom() == other.getBottom()
  7074. && (other.getRight() >= x && other.x <= getRight()))
  7075. {
  7076. const ValueType newX = jmin (x, other.x);
  7077. w = jmax (getRight(), other.getRight()) - newX;
  7078. x = newX;
  7079. return true;
  7080. }
  7081. return false;
  7082. }
  7083. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7084. {
  7085. int inside = 0;
  7086. const int otherR = other.getRight();
  7087. if (x >= other.x && x < otherR) inside = 1;
  7088. const int otherB = other.getBottom();
  7089. if (y >= other.y && y < otherB) inside |= 2;
  7090. const int r = x + w;
  7091. if (r >= other.x && r < otherR) inside |= 4;
  7092. const int b = y + h;
  7093. if (b >= other.y && b < otherB) inside |= 8;
  7094. switch (inside)
  7095. {
  7096. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7097. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7098. case 2 + 4 + 8: w = other.x - x; return true;
  7099. case 1 + 4 + 8: h = other.y - y; return true;
  7100. }
  7101. return false;
  7102. }
  7103. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7104. {
  7105. float x1 = x, y1 = y;
  7106. float x2 = x + w, y2 = y;
  7107. float x3 = x, y3 = y + h;
  7108. float x4 = x2, y4 = y3;
  7109. transform.transformPoint (x1, y1);
  7110. transform.transformPoint (x2, y2);
  7111. transform.transformPoint (x3, y3);
  7112. transform.transformPoint (x4, y4);
  7113. const float x = jmin (x1, x2, x3, x4);
  7114. const float y = jmin (y1, y2, y3, y4);
  7115. return Rectangle (x, y,
  7116. jmax (x1, x2, x3, x4) - x,
  7117. jmax (y1, y2, y3, y4) - y);
  7118. }
  7119. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7120. {
  7121. const int x1 = (int) floorf ((float) x);
  7122. const int y1 = (int) floorf ((float) y);
  7123. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7124. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7125. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7126. }
  7127. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7128. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7129. {
  7130. const ValueType x = jmax (x1, x2);
  7131. w1 = jmin (x1 + w1, x2 + w2) - x;
  7132. if (w1 > 0)
  7133. {
  7134. const ValueType y = jmax (y1, y2);
  7135. h1 = jmin (y1 + h1, y2 + h2) - y;
  7136. if (h1 > 0)
  7137. {
  7138. x1 = x; y1 = y;
  7139. return true;
  7140. }
  7141. }
  7142. return false;
  7143. }
  7144. const String toString() const
  7145. {
  7146. String s;
  7147. s.preallocateStorage (16);
  7148. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  7149. return s;
  7150. }
  7151. static const Rectangle fromString (const String& stringVersion)
  7152. {
  7153. StringArray toks;
  7154. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), 0);
  7155. return Rectangle (toks[0].trim().getIntValue(),
  7156. toks[1].trim().getIntValue(),
  7157. toks[2].trim().getIntValue(),
  7158. toks[3].trim().getIntValue());
  7159. }
  7160. juce_UseDebuggingNewOperator
  7161. private:
  7162. friend class RectangleList;
  7163. ValueType x, y, w, h;
  7164. };
  7165. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7166. /*** End of inlined file: juce_Rectangle.h ***/
  7167. /*** Start of inlined file: juce_Justification.h ***/
  7168. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7169. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7170. class JUCE_API Justification
  7171. {
  7172. public:
  7173. inline Justification (const int flags_) throw() : flags (flags_) {}
  7174. Justification (const Justification& other) throw();
  7175. const Justification& operator= (const Justification& other) throw();
  7176. inline int getFlags() const throw() { return flags; }
  7177. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7178. int getOnlyVerticalFlags() const throw();
  7179. int getOnlyHorizontalFlags() const throw();
  7180. void applyToRectangle (int& x, int& y,
  7181. const int w, const int h,
  7182. const int spaceX, const int spaceY,
  7183. const int spaceW, const int spaceH) const throw();
  7184. enum
  7185. {
  7186. left = 1,
  7187. right = 2,
  7188. horizontallyCentred = 4,
  7189. top = 8,
  7190. bottom = 16,
  7191. verticallyCentred = 32,
  7192. horizontallyJustified = 64,
  7193. centred = 36,
  7194. centredLeft = 33,
  7195. centredRight = 34,
  7196. centredTop = 12,
  7197. centredBottom = 20,
  7198. topLeft = 9,
  7199. topRight = 10,
  7200. bottomLeft = 17,
  7201. bottomRight = 18
  7202. };
  7203. private:
  7204. int flags;
  7205. };
  7206. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7207. /*** End of inlined file: juce_Justification.h ***/
  7208. /*** Start of inlined file: juce_EdgeTable.h ***/
  7209. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7210. #define __JUCE_EDGETABLE_JUCEHEADER__
  7211. class Path;
  7212. class RectangleList;
  7213. class Image;
  7214. class JUCE_API EdgeTable
  7215. {
  7216. public:
  7217. EdgeTable (const Rectangle<int>& clipLimits,
  7218. const Path& pathToAdd,
  7219. const AffineTransform& transform) throw();
  7220. EdgeTable (const Rectangle<int>& rectangleToAdd) throw();
  7221. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  7222. EdgeTable (const float x, const float y,
  7223. const float w, const float h) throw();
  7224. EdgeTable (const EdgeTable& other) throw();
  7225. const EdgeTable& operator= (const EdgeTable& other) throw();
  7226. ~EdgeTable() throw();
  7227. void clipToRectangle (const Rectangle<int>& r) throw();
  7228. void excludeRectangle (const Rectangle<int>& r) throw();
  7229. void clipToEdgeTable (const EdgeTable& other);
  7230. void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
  7231. bool isEmpty() throw();
  7232. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7233. void translate (float dx, int dy) throw();
  7234. void optimiseTable() throw();
  7235. template <class EdgeTableIterationCallback>
  7236. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7237. {
  7238. const int* lineStart = table;
  7239. for (int y = 0; y < bounds.getHeight(); ++y)
  7240. {
  7241. const int* line = lineStart;
  7242. lineStart += lineStrideElements;
  7243. int numPoints = line[0];
  7244. if (--numPoints > 0)
  7245. {
  7246. int x = *++line;
  7247. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7248. int levelAccumulator = 0;
  7249. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7250. while (--numPoints >= 0)
  7251. {
  7252. const int level = *++line;
  7253. jassert (((unsigned int) level) < (unsigned int) 256);
  7254. const int endX = *++line;
  7255. jassert (endX >= x);
  7256. const int endOfRun = (endX >> 8);
  7257. if (endOfRun == (x >> 8))
  7258. {
  7259. // small segment within the same pixel, so just save it for the next
  7260. // time round..
  7261. levelAccumulator += (endX - x) * level;
  7262. }
  7263. else
  7264. {
  7265. // plot the fist pixel of this segment, including any accumulated
  7266. // levels from smaller segments that haven't been drawn yet
  7267. levelAccumulator += (0xff - (x & 0xff)) * level;
  7268. levelAccumulator >>= 8;
  7269. x >>= 8;
  7270. if (levelAccumulator > 0)
  7271. {
  7272. if (levelAccumulator >> 8)
  7273. levelAccumulator = 0xff;
  7274. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7275. }
  7276. // if there's a run of similar pixels, do it all in one go..
  7277. if (level > 0)
  7278. {
  7279. jassert (endOfRun <= bounds.getRight());
  7280. const int numPix = endOfRun - ++x;
  7281. if (numPix > 0)
  7282. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7283. }
  7284. // save the bit at the end to be drawn next time round the loop.
  7285. levelAccumulator = (endX & 0xff) * level;
  7286. }
  7287. x = endX;
  7288. }
  7289. if (levelAccumulator > 0)
  7290. {
  7291. levelAccumulator >>= 8;
  7292. if (levelAccumulator >> 8)
  7293. levelAccumulator = 0xff;
  7294. x >>= 8;
  7295. jassert (x >= bounds.getX() && x < bounds.getRight());
  7296. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7297. }
  7298. }
  7299. }
  7300. }
  7301. juce_UseDebuggingNewOperator
  7302. private:
  7303. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7304. HeapBlock<int> table;
  7305. Rectangle<int> bounds;
  7306. int maxEdgesPerLine, lineStrideElements;
  7307. bool needToCheckEmptinesss;
  7308. void addEdgePoint (const int x, const int y, const int winding) throw();
  7309. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7310. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7311. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7312. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7313. };
  7314. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7315. /*** End of inlined file: juce_EdgeTable.h ***/
  7316. class Image;
  7317. class JUCE_API Path
  7318. {
  7319. public:
  7320. Path() throw();
  7321. Path (const Path& other) throw();
  7322. ~Path() throw();
  7323. const Path& operator= (const Path& other) throw();
  7324. bool isEmpty() const throw();
  7325. const Rectangle<float> getBounds() const throw();
  7326. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7327. bool contains (const float x,
  7328. const float y,
  7329. const float tolerence = 10.0f) const throw();
  7330. bool intersectsLine (const float x1, const float y1,
  7331. const float x2, const float y2,
  7332. const float tolerence = 10.0f) throw();
  7333. void clear() throw();
  7334. void startNewSubPath (const float startX,
  7335. const float startY) throw();
  7336. void closeSubPath() throw();
  7337. void lineTo (const float endX,
  7338. const float endY) throw();
  7339. void quadraticTo (const float controlPointX,
  7340. const float controlPointY,
  7341. const float endPointX,
  7342. const float endPointY) throw();
  7343. void cubicTo (const float controlPoint1X,
  7344. const float controlPoint1Y,
  7345. const float controlPoint2X,
  7346. const float controlPoint2Y,
  7347. const float endPointX,
  7348. const float endPointY) throw();
  7349. const Point<float> getCurrentPosition() const;
  7350. void addRectangle (const float x, const float y,
  7351. const float w, const float h) throw();
  7352. void addRectangle (const Rectangle<int>& rectangle) throw();
  7353. void addRoundedRectangle (const float x, const float y,
  7354. const float w, const float h,
  7355. float cornerSize) throw();
  7356. void addRoundedRectangle (const float x, const float y,
  7357. const float w, const float h,
  7358. float cornerSizeX,
  7359. float cornerSizeY) throw();
  7360. void addTriangle (const float x1, const float y1,
  7361. const float x2, const float y2,
  7362. const float x3, const float y3) throw();
  7363. void addQuadrilateral (const float x1, const float y1,
  7364. const float x2, const float y2,
  7365. const float x3, const float y3,
  7366. const float x4, const float y4) throw();
  7367. void addEllipse (const float x, const float y,
  7368. const float width, const float height) throw();
  7369. void addArc (const float x, const float y,
  7370. const float width, const float height,
  7371. const float fromRadians,
  7372. const float toRadians,
  7373. const bool startAsNewSubPath = false) throw();
  7374. void addCentredArc (const float centreX, const float centreY,
  7375. const float radiusX, const float radiusY,
  7376. const float rotationOfEllipse,
  7377. const float fromRadians,
  7378. const float toRadians,
  7379. const bool startAsNewSubPath = false) throw();
  7380. void addPieSegment (const float x, const float y,
  7381. const float width, const float height,
  7382. const float fromRadians,
  7383. const float toRadians,
  7384. const float innerCircleProportionalSize);
  7385. void addLineSegment (const float startX, const float startY,
  7386. const float endX, const float endY,
  7387. float lineThickness) throw();
  7388. void addArrow (const float startX, const float startY,
  7389. const float endX, const float endY,
  7390. float lineThickness,
  7391. float arrowheadWidth,
  7392. float arrowheadLength) throw();
  7393. void addStar (const float centreX,
  7394. const float centreY,
  7395. const int numberOfPoints,
  7396. const float innerRadius,
  7397. const float outerRadius,
  7398. const float startAngle = 0.0f);
  7399. void addBubble (float bodyX, float bodyY,
  7400. float bodyW, float bodyH,
  7401. float cornerSize,
  7402. float arrowTipX,
  7403. float arrowTipY,
  7404. int whichSide,
  7405. float arrowPositionAlongEdgeProportional,
  7406. float arrowWidth);
  7407. void addPath (const Path& pathToAppend) throw();
  7408. void addPath (const Path& pathToAppend,
  7409. const AffineTransform& transformToApply) throw();
  7410. void swapWithPath (Path& other);
  7411. void applyTransform (const AffineTransform& transform) throw();
  7412. void scaleToFit (const float x, const float y,
  7413. const float width, const float height,
  7414. const bool preserveProportions) throw();
  7415. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7416. const float width, const float height,
  7417. const bool preserveProportions,
  7418. const Justification& justificationType = Justification::centred) const throw();
  7419. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7420. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7421. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7422. class JUCE_API Iterator
  7423. {
  7424. public:
  7425. Iterator (const Path& path);
  7426. ~Iterator();
  7427. bool next();
  7428. enum PathElementType
  7429. {
  7430. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7431. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7432. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7433. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7434. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7435. };
  7436. PathElementType elementType;
  7437. float x1, y1, x2, y2, x3, y3;
  7438. private:
  7439. const Path& path;
  7440. int index;
  7441. Iterator (const Iterator&);
  7442. const Iterator& operator= (const Iterator&);
  7443. };
  7444. void loadPathFromStream (InputStream& source);
  7445. void loadPathFromData (const unsigned char* const data,
  7446. const int numberOfBytes) throw();
  7447. void writePathToStream (OutputStream& destination) const;
  7448. const String toString() const;
  7449. void restoreFromString (const String& stringVersion);
  7450. juce_UseDebuggingNewOperator
  7451. private:
  7452. friend class PathFlatteningIterator;
  7453. friend class Path::Iterator;
  7454. ArrayAllocationBase <float, DummyCriticalSection> data;
  7455. int numElements;
  7456. float pathXMin, pathXMax, pathYMin, pathYMax;
  7457. bool useNonZeroWinding;
  7458. static const float lineMarker;
  7459. static const float moveMarker;
  7460. static const float quadMarker;
  7461. static const float cubicMarker;
  7462. static const float closeSubPathMarker;
  7463. };
  7464. #endif // __JUCE_PATH_JUCEHEADER__
  7465. /*** End of inlined file: juce_Path.h ***/
  7466. class Font;
  7467. class JUCE_API Typeface : public ReferenceCountedObject
  7468. {
  7469. public:
  7470. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7471. const String getName() const throw() { return name; }
  7472. static const Ptr createSystemTypefaceFor (const Font& font);
  7473. virtual ~Typeface();
  7474. virtual float getAscent() const = 0;
  7475. virtual float getDescent() const = 0;
  7476. virtual float getStringWidth (const String& text) = 0;
  7477. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7478. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7479. juce_UseDebuggingNewOperator
  7480. protected:
  7481. String name;
  7482. Typeface (const String& name) throw();
  7483. private:
  7484. Typeface (const Typeface&);
  7485. const Typeface& operator= (const Typeface&);
  7486. };
  7487. class JUCE_API CustomTypeface : public Typeface
  7488. {
  7489. public:
  7490. CustomTypeface();
  7491. CustomTypeface (InputStream& serialisedTypefaceStream);
  7492. ~CustomTypeface();
  7493. void clear();
  7494. void setCharacteristics (const String& name, const float ascent,
  7495. const bool isBold, const bool isItalic,
  7496. const juce_wchar defaultCharacter) throw();
  7497. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7498. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7499. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7500. bool writeToStream (OutputStream& outputStream);
  7501. // The following methods implement the basic Typeface behaviour.
  7502. float getAscent() const;
  7503. float getDescent() const;
  7504. float getStringWidth (const String& text);
  7505. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7506. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7507. int getGlyphForCharacter (juce_wchar character);
  7508. juce_UseDebuggingNewOperator
  7509. protected:
  7510. juce_wchar defaultCharacter;
  7511. float ascent;
  7512. bool isBold, isItalic;
  7513. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7514. private:
  7515. class GlyphInfo;
  7516. friend class OwnedArray<GlyphInfo>;
  7517. OwnedArray <GlyphInfo> glyphs;
  7518. short lookupTable [128];
  7519. CustomTypeface (const CustomTypeface&);
  7520. const CustomTypeface& operator= (const CustomTypeface&);
  7521. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7522. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7523. };
  7524. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7525. /*** End of inlined file: juce_Typeface.h ***/
  7526. class LowLevelGraphicsContext;
  7527. class JUCE_API Font
  7528. {
  7529. public:
  7530. enum FontStyleFlags
  7531. {
  7532. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7533. bold = 1, /**< boldens the font. @see setStyleFlags */
  7534. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7535. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7536. };
  7537. Font (const float fontHeight,
  7538. const int styleFlags = plain) throw();
  7539. Font (const String& typefaceName,
  7540. const float fontHeight,
  7541. const int styleFlags) throw();
  7542. Font (const Font& other) throw();
  7543. Font (const Typeface::Ptr& typeface) throw();
  7544. Font() throw();
  7545. const Font& operator= (const Font& other) throw();
  7546. bool operator== (const Font& other) const throw();
  7547. bool operator!= (const Font& other) const throw();
  7548. ~Font() throw();
  7549. void setTypefaceName (const String& faceName) throw();
  7550. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7551. static const String getDefaultSansSerifFontName() throw();
  7552. static const String getDefaultSerifFontName() throw();
  7553. static const String getDefaultMonospacedFontName() throw();
  7554. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7555. float getHeight() const throw() { return font->height; }
  7556. void setHeight (float newHeight) throw();
  7557. void setHeightWithoutChangingWidth (float newHeight) throw();
  7558. float getAscent() const throw();
  7559. float getDescent() const throw();
  7560. int getStyleFlags() const throw() { return font->styleFlags; }
  7561. void setStyleFlags (const int newFlags) throw();
  7562. void setBold (const bool shouldBeBold) throw();
  7563. bool isBold() const throw();
  7564. void setItalic (const bool shouldBeItalic) throw();
  7565. bool isItalic() const throw();
  7566. void setUnderline (const bool shouldBeUnderlined) throw();
  7567. bool isUnderlined() const throw();
  7568. void setHorizontalScale (const float scaleFactor) throw();
  7569. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7570. void setExtraKerningFactor (const float extraKerning) throw();
  7571. float getExtraKerningFactor() const throw() { return font->kerning; }
  7572. void setSizeAndStyle (float newHeight,
  7573. const int newStyleFlags,
  7574. const float newHorizontalScale,
  7575. const float newKerningAmount) throw();
  7576. int getStringWidth (const String& text) const throw();
  7577. float getStringWidthFloat (const String& text) const throw();
  7578. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7579. Typeface* getTypeface() const throw();
  7580. static void findFonts (Array<Font>& results) throw();
  7581. static const StringArray findAllTypefaceNames() throw();
  7582. static const String getFallbackFontName() throw();
  7583. static void setFallbackFontName (const String& name) throw();
  7584. juce_UseDebuggingNewOperator
  7585. private:
  7586. friend class FontGlyphAlphaMap;
  7587. friend class TypefaceCache;
  7588. class SharedFontInternal : public ReferenceCountedObject
  7589. {
  7590. public:
  7591. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7592. const float kerning, const float ascent, const int styleFlags,
  7593. Typeface* const typeface) throw();
  7594. SharedFontInternal (const SharedFontInternal& other) throw();
  7595. String typefaceName;
  7596. float height, horizontalScale, kerning, ascent;
  7597. int styleFlags;
  7598. Typeface::Ptr typeface;
  7599. };
  7600. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7601. void dupeInternalIfShared() throw();
  7602. };
  7603. #endif // __JUCE_FONT_JUCEHEADER__
  7604. /*** End of inlined file: juce_Font.h ***/
  7605. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7606. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7607. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7608. class JUCE_API PathStrokeType
  7609. {
  7610. public:
  7611. enum JointStyle
  7612. {
  7613. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7614. Note that for angles that curve back on themselves, drawing a
  7615. mitre could require extending the point too far away from the
  7616. path, so a mitre limit is imposed and any corners that exceed it
  7617. are drawn as bevelled instead. */
  7618. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7619. beveled /**< Indicates that corners should be drawn with a line flattening their
  7620. outside edge. */
  7621. };
  7622. enum EndCapStyle
  7623. {
  7624. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7625. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7626. the thickness of the stroke. */
  7627. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7628. };
  7629. PathStrokeType (const float strokeThickness,
  7630. const JointStyle jointStyle = mitered,
  7631. const EndCapStyle endStyle = butt) throw();
  7632. PathStrokeType (const PathStrokeType& other) throw();
  7633. const PathStrokeType& operator= (const PathStrokeType& other) throw();
  7634. ~PathStrokeType() throw();
  7635. void createStrokedPath (Path& destPath,
  7636. const Path& sourcePath,
  7637. const AffineTransform& transform = AffineTransform::identity,
  7638. const float extraAccuracy = 1.0f) const throw();
  7639. void createDashedStroke (Path& destPath,
  7640. const Path& sourcePath,
  7641. const float* dashLengths,
  7642. int numDashLengths,
  7643. const AffineTransform& transform = AffineTransform::identity,
  7644. const float extraAccuracy = 1.0f) const throw();
  7645. float getStrokeThickness() const throw() { return thickness; }
  7646. JointStyle getJointStyle() const throw() { return jointStyle; }
  7647. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7648. juce_UseDebuggingNewOperator
  7649. bool operator== (const PathStrokeType& other) const throw();
  7650. bool operator!= (const PathStrokeType& other) const throw();
  7651. private:
  7652. float thickness;
  7653. JointStyle jointStyle;
  7654. EndCapStyle endStyle;
  7655. };
  7656. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7657. /*** End of inlined file: juce_PathStrokeType.h ***/
  7658. /*** Start of inlined file: juce_Line.h ***/
  7659. #ifndef __JUCE_LINE_JUCEHEADER__
  7660. #define __JUCE_LINE_JUCEHEADER__
  7661. class JUCE_API Line
  7662. {
  7663. public:
  7664. Line() throw();
  7665. Line (const Line& other) throw();
  7666. Line (const float startX,
  7667. const float startY,
  7668. const float endX,
  7669. const float endY) throw();
  7670. Line (const Point<float>& start,
  7671. const Point<float>& end) throw();
  7672. const Line& operator= (const Line& other) throw();
  7673. ~Line() throw();
  7674. inline float getStartX() const throw() { return startX; }
  7675. inline float getStartY() const throw() { return startY; }
  7676. inline float getEndX() const throw() { return endX; }
  7677. inline float getEndY() const throw() { return endY; }
  7678. const Point<float> getStart() const throw();
  7679. const Point<float> getEnd() const throw();
  7680. void setStart (const float newStartX,
  7681. const float newStartY) throw();
  7682. void setEnd (const float newEndX,
  7683. const float newEndY) throw();
  7684. void setStart (const Point<float>& newStart) throw();
  7685. void setEnd (const Point<float>& newEnd) throw();
  7686. void applyTransform (const AffineTransform& transform) throw();
  7687. float getLength() const throw();
  7688. bool isVertical() const throw();
  7689. bool isHorizontal() const throw();
  7690. float getAngle() const throw();
  7691. bool operator== (const Line& other) const throw();
  7692. bool operator!= (const Line& other) const throw();
  7693. bool intersects (const Line& line,
  7694. float& intersectionX,
  7695. float& intersectionY) const throw();
  7696. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7697. const Point<float> getPointAlongLine (const float distanceFromStart,
  7698. const float perpendicularDistance) const throw();
  7699. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7700. float getDistanceFromLine (const float x,
  7701. const float y) const throw();
  7702. float findNearestPointTo (const float x,
  7703. const float y) const throw();
  7704. bool isPointAbove (const float x, const float y) const throw();
  7705. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7706. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7707. bool clipToPath (const Path& path,
  7708. const bool keepSectionOutsidePath) throw();
  7709. juce_UseDebuggingNewOperator
  7710. private:
  7711. float startX, startY, endX, endY;
  7712. };
  7713. #endif // __JUCE_LINE_JUCEHEADER__
  7714. /*** End of inlined file: juce_Line.h ***/
  7715. /*** Start of inlined file: juce_Colours.h ***/
  7716. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7717. #define __JUCE_COLOURS_JUCEHEADER__
  7718. /*** Start of inlined file: juce_Colour.h ***/
  7719. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7720. #define __JUCE_COLOUR_JUCEHEADER__
  7721. /*** Start of inlined file: juce_PixelFormats.h ***/
  7722. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7723. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7724. #if JUCE_MSVC
  7725. #pragma pack (push, 1)
  7726. #define PACKED
  7727. #elif JUCE_GCC
  7728. #define PACKED __attribute__((packed))
  7729. #else
  7730. #define PACKED
  7731. #endif
  7732. class PixelRGB;
  7733. class PixelAlpha;
  7734. class JUCE_API PixelARGB
  7735. {
  7736. public:
  7737. PixelARGB() throw() {}
  7738. ~PixelARGB() throw() {}
  7739. PixelARGB (const uint32 argb_) throw()
  7740. : argb (argb_)
  7741. {
  7742. }
  7743. forcedinline uint32 getARGB() const throw() { return argb; }
  7744. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7745. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7746. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7747. forcedinline uint8 getRed() const throw() { return components.r; }
  7748. forcedinline uint8 getGreen() const throw() { return components.g; }
  7749. forcedinline uint8 getBlue() const throw() { return components.b; }
  7750. forcedinline void blend (const PixelARGB& src) throw()
  7751. {
  7752. uint32 sargb = src.getARGB();
  7753. const uint32 alpha = 0x100 - (sargb >> 24);
  7754. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7755. sargb += 0xff00ff00 & (getAG() * alpha);
  7756. argb = sargb;
  7757. }
  7758. forcedinline void blend (const PixelAlpha& src) throw();
  7759. forcedinline void blend (const PixelRGB& src) throw();
  7760. template <class Pixel>
  7761. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7762. {
  7763. ++extraAlpha;
  7764. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7765. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7766. const uint32 alpha = 0x100 - (sargb >> 24);
  7767. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7768. sargb += 0xff00ff00 & (getAG() * alpha);
  7769. argb = sargb;
  7770. }
  7771. template <class Pixel>
  7772. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7773. {
  7774. uint32 drb = getRB();
  7775. drb += (((src.getRB() - drb) * amount) >> 8);
  7776. drb &= 0x00ff00ff;
  7777. uint32 dag = getAG();
  7778. dag += (((src.getAG() - dag) * amount) >> 8);
  7779. dag &= 0x00ff00ff;
  7780. dag <<= 8;
  7781. dag |= drb;
  7782. argb = dag;
  7783. }
  7784. template <class Pixel>
  7785. forcedinline void set (const Pixel& src) throw()
  7786. {
  7787. argb = src.getARGB();
  7788. }
  7789. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7790. {
  7791. components.a = newAlpha;
  7792. }
  7793. forcedinline void multiplyAlpha (int multiplier) throw()
  7794. {
  7795. ++multiplier;
  7796. argb = ((multiplier * getAG()) & 0xff00ff00)
  7797. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7798. }
  7799. forcedinline void multiplyAlpha (const float multiplier) throw()
  7800. {
  7801. multiplyAlpha ((int) (multiplier * 256.0f));
  7802. }
  7803. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7804. {
  7805. components.b = b;
  7806. components.g = g;
  7807. components.r = r;
  7808. components.a = a;
  7809. }
  7810. forcedinline void premultiply() throw()
  7811. {
  7812. const uint32 alpha = components.a;
  7813. if (alpha < 0xff)
  7814. {
  7815. if (alpha == 0)
  7816. {
  7817. components.b = 0;
  7818. components.g = 0;
  7819. components.r = 0;
  7820. }
  7821. else
  7822. {
  7823. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7824. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7825. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7826. }
  7827. }
  7828. }
  7829. forcedinline void unpremultiply() throw()
  7830. {
  7831. const uint32 alpha = components.a;
  7832. if (alpha < 0xff)
  7833. {
  7834. if (alpha == 0)
  7835. {
  7836. components.b = 0;
  7837. components.g = 0;
  7838. components.r = 0;
  7839. }
  7840. else
  7841. {
  7842. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7843. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7844. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7845. }
  7846. }
  7847. }
  7848. forcedinline void desaturate() throw()
  7849. {
  7850. if (components.a < 0xff && components.a > 0)
  7851. {
  7852. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7853. components.r = components.g = components.b
  7854. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7855. }
  7856. else
  7857. {
  7858. components.r = components.g = components.b
  7859. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7860. }
  7861. }
  7862. #if JUCE_BIG_ENDIAN
  7863. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7864. #else
  7865. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7866. #endif
  7867. private:
  7868. union
  7869. {
  7870. uint32 argb;
  7871. struct
  7872. {
  7873. #if JUCE_BIG_ENDIAN
  7874. uint8 a : 8, r : 8, g : 8, b : 8;
  7875. #else
  7876. uint8 b, g, r, a;
  7877. #endif
  7878. } PACKED components;
  7879. };
  7880. } PACKED;
  7881. class JUCE_API PixelRGB
  7882. {
  7883. public:
  7884. PixelRGB() throw() {}
  7885. ~PixelRGB() throw() {}
  7886. PixelRGB (const uint32 argb) throw()
  7887. {
  7888. r = (uint8) (argb >> 16);
  7889. g = (uint8) (argb >> 8);
  7890. b = (uint8) (argb);
  7891. }
  7892. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7893. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7894. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7895. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7896. forcedinline uint8 getRed() const throw() { return r; }
  7897. forcedinline uint8 getGreen() const throw() { return g; }
  7898. forcedinline uint8 getBlue() const throw() { return b; }
  7899. forcedinline void blend (const PixelARGB& src) throw()
  7900. {
  7901. uint32 sargb = src.getARGB();
  7902. const uint32 alpha = 0x100 - (sargb >> 24);
  7903. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7904. sargb += 0x0000ff00 & (g * alpha);
  7905. r = (uint8) (sargb >> 16);
  7906. g = (uint8) (sargb >> 8);
  7907. b = (uint8) sargb;
  7908. }
  7909. forcedinline void blend (const PixelRGB& src) throw()
  7910. {
  7911. set (src);
  7912. }
  7913. forcedinline void blend (const PixelAlpha& src) throw();
  7914. template <class Pixel>
  7915. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7916. {
  7917. ++extraAlpha;
  7918. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7919. const uint32 sag = extraAlpha * src.getAG();
  7920. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7921. const uint32 alpha = 0x100 - (sargb >> 24);
  7922. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7923. sargb += 0x0000ff00 & (g * alpha);
  7924. b = (uint8) sargb;
  7925. g = (uint8) (sargb >> 8);
  7926. r = (uint8) (sargb >> 16);
  7927. }
  7928. template <class Pixel>
  7929. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7930. {
  7931. uint32 drb = getRB();
  7932. drb += (((src.getRB() - drb) * amount) >> 8);
  7933. uint32 dag = getAG();
  7934. dag += (((src.getAG() - dag) * amount) >> 8);
  7935. b = (uint8) drb;
  7936. g = (uint8) dag;
  7937. r = (uint8) (drb >> 16);
  7938. }
  7939. template <class Pixel>
  7940. forcedinline void set (const Pixel& src) throw()
  7941. {
  7942. b = src.getBlue();
  7943. g = src.getGreen();
  7944. r = src.getRed();
  7945. }
  7946. forcedinline void setAlpha (const uint8) throw() {}
  7947. forcedinline void multiplyAlpha (int) throw() {}
  7948. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7949. {
  7950. r = r_;
  7951. g = g_;
  7952. b = b_;
  7953. }
  7954. forcedinline void premultiply() throw() {}
  7955. forcedinline void unpremultiply() throw() {}
  7956. forcedinline void desaturate() throw()
  7957. {
  7958. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7959. }
  7960. #if JUCE_MAC
  7961. enum { indexR = 0, indexG = 1, indexB = 2 };
  7962. #else
  7963. enum { indexR = 2, indexG = 1, indexB = 0 };
  7964. #endif
  7965. private:
  7966. #if JUCE_MAC
  7967. uint8 r, g, b;
  7968. #else
  7969. uint8 b, g, r;
  7970. #endif
  7971. } PACKED;
  7972. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7973. {
  7974. set (src);
  7975. }
  7976. class JUCE_API PixelAlpha
  7977. {
  7978. public:
  7979. PixelAlpha() throw() {}
  7980. ~PixelAlpha() throw() {}
  7981. PixelAlpha (const uint32 argb) throw()
  7982. {
  7983. a = (uint8) (argb >> 24);
  7984. }
  7985. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7986. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7987. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7988. forcedinline uint8 getAlpha() const throw() { return a; }
  7989. forcedinline uint8 getRed() const throw() { return 0; }
  7990. forcedinline uint8 getGreen() const throw() { return 0; }
  7991. forcedinline uint8 getBlue() const throw() { return 0; }
  7992. template <class Pixel>
  7993. forcedinline void blend (const Pixel& src) throw()
  7994. {
  7995. const int srcA = src.getAlpha();
  7996. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7997. }
  7998. template <class Pixel>
  7999. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8000. {
  8001. ++extraAlpha;
  8002. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8003. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8004. }
  8005. template <class Pixel>
  8006. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8007. {
  8008. a += ((src,getAlpha() - a) * amount) >> 8;
  8009. }
  8010. template <class Pixel>
  8011. forcedinline void set (const Pixel& src) throw()
  8012. {
  8013. a = src.getAlpha();
  8014. }
  8015. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8016. {
  8017. a = newAlpha;
  8018. }
  8019. forcedinline void multiplyAlpha (int multiplier) throw()
  8020. {
  8021. ++multiplier;
  8022. a = (uint8) ((a * multiplier) >> 8);
  8023. }
  8024. forcedinline void multiplyAlpha (const float multiplier) throw()
  8025. {
  8026. a = (uint8) (a * multiplier);
  8027. }
  8028. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8029. {
  8030. a = a_;
  8031. }
  8032. forcedinline void premultiply() throw()
  8033. {
  8034. }
  8035. forcedinline void unpremultiply() throw()
  8036. {
  8037. }
  8038. forcedinline void desaturate() throw()
  8039. {
  8040. }
  8041. private:
  8042. uint8 a : 8;
  8043. } PACKED;
  8044. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8045. {
  8046. blend (PixelARGB (src.getARGB()));
  8047. }
  8048. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8049. {
  8050. uint32 sargb = src.getARGB();
  8051. const uint32 alpha = 0x100 - (sargb >> 24);
  8052. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8053. sargb += 0xff00ff00 & (getAG() * alpha);
  8054. argb = sargb;
  8055. }
  8056. #if JUCE_MSVC
  8057. #pragma pack (pop)
  8058. #endif
  8059. #undef PACKED
  8060. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8061. /*** End of inlined file: juce_PixelFormats.h ***/
  8062. class JUCE_API Colour
  8063. {
  8064. public:
  8065. Colour() throw();
  8066. Colour (const Colour& other) throw();
  8067. explicit Colour (const uint32 argb) throw();
  8068. Colour (const uint8 red,
  8069. const uint8 green,
  8070. const uint8 blue) throw();
  8071. static const Colour fromRGB (const uint8 red,
  8072. const uint8 green,
  8073. const uint8 blue) throw();
  8074. Colour (const uint8 red,
  8075. const uint8 green,
  8076. const uint8 blue,
  8077. const uint8 alpha) throw();
  8078. static const Colour fromRGBA (const uint8 red,
  8079. const uint8 green,
  8080. const uint8 blue,
  8081. const uint8 alpha) throw();
  8082. Colour (const uint8 red,
  8083. const uint8 green,
  8084. const uint8 blue,
  8085. const float alpha) throw();
  8086. static const Colour fromRGBAFloat (const uint8 red,
  8087. const uint8 green,
  8088. const uint8 blue,
  8089. const float alpha) throw();
  8090. Colour (const float hue,
  8091. const float saturation,
  8092. const float brightness,
  8093. const uint8 alpha) throw();
  8094. Colour (const float hue,
  8095. const float saturation,
  8096. const float brightness,
  8097. const float alpha) throw();
  8098. static const Colour fromHSV (const float hue,
  8099. const float saturation,
  8100. const float brightness,
  8101. const float alpha) throw();
  8102. ~Colour() throw();
  8103. const Colour& operator= (const Colour& other) throw();
  8104. bool operator== (const Colour& other) const throw();
  8105. bool operator!= (const Colour& other) const throw();
  8106. uint8 getRed() const throw() { return argb.getRed(); }
  8107. uint8 getGreen() const throw() { return argb.getGreen(); }
  8108. uint8 getBlue() const throw() { return argb.getBlue(); }
  8109. float getFloatRed() const throw();
  8110. float getFloatGreen() const throw();
  8111. float getFloatBlue() const throw();
  8112. const PixelARGB getPixelARGB() const throw();
  8113. uint32 getARGB() const throw();
  8114. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8115. float getFloatAlpha() const throw();
  8116. bool isOpaque() const throw();
  8117. bool isTransparent() const throw();
  8118. const Colour withAlpha (const uint8 newAlpha) const throw();
  8119. const Colour withAlpha (const float newAlpha) const throw();
  8120. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  8121. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8122. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8123. float getHue() const throw();
  8124. float getSaturation() const throw();
  8125. float getBrightness() const throw();
  8126. void getHSB (float& hue,
  8127. float& saturation,
  8128. float& brightness) const throw();
  8129. const Colour withHue (const float newHue) const throw();
  8130. const Colour withSaturation (const float newSaturation) const throw();
  8131. const Colour withBrightness (const float newBrightness) const throw();
  8132. const Colour withRotatedHue (const float amountToRotate) const throw();
  8133. const Colour withMultipliedSaturation (const float multiplier) const throw();
  8134. const Colour withMultipliedBrightness (const float amount) const throw();
  8135. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8136. const Colour darker (float amountDarker = 0.4f) const throw();
  8137. const Colour contrasting (const float amount = 1.0f) const throw();
  8138. static const Colour contrasting (const Colour& colour1,
  8139. const Colour& colour2) throw();
  8140. static const Colour greyLevel (const float brightness) throw();
  8141. const String toString() const throw();
  8142. static const Colour fromString (const String& encodedColourString);
  8143. juce_UseDebuggingNewOperator
  8144. private:
  8145. PixelARGB argb;
  8146. };
  8147. #endif // __JUCE_COLOUR_JUCEHEADER__
  8148. /*** End of inlined file: juce_Colour.h ***/
  8149. class Colours
  8150. {
  8151. public:
  8152. static JUCE_API const Colour
  8153. transparentBlack, /**< ARGB = 0x00000000 */
  8154. transparentWhite, /**< ARGB = 0x00ffffff */
  8155. black, /**< ARGB = 0xff000000 */
  8156. white, /**< ARGB = 0xffffffff */
  8157. blue, /**< ARGB = 0xff0000ff */
  8158. grey, /**< ARGB = 0xff808080 */
  8159. green, /**< ARGB = 0xff008000 */
  8160. red, /**< ARGB = 0xffff0000 */
  8161. yellow, /**< ARGB = 0xffffff00 */
  8162. aliceblue, antiquewhite, aqua, aquamarine,
  8163. azure, beige, bisque, blanchedalmond,
  8164. blueviolet, brown, burlywood, cadetblue,
  8165. chartreuse, chocolate, coral, cornflowerblue,
  8166. cornsilk, crimson, cyan, darkblue,
  8167. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8168. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8169. darkorchid, darkred, darksalmon, darkseagreen,
  8170. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8171. deeppink, deepskyblue, dimgrey, dodgerblue,
  8172. firebrick, floralwhite, forestgreen, fuchsia,
  8173. gainsboro, gold, goldenrod, greenyellow,
  8174. honeydew, hotpink, indianred, indigo,
  8175. ivory, khaki, lavender, lavenderblush,
  8176. lemonchiffon, lightblue, lightcoral, lightcyan,
  8177. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8178. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8179. lightsteelblue, lightyellow, lime, limegreen,
  8180. linen, magenta, maroon, mediumaquamarine,
  8181. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8182. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8183. midnightblue, mintcream, mistyrose, navajowhite,
  8184. navy, oldlace, olive, olivedrab,
  8185. orange, orangered, orchid, palegoldenrod,
  8186. palegreen, paleturquoise, palevioletred, papayawhip,
  8187. peachpuff, peru, pink, plum,
  8188. powderblue, purple, rosybrown, royalblue,
  8189. saddlebrown, salmon, sandybrown, seagreen,
  8190. seashell, sienna, silver, skyblue,
  8191. slateblue, slategrey, snow, springgreen,
  8192. steelblue, tan, teal, thistle,
  8193. tomato, turquoise, violet, wheat,
  8194. whitesmoke, yellowgreen;
  8195. static JUCE_API const Colour findColourForName (const String& colourName,
  8196. const Colour& defaultColour);
  8197. private:
  8198. // this isn't a class you should ever instantiate - it's just here for the
  8199. // static values in it.
  8200. Colours();
  8201. };
  8202. #endif // __JUCE_COLOURS_JUCEHEADER__
  8203. /*** End of inlined file: juce_Colours.h ***/
  8204. /*** Start of inlined file: juce_FillType.h ***/
  8205. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8206. #define __JUCE_FILLTYPE_JUCEHEADER__
  8207. /*** Start of inlined file: juce_ColourGradient.h ***/
  8208. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8209. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8210. class JUCE_API ColourGradient
  8211. {
  8212. public:
  8213. ColourGradient (const Colour& colour1,
  8214. const float x1,
  8215. const float y1,
  8216. const Colour& colour2,
  8217. const float x2,
  8218. const float y2,
  8219. const bool isRadial) throw();
  8220. ColourGradient() throw();
  8221. ~ColourGradient() throw();
  8222. void clearColours() throw();
  8223. void addColour (const double proportionAlongGradient,
  8224. const Colour& colour) throw();
  8225. void multiplyOpacity (const float multiplier) throw();
  8226. int getNumColours() const throw();
  8227. double getColourPosition (const int index) const throw();
  8228. const Colour getColour (const int index) const throw();
  8229. const Colour getColourAtPosition (const float position) const throw();
  8230. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8231. bool isOpaque() const throw();
  8232. bool isInvisible() const throw();
  8233. float x1;
  8234. float y1;
  8235. float x2;
  8236. float y2;
  8237. bool isRadial;
  8238. juce_UseDebuggingNewOperator
  8239. private:
  8240. Array <uint32> colours;
  8241. };
  8242. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8243. /*** End of inlined file: juce_ColourGradient.h ***/
  8244. class Image;
  8245. class JUCE_API FillType
  8246. {
  8247. public:
  8248. FillType() throw();
  8249. FillType (const Colour& colour) throw();
  8250. FillType (const ColourGradient& gradient) throw();
  8251. FillType (const Image& image, const AffineTransform& transform) throw();
  8252. FillType (const FillType& other) throw();
  8253. const FillType& operator= (const FillType& other) throw();
  8254. ~FillType() throw();
  8255. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8256. bool isGradient() const throw() { return gradient != 0; }
  8257. bool isTiledImage() const throw() { return image != 0; }
  8258. void setColour (const Colour& newColour) throw();
  8259. void setGradient (const ColourGradient& newGradient) throw();
  8260. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8261. void setOpacity (const float newOpacity) throw();
  8262. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8263. Colour colour;
  8264. ScopedPointer <ColourGradient> gradient;
  8265. const Image* image;
  8266. AffineTransform transform;
  8267. juce_UseDebuggingNewOperator
  8268. };
  8269. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8270. /*** End of inlined file: juce_FillType.h ***/
  8271. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8272. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8273. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8274. class JUCE_API RectanglePlacement
  8275. {
  8276. public:
  8277. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  8278. RectanglePlacement (const RectanglePlacement& other) throw();
  8279. const RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8280. enum
  8281. {
  8282. xLeft = 1,
  8283. xRight = 2,
  8284. xMid = 4,
  8285. yTop = 8,
  8286. yBottom = 16,
  8287. yMid = 32,
  8288. stretchToFit = 64,
  8289. fillDestination = 128,
  8290. onlyReduceInSize = 256,
  8291. onlyIncreaseInSize = 512,
  8292. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8293. centred = 4 + 32
  8294. };
  8295. inline int getFlags() const throw() { return flags; }
  8296. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8297. void applyTo (double& sourceX,
  8298. double& sourceY,
  8299. double& sourceW,
  8300. double& sourceH,
  8301. const double destinationX,
  8302. const double destinationY,
  8303. const double destinationW,
  8304. const double destinationH) const throw();
  8305. const AffineTransform getTransformToFit (float sourceX,
  8306. float sourceY,
  8307. float sourceW,
  8308. float sourceH,
  8309. const float destinationX,
  8310. const float destinationY,
  8311. const float destinationW,
  8312. const float destinationH) const throw();
  8313. private:
  8314. int flags;
  8315. };
  8316. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8317. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8318. class LowLevelGraphicsContext;
  8319. class Image;
  8320. class RectangleList;
  8321. class JUCE_API Graphics
  8322. {
  8323. public:
  8324. Graphics (Image& imageToDrawOnto) throw();
  8325. ~Graphics() throw();
  8326. void setColour (const Colour& newColour) throw();
  8327. void setOpacity (const float newOpacity) throw();
  8328. void setGradientFill (const ColourGradient& gradient) throw();
  8329. void setTiledImageFill (const Image& imageToUse,
  8330. const int anchorX,
  8331. const int anchorY,
  8332. const float opacity) throw();
  8333. void setFillType (const FillType& newFill) throw();
  8334. void setFont (const Font& newFont) throw();
  8335. void setFont (const float newFontHeight,
  8336. const int fontStyleFlags = Font::plain) throw();
  8337. void drawSingleLineText (const String& text,
  8338. const int startX,
  8339. const int baselineY) const throw();
  8340. void drawMultiLineText (const String& text,
  8341. const int startX,
  8342. const int baselineY,
  8343. const int maximumLineWidth) const throw();
  8344. void drawTextAsPath (const String& text,
  8345. const AffineTransform& transform) const throw();
  8346. void drawText (const String& text,
  8347. const int x,
  8348. const int y,
  8349. const int width,
  8350. const int height,
  8351. const Justification& justificationType,
  8352. const bool useEllipsesIfTooBig) const throw();
  8353. void drawFittedText (const String& text,
  8354. const int x,
  8355. const int y,
  8356. const int width,
  8357. const int height,
  8358. const Justification& justificationFlags,
  8359. const int maximumNumberOfLines,
  8360. const float minimumHorizontalScale = 0.7f) const throw();
  8361. void fillAll() const throw();
  8362. void fillAll (const Colour& colourToUse) const throw();
  8363. void fillRect (int x,
  8364. int y,
  8365. int width,
  8366. int height) const throw();
  8367. void fillRect (const Rectangle<int>& rectangle) const throw();
  8368. void fillRect (const float x,
  8369. const float y,
  8370. const float width,
  8371. const float height) const throw();
  8372. void fillRoundedRectangle (const float x,
  8373. const float y,
  8374. const float width,
  8375. const float height,
  8376. const float cornerSize) const throw();
  8377. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8378. const float cornerSize) const throw();
  8379. void fillCheckerBoard (int x, int y,
  8380. int width, int height,
  8381. const int checkWidth,
  8382. const int checkHeight,
  8383. const Colour& colour1,
  8384. const Colour& colour2) const throw();
  8385. void drawRect (const int x,
  8386. const int y,
  8387. const int width,
  8388. const int height,
  8389. const int lineThickness = 1) const throw();
  8390. void drawRect (const float x,
  8391. const float y,
  8392. const float width,
  8393. const float height,
  8394. const float lineThickness = 1.0f) const throw();
  8395. void drawRect (const Rectangle<int>& rectangle,
  8396. const int lineThickness = 1) const throw();
  8397. void drawRoundedRectangle (const float x,
  8398. const float y,
  8399. const float width,
  8400. const float height,
  8401. const float cornerSize,
  8402. const float lineThickness) const throw();
  8403. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8404. const float cornerSize,
  8405. const float lineThickness) const throw();
  8406. void drawBevel (const int x,
  8407. const int y,
  8408. const int width,
  8409. const int height,
  8410. const int bevelThickness,
  8411. const Colour& topLeftColour = Colours::white,
  8412. const Colour& bottomRightColour = Colours::black,
  8413. const bool useGradient = true,
  8414. const bool sharpEdgeOnOutside = true) const throw();
  8415. void setPixel (int x, int y) const throw();
  8416. void fillEllipse (const float x,
  8417. const float y,
  8418. const float width,
  8419. const float height) const throw();
  8420. void drawEllipse (const float x,
  8421. const float y,
  8422. const float width,
  8423. const float height,
  8424. const float lineThickness) const throw();
  8425. void drawLine (float startX,
  8426. float startY,
  8427. float endX,
  8428. float endY) const throw();
  8429. void drawLine (const float startX,
  8430. const float startY,
  8431. const float endX,
  8432. const float endY,
  8433. const float lineThickness) const throw();
  8434. void drawLine (const Line& line) const throw();
  8435. void drawLine (const Line& line,
  8436. const float lineThickness) const throw();
  8437. void drawDashedLine (const float startX,
  8438. const float startY,
  8439. const float endX,
  8440. const float endY,
  8441. const float* const dashLengths,
  8442. const int numDashLengths,
  8443. const float lineThickness = 1.0f) const throw();
  8444. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8445. void drawHorizontalLine (const int y, float left, float right) const throw();
  8446. void fillPath (const Path& path,
  8447. const AffineTransform& transform = AffineTransform::identity) const throw();
  8448. void strokePath (const Path& path,
  8449. const PathStrokeType& strokeType,
  8450. const AffineTransform& transform = AffineTransform::identity) const throw();
  8451. void drawArrow (const float startX,
  8452. const float startY,
  8453. const float endX,
  8454. const float endY,
  8455. const float lineThickness,
  8456. const float arrowheadWidth,
  8457. const float arrowheadLength) const throw();
  8458. enum ResamplingQuality
  8459. {
  8460. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8461. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8462. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8463. };
  8464. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8465. void drawImageAt (const Image* const imageToDraw,
  8466. const int topLeftX,
  8467. const int topLeftY,
  8468. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8469. void drawImage (const Image* const imageToDraw,
  8470. int destX,
  8471. int destY,
  8472. int destWidth,
  8473. int destHeight,
  8474. int sourceX,
  8475. int sourceY,
  8476. int sourceWidth,
  8477. int sourceHeight,
  8478. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8479. void drawImageTransformed (const Image* const imageToDraw,
  8480. const Rectangle<int>& imageSubRegion,
  8481. const AffineTransform& transform,
  8482. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8483. void drawImageWithin (const Image* const imageToDraw,
  8484. const int destX,
  8485. const int destY,
  8486. const int destWidth,
  8487. const int destHeight,
  8488. const RectanglePlacement& placementWithinTarget,
  8489. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8490. const Rectangle<int> getClipBounds() const throw();
  8491. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8492. bool reduceClipRegion (const int x, const int y,
  8493. const int width, const int height) throw();
  8494. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8495. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8496. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8497. const AffineTransform& transform) throw();
  8498. void excludeClipRegion (const int x, const int y,
  8499. const int width, const int height) throw();
  8500. bool isClipEmpty() const throw();
  8501. void saveState() throw();
  8502. void restoreState() throw();
  8503. void setOrigin (const int newOriginX,
  8504. const int newOriginY) throw();
  8505. void resetToDefaultState() throw();
  8506. bool isVectorDevice() const throw();
  8507. juce_UseDebuggingNewOperator
  8508. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8509. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8510. private:
  8511. LowLevelGraphicsContext* const context;
  8512. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8513. bool saveStatePending;
  8514. void saveStateIfPending() throw();
  8515. const Graphics& operator= (const Graphics& other);
  8516. Graphics (const Graphics&);
  8517. };
  8518. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8519. /*** End of inlined file: juce_Graphics.h ***/
  8520. class JUCE_API ImageEffectFilter
  8521. {
  8522. public:
  8523. virtual void applyEffect (Image& sourceImage,
  8524. Graphics& destContext) = 0;
  8525. virtual ~ImageEffectFilter() {}
  8526. };
  8527. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8528. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8529. /*** Start of inlined file: juce_RectangleList.h ***/
  8530. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8531. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8532. class JUCE_API RectangleList
  8533. {
  8534. public:
  8535. RectangleList() throw();
  8536. RectangleList (const RectangleList& other) throw();
  8537. RectangleList (const Rectangle<int>& rect) throw();
  8538. const RectangleList& operator= (const RectangleList& other) throw();
  8539. ~RectangleList() throw();
  8540. bool isEmpty() const throw();
  8541. int getNumRectangles() const throw() { return rects.size(); }
  8542. const Rectangle<int> getRectangle (const int index) const throw();
  8543. void clear() throw();
  8544. void add (const int x, const int y,
  8545. const int w, const int h) throw();
  8546. void add (const Rectangle<int>& rect) throw();
  8547. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8548. void add (const RectangleList& other) throw();
  8549. void subtract (const Rectangle<int>& rect) throw();
  8550. void subtract (const RectangleList& otherList) throw();
  8551. bool clipTo (const Rectangle<int>& rect) throw();
  8552. bool clipTo (const RectangleList& other) throw();
  8553. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8554. void swapWith (RectangleList& otherList) throw();
  8555. bool containsPoint (const int x, const int y) const throw();
  8556. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8557. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8558. bool intersects (const RectangleList& other) const throw();
  8559. const Rectangle<int> getBounds() const throw();
  8560. void consolidate() throw();
  8561. void offsetAll (const int dx, const int dy) throw();
  8562. const Path toPath() const throw();
  8563. class Iterator
  8564. {
  8565. public:
  8566. Iterator (const RectangleList& list) throw();
  8567. ~Iterator() throw();
  8568. bool next() throw();
  8569. const Rectangle<int>* getRectangle() const throw() { return current; }
  8570. juce_UseDebuggingNewOperator
  8571. private:
  8572. const Rectangle<int>* current;
  8573. const RectangleList& owner;
  8574. int index;
  8575. Iterator (const Iterator&);
  8576. const Iterator& operator= (const Iterator&);
  8577. };
  8578. juce_UseDebuggingNewOperator
  8579. private:
  8580. friend class Iterator;
  8581. Array <Rectangle<int> > rects;
  8582. };
  8583. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8584. /*** End of inlined file: juce_RectangleList.h ***/
  8585. /*** Start of inlined file: juce_BorderSize.h ***/
  8586. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8587. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8588. class JUCE_API BorderSize
  8589. {
  8590. public:
  8591. BorderSize() throw();
  8592. BorderSize (const BorderSize& other) throw();
  8593. BorderSize (const int topGap,
  8594. const int leftGap,
  8595. const int bottomGap,
  8596. const int rightGap) throw();
  8597. BorderSize (const int allGaps) throw();
  8598. ~BorderSize() throw();
  8599. int getTop() const throw() { return top; }
  8600. int getLeft() const throw() { return left; }
  8601. int getBottom() const throw() { return bottom; }
  8602. int getRight() const throw() { return right; }
  8603. int getTopAndBottom() const throw() { return top + bottom; }
  8604. int getLeftAndRight() const throw() { return left + right; }
  8605. void setTop (const int newTopGap) throw();
  8606. void setLeft (const int newLeftGap) throw();
  8607. void setBottom (const int newBottomGap) throw();
  8608. void setRight (const int newRightGap) throw();
  8609. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8610. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8611. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8612. void addTo (Rectangle<int>& original) const throw();
  8613. bool operator== (const BorderSize& other) const throw();
  8614. bool operator!= (const BorderSize& other) const throw();
  8615. juce_UseDebuggingNewOperator
  8616. private:
  8617. int top, left, bottom, right;
  8618. };
  8619. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8620. /*** End of inlined file: juce_BorderSize.h ***/
  8621. /*** Start of inlined file: juce_ComponentPeer.h ***/
  8622. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  8623. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  8624. class Component;
  8625. class Graphics;
  8626. class ComponentBoundsConstrainer;
  8627. class ComponentDeletionWatcher;
  8628. class JUCE_API ComponentPeer : public MessageListener
  8629. {
  8630. public:
  8631. enum StyleFlags
  8632. {
  8633. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  8634. entry on the taskbar (ignored on MacOSX) */
  8635. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  8636. tooltip, etc. */
  8637. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  8638. through it (may not be possible on some platforms). */
  8639. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  8640. title bar and frame\. if not specified, the window will be
  8641. borderless. */
  8642. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  8643. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  8644. minimise button on it. */
  8645. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  8646. maximise button on it. */
  8647. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  8648. close button on it. */
  8649. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  8650. not be possible on all platforms). */
  8651. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  8652. do its own repainting, but only to repaint when the
  8653. performAnyPendingRepaintsNow() method is called. */
  8654. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  8655. be used for things like plugin windows, to stop them interfering
  8656. with the host's shortcut keys */
  8657. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  8658. };
  8659. ComponentPeer (Component* const component,
  8660. const int styleFlags) throw();
  8661. virtual ~ComponentPeer();
  8662. Component* getComponent() const throw() { return component; }
  8663. int getStyleFlags() const throw() { return styleFlags; }
  8664. virtual void* getNativeHandle() const = 0;
  8665. virtual void setVisible (bool shouldBeVisible) = 0;
  8666. virtual void setTitle (const String& title) = 0;
  8667. virtual void setPosition (int x, int y) = 0;
  8668. virtual void setSize (int w, int h) = 0;
  8669. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  8670. virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
  8671. virtual const Point<int> getScreenPosition() const = 0;
  8672. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  8673. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  8674. virtual void setMinimised (bool shouldBeMinimised) = 0;
  8675. virtual bool isMinimised() const = 0;
  8676. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  8677. virtual bool isFullScreen() const = 0;
  8678. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  8679. const Rectangle<int>& getNonFullScreenBounds() const throw();
  8680. virtual void setIcon (const Image& newIcon) = 0;
  8681. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  8682. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  8683. virtual bool contains (int x, int y, bool trueIfInAChildWindow) const = 0;
  8684. virtual const BorderSize getFrameSize() const = 0;
  8685. void handleMovedOrResized();
  8686. void handleScreenSizeChange();
  8687. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  8688. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  8689. virtual void toFront (bool makeActive) = 0;
  8690. virtual void toBehind (ComponentPeer* other) = 0;
  8691. void handleBroughtToFront();
  8692. virtual bool isFocused() const = 0;
  8693. virtual void grabFocus() = 0;
  8694. virtual void textInputRequired (const Point<int>& position) = 0;
  8695. void handleFocusGain();
  8696. void handleFocusLoss();
  8697. Component* getLastFocusedSubcomponent() const throw();
  8698. bool handleKeyPress (const int keyCode,
  8699. const juce_wchar textCharacter);
  8700. bool handleKeyUpOrDown (const bool isKeyDown);
  8701. void handleModifierKeysChange();
  8702. virtual void repaint (int x, int y, int w, int h) = 0;
  8703. virtual void performAnyPendingRepaintsNow() = 0;
  8704. void handleMouseEnter (int x, int y, const int64 time);
  8705. void handleMouseMove (int x, int y, const int64 time);
  8706. void handleMouseDown (int x, int y, const int64 time);
  8707. void handleMouseDrag (int x, int y, const int64 time);
  8708. void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8709. void handleMouseExit (int x, int y, const int64 time);
  8710. void handleMouseWheel (const int amountX, const int amountY, const int64 time);
  8711. void sendFakeMouseMove() throw();
  8712. void handleUserClosingWindow();
  8713. void handleFileDragMove (const StringArray& files, int x, int y);
  8714. void handleFileDragExit (const StringArray& files);
  8715. void handleFileDragDrop (const StringArray& files, int x, int y);
  8716. void clearMaskedRegion() throw();
  8717. void addMaskedRegion (int x, int y, int w, int h) throw();
  8718. static int getNumPeers() throw();
  8719. static ComponentPeer* getPeer (const int index) throw();
  8720. static bool isValidPeer (const ComponentPeer* const peer) throw();
  8721. static void bringModalComponentToFront();
  8722. virtual const StringArray getAvailableRenderingEngines() throw();
  8723. virtual int getCurrentRenderingEngine() throw();
  8724. virtual void setCurrentRenderingEngine (int index) throw();
  8725. juce_UseDebuggingNewOperator
  8726. protected:
  8727. Component* const component;
  8728. const int styleFlags;
  8729. RectangleList maskedRegion;
  8730. Rectangle<int> lastNonFullscreenBounds;
  8731. uint32 lastPaintTime;
  8732. ComponentBoundsConstrainer* constrainer;
  8733. static void updateCurrentModifiers() throw();
  8734. void handleMessage (const Message& message);
  8735. private:
  8736. Component* lastFocusedComponent;
  8737. ScopedPointer <ComponentDeletionWatcher> dragAndDropTargetComponent;
  8738. Component* lastDragAndDropCompUnderMouse;
  8739. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  8740. friend class Component;
  8741. static ComponentPeer* getPeerFor (const Component* const component) throw();
  8742. void setLastDragDropTarget (Component* comp);
  8743. ComponentPeer (const ComponentPeer&);
  8744. const ComponentPeer& operator= (const ComponentPeer&);
  8745. };
  8746. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  8747. /*** End of inlined file: juce_ComponentPeer.h ***/
  8748. class LookAndFeel;
  8749. class JUCE_API Component : public MouseListener,
  8750. protected MessageListener
  8751. {
  8752. public:
  8753. Component() throw();
  8754. virtual ~Component();
  8755. Component (const String& componentName) throw();
  8756. const String& getName() const throw() { return componentName_; }
  8757. virtual void setName (const String& newName);
  8758. bool isValidComponent() const throw();
  8759. virtual void setVisible (bool shouldBeVisible);
  8760. bool isVisible() const throw() { return flags.visibleFlag; }
  8761. virtual void visibilityChanged();
  8762. bool isShowing() const throw();
  8763. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8764. const int deltaXToMove = 0,
  8765. const int deltaYToMove = 0,
  8766. const float scaleFactorAtEnd = 1.0f);
  8767. virtual void addToDesktop (int windowStyleFlags,
  8768. void* nativeWindowToAttachTo = 0);
  8769. void removeFromDesktop();
  8770. bool isOnDesktop() const throw();
  8771. ComponentPeer* getPeer() const throw();
  8772. virtual void userTriedToCloseWindow();
  8773. virtual void minimisationStateChanged (bool isNowMinimised);
  8774. void toFront (const bool shouldAlsoGainFocus);
  8775. void toBack();
  8776. void toBehind (Component* const other);
  8777. void setAlwaysOnTop (const bool shouldStayOnTop);
  8778. bool isAlwaysOnTop() const throw();
  8779. inline int getX() const throw() { return bounds_.getX(); }
  8780. inline int getY() const throw() { return bounds_.getY(); }
  8781. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8782. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8783. int getRight() const throw() { return bounds_.getRight(); }
  8784. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8785. int getBottom() const throw() { return bounds_.getBottom(); }
  8786. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8787. void getVisibleArea (RectangleList& result,
  8788. const bool includeSiblings) const;
  8789. int getScreenX() const;
  8790. int getScreenY() const;
  8791. const Point<int> getScreenPosition() const;
  8792. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8793. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8794. const Point<int> relativePositionToOtherComponent (const Component* const targetComponent,
  8795. const Point<int>& positionRelativeToThis) const;
  8796. void setTopLeftPosition (const int x, const int y);
  8797. void setTopRightPosition (const int x, const int y);
  8798. void setSize (const int newWidth, const int newHeight);
  8799. void setBounds (int x, int y, int width, int height);
  8800. void setBounds (const Rectangle<int>& newBounds);
  8801. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8802. const float proportionalWidth, const float proportionalHeight);
  8803. void setBoundsInset (const BorderSize& borders);
  8804. void setBoundsToFit (int x, int y, int width, int height,
  8805. const Justification& justification,
  8806. const bool onlyReduceInSize);
  8807. void setCentrePosition (const int x, const int y);
  8808. void setCentreRelative (const float x, const float y);
  8809. void centreWithSize (const int width, const int height);
  8810. int proportionOfWidth (const float proportion) const throw();
  8811. int proportionOfHeight (const float proportion) const throw();
  8812. int getParentWidth() const throw();
  8813. int getParentHeight() const throw();
  8814. const Rectangle<int> getParentMonitorArea() const throw();
  8815. int getNumChildComponents() const throw();
  8816. Component* getChildComponent (const int index) const throw();
  8817. int getIndexOfChildComponent (const Component* const child) const throw();
  8818. void addChildComponent (Component* const child,
  8819. int zOrder = -1);
  8820. void addAndMakeVisible (Component* const child,
  8821. int zOrder = -1);
  8822. void removeChildComponent (Component* const childToRemove);
  8823. Component* removeChildComponent (const int childIndexToRemove);
  8824. void removeAllChildren();
  8825. void deleteAllChildren();
  8826. Component* getParentComponent() const throw() { return parentComponent_; }
  8827. template <class TargetClass>
  8828. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8829. {
  8830. (void) dummyParameter;
  8831. Component* p = parentComponent_;
  8832. while (p != 0)
  8833. {
  8834. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8835. if (target != 0)
  8836. return target;
  8837. p = p->parentComponent_;
  8838. }
  8839. return 0;
  8840. }
  8841. Component* getTopLevelComponent() const throw();
  8842. bool isParentOf (const Component* possibleChild) const throw();
  8843. virtual void parentHierarchyChanged();
  8844. virtual void childrenChanged();
  8845. virtual bool hitTest (int x, int y);
  8846. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8847. const bool allowClicksOnChildComponents) throw();
  8848. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8849. bool& allowsClicksOnChildComponents) const throw();
  8850. virtual bool contains (int x, int y);
  8851. bool reallyContains (int x, int y,
  8852. const bool returnTrueIfWithinAChild);
  8853. Component* getComponentAt (const int x, const int y);
  8854. void repaint() throw();
  8855. void repaint (const int x, const int y,
  8856. const int width, const int height) throw();
  8857. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8858. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8859. const bool clipImageToComponentBounds = true);
  8860. void paintEntireComponent (Graphics& context);
  8861. void setComponentEffect (ImageEffectFilter* const newEffect);
  8862. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8863. LookAndFeel& getLookAndFeel() const throw();
  8864. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8865. virtual void lookAndFeelChanged();
  8866. void sendLookAndFeelChange();
  8867. void setOpaque (const bool shouldBeOpaque) throw();
  8868. bool isOpaque() const throw();
  8869. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8870. bool isBroughtToFrontOnMouseClick() const throw();
  8871. // Keyboard focus methods
  8872. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8873. bool getWantsKeyboardFocus() const throw();
  8874. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8875. bool getMouseClickGrabsKeyboardFocus() const throw();
  8876. void grabKeyboardFocus();
  8877. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8878. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8879. void moveKeyboardFocusToSibling (const bool moveToNext);
  8880. virtual KeyboardFocusTraverser* createFocusTraverser();
  8881. int getExplicitFocusOrder() const throw();
  8882. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8883. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8884. bool isFocusContainer() const throw();
  8885. bool isEnabled() const throw();
  8886. void setEnabled (const bool shouldBeEnabled);
  8887. virtual void enablementChanged();
  8888. void setMouseCursor (const MouseCursor& cursorType) throw();
  8889. virtual const MouseCursor getMouseCursor();
  8890. void updateMouseCursor() const throw();
  8891. virtual void paint (Graphics& g);
  8892. virtual void paintOverChildren (Graphics& g);
  8893. virtual void mouseMove (const MouseEvent& e);
  8894. virtual void mouseEnter (const MouseEvent& e);
  8895. virtual void mouseExit (const MouseEvent& e);
  8896. virtual void mouseDown (const MouseEvent& e);
  8897. virtual void mouseDrag (const MouseEvent& e);
  8898. virtual void mouseUp (const MouseEvent& e);
  8899. virtual void mouseDoubleClick (const MouseEvent& e);
  8900. virtual void mouseWheelMove (const MouseEvent& e,
  8901. float wheelIncrementX,
  8902. float wheelIncrementY);
  8903. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8904. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8905. void addMouseListener (MouseListener* const newListener,
  8906. const bool wantsEventsForAllNestedChildComponents) throw();
  8907. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8908. void addKeyListener (KeyListener* const newListener) throw();
  8909. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8910. virtual bool keyPressed (const KeyPress& key);
  8911. virtual bool keyStateChanged (const bool isKeyDown);
  8912. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8913. enum FocusChangeType
  8914. {
  8915. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8916. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8917. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8918. };
  8919. virtual void focusGained (FocusChangeType cause);
  8920. virtual void focusLost (FocusChangeType cause);
  8921. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8922. bool isMouseOver() const throw();
  8923. bool isMouseButtonDown() const throw();
  8924. bool isMouseOverOrDragging() const throw();
  8925. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8926. const Point<int> getMouseXYRelative() const;
  8927. static Component* JUCE_CALLTYPE getComponentUnderMouse() throw();
  8928. void enableUnboundedMouseMovement (bool shouldUnboundedMovementBeEnabled,
  8929. bool keepCursorVisibleUntilOffscreen = false) throw();
  8930. virtual void resized();
  8931. virtual void moved();
  8932. virtual void childBoundsChanged (Component* child);
  8933. virtual void parentSizeChanged();
  8934. virtual void broughtToFront();
  8935. void addComponentListener (ComponentListener* const newListener) throw();
  8936. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8937. void postCommandMessage (const int commandId) throw();
  8938. virtual void handleCommandMessage (int commandId);
  8939. int runModalLoop();
  8940. void enterModalState (const bool takeKeyboardFocus = true);
  8941. void exitModalState (const int returnValue);
  8942. bool isCurrentlyModal() const throw();
  8943. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8944. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8945. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8946. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8947. virtual void inputAttemptWhenModal();
  8948. NamedValueSet& getProperties() throw() { return properties; }
  8949. const NamedValueSet& getProperties() const throw() { return properties; }
  8950. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8951. void setColour (const int colourId, const Colour& colour);
  8952. void removeColour (const int colourId);
  8953. bool isColourSpecified (const int colourId) const throw();
  8954. void copyAllExplicitColoursTo (Component& target) const throw();
  8955. virtual void colourChanged();
  8956. void* getWindowHandle() const throw();
  8957. uint32 getComponentUID() const throw() { return componentUID; }
  8958. juce_UseDebuggingNewOperator
  8959. private:
  8960. friend class ComponentPeer;
  8961. friend class InternalDragRepeater;
  8962. static Component* currentlyFocusedComponent;
  8963. static Component* componentUnderMouse;
  8964. String componentName_;
  8965. Component* parentComponent_;
  8966. uint32 componentUID;
  8967. Rectangle<int> bounds_;
  8968. int numDeepMouseListeners;
  8969. Array <Component*> childComponentList_;
  8970. LookAndFeel* lookAndFeel_;
  8971. MouseCursor cursor_;
  8972. ImageEffectFilter* effect_;
  8973. Image* bufferedImage_;
  8974. VoidArray* mouseListeners_;
  8975. VoidArray* keyListeners_;
  8976. VoidArray* componentListeners_;
  8977. NamedValueSet properties;
  8978. struct ComponentFlags
  8979. {
  8980. bool hasHeavyweightPeerFlag : 1;
  8981. bool visibleFlag : 1;
  8982. bool opaqueFlag : 1;
  8983. bool ignoresMouseClicksFlag : 1;
  8984. bool allowChildMouseClicksFlag : 1;
  8985. bool wantsFocusFlag : 1;
  8986. bool isFocusContainerFlag : 1;
  8987. bool dontFocusOnMouseClickFlag : 1;
  8988. bool alwaysOnTopFlag : 1;
  8989. bool bufferToImageFlag : 1;
  8990. bool bringToFrontOnClickFlag : 1;
  8991. bool repaintOnMouseActivityFlag : 1;
  8992. bool draggingFlag : 1;
  8993. bool mouseOverFlag : 1;
  8994. bool mouseInsideFlag : 1;
  8995. bool currentlyModalFlag : 1;
  8996. bool isDisabledFlag : 1;
  8997. bool childCompFocusedFlag : 1;
  8998. #ifdef JUCE_DEBUG
  8999. bool isInsidePaintCall : 1;
  9000. #endif
  9001. };
  9002. union
  9003. {
  9004. uint32 componentFlags_;
  9005. ComponentFlags flags;
  9006. };
  9007. void internalMouseEnter (int x, int y, const int64 time);
  9008. void internalMouseExit (int x, int y, const int64 time);
  9009. void internalMouseDown (int x, int y, const int64 time);
  9010. void internalMouseUp (const int oldModifiers, int x, int y, const int64 time);
  9011. void internalMouseDrag (int x, int y, const int64 time);
  9012. void internalMouseMove (int x, int y, const int64 time);
  9013. void internalMouseWheel (const int intAmountX, const int intAmountY, const int64 time);
  9014. void internalBroughtToFront();
  9015. void internalFocusGain (const FocusChangeType cause);
  9016. void internalFocusLoss (const FocusChangeType cause);
  9017. void internalChildFocusChange (FocusChangeType cause);
  9018. void internalModalInputAttempt();
  9019. void internalModifierKeysChanged();
  9020. void internalChildrenChanged();
  9021. void internalHierarchyChanged();
  9022. void internalUpdateMouseCursor (const bool forcedUpdate) throw();
  9023. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  9024. void repaintParent() throw();
  9025. void sendFakeMouseMove() const;
  9026. void takeKeyboardFocus (const FocusChangeType cause);
  9027. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  9028. static void giveAwayFocus();
  9029. void sendEnablementChangeMessage();
  9030. static void* runModalLoopCallback (void*);
  9031. static void bringModalComponentToFront();
  9032. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  9033. const Rectangle<int>& clipRect,
  9034. const Component* const compToAvoid) const throw();
  9035. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  9036. const int deltaX, const int deltaY) const throw();
  9037. // how much of the component is not off the edges of its parents
  9038. const Rectangle<int> getUnclippedArea() const;
  9039. void sendVisibilityChangeMessage();
  9040. // This is included here just to cause a compile error if your code is still handling
  9041. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  9042. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  9043. // implement its methods instead of this Component method).
  9044. virtual void filesDropped (const StringArray&, int, int) {}
  9045. // components aren't allowed to have copy constructors, as this would mess up parent
  9046. // hierarchies. You might need to give your subclasses a private dummy constructor like
  9047. // this one to avoid compiler warnings.
  9048. Component (const Component&);
  9049. const Component& operator= (const Component&);
  9050. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  9051. // subclass to use the new parameters to keyStateChanged)
  9052. virtual void keyStateChanged() {};
  9053. protected:
  9054. virtual void internalRepaint (int x, int y, int w, int h);
  9055. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  9056. void handleMessage (const Message&);
  9057. };
  9058. #endif // __JUCE_COMPONENT_JUCEHEADER__
  9059. /*** End of inlined file: juce_Component.h ***/
  9060. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  9061. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9062. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9063. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9064. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9065. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9066. typedef int CommandID;
  9067. namespace StandardApplicationCommandIDs
  9068. {
  9069. static const CommandID quit = 0x1001;
  9070. static const CommandID del = 0x1002;
  9071. static const CommandID cut = 0x1003;
  9072. static const CommandID copy = 0x1004;
  9073. static const CommandID paste = 0x1005;
  9074. static const CommandID selectAll = 0x1006;
  9075. static const CommandID deselectAll = 0x1007;
  9076. }
  9077. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9078. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9079. struct JUCE_API ApplicationCommandInfo
  9080. {
  9081. ApplicationCommandInfo (const CommandID commandID) throw();
  9082. void setInfo (const String& shortName,
  9083. const String& description,
  9084. const String& categoryName,
  9085. const int flags) throw();
  9086. void setActive (const bool isActive) throw();
  9087. void setTicked (const bool isTicked) throw();
  9088. void addDefaultKeypress (const int keyCode,
  9089. const ModifierKeys& modifiers) throw();
  9090. CommandID commandID;
  9091. String shortName;
  9092. String description;
  9093. String categoryName;
  9094. Array <KeyPress> defaultKeypresses;
  9095. enum CommandFlags
  9096. {
  9097. isDisabled = 1 << 0,
  9098. isTicked = 1 << 1,
  9099. wantsKeyUpDownCallbacks = 1 << 2,
  9100. hiddenFromKeyEditor = 1 << 3,
  9101. readOnlyInKeyEditor = 1 << 4,
  9102. dontTriggerVisualFeedback = 1 << 5
  9103. };
  9104. int flags;
  9105. };
  9106. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9107. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9108. class JUCE_API ApplicationCommandTarget
  9109. {
  9110. public:
  9111. ApplicationCommandTarget();
  9112. virtual ~ApplicationCommandTarget();
  9113. struct JUCE_API InvocationInfo
  9114. {
  9115. InvocationInfo (const CommandID commandID) throw();
  9116. CommandID commandID;
  9117. int commandFlags;
  9118. enum InvocationMethod
  9119. {
  9120. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9121. fromKeyPress, /**< The command is being invoked by a key-press. */
  9122. fromMenu, /**< The command is being invoked by a menu selection. */
  9123. fromButton /**< The command is being invoked by a button click. */
  9124. };
  9125. InvocationMethod invocationMethod;
  9126. Component* originatingComponent;
  9127. KeyPress keyPress;
  9128. bool isKeyDown;
  9129. int millisecsSinceKeyPressed;
  9130. };
  9131. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9132. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9133. virtual void getCommandInfo (const CommandID commandID,
  9134. ApplicationCommandInfo& result) = 0;
  9135. virtual bool perform (const InvocationInfo& info) = 0;
  9136. bool invoke (const InvocationInfo& invocationInfo,
  9137. const bool asynchronously);
  9138. bool invokeDirectly (const CommandID commandID,
  9139. const bool asynchronously);
  9140. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9141. bool isCommandActive (const CommandID commandID);
  9142. ApplicationCommandTarget* findFirstTargetParentComponent();
  9143. juce_UseDebuggingNewOperator
  9144. private:
  9145. // (for async invocation of commands)
  9146. class CommandTargetMessageInvoker : public MessageListener
  9147. {
  9148. public:
  9149. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9150. ~CommandTargetMessageInvoker();
  9151. void handleMessage (const Message& message);
  9152. private:
  9153. ApplicationCommandTarget* const owner;
  9154. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9155. const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9156. };
  9157. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9158. friend class CommandTargetMessageInvoker;
  9159. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9160. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9161. const ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9162. };
  9163. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9164. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9165. /*** Start of inlined file: juce_ActionListener.h ***/
  9166. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9167. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9168. class JUCE_API ActionListener
  9169. {
  9170. public:
  9171. virtual ~ActionListener() {}
  9172. virtual void actionListenerCallback (const String& message) = 0;
  9173. };
  9174. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9175. /*** End of inlined file: juce_ActionListener.h ***/
  9176. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9177. private ActionListener
  9178. {
  9179. protected:
  9180. JUCEApplication();
  9181. public:
  9182. virtual ~JUCEApplication();
  9183. static JUCEApplication* getInstance() throw();
  9184. virtual void initialise (const String& commandLineParameters) = 0;
  9185. bool isInitialising() const throw();
  9186. virtual void shutdown() = 0;
  9187. virtual const String getApplicationName() = 0;
  9188. virtual const String getApplicationVersion();
  9189. virtual bool moreThanOneInstanceAllowed();
  9190. virtual void anotherInstanceStarted (const String& commandLine);
  9191. virtual void systemRequestedQuit();
  9192. virtual void unhandledException (const std::exception* e,
  9193. const String& sourceFilename,
  9194. const int lineNumber);
  9195. static void quit();
  9196. void setApplicationReturnValue (const int newReturnValue) throw();
  9197. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9198. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9199. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9200. static int main (String& commandLine, JUCEApplication* const newApp);
  9201. static int main (int argc, char* argv[], JUCEApplication* const newApp);
  9202. static void sendUnhandledException (const std::exception* const e,
  9203. const char* const sourceFile,
  9204. const int lineNumber);
  9205. ApplicationCommandTarget* getNextCommandTarget();
  9206. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  9207. void getAllCommands (Array <CommandID>& commands);
  9208. bool perform (const InvocationInfo& info);
  9209. void actionListenerCallback (const String& message);
  9210. private:
  9211. String commandLineParameters;
  9212. int appReturnValue;
  9213. bool stillInitialising;
  9214. InterProcessLock* appLock;
  9215. JUCEApplication (const JUCEApplication&);
  9216. const JUCEApplication& operator= (const JUCEApplication&);
  9217. public:
  9218. bool initialiseApp (String& commandLine);
  9219. static int shutdownAppAndClearUp();
  9220. };
  9221. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9222. /*** End of inlined file: juce_Application.h ***/
  9223. #endif
  9224. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9225. #endif
  9226. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9227. #endif
  9228. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9229. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9230. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9231. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9232. /*** Start of inlined file: juce_Desktop.h ***/
  9233. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9234. #define __JUCE_DESKTOP_JUCEHEADER__
  9235. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9236. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9237. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9238. class JUCE_API DeletedAtShutdown
  9239. {
  9240. protected:
  9241. DeletedAtShutdown();
  9242. virtual ~DeletedAtShutdown();
  9243. public:
  9244. static void deleteAll();
  9245. private:
  9246. DeletedAtShutdown (const DeletedAtShutdown&);
  9247. const DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9248. };
  9249. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9250. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9251. /*** Start of inlined file: juce_Timer.h ***/
  9252. #ifndef __JUCE_TIMER_JUCEHEADER__
  9253. #define __JUCE_TIMER_JUCEHEADER__
  9254. class InternalTimerThread;
  9255. class JUCE_API Timer
  9256. {
  9257. protected:
  9258. Timer() throw();
  9259. Timer (const Timer& other) throw();
  9260. public:
  9261. virtual ~Timer();
  9262. virtual void timerCallback() = 0;
  9263. void startTimer (const int intervalInMilliseconds) throw();
  9264. void stopTimer() throw();
  9265. bool isTimerRunning() const throw() { return periodMs > 0; }
  9266. int getTimerInterval() const throw() { return periodMs; }
  9267. private:
  9268. friend class InternalTimerThread;
  9269. int countdownMs, periodMs;
  9270. Timer* previous;
  9271. Timer* next;
  9272. const Timer& operator= (const Timer&);
  9273. };
  9274. #endif // __JUCE_TIMER_JUCEHEADER__
  9275. /*** End of inlined file: juce_Timer.h ***/
  9276. class JUCE_API FocusChangeListener
  9277. {
  9278. public:
  9279. virtual ~FocusChangeListener() {}
  9280. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9281. };
  9282. class JUCE_API Desktop : private DeletedAtShutdown,
  9283. private Timer,
  9284. private AsyncUpdater
  9285. {
  9286. public:
  9287. static Desktop& JUCE_CALLTYPE getInstance() throw();
  9288. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9289. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9290. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, const bool clippedToWorkArea = true) const throw();
  9291. static const Point<int> getMousePosition();
  9292. static void setMousePosition (const Point<int>& newPosition);
  9293. static const Point<int> getLastMouseDownPosition() throw();
  9294. static int getMouseButtonClickCounter() throw();
  9295. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9296. static bool isScreenSaverEnabled() throw();
  9297. void addGlobalMouseListener (MouseListener* const listener) throw();
  9298. void removeGlobalMouseListener (MouseListener* const listener) throw();
  9299. void addFocusChangeListener (FocusChangeListener* const listener) throw();
  9300. void removeFocusChangeListener (FocusChangeListener* const listener) throw();
  9301. void setKioskModeComponent (Component* componentToUse,
  9302. const bool allowMenusAndBars = true);
  9303. Component* getKioskModeComponent() const { return kioskModeComponent; }
  9304. int getNumComponents() const throw();
  9305. Component* getComponent (const int index) const throw();
  9306. Component* findComponentAt (const Point<int>& screenPosition) const;
  9307. juce_UseDebuggingNewOperator
  9308. void refreshMonitorSizes() throw();
  9309. static bool canUseSemiTransparentWindows() throw();
  9310. private:
  9311. static Desktop* instance;
  9312. friend class Component;
  9313. friend class ComponentPeer;
  9314. SortedSet <void*> mouseListeners, focusListeners;
  9315. Array <Component*> desktopComponents;
  9316. friend class DeletedAtShutdown;
  9317. friend class TopLevelWindowManager;
  9318. Desktop() throw();
  9319. ~Desktop() throw();
  9320. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9321. Point<int> lastFakeMouseMove;
  9322. int mouseClickCounter;
  9323. bool mouseMovedSignificantlySincePressed;
  9324. struct RecentMouseDown
  9325. {
  9326. Point<int> position;
  9327. int64 time;
  9328. Component* component;
  9329. };
  9330. RecentMouseDown mouseDowns[4];
  9331. void incrementMouseClickCounter() throw();
  9332. void registerMouseDown (const Point<int>& position, int64 time, Component* component) throw();
  9333. void registerMouseDrag (const Point<int>& position) throw();
  9334. const Time getLastMouseDownTime() const throw();
  9335. int getNumberOfMultipleClicks() const throw();
  9336. Component* kioskModeComponent;
  9337. Rectangle<int> kioskComponentOriginalBounds;
  9338. void timerCallback();
  9339. void sendMouseMove();
  9340. void resetTimer() throw();
  9341. int getNumDisplayMonitors() const throw();
  9342. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9343. void addDesktopComponent (Component* const c) throw();
  9344. void removeDesktopComponent (Component* const c) throw();
  9345. void componentBroughtToFront (Component* const c) throw();
  9346. void triggerFocusCallback() throw();
  9347. void handleAsyncUpdate();
  9348. Desktop (const Desktop&);
  9349. const Desktop& operator= (const Desktop&);
  9350. };
  9351. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9352. /*** End of inlined file: juce_Desktop.h ***/
  9353. class KeyPressMappingSet;
  9354. class ApplicationCommandManagerListener;
  9355. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9356. private FocusChangeListener
  9357. {
  9358. public:
  9359. ApplicationCommandManager();
  9360. virtual ~ApplicationCommandManager();
  9361. void clearCommands();
  9362. void registerCommand (const ApplicationCommandInfo& newCommand);
  9363. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9364. void removeCommand (const CommandID commandID);
  9365. void commandStatusChanged();
  9366. int getNumCommands() const throw() { return commands.size(); }
  9367. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9368. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9369. const String getNameOfCommand (const CommandID commandID) const throw();
  9370. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9371. const StringArray getCommandCategories() const throw();
  9372. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9373. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9374. bool invokeDirectly (const CommandID commandID,
  9375. const bool asynchronously);
  9376. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9377. const bool asynchronously);
  9378. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9379. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9380. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9381. ApplicationCommandInfo& upToDateInfo);
  9382. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9383. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9384. static ApplicationCommandTarget* findDefaultComponentTarget();
  9385. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9386. juce_UseDebuggingNewOperator
  9387. private:
  9388. OwnedArray <ApplicationCommandInfo> commands;
  9389. SortedSet <void*> listeners;
  9390. ScopedPointer <KeyPressMappingSet> keyMappings;
  9391. ApplicationCommandTarget* firstTarget;
  9392. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) const;
  9393. void handleAsyncUpdate();
  9394. void globalFocusChanged (Component*);
  9395. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9396. // version of this method.
  9397. virtual short getFirstCommandTarget() { return 0; }
  9398. };
  9399. class JUCE_API ApplicationCommandManagerListener
  9400. {
  9401. public:
  9402. virtual ~ApplicationCommandManagerListener() {}
  9403. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9404. virtual void applicationCommandListChanged() = 0;
  9405. };
  9406. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9407. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9408. #endif
  9409. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9410. #endif
  9411. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9412. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9413. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9414. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9415. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9416. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9417. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9418. class JUCE_API PropertiesFile : public PropertySet,
  9419. public ChangeBroadcaster,
  9420. private Timer
  9421. {
  9422. public:
  9423. enum FileFormatOptions
  9424. {
  9425. ignoreCaseOfKeyNames = 1,
  9426. storeAsBinary = 2,
  9427. storeAsCompressedBinary = 4,
  9428. storeAsXML = 8
  9429. };
  9430. PropertiesFile (const File& file,
  9431. const int millisecondsBeforeSaving,
  9432. const int options);
  9433. ~PropertiesFile();
  9434. bool saveIfNeeded();
  9435. bool save();
  9436. bool needsToBeSaved() const;
  9437. const File getFile() const { return file; }
  9438. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9439. const String& fileNameSuffix,
  9440. const String& folderName,
  9441. const bool commonToAllUsers,
  9442. const int millisecondsBeforeSaving,
  9443. const int propertiesFileOptions);
  9444. static const File getDefaultAppSettingsFile (const String& applicationName,
  9445. const String& fileNameSuffix,
  9446. const String& folderName,
  9447. const bool commonToAllUsers);
  9448. juce_UseDebuggingNewOperator
  9449. protected:
  9450. virtual void propertyChanged();
  9451. private:
  9452. File file;
  9453. int timerInterval;
  9454. const int options;
  9455. bool needsWriting;
  9456. void timerCallback();
  9457. PropertiesFile (const PropertiesFile&);
  9458. const PropertiesFile& operator= (const PropertiesFile&);
  9459. };
  9460. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9461. /*** End of inlined file: juce_PropertiesFile.h ***/
  9462. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9463. {
  9464. public:
  9465. ApplicationProperties() throw();
  9466. ~ApplicationProperties();
  9467. juce_DeclareSingleton (ApplicationProperties, false)
  9468. void setStorageParameters (const String& applicationName,
  9469. const String& fileNameSuffix,
  9470. const String& folderName,
  9471. const int millisecondsBeforeSaving,
  9472. const int propertiesFileOptions) throw();
  9473. bool testWriteAccess (const bool testUserSettings,
  9474. const bool testCommonSettings,
  9475. const bool showWarningDialogOnFailure);
  9476. PropertiesFile* getUserSettings() throw();
  9477. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9478. bool saveIfNeeded();
  9479. void closeFiles();
  9480. juce_UseDebuggingNewOperator
  9481. private:
  9482. ScopedPointer <PropertiesFile> userProps, commonProps;
  9483. String appName, fileSuffix, folderName;
  9484. int msBeforeSaving, options;
  9485. int commonSettingsAreReadOnly;
  9486. ApplicationProperties (const ApplicationProperties&);
  9487. const ApplicationProperties& operator= (const ApplicationProperties&);
  9488. void openFiles() throw();
  9489. };
  9490. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9491. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9492. #endif
  9493. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9494. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9495. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9496. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9497. /*** Start of inlined file: juce_AudioFormat.h ***/
  9498. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9499. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9500. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9501. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9502. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9503. class AudioFormat;
  9504. class JUCE_API AudioFormatReader
  9505. {
  9506. protected:
  9507. AudioFormatReader (InputStream* const sourceStream,
  9508. const String& formatName);
  9509. public:
  9510. virtual ~AudioFormatReader();
  9511. const String getFormatName() const throw() { return formatName; }
  9512. bool read (int** destSamples,
  9513. int numDestChannels,
  9514. int64 startSampleInSource,
  9515. int numSamplesToRead,
  9516. const bool fillLeftoverChannelsWithCopies);
  9517. virtual void readMaxLevels (int64 startSample,
  9518. int64 numSamples,
  9519. float& lowestLeft,
  9520. float& highestLeft,
  9521. float& lowestRight,
  9522. float& highestRight);
  9523. int64 searchForLevel (int64 startSample,
  9524. int64 numSamplesToSearch,
  9525. const double magnitudeRangeMinimum,
  9526. const double magnitudeRangeMaximum,
  9527. const int minimumConsecutiveSamples);
  9528. double sampleRate;
  9529. unsigned int bitsPerSample;
  9530. int64 lengthInSamples;
  9531. unsigned int numChannels;
  9532. bool usesFloatingPointData;
  9533. StringPairArray metadataValues;
  9534. InputStream* input;
  9535. virtual bool readSamples (int** destSamples,
  9536. int numDestChannels,
  9537. int startOffsetInDestBuffer,
  9538. int64 startSampleInFile,
  9539. int numSamples) = 0;
  9540. juce_UseDebuggingNewOperator
  9541. private:
  9542. String formatName;
  9543. AudioFormatReader (const AudioFormatReader&);
  9544. const AudioFormatReader& operator= (const AudioFormatReader&);
  9545. };
  9546. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9547. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9548. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9549. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9550. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9551. /*** Start of inlined file: juce_AudioSource.h ***/
  9552. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9553. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9554. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9555. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9556. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9557. class AudioFormatReader;
  9558. class AudioFormatWriter;
  9559. class JUCE_API AudioSampleBuffer
  9560. {
  9561. public:
  9562. AudioSampleBuffer (const int numChannels,
  9563. const int numSamples) throw();
  9564. AudioSampleBuffer (float** dataToReferTo,
  9565. const int numChannels,
  9566. const int numSamples) throw();
  9567. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9568. const AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9569. virtual ~AudioSampleBuffer() throw();
  9570. int getNumChannels() const throw() { return numChannels; }
  9571. int getNumSamples() const throw() { return size; }
  9572. float* getSampleData (const int channelNumber) const throw()
  9573. {
  9574. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9575. return channels [channelNumber];
  9576. }
  9577. float* getSampleData (const int channelNumber,
  9578. const int sampleOffset) const throw()
  9579. {
  9580. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9581. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9582. return channels [channelNumber] + sampleOffset;
  9583. }
  9584. float** getArrayOfChannels() const throw() { return channels; }
  9585. void setSize (const int newNumChannels,
  9586. const int newNumSamples,
  9587. const bool keepExistingContent = false,
  9588. const bool clearExtraSpace = false,
  9589. const bool avoidReallocating = false) throw();
  9590. void setDataToReferTo (float** dataToReferTo,
  9591. const int numChannels,
  9592. const int numSamples) throw();
  9593. void clear() throw();
  9594. void clear (const int startSample,
  9595. const int numSamples) throw();
  9596. void clear (const int channel,
  9597. const int startSample,
  9598. const int numSamples) throw();
  9599. void applyGain (const int channel,
  9600. const int startSample,
  9601. int numSamples,
  9602. const float gain) throw();
  9603. void applyGain (const int startSample,
  9604. const int numSamples,
  9605. const float gain) throw();
  9606. void applyGainRamp (const int channel,
  9607. const int startSample,
  9608. int numSamples,
  9609. float startGain,
  9610. float endGain) throw();
  9611. void addFrom (const int destChannel,
  9612. const int destStartSample,
  9613. const AudioSampleBuffer& source,
  9614. const int sourceChannel,
  9615. const int sourceStartSample,
  9616. int numSamples,
  9617. const float gainToApplyToSource = 1.0f) throw();
  9618. void addFrom (const int destChannel,
  9619. const int destStartSample,
  9620. const float* source,
  9621. int numSamples,
  9622. const float gainToApplyToSource = 1.0f) throw();
  9623. void addFromWithRamp (const int destChannel,
  9624. const int destStartSample,
  9625. const float* source,
  9626. int numSamples,
  9627. float startGain,
  9628. float endGain) throw();
  9629. void copyFrom (const int destChannel,
  9630. const int destStartSample,
  9631. const AudioSampleBuffer& source,
  9632. const int sourceChannel,
  9633. const int sourceStartSample,
  9634. int numSamples) throw();
  9635. void copyFrom (const int destChannel,
  9636. const int destStartSample,
  9637. const float* source,
  9638. int numSamples) throw();
  9639. void copyFrom (const int destChannel,
  9640. const int destStartSample,
  9641. const float* source,
  9642. int numSamples,
  9643. const float gain) throw();
  9644. void copyFromWithRamp (const int destChannel,
  9645. const int destStartSample,
  9646. const float* source,
  9647. int numSamples,
  9648. float startGain,
  9649. float endGain) throw();
  9650. void findMinMax (const int channel,
  9651. const int startSample,
  9652. int numSamples,
  9653. float& minVal,
  9654. float& maxVal) const throw();
  9655. float getMagnitude (const int channel,
  9656. const int startSample,
  9657. const int numSamples) const throw();
  9658. float getMagnitude (const int startSample,
  9659. const int numSamples) const throw();
  9660. float getRMSLevel (const int channel,
  9661. const int startSample,
  9662. const int numSamples) const throw();
  9663. void readFromAudioReader (AudioFormatReader* reader,
  9664. const int startSample,
  9665. const int numSamples,
  9666. const int readerStartSample,
  9667. const bool useReaderLeftChan,
  9668. const bool useReaderRightChan) throw();
  9669. void writeToAudioWriter (AudioFormatWriter* writer,
  9670. const int startSample,
  9671. const int numSamples) const throw();
  9672. juce_UseDebuggingNewOperator
  9673. private:
  9674. int numChannels, size;
  9675. size_t allocatedBytes;
  9676. float** channels;
  9677. HeapBlock <char> allocatedData;
  9678. float* preallocatedChannelSpace [32];
  9679. void allocateData();
  9680. void allocateChannels (float** const dataToReferTo);
  9681. };
  9682. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9683. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9684. struct JUCE_API AudioSourceChannelInfo
  9685. {
  9686. AudioSampleBuffer* buffer;
  9687. int startSample;
  9688. int numSamples;
  9689. void clearActiveBufferRegion() const
  9690. {
  9691. if (buffer != 0)
  9692. buffer->clear (startSample, numSamples);
  9693. }
  9694. };
  9695. class JUCE_API AudioSource
  9696. {
  9697. protected:
  9698. AudioSource() throw() {}
  9699. public:
  9700. virtual ~AudioSource() {}
  9701. virtual void prepareToPlay (int samplesPerBlockExpected,
  9702. double sampleRate) = 0;
  9703. virtual void releaseResources() = 0;
  9704. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9705. };
  9706. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9707. /*** End of inlined file: juce_AudioSource.h ***/
  9708. class JUCE_API AudioFormatWriter
  9709. {
  9710. protected:
  9711. AudioFormatWriter (OutputStream* const destStream,
  9712. const String& formatName,
  9713. const double sampleRate,
  9714. const unsigned int numberOfChannels,
  9715. const unsigned int bitsPerSample);
  9716. public:
  9717. virtual ~AudioFormatWriter();
  9718. const String getFormatName() const throw() { return formatName; }
  9719. virtual bool write (const int** samplesToWrite,
  9720. int numSamples) = 0;
  9721. bool writeFromAudioReader (AudioFormatReader& reader,
  9722. int64 startSample,
  9723. int64 numSamplesToRead);
  9724. bool writeFromAudioSource (AudioSource& source,
  9725. int numSamplesToRead,
  9726. const int samplesPerBlock = 2048);
  9727. double getSampleRate() const throw() { return sampleRate; }
  9728. int getNumChannels() const throw() { return numChannels; }
  9729. int getBitsPerSample() const throw() { return bitsPerSample; }
  9730. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9731. juce_UseDebuggingNewOperator
  9732. protected:
  9733. double sampleRate;
  9734. unsigned int numChannels;
  9735. unsigned int bitsPerSample;
  9736. bool usesFloatingPointData;
  9737. OutputStream* output;
  9738. private:
  9739. String formatName;
  9740. };
  9741. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9742. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9743. class JUCE_API AudioFormat
  9744. {
  9745. public:
  9746. virtual ~AudioFormat();
  9747. const String& getFormatName() const;
  9748. const StringArray& getFileExtensions() const;
  9749. virtual bool canHandleFile (const File& fileToTest);
  9750. virtual const Array <int> getPossibleSampleRates() = 0;
  9751. virtual const Array <int> getPossibleBitDepths() = 0;
  9752. virtual bool canDoStereo() = 0;
  9753. virtual bool canDoMono() = 0;
  9754. virtual bool isCompressed();
  9755. virtual const StringArray getQualityOptions();
  9756. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9757. const bool deleteStreamIfOpeningFails) = 0;
  9758. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9759. double sampleRateToUse,
  9760. unsigned int numberOfChannels,
  9761. int bitsPerSample,
  9762. const StringPairArray& metadataValues,
  9763. int qualityOptionIndex) = 0;
  9764. protected:
  9765. AudioFormat (const String& formatName,
  9766. const tchar** const fileExtensions);
  9767. private:
  9768. String formatName;
  9769. StringArray fileExtensions;
  9770. };
  9771. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9772. /*** End of inlined file: juce_AudioFormat.h ***/
  9773. class JUCE_API AiffAudioFormat : public AudioFormat
  9774. {
  9775. public:
  9776. AiffAudioFormat();
  9777. ~AiffAudioFormat();
  9778. const Array <int> getPossibleSampleRates();
  9779. const Array <int> getPossibleBitDepths();
  9780. bool canDoStereo();
  9781. bool canDoMono();
  9782. #if JUCE_MAC
  9783. bool canHandleFile (const File& fileToTest);
  9784. #endif
  9785. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9786. const bool deleteStreamIfOpeningFails);
  9787. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9788. double sampleRateToUse,
  9789. unsigned int numberOfChannels,
  9790. int bitsPerSample,
  9791. const StringPairArray& metadataValues,
  9792. int qualityOptionIndex);
  9793. juce_UseDebuggingNewOperator
  9794. };
  9795. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9796. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9797. #endif
  9798. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9799. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9800. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9801. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9802. #if JUCE_USE_CDBURNER
  9803. class AudioCDBurner
  9804. {
  9805. public:
  9806. static const StringArray findAvailableDevices();
  9807. static AudioCDBurner* openDevice (const int deviceIndex);
  9808. ~AudioCDBurner();
  9809. bool isDiskPresent() const;
  9810. int getNumAvailableAudioBlocks() const;
  9811. bool addAudioTrack (AudioSource* source, int numSamples);
  9812. class BurnProgressListener
  9813. {
  9814. public:
  9815. BurnProgressListener() throw() {}
  9816. virtual ~BurnProgressListener() {}
  9817. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9818. };
  9819. const String burn (BurnProgressListener* listener,
  9820. const bool ejectDiscAfterwards,
  9821. const bool peformFakeBurnForTesting);
  9822. juce_UseDebuggingNewOperator
  9823. private:
  9824. AudioCDBurner (const int deviceIndex);
  9825. void* internal;
  9826. };
  9827. #endif
  9828. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9829. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9830. #endif
  9831. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9832. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9833. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9834. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9835. #if JUCE_USE_CDREADER
  9836. #if JUCE_MAC
  9837. #endif
  9838. class JUCE_API AudioCDReader : public AudioFormatReader
  9839. {
  9840. public:
  9841. static const StringArray getAvailableCDNames();
  9842. static AudioCDReader* createReaderForCD (const int index);
  9843. ~AudioCDReader();
  9844. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9845. int64 startSampleInFile, int numSamples);
  9846. bool isCDStillPresent() const;
  9847. int getNumTracks() const;
  9848. int getPositionOfTrackStart (int trackNum) const;
  9849. bool isTrackAudio (int trackNum) const;
  9850. void refreshTrackLengths();
  9851. void enableIndexScanning (bool enabled);
  9852. int getLastIndex() const;
  9853. const Array <int> findIndexesInTrack (const int trackNumber);
  9854. int getCDDBId();
  9855. void ejectDisk();
  9856. juce_UseDebuggingNewOperator
  9857. private:
  9858. #if JUCE_MAC
  9859. File volumeDir;
  9860. Array<File> tracks;
  9861. Array<int> trackStartSamples;
  9862. int currentReaderTrack;
  9863. ScopedPointer <AudioFormatReader> reader;
  9864. AudioCDReader (const File& volume);
  9865. public:
  9866. static int compareElements (const File&, const File&);
  9867. private:
  9868. #elif JUCE_WINDOWS
  9869. int numTracks;
  9870. int trackStarts[100];
  9871. bool audioTracks [100];
  9872. void* handle;
  9873. bool indexingEnabled;
  9874. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9875. MemoryBlock buffer;
  9876. AudioCDReader (void* handle);
  9877. int getIndexAt (int samplePos);
  9878. #elif JUCE_LINUX
  9879. AudioCDReader();
  9880. #endif
  9881. AudioCDReader (const AudioCDReader&);
  9882. const AudioCDReader& operator= (const AudioCDReader&);
  9883. };
  9884. #endif
  9885. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9886. /*** End of inlined file: juce_AudioCDReader.h ***/
  9887. #endif
  9888. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9889. #endif
  9890. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9891. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9892. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9893. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9894. class JUCE_API AudioFormatManager
  9895. {
  9896. public:
  9897. AudioFormatManager();
  9898. ~AudioFormatManager();
  9899. juce_DeclareSingleton (AudioFormatManager, false);
  9900. void registerFormat (AudioFormat* newFormat,
  9901. const bool makeThisTheDefaultFormat);
  9902. void registerBasicFormats();
  9903. void clearFormats();
  9904. int getNumKnownFormats() const;
  9905. AudioFormat* getKnownFormat (const int index) const;
  9906. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9907. AudioFormat* getDefaultFormat() const;
  9908. const String getWildcardForAllFormats() const;
  9909. AudioFormatReader* createReaderFor (const File& audioFile);
  9910. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9911. juce_UseDebuggingNewOperator
  9912. private:
  9913. VoidArray knownFormats;
  9914. int defaultFormatIndex;
  9915. };
  9916. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9917. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9918. #endif
  9919. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9920. #endif
  9921. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9922. #endif
  9923. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9924. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9925. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9926. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9927. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9928. {
  9929. public:
  9930. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9931. const int64 subsectionStartSample,
  9932. const int64 subsectionLength,
  9933. const bool deleteSourceWhenDeleted);
  9934. ~AudioSubsectionReader();
  9935. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9936. int64 startSampleInFile, int numSamples);
  9937. void readMaxLevels (int64 startSample,
  9938. int64 numSamples,
  9939. float& lowestLeft,
  9940. float& highestLeft,
  9941. float& lowestRight,
  9942. float& highestRight);
  9943. juce_UseDebuggingNewOperator
  9944. private:
  9945. AudioFormatReader* const source;
  9946. int64 startSample, length;
  9947. const bool deleteSourceWhenDeleted;
  9948. AudioSubsectionReader (const AudioSubsectionReader&);
  9949. const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9950. };
  9951. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9952. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9953. #endif
  9954. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9955. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9956. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9957. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9958. class AudioThumbnailCache;
  9959. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9960. public TimeSliceClient,
  9961. private Timer
  9962. {
  9963. public:
  9964. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9965. AudioFormatManager& formatManagerToUse,
  9966. AudioThumbnailCache& cacheToUse);
  9967. ~AudioThumbnail();
  9968. void setSource (InputSource* const newSource);
  9969. void loadFrom (InputStream& input);
  9970. void saveTo (OutputStream& output) const;
  9971. int getNumChannels() const throw();
  9972. double getTotalLength() const throw();
  9973. void drawChannel (Graphics& g,
  9974. int x, int y, int w, int h,
  9975. double startTimeSeconds,
  9976. double endTimeSeconds,
  9977. int channelNum,
  9978. const float verticalZoomFactor);
  9979. bool isFullyLoaded() const throw();
  9980. bool useTimeSlice();
  9981. void timerCallback();
  9982. juce_UseDebuggingNewOperator
  9983. private:
  9984. AudioFormatManager& formatManagerToUse;
  9985. AudioThumbnailCache& cache;
  9986. ScopedPointer <InputSource> source;
  9987. CriticalSection readerLock;
  9988. ScopedPointer <AudioFormatReader> reader;
  9989. MemoryBlock data, cachedLevels;
  9990. int orginalSamplesPerThumbnailSample;
  9991. int numChannelsCached, numSamplesCached;
  9992. double cachedStart, cachedTimePerPixel;
  9993. bool cacheNeedsRefilling;
  9994. void clear();
  9995. AudioFormatReader* createReader() const;
  9996. void generateSection (AudioFormatReader& reader,
  9997. int64 startSample,
  9998. int numSamples);
  9999. char* getChannelData (int channel) const;
  10000. void refillCache (const int numSamples,
  10001. double startTime,
  10002. const double timePerPixel);
  10003. friend class AudioThumbnailCache;
  10004. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  10005. bool initialiseFromAudioFile (AudioFormatReader& reader);
  10006. // returns true if more needs to be read
  10007. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  10008. };
  10009. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10010. /*** End of inlined file: juce_AudioThumbnail.h ***/
  10011. #endif
  10012. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10013. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  10014. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10015. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10016. struct ThumbnailCacheEntry;
  10017. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  10018. {
  10019. public:
  10020. AudioThumbnailCache (const int maxNumThumbsToStore);
  10021. ~AudioThumbnailCache();
  10022. void clear();
  10023. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  10024. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  10025. juce_UseDebuggingNewOperator
  10026. private:
  10027. OwnedArray <ThumbnailCacheEntry> thumbs;
  10028. int maxNumThumbsToStore;
  10029. friend class AudioThumbnail;
  10030. void addThumbnail (AudioThumbnail* const thumb);
  10031. void removeThumbnail (AudioThumbnail* const thumb);
  10032. };
  10033. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10034. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  10035. #endif
  10036. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10037. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10038. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10039. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10040. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10041. class JUCE_API FlacAudioFormat : public AudioFormat
  10042. {
  10043. public:
  10044. FlacAudioFormat();
  10045. ~FlacAudioFormat();
  10046. const Array <int> getPossibleSampleRates();
  10047. const Array <int> getPossibleBitDepths();
  10048. bool canDoStereo();
  10049. bool canDoMono();
  10050. bool isCompressed();
  10051. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10052. const bool deleteStreamIfOpeningFails);
  10053. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10054. double sampleRateToUse,
  10055. unsigned int numberOfChannels,
  10056. int bitsPerSample,
  10057. const StringPairArray& metadataValues,
  10058. int qualityOptionIndex);
  10059. juce_UseDebuggingNewOperator
  10060. };
  10061. #endif
  10062. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10063. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10064. #endif
  10065. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10066. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10067. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10068. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10069. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10070. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10071. {
  10072. public:
  10073. OggVorbisAudioFormat();
  10074. ~OggVorbisAudioFormat();
  10075. const Array <int> getPossibleSampleRates();
  10076. const Array <int> getPossibleBitDepths();
  10077. bool canDoStereo();
  10078. bool canDoMono();
  10079. bool isCompressed();
  10080. const StringArray getQualityOptions();
  10081. int estimateOggFileQuality (const File& source);
  10082. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10083. const bool deleteStreamIfOpeningFails);
  10084. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10085. double sampleRateToUse,
  10086. unsigned int numberOfChannels,
  10087. int bitsPerSample,
  10088. const StringPairArray& metadataValues,
  10089. int qualityOptionIndex);
  10090. juce_UseDebuggingNewOperator
  10091. };
  10092. #endif
  10093. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10094. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10095. #endif
  10096. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10097. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10098. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10099. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10100. #if JUCE_QUICKTIME
  10101. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10102. {
  10103. public:
  10104. QuickTimeAudioFormat();
  10105. ~QuickTimeAudioFormat();
  10106. const Array <int> getPossibleSampleRates();
  10107. const Array <int> getPossibleBitDepths();
  10108. bool canDoStereo();
  10109. bool canDoMono();
  10110. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10111. const bool deleteStreamIfOpeningFails);
  10112. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10113. double sampleRateToUse,
  10114. unsigned int numberOfChannels,
  10115. int bitsPerSample,
  10116. const StringPairArray& metadataValues,
  10117. int qualityOptionIndex);
  10118. juce_UseDebuggingNewOperator
  10119. };
  10120. #endif
  10121. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10122. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10123. #endif
  10124. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10125. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10126. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10127. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10128. class JUCE_API WavAudioFormat : public AudioFormat
  10129. {
  10130. public:
  10131. WavAudioFormat();
  10132. ~WavAudioFormat();
  10133. static const tchar* const bwavDescription;
  10134. static const tchar* const bwavOriginator;
  10135. static const tchar* const bwavOriginatorRef;
  10136. static const tchar* const bwavOriginationDate;
  10137. static const tchar* const bwavOriginationTime;
  10138. static const tchar* const bwavTimeReference;
  10139. static const tchar* const bwavCodingHistory;
  10140. static const StringPairArray createBWAVMetadata (const String& description,
  10141. const String& originator,
  10142. const String& originatorRef,
  10143. const Time& dateAndTime,
  10144. const int64 timeReferenceSamples,
  10145. const String& codingHistory);
  10146. const Array <int> getPossibleSampleRates();
  10147. const Array <int> getPossibleBitDepths();
  10148. bool canDoStereo();
  10149. bool canDoMono();
  10150. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10151. const bool deleteStreamIfOpeningFails);
  10152. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10153. double sampleRateToUse,
  10154. unsigned int numberOfChannels,
  10155. int bitsPerSample,
  10156. const StringPairArray& metadataValues,
  10157. int qualityOptionIndex);
  10158. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10159. juce_UseDebuggingNewOperator
  10160. };
  10161. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10162. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10163. #endif
  10164. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10165. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10166. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10167. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10168. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10169. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10170. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10171. class JUCE_API PositionableAudioSource : public AudioSource
  10172. {
  10173. protected:
  10174. PositionableAudioSource() throw() {}
  10175. public:
  10176. ~PositionableAudioSource() {}
  10177. virtual void setNextReadPosition (int newPosition) = 0;
  10178. virtual int getNextReadPosition() const = 0;
  10179. virtual int getTotalLength() const = 0;
  10180. virtual bool isLooping() const = 0;
  10181. };
  10182. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10183. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10184. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10185. {
  10186. public:
  10187. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10188. const bool deleteReaderWhenThisIsDeleted);
  10189. ~AudioFormatReaderSource();
  10190. void setLooping (const bool shouldLoop) throw();
  10191. bool isLooping() const { return looping; }
  10192. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10193. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10194. void releaseResources();
  10195. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10196. void setNextReadPosition (int newPosition);
  10197. int getNextReadPosition() const;
  10198. int getTotalLength() const;
  10199. juce_UseDebuggingNewOperator
  10200. private:
  10201. AudioFormatReader* reader;
  10202. bool deleteReader;
  10203. int volatile nextPlayPos;
  10204. bool volatile looping;
  10205. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10206. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10207. const AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10208. };
  10209. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10210. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10211. #endif
  10212. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10213. #endif
  10214. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10215. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10216. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10217. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10218. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10219. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10220. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10221. class AudioIODevice;
  10222. class JUCE_API AudioIODeviceCallback
  10223. {
  10224. public:
  10225. virtual ~AudioIODeviceCallback() {}
  10226. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10227. int numInputChannels,
  10228. float** outputChannelData,
  10229. int numOutputChannels,
  10230. int numSamples) = 0;
  10231. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10232. virtual void audioDeviceStopped() = 0;
  10233. };
  10234. class JUCE_API AudioIODevice
  10235. {
  10236. public:
  10237. virtual ~AudioIODevice();
  10238. const String& getName() const throw() { return name; }
  10239. const String& getTypeName() const throw() { return typeName; }
  10240. virtual const StringArray getOutputChannelNames() = 0;
  10241. virtual const StringArray getInputChannelNames() = 0;
  10242. virtual int getNumSampleRates() = 0;
  10243. virtual double getSampleRate (int index) = 0;
  10244. virtual int getNumBufferSizesAvailable() = 0;
  10245. virtual int getBufferSizeSamples (int index) = 0;
  10246. virtual int getDefaultBufferSize() = 0;
  10247. virtual const String open (const BitArray& inputChannels,
  10248. const BitArray& outputChannels,
  10249. double sampleRate,
  10250. int bufferSizeSamples) = 0;
  10251. virtual void close() = 0;
  10252. virtual bool isOpen() = 0;
  10253. virtual void start (AudioIODeviceCallback* callback) = 0;
  10254. virtual void stop() = 0;
  10255. virtual bool isPlaying() = 0;
  10256. virtual const String getLastError() = 0;
  10257. virtual int getCurrentBufferSizeSamples() = 0;
  10258. virtual double getCurrentSampleRate() = 0;
  10259. virtual int getCurrentBitDepth() = 0;
  10260. virtual const BitArray getActiveOutputChannels() const = 0;
  10261. virtual const BitArray getActiveInputChannels() const = 0;
  10262. virtual int getOutputLatencyInSamples() = 0;
  10263. virtual int getInputLatencyInSamples() = 0;
  10264. virtual bool hasControlPanel() const;
  10265. virtual bool showControlPanel();
  10266. protected:
  10267. AudioIODevice (const String& deviceName,
  10268. const String& typeName);
  10269. String name, typeName;
  10270. };
  10271. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10272. /*** End of inlined file: juce_AudioIODevice.h ***/
  10273. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10274. {
  10275. public:
  10276. AudioSourcePlayer();
  10277. virtual ~AudioSourcePlayer();
  10278. void setSource (AudioSource* newSource);
  10279. AudioSource* getCurrentSource() const throw() { return source; }
  10280. void setGain (const float newGain) throw();
  10281. void audioDeviceIOCallback (const float** inputChannelData,
  10282. int totalNumInputChannels,
  10283. float** outputChannelData,
  10284. int totalNumOutputChannels,
  10285. int numSamples);
  10286. void audioDeviceAboutToStart (AudioIODevice* device);
  10287. void audioDeviceStopped();
  10288. juce_UseDebuggingNewOperator
  10289. private:
  10290. CriticalSection readLock;
  10291. AudioSource* source;
  10292. double sampleRate;
  10293. int bufferSize;
  10294. float* channels [128];
  10295. float* outputChans [128];
  10296. const float* inputChans [128];
  10297. AudioSampleBuffer tempBuffer;
  10298. float lastGain, gain;
  10299. AudioSourcePlayer (const AudioSourcePlayer&);
  10300. const AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10301. };
  10302. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10303. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10304. #endif
  10305. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10306. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10307. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10308. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10309. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10310. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10311. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10312. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10313. {
  10314. public:
  10315. BufferingAudioSource (PositionableAudioSource* source,
  10316. const bool deleteSourceWhenDeleted,
  10317. int numberOfSamplesToBuffer);
  10318. ~BufferingAudioSource();
  10319. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10320. void releaseResources();
  10321. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10322. void setNextReadPosition (int newPosition);
  10323. int getNextReadPosition() const;
  10324. int getTotalLength() const { return source->getTotalLength(); }
  10325. bool isLooping() const { return source->isLooping(); }
  10326. juce_UseDebuggingNewOperator
  10327. private:
  10328. PositionableAudioSource* source;
  10329. bool deleteSourceWhenDeleted;
  10330. int numberOfSamplesToBuffer;
  10331. AudioSampleBuffer buffer;
  10332. CriticalSection bufferStartPosLock;
  10333. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10334. bool wasSourceLooping;
  10335. double volatile sampleRate;
  10336. friend class SharedBufferingAudioSourceThread;
  10337. bool readNextBufferChunk();
  10338. void readBufferSection (int start, int length, int bufferOffset);
  10339. BufferingAudioSource (const BufferingAudioSource&);
  10340. const BufferingAudioSource& operator= (const BufferingAudioSource&);
  10341. };
  10342. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10343. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10344. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10345. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10346. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10347. class JUCE_API ResamplingAudioSource : public AudioSource
  10348. {
  10349. public:
  10350. ResamplingAudioSource (AudioSource* const inputSource,
  10351. const bool deleteInputWhenDeleted);
  10352. ~ResamplingAudioSource();
  10353. void setResamplingRatio (const double samplesInPerOutputSample);
  10354. double getResamplingRatio() const throw() { return ratio; }
  10355. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10356. void releaseResources();
  10357. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10358. juce_UseDebuggingNewOperator
  10359. private:
  10360. AudioSource* const input;
  10361. const bool deleteInputWhenDeleted;
  10362. double ratio, lastRatio;
  10363. AudioSampleBuffer buffer;
  10364. int bufferPos, sampsInBuffer;
  10365. double subSampleOffset;
  10366. double coefficients[6];
  10367. CriticalSection ratioLock;
  10368. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10369. void createLowPass (const double proportionalRate);
  10370. struct FilterState
  10371. {
  10372. double x1, x2, y1, y2;
  10373. };
  10374. FilterState filterStates[2];
  10375. void resetFilters();
  10376. void applyFilter (float* samples, int num, FilterState& fs);
  10377. ResamplingAudioSource (const ResamplingAudioSource&);
  10378. const ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10379. };
  10380. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10381. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10382. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10383. public ChangeBroadcaster
  10384. {
  10385. public:
  10386. AudioTransportSource();
  10387. ~AudioTransportSource();
  10388. void setSource (PositionableAudioSource* const newSource,
  10389. int readAheadBufferSize = 0,
  10390. double sourceSampleRateToCorrectFor = 0.0);
  10391. void setPosition (double newPosition);
  10392. double getCurrentPosition() const;
  10393. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10394. void start();
  10395. void stop();
  10396. bool isPlaying() const throw() { return playing; }
  10397. void setGain (const float newGain) throw();
  10398. float getGain() const throw() { return gain; }
  10399. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10400. void releaseResources();
  10401. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10402. void setNextReadPosition (int newPosition);
  10403. int getNextReadPosition() const;
  10404. int getTotalLength() const;
  10405. bool isLooping() const;
  10406. juce_UseDebuggingNewOperator
  10407. private:
  10408. PositionableAudioSource* source;
  10409. ResamplingAudioSource* resamplerSource;
  10410. BufferingAudioSource* bufferingSource;
  10411. PositionableAudioSource* positionableSource;
  10412. AudioSource* masterSource;
  10413. CriticalSection callbackLock;
  10414. float volatile gain, lastGain;
  10415. bool volatile playing, stopped;
  10416. double sampleRate, sourceSampleRate;
  10417. int blockSize, readAheadBufferSize;
  10418. bool isPrepared, inputStreamEOF;
  10419. AudioTransportSource (const AudioTransportSource&);
  10420. const AudioTransportSource& operator= (const AudioTransportSource&);
  10421. };
  10422. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10423. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10424. #endif
  10425. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10426. #endif
  10427. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10428. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10429. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10430. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10431. class ChannelRemappingAudioSource : public AudioSource
  10432. {
  10433. public:
  10434. ChannelRemappingAudioSource (AudioSource* const source,
  10435. const bool deleteSourceWhenDeleted);
  10436. ~ChannelRemappingAudioSource();
  10437. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10438. void clearAllMappings() throw();
  10439. void setInputChannelMapping (const int destChannelIndex,
  10440. const int sourceChannelIndex) throw();
  10441. void setOutputChannelMapping (const int sourceChannelIndex,
  10442. const int destChannelIndex) throw();
  10443. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10444. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10445. XmlElement* createXml() const throw();
  10446. void restoreFromXml (const XmlElement& e) throw();
  10447. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10448. void releaseResources();
  10449. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10450. juce_UseDebuggingNewOperator
  10451. private:
  10452. int requiredNumberOfChannels;
  10453. Array <int> remappedInputs, remappedOutputs;
  10454. AudioSource* const source;
  10455. const bool deleteSourceWhenDeleted;
  10456. AudioSampleBuffer buffer;
  10457. AudioSourceChannelInfo remappedInfo;
  10458. CriticalSection lock;
  10459. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10460. const ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10461. };
  10462. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10463. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10464. #endif
  10465. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10466. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10467. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10468. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10469. /*** Start of inlined file: juce_IIRFilter.h ***/
  10470. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10471. #define __JUCE_IIRFILTER_JUCEHEADER__
  10472. class JUCE_API IIRFilter
  10473. {
  10474. public:
  10475. IIRFilter() throw();
  10476. IIRFilter (const IIRFilter& other) throw();
  10477. ~IIRFilter() throw();
  10478. void reset() throw();
  10479. void processSamples (float* const samples,
  10480. const int numSamples) throw();
  10481. float processSingleSampleRaw (const float sample) throw();
  10482. void makeLowPass (const double sampleRate,
  10483. const double frequency) throw();
  10484. void makeHighPass (const double sampleRate,
  10485. const double frequency) throw();
  10486. void makeLowShelf (const double sampleRate,
  10487. const double cutOffFrequency,
  10488. const double Q,
  10489. const float gainFactor) throw();
  10490. void makeHighShelf (const double sampleRate,
  10491. const double cutOffFrequency,
  10492. const double Q,
  10493. const float gainFactor) throw();
  10494. void makeBandPass (const double sampleRate,
  10495. const double centreFrequency,
  10496. const double Q,
  10497. const float gainFactor) throw();
  10498. void makeInactive() throw();
  10499. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10500. juce_UseDebuggingNewOperator
  10501. protected:
  10502. CriticalSection processLock;
  10503. void setCoefficients (double c1, double c2, double c3,
  10504. double c4, double c5, double c6) throw();
  10505. bool active;
  10506. float coefficients[6];
  10507. float x1, x2, y1, y2;
  10508. // (use the copyCoefficientsFrom() method instead of this operator)
  10509. const IIRFilter& operator= (const IIRFilter&);
  10510. };
  10511. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10512. /*** End of inlined file: juce_IIRFilter.h ***/
  10513. class JUCE_API IIRFilterAudioSource : public AudioSource
  10514. {
  10515. public:
  10516. IIRFilterAudioSource (AudioSource* const inputSource,
  10517. const bool deleteInputWhenDeleted);
  10518. ~IIRFilterAudioSource();
  10519. void setFilterParameters (const IIRFilter& newSettings);
  10520. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10521. void releaseResources();
  10522. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10523. juce_UseDebuggingNewOperator
  10524. private:
  10525. AudioSource* const input;
  10526. const bool deleteInputWhenDeleted;
  10527. OwnedArray <IIRFilter> iirFilters;
  10528. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10529. const IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10530. };
  10531. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10532. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10533. #endif
  10534. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10535. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10536. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10537. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10538. class JUCE_API MixerAudioSource : public AudioSource
  10539. {
  10540. public:
  10541. MixerAudioSource();
  10542. ~MixerAudioSource();
  10543. void addInputSource (AudioSource* newInput,
  10544. const bool deleteWhenRemoved);
  10545. void removeInputSource (AudioSource* input,
  10546. const bool deleteSource);
  10547. void removeAllInputs();
  10548. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10549. void releaseResources();
  10550. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10551. juce_UseDebuggingNewOperator
  10552. private:
  10553. VoidArray inputs;
  10554. BitArray inputsToDelete;
  10555. CriticalSection lock;
  10556. AudioSampleBuffer tempBuffer;
  10557. double currentSampleRate;
  10558. int bufferSizeExpected;
  10559. MixerAudioSource (const MixerAudioSource&);
  10560. const MixerAudioSource& operator= (const MixerAudioSource&);
  10561. };
  10562. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10563. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10564. #endif
  10565. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10566. #endif
  10567. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10568. #endif
  10569. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10570. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10571. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10572. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10573. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10574. {
  10575. public:
  10576. ToneGeneratorAudioSource();
  10577. ~ToneGeneratorAudioSource();
  10578. void setAmplitude (const float newAmplitude);
  10579. void setFrequency (const double newFrequencyHz);
  10580. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10581. void releaseResources();
  10582. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10583. juce_UseDebuggingNewOperator
  10584. private:
  10585. double frequency, sampleRate;
  10586. double currentPhase, phasePerSample;
  10587. float amplitude;
  10588. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10589. const ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10590. };
  10591. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10592. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10593. #endif
  10594. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10595. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10596. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10597. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10598. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10599. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10600. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10601. class AudioDeviceManager;
  10602. class Component;
  10603. class JUCE_API AudioIODeviceType
  10604. {
  10605. public:
  10606. const String& getTypeName() const throw() { return typeName; }
  10607. virtual void scanForDevices() = 0;
  10608. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10609. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10610. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10611. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10612. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10613. const String& inputDeviceName) = 0;
  10614. struct DeviceSetupDetails
  10615. {
  10616. AudioDeviceManager* manager;
  10617. int minNumInputChannels, maxNumInputChannels;
  10618. int minNumOutputChannels, maxNumOutputChannels;
  10619. bool useStereoPairs;
  10620. };
  10621. virtual ~AudioIODeviceType();
  10622. protected:
  10623. AudioIODeviceType (const tchar* const typeName);
  10624. private:
  10625. String typeName;
  10626. AudioIODeviceType (const AudioIODeviceType&);
  10627. const AudioIODeviceType& operator= (const AudioIODeviceType&);
  10628. };
  10629. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10630. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10631. /*** Start of inlined file: juce_MidiInput.h ***/
  10632. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10633. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10634. /*** Start of inlined file: juce_MidiMessage.h ***/
  10635. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10636. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10637. class JUCE_API MidiMessage
  10638. {
  10639. public:
  10640. MidiMessage (const int byte1,
  10641. const int byte2,
  10642. const int byte3,
  10643. const double timeStamp = 0) throw();
  10644. MidiMessage (const int byte1,
  10645. const int byte2,
  10646. const double timeStamp = 0) throw();
  10647. MidiMessage (const int byte1,
  10648. const double timeStamp = 0) throw();
  10649. MidiMessage (const uint8* const data,
  10650. const int dataSize,
  10651. const double timeStamp = 0) throw();
  10652. MidiMessage (const uint8* data,
  10653. int size,
  10654. int& numBytesUsed,
  10655. uint8 lastStatusByte,
  10656. double timeStamp = 0) throw();
  10657. MidiMessage (const MidiMessage& other) throw();
  10658. MidiMessage (const MidiMessage& other,
  10659. const double newTimeStamp) throw();
  10660. ~MidiMessage() throw();
  10661. const MidiMessage& operator= (const MidiMessage& other) throw();
  10662. uint8* getRawData() const throw() { return data; }
  10663. int getRawDataSize() const throw() { return size; }
  10664. double getTimeStamp() const throw() { return timeStamp; }
  10665. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10666. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10667. int getChannel() const throw();
  10668. bool isForChannel (const int channelNumber) const throw();
  10669. void setChannel (const int newChannelNumber) throw();
  10670. bool isSysEx() const throw();
  10671. const uint8* getSysExData() const throw();
  10672. int getSysExDataSize() const throw();
  10673. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10674. static const MidiMessage noteOn (const int channel,
  10675. const int noteNumber,
  10676. const float velocity) throw();
  10677. static const MidiMessage noteOn (const int channel,
  10678. const int noteNumber,
  10679. const uint8 velocity) throw();
  10680. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10681. static const MidiMessage noteOff (const int channel,
  10682. const int noteNumber) throw();
  10683. bool isNoteOnOrOff() const throw();
  10684. int getNoteNumber() const throw();
  10685. void setNoteNumber (const int newNoteNumber) throw();
  10686. uint8 getVelocity() const throw();
  10687. float getFloatVelocity() const throw();
  10688. void setVelocity (const float newVelocity) throw();
  10689. void multiplyVelocity (const float scaleFactor) throw();
  10690. bool isProgramChange() const throw();
  10691. int getProgramChangeNumber() const throw();
  10692. static const MidiMessage programChange (const int channel,
  10693. const int programNumber) throw();
  10694. bool isPitchWheel() const throw();
  10695. int getPitchWheelValue() const throw();
  10696. static const MidiMessage pitchWheel (const int channel,
  10697. const int position) throw();
  10698. bool isAftertouch() const throw();
  10699. int getAfterTouchValue() const throw();
  10700. static const MidiMessage aftertouchChange (const int channel,
  10701. const int noteNumber,
  10702. const int aftertouchAmount) throw();
  10703. bool isChannelPressure() const throw();
  10704. int getChannelPressureValue() const throw();
  10705. static const MidiMessage channelPressureChange (const int channel,
  10706. const int pressure) throw();
  10707. bool isController() const throw();
  10708. int getControllerNumber() const throw();
  10709. int getControllerValue() const throw();
  10710. static const MidiMessage controllerEvent (const int channel,
  10711. const int controllerType,
  10712. const int value) throw();
  10713. bool isAllNotesOff() const throw();
  10714. bool isAllSoundOff() const throw();
  10715. static const MidiMessage allNotesOff (const int channel) throw();
  10716. static const MidiMessage allSoundOff (const int channel) throw();
  10717. static const MidiMessage allControllersOff (const int channel) throw();
  10718. bool isMetaEvent() const throw();
  10719. int getMetaEventType() const throw();
  10720. const uint8* getMetaEventData() const throw();
  10721. int getMetaEventLength() const throw();
  10722. bool isTrackMetaEvent() const throw();
  10723. bool isEndOfTrackMetaEvent() const throw();
  10724. static const MidiMessage endOfTrack() throw();
  10725. bool isTrackNameEvent() const throw();
  10726. bool isTextMetaEvent() const throw();
  10727. const String getTextFromTextMetaEvent() const throw();
  10728. bool isTempoMetaEvent() const throw();
  10729. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10730. double getTempoSecondsPerQuarterNote() const throw();
  10731. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10732. bool isTimeSignatureMetaEvent() const throw();
  10733. void getTimeSignatureInfo (int& numerator,
  10734. int& denominator) const throw();
  10735. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10736. const int denominator) throw();
  10737. bool isKeySignatureMetaEvent() const throw();
  10738. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10739. bool isMidiChannelMetaEvent() const throw();
  10740. int getMidiChannelMetaEventChannel() const throw();
  10741. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10742. bool isActiveSense() const throw();
  10743. bool isMidiStart() const throw();
  10744. static const MidiMessage midiStart() throw();
  10745. bool isMidiContinue() const throw();
  10746. static const MidiMessage midiContinue() throw();
  10747. bool isMidiStop() const throw();
  10748. static const MidiMessage midiStop() throw();
  10749. bool isMidiClock() const throw();
  10750. static const MidiMessage midiClock() throw();
  10751. bool isSongPositionPointer() const throw();
  10752. int getSongPositionPointerMidiBeat() const throw();
  10753. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10754. bool isQuarterFrame() const throw();
  10755. int getQuarterFrameSequenceNumber() const throw();
  10756. int getQuarterFrameValue() const throw();
  10757. static const MidiMessage quarterFrame (const int sequenceNumber,
  10758. const int value) throw();
  10759. enum SmpteTimecodeType
  10760. {
  10761. fps24 = 0,
  10762. fps25 = 1,
  10763. fps30drop = 2,
  10764. fps30 = 3
  10765. };
  10766. bool isFullFrame() const throw();
  10767. void getFullFrameParameters (int& hours,
  10768. int& minutes,
  10769. int& seconds,
  10770. int& frames,
  10771. SmpteTimecodeType& timecodeType) const throw();
  10772. static const MidiMessage fullFrame (const int hours,
  10773. const int minutes,
  10774. const int seconds,
  10775. const int frames,
  10776. SmpteTimecodeType timecodeType);
  10777. enum MidiMachineControlCommand
  10778. {
  10779. mmc_stop = 1,
  10780. mmc_play = 2,
  10781. mmc_deferredplay = 3,
  10782. mmc_fastforward = 4,
  10783. mmc_rewind = 5,
  10784. mmc_recordStart = 6,
  10785. mmc_recordStop = 7,
  10786. mmc_pause = 9
  10787. };
  10788. bool isMidiMachineControlMessage() const throw();
  10789. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10790. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10791. bool isMidiMachineControlGoto (int& hours,
  10792. int& minutes,
  10793. int& seconds,
  10794. int& frames) const throw();
  10795. static const MidiMessage midiMachineControlGoto (int hours,
  10796. int minutes,
  10797. int seconds,
  10798. int frames);
  10799. static const MidiMessage masterVolume (const float volume) throw();
  10800. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10801. const int dataSize) throw();
  10802. static int readVariableLengthVal (const uint8* data,
  10803. int& numBytesUsed) throw();
  10804. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10805. static const String getMidiNoteName (int noteNumber,
  10806. bool useSharps,
  10807. bool includeOctaveNumber,
  10808. int octaveNumForMiddleC) throw();
  10809. static const double getMidiNoteInHertz (int noteNumber) throw();
  10810. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10811. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10812. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10813. static const String getControllerName (int controllerNumber) throw();
  10814. juce_UseDebuggingNewOperator
  10815. private:
  10816. double timeStamp;
  10817. uint8* data;
  10818. int message, size;
  10819. };
  10820. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10821. /*** End of inlined file: juce_MidiMessage.h ***/
  10822. class MidiInput;
  10823. class JUCE_API MidiInputCallback
  10824. {
  10825. public:
  10826. virtual ~MidiInputCallback() {}
  10827. virtual void handleIncomingMidiMessage (MidiInput* source,
  10828. const MidiMessage& message) = 0;
  10829. virtual void handlePartialSysexMessage (MidiInput* source,
  10830. const uint8* messageData,
  10831. const int numBytesSoFar,
  10832. const double timestamp)
  10833. {
  10834. // (this bit is just to avoid compiler warnings about unused variables)
  10835. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10836. }
  10837. };
  10838. class JUCE_API MidiInput
  10839. {
  10840. public:
  10841. static const StringArray getDevices();
  10842. static int getDefaultDeviceIndex();
  10843. static MidiInput* openDevice (int deviceIndex,
  10844. MidiInputCallback* callback);
  10845. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10846. static MidiInput* createNewDevice (const String& deviceName,
  10847. MidiInputCallback* callback);
  10848. #endif
  10849. virtual ~MidiInput();
  10850. virtual const String getName() const throw() { return name; }
  10851. virtual void setName (const String& newName) throw() { name = newName; }
  10852. virtual void start();
  10853. virtual void stop();
  10854. juce_UseDebuggingNewOperator
  10855. protected:
  10856. String name;
  10857. void* internal;
  10858. MidiInput (const String& name);
  10859. MidiInput (const MidiInput&);
  10860. };
  10861. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10862. /*** End of inlined file: juce_MidiInput.h ***/
  10863. /*** Start of inlined file: juce_MidiOutput.h ***/
  10864. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10865. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10866. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10867. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10868. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10869. class JUCE_API MidiBuffer
  10870. {
  10871. public:
  10872. MidiBuffer() throw();
  10873. MidiBuffer (const MidiMessage& message) throw();
  10874. MidiBuffer (const MidiBuffer& other) throw();
  10875. const MidiBuffer& operator= (const MidiBuffer& other) throw();
  10876. ~MidiBuffer() throw();
  10877. void clear() throw();
  10878. void clear (const int start,
  10879. const int numSamples) throw();
  10880. bool isEmpty() const throw();
  10881. int getNumEvents() const throw();
  10882. void addEvent (const MidiMessage& midiMessage,
  10883. const int sampleNumber) throw();
  10884. void addEvent (const uint8* const rawMidiData,
  10885. const int maxBytesOfMidiData,
  10886. const int sampleNumber) throw();
  10887. void addEvents (const MidiBuffer& otherBuffer,
  10888. const int startSample,
  10889. const int numSamples,
  10890. const int sampleDeltaToAdd) throw();
  10891. int getFirstEventTime() const throw();
  10892. int getLastEventTime() const throw();
  10893. void swap (MidiBuffer& other);
  10894. class Iterator
  10895. {
  10896. public:
  10897. Iterator (const MidiBuffer& buffer) throw();
  10898. ~Iterator() throw();
  10899. void setNextSamplePosition (const int samplePosition) throw();
  10900. bool getNextEvent (MidiMessage& result,
  10901. int& samplePosition) throw();
  10902. bool getNextEvent (const uint8* &midiData,
  10903. int& numBytesOfMidiData,
  10904. int& samplePosition) throw();
  10905. juce_UseDebuggingNewOperator
  10906. private:
  10907. const MidiBuffer& buffer;
  10908. const uint8* data;
  10909. Iterator (const Iterator&);
  10910. const Iterator& operator= (const Iterator&);
  10911. };
  10912. juce_UseDebuggingNewOperator
  10913. private:
  10914. friend class MidiBuffer::Iterator;
  10915. MemoryBlock data;
  10916. int bytesUsed;
  10917. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10918. };
  10919. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10920. /*** End of inlined file: juce_MidiBuffer.h ***/
  10921. class JUCE_API MidiOutput : private Thread
  10922. {
  10923. public:
  10924. static const StringArray getDevices();
  10925. static int getDefaultDeviceIndex();
  10926. static MidiOutput* openDevice (int deviceIndex);
  10927. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10928. static MidiOutput* createNewDevice (const String& deviceName);
  10929. #endif
  10930. virtual ~MidiOutput();
  10931. virtual void sendMessageNow (const MidiMessage& message);
  10932. virtual void reset();
  10933. virtual bool getVolume (float& leftVol,
  10934. float& rightVol);
  10935. virtual void setVolume (float leftVol,
  10936. float rightVol);
  10937. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10938. const double millisecondCounterToStartAt,
  10939. double samplesPerSecondForBuffer) throw();
  10940. virtual void clearAllPendingMessages() throw();
  10941. virtual void startBackgroundThread() throw();
  10942. virtual void stopBackgroundThread() throw();
  10943. juce_UseDebuggingNewOperator
  10944. protected:
  10945. void* internal;
  10946. struct PendingMessage
  10947. {
  10948. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10949. MidiMessage message;
  10950. PendingMessage* next;
  10951. juce_UseDebuggingNewOperator
  10952. };
  10953. CriticalSection lock;
  10954. PendingMessage* firstMessage;
  10955. MidiOutput() throw();
  10956. MidiOutput (const MidiOutput&);
  10957. void run();
  10958. };
  10959. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10960. /*** End of inlined file: juce_MidiOutput.h ***/
  10961. /*** Start of inlined file: juce_ComboBox.h ***/
  10962. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10963. #define __JUCE_COMBOBOX_JUCEHEADER__
  10964. /*** Start of inlined file: juce_Label.h ***/
  10965. #ifndef __JUCE_LABEL_JUCEHEADER__
  10966. #define __JUCE_LABEL_JUCEHEADER__
  10967. /*** Start of inlined file: juce_ComponentDeletionWatcher.h ***/
  10968. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10969. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10970. class JUCE_API ComponentDeletionWatcher
  10971. {
  10972. public:
  10973. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  10974. ~ComponentDeletionWatcher() throw();
  10975. bool hasBeenDeleted() const throw();
  10976. const Component* getComponent() const throw();
  10977. juce_UseDebuggingNewOperator
  10978. private:
  10979. const Component* const componentToWatch;
  10980. const uint32 componentUID;
  10981. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  10982. const ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  10983. };
  10984. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10985. /*** End of inlined file: juce_ComponentDeletionWatcher.h ***/
  10986. /*** Start of inlined file: juce_TextEditor.h ***/
  10987. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10988. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10989. /*** Start of inlined file: juce_Viewport.h ***/
  10990. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10991. #define __JUCE_VIEWPORT_JUCEHEADER__
  10992. /*** Start of inlined file: juce_ScrollBar.h ***/
  10993. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10994. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10995. /*** Start of inlined file: juce_Button.h ***/
  10996. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10997. #define __JUCE_BUTTON_JUCEHEADER__
  10998. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10999. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11000. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11001. /*** Start of inlined file: juce_TooltipClient.h ***/
  11002. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11003. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11004. class JUCE_API TooltipClient
  11005. {
  11006. public:
  11007. virtual ~TooltipClient() {}
  11008. virtual const String getTooltip() = 0;
  11009. };
  11010. class JUCE_API SettableTooltipClient : public TooltipClient
  11011. {
  11012. public:
  11013. virtual ~SettableTooltipClient() {}
  11014. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  11015. virtual const String getTooltip() { return tooltipString; }
  11016. juce_UseDebuggingNewOperator
  11017. protected:
  11018. String tooltipString;
  11019. };
  11020. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11021. /*** End of inlined file: juce_TooltipClient.h ***/
  11022. class JUCE_API TooltipWindow : public Component,
  11023. private Timer
  11024. {
  11025. public:
  11026. TooltipWindow (Component* parentComponent = 0,
  11027. const int millisecondsBeforeTipAppears = 700);
  11028. ~TooltipWindow();
  11029. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  11030. enum ColourIds
  11031. {
  11032. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  11033. textColourId = 0x1001c00, /**< The colour to use for the text. */
  11034. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  11035. };
  11036. juce_UseDebuggingNewOperator
  11037. private:
  11038. int millisecondsBeforeTipAppears;
  11039. Point<int> lastMousePos;
  11040. int mouseClicks;
  11041. unsigned int lastCompChangeTime, lastHideTime;
  11042. Component* lastComponentUnderMouse;
  11043. bool changedCompsSinceShown;
  11044. String tipShowing, lastTipUnderMouse;
  11045. void paint (Graphics& g);
  11046. void mouseEnter (const MouseEvent& e);
  11047. void timerCallback();
  11048. static const String getTipFor (Component* const c);
  11049. void showFor (const String& tip);
  11050. void hide();
  11051. TooltipWindow (const TooltipWindow&);
  11052. const TooltipWindow& operator= (const TooltipWindow&);
  11053. };
  11054. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11055. /*** End of inlined file: juce_TooltipWindow.h ***/
  11056. class Button;
  11057. class JUCE_API ButtonListener
  11058. {
  11059. public:
  11060. virtual ~ButtonListener() {}
  11061. virtual void buttonClicked (Button* button) = 0;
  11062. virtual void buttonStateChanged (Button*) {}
  11063. };
  11064. class JUCE_API Button : public Component,
  11065. public SettableTooltipClient,
  11066. public ApplicationCommandManagerListener,
  11067. public Value::Listener,
  11068. private KeyListener
  11069. {
  11070. protected:
  11071. Button (const String& buttonName);
  11072. public:
  11073. virtual ~Button();
  11074. void setButtonText (const String& newText);
  11075. const String getButtonText() const { return text; }
  11076. bool isDown() const throw();
  11077. bool isOver() const throw();
  11078. void setToggleState (const bool shouldBeOn,
  11079. const bool sendChangeNotification);
  11080. bool getToggleState() const throw() { return isOn.getValue(); }
  11081. Value& getToggleStateValue() { return isOn; }
  11082. void setClickingTogglesState (const bool shouldToggle) throw();
  11083. bool getClickingTogglesState() const throw();
  11084. void setRadioGroupId (const int newGroupId);
  11085. int getRadioGroupId() const throw() { return radioGroupId; }
  11086. void addButtonListener (ButtonListener* const newListener);
  11087. void removeButtonListener (ButtonListener* const listener);
  11088. virtual void triggerClick();
  11089. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11090. const int commandID,
  11091. const bool generateTooltip);
  11092. int getCommandID() const throw() { return commandID; }
  11093. void addShortcut (const KeyPress& key);
  11094. void clearShortcuts();
  11095. bool isRegisteredForShortcut (const KeyPress& key) const;
  11096. void setRepeatSpeed (const int initialDelayInMillisecs,
  11097. const int repeatDelayInMillisecs,
  11098. const int minimumDelayInMillisecs = -1) throw();
  11099. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  11100. uint32 getMillisecondsSinceButtonDown() const throw();
  11101. void setVisible (bool shouldBeVisible);
  11102. void setTooltip (const String& newTooltip);
  11103. // (implementation of the TooltipClient method)
  11104. const String getTooltip();
  11105. enum ConnectedEdgeFlags
  11106. {
  11107. ConnectedOnLeft = 1,
  11108. ConnectedOnRight = 2,
  11109. ConnectedOnTop = 4,
  11110. ConnectedOnBottom = 8
  11111. };
  11112. void setConnectedEdges (const int connectedEdgeFlags);
  11113. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11114. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11115. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11116. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11117. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11118. enum ButtonState
  11119. {
  11120. buttonNormal,
  11121. buttonOver,
  11122. buttonDown
  11123. };
  11124. void setState (const ButtonState newState);
  11125. juce_UseDebuggingNewOperator
  11126. protected:
  11127. virtual void clicked();
  11128. virtual void clicked (const ModifierKeys& modifiers);
  11129. virtual void paintButton (Graphics& g,
  11130. bool isMouseOverButton,
  11131. bool isButtonDown) = 0;
  11132. virtual void buttonStateChanged();
  11133. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11134. void handleCommandMessage (int commandId);
  11135. void mouseEnter (const MouseEvent& e);
  11136. void mouseExit (const MouseEvent& e);
  11137. void mouseDown (const MouseEvent& e);
  11138. void mouseDrag (const MouseEvent& e);
  11139. void mouseUp (const MouseEvent& e);
  11140. bool keyPressed (const KeyPress& key);
  11141. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11142. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  11143. void paint (Graphics& g);
  11144. void parentHierarchyChanged();
  11145. void focusGained (FocusChangeType cause);
  11146. void focusLost (FocusChangeType cause);
  11147. void enablementChanged();
  11148. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11149. void applicationCommandListChanged();
  11150. void valueChanged (Value& value);
  11151. private:
  11152. Array <KeyPress> shortcuts;
  11153. Component* keySource;
  11154. String text;
  11155. SortedSet <void*> buttonListeners;
  11156. class RepeatTimer;
  11157. friend class ScopedPointer <RepeatTimer>;
  11158. ScopedPointer <RepeatTimer> repeatTimer;
  11159. uint32 buttonPressTime, lastTimeCallbackTime;
  11160. ApplicationCommandManager* commandManagerToUse;
  11161. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11162. int radioGroupId, commandID, connectedEdgeFlags;
  11163. ButtonState buttonState;
  11164. Value isOn;
  11165. bool lastToggleState : 1;
  11166. bool clickTogglesState : 1;
  11167. bool needsToRelease : 1;
  11168. bool needsRepainting : 1;
  11169. bool isKeyDown : 1;
  11170. bool triggerOnMouseDown : 1;
  11171. bool generateTooltip : 1;
  11172. void repeatTimerCallback();
  11173. RepeatTimer& getRepeatTimer();
  11174. ButtonState updateState (const MouseEvent* const e);
  11175. bool isShortcutPressed() const;
  11176. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11177. void flashButtonState();
  11178. void sendClickMessage (const ModifierKeys& modifiers);
  11179. void sendStateMessage();
  11180. Button (const Button&);
  11181. const Button& operator= (const Button&);
  11182. };
  11183. #endif // __JUCE_BUTTON_JUCEHEADER__
  11184. /*** End of inlined file: juce_Button.h ***/
  11185. class ScrollBar;
  11186. class JUCE_API ScrollBarListener
  11187. {
  11188. public:
  11189. virtual ~ScrollBarListener() {}
  11190. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11191. const double newRangeStart) = 0;
  11192. };
  11193. class JUCE_API ScrollBar : public Component,
  11194. public AsyncUpdater,
  11195. private Timer
  11196. {
  11197. public:
  11198. ScrollBar (const bool isVertical,
  11199. const bool buttonsAreVisible = true);
  11200. ~ScrollBar();
  11201. bool isVertical() const throw() { return vertical; }
  11202. void setOrientation (const bool shouldBeVertical) throw();
  11203. void setButtonVisibility (const bool buttonsAreVisible);
  11204. void setAutoHide (const bool shouldHideWhenFullRange);
  11205. void setRangeLimits (const double minimum,
  11206. const double maximum) throw();
  11207. double getMinimumRangeLimit() const throw() { return minimum; }
  11208. double getMaximumRangeLimit() const throw() { return maximum; }
  11209. void setCurrentRange (double newStart,
  11210. double newSize) throw();
  11211. void setCurrentRangeStart (double newStart) throw();
  11212. double getCurrentRangeStart() const throw() { return rangeStart; }
  11213. double getCurrentRangeSize() const throw() { return rangeSize; }
  11214. void setSingleStepSize (const double newSingleStepSize) throw();
  11215. void moveScrollbarInSteps (const int howManySteps) throw();
  11216. void moveScrollbarInPages (const int howManyPages) throw();
  11217. void scrollToTop() throw();
  11218. void scrollToBottom() throw();
  11219. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  11220. const int repeatDelayInMillisecs,
  11221. const int minimumDelayInMillisecs = -1) throw();
  11222. enum ColourIds
  11223. {
  11224. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11225. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11226. 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. */
  11227. };
  11228. void addListener (ScrollBarListener* const listener) throw();
  11229. void removeListener (ScrollBarListener* const listener) throw();
  11230. bool keyPressed (const KeyPress& key);
  11231. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11232. void lookAndFeelChanged();
  11233. void handleAsyncUpdate();
  11234. void mouseDown (const MouseEvent& e);
  11235. void mouseDrag (const MouseEvent& e);
  11236. void mouseUp (const MouseEvent& e);
  11237. void paint (Graphics& g);
  11238. void resized();
  11239. juce_UseDebuggingNewOperator
  11240. private:
  11241. double minimum, maximum;
  11242. double rangeStart, rangeSize;
  11243. double singleStepSize, dragStartRange;
  11244. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11245. int dragStartMousePos, lastMousePos;
  11246. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11247. bool vertical, isDraggingThumb, alwaysVisible;
  11248. Button* upButton;
  11249. Button* downButton;
  11250. SortedSet <void*> listeners;
  11251. void updateThumbPosition() throw();
  11252. void timerCallback();
  11253. ScrollBar (const ScrollBar&);
  11254. const ScrollBar& operator= (const ScrollBar&);
  11255. };
  11256. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11257. /*** End of inlined file: juce_ScrollBar.h ***/
  11258. class JUCE_API Viewport : public Component,
  11259. private ComponentListener,
  11260. private ScrollBarListener
  11261. {
  11262. public:
  11263. Viewport (const String& componentName = String::empty);
  11264. ~Viewport();
  11265. void setViewedComponent (Component* const newViewedComponent);
  11266. Component* getViewedComponent() const throw() { return contentComp; }
  11267. void setViewPosition (const int xPixelsOffset,
  11268. const int yPixelsOffset);
  11269. void setViewPositionProportionately (const double proportionX,
  11270. const double proportionY);
  11271. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11272. int getViewPositionX() const throw() { return lastVX; }
  11273. int getViewPositionY() const throw() { return lastVY; }
  11274. int getViewWidth() const throw() { return lastVW; }
  11275. int getViewHeight() const throw() { return lastVH; }
  11276. int getMaximumVisibleWidth() const throw();
  11277. int getMaximumVisibleHeight() const throw();
  11278. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11279. int visibleW, int visibleH);
  11280. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11281. const bool showHorizontalScrollbarIfNeeded);
  11282. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11283. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11284. void setScrollBarThickness (const int thickness);
  11285. int getScrollBarThickness() const throw();
  11286. void setSingleStepSizes (const int stepX, const int stepY);
  11287. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11288. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11289. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11290. juce_UseDebuggingNewOperator
  11291. void resized();
  11292. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  11293. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11294. bool keyPressed (const KeyPress& key);
  11295. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11296. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11297. private:
  11298. Component* contentComp;
  11299. int lastVX, lastVY, lastVW, lastVH;
  11300. int scrollBarThickness;
  11301. int singleStepX, singleStepY;
  11302. bool showHScrollbar, showVScrollbar;
  11303. Component* contentHolder;
  11304. ScrollBar* verticalScrollBar;
  11305. ScrollBar* horizontalScrollBar;
  11306. void updateVisibleRegion();
  11307. Viewport (const Viewport&);
  11308. const Viewport& operator= (const Viewport&);
  11309. };
  11310. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11311. /*** End of inlined file: juce_Viewport.h ***/
  11312. /*** Start of inlined file: juce_PopupMenu.h ***/
  11313. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11314. #define __JUCE_POPUPMENU_JUCEHEADER__
  11315. class PopupMenuCustomComponent;
  11316. class JUCE_API PopupMenu
  11317. {
  11318. public:
  11319. PopupMenu();
  11320. PopupMenu (const PopupMenu& other);
  11321. ~PopupMenu();
  11322. const PopupMenu& operator= (const PopupMenu& other);
  11323. void clear();
  11324. void addItem (const int itemResultId,
  11325. const String& itemText,
  11326. const bool isActive = true,
  11327. const bool isTicked = false,
  11328. const Image* const iconToUse = 0);
  11329. void addCommandItem (ApplicationCommandManager* commandManager,
  11330. const int commandID,
  11331. const String& displayName = String::empty);
  11332. void addColouredItem (const int itemResultId,
  11333. const String& itemText,
  11334. const Colour& itemTextColour,
  11335. const bool isActive = true,
  11336. const bool isTicked = false,
  11337. const Image* const iconToUse = 0);
  11338. void addCustomItem (const int itemResultId,
  11339. PopupMenuCustomComponent* const customComponent);
  11340. void addCustomItem (const int itemResultId,
  11341. Component* customComponent,
  11342. int idealWidth, int idealHeight,
  11343. const bool triggerMenuItemAutomaticallyWhenClicked);
  11344. void addSubMenu (const String& subMenuName,
  11345. const PopupMenu& subMenu,
  11346. const bool isActive = true,
  11347. Image* const iconToUse = 0,
  11348. const bool isTicked = false);
  11349. void addSeparator();
  11350. void addSectionHeader (const String& title);
  11351. int getNumItems() const throw();
  11352. bool containsCommandItem (const int commandID) const;
  11353. bool containsAnyActiveItems() const throw();
  11354. int show (const int itemIdThatMustBeVisible = 0,
  11355. const int minimumWidth = 0,
  11356. const int maximumNumColumns = 0,
  11357. const int standardItemHeight = 0);
  11358. int showAt (const int screenX,
  11359. const int screenY,
  11360. const int itemIdThatMustBeVisible = 0,
  11361. const int minimumWidth = 0,
  11362. const int maximumNumColumns = 0,
  11363. const int standardItemHeight = 0);
  11364. int showAt (Component* componentToAttachTo,
  11365. const int itemIdThatMustBeVisible = 0,
  11366. const int minimumWidth = 0,
  11367. const int maximumNumColumns = 0,
  11368. const int standardItemHeight = 0);
  11369. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11370. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11371. enum ColourIds
  11372. {
  11373. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11374. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11375. colour is specified when the item is added). */
  11376. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11377. addSectionHeader() method). */
  11378. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11379. highlighted menu item. */
  11380. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11381. highlighted item. */
  11382. };
  11383. class JUCE_API MenuItemIterator
  11384. {
  11385. public:
  11386. MenuItemIterator (const PopupMenu& menu);
  11387. ~MenuItemIterator();
  11388. bool next();
  11389. String itemName;
  11390. const PopupMenu* subMenu;
  11391. int itemId;
  11392. bool isSeparator;
  11393. bool isTicked;
  11394. bool isEnabled;
  11395. bool isCustomComponent;
  11396. bool isSectionHeader;
  11397. const Colour* customColour;
  11398. const Image* customImage;
  11399. ApplicationCommandManager* commandManager;
  11400. juce_UseDebuggingNewOperator
  11401. private:
  11402. const PopupMenu& menu;
  11403. int index;
  11404. MenuItemIterator (const MenuItemIterator&);
  11405. const MenuItemIterator& operator= (const MenuItemIterator&);
  11406. };
  11407. juce_UseDebuggingNewOperator
  11408. private:
  11409. class Item;
  11410. class ItemComponent;
  11411. class Window;
  11412. friend class MenuItemIterator;
  11413. friend class ItemComponent;
  11414. friend class Window;
  11415. friend class PopupMenuCustomComponent;
  11416. friend class OwnedArray <Item>;
  11417. friend class ScopedPointer <Window>;
  11418. OwnedArray <Item> items;
  11419. LookAndFeel* lookAndFeel;
  11420. bool separatorPending;
  11421. void addSeparatorIfPending();
  11422. int showMenu (const int x, const int y, const int w, const int h,
  11423. const int itemIdThatMustBeVisible,
  11424. const int minimumWidth,
  11425. const int maximumNumColumns,
  11426. const int standardItemHeight,
  11427. const bool alignToRectangle,
  11428. Component* const componentAttachedTo);
  11429. friend class MenuBarComponent;
  11430. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11431. const int itemIdThatMustBeVisible,
  11432. const int minimumWidth,
  11433. const int maximumNumColumns,
  11434. const int standardItemHeight,
  11435. const bool alignToRectangle,
  11436. Component* menuBarComponent,
  11437. ApplicationCommandManager** managerOfChosenCommand,
  11438. Component* const componentAttachedTo);
  11439. };
  11440. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11441. /*** End of inlined file: juce_PopupMenu.h ***/
  11442. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11443. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11444. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11445. class JUCE_API TextInputTarget
  11446. {
  11447. public:
  11448. TextInputTarget() {}
  11449. virtual ~TextInputTarget() {}
  11450. virtual const Range<int> getHighlightedRegion() const = 0;
  11451. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11452. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11453. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11454. };
  11455. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11456. /*** End of inlined file: juce_TextInputTarget.h ***/
  11457. class TextEditor;
  11458. class TextHolderComponent;
  11459. class JUCE_API TextEditorListener
  11460. {
  11461. public:
  11462. virtual ~TextEditorListener() {}
  11463. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11464. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11465. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11466. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11467. };
  11468. class JUCE_API TextEditor : public Component,
  11469. public TextInputTarget,
  11470. public SettableTooltipClient
  11471. {
  11472. public:
  11473. TextEditor (const String& componentName = String::empty,
  11474. const tchar passwordCharacter = 0);
  11475. virtual ~TextEditor();
  11476. void setMultiLine (const bool shouldBeMultiLine,
  11477. const bool shouldWordWrap = true);
  11478. bool isMultiLine() const;
  11479. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11480. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11481. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11482. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11483. void setReadOnly (const bool shouldBeReadOnly);
  11484. bool isReadOnly() const;
  11485. void setCaretVisible (const bool shouldBeVisible);
  11486. bool isCaretVisible() const { return caretVisible; }
  11487. void setScrollbarsShown (bool shouldBeEnabled);
  11488. bool areScrollbarsShown() const { return scrollbarVisible; }
  11489. void setPasswordCharacter (const tchar passwordCharacter);
  11490. tchar getPasswordCharacter() const { return passwordCharacter; }
  11491. void setPopupMenuEnabled (const bool menuEnabled);
  11492. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11493. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11494. enum ColourIds
  11495. {
  11496. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11497. transparent if necessary. */
  11498. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11499. that because the editor can contain multiple colours, calling this
  11500. method won't change the colour of existing text - to do that, call
  11501. applyFontToAllText() after calling this method.*/
  11502. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11503. the text - this can be transparent if you don't want to show any
  11504. highlighting.*/
  11505. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11506. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11507. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11508. the edge of the component. */
  11509. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11510. the edge of the component when it has focus. */
  11511. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11512. around the edge of the editor. */
  11513. };
  11514. void setFont (const Font& newFont);
  11515. void applyFontToAllText (const Font& newFont);
  11516. const Font getFont() const;
  11517. void setSelectAllWhenFocused (const bool b);
  11518. void setInputRestrictions (const int maxTextLength,
  11519. const String& allowedCharacters = String::empty);
  11520. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11521. void setScrollBarThickness (const int newThicknessPixels);
  11522. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11523. void addListener (TextEditorListener* const newListener);
  11524. void removeListener (TextEditorListener* const listenerToRemove);
  11525. const String getText() const;
  11526. const String getTextInRange (const Range<int>& textRange) const;
  11527. bool isEmpty() const;
  11528. void setText (const String& newText,
  11529. const bool sendTextChangeMessage = true);
  11530. Value& getTextValue();
  11531. void insertTextAtCaret (const String& textToInsert);
  11532. void clear();
  11533. void cut();
  11534. void copy();
  11535. void paste();
  11536. void setCaretPosition (const int newIndex);
  11537. int getCaretPosition() const;
  11538. void scrollEditorToPositionCaret (const int desiredCaretX,
  11539. const int desiredCaretY);
  11540. const Rectangle<int> getCaretRectangle();
  11541. void setHighlightedRegion (const Range<int>& newSelection);
  11542. const Range<int> getHighlightedRegion() const { return selection; }
  11543. const String getHighlightedText() const;
  11544. int getTextIndexAt (const int x, const int y);
  11545. int getTotalNumChars() const;
  11546. int getTextWidth() const;
  11547. int getTextHeight() const;
  11548. void setIndents (const int newLeftIndent, const int newTopIndent);
  11549. void setBorder (const BorderSize& border);
  11550. const BorderSize getBorder() const;
  11551. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11552. void paint (Graphics& g);
  11553. void paintOverChildren (Graphics& g);
  11554. void mouseDown (const MouseEvent& e);
  11555. void mouseUp (const MouseEvent& e);
  11556. void mouseDrag (const MouseEvent& e);
  11557. void mouseDoubleClick (const MouseEvent& e);
  11558. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11559. bool keyPressed (const KeyPress& key);
  11560. bool keyStateChanged (const bool isKeyDown);
  11561. void focusGained (FocusChangeType cause);
  11562. void focusLost (FocusChangeType cause);
  11563. void resized();
  11564. void enablementChanged();
  11565. void colourChanged();
  11566. juce_UseDebuggingNewOperator
  11567. protected:
  11568. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11569. const MouseEvent* mouseClickEvent);
  11570. virtual void performPopupMenuAction (const int menuItemID);
  11571. void scrollToMakeSureCursorIsVisible();
  11572. void moveCaret (int newCaretPos);
  11573. void moveCursorTo (const int newPosition, const bool isSelecting);
  11574. void textChanged();
  11575. void newTransaction();
  11576. void doUndoRedo (const bool isRedo);
  11577. virtual void returnPressed();
  11578. virtual void escapePressed();
  11579. void handleCommandMessage (int commandId);
  11580. private:
  11581. ScopedPointer <Viewport> viewport;
  11582. TextHolderComponent* textHolder;
  11583. BorderSize borderSize;
  11584. bool readOnly : 1;
  11585. bool multiline : 1;
  11586. bool wordWrap : 1;
  11587. bool returnKeyStartsNewLine : 1;
  11588. bool caretVisible : 1;
  11589. bool popupMenuEnabled : 1;
  11590. bool selectAllTextWhenFocused : 1;
  11591. bool scrollbarVisible : 1;
  11592. bool wasFocused : 1;
  11593. bool caretFlashState : 1;
  11594. bool keepCursorOnScreen : 1;
  11595. bool tabKeyUsed : 1;
  11596. bool menuActive : 1;
  11597. bool valueTextNeedsUpdating : 1;
  11598. UndoManager undoManager;
  11599. float cursorX, cursorY, cursorHeight;
  11600. int maxTextLength;
  11601. Range<int> selection;
  11602. int leftIndent, topIndent;
  11603. unsigned int lastTransactionTime;
  11604. Font currentFont;
  11605. mutable int totalNumChars;
  11606. int caretPosition;
  11607. VoidArray sections;
  11608. String textToShowWhenEmpty;
  11609. Colour colourForTextWhenEmpty;
  11610. tchar passwordCharacter;
  11611. Value textValue;
  11612. enum
  11613. {
  11614. notDragging,
  11615. draggingSelectionStart,
  11616. draggingSelectionEnd
  11617. } dragType;
  11618. String allowedCharacters;
  11619. SortedSet <void*> listeners;
  11620. friend class TextEditorInsertAction;
  11621. friend class TextEditorRemoveAction;
  11622. void coalesceSimilarSections();
  11623. void splitSection (const int sectionIndex, const int charToSplitAt);
  11624. void clearInternal (UndoManager* const um);
  11625. void insert (const String& text,
  11626. const int insertIndex,
  11627. const Font& font,
  11628. const Colour& colour,
  11629. UndoManager* const um,
  11630. const int caretPositionToMoveTo);
  11631. void reinsert (const int insertIndex,
  11632. const VoidArray& sections);
  11633. void remove (const Range<int>& range,
  11634. UndoManager* const um,
  11635. const int caretPositionToMoveTo);
  11636. void getCharPosition (const int index,
  11637. float& x, float& y,
  11638. float& lineHeight) const;
  11639. void updateCaretPosition();
  11640. void textWasChangedByValue();
  11641. int indexAtPosition (const float x,
  11642. const float y);
  11643. int findWordBreakAfter (const int position) const;
  11644. int findWordBreakBefore (const int position) const;
  11645. friend class TextHolderComponent;
  11646. friend class TextEditorViewport;
  11647. void drawContent (Graphics& g);
  11648. void updateTextHolderSize();
  11649. float getWordWrapWidth() const;
  11650. void timerCallbackInt();
  11651. void repaintCaret();
  11652. void repaintText (const Range<int>& range);
  11653. TextEditor (const TextEditor&);
  11654. const TextEditor& operator= (const TextEditor&);
  11655. };
  11656. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11657. /*** End of inlined file: juce_TextEditor.h ***/
  11658. class Label;
  11659. class JUCE_API LabelListener
  11660. {
  11661. public:
  11662. virtual ~LabelListener() {}
  11663. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11664. };
  11665. class JUCE_API Label : public Component,
  11666. public SettableTooltipClient,
  11667. protected TextEditorListener,
  11668. private ComponentListener,
  11669. private Value::Listener
  11670. {
  11671. public:
  11672. Label (const String& componentName,
  11673. const String& labelText);
  11674. ~Label();
  11675. void setText (const String& newText,
  11676. const bool broadcastChangeMessage);
  11677. const String getText (const bool returnActiveEditorContents = false) const throw();
  11678. Value& getTextValue() { return textValue; }
  11679. void setFont (const Font& newFont) throw();
  11680. const Font& getFont() const throw();
  11681. enum ColourIds
  11682. {
  11683. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11684. textColourId = 0x1000281, /**< The colour for the text. */
  11685. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11686. Leave this transparent to not have an outline. */
  11687. };
  11688. void setJustificationType (const Justification& justification) throw();
  11689. const Justification getJustificationType() const throw() { return justification; }
  11690. void setBorderSize (int horizontalBorder, int verticalBorder);
  11691. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11692. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11693. void attachToComponent (Component* owner,
  11694. const bool onLeft);
  11695. Component* getAttachedComponent() const throw() { return ownerComponent; }
  11696. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11697. void setMinimumHorizontalScale (const float newScale);
  11698. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11699. void addListener (LabelListener* const listener) throw();
  11700. void removeListener (LabelListener* const listener) throw();
  11701. void setEditable (const bool editOnSingleClick,
  11702. const bool editOnDoubleClick = false,
  11703. const bool lossOfFocusDiscardsChanges = false) throw();
  11704. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11705. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11706. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11707. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11708. void showEditor();
  11709. void hideEditor (const bool discardCurrentEditorContents);
  11710. bool isBeingEdited() const throw();
  11711. juce_UseDebuggingNewOperator
  11712. protected:
  11713. virtual TextEditor* createEditorComponent();
  11714. virtual void textWasEdited();
  11715. virtual void textWasChanged();
  11716. virtual void editorShown (TextEditor* editorComponent);
  11717. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11718. void paint (Graphics& g);
  11719. void resized();
  11720. void mouseUp (const MouseEvent& e);
  11721. void mouseDoubleClick (const MouseEvent& e);
  11722. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11723. void componentParentHierarchyChanged (Component& component);
  11724. void componentVisibilityChanged (Component& component);
  11725. void inputAttemptWhenModal();
  11726. void focusGained (FocusChangeType);
  11727. void enablementChanged();
  11728. KeyboardFocusTraverser* createFocusTraverser();
  11729. void textEditorTextChanged (TextEditor& editor);
  11730. void textEditorReturnKeyPressed (TextEditor& editor);
  11731. void textEditorEscapeKeyPressed (TextEditor& editor);
  11732. void textEditorFocusLost (TextEditor& editor);
  11733. void colourChanged();
  11734. void valueChanged (Value&);
  11735. private:
  11736. Value textValue;
  11737. String lastTextValue;
  11738. Font font;
  11739. Justification justification;
  11740. ScopedPointer <TextEditor> editor;
  11741. SortedSet <void*> listeners;
  11742. Component* ownerComponent;
  11743. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  11744. int horizontalBorderSize, verticalBorderSize;
  11745. float minimumHorizontalScale;
  11746. bool editSingleClick : 1;
  11747. bool editDoubleClick : 1;
  11748. bool lossOfFocusDiscardsChanges : 1;
  11749. bool leftOfOwnerComp : 1;
  11750. bool updateFromTextEditorContents();
  11751. void callChangeListeners();
  11752. Label (const Label&);
  11753. const Label& operator= (const Label&);
  11754. };
  11755. #endif // __JUCE_LABEL_JUCEHEADER__
  11756. /*** End of inlined file: juce_Label.h ***/
  11757. class ComboBox;
  11758. class JUCE_API ComboBoxListener
  11759. {
  11760. public:
  11761. virtual ~ComboBoxListener() {}
  11762. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11763. };
  11764. class JUCE_API ComboBox : public Component,
  11765. public SettableTooltipClient,
  11766. private LabelListener,
  11767. private AsyncUpdater,
  11768. private Value::Listener
  11769. {
  11770. public:
  11771. ComboBox (const String& componentName);
  11772. ~ComboBox();
  11773. void setEditableText (const bool isEditable);
  11774. bool isTextEditable() const throw();
  11775. void setJustificationType (const Justification& justification) throw();
  11776. const Justification getJustificationType() const throw();
  11777. void addItem (const String& newItemText,
  11778. const int newItemId) throw();
  11779. void addSeparator() throw();
  11780. void addSectionHeading (const String& headingName) throw();
  11781. void setItemEnabled (const int itemId,
  11782. const bool shouldBeEnabled) throw();
  11783. void changeItemText (const int itemId,
  11784. const String& newText) throw();
  11785. void clear (const bool dontSendChangeMessage = false);
  11786. int getNumItems() const throw();
  11787. const String getItemText (const int index) const throw();
  11788. int getItemId (const int index) const throw();
  11789. int indexOfItemId (const int itemId) const throw();
  11790. int getSelectedId() const throw();
  11791. Value& getSelectedIdAsValue() throw() { return currentId; }
  11792. void setSelectedId (const int newItemId,
  11793. const bool dontSendChangeMessage = false) throw();
  11794. int getSelectedItemIndex() const throw();
  11795. void setSelectedItemIndex (const int newItemIndex,
  11796. const bool dontSendChangeMessage = false) throw();
  11797. const String getText() const throw();
  11798. void setText (const String& newText,
  11799. const bool dontSendChangeMessage = false) throw();
  11800. void showEditor();
  11801. void addListener (ComboBoxListener* const listener) throw();
  11802. void removeListener (ComboBoxListener* const listener) throw();
  11803. void setTextWhenNothingSelected (const String& newMessage) throw();
  11804. const String getTextWhenNothingSelected() const throw();
  11805. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11806. const String getTextWhenNoChoicesAvailable() const throw();
  11807. void setTooltip (const String& newTooltip);
  11808. enum ColourIds
  11809. {
  11810. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11811. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11812. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11813. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11814. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11815. };
  11816. void labelTextChanged (Label*);
  11817. void enablementChanged();
  11818. void colourChanged();
  11819. void focusGained (Component::FocusChangeType cause);
  11820. void focusLost (Component::FocusChangeType cause);
  11821. void handleAsyncUpdate();
  11822. const String getTooltip() { return label->getTooltip(); }
  11823. void mouseDown (const MouseEvent&);
  11824. void mouseDrag (const MouseEvent&);
  11825. void mouseUp (const MouseEvent&);
  11826. void lookAndFeelChanged();
  11827. void paint (Graphics&);
  11828. void resized();
  11829. bool keyStateChanged (const bool isKeyDown);
  11830. bool keyPressed (const KeyPress&);
  11831. void valueChanged (Value&);
  11832. juce_UseDebuggingNewOperator
  11833. private:
  11834. struct ItemInfo
  11835. {
  11836. String name;
  11837. int itemId;
  11838. bool isEnabled : 1, isHeading : 1;
  11839. bool isSeparator() const throw();
  11840. bool isRealItem() const throw();
  11841. };
  11842. OwnedArray <ItemInfo> items;
  11843. Value currentId;
  11844. int lastCurrentId;
  11845. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11846. SortedSet <void*> listeners;
  11847. Label* label;
  11848. String textWhenNothingSelected, noChoicesMessage;
  11849. void showPopup();
  11850. ItemInfo* getItemForId (const int itemId) const throw();
  11851. ItemInfo* getItemForIndex (const int index) const throw();
  11852. ComboBox (const ComboBox&);
  11853. const ComboBox& operator= (const ComboBox&);
  11854. };
  11855. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11856. /*** End of inlined file: juce_ComboBox.h ***/
  11857. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11858. {
  11859. public:
  11860. AudioDeviceManager();
  11861. ~AudioDeviceManager();
  11862. struct JUCE_API AudioDeviceSetup
  11863. {
  11864. AudioDeviceSetup();
  11865. bool operator== (const AudioDeviceSetup& other) const;
  11866. String outputDeviceName;
  11867. String inputDeviceName;
  11868. double sampleRate;
  11869. int bufferSize;
  11870. BitArray inputChannels;
  11871. bool useDefaultInputChannels;
  11872. BitArray outputChannels;
  11873. bool useDefaultOutputChannels;
  11874. };
  11875. const String initialise (const int numInputChannelsNeeded,
  11876. const int numOutputChannelsNeeded,
  11877. const XmlElement* const savedState,
  11878. const bool selectDefaultDeviceOnFailure,
  11879. const String& preferredDefaultDeviceName = String::empty,
  11880. const AudioDeviceSetup* preferredSetupOptions = 0);
  11881. XmlElement* createStateXml() const;
  11882. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11883. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11884. const bool treatAsChosenDevice);
  11885. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11886. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11887. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11888. void setCurrentAudioDeviceType (const String& type,
  11889. const bool treatAsChosenDevice);
  11890. void closeAudioDevice();
  11891. void restartLastAudioDevice();
  11892. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11893. void removeAudioCallback (AudioIODeviceCallback* callback);
  11894. double getCpuUsage() const;
  11895. void setMidiInputEnabled (const String& midiInputDeviceName,
  11896. const bool enabled);
  11897. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11898. void addMidiInputCallback (const String& midiInputDeviceName,
  11899. MidiInputCallback* callback);
  11900. void removeMidiInputCallback (const String& midiInputDeviceName,
  11901. MidiInputCallback* callback);
  11902. void setDefaultMidiOutput (const String& deviceName);
  11903. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11904. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11905. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11906. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11907. void playTestSound();
  11908. void enableInputLevelMeasurement (const bool enableMeasurement);
  11909. double getCurrentInputLevel() const;
  11910. juce_UseDebuggingNewOperator
  11911. private:
  11912. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11913. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11914. AudioDeviceSetup currentSetup;
  11915. ScopedPointer <AudioIODevice> currentAudioDevice;
  11916. SortedSet <AudioIODeviceCallback*> callbacks;
  11917. int numInputChansNeeded, numOutputChansNeeded;
  11918. String currentDeviceType;
  11919. BitArray inputChannels, outputChannels;
  11920. ScopedPointer <XmlElement> lastExplicitSettings;
  11921. mutable bool listNeedsScanning;
  11922. bool useInputNames;
  11923. int inputLevelMeasurementEnabledCount;
  11924. double inputLevel;
  11925. ScopedPointer <AudioSampleBuffer> testSound;
  11926. int testSoundPosition;
  11927. AudioSampleBuffer tempBuffer;
  11928. StringArray midiInsFromXml;
  11929. OwnedArray <MidiInput> enabledMidiInputs;
  11930. Array <MidiInputCallback*> midiCallbacks;
  11931. Array <MidiInput*> midiCallbackDevices;
  11932. String defaultMidiOutputName;
  11933. ScopedPointer <MidiOutput> defaultMidiOutput;
  11934. CriticalSection audioCallbackLock, midiCallbackLock;
  11935. double cpuUsageMs, timeToCpuScale;
  11936. class CallbackHandler : public AudioIODeviceCallback,
  11937. public MidiInputCallback
  11938. {
  11939. public:
  11940. AudioDeviceManager* owner;
  11941. void audioDeviceIOCallback (const float** inputChannelData,
  11942. int totalNumInputChannels,
  11943. float** outputChannelData,
  11944. int totalNumOutputChannels,
  11945. int numSamples);
  11946. void audioDeviceAboutToStart (AudioIODevice*);
  11947. void audioDeviceStopped();
  11948. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11949. };
  11950. CallbackHandler callbackHandler;
  11951. friend class CallbackHandler;
  11952. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11953. int totalNumInputChannels,
  11954. float** outputChannelData,
  11955. int totalNumOutputChannels,
  11956. int numSamples);
  11957. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11958. void audioDeviceStoppedInt();
  11959. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11960. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11961. const BitArray& ins, const BitArray& outs);
  11962. void stopDevice();
  11963. void updateXml();
  11964. void createDeviceTypesIfNeeded();
  11965. void scanDevicesIfNeeded();
  11966. void deleteCurrentDevice();
  11967. double chooseBestSampleRate (double preferred) const;
  11968. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11969. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11970. AudioDeviceManager (const AudioDeviceManager&);
  11971. const AudioDeviceManager& operator= (const AudioDeviceManager&);
  11972. };
  11973. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11974. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11975. #endif
  11976. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11977. #endif
  11978. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11979. #endif
  11980. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11981. #endif
  11982. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11983. #endif
  11984. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11985. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11986. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11987. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11988. class JUCE_API AudioDataConverters
  11989. {
  11990. public:
  11991. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11992. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11993. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11994. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11995. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11996. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11997. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11998. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11999. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  12000. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  12001. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  12002. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  12003. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  12004. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  12005. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  12006. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  12007. enum DataFormat
  12008. {
  12009. int16LE,
  12010. int16BE,
  12011. int24LE,
  12012. int24BE,
  12013. int32LE,
  12014. int32BE,
  12015. float32LE,
  12016. float32BE,
  12017. };
  12018. static void convertFloatToFormat (const DataFormat destFormat,
  12019. const float* source, void* dest, int numSamples);
  12020. static void convertFormatToFloat (const DataFormat sourceFormat,
  12021. const void* source, float* dest, int numSamples);
  12022. static void interleaveSamples (const float** source, float* dest,
  12023. const int numSamples, const int numChannels);
  12024. static void deinterleaveSamples (const float* source, float** dest,
  12025. const int numSamples, const int numChannels);
  12026. };
  12027. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12028. /*** End of inlined file: juce_AudioDataConverters.h ***/
  12029. #endif
  12030. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  12031. #endif
  12032. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  12033. #endif
  12034. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  12035. #endif
  12036. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12037. /*** Start of inlined file: juce_MidiFile.h ***/
  12038. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12039. #define __JUCE_MIDIFILE_JUCEHEADER__
  12040. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  12041. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12042. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12043. class JUCE_API MidiMessageSequence
  12044. {
  12045. public:
  12046. MidiMessageSequence();
  12047. MidiMessageSequence (const MidiMessageSequence& other);
  12048. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  12049. ~MidiMessageSequence();
  12050. class MidiEventHolder
  12051. {
  12052. public:
  12053. ~MidiEventHolder();
  12054. MidiMessage message;
  12055. MidiEventHolder* noteOffObject;
  12056. juce_UseDebuggingNewOperator
  12057. private:
  12058. friend class MidiMessageSequence;
  12059. MidiEventHolder (const MidiMessage& message);
  12060. };
  12061. void clear();
  12062. int getNumEvents() const;
  12063. MidiEventHolder* getEventPointer (const int index) const;
  12064. double getTimeOfMatchingKeyUp (const int index) const;
  12065. int getIndexOfMatchingKeyUp (const int index) const;
  12066. int getIndexOf (MidiEventHolder* const event) const;
  12067. int getNextIndexAtTime (const double timeStamp) const;
  12068. double getStartTime() const;
  12069. double getEndTime() const;
  12070. double getEventTime (const int index) const;
  12071. void addEvent (const MidiMessage& newMessage,
  12072. double timeAdjustment = 0);
  12073. void deleteEvent (const int index,
  12074. const bool deleteMatchingNoteUp);
  12075. void addSequence (const MidiMessageSequence& other,
  12076. double timeAdjustmentDelta,
  12077. double firstAllowableDestTime,
  12078. double endOfAllowableDestTimes);
  12079. void updateMatchedPairs();
  12080. void extractMidiChannelMessages (const int channelNumberToExtract,
  12081. MidiMessageSequence& destSequence,
  12082. const bool alsoIncludeMetaEvents) const;
  12083. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12084. void deleteMidiChannelMessages (const int channelNumberToRemove);
  12085. void deleteSysExMessages();
  12086. void addTimeToMessages (const double deltaTime);
  12087. void createControllerUpdatesForTime (const int channelNumber,
  12088. const double time,
  12089. OwnedArray<MidiMessage>& resultMessages);
  12090. void swapWith (MidiMessageSequence& other) throw();
  12091. juce_UseDebuggingNewOperator
  12092. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12093. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12094. private:
  12095. friend class MidiFile;
  12096. OwnedArray <MidiEventHolder> list;
  12097. void sort();
  12098. };
  12099. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12100. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12101. class JUCE_API MidiFile
  12102. {
  12103. public:
  12104. MidiFile() throw();
  12105. ~MidiFile() throw();
  12106. int getNumTracks() const throw();
  12107. const MidiMessageSequence* getTrack (const int index) const throw();
  12108. void addTrack (const MidiMessageSequence& trackSequence) throw();
  12109. void clear() throw();
  12110. short getTimeFormat() const throw();
  12111. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12112. void setSmpteTimeFormat (const int framesPerSecond,
  12113. const int subframeResolution) throw();
  12114. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12115. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12116. double getLastTimestamp() const;
  12117. bool readFrom (InputStream& sourceStream);
  12118. bool writeTo (OutputStream& destStream);
  12119. void convertTimestampTicksToSeconds();
  12120. juce_UseDebuggingNewOperator
  12121. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12122. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12123. private:
  12124. OwnedArray <MidiMessageSequence> tracks;
  12125. short timeFormat;
  12126. MidiFile (const MidiFile&);
  12127. const MidiFile& operator= (const MidiFile&);
  12128. void readNextTrack (const char* data, int size);
  12129. void writeTrack (OutputStream& mainOut, const int trackNum);
  12130. };
  12131. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12132. /*** End of inlined file: juce_MidiFile.h ***/
  12133. #endif
  12134. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12135. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12136. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12137. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12138. class MidiKeyboardState;
  12139. class JUCE_API MidiKeyboardStateListener
  12140. {
  12141. public:
  12142. MidiKeyboardStateListener() throw() {}
  12143. virtual ~MidiKeyboardStateListener() {}
  12144. virtual void handleNoteOn (MidiKeyboardState* source,
  12145. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12146. virtual void handleNoteOff (MidiKeyboardState* source,
  12147. int midiChannel, int midiNoteNumber) = 0;
  12148. };
  12149. class JUCE_API MidiKeyboardState
  12150. {
  12151. public:
  12152. MidiKeyboardState();
  12153. ~MidiKeyboardState();
  12154. void reset();
  12155. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12156. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12157. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12158. void noteOff (const int midiChannel, const int midiNoteNumber);
  12159. void allNotesOff (const int midiChannel);
  12160. void processNextMidiEvent (const MidiMessage& message);
  12161. void processNextMidiBuffer (MidiBuffer& buffer,
  12162. const int startSample,
  12163. const int numSamples,
  12164. const bool injectIndirectEvents);
  12165. void addListener (MidiKeyboardStateListener* const listener) throw();
  12166. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12167. juce_UseDebuggingNewOperator
  12168. private:
  12169. CriticalSection lock;
  12170. uint16 noteStates [128];
  12171. MidiBuffer eventsToAdd;
  12172. VoidArray listeners;
  12173. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12174. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12175. MidiKeyboardState (const MidiKeyboardState&);
  12176. const MidiKeyboardState& operator= (const MidiKeyboardState&);
  12177. };
  12178. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12179. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12180. #endif
  12181. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12182. #endif
  12183. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12184. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12185. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12186. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12187. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12188. public MidiInputCallback
  12189. {
  12190. public:
  12191. MidiMessageCollector();
  12192. ~MidiMessageCollector();
  12193. void reset (const double sampleRate);
  12194. void addMessageToQueue (const MidiMessage& message);
  12195. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12196. const int numSamples);
  12197. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12198. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12199. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12200. juce_UseDebuggingNewOperator
  12201. private:
  12202. double lastCallbackTime;
  12203. CriticalSection midiCallbackLock;
  12204. MidiBuffer incomingMessages;
  12205. double sampleRate;
  12206. MidiMessageCollector (const MidiMessageCollector&);
  12207. const MidiMessageCollector& operator= (const MidiMessageCollector&);
  12208. };
  12209. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12210. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12211. #endif
  12212. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12213. #endif
  12214. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12215. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12216. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12217. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12218. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12219. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12220. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12221. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12222. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12223. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12224. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12225. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12226. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12227. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12228. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12229. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12230. class AudioProcessor;
  12231. class JUCE_API AudioProcessorEditor : public Component
  12232. {
  12233. protected:
  12234. AudioProcessorEditor (AudioProcessor* const owner);
  12235. public:
  12236. ~AudioProcessorEditor();
  12237. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12238. private:
  12239. AudioProcessor* const owner;
  12240. };
  12241. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12242. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12243. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12244. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12245. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12246. class AudioProcessor;
  12247. class JUCE_API AudioProcessorListener
  12248. {
  12249. public:
  12250. virtual ~AudioProcessorListener() {}
  12251. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12252. int parameterIndex,
  12253. float newValue) = 0;
  12254. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12255. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12256. int parameterIndex);
  12257. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12258. int parameterIndex);
  12259. };
  12260. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12261. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12262. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12263. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12264. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12265. class JUCE_API AudioPlayHead
  12266. {
  12267. protected:
  12268. AudioPlayHead() {}
  12269. public:
  12270. virtual ~AudioPlayHead() {}
  12271. enum FrameRateType
  12272. {
  12273. fps24 = 0,
  12274. fps25 = 1,
  12275. fps2997 = 2,
  12276. fps30 = 3,
  12277. fps2997drop = 4,
  12278. fps30drop = 5,
  12279. fpsUnknown = 99
  12280. };
  12281. struct CurrentPositionInfo
  12282. {
  12283. double bpm;
  12284. int timeSigNumerator;
  12285. int timeSigDenominator;
  12286. double timeInSeconds;
  12287. double editOriginTime;
  12288. double ppqPosition;
  12289. double ppqPositionOfLastBarStart;
  12290. FrameRateType frameRate;
  12291. bool isPlaying;
  12292. bool isRecording;
  12293. };
  12294. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12295. };
  12296. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12297. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12298. class JUCE_API AudioProcessor
  12299. {
  12300. protected:
  12301. AudioProcessor();
  12302. public:
  12303. virtual ~AudioProcessor();
  12304. virtual const String getName() const = 0;
  12305. virtual void prepareToPlay (double sampleRate,
  12306. int estimatedSamplesPerBlock) = 0;
  12307. virtual void releaseResources() = 0;
  12308. virtual void processBlock (AudioSampleBuffer& buffer,
  12309. MidiBuffer& midiMessages) = 0;
  12310. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12311. double getSampleRate() const throw() { return sampleRate; }
  12312. int getBlockSize() const throw() { return blockSize; }
  12313. int getNumInputChannels() const throw() { return numInputChannels; }
  12314. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12315. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12316. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12317. virtual bool isInputChannelStereoPair (int index) const = 0;
  12318. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12319. int getLatencySamples() const throw() { return latencySamples; }
  12320. void setLatencySamples (const int newLatency);
  12321. virtual bool acceptsMidi() const = 0;
  12322. virtual bool producesMidi() const = 0;
  12323. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12324. void suspendProcessing (const bool shouldBeSuspended);
  12325. bool isSuspended() const throw() { return suspended; }
  12326. virtual void reset();
  12327. bool isNonRealtime() const throw() { return nonRealtime; }
  12328. void setNonRealtime (const bool isNonRealtime) throw();
  12329. virtual AudioProcessorEditor* createEditor() = 0;
  12330. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12331. AudioProcessorEditor* createEditorIfNeeded();
  12332. virtual int getNumParameters() = 0;
  12333. virtual const String getParameterName (int parameterIndex) = 0;
  12334. virtual float getParameter (int parameterIndex) = 0;
  12335. virtual const String getParameterText (int parameterIndex) = 0;
  12336. virtual void setParameter (int parameterIndex,
  12337. float newValue) = 0;
  12338. void setParameterNotifyingHost (int parameterIndex,
  12339. float newValue);
  12340. virtual bool isParameterAutomatable (int parameterIndex) const;
  12341. virtual bool isMetaParameter (int parameterIndex) const;
  12342. void beginParameterChangeGesture (int parameterIndex);
  12343. void endParameterChangeGesture (int parameterIndex);
  12344. void updateHostDisplay();
  12345. virtual int getNumPrograms() = 0;
  12346. virtual int getCurrentProgram() = 0;
  12347. virtual void setCurrentProgram (int index) = 0;
  12348. virtual const String getProgramName (int index) = 0;
  12349. virtual void changeProgramName (int index, const String& newName) = 0;
  12350. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12351. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12352. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12353. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12354. void addListener (AudioProcessorListener* const newListener) throw();
  12355. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12356. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12357. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12358. void setPlayConfigDetails (const int numIns, const int numOuts,
  12359. const double sampleRate,
  12360. const int blockSize) throw();
  12361. juce_UseDebuggingNewOperator
  12362. protected:
  12363. static void copyXmlToBinary (const XmlElement& xml,
  12364. JUCE_NAMESPACE::MemoryBlock& destData);
  12365. static XmlElement* getXmlFromBinary (const void* data,
  12366. const int sizeInBytes);
  12367. AudioPlayHead* playHead;
  12368. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12369. private:
  12370. VoidArray listeners;
  12371. AudioProcessorEditor* activeEditor;
  12372. double sampleRate;
  12373. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12374. bool suspended, nonRealtime;
  12375. CriticalSection callbackLock, listenerLock;
  12376. #ifdef JUCE_DEBUG
  12377. BitArray changingParams;
  12378. #endif
  12379. AudioProcessor (const AudioProcessor&);
  12380. const AudioProcessor& operator= (const AudioProcessor&);
  12381. };
  12382. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12383. /*** End of inlined file: juce_AudioProcessor.h ***/
  12384. /*** Start of inlined file: juce_PluginDescription.h ***/
  12385. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12386. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12387. class JUCE_API PluginDescription
  12388. {
  12389. public:
  12390. PluginDescription() throw();
  12391. PluginDescription (const PluginDescription& other) throw();
  12392. const PluginDescription& operator= (const PluginDescription& other) throw();
  12393. ~PluginDescription() throw();
  12394. String name;
  12395. String pluginFormatName;
  12396. String category;
  12397. String manufacturerName;
  12398. String version;
  12399. String fileOrIdentifier;
  12400. Time lastFileModTime;
  12401. int uid;
  12402. bool isInstrument;
  12403. int numInputChannels;
  12404. int numOutputChannels;
  12405. bool isDuplicateOf (const PluginDescription& other) const;
  12406. const String createIdentifierString() const throw();
  12407. XmlElement* createXml() const;
  12408. bool loadFromXml (const XmlElement& xml);
  12409. juce_UseDebuggingNewOperator
  12410. };
  12411. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12412. /*** End of inlined file: juce_PluginDescription.h ***/
  12413. class JUCE_API AudioPluginInstance : public AudioProcessor
  12414. {
  12415. public:
  12416. virtual ~AudioPluginInstance();
  12417. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12418. juce_UseDebuggingNewOperator
  12419. protected:
  12420. AudioPluginInstance();
  12421. AudioPluginInstance (const AudioPluginInstance&);
  12422. const AudioPluginInstance& operator= (const AudioPluginInstance&);
  12423. };
  12424. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12425. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12426. class PluginDescription;
  12427. class JUCE_API AudioPluginFormat
  12428. {
  12429. public:
  12430. virtual ~AudioPluginFormat();
  12431. virtual const String getName() const = 0;
  12432. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12433. const String& fileOrIdentifier) = 0;
  12434. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12435. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12436. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12437. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12438. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12439. const bool recursive) = 0;
  12440. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12441. juce_UseDebuggingNewOperator
  12442. protected:
  12443. AudioPluginFormat() throw();
  12444. AudioPluginFormat (const AudioPluginFormat&);
  12445. const AudioPluginFormat& operator= (const AudioPluginFormat&);
  12446. };
  12447. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12448. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12449. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12450. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12451. {
  12452. public:
  12453. AudioUnitPluginFormat();
  12454. ~AudioUnitPluginFormat();
  12455. const String getName() const { return "AudioUnit"; }
  12456. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12457. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12458. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12459. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12460. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12461. bool doesPluginStillExist (const PluginDescription& desc);
  12462. const FileSearchPath getDefaultLocationsToSearch();
  12463. juce_UseDebuggingNewOperator
  12464. private:
  12465. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12466. const AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12467. };
  12468. #endif
  12469. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12470. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12471. #endif
  12472. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12473. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12474. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12475. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12476. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12477. // Sorry, this file is just a placeholder at the moment!...
  12478. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12479. {
  12480. public:
  12481. DirectXPluginFormat();
  12482. ~DirectXPluginFormat();
  12483. const String getName() const { return "DirectX"; }
  12484. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12485. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12486. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12487. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12488. const FileSearchPath getDefaultLocationsToSearch();
  12489. juce_UseDebuggingNewOperator
  12490. private:
  12491. DirectXPluginFormat (const DirectXPluginFormat&);
  12492. const DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12493. };
  12494. #endif
  12495. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12496. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12497. #endif
  12498. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12499. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12500. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12501. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12502. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12503. // Sorry, this file is just a placeholder at the moment!...
  12504. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12505. {
  12506. public:
  12507. LADSPAPluginFormat();
  12508. ~LADSPAPluginFormat();
  12509. const String getName() const { return "LADSPA"; }
  12510. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12511. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12512. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12513. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12514. const FileSearchPath getDefaultLocationsToSearch();
  12515. juce_UseDebuggingNewOperator
  12516. private:
  12517. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12518. const LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12519. };
  12520. #endif
  12521. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12522. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12523. #endif
  12524. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12525. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12526. #ifdef __aeffect__
  12527. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12528. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12529. class VSTMidiEventList
  12530. {
  12531. public:
  12532. VSTMidiEventList()
  12533. : numEventsUsed (0), numEventsAllocated (0)
  12534. {
  12535. }
  12536. ~VSTMidiEventList()
  12537. {
  12538. freeEvents();
  12539. }
  12540. void clear()
  12541. {
  12542. numEventsUsed = 0;
  12543. if (events != 0)
  12544. events->numEvents = 0;
  12545. }
  12546. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12547. {
  12548. ensureSize (numEventsUsed + 1);
  12549. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12550. events->numEvents = ++numEventsUsed;
  12551. if (numBytes <= 4)
  12552. {
  12553. if (e->type == kVstSysExType)
  12554. {
  12555. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12556. e->type = kVstMidiType;
  12557. e->byteSize = sizeof (VstMidiEvent);
  12558. e->noteLength = 0;
  12559. e->noteOffset = 0;
  12560. e->detune = 0;
  12561. e->noteOffVelocity = 0;
  12562. }
  12563. e->deltaFrames = frameOffset;
  12564. memcpy (e->midiData, midiData, numBytes);
  12565. }
  12566. else
  12567. {
  12568. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12569. if (se->type == kVstSysExType)
  12570. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12571. else
  12572. se->sysexDump = (char*) juce_malloc (numBytes);
  12573. memcpy (se->sysexDump, midiData, numBytes);
  12574. se->type = kVstSysExType;
  12575. se->byteSize = sizeof (VstMidiSysexEvent);
  12576. se->deltaFrames = frameOffset;
  12577. se->flags = 0;
  12578. se->dumpBytes = numBytes;
  12579. se->resvd1 = 0;
  12580. se->resvd2 = 0;
  12581. }
  12582. }
  12583. // Handy method to pull the events out of an event buffer supplied by the host
  12584. // or plugin.
  12585. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12586. {
  12587. for (int i = 0; i < events->numEvents; ++i)
  12588. {
  12589. const VstEvent* const e = events->events[i];
  12590. if (e != 0)
  12591. {
  12592. if (e->type == kVstMidiType)
  12593. {
  12594. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12595. 4, e->deltaFrames);
  12596. }
  12597. else if (e->type == kVstSysExType)
  12598. {
  12599. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12600. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12601. e->deltaFrames);
  12602. }
  12603. }
  12604. }
  12605. }
  12606. void ensureSize (int numEventsNeeded)
  12607. {
  12608. if (numEventsNeeded > numEventsAllocated)
  12609. {
  12610. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12611. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12612. if (events == 0)
  12613. events.calloc (size, 1);
  12614. else
  12615. events.realloc (size, 1);
  12616. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12617. {
  12618. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12619. (int) sizeof (VstMidiSysexEvent)));
  12620. e->type = kVstMidiType;
  12621. e->byteSize = sizeof (VstMidiEvent);
  12622. events->events[i] = (VstEvent*) e;
  12623. }
  12624. numEventsAllocated = numEventsNeeded;
  12625. }
  12626. }
  12627. void freeEvents()
  12628. {
  12629. if (events != 0)
  12630. {
  12631. for (int i = numEventsAllocated; --i >= 0;)
  12632. {
  12633. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12634. if (e->type == kVstSysExType)
  12635. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12636. juce_free (e);
  12637. }
  12638. events.free();
  12639. numEventsUsed = 0;
  12640. numEventsAllocated = 0;
  12641. }
  12642. }
  12643. HeapBlock <VstEvents> events;
  12644. private:
  12645. int numEventsUsed, numEventsAllocated;
  12646. };
  12647. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12648. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12649. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12650. #endif
  12651. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12652. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12653. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12654. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12655. #if JUCE_PLUGINHOST_VST
  12656. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12657. {
  12658. public:
  12659. VSTPluginFormat();
  12660. ~VSTPluginFormat();
  12661. const String getName() const { return "VST"; }
  12662. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12663. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12664. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12665. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12666. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12667. bool doesPluginStillExist (const PluginDescription& desc);
  12668. const FileSearchPath getDefaultLocationsToSearch();
  12669. juce_UseDebuggingNewOperator
  12670. private:
  12671. VSTPluginFormat (const VSTPluginFormat&);
  12672. const VSTPluginFormat& operator= (const VSTPluginFormat&);
  12673. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12674. };
  12675. #endif
  12676. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12677. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12678. #endif
  12679. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12680. #endif
  12681. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12682. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12683. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12684. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12685. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12686. {
  12687. public:
  12688. AudioPluginFormatManager() throw();
  12689. ~AudioPluginFormatManager() throw();
  12690. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12691. void addDefaultFormats();
  12692. int getNumFormats() throw();
  12693. AudioPluginFormat* getFormat (const int index) throw();
  12694. void addFormat (AudioPluginFormat* const format) throw();
  12695. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12696. String& errorMessage) const;
  12697. bool doesPluginStillExist (const PluginDescription& description) const;
  12698. juce_UseDebuggingNewOperator
  12699. private:
  12700. OwnedArray <AudioPluginFormat> formats;
  12701. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12702. const AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12703. };
  12704. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12705. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12706. #endif
  12707. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12708. #endif
  12709. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12710. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12711. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12712. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12713. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12714. {
  12715. public:
  12716. KnownPluginList();
  12717. ~KnownPluginList();
  12718. void clear();
  12719. int getNumTypes() const throw() { return types.size(); }
  12720. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12721. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12722. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12723. bool addType (const PluginDescription& type);
  12724. void removeType (const int index) throw();
  12725. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12726. const bool dontRescanIfAlreadyInList,
  12727. OwnedArray <PluginDescription>& typesFound,
  12728. AudioPluginFormat& formatToUse);
  12729. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12730. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12731. OwnedArray <PluginDescription>& typesFound);
  12732. enum SortMethod
  12733. {
  12734. defaultOrder = 0,
  12735. sortAlphabetically,
  12736. sortByCategory,
  12737. sortByManufacturer,
  12738. sortByFileSystemLocation
  12739. };
  12740. void addToMenu (PopupMenu& menu,
  12741. const SortMethod sortMethod) const;
  12742. int getIndexChosenByMenu (const int menuResultCode) const;
  12743. void sort (const SortMethod method);
  12744. XmlElement* createXml() const;
  12745. void recreateFromXml (const XmlElement& xml);
  12746. juce_UseDebuggingNewOperator
  12747. private:
  12748. OwnedArray <PluginDescription> types;
  12749. KnownPluginList (const KnownPluginList&);
  12750. const KnownPluginList& operator= (const KnownPluginList&);
  12751. };
  12752. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12753. /*** End of inlined file: juce_KnownPluginList.h ***/
  12754. #endif
  12755. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12756. #endif
  12757. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12758. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12759. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12760. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12761. class JUCE_API PluginDirectoryScanner
  12762. {
  12763. public:
  12764. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12765. AudioPluginFormat& formatToLookFor,
  12766. FileSearchPath directoriesToSearch,
  12767. const bool searchRecursively,
  12768. const File& deadMansPedalFile);
  12769. ~PluginDirectoryScanner();
  12770. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12771. const String getNextPluginFileThatWillBeScanned() const throw();
  12772. float getProgress() const { return progress; }
  12773. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12774. juce_UseDebuggingNewOperator
  12775. private:
  12776. KnownPluginList& list;
  12777. AudioPluginFormat& format;
  12778. StringArray filesOrIdentifiersToScan;
  12779. File deadMansPedalFile;
  12780. StringArray failedFiles;
  12781. int nextIndex;
  12782. float progress;
  12783. const StringArray getDeadMansPedalFile() throw();
  12784. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12785. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12786. const PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12787. };
  12788. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12789. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12790. #endif
  12791. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12792. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12793. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12794. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12795. /*** Start of inlined file: juce_ListBox.h ***/
  12796. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12797. #define __JUCE_LISTBOX_JUCEHEADER__
  12798. class ListViewport;
  12799. class JUCE_API ListBoxModel
  12800. {
  12801. public:
  12802. virtual ~ListBoxModel() {}
  12803. virtual int getNumRows() = 0;
  12804. virtual void paintListBoxItem (int rowNumber,
  12805. Graphics& g,
  12806. int width, int height,
  12807. bool rowIsSelected) = 0;
  12808. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12809. Component* existingComponentToUpdate);
  12810. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12811. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12812. virtual void backgroundClicked();
  12813. virtual void selectedRowsChanged (int lastRowSelected);
  12814. virtual void deleteKeyPressed (int lastRowSelected);
  12815. virtual void returnKeyPressed (int lastRowSelected);
  12816. virtual void listWasScrolled();
  12817. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12818. virtual const String getTooltipForRow (int row);
  12819. };
  12820. class JUCE_API ListBox : public Component,
  12821. public SettableTooltipClient
  12822. {
  12823. public:
  12824. ListBox (const String& componentName,
  12825. ListBoxModel* const model);
  12826. ~ListBox();
  12827. void setModel (ListBoxModel* const newModel);
  12828. ListBoxModel* getModel() const throw() { return model; }
  12829. void updateContent();
  12830. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12831. void setMouseMoveSelectsRows (bool shouldSelect);
  12832. void selectRow (const int rowNumber,
  12833. bool dontScrollToShowThisRow = false,
  12834. bool deselectOthersFirst = true);
  12835. void selectRangeOfRows (int firstRow,
  12836. int lastRow);
  12837. void deselectRow (const int rowNumber);
  12838. void deselectAllRows();
  12839. void flipRowSelection (const int rowNumber);
  12840. const SparseSet<int> getSelectedRows() const;
  12841. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12842. const bool sendNotificationEventToModel = true);
  12843. bool isRowSelected (const int rowNumber) const;
  12844. int getNumSelectedRows() const;
  12845. int getSelectedRow (const int index = 0) const;
  12846. int getLastRowSelected() const;
  12847. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12848. const ModifierKeys& modifiers);
  12849. void setVerticalPosition (const double newProportion);
  12850. double getVerticalPosition() const;
  12851. void scrollToEnsureRowIsOnscreen (const int row);
  12852. ScrollBar* getVerticalScrollBar() const throw();
  12853. ScrollBar* getHorizontalScrollBar() const throw();
  12854. int getRowContainingPosition (const int x, const int y) const throw();
  12855. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12856. const Rectangle<int> getRowPosition (const int rowNumber,
  12857. const bool relativeToComponentTopLeft) const throw();
  12858. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12859. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12860. int getVisibleRowWidth() const throw();
  12861. void setRowHeight (const int newHeight);
  12862. int getRowHeight() const throw() { return rowHeight; }
  12863. int getNumRowsOnScreen() const throw();
  12864. enum ColourIds
  12865. {
  12866. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12867. Make this transparent if you don't want the background to be filled. */
  12868. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12869. Make this transparent to not have an outline. */
  12870. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12871. };
  12872. void setOutlineThickness (const int outlineThickness);
  12873. int getOutlineThickness() const throw() { return outlineThickness; }
  12874. void setHeaderComponent (Component* const newHeaderComponent);
  12875. void setMinimumContentWidth (const int newMinimumWidth);
  12876. int getVisibleContentWidth() const throw();
  12877. void repaintRow (const int rowNumber) throw();
  12878. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12879. Viewport* getViewport() const throw();
  12880. bool keyPressed (const KeyPress& key);
  12881. bool keyStateChanged (const bool isKeyDown);
  12882. void paint (Graphics& g);
  12883. void paintOverChildren (Graphics& g);
  12884. void resized();
  12885. void visibilityChanged();
  12886. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12887. void mouseMove (const MouseEvent&);
  12888. void mouseExit (const MouseEvent&);
  12889. void mouseUp (const MouseEvent&);
  12890. void colourChanged();
  12891. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12892. juce_UseDebuggingNewOperator
  12893. private:
  12894. friend class ListViewport;
  12895. friend class TableListBox;
  12896. ListBoxModel* model;
  12897. ListViewport* viewport;
  12898. Component* headerComponent;
  12899. int totalItems, rowHeight, minimumRowWidth;
  12900. int outlineThickness;
  12901. int lastRowSelected;
  12902. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12903. SparseSet <int> selected;
  12904. void selectRowInternal (const int rowNumber,
  12905. bool dontScrollToShowThisRow,
  12906. bool deselectOthersFirst,
  12907. bool isMouseClick);
  12908. ListBox (const ListBox&);
  12909. const ListBox& operator= (const ListBox&);
  12910. };
  12911. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12912. /*** End of inlined file: juce_ListBox.h ***/
  12913. /*** Start of inlined file: juce_TextButton.h ***/
  12914. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12915. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12916. class JUCE_API TextButton : public Button
  12917. {
  12918. public:
  12919. TextButton (const String& buttonName,
  12920. const String& toolTip = String::empty);
  12921. ~TextButton();
  12922. enum ColourIds
  12923. {
  12924. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12925. 'off'). The look-and-feel class might re-interpret this to add
  12926. effects, etc. */
  12927. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12928. 'on'). The look-and-feel class might re-interpret this to add
  12929. effects, etc. */
  12930. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12931. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12932. };
  12933. void changeWidthToFitText (const int newHeight = -1);
  12934. virtual const Font getFont();
  12935. juce_UseDebuggingNewOperator
  12936. protected:
  12937. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12938. void colourChanged();
  12939. private:
  12940. TextButton (const TextButton&);
  12941. const TextButton& operator= (const TextButton&);
  12942. };
  12943. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12944. /*** End of inlined file: juce_TextButton.h ***/
  12945. class JUCE_API PluginListComponent : public Component,
  12946. public ListBoxModel,
  12947. public ChangeListener,
  12948. public ButtonListener,
  12949. public Timer
  12950. {
  12951. public:
  12952. PluginListComponent (KnownPluginList& listToRepresent,
  12953. const File& deadMansPedalFile,
  12954. PropertiesFile* const propertiesToUse);
  12955. ~PluginListComponent();
  12956. void resized();
  12957. bool isInterestedInFileDrag (const StringArray& files);
  12958. void filesDropped (const StringArray& files, int, int);
  12959. int getNumRows();
  12960. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12961. void deleteKeyPressed (int lastRowSelected);
  12962. void buttonClicked (Button* b);
  12963. void changeListenerCallback (void*);
  12964. void timerCallback();
  12965. juce_UseDebuggingNewOperator
  12966. private:
  12967. KnownPluginList& list;
  12968. File deadMansPedalFile;
  12969. ListBox* listBox;
  12970. TextButton* optionsButton;
  12971. PropertiesFile* propertiesToUse;
  12972. int typeToScan;
  12973. void scanFor (AudioPluginFormat* format);
  12974. PluginListComponent (const PluginListComponent&);
  12975. const PluginListComponent& operator= (const PluginListComponent&);
  12976. };
  12977. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12978. /*** End of inlined file: juce_PluginListComponent.h ***/
  12979. #endif
  12980. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12981. #endif
  12982. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12983. #endif
  12984. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12985. #endif
  12986. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12987. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12988. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12989. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12990. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12991. public AsyncUpdater
  12992. {
  12993. public:
  12994. AudioProcessorGraph();
  12995. ~AudioProcessorGraph();
  12996. class JUCE_API Node : public ReferenceCountedObject
  12997. {
  12998. public:
  12999. ~Node();
  13000. const uint32 id;
  13001. AudioProcessor* const processor;
  13002. NamedValueSet properties;
  13003. typedef ReferenceCountedObjectPtr <Node> Ptr;
  13004. juce_UseDebuggingNewOperator
  13005. private:
  13006. friend class AudioProcessorGraph;
  13007. bool isPrepared;
  13008. Node (const uint32 id, AudioProcessor* const processor);
  13009. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  13010. void unprepare();
  13011. Node (const Node&);
  13012. const Node& operator= (const Node&);
  13013. };
  13014. struct JUCE_API Connection
  13015. {
  13016. public:
  13017. uint32 sourceNodeId;
  13018. int sourceChannelIndex;
  13019. uint32 destNodeId;
  13020. int destChannelIndex;
  13021. juce_UseDebuggingNewOperator
  13022. private:
  13023. };
  13024. void clear();
  13025. int getNumNodes() const { return nodes.size(); }
  13026. Node* getNode (const int index) const { return nodes [index]; }
  13027. Node* getNodeForId (const uint32 nodeId) const;
  13028. Node* addNode (AudioProcessor* const newProcessor,
  13029. uint32 nodeId = 0);
  13030. bool removeNode (const uint32 nodeId);
  13031. int getNumConnections() const { return connections.size(); }
  13032. const Connection* getConnection (const int index) const { return connections [index]; }
  13033. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  13034. const int sourceChannelIndex,
  13035. const uint32 destNodeId,
  13036. const int destChannelIndex) const;
  13037. bool isConnected (const uint32 possibleSourceNodeId,
  13038. const uint32 possibleDestNodeId) const;
  13039. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  13040. const uint32 destNodeId, const int destChannelIndex) const;
  13041. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  13042. const uint32 destNodeId, const int destChannelIndex);
  13043. void removeConnection (const int index);
  13044. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  13045. const uint32 destNodeId, const int destChannelIndex);
  13046. bool disconnectNode (const uint32 nodeId);
  13047. bool removeIllegalConnections();
  13048. static const int midiChannelIndex;
  13049. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13050. {
  13051. public:
  13052. enum IODeviceType
  13053. {
  13054. audioInputNode, /**< In this mode, the processor has output channels
  13055. representing all the audio input channels that are
  13056. coming into its parent audio graph. */
  13057. audioOutputNode, /**< In this mode, the processor has input channels
  13058. representing all the audio output channels that are
  13059. going out of its parent audio graph. */
  13060. midiInputNode, /**< In this mode, the processor has a midi output which
  13061. delivers the same midi data that is arriving at its
  13062. parent graph. */
  13063. midiOutputNode /**< In this mode, the processor has a midi input and
  13064. any data sent to it will be passed out of the parent
  13065. graph. */
  13066. };
  13067. IODeviceType getType() const { return type; }
  13068. AudioProcessorGraph* getParentGraph() const { return graph; }
  13069. bool isInput() const;
  13070. bool isOutput() const;
  13071. AudioGraphIOProcessor (const IODeviceType type);
  13072. ~AudioGraphIOProcessor();
  13073. const String getName() const;
  13074. void fillInPluginDescription (PluginDescription& d) const;
  13075. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13076. void releaseResources();
  13077. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13078. const String getInputChannelName (const int channelIndex) const;
  13079. const String getOutputChannelName (const int channelIndex) const;
  13080. bool isInputChannelStereoPair (int index) const;
  13081. bool isOutputChannelStereoPair (int index) const;
  13082. bool acceptsMidi() const;
  13083. bool producesMidi() const;
  13084. AudioProcessorEditor* createEditor();
  13085. int getNumParameters();
  13086. const String getParameterName (int);
  13087. float getParameter (int);
  13088. const String getParameterText (int);
  13089. void setParameter (int, float);
  13090. int getNumPrograms();
  13091. int getCurrentProgram();
  13092. void setCurrentProgram (int);
  13093. const String getProgramName (int);
  13094. void changeProgramName (int, const String&);
  13095. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13096. void setStateInformation (const void* data, int sizeInBytes);
  13097. void setParentGraph (AudioProcessorGraph* const graph);
  13098. juce_UseDebuggingNewOperator
  13099. private:
  13100. const IODeviceType type;
  13101. AudioProcessorGraph* graph;
  13102. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13103. const AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13104. };
  13105. // AudioProcessor methods:
  13106. const String getName() const;
  13107. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13108. void releaseResources();
  13109. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13110. const String getInputChannelName (const int channelIndex) const;
  13111. const String getOutputChannelName (const int channelIndex) const;
  13112. bool isInputChannelStereoPair (int index) const;
  13113. bool isOutputChannelStereoPair (int index) const;
  13114. bool acceptsMidi() const;
  13115. bool producesMidi() const;
  13116. AudioProcessorEditor* createEditor() { return 0; }
  13117. int getNumParameters() { return 0; }
  13118. const String getParameterName (int) { return String::empty; }
  13119. float getParameter (int) { return 0; }
  13120. const String getParameterText (int) { return String::empty; }
  13121. void setParameter (int, float) { }
  13122. int getNumPrograms() { return 0; }
  13123. int getCurrentProgram() { return 0; }
  13124. void setCurrentProgram (int) { }
  13125. const String getProgramName (int) { return String::empty; }
  13126. void changeProgramName (int, const String&) { }
  13127. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13128. void setStateInformation (const void* data, int sizeInBytes);
  13129. void handleAsyncUpdate();
  13130. juce_UseDebuggingNewOperator
  13131. private:
  13132. ReferenceCountedArray <Node> nodes;
  13133. OwnedArray <Connection> connections;
  13134. int lastNodeId;
  13135. AudioSampleBuffer renderingBuffers;
  13136. OwnedArray <MidiBuffer> midiBuffers;
  13137. CriticalSection renderLock;
  13138. VoidArray renderingOps;
  13139. friend class AudioGraphIOProcessor;
  13140. AudioSampleBuffer* currentAudioInputBuffer;
  13141. AudioSampleBuffer currentAudioOutputBuffer;
  13142. MidiBuffer* currentMidiInputBuffer;
  13143. MidiBuffer currentMidiOutputBuffer;
  13144. void clearRenderingSequence();
  13145. void buildRenderingSequence();
  13146. bool isAnInputTo (const uint32 possibleInputId,
  13147. const uint32 possibleDestinationId,
  13148. const int recursionCheck) const;
  13149. AudioProcessorGraph (const AudioProcessorGraph&);
  13150. const AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13151. };
  13152. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13153. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13154. #endif
  13155. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13156. #endif
  13157. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13158. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13159. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13160. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13161. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13162. public MidiInputCallback
  13163. {
  13164. public:
  13165. AudioProcessorPlayer();
  13166. virtual ~AudioProcessorPlayer();
  13167. void setProcessor (AudioProcessor* const processorToPlay);
  13168. AudioProcessor* getCurrentProcessor() const { return processor; }
  13169. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13170. void audioDeviceIOCallback (const float** inputChannelData,
  13171. int totalNumInputChannels,
  13172. float** outputChannelData,
  13173. int totalNumOutputChannels,
  13174. int numSamples);
  13175. void audioDeviceAboutToStart (AudioIODevice* device);
  13176. void audioDeviceStopped();
  13177. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13178. juce_UseDebuggingNewOperator
  13179. private:
  13180. AudioProcessor* processor;
  13181. CriticalSection lock;
  13182. double sampleRate;
  13183. int blockSize;
  13184. bool isPrepared;
  13185. int numInputChans, numOutputChans;
  13186. float* channels [128];
  13187. AudioSampleBuffer tempBuffer;
  13188. MidiBuffer incomingMidi;
  13189. MidiMessageCollector messageCollector;
  13190. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13191. const AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13192. };
  13193. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13194. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13195. #endif
  13196. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13197. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13198. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13199. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13200. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13201. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13202. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13203. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13204. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13205. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13206. class EditableProperty;
  13207. class JUCE_API PropertyComponent : public Component,
  13208. public SettableTooltipClient
  13209. {
  13210. public:
  13211. PropertyComponent (const String& propertyName,
  13212. const int preferredHeight = 25);
  13213. ~PropertyComponent();
  13214. int getPreferredHeight() const throw() { return preferredHeight; }
  13215. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13216. virtual void refresh() = 0;
  13217. void paint (Graphics& g);
  13218. void resized();
  13219. void enablementChanged();
  13220. juce_UseDebuggingNewOperator
  13221. protected:
  13222. int preferredHeight;
  13223. };
  13224. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13225. /*** End of inlined file: juce_PropertyComponent.h ***/
  13226. class JUCE_API PropertyPanel : public Component
  13227. {
  13228. public:
  13229. PropertyPanel();
  13230. ~PropertyPanel();
  13231. void clear();
  13232. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13233. void addSection (const String& sectionTitle,
  13234. const Array <PropertyComponent*>& newPropertyComponents,
  13235. const bool shouldSectionInitiallyBeOpen = true);
  13236. void refreshAll() const;
  13237. const StringArray getSectionNames() const;
  13238. bool isSectionOpen (const int sectionIndex) const;
  13239. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  13240. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  13241. XmlElement* getOpennessState() const;
  13242. void restoreOpennessState (const XmlElement& newState);
  13243. void setMessageWhenEmpty (const String& newMessage);
  13244. const String& getMessageWhenEmpty() const;
  13245. void paint (Graphics& g);
  13246. void resized();
  13247. juce_UseDebuggingNewOperator
  13248. private:
  13249. Viewport* viewport;
  13250. Component* propertyHolderComponent;
  13251. String messageWhenEmpty;
  13252. void updatePropHolderLayout() const;
  13253. void updatePropHolderLayout (const int width) const;
  13254. };
  13255. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13256. /*** End of inlined file: juce_PropertyPanel.h ***/
  13257. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13258. {
  13259. public:
  13260. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13261. ~GenericAudioProcessorEditor();
  13262. void paint (Graphics& g);
  13263. void resized();
  13264. juce_UseDebuggingNewOperator
  13265. private:
  13266. PropertyPanel* panel;
  13267. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13268. const GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13269. };
  13270. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13271. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13272. #endif
  13273. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13274. /*** Start of inlined file: juce_Sampler.h ***/
  13275. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13276. #define __JUCE_SAMPLER_JUCEHEADER__
  13277. /*** Start of inlined file: juce_Synthesiser.h ***/
  13278. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13279. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13280. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13281. {
  13282. protected:
  13283. SynthesiserSound();
  13284. public:
  13285. virtual ~SynthesiserSound();
  13286. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13287. virtual bool appliesToChannel (const int midiChannel) = 0;
  13288. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13289. juce_UseDebuggingNewOperator
  13290. };
  13291. class JUCE_API SynthesiserVoice
  13292. {
  13293. public:
  13294. SynthesiserVoice();
  13295. virtual ~SynthesiserVoice();
  13296. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13297. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13298. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13299. virtual void startNote (const int midiNoteNumber,
  13300. const float velocity,
  13301. SynthesiserSound* sound,
  13302. const int currentPitchWheelPosition) = 0;
  13303. virtual void stopNote (const bool allowTailOff) = 0;
  13304. virtual void pitchWheelMoved (const int newValue) = 0;
  13305. virtual void controllerMoved (const int controllerNumber,
  13306. const int newValue) = 0;
  13307. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13308. int startSample,
  13309. int numSamples) = 0;
  13310. bool isPlayingChannel (const int midiChannel) const;
  13311. void setCurrentPlaybackSampleRate (const double newRate);
  13312. juce_UseDebuggingNewOperator
  13313. protected:
  13314. double getSampleRate() const { return currentSampleRate; }
  13315. void clearCurrentNote();
  13316. private:
  13317. friend class Synthesiser;
  13318. double currentSampleRate;
  13319. int currentlyPlayingNote;
  13320. uint32 noteOnTime;
  13321. SynthesiserSound::Ptr currentlyPlayingSound;
  13322. };
  13323. class JUCE_API Synthesiser
  13324. {
  13325. public:
  13326. Synthesiser();
  13327. virtual ~Synthesiser();
  13328. void clearVoices();
  13329. int getNumVoices() const { return voices.size(); }
  13330. SynthesiserVoice* getVoice (const int index) const;
  13331. void addVoice (SynthesiserVoice* const newVoice);
  13332. void removeVoice (const int index);
  13333. void clearSounds();
  13334. int getNumSounds() const { return sounds.size(); }
  13335. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13336. void addSound (const SynthesiserSound::Ptr& newSound);
  13337. void removeSound (const int index);
  13338. void setNoteStealingEnabled (const bool shouldStealNotes);
  13339. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13340. virtual void noteOn (const int midiChannel,
  13341. const int midiNoteNumber,
  13342. const float velocity);
  13343. virtual void noteOff (const int midiChannel,
  13344. const int midiNoteNumber,
  13345. const bool allowTailOff);
  13346. virtual void allNotesOff (const int midiChannel,
  13347. const bool allowTailOff);
  13348. virtual void handlePitchWheel (const int midiChannel,
  13349. const int wheelValue);
  13350. virtual void handleController (const int midiChannel,
  13351. const int controllerNumber,
  13352. const int controllerValue);
  13353. void setCurrentPlaybackSampleRate (const double sampleRate);
  13354. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13355. const MidiBuffer& inputMidi,
  13356. int startSample,
  13357. int numSamples);
  13358. juce_UseDebuggingNewOperator
  13359. protected:
  13360. CriticalSection lock;
  13361. OwnedArray <SynthesiserVoice> voices;
  13362. ReferenceCountedArray <SynthesiserSound> sounds;
  13363. int lastPitchWheelValues [16];
  13364. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13365. const bool stealIfNoneAvailable) const;
  13366. void startVoice (SynthesiserVoice* const voice,
  13367. SynthesiserSound* const sound,
  13368. const int midiChannel,
  13369. const int midiNoteNumber,
  13370. const float velocity);
  13371. int findFreeVoice (const bool) const { return 0; }
  13372. private:
  13373. double sampleRate;
  13374. uint32 lastNoteOnCounter;
  13375. bool shouldStealNotes;
  13376. Synthesiser (const Synthesiser&);
  13377. const Synthesiser& operator= (const Synthesiser&);
  13378. };
  13379. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13380. /*** End of inlined file: juce_Synthesiser.h ***/
  13381. class JUCE_API SamplerSound : public SynthesiserSound
  13382. {
  13383. public:
  13384. SamplerSound (const String& name,
  13385. AudioFormatReader& source,
  13386. const BitArray& midiNotes,
  13387. const int midiNoteForNormalPitch,
  13388. const double attackTimeSecs,
  13389. const double releaseTimeSecs,
  13390. const double maxSampleLengthSeconds);
  13391. ~SamplerSound();
  13392. const String& getName() const { return name; }
  13393. AudioSampleBuffer* getAudioData() const { return data; }
  13394. bool appliesToNote (const int midiNoteNumber);
  13395. bool appliesToChannel (const int midiChannel);
  13396. juce_UseDebuggingNewOperator
  13397. private:
  13398. friend class SamplerVoice;
  13399. String name;
  13400. ScopedPointer <AudioSampleBuffer> data;
  13401. double sourceSampleRate;
  13402. BitArray midiNotes;
  13403. int length, attackSamples, releaseSamples;
  13404. int midiRootNote;
  13405. };
  13406. class JUCE_API SamplerVoice : public SynthesiserVoice
  13407. {
  13408. public:
  13409. SamplerVoice();
  13410. ~SamplerVoice();
  13411. bool canPlaySound (SynthesiserSound* sound);
  13412. void startNote (const int midiNoteNumber,
  13413. const float velocity,
  13414. SynthesiserSound* sound,
  13415. const int currentPitchWheelPosition);
  13416. void stopNote (const bool allowTailOff);
  13417. void pitchWheelMoved (const int newValue);
  13418. void controllerMoved (const int controllerNumber,
  13419. const int newValue);
  13420. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13421. juce_UseDebuggingNewOperator
  13422. private:
  13423. double pitchRatio;
  13424. double sourceSamplePosition;
  13425. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13426. bool isInAttack, isInRelease;
  13427. };
  13428. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13429. /*** End of inlined file: juce_Sampler.h ***/
  13430. #endif
  13431. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13432. #endif
  13433. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13434. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13435. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13436. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13437. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13438. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13439. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13440. class JUCE_API ActionListenerList : public MessageListener
  13441. {
  13442. public:
  13443. ActionListenerList() throw();
  13444. ~ActionListenerList() throw();
  13445. void addActionListener (ActionListener* const listener) throw();
  13446. void removeActionListener (ActionListener* const listener) throw();
  13447. void removeAllActionListeners() throw();
  13448. void sendActionMessage (const String& message) const;
  13449. void handleMessage (const Message&);
  13450. juce_UseDebuggingNewOperator
  13451. private:
  13452. SortedSet <void*> actionListeners_;
  13453. CriticalSection actionListenerLock_;
  13454. ActionListenerList (const ActionListenerList&);
  13455. const ActionListenerList& operator= (const ActionListenerList&);
  13456. };
  13457. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13458. /*** End of inlined file: juce_ActionListenerList.h ***/
  13459. class JUCE_API ActionBroadcaster
  13460. {
  13461. public:
  13462. ActionBroadcaster() throw();
  13463. virtual ~ActionBroadcaster();
  13464. void addActionListener (ActionListener* const listener);
  13465. void removeActionListener (ActionListener* const listener);
  13466. void removeAllActionListeners();
  13467. void sendActionMessage (const String& message) const;
  13468. private:
  13469. ActionListenerList actionListenerList;
  13470. ActionBroadcaster (const ActionBroadcaster&);
  13471. const ActionBroadcaster& operator= (const ActionBroadcaster&);
  13472. };
  13473. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13474. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13475. #endif
  13476. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13477. #endif
  13478. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13479. #endif
  13480. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13481. #endif
  13482. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13483. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13484. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13485. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13486. class JUCE_API CallbackMessage : public Message
  13487. {
  13488. public:
  13489. CallbackMessage() throw();
  13490. ~CallbackMessage() throw();
  13491. virtual void messageCallback() = 0;
  13492. void post();
  13493. juce_UseDebuggingNewOperator
  13494. private:
  13495. CallbackMessage (const CallbackMessage&);
  13496. const CallbackMessage& operator= (const CallbackMessage&);
  13497. };
  13498. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13499. /*** End of inlined file: juce_CallbackMessage.h ***/
  13500. #endif
  13501. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13502. #endif
  13503. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13504. #endif
  13505. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13506. #endif
  13507. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13508. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13509. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13510. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13511. class InterprocessConnectionServer;
  13512. class JUCE_API InterprocessConnection : public Thread,
  13513. private MessageListener
  13514. {
  13515. public:
  13516. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13517. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13518. ~InterprocessConnection();
  13519. bool connectToSocket (const String& hostName,
  13520. const int portNumber,
  13521. const int timeOutMillisecs);
  13522. bool connectToPipe (const String& pipeName,
  13523. const int pipeReceiveMessageTimeoutMs = -1);
  13524. bool createPipe (const String& pipeName,
  13525. const int pipeReceiveMessageTimeoutMs = -1);
  13526. void disconnect();
  13527. bool isConnected() const;
  13528. StreamingSocket* getSocket() const throw() { return socket; }
  13529. NamedPipe* getPipe() const throw() { return pipe; }
  13530. const String getConnectedHostName() const;
  13531. bool sendMessage (const MemoryBlock& message);
  13532. virtual void connectionMade() = 0;
  13533. virtual void connectionLost() = 0;
  13534. virtual void messageReceived (const MemoryBlock& message) = 0;
  13535. juce_UseDebuggingNewOperator
  13536. private:
  13537. CriticalSection pipeAndSocketLock;
  13538. ScopedPointer <StreamingSocket> socket;
  13539. ScopedPointer <NamedPipe> pipe;
  13540. bool callbackConnectionState;
  13541. const bool useMessageThread;
  13542. const uint32 magicMessageHeader;
  13543. int pipeReceiveMessageTimeout;
  13544. friend class InterprocessConnectionServer;
  13545. void initialiseWithSocket (StreamingSocket* const socket_);
  13546. void initialiseWithPipe (NamedPipe* const pipe_);
  13547. void handleMessage (const Message& message);
  13548. void connectionMadeInt();
  13549. void connectionLostInt();
  13550. void deliverDataInt (const MemoryBlock& data);
  13551. bool readNextMessageInt();
  13552. void run();
  13553. InterprocessConnection (const InterprocessConnection&);
  13554. const InterprocessConnection& operator= (const InterprocessConnection&);
  13555. };
  13556. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13557. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13558. #endif
  13559. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13560. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13561. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13562. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13563. class JUCE_API InterprocessConnectionServer : private Thread
  13564. {
  13565. public:
  13566. InterprocessConnectionServer();
  13567. ~InterprocessConnectionServer();
  13568. bool beginWaitingForSocket (const int portNumber);
  13569. void stop();
  13570. protected:
  13571. virtual InterprocessConnection* createConnectionObject() = 0;
  13572. public:
  13573. juce_UseDebuggingNewOperator
  13574. private:
  13575. ScopedPointer <StreamingSocket> socket;
  13576. void run();
  13577. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13578. const InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13579. };
  13580. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13581. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13582. #endif
  13583. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13584. #endif
  13585. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13586. #endif
  13587. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13588. /*** Start of inlined file: juce_MessageManager.h ***/
  13589. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13590. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13591. class Component;
  13592. class MessageManagerLock;
  13593. typedef void* (MessageCallbackFunction) (void* userData);
  13594. class JUCE_API MessageManager
  13595. {
  13596. public:
  13597. static MessageManager* getInstance() throw();
  13598. void runDispatchLoop();
  13599. void stopDispatchLoop();
  13600. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13601. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13602. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13603. void* userData);
  13604. bool isThisTheMessageThread() const throw();
  13605. void setCurrentMessageThread (const Thread::ThreadID threadId) throw();
  13606. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13607. bool currentThreadHasLockedMessageManager() const throw();
  13608. static void broadcastMessage (const String& messageText) throw();
  13609. void registerBroadcastListener (ActionListener* listener) throw();
  13610. void deregisterBroadcastListener (ActionListener* listener) throw();
  13611. void deliverMessage (void*);
  13612. void deliverBroadcastMessage (const String&);
  13613. ~MessageManager() throw();
  13614. juce_UseDebuggingNewOperator
  13615. private:
  13616. MessageManager() throw();
  13617. friend class MessageListener;
  13618. friend class ChangeBroadcaster;
  13619. friend class ActionBroadcaster;
  13620. friend class CallbackMessage;
  13621. static MessageManager* instance;
  13622. SortedSet <const MessageListener*> messageListeners;
  13623. ScopedPointer <ActionListenerList> broadcastListeners;
  13624. friend class JUCEApplication;
  13625. bool quitMessagePosted, quitMessageReceived;
  13626. Thread::ThreadID messageThreadId;
  13627. VoidArray modalComponents;
  13628. static void* exitModalLoopCallback (void*);
  13629. void postMessageToQueue (Message* const message);
  13630. void postCallbackMessage (Message* const message);
  13631. static void doPlatformSpecificInitialisation();
  13632. static void doPlatformSpecificShutdown();
  13633. friend class MessageManagerLock;
  13634. Thread::ThreadID volatile threadWithLock;
  13635. CriticalSection lockingLock;
  13636. MessageManager (const MessageManager&);
  13637. const MessageManager& operator= (const MessageManager&);
  13638. };
  13639. class JUCE_API MessageManagerLock
  13640. {
  13641. public:
  13642. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13643. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13644. ~MessageManagerLock() throw();
  13645. bool lockWasGained() const throw() { return locked; }
  13646. private:
  13647. bool locked, needsUnlocking;
  13648. void* sharedEvents;
  13649. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13650. MessageManagerLock (const MessageManagerLock&);
  13651. const MessageManagerLock& operator= (const MessageManagerLock&);
  13652. };
  13653. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13654. /*** End of inlined file: juce_MessageManager.h ***/
  13655. #endif
  13656. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13657. /*** Start of inlined file: juce_MultiTimer.h ***/
  13658. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13659. #define __JUCE_MULTITIMER_JUCEHEADER__
  13660. class JUCE_API MultiTimer
  13661. {
  13662. protected:
  13663. MultiTimer() throw();
  13664. MultiTimer (const MultiTimer& other) throw();
  13665. public:
  13666. virtual ~MultiTimer();
  13667. virtual void timerCallback (const int timerId) = 0;
  13668. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13669. void stopTimer (const int timerId) throw();
  13670. bool isTimerRunning (const int timerId) const throw();
  13671. int getTimerInterval (const int timerId) const throw();
  13672. private:
  13673. class MultiTimerCallback;
  13674. CriticalSection timerListLock;
  13675. OwnedArray <MultiTimerCallback> timers;
  13676. const MultiTimer& operator= (const MultiTimer&);
  13677. };
  13678. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13679. /*** End of inlined file: juce_MultiTimer.h ***/
  13680. #endif
  13681. #ifndef __JUCE_TIMER_JUCEHEADER__
  13682. #endif
  13683. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13684. /*** Start of inlined file: juce_ArrowButton.h ***/
  13685. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13686. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13687. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13688. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13689. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13690. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13691. {
  13692. public:
  13693. DropShadowEffect();
  13694. ~DropShadowEffect();
  13695. void setShadowProperties (const float newRadius,
  13696. const float newOpacity,
  13697. const int newShadowOffsetX,
  13698. const int newShadowOffsetY);
  13699. void applyEffect (Image& sourceImage, Graphics& destContext);
  13700. juce_UseDebuggingNewOperator
  13701. private:
  13702. int offsetX, offsetY;
  13703. float radius, opacity;
  13704. };
  13705. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13706. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13707. class JUCE_API ArrowButton : public Button
  13708. {
  13709. public:
  13710. ArrowButton (const String& buttonName,
  13711. float arrowDirection,
  13712. const Colour& arrowColour);
  13713. ~ArrowButton();
  13714. juce_UseDebuggingNewOperator
  13715. protected:
  13716. void paintButton (Graphics& g,
  13717. bool isMouseOverButton,
  13718. bool isButtonDown);
  13719. void buttonStateChanged();
  13720. private:
  13721. Colour colour;
  13722. DropShadowEffect shadow;
  13723. Path path;
  13724. int offset;
  13725. ArrowButton (const ArrowButton&);
  13726. const ArrowButton& operator= (const ArrowButton&);
  13727. };
  13728. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13729. /*** End of inlined file: juce_ArrowButton.h ***/
  13730. #endif
  13731. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13732. #endif
  13733. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13734. /*** Start of inlined file: juce_DrawableButton.h ***/
  13735. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13736. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13737. /*** Start of inlined file: juce_Drawable.h ***/
  13738. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13739. #define __JUCE_DRAWABLE_JUCEHEADER__
  13740. class JUCE_API Drawable
  13741. {
  13742. protected:
  13743. Drawable();
  13744. public:
  13745. virtual ~Drawable();
  13746. virtual Drawable* createCopy() const = 0;
  13747. void draw (Graphics& g, const float opacity,
  13748. const AffineTransform& transform = AffineTransform::identity) const;
  13749. void drawAt (Graphics& g,
  13750. const float x,
  13751. const float y,
  13752. const float opacity) const;
  13753. void drawWithin (Graphics& g,
  13754. const int destX,
  13755. const int destY,
  13756. const int destWidth,
  13757. const int destHeight,
  13758. const RectanglePlacement& placement,
  13759. const float opacity) const;
  13760. class RenderingContext
  13761. {
  13762. public:
  13763. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13764. Graphics& g;
  13765. AffineTransform transform;
  13766. float opacity;
  13767. private:
  13768. const RenderingContext& operator= (const RenderingContext&);
  13769. };
  13770. virtual void render (const RenderingContext& context) const = 0;
  13771. virtual const Rectangle<float> getBounds() const = 0;
  13772. virtual bool hitTest (float x, float y) const = 0;
  13773. const String& getName() const throw() { return name; }
  13774. void setName (const String& newName) throw() { name = newName; }
  13775. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13776. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13777. static Drawable* createFromImageFile (const File& file);
  13778. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13779. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13780. virtual ValueTree createValueTree() const throw() = 0;
  13781. juce_UseDebuggingNewOperator
  13782. private:
  13783. Drawable (const Drawable&);
  13784. const Drawable& operator= (const Drawable&);
  13785. String name;
  13786. };
  13787. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13788. /*** End of inlined file: juce_Drawable.h ***/
  13789. class JUCE_API DrawableButton : public Button
  13790. {
  13791. public:
  13792. enum ButtonStyle
  13793. {
  13794. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13795. ImageRaw, /**< The button will just display the images in their normal size and position.
  13796. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13797. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13798. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13799. };
  13800. DrawableButton (const String& buttonName,
  13801. const ButtonStyle buttonStyle);
  13802. ~DrawableButton();
  13803. void setImages (const Drawable* normalImage,
  13804. const Drawable* overImage = 0,
  13805. const Drawable* downImage = 0,
  13806. const Drawable* disabledImage = 0,
  13807. const Drawable* normalImageOn = 0,
  13808. const Drawable* overImageOn = 0,
  13809. const Drawable* downImageOn = 0,
  13810. const Drawable* disabledImageOn = 0);
  13811. void setButtonStyle (const ButtonStyle newStyle);
  13812. void setBackgroundColours (const Colour& toggledOffColour,
  13813. const Colour& toggledOnColour);
  13814. const Colour& getBackgroundColour() const throw();
  13815. void setEdgeIndent (const int numPixelsIndent);
  13816. const Drawable* getCurrentImage() const throw();
  13817. const Drawable* getNormalImage() const throw();
  13818. const Drawable* getOverImage() const throw();
  13819. const Drawable* getDownImage() const throw();
  13820. juce_UseDebuggingNewOperator
  13821. protected:
  13822. void paintButton (Graphics& g,
  13823. bool isMouseOverButton,
  13824. bool isButtonDown);
  13825. private:
  13826. ButtonStyle style;
  13827. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13828. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13829. Colour backgroundOff, backgroundOn;
  13830. int edgeIndent;
  13831. void deleteImages();
  13832. DrawableButton (const DrawableButton&);
  13833. const DrawableButton& operator= (const DrawableButton&);
  13834. };
  13835. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13836. /*** End of inlined file: juce_DrawableButton.h ***/
  13837. #endif
  13838. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13839. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13840. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13841. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13842. class JUCE_API HyperlinkButton : public Button
  13843. {
  13844. public:
  13845. HyperlinkButton (const String& linkText,
  13846. const URL& linkURL);
  13847. ~HyperlinkButton();
  13848. void setFont (const Font& newFont,
  13849. const bool resizeToMatchComponentHeight,
  13850. const Justification& justificationType = Justification::horizontallyCentred);
  13851. enum ColourIds
  13852. {
  13853. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13854. };
  13855. void setURL (const URL& newURL) throw();
  13856. const URL& getURL() const throw() { return url; }
  13857. void changeWidthToFitText();
  13858. juce_UseDebuggingNewOperator
  13859. protected:
  13860. void clicked();
  13861. void colourChanged();
  13862. void paintButton (Graphics& g,
  13863. bool isMouseOverButton,
  13864. bool isButtonDown);
  13865. private:
  13866. URL url;
  13867. Font font;
  13868. bool resizeFont;
  13869. Justification justification;
  13870. const Font getFontToUse() const;
  13871. HyperlinkButton (const HyperlinkButton&);
  13872. const HyperlinkButton& operator= (const HyperlinkButton&);
  13873. };
  13874. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13875. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13876. #endif
  13877. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13878. /*** Start of inlined file: juce_ImageButton.h ***/
  13879. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13880. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13881. class JUCE_API ImageButton : public Button
  13882. {
  13883. public:
  13884. ImageButton (const String& name);
  13885. ~ImageButton();
  13886. void setImages (const bool resizeButtonNowToFitThisImage,
  13887. const bool rescaleImagesWhenButtonSizeChanges,
  13888. const bool preserveImageProportions,
  13889. Image* const normalImage,
  13890. const float imageOpacityWhenNormal,
  13891. const Colour& overlayColourWhenNormal,
  13892. Image* const overImage,
  13893. const float imageOpacityWhenOver,
  13894. const Colour& overlayColourWhenOver,
  13895. Image* const downImage,
  13896. const float imageOpacityWhenDown,
  13897. const Colour& overlayColourWhenDown,
  13898. const float hitTestAlphaThreshold = 0.0f);
  13899. Image* getNormalImage() const throw();
  13900. Image* getOverImage() const throw();
  13901. Image* getDownImage() const throw();
  13902. juce_UseDebuggingNewOperator
  13903. protected:
  13904. bool hitTest (int x, int y);
  13905. void paintButton (Graphics& g,
  13906. bool isMouseOverButton,
  13907. bool isButtonDown);
  13908. private:
  13909. bool scaleImageToFit, preserveProportions;
  13910. unsigned char alphaThreshold;
  13911. int imageX, imageY, imageW, imageH;
  13912. Image* normalImage;
  13913. Image* overImage;
  13914. Image* downImage;
  13915. float normalOpacity, overOpacity, downOpacity;
  13916. Colour normalOverlay, overOverlay, downOverlay;
  13917. Image* getCurrentImage() const;
  13918. void deleteImages();
  13919. ImageButton (const ImageButton&);
  13920. const ImageButton& operator= (const ImageButton&);
  13921. };
  13922. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13923. /*** End of inlined file: juce_ImageButton.h ***/
  13924. #endif
  13925. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13926. /*** Start of inlined file: juce_ShapeButton.h ***/
  13927. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13928. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13929. class JUCE_API ShapeButton : public Button
  13930. {
  13931. public:
  13932. ShapeButton (const String& name,
  13933. const Colour& normalColour,
  13934. const Colour& overColour,
  13935. const Colour& downColour);
  13936. ~ShapeButton();
  13937. void setShape (const Path& newShape,
  13938. const bool resizeNowToFitThisShape,
  13939. const bool maintainShapeProportions,
  13940. const bool hasDropShadow);
  13941. void setColours (const Colour& normalColour,
  13942. const Colour& overColour,
  13943. const Colour& downColour);
  13944. void setOutline (const Colour& outlineColour,
  13945. const float outlineStrokeWidth);
  13946. juce_UseDebuggingNewOperator
  13947. protected:
  13948. void paintButton (Graphics& g,
  13949. bool isMouseOverButton,
  13950. bool isButtonDown);
  13951. private:
  13952. Colour normalColour, overColour, downColour, outlineColour;
  13953. DropShadowEffect shadow;
  13954. Path shape;
  13955. bool maintainShapeProportions;
  13956. float outlineWidth;
  13957. ShapeButton (const ShapeButton&);
  13958. const ShapeButton& operator= (const ShapeButton&);
  13959. };
  13960. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13961. /*** End of inlined file: juce_ShapeButton.h ***/
  13962. #endif
  13963. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13964. #endif
  13965. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13966. /*** Start of inlined file: juce_ToggleButton.h ***/
  13967. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13968. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13969. class JUCE_API ToggleButton : public Button
  13970. {
  13971. public:
  13972. ToggleButton (const String& buttonText);
  13973. ~ToggleButton();
  13974. void changeWidthToFitText();
  13975. enum ColourIds
  13976. {
  13977. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13978. };
  13979. juce_UseDebuggingNewOperator
  13980. protected:
  13981. void paintButton (Graphics& g,
  13982. bool isMouseOverButton,
  13983. bool isButtonDown);
  13984. void colourChanged();
  13985. private:
  13986. ToggleButton (const ToggleButton&);
  13987. const ToggleButton& operator= (const ToggleButton&);
  13988. };
  13989. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13990. /*** End of inlined file: juce_ToggleButton.h ***/
  13991. #endif
  13992. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13993. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13994. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13995. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13996. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13997. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13998. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13999. /*** Start of inlined file: juce_Toolbar.h ***/
  14000. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14001. #define __JUCE_TOOLBAR_JUCEHEADER__
  14002. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  14003. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14004. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14005. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  14006. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14007. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14008. class JUCE_API DragAndDropTarget
  14009. {
  14010. public:
  14011. virtual ~DragAndDropTarget() {}
  14012. virtual bool isInterestedInDragSource (const String& sourceDescription,
  14013. Component* sourceComponent) = 0;
  14014. virtual void itemDragEnter (const String& sourceDescription,
  14015. Component* sourceComponent,
  14016. int x,
  14017. int y);
  14018. virtual void itemDragMove (const String& sourceDescription,
  14019. Component* sourceComponent,
  14020. int x,
  14021. int y);
  14022. virtual void itemDragExit (const String& sourceDescription,
  14023. Component* sourceComponent);
  14024. virtual void itemDropped (const String& sourceDescription,
  14025. Component* sourceComponent,
  14026. int x,
  14027. int y) = 0;
  14028. virtual bool shouldDrawDragImageWhenOver();
  14029. };
  14030. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14031. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  14032. class JUCE_API DragAndDropContainer
  14033. {
  14034. public:
  14035. DragAndDropContainer();
  14036. virtual ~DragAndDropContainer();
  14037. void startDragging (const String& sourceDescription,
  14038. Component* sourceComponent,
  14039. Image* dragImage = 0,
  14040. const bool allowDraggingToOtherJuceWindows = false,
  14041. const Point<int>* imageOffsetFromMouse = 0);
  14042. bool isDragAndDropActive() const;
  14043. const String getCurrentDragDescription() const;
  14044. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14045. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  14046. static bool performExternalDragDropOfText (const String& text);
  14047. juce_UseDebuggingNewOperator
  14048. protected:
  14049. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14050. Component* dragSourceComponent,
  14051. StringArray& files,
  14052. bool& canMoveFiles);
  14053. private:
  14054. friend class DragImageComponent;
  14055. ScopedPointer <Component> dragImageComponent;
  14056. String currentDragDesc;
  14057. };
  14058. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14059. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14060. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14061. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14062. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14063. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14064. private Timer
  14065. {
  14066. public:
  14067. ComponentAnimator();
  14068. ~ComponentAnimator();
  14069. void animateComponent (Component* const component,
  14070. const Rectangle<int>& finalPosition,
  14071. const int millisecondsToSpendMoving,
  14072. const double startSpeed = 1.0,
  14073. const double endSpeed = 1.0);
  14074. void cancelAnimation (Component* const component,
  14075. const bool moveComponentToItsFinalPosition);
  14076. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  14077. const Rectangle<int> getComponentDestination (Component* const component);
  14078. bool isAnimating (Component* component) const;
  14079. juce_UseDebuggingNewOperator
  14080. private:
  14081. VoidArray tasks;
  14082. uint32 lastTime;
  14083. void* findTaskFor (Component* const component) const;
  14084. void timerCallback();
  14085. };
  14086. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14087. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14088. class ToolbarItemComponent;
  14089. class ToolbarItemFactory;
  14090. class MissingItemsComponent;
  14091. class JUCE_API Toolbar : public Component,
  14092. public DragAndDropContainer,
  14093. public DragAndDropTarget,
  14094. private ButtonListener
  14095. {
  14096. public:
  14097. Toolbar();
  14098. ~Toolbar();
  14099. void setVertical (const bool shouldBeVertical);
  14100. bool isVertical() const throw() { return vertical; }
  14101. int getThickness() const throw();
  14102. int getLength() const throw();
  14103. void clear();
  14104. void addItem (ToolbarItemFactory& factory,
  14105. const int itemId,
  14106. const int insertIndex = -1);
  14107. void removeToolbarItem (const int itemIndex);
  14108. int getNumItems() const throw();
  14109. int getItemId (const int itemIndex) const throw();
  14110. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  14111. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14112. enum ToolbarItemStyle
  14113. {
  14114. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14115. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14116. textOnly /**< Means that the toolbar only display text labels for each item. */
  14117. };
  14118. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14119. void setStyle (const ToolbarItemStyle& newStyle);
  14120. enum CustomisationFlags
  14121. {
  14122. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14123. show the "icons only" option on its choice of toolbar styles. */
  14124. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14125. show the "icons with text" option on its choice of toolbar styles. */
  14126. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14127. show the "text only" option on its choice of toolbar styles. */
  14128. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14129. show a button to reset the toolbar to its default set of items. */
  14130. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14131. };
  14132. void showCustomisationDialog (ToolbarItemFactory& factory,
  14133. const int optionFlags = allCustomisationOptionsEnabled);
  14134. void setEditingActive (const bool editingEnabled);
  14135. enum ColourIds
  14136. {
  14137. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14138. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14139. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14140. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14141. over them. */
  14142. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14143. held down on them. */
  14144. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14145. when the style is set to iconsWithText or textOnly. */
  14146. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14147. the customisation dialog is active and the mouse moves over them. */
  14148. };
  14149. const String toString() const;
  14150. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14151. const String& savedVersion);
  14152. void paint (Graphics& g);
  14153. void resized();
  14154. void buttonClicked (Button*);
  14155. void mouseDown (const MouseEvent&);
  14156. bool isInterestedInDragSource (const String&, Component*);
  14157. void itemDragMove (const String&, Component*, int, int);
  14158. void itemDragExit (const String&, Component*);
  14159. void itemDropped (const String&, Component*, int, int);
  14160. void updateAllItemPositions (const bool animate);
  14161. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14162. juce_UseDebuggingNewOperator
  14163. private:
  14164. Button* missingItemsButton;
  14165. bool vertical, isEditingActive;
  14166. ToolbarItemStyle toolbarStyle;
  14167. ComponentAnimator animator;
  14168. friend class MissingItemsComponent;
  14169. Array <ToolbarItemComponent*> items;
  14170. friend class ItemDragAndDropOverlayComponent;
  14171. static const tchar* const toolbarDragDescriptor;
  14172. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14173. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14174. Toolbar (const Toolbar&);
  14175. const Toolbar& operator= (const Toolbar&);
  14176. };
  14177. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14178. /*** End of inlined file: juce_Toolbar.h ***/
  14179. class ItemDragAndDropOverlayComponent;
  14180. class JUCE_API ToolbarItemComponent : public Button
  14181. {
  14182. public:
  14183. ToolbarItemComponent (const int itemId,
  14184. const String& labelText,
  14185. const bool isBeingUsedAsAButton);
  14186. ~ToolbarItemComponent();
  14187. int getItemId() const throw() { return itemId; }
  14188. Toolbar* getToolbar() const;
  14189. bool isToolbarVertical() const;
  14190. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14191. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14192. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14193. virtual bool getToolbarItemSizes (int toolbarThickness,
  14194. bool isToolbarVertical,
  14195. int& preferredSize,
  14196. int& minSize,
  14197. int& maxSize) = 0;
  14198. virtual void paintButtonArea (Graphics& g,
  14199. int width, int height,
  14200. bool isMouseOver, bool isMouseDown) = 0;
  14201. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14202. enum ToolbarEditingMode
  14203. {
  14204. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14205. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14206. customisation mode, and the items can be dragged around. */
  14207. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14208. dragged onto a toolbar to add it to that bar.*/
  14209. };
  14210. void setEditingMode (const ToolbarEditingMode newMode);
  14211. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14212. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14213. void resized();
  14214. juce_UseDebuggingNewOperator
  14215. private:
  14216. friend class Toolbar;
  14217. friend class ItemDragAndDropOverlayComponent;
  14218. const int itemId;
  14219. ToolbarEditingMode mode;
  14220. Toolbar::ToolbarItemStyle toolbarStyle;
  14221. ScopedPointer <Component> overlayComp;
  14222. int dragOffsetX, dragOffsetY;
  14223. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14224. Rectangle<int> contentArea;
  14225. ToolbarItemComponent (const ToolbarItemComponent&);
  14226. const ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14227. };
  14228. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14229. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14230. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14231. {
  14232. public:
  14233. ToolbarButton (const int itemId,
  14234. const String& labelText,
  14235. Drawable* const normalImage,
  14236. Drawable* const toggledOnImage);
  14237. ~ToolbarButton();
  14238. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14239. int& minSize, int& maxSize);
  14240. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14241. void contentAreaChanged (const Rectangle<int>& newBounds);
  14242. juce_UseDebuggingNewOperator
  14243. private:
  14244. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14245. ToolbarButton (const ToolbarButton&);
  14246. const ToolbarButton& operator= (const ToolbarButton&);
  14247. };
  14248. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14249. /*** End of inlined file: juce_ToolbarButton.h ***/
  14250. #endif
  14251. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14252. /*** Start of inlined file: juce_CodeDocument.h ***/
  14253. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14254. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14255. class CodeDocumentLine;
  14256. class JUCE_API CodeDocument
  14257. {
  14258. public:
  14259. CodeDocument();
  14260. ~CodeDocument();
  14261. class JUCE_API Position
  14262. {
  14263. public:
  14264. Position() throw();
  14265. Position (const CodeDocument* const ownerDocument,
  14266. const int line, const int indexInLine) throw();
  14267. Position (const CodeDocument* const ownerDocument,
  14268. const int charactersFromStartOfDocument) throw();
  14269. Position (const Position& other) throw();
  14270. ~Position() throw();
  14271. const Position& operator= (const Position& other) throw();
  14272. bool operator== (const Position& other) const throw();
  14273. bool operator!= (const Position& other) const throw();
  14274. void setPosition (const int charactersFromStartOfDocument) throw();
  14275. int getPosition() const throw() { return characterPos; }
  14276. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14277. int getLineNumber() const throw() { return line; }
  14278. int getIndexInLine() const throw() { return indexInLine; }
  14279. void setPositionMaintained (const bool isMaintained) throw();
  14280. void moveBy (int characterDelta) throw();
  14281. const Position movedBy (const int characterDelta) const throw();
  14282. const Position movedByLines (const int deltaLines) const throw();
  14283. const tchar getCharacter() const throw();
  14284. const String getLineText() const throw();
  14285. private:
  14286. CodeDocument* owner;
  14287. int characterPos, line, indexInLine;
  14288. bool positionMaintained;
  14289. };
  14290. const String getAllContent() const throw();
  14291. const String getTextBetween (const Position& start, const Position& end) const throw();
  14292. const String getLine (const int lineIndex) const throw();
  14293. int getNumCharacters() const throw();
  14294. int getNumLines() const throw() { return lines.size(); }
  14295. int getMaximumLineLength() throw();
  14296. void deleteSection (const Position& startPosition, const Position& endPosition);
  14297. void insertText (const Position& position, const String& text);
  14298. void replaceAllContent (const String& newContent);
  14299. bool loadFromStream (InputStream& stream);
  14300. bool writeToStream (OutputStream& stream);
  14301. const String getNewLineCharacters() const throw() { return newLineChars; }
  14302. void setNewLineCharacters (const String& newLine) throw();
  14303. void newTransaction();
  14304. void undo();
  14305. void redo();
  14306. void clearUndoHistory();
  14307. UndoManager& getUndoManager() throw() { return undoManager; }
  14308. void setSavePoint() throw();
  14309. bool hasChangedSinceSavePoint() const throw();
  14310. const Position findWordBreakAfter (const Position& position) const throw();
  14311. const Position findWordBreakBefore (const Position& position) const throw();
  14312. class JUCE_API Listener
  14313. {
  14314. public:
  14315. Listener() {}
  14316. virtual ~Listener() {}
  14317. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14318. const Position& affectedTextEnd) = 0;
  14319. };
  14320. void addListener (Listener* const listener) throw();
  14321. void removeListener (Listener* const listener) throw();
  14322. class Iterator
  14323. {
  14324. public:
  14325. Iterator (CodeDocument* const document);
  14326. Iterator (const Iterator& other);
  14327. const Iterator& operator= (const Iterator& other) throw();
  14328. ~Iterator() throw();
  14329. juce_wchar nextChar();
  14330. juce_wchar peekNextChar() const;
  14331. void skip();
  14332. int getPosition() const throw() { return position; }
  14333. void skipWhitespace();
  14334. void skipToEndOfLine();
  14335. int getLine() const throw() { return line; }
  14336. bool isEOF() const throw();
  14337. private:
  14338. CodeDocument* document;
  14339. CodeDocumentLine* currentLine;
  14340. int line, position;
  14341. };
  14342. juce_UseDebuggingNewOperator
  14343. private:
  14344. friend class CodeDocumentInsertAction;
  14345. friend class CodeDocumentDeleteAction;
  14346. friend class Iterator;
  14347. friend class Position;
  14348. OwnedArray <CodeDocumentLine> lines;
  14349. Array <Position*> positionsToMaintain;
  14350. UndoManager undoManager;
  14351. int currentActionIndex, indexOfSavedState;
  14352. int maximumLineLength;
  14353. VoidArray listeners;
  14354. String newLineChars;
  14355. void sendListenerChangeMessage (const int startLine, const int endLine);
  14356. void insert (const String& text, const int insertPos, const bool undoable);
  14357. void remove (const int startPos, const int endPos, const bool undoable);
  14358. void checkLastLineStatus();
  14359. CodeDocument (const CodeDocument&);
  14360. const CodeDocument& operator= (const CodeDocument&);
  14361. };
  14362. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14363. /*** End of inlined file: juce_CodeDocument.h ***/
  14364. #endif
  14365. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14366. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14367. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14368. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14369. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14370. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14371. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14372. class JUCE_API CodeTokeniser
  14373. {
  14374. public:
  14375. CodeTokeniser() {}
  14376. virtual ~CodeTokeniser() {}
  14377. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14378. virtual const StringArray getTokenTypes() = 0;
  14379. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14380. juce_UseDebuggingNewOperator
  14381. };
  14382. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14383. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14384. class JUCE_API CodeEditorComponent : public Component,
  14385. public TextInputTarget,
  14386. public Timer,
  14387. public ScrollBarListener,
  14388. public CodeDocument::Listener,
  14389. public AsyncUpdater
  14390. {
  14391. public:
  14392. CodeEditorComponent (CodeDocument& document,
  14393. CodeTokeniser* const codeTokeniser);
  14394. ~CodeEditorComponent();
  14395. CodeDocument& getDocument() const throw() { return document; }
  14396. void loadContent (const String& newContent);
  14397. float getCharWidth() const throw() { return charWidth; }
  14398. int getLineHeight() const throw() { return lineHeight; }
  14399. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14400. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14401. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14402. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14403. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14404. const CodeDocument::Position getPositionAt (int x, int y);
  14405. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14406. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14407. void cursorDown (const bool selecting);
  14408. void cursorUp (const bool selecting);
  14409. void pageDown (const bool selecting);
  14410. void pageUp (const bool selecting);
  14411. void scrollDown();
  14412. void scrollUp();
  14413. void scrollToLine (int newFirstLineOnScreen);
  14414. void scrollBy (int deltaLines);
  14415. void scrollToColumn (int newFirstColumnOnScreen);
  14416. void scrollToKeepCaretOnScreen();
  14417. void goToStartOfDocument (const bool selecting);
  14418. void goToStartOfLine (const bool selecting);
  14419. void goToEndOfDocument (const bool selecting);
  14420. void goToEndOfLine (const bool selecting);
  14421. void deselectAll();
  14422. void selectAll();
  14423. void insertTextAtCaret (const String& textToInsert);
  14424. void insertTabAtCaret();
  14425. void cut();
  14426. void copy();
  14427. void copyThenCut();
  14428. void paste();
  14429. void backspace (const bool moveInWholeWordSteps);
  14430. void deleteForward (const bool moveInWholeWordSteps);
  14431. void undo();
  14432. void redo();
  14433. const Range<int> getHighlightedRegion() const;
  14434. void setHighlightedRegion (const Range<int>& newRange);
  14435. const String getTextInRange (const Range<int>& range) const;
  14436. void setTabSize (const int numSpacesPerTab,
  14437. const bool insertSpacesInsteadOfTabCharacters) throw();
  14438. int getTabSize() const throw() { return spacesPerTab; }
  14439. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14440. void setFont (const Font& newFont);
  14441. void resetToDefaultColours();
  14442. void setColourForTokenType (const int tokenType, const Colour& colour);
  14443. const Colour getColourForTokenType (const int tokenType) const throw();
  14444. enum ColourIds
  14445. {
  14446. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14447. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14448. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14449. selected text. */
  14450. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14451. enabled. */
  14452. };
  14453. void setScrollbarThickness (const int thickness) throw();
  14454. void resized();
  14455. void paint (Graphics& g);
  14456. bool keyPressed (const KeyPress& key);
  14457. void mouseDown (const MouseEvent& e);
  14458. void mouseDrag (const MouseEvent& e);
  14459. void mouseUp (const MouseEvent& e);
  14460. void mouseDoubleClick (const MouseEvent& e);
  14461. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14462. void timerCallback();
  14463. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14464. void handleAsyncUpdate();
  14465. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14466. const CodeDocument::Position& affectedTextEnd);
  14467. juce_UseDebuggingNewOperator
  14468. private:
  14469. CodeDocument& document;
  14470. Font font;
  14471. int firstLineOnScreen, gutter, spacesPerTab;
  14472. float charWidth;
  14473. int lineHeight, linesOnScreen, columnsOnScreen;
  14474. int scrollbarThickness, columnToTryToMaintain;
  14475. bool useSpacesForTabs;
  14476. double xOffset;
  14477. CodeDocument::Position caretPos;
  14478. CodeDocument::Position selectionStart, selectionEnd;
  14479. Component* caret;
  14480. ScrollBar* verticalScrollBar;
  14481. ScrollBar* horizontalScrollBar;
  14482. enum DragType
  14483. {
  14484. notDragging,
  14485. draggingSelectionStart,
  14486. draggingSelectionEnd
  14487. };
  14488. DragType dragType;
  14489. CodeTokeniser* codeTokeniser;
  14490. Array <Colour> coloursForTokenCategories;
  14491. class CodeEditorLine;
  14492. OwnedArray <CodeEditorLine> lines;
  14493. void rebuildLineTokens();
  14494. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14495. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14496. void updateCachedIterators (int maxLineNum);
  14497. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14498. void moveLineDelta (const int delta, const bool selecting);
  14499. void updateScrollBars();
  14500. void scrollToLineInternal (int line);
  14501. void scrollToColumnInternal (double column);
  14502. void newTransaction();
  14503. int indexToColumn (int line, int index) const throw();
  14504. int columnToIndex (int line, int column) const throw();
  14505. CodeEditorComponent (const CodeEditorComponent&);
  14506. const CodeEditorComponent& operator= (const CodeEditorComponent&);
  14507. };
  14508. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14509. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14510. #endif
  14511. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14512. #endif
  14513. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14514. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14515. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14516. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14517. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14518. {
  14519. public:
  14520. CPlusPlusCodeTokeniser();
  14521. ~CPlusPlusCodeTokeniser();
  14522. enum TokenType
  14523. {
  14524. tokenType_error = 0,
  14525. tokenType_comment,
  14526. tokenType_builtInKeyword,
  14527. tokenType_identifier,
  14528. tokenType_integerLiteral,
  14529. tokenType_floatLiteral,
  14530. tokenType_stringLiteral,
  14531. tokenType_operator,
  14532. tokenType_bracket,
  14533. tokenType_punctuation,
  14534. tokenType_preprocessor
  14535. };
  14536. int readNextToken (CodeDocument::Iterator& source);
  14537. const StringArray getTokenTypes();
  14538. const Colour getDefaultColour (const int tokenType);
  14539. juce_UseDebuggingNewOperator
  14540. };
  14541. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14542. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14543. #endif
  14544. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14545. #endif
  14546. #ifndef __JUCE_LABEL_JUCEHEADER__
  14547. #endif
  14548. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14549. #endif
  14550. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14551. /*** Start of inlined file: juce_ProgressBar.h ***/
  14552. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14553. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14554. class JUCE_API ProgressBar : public Component,
  14555. public SettableTooltipClient,
  14556. private Timer
  14557. {
  14558. public:
  14559. ProgressBar (double& progress);
  14560. ~ProgressBar();
  14561. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14562. void setTextToDisplay (const String& text);
  14563. enum ColourIds
  14564. {
  14565. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14566. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14567. classes will probably use variations on this colour. */
  14568. };
  14569. juce_UseDebuggingNewOperator
  14570. protected:
  14571. void paint (Graphics& g);
  14572. void lookAndFeelChanged();
  14573. void visibilityChanged();
  14574. void colourChanged();
  14575. private:
  14576. double& progress;
  14577. double currentValue;
  14578. bool displayPercentage;
  14579. String displayedMessage, currentMessage;
  14580. uint32 lastCallbackTime;
  14581. void timerCallback();
  14582. ProgressBar (const ProgressBar&);
  14583. const ProgressBar& operator= (const ProgressBar&);
  14584. };
  14585. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14586. /*** End of inlined file: juce_ProgressBar.h ***/
  14587. #endif
  14588. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14589. /*** Start of inlined file: juce_Slider.h ***/
  14590. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14591. #define __JUCE_SLIDER_JUCEHEADER__
  14592. /*** Start of inlined file: juce_SliderListener.h ***/
  14593. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14594. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14595. class Slider;
  14596. class JUCE_API SliderListener
  14597. {
  14598. public:
  14599. virtual ~SliderListener() {}
  14600. virtual void sliderValueChanged (Slider* slider) = 0;
  14601. virtual void sliderDragStarted (Slider* slider);
  14602. virtual void sliderDragEnded (Slider* slider);
  14603. };
  14604. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14605. /*** End of inlined file: juce_SliderListener.h ***/
  14606. class JUCE_API Slider : public Component,
  14607. public SettableTooltipClient,
  14608. private AsyncUpdater,
  14609. private ButtonListener,
  14610. private LabelListener,
  14611. private Value::Listener
  14612. {
  14613. public:
  14614. Slider (const String& componentName);
  14615. ~Slider();
  14616. enum SliderStyle
  14617. {
  14618. LinearHorizontal, /**< A traditional horizontal slider. */
  14619. LinearVertical, /**< A traditional vertical slider. */
  14620. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14621. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14622. @see setRotaryParameters */
  14623. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14624. @see setRotaryParameters */
  14625. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14626. @see setRotaryParameters */
  14627. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14628. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14629. @see setMinValue, setMaxValue */
  14630. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14631. @see setMinValue, setMaxValue */
  14632. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14633. value, with the current value being somewhere between them.
  14634. @see setMinValue, setMaxValue */
  14635. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14636. value, with the current value being somewhere between them.
  14637. @see setMinValue, setMaxValue */
  14638. };
  14639. void setSliderStyle (const SliderStyle newStyle);
  14640. SliderStyle getSliderStyle() const { return style; }
  14641. void setRotaryParameters (const float startAngleRadians,
  14642. const float endAngleRadians,
  14643. const bool stopAtEnd);
  14644. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14645. void setVelocityBasedMode (const bool isVelocityBased);
  14646. bool getVelocityBasedMode() const { return isVelocityBased; }
  14647. void setVelocityModeParameters (const double sensitivity = 1.0,
  14648. const int threshold = 1,
  14649. const double offset = 0.0,
  14650. const bool userCanPressKeyToSwapMode = true);
  14651. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14652. int getVelocityThreshold() const { return velocityModeThreshold; }
  14653. double getVelocityOffset() const { return velocityModeOffset; }
  14654. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14655. void setSkewFactor (const double factor);
  14656. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14657. double getSkewFactor() const { return skewFactor; }
  14658. enum IncDecButtonMode
  14659. {
  14660. incDecButtonsNotDraggable,
  14661. incDecButtonsDraggable_AutoDirection,
  14662. incDecButtonsDraggable_Horizontal,
  14663. incDecButtonsDraggable_Vertical
  14664. };
  14665. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14666. enum TextEntryBoxPosition
  14667. {
  14668. NoTextBox, /**< Doesn't display a text box. */
  14669. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14670. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14671. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14672. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14673. };
  14674. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14675. const bool isReadOnly,
  14676. const int textEntryBoxWidth,
  14677. const int textEntryBoxHeight);
  14678. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14679. int getTextBoxWidth() const { return textBoxWidth; }
  14680. int getTextBoxHeight() const { return textBoxHeight; }
  14681. void setTextBoxIsEditable (const bool shouldBeEditable);
  14682. bool isTextBoxEditable() const { return editableText; }
  14683. void showTextBox();
  14684. void hideTextBox (const bool discardCurrentEditorContents);
  14685. void setValue (double newValue,
  14686. const bool sendUpdateMessage = true,
  14687. const bool sendMessageSynchronously = false);
  14688. double getValue() const;
  14689. Value& getValueObject() { return currentValue; }
  14690. void setRange (const double newMinimum,
  14691. const double newMaximum,
  14692. const double newInterval = 0);
  14693. double getMaximum() const { return maximum; }
  14694. double getMinimum() const { return minimum; }
  14695. double getInterval() const { return interval; }
  14696. double getMinValue() const;
  14697. Value& getMinValueObject() { return valueMin; }
  14698. void setMinValue (double newValue,
  14699. const bool sendUpdateMessage = true,
  14700. const bool sendMessageSynchronously = false,
  14701. const bool allowNudgingOfOtherValues = false);
  14702. double getMaxValue() const;
  14703. Value& getMaxValueObject() { return valueMax; }
  14704. void setMaxValue (double newValue,
  14705. const bool sendUpdateMessage = true,
  14706. const bool sendMessageSynchronously = false,
  14707. const bool allowNudgingOfOtherValues = false);
  14708. void addListener (SliderListener* const listener);
  14709. void removeListener (SliderListener* const listener);
  14710. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14711. const double valueToSetOnDoubleClick);
  14712. double getDoubleClickReturnValue (bool& isEnabled) const;
  14713. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14714. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14715. void setPopupDisplayEnabled (const bool isEnabled,
  14716. Component* const parentComponentToUse);
  14717. void setPopupMenuEnabled (const bool menuEnabled);
  14718. void setScrollWheelEnabled (const bool enabled);
  14719. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14720. virtual void startedDragging();
  14721. virtual void stoppedDragging();
  14722. virtual void valueChanged();
  14723. /** Callback to indicate that the user has just moved the slider.
  14724. Note - the valueChanged() method has changed its format and now no longer has
  14725. any parameters. Update your code to use the new version.
  14726. This version has been left here with an int as its return value to cause
  14727. a syntax error if you've got existing code that uses the old version.
  14728. */
  14729. virtual int valueChanged (double) { jassertfalse; return 0; }
  14730. virtual double getValueFromText (const String& text);
  14731. virtual const String getTextFromValue (double value);
  14732. void setTextValueSuffix (const String& suffix);
  14733. virtual double proportionOfLengthToValue (double proportion);
  14734. virtual double valueToProportionOfLength (double value);
  14735. float getPositionOfValue (const double value);
  14736. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14737. void updateText();
  14738. bool isHorizontal() const;
  14739. bool isVertical() const;
  14740. enum ColourIds
  14741. {
  14742. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14743. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14744. and feel class how this is used. */
  14745. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14746. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14747. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14748. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14749. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14750. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14751. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14752. };
  14753. juce_UseDebuggingNewOperator
  14754. protected:
  14755. void labelTextChanged (Label*);
  14756. void paint (Graphics& g);
  14757. void resized();
  14758. void mouseDown (const MouseEvent& e);
  14759. void mouseUp (const MouseEvent& e);
  14760. void mouseDrag (const MouseEvent& e);
  14761. void mouseDoubleClick (const MouseEvent& e);
  14762. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14763. void modifierKeysChanged (const ModifierKeys& modifiers);
  14764. void buttonClicked (Button* button);
  14765. void lookAndFeelChanged();
  14766. void enablementChanged();
  14767. void focusOfChildComponentChanged (FocusChangeType cause);
  14768. void handleAsyncUpdate();
  14769. void colourChanged();
  14770. void valueChanged (Value& value);
  14771. private:
  14772. SortedSet <void*> listeners;
  14773. Value currentValue, valueMin, valueMax;
  14774. double lastCurrentValue, lastValueMin, lastValueMax;
  14775. double minimum, maximum, interval, doubleClickReturnValue;
  14776. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14777. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14778. int velocityModeThreshold;
  14779. float rotaryStart, rotaryEnd;
  14780. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14781. int mouseDragStartX, mouseDragStartY;
  14782. int sliderRegionStart, sliderRegionSize;
  14783. int sliderBeingDragged;
  14784. int pixelsForFullDragExtent;
  14785. Rectangle<int> sliderRect;
  14786. String textSuffix;
  14787. SliderStyle style;
  14788. TextEntryBoxPosition textBoxPos;
  14789. int textBoxWidth, textBoxHeight;
  14790. IncDecButtonMode incDecButtonMode;
  14791. bool editableText : 1, doubleClickToValue : 1;
  14792. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14793. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14794. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14795. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14796. Font font;
  14797. Label* valueBox;
  14798. Button* incButton;
  14799. Button* decButton;
  14800. ScopedPointer <Component> popupDisplay;
  14801. Component* parentForPopupDisplay;
  14802. float getLinearSliderPos (const double value);
  14803. void restoreMouseIfHidden();
  14804. void sendDragStart();
  14805. void sendDragEnd();
  14806. double constrainedValue (double value) const;
  14807. void triggerChangeMessage (const bool synchronous);
  14808. bool incDecDragDirectionIsHorizontal() const;
  14809. Slider (const Slider&);
  14810. const Slider& operator= (const Slider&);
  14811. };
  14812. #endif // __JUCE_SLIDER_JUCEHEADER__
  14813. /*** End of inlined file: juce_Slider.h ***/
  14814. #endif
  14815. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14816. #endif
  14817. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14818. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14819. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14820. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14821. class TableHeaderComponent;
  14822. class JUCE_API TableHeaderListener
  14823. {
  14824. public:
  14825. TableHeaderListener() {}
  14826. virtual ~TableHeaderListener() {}
  14827. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14828. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14829. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14830. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14831. int columnIdNowBeingDragged);
  14832. };
  14833. class JUCE_API TableHeaderComponent : public Component,
  14834. private AsyncUpdater
  14835. {
  14836. public:
  14837. TableHeaderComponent();
  14838. ~TableHeaderComponent();
  14839. enum ColumnPropertyFlags
  14840. {
  14841. 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. */
  14842. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14843. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14844. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14845. 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. */
  14846. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14847. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14848. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14849. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14850. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14851. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14852. };
  14853. void addColumn (const String& columnName,
  14854. const int columnId,
  14855. const int width,
  14856. const int minimumWidth = 30,
  14857. const int maximumWidth = -1,
  14858. const int propertyFlags = defaultFlags,
  14859. const int insertIndex = -1);
  14860. void removeColumn (const int columnIdToRemove);
  14861. void removeAllColumns();
  14862. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14863. const String getColumnName (const int columnId) const;
  14864. void setColumnName (const int columnId, const String& newName);
  14865. void moveColumn (const int columnId, int newVisibleIndex);
  14866. int getColumnWidth (const int columnId) const;
  14867. void setColumnWidth (const int columnId, const int newWidth);
  14868. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14869. bool isColumnVisible (const int columnId) const;
  14870. void setSortColumnId (const int columnId, const bool sortForwards);
  14871. int getSortColumnId() const;
  14872. bool isSortedForwards() const;
  14873. void reSortTable();
  14874. int getTotalWidth() const;
  14875. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14876. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14877. const Rectangle<int> getColumnPosition (const int index) const;
  14878. int getColumnIdAtX (const int xToFind) const;
  14879. void setStretchToFitActive (const bool shouldStretchToFit);
  14880. bool isStretchToFitActive() const;
  14881. void resizeAllColumnsToFit (int targetTotalWidth);
  14882. void setPopupMenuActive (const bool hasMenu);
  14883. bool isPopupMenuActive() const;
  14884. const String toString() const;
  14885. void restoreFromString (const String& storedVersion);
  14886. void addListener (TableHeaderListener* const newListener);
  14887. void removeListener (TableHeaderListener* const listenerToRemove);
  14888. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14889. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14890. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14891. void paint (Graphics& g);
  14892. void resized();
  14893. void mouseMove (const MouseEvent&);
  14894. void mouseEnter (const MouseEvent&);
  14895. void mouseExit (const MouseEvent&);
  14896. void mouseDown (const MouseEvent&);
  14897. void mouseDrag (const MouseEvent&);
  14898. void mouseUp (const MouseEvent&);
  14899. const MouseCursor getMouseCursor();
  14900. virtual void showColumnChooserMenu (const int columnIdClicked);
  14901. juce_UseDebuggingNewOperator
  14902. private:
  14903. struct ColumnInfo
  14904. {
  14905. String name;
  14906. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14907. double lastDeliberateWidth;
  14908. bool isVisible() const;
  14909. };
  14910. OwnedArray <ColumnInfo> columns;
  14911. Array <TableHeaderListener*> listeners;
  14912. ScopedPointer <Component> dragOverlayComp;
  14913. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14914. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14915. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14916. ColumnInfo* getInfoForId (const int columnId) const;
  14917. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14918. void sendColumnsChanged();
  14919. void handleAsyncUpdate();
  14920. void beginDrag (const MouseEvent&);
  14921. void endDrag (const int finalIndex);
  14922. int getResizeDraggerAt (const int mouseX) const;
  14923. void updateColumnUnderMouse (int x, int y);
  14924. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14925. TableHeaderComponent (const TableHeaderComponent&);
  14926. const TableHeaderComponent operator= (const TableHeaderComponent&);
  14927. };
  14928. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14929. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14930. #endif
  14931. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14932. /*** Start of inlined file: juce_TableListBox.h ***/
  14933. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14934. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14935. class JUCE_API TableListBoxModel
  14936. {
  14937. public:
  14938. TableListBoxModel() {}
  14939. virtual ~TableListBoxModel() {}
  14940. virtual int getNumRows() = 0;
  14941. virtual void paintRowBackground (Graphics& g,
  14942. int rowNumber,
  14943. int width, int height,
  14944. bool rowIsSelected) = 0;
  14945. virtual void paintCell (Graphics& g,
  14946. int rowNumber,
  14947. int columnId,
  14948. int width, int height,
  14949. bool rowIsSelected) = 0;
  14950. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14951. Component* existingComponentToUpdate);
  14952. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14953. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14954. virtual void backgroundClicked();
  14955. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14956. virtual int getColumnAutoSizeWidth (int columnId);
  14957. virtual const String getCellTooltip (int rowNumber, int columnId);
  14958. virtual void selectedRowsChanged (int lastRowSelected);
  14959. virtual void deleteKeyPressed (int lastRowSelected);
  14960. virtual void returnKeyPressed (int lastRowSelected);
  14961. virtual void listWasScrolled();
  14962. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14963. };
  14964. class JUCE_API TableListBox : public ListBox,
  14965. private ListBoxModel,
  14966. private TableHeaderListener
  14967. {
  14968. public:
  14969. TableListBox (const String& componentName,
  14970. TableListBoxModel* const model);
  14971. ~TableListBox();
  14972. void setModel (TableListBoxModel* const newModel);
  14973. TableListBoxModel* getModel() const { return model; }
  14974. TableHeaderComponent* getHeader() const { return header; }
  14975. void setHeaderHeight (const int newHeight);
  14976. int getHeaderHeight() const;
  14977. void autoSizeColumn (const int columnId);
  14978. void autoSizeAllColumns();
  14979. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14980. bool isAutoSizeMenuOptionShown() const;
  14981. const Rectangle<int> getCellPosition (const int columnId,
  14982. const int rowNumber,
  14983. const bool relativeToComponentTopLeft) const;
  14984. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14985. int getNumRows();
  14986. void paintListBoxItem (int, Graphics&, int, int, bool);
  14987. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14988. void selectedRowsChanged (int lastRowSelected);
  14989. void deleteKeyPressed (int currentSelectedRow);
  14990. void returnKeyPressed (int currentSelectedRow);
  14991. void backgroundClicked();
  14992. void listWasScrolled();
  14993. void tableColumnsChanged (TableHeaderComponent*);
  14994. void tableColumnsResized (TableHeaderComponent*);
  14995. void tableSortOrderChanged (TableHeaderComponent*);
  14996. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14997. void resized();
  14998. juce_UseDebuggingNewOperator
  14999. private:
  15000. TableHeaderComponent* header;
  15001. TableListBoxModel* model;
  15002. int columnIdNowBeingDragged;
  15003. bool autoSizeOptionsShown;
  15004. void updateColumnComponents() const;
  15005. TableListBox (const TableListBox&);
  15006. const TableListBox& operator= (const TableListBox&);
  15007. };
  15008. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  15009. /*** End of inlined file: juce_TableListBox.h ***/
  15010. #endif
  15011. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  15012. #endif
  15013. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  15014. #endif
  15015. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  15016. #endif
  15017. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15018. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  15019. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15020. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15021. class JUCE_API ToolbarItemFactory
  15022. {
  15023. public:
  15024. ToolbarItemFactory();
  15025. virtual ~ToolbarItemFactory();
  15026. enum SpecialItemIds
  15027. {
  15028. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  15029. can be placed between sets of items to break them into groups. */
  15030. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  15031. items.*/
  15032. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  15033. either side of it, filling any available space. */
  15034. };
  15035. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  15036. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  15037. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  15038. };
  15039. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15040. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  15041. #endif
  15042. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15043. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15044. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15045. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15046. class JUCE_API ToolbarItemPalette : public Component,
  15047. public DragAndDropContainer
  15048. {
  15049. public:
  15050. ToolbarItemPalette (ToolbarItemFactory& factory,
  15051. Toolbar* const toolbar);
  15052. ~ToolbarItemPalette();
  15053. void resized();
  15054. juce_UseDebuggingNewOperator
  15055. private:
  15056. ToolbarItemFactory& factory;
  15057. Toolbar* toolbar;
  15058. Viewport* viewport;
  15059. friend class Toolbar;
  15060. void replaceComponent (ToolbarItemComponent* const comp);
  15061. ToolbarItemPalette (const ToolbarItemPalette&);
  15062. const ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15063. };
  15064. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15065. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15066. #endif
  15067. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15068. /*** Start of inlined file: juce_TreeView.h ***/
  15069. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15070. #define __JUCE_TREEVIEW_JUCEHEADER__
  15071. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15072. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15073. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15074. class JUCE_API FileDragAndDropTarget
  15075. {
  15076. public:
  15077. virtual ~FileDragAndDropTarget() {}
  15078. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15079. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15080. virtual void fileDragMove (const StringArray& files, int x, int y);
  15081. virtual void fileDragExit (const StringArray& files);
  15082. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15083. };
  15084. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15085. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15086. class TreeView;
  15087. class JUCE_API TreeViewItem
  15088. {
  15089. public:
  15090. TreeViewItem();
  15091. virtual ~TreeViewItem();
  15092. int getNumSubItems() const throw();
  15093. TreeViewItem* getSubItem (const int index) const throw();
  15094. void clearSubItems();
  15095. void addSubItem (TreeViewItem* const newItem,
  15096. const int insertPosition = -1);
  15097. void removeSubItem (const int index,
  15098. const bool deleteItem = true);
  15099. TreeView* getOwnerView() const throw() { return ownerView; }
  15100. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15101. bool isOpen() const throw();
  15102. void setOpen (const bool shouldBeOpen);
  15103. bool isSelected() const throw();
  15104. void setSelected (const bool shouldBeSelected,
  15105. const bool deselectOtherItemsFirst);
  15106. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  15107. void treeHasChanged() const throw();
  15108. void repaintItem() const;
  15109. int getRowNumberInTree() const throw();
  15110. bool areAllParentsOpen() const throw();
  15111. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  15112. virtual bool mightContainSubItems() = 0;
  15113. virtual const String getUniqueName() const;
  15114. virtual void itemOpennessChanged (bool isNowOpen);
  15115. virtual int getItemWidth() const { return -1; }
  15116. virtual int getItemHeight() const { return 20; }
  15117. virtual bool canBeSelected() const { return true; }
  15118. virtual Component* createItemComponent() { return 0; }
  15119. virtual void paintItem (Graphics& g, int width, int height);
  15120. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15121. virtual void itemClicked (const MouseEvent& e);
  15122. virtual void itemDoubleClicked (const MouseEvent& e);
  15123. virtual void itemSelectionChanged (bool isNowSelected);
  15124. virtual const String getTooltip();
  15125. virtual const String getDragSourceDescription();
  15126. virtual bool isInterestedInFileDrag (const StringArray& files);
  15127. virtual void filesDropped (const StringArray& files, int insertIndex);
  15128. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15129. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15130. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15131. XmlElement* getOpennessState() const throw();
  15132. void restoreOpennessState (const XmlElement& xml) throw();
  15133. int getIndexInParent() const throw();
  15134. bool isLastOfSiblings() const throw();
  15135. const String getItemIdentifierString() const;
  15136. juce_UseDebuggingNewOperator
  15137. private:
  15138. TreeView* ownerView;
  15139. TreeViewItem* parentItem;
  15140. OwnedArray <TreeViewItem> subItems;
  15141. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15142. int uid;
  15143. bool selected : 1;
  15144. bool redrawNeeded : 1;
  15145. bool drawLinesInside : 1;
  15146. bool drawsInLeftMargin : 1;
  15147. unsigned int openness : 2;
  15148. friend class TreeView;
  15149. friend class TreeViewContentComponent;
  15150. void updatePositions (int newY);
  15151. int getIndentX() const throw();
  15152. void setOwnerView (TreeView* const newOwner) throw();
  15153. void paintRecursively (Graphics& g, int width);
  15154. TreeViewItem* getTopLevelItem() throw();
  15155. TreeViewItem* findItemRecursively (int y) throw();
  15156. TreeViewItem* getDeepestOpenParentItem() throw();
  15157. int getNumRows() const throw();
  15158. TreeViewItem* getItemOnRow (int index) throw();
  15159. void deselectAllRecursively();
  15160. int countSelectedItemsRecursively() const throw();
  15161. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15162. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  15163. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15164. TreeViewItem (const TreeViewItem&);
  15165. const TreeViewItem& operator= (const TreeViewItem&);
  15166. };
  15167. class JUCE_API TreeView : public Component,
  15168. public SettableTooltipClient,
  15169. public FileDragAndDropTarget,
  15170. public DragAndDropTarget,
  15171. private AsyncUpdater
  15172. {
  15173. public:
  15174. TreeView (const String& componentName = String::empty);
  15175. ~TreeView();
  15176. void setRootItem (TreeViewItem* const newRootItem);
  15177. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15178. void deleteRootItem();
  15179. void setRootItemVisible (const bool shouldBeVisible);
  15180. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15181. void setDefaultOpenness (const bool isOpenByDefault);
  15182. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15183. void setMultiSelectEnabled (const bool canMultiSelect);
  15184. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15185. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  15186. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15187. void clearSelectedItems();
  15188. int getNumSelectedItems() const throw();
  15189. TreeViewItem* getSelectedItem (const int index) const throw();
  15190. int getNumRowsInTree() const;
  15191. TreeViewItem* getItemOnRow (int index) const;
  15192. TreeViewItem* getItemAt (int yPosition) const throw();
  15193. void scrollToKeepItemVisible (TreeViewItem* item);
  15194. Viewport* getViewport() const throw() { return viewport; }
  15195. int getIndentSize() const throw() { return indentSize; }
  15196. void setIndentSize (const int newIndentSize);
  15197. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15198. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  15199. void restoreOpennessState (const XmlElement& newState);
  15200. enum ColourIds
  15201. {
  15202. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15203. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15204. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15205. };
  15206. void paint (Graphics& g);
  15207. void resized();
  15208. bool keyPressed (const KeyPress& key);
  15209. void colourChanged();
  15210. void enablementChanged();
  15211. bool isInterestedInFileDrag (const StringArray& files);
  15212. void fileDragEnter (const StringArray& files, int x, int y);
  15213. void fileDragMove (const StringArray& files, int x, int y);
  15214. void fileDragExit (const StringArray& files);
  15215. void filesDropped (const StringArray& files, int x, int y);
  15216. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15217. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15218. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15219. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15220. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15221. juce_UseDebuggingNewOperator
  15222. private:
  15223. friend class TreeViewItem;
  15224. friend class TreeViewContentComponent;
  15225. Viewport* viewport;
  15226. CriticalSection nodeAlterationLock;
  15227. TreeViewItem* rootItem;
  15228. Component* dragInsertPointHighlight;
  15229. Component* dragTargetGroupHighlight;
  15230. int indentSize;
  15231. bool defaultOpenness : 1;
  15232. bool needsRecalculating : 1;
  15233. bool rootItemVisible : 1;
  15234. bool multiSelectEnabled : 1;
  15235. bool openCloseButtonsVisible : 1;
  15236. void itemsChanged() throw();
  15237. void handleAsyncUpdate();
  15238. void moveSelectedRow (int delta);
  15239. void updateButtonUnderMouse (const MouseEvent& e);
  15240. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15241. void hideDragHighlight() throw();
  15242. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15243. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15244. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15245. const StringArray& files, const String& sourceDescription,
  15246. Component* sourceComponent) const throw();
  15247. TreeView (const TreeView&);
  15248. const TreeView& operator= (const TreeView&);
  15249. };
  15250. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15251. /*** End of inlined file: juce_TreeView.h ***/
  15252. #endif
  15253. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15254. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15255. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15256. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15257. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15258. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15259. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15260. /*** Start of inlined file: juce_FileFilter.h ***/
  15261. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15262. #define __JUCE_FILEFILTER_JUCEHEADER__
  15263. class JUCE_API FileFilter
  15264. {
  15265. public:
  15266. FileFilter (const String& filterDescription);
  15267. virtual ~FileFilter();
  15268. const String& getDescription() const throw();
  15269. virtual bool isFileSuitable (const File& file) const = 0;
  15270. virtual bool isDirectorySuitable (const File& file) const = 0;
  15271. protected:
  15272. String description;
  15273. };
  15274. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15275. /*** End of inlined file: juce_FileFilter.h ***/
  15276. /*** Start of inlined file: juce_Image.h ***/
  15277. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15278. #define __JUCE_IMAGE_JUCEHEADER__
  15279. class JUCE_API Image
  15280. {
  15281. public:
  15282. enum PixelFormat
  15283. {
  15284. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15285. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15286. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15287. };
  15288. Image (const PixelFormat format,
  15289. const int imageWidth,
  15290. const int imageHeight,
  15291. const bool clearImage);
  15292. Image (const Image& other);
  15293. virtual ~Image();
  15294. static Image* createNativeImage (const PixelFormat format,
  15295. const int imageWidth,
  15296. const int imageHeight,
  15297. const bool clearImage);
  15298. int getWidth() const throw() { return imageWidth; }
  15299. int getHeight() const throw() { return imageHeight; }
  15300. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15301. PixelFormat getFormat() const throw() { return format; }
  15302. bool isARGB() const throw() { return format == ARGB; }
  15303. bool isRGB() const throw() { return format == RGB; }
  15304. bool hasAlphaChannel() const throw() { return format != RGB; }
  15305. virtual void clear (int x, int y, int w, int h,
  15306. const Colour& colourToClearTo = Colour (0x00000000));
  15307. virtual Image* createCopy (int newWidth = -1,
  15308. int newHeight = -1,
  15309. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15310. virtual Image* createCopyOfAlphaChannel() const;
  15311. virtual const Colour getPixelAt (const int x, const int y) const;
  15312. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  15313. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  15314. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  15315. virtual void desaturate();
  15316. class BitmapData
  15317. {
  15318. public:
  15319. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  15320. BitmapData (const Image& image, int x, int y, int w, int h);
  15321. ~BitmapData();
  15322. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  15323. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  15324. uint8* data;
  15325. int lineStride, pixelStride, width, height;
  15326. private:
  15327. BitmapData (const BitmapData&);
  15328. const BitmapData& operator= (const BitmapData&);
  15329. };
  15330. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15331. const uint8* sourcePixelData, int sourceLineStride);
  15332. virtual void moveImageSection (int destX, int destY,
  15333. int sourceX, int sourceY,
  15334. int width, int height);
  15335. void createSolidAreaMask (RectangleList& result,
  15336. const float alphaThreshold = 0.5f) const;
  15337. juce_UseDebuggingNewOperator
  15338. virtual LowLevelGraphicsContext* createLowLevelContext();
  15339. protected:
  15340. friend class BitmapData;
  15341. const PixelFormat format;
  15342. const int imageWidth, imageHeight;
  15343. Image (const PixelFormat format,
  15344. const int imageWidth,
  15345. const int imageHeight);
  15346. int pixelStride, lineStride;
  15347. HeapBlock <uint8> imageDataAllocated;
  15348. uint8* imageData;
  15349. private:
  15350. const Image& operator= (const Image&);
  15351. };
  15352. #endif // __JUCE_IMAGE_JUCEHEADER__
  15353. /*** End of inlined file: juce_Image.h ***/
  15354. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15355. public TimeSliceClient
  15356. {
  15357. public:
  15358. DirectoryContentsList (const FileFilter* const fileFilter,
  15359. TimeSliceThread& threadToUse);
  15360. ~DirectoryContentsList();
  15361. void setDirectory (const File& directory,
  15362. const bool includeDirectories,
  15363. const bool includeFiles);
  15364. const File& getDirectory() const;
  15365. void clear();
  15366. void refresh();
  15367. bool isStillLoading() const;
  15368. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15369. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15370. struct FileInfo
  15371. {
  15372. String filename;
  15373. int64 fileSize;
  15374. Time modificationTime;
  15375. Time creationTime;
  15376. bool isDirectory;
  15377. bool isReadOnly;
  15378. };
  15379. int getNumFiles() const;
  15380. bool getFileInfo (const int index,
  15381. FileInfo& resultInfo) const;
  15382. const File getFile (const int index) const;
  15383. const FileFilter* getFilter() const { return fileFilter; }
  15384. bool useTimeSlice();
  15385. TimeSliceThread& getTimeSliceThread() { return thread; }
  15386. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15387. const DirectoryContentsList::FileInfo* const second);
  15388. juce_UseDebuggingNewOperator
  15389. private:
  15390. File root;
  15391. const FileFilter* fileFilter;
  15392. TimeSliceThread& thread;
  15393. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15394. CriticalSection fileListLock;
  15395. OwnedArray <FileInfo> files;
  15396. void* volatile fileFindHandle;
  15397. bool volatile shouldStop;
  15398. void changed();
  15399. bool checkNextFile (bool& hasChanged);
  15400. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15401. const int64 fileSize, const Time& modTime,
  15402. const Time& creationTime, const bool isReadOnly);
  15403. DirectoryContentsList (const DirectoryContentsList&);
  15404. const DirectoryContentsList& operator= (const DirectoryContentsList&);
  15405. };
  15406. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15407. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15408. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15409. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15410. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15411. class JUCE_API FileBrowserListener
  15412. {
  15413. public:
  15414. virtual ~FileBrowserListener();
  15415. virtual void selectionChanged() = 0;
  15416. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15417. virtual void fileDoubleClicked (const File& file) = 0;
  15418. };
  15419. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15420. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15421. class JUCE_API DirectoryContentsDisplayComponent
  15422. {
  15423. public:
  15424. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15425. virtual ~DirectoryContentsDisplayComponent();
  15426. virtual int getNumSelectedFiles() const = 0;
  15427. virtual const File getSelectedFile (int index) const = 0;
  15428. virtual void scrollToTop() = 0;
  15429. void addListener (FileBrowserListener* const listener) throw();
  15430. void removeListener (FileBrowserListener* const listener) throw();
  15431. enum ColourIds
  15432. {
  15433. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15434. textColourId = 0x1000541, /**< The colour for the text. */
  15435. };
  15436. void sendSelectionChangeMessage();
  15437. void sendDoubleClickMessage (const File& file);
  15438. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15439. juce_UseDebuggingNewOperator
  15440. protected:
  15441. DirectoryContentsList& fileList;
  15442. SortedSet <void*> listeners;
  15443. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15444. const DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15445. };
  15446. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15447. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15448. #endif
  15449. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15450. #endif
  15451. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15452. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15453. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15454. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15455. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15456. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15457. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15458. class JUCE_API FilePreviewComponent : public Component
  15459. {
  15460. public:
  15461. FilePreviewComponent();
  15462. ~FilePreviewComponent();
  15463. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15464. juce_UseDebuggingNewOperator
  15465. private:
  15466. FilePreviewComponent (const FilePreviewComponent&);
  15467. const FilePreviewComponent& operator= (const FilePreviewComponent&);
  15468. };
  15469. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15470. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15471. class JUCE_API FileBrowserComponent : public Component,
  15472. public ChangeBroadcaster,
  15473. private FileBrowserListener,
  15474. private TextEditorListener,
  15475. private ButtonListener,
  15476. private ComboBoxListener,
  15477. private FileFilter
  15478. {
  15479. public:
  15480. enum FileChooserFlags
  15481. {
  15482. openMode = 1, /**< specifies that the component should allow the user to
  15483. choose an existing file with the intention of opening it. */
  15484. saveMode = 2, /**< specifies that the component should allow the user to specify
  15485. the name of a file that will be used to save something. */
  15486. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15487. conjunction with canSelectDirectories). */
  15488. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15489. conjuction with canSelectFiles). */
  15490. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15491. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15492. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15493. };
  15494. FileBrowserComponent (int flags,
  15495. const File& initialFileOrDirectory,
  15496. const FileFilter* fileFilter,
  15497. FilePreviewComponent* previewComp);
  15498. ~FileBrowserComponent();
  15499. int getNumSelectedFiles() const throw();
  15500. const File getSelectedFile (int index) const throw();
  15501. bool currentFileIsValid() const;
  15502. const File getHighlightedFile() const throw();
  15503. const File getRoot() const;
  15504. void setRoot (const File& newRootDirectory);
  15505. void goUp();
  15506. void refresh();
  15507. virtual const String getActionVerb() const;
  15508. bool isSaveMode() const throw();
  15509. void addListener (FileBrowserListener* const listener) throw();
  15510. void removeListener (FileBrowserListener* const listener) throw();
  15511. void resized();
  15512. void buttonClicked (Button* b);
  15513. void comboBoxChanged (ComboBox*);
  15514. void textEditorTextChanged (TextEditor& editor);
  15515. void textEditorReturnKeyPressed (TextEditor& editor);
  15516. void textEditorEscapeKeyPressed (TextEditor& editor);
  15517. void textEditorFocusLost (TextEditor& editor);
  15518. bool keyPressed (const KeyPress& key);
  15519. void selectionChanged();
  15520. void fileClicked (const File& f, const MouseEvent& e);
  15521. void fileDoubleClicked (const File& f);
  15522. bool isFileSuitable (const File& file) const;
  15523. bool isDirectorySuitable (const File&) const;
  15524. FilePreviewComponent* getPreviewComponent() const throw();
  15525. juce_UseDebuggingNewOperator
  15526. protected:
  15527. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15528. private:
  15529. ScopedPointer <DirectoryContentsList> fileList;
  15530. const FileFilter* fileFilter;
  15531. int flags;
  15532. File currentRoot;
  15533. Array<File> chosenFiles;
  15534. SortedSet <void*> listeners;
  15535. DirectoryContentsDisplayComponent* fileListComponent;
  15536. FilePreviewComponent* previewComp;
  15537. ComboBox* currentPathBox;
  15538. TextEditor* filenameBox;
  15539. Button* goUpButton;
  15540. TimeSliceThread thread;
  15541. void sendListenerChangeMessage();
  15542. bool isFileOrDirSuitable (const File& f) const;
  15543. FileBrowserComponent (const FileBrowserComponent&);
  15544. const FileBrowserComponent& operator= (const FileBrowserComponent&);
  15545. };
  15546. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15547. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15548. #endif
  15549. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15550. #endif
  15551. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15552. /*** Start of inlined file: juce_FileChooser.h ***/
  15553. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15554. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15555. class JUCE_API FileChooser
  15556. {
  15557. public:
  15558. FileChooser (const String& dialogBoxTitle,
  15559. const File& initialFileOrDirectory = File::nonexistent,
  15560. const String& filePatternsAllowed = String::empty,
  15561. const bool useOSNativeDialogBox = true);
  15562. ~FileChooser();
  15563. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15564. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15565. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15566. bool browseForDirectory();
  15567. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15568. const File getResult() const;
  15569. const Array<File>& getResults() const;
  15570. juce_UseDebuggingNewOperator
  15571. private:
  15572. String title, filters;
  15573. File startingFile;
  15574. Array<File> results;
  15575. bool useNativeDialogBox;
  15576. bool showDialog (const bool selectsDirectories,
  15577. const bool selectsFiles,
  15578. const bool isSave,
  15579. const bool warnAboutOverwritingExistingFiles,
  15580. const bool selectMultipleFiles,
  15581. FilePreviewComponent* const previewComponent);
  15582. static void showPlatformDialog (Array<File>& results,
  15583. const String& title,
  15584. const File& file,
  15585. const String& filters,
  15586. bool selectsDirectories,
  15587. bool selectsFiles,
  15588. bool isSave,
  15589. bool warnAboutOverwritingExistingFiles,
  15590. bool selectMultipleFiles,
  15591. FilePreviewComponent* previewComponent);
  15592. };
  15593. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15594. /*** End of inlined file: juce_FileChooser.h ***/
  15595. #endif
  15596. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15597. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15598. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15599. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15600. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15601. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15602. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15603. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15604. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15605. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15606. /*** Start of inlined file: juce_DropShadower.h ***/
  15607. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15608. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15609. class JUCE_API DropShadower : public ComponentListener
  15610. {
  15611. public:
  15612. DropShadower (const float alpha = 0.5f,
  15613. const int xOffset = 1,
  15614. const int yOffset = 5,
  15615. const float blurRadius = 10.0f);
  15616. virtual ~DropShadower();
  15617. void setOwner (Component* componentToFollow);
  15618. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15619. void componentBroughtToFront (Component& component);
  15620. void componentChildrenChanged (Component& component);
  15621. void componentParentHierarchyChanged (Component& component);
  15622. void componentVisibilityChanged (Component& component);
  15623. juce_UseDebuggingNewOperator
  15624. private:
  15625. Component* owner;
  15626. int numShadows;
  15627. Component* shadowWindows[4];
  15628. Image* shadowImageSections[12];
  15629. const int shadowEdge, xOffset, yOffset;
  15630. const float alpha, blurRadius;
  15631. bool inDestructor, reentrant;
  15632. void updateShadows();
  15633. void setShadowImage (Image* const src,
  15634. const int num,
  15635. const int w, const int h,
  15636. const int sx, const int sy);
  15637. void bringShadowWindowsToFront();
  15638. void deleteShadowWindows();
  15639. DropShadower (const DropShadower&);
  15640. const DropShadower& operator= (const DropShadower&);
  15641. };
  15642. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15643. /*** End of inlined file: juce_DropShadower.h ***/
  15644. class JUCE_API TopLevelWindow : public Component
  15645. {
  15646. public:
  15647. TopLevelWindow (const String& name,
  15648. const bool addToDesktop);
  15649. ~TopLevelWindow();
  15650. bool isActiveWindow() const throw() { return windowIsActive_; }
  15651. void centreAroundComponent (Component* componentToCentreAround,
  15652. const int width, const int height);
  15653. void setDropShadowEnabled (const bool useShadow);
  15654. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15655. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15656. static int getNumTopLevelWindows() throw();
  15657. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15658. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15659. juce_UseDebuggingNewOperator
  15660. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15661. protected:
  15662. virtual void activeWindowStatusChanged();
  15663. void focusOfChildComponentChanged (FocusChangeType cause);
  15664. void parentHierarchyChanged();
  15665. void visibilityChanged();
  15666. virtual int getDesktopWindowStyleFlags() const;
  15667. void recreateDesktopWindow();
  15668. private:
  15669. friend class TopLevelWindowManager;
  15670. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15671. ScopedPointer <DropShadower> shadower;
  15672. void setWindowActive (const bool isNowActive) throw();
  15673. TopLevelWindow (const TopLevelWindow&);
  15674. const TopLevelWindow& operator= (const TopLevelWindow&);
  15675. };
  15676. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15677. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15678. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15679. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15680. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15681. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15682. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15683. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15684. class JUCE_API ComponentBoundsConstrainer
  15685. {
  15686. public:
  15687. ComponentBoundsConstrainer() throw();
  15688. virtual ~ComponentBoundsConstrainer();
  15689. void setMinimumWidth (const int minimumWidth) throw();
  15690. int getMinimumWidth() const throw() { return minW; }
  15691. void setMaximumWidth (const int maximumWidth) throw();
  15692. int getMaximumWidth() const throw() { return maxW; }
  15693. void setMinimumHeight (const int minimumHeight) throw();
  15694. int getMinimumHeight() const throw() { return minH; }
  15695. void setMaximumHeight (const int maximumHeight) throw();
  15696. int getMaximumHeight() const throw() { return maxH; }
  15697. void setMinimumSize (const int minimumWidth,
  15698. const int minimumHeight) throw();
  15699. void setMaximumSize (const int maximumWidth,
  15700. const int maximumHeight) throw();
  15701. void setSizeLimits (const int minimumWidth,
  15702. const int minimumHeight,
  15703. const int maximumWidth,
  15704. const int maximumHeight) throw();
  15705. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15706. const int minimumWhenOffTheLeft,
  15707. const int minimumWhenOffTheBottom,
  15708. const int minimumWhenOffTheRight) throw();
  15709. void setFixedAspectRatio (const double widthOverHeight) throw();
  15710. double getFixedAspectRatio() const throw();
  15711. virtual void checkBounds (Rectangle<int>& bounds,
  15712. const Rectangle<int>& previousBounds,
  15713. const Rectangle<int>& limits,
  15714. const bool isStretchingTop,
  15715. const bool isStretchingLeft,
  15716. const bool isStretchingBottom,
  15717. const bool isStretchingRight);
  15718. virtual void resizeStart();
  15719. virtual void resizeEnd();
  15720. void setBoundsForComponent (Component* const component,
  15721. const Rectangle<int>& bounds,
  15722. const bool isStretchingTop,
  15723. const bool isStretchingLeft,
  15724. const bool isStretchingBottom,
  15725. const bool isStretchingRight);
  15726. void checkComponentBounds (Component* component);
  15727. virtual void applyBoundsToComponent (Component* component,
  15728. const Rectangle<int>& bounds);
  15729. juce_UseDebuggingNewOperator
  15730. private:
  15731. int minW, maxW, minH, maxH;
  15732. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15733. double aspectRatio;
  15734. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15735. const ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15736. };
  15737. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15738. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15739. class JUCE_API ComponentDragger
  15740. {
  15741. public:
  15742. ComponentDragger();
  15743. virtual ~ComponentDragger();
  15744. void startDraggingComponent (Component* const componentToDrag,
  15745. ComponentBoundsConstrainer* constrainer);
  15746. void dragComponent (Component* const componentToDrag,
  15747. const MouseEvent& e);
  15748. juce_UseDebuggingNewOperator
  15749. private:
  15750. ComponentBoundsConstrainer* constrainer;
  15751. Point<int> originalPos;
  15752. };
  15753. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15754. /*** End of inlined file: juce_ComponentDragger.h ***/
  15755. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15756. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15757. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15758. class JUCE_API ResizableBorderComponent : public Component
  15759. {
  15760. public:
  15761. ResizableBorderComponent (Component* const componentToResize,
  15762. ComponentBoundsConstrainer* const constrainer);
  15763. ~ResizableBorderComponent();
  15764. void setBorderThickness (const BorderSize& newBorderSize) throw();
  15765. const BorderSize getBorderThickness() const throw();
  15766. juce_UseDebuggingNewOperator
  15767. protected:
  15768. void paint (Graphics& g);
  15769. void mouseEnter (const MouseEvent& e);
  15770. void mouseMove (const MouseEvent& e);
  15771. void mouseDown (const MouseEvent& e);
  15772. void mouseDrag (const MouseEvent& e);
  15773. void mouseUp (const MouseEvent& e);
  15774. bool hitTest (int x, int y);
  15775. private:
  15776. Component* const component;
  15777. ComponentBoundsConstrainer* constrainer;
  15778. BorderSize borderSize;
  15779. int originalX, originalY, originalW, originalH;
  15780. int mouseZone;
  15781. void updateMouseZone (const MouseEvent& e) throw();
  15782. ResizableBorderComponent (const ResizableBorderComponent&);
  15783. const ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15784. };
  15785. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15786. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15787. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15788. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15789. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15790. class JUCE_API ResizableCornerComponent : public Component
  15791. {
  15792. public:
  15793. ResizableCornerComponent (Component* const componentToResize,
  15794. ComponentBoundsConstrainer* const constrainer);
  15795. ~ResizableCornerComponent();
  15796. juce_UseDebuggingNewOperator
  15797. protected:
  15798. void paint (Graphics& g);
  15799. void mouseDown (const MouseEvent& e);
  15800. void mouseDrag (const MouseEvent& e);
  15801. void mouseUp (const MouseEvent& e);
  15802. bool hitTest (int x, int y);
  15803. private:
  15804. Component* const component;
  15805. ComponentBoundsConstrainer* constrainer;
  15806. int originalX, originalY, originalW, originalH;
  15807. ResizableCornerComponent (const ResizableCornerComponent&);
  15808. const ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15809. };
  15810. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15811. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15812. class JUCE_API ResizableWindow : public TopLevelWindow
  15813. {
  15814. public:
  15815. ResizableWindow (const String& name,
  15816. const bool addToDesktop);
  15817. ResizableWindow (const String& name,
  15818. const Colour& backgroundColour,
  15819. const bool addToDesktop);
  15820. ~ResizableWindow();
  15821. const Colour getBackgroundColour() const throw();
  15822. void setBackgroundColour (const Colour& newColour);
  15823. void setResizable (const bool shouldBeResizable,
  15824. const bool useBottomRightCornerResizer);
  15825. bool isResizable() const throw();
  15826. void setResizeLimits (const int newMinimumWidth,
  15827. const int newMinimumHeight,
  15828. const int newMaximumWidth,
  15829. const int newMaximumHeight) throw();
  15830. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15831. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15832. void setBoundsConstrained (const Rectangle<int>& bounds);
  15833. bool isFullScreen() const;
  15834. void setFullScreen (const bool shouldBeFullScreen);
  15835. bool isMinimised() const;
  15836. void setMinimised (const bool shouldMinimise);
  15837. const String getWindowStateAsString();
  15838. bool restoreWindowStateFromString (const String& previousState);
  15839. Component* getContentComponent() const throw() { return contentComponent; }
  15840. void setContentComponent (Component* const newContentComponent,
  15841. const bool deleteOldOne = true,
  15842. const bool resizeToFit = false);
  15843. void setContentComponentSize (int width, int height);
  15844. enum ColourIds
  15845. {
  15846. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15847. };
  15848. juce_UseDebuggingNewOperator
  15849. protected:
  15850. void paint (Graphics& g);
  15851. void moved();
  15852. void resized();
  15853. void mouseDown (const MouseEvent& e);
  15854. void mouseDrag (const MouseEvent& e);
  15855. void lookAndFeelChanged();
  15856. void childBoundsChanged (Component* child);
  15857. void parentSizeChanged();
  15858. void visibilityChanged();
  15859. void activeWindowStatusChanged();
  15860. int getDesktopWindowStyleFlags() const;
  15861. virtual const BorderSize getBorderThickness();
  15862. virtual const BorderSize getContentComponentBorder();
  15863. #ifdef JUCE_DEBUG
  15864. void addChildComponent (Component* const child, int zOrder = -1);
  15865. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15866. #endif
  15867. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15868. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15869. private:
  15870. ScopedPointer <Component> contentComponent;
  15871. bool resizeToFitContent, fullscreen;
  15872. ComponentDragger dragger;
  15873. Rectangle<int> lastNonFullScreenPos;
  15874. ComponentBoundsConstrainer defaultConstrainer;
  15875. ComponentBoundsConstrainer* constrainer;
  15876. #ifdef JUCE_DEBUG
  15877. bool hasBeenResized;
  15878. #endif
  15879. void updateLastPos();
  15880. ResizableWindow (const ResizableWindow&);
  15881. const ResizableWindow& operator= (const ResizableWindow&);
  15882. // (xxx remove these eventually)
  15883. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15884. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15885. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15886. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15887. };
  15888. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15889. /*** End of inlined file: juce_ResizableWindow.h ***/
  15890. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15891. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15892. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15893. class JUCE_API PositionedGlyph
  15894. {
  15895. public:
  15896. juce_wchar getCharacter() const { return character; }
  15897. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15898. float getLeft() const { return x; }
  15899. float getRight() const { return x + w; }
  15900. float getBaselineY() const { return y; }
  15901. float getTop() const { return y - font.getAscent(); }
  15902. float getBottom() const { return y + font.getDescent(); }
  15903. void moveBy (const float deltaX,
  15904. const float deltaY);
  15905. void draw (const Graphics& g) const;
  15906. void draw (const Graphics& g, const AffineTransform& transform) const;
  15907. void createPath (Path& path) const;
  15908. bool hitTest (float x, float y) const;
  15909. juce_UseDebuggingNewOperator
  15910. private:
  15911. friend class GlyphArrangement;
  15912. float x, y, w;
  15913. Font font;
  15914. juce_wchar character;
  15915. int glyph;
  15916. PositionedGlyph();
  15917. };
  15918. class JUCE_API GlyphArrangement
  15919. {
  15920. public:
  15921. GlyphArrangement();
  15922. GlyphArrangement (const GlyphArrangement& other);
  15923. const GlyphArrangement& operator= (const GlyphArrangement& other);
  15924. ~GlyphArrangement();
  15925. int getNumGlyphs() const { return glyphs.size(); }
  15926. PositionedGlyph& getGlyph (const int index) const;
  15927. void clear();
  15928. void addLineOfText (const Font& font,
  15929. const String& text,
  15930. const float x,
  15931. const float y);
  15932. void addCurtailedLineOfText (const Font& font,
  15933. const String& text,
  15934. float x,
  15935. const float y,
  15936. const float maxWidthPixels,
  15937. const bool useEllipsis);
  15938. void addJustifiedText (const Font& font,
  15939. const String& text,
  15940. float x, float y,
  15941. const float maxLineWidth,
  15942. const Justification& horizontalLayout);
  15943. void addFittedText (const Font& font,
  15944. const String& text,
  15945. const float x, const float y,
  15946. const float width, const float height,
  15947. const Justification& layout,
  15948. int maximumLinesToUse,
  15949. const float minimumHorizontalScale = 0.7f);
  15950. void addGlyphArrangement (const GlyphArrangement& other);
  15951. void draw (const Graphics& g) const;
  15952. void draw (const Graphics& g, const AffineTransform& transform) const;
  15953. void createPath (Path& path) const;
  15954. int findGlyphIndexAt (float x, float y) const;
  15955. void getBoundingBox (int startIndex,
  15956. int numGlyphs,
  15957. float& left,
  15958. float& top,
  15959. float& right,
  15960. float& bottom,
  15961. const bool includeWhitespace) const;
  15962. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15963. const float deltaX,
  15964. const float deltaY);
  15965. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15966. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15967. const float horizontalScaleFactor);
  15968. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15969. const float x,
  15970. const float y,
  15971. const float width,
  15972. const float height,
  15973. const Justification& justification);
  15974. juce_UseDebuggingNewOperator
  15975. private:
  15976. OwnedArray <PositionedGlyph> glyphs;
  15977. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15978. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15979. const Justification& justification, float minimumHorizontalScale);
  15980. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15981. };
  15982. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15983. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15984. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15985. public ButtonListener,
  15986. public FileBrowserListener
  15987. {
  15988. public:
  15989. FileChooserDialogBox (const String& title,
  15990. const String& instructions,
  15991. FileBrowserComponent& browserComponent,
  15992. const bool warnAboutOverwritingExistingFiles,
  15993. const Colour& backgroundColour);
  15994. ~FileChooserDialogBox();
  15995. bool show (int width = 0,int height = 0);
  15996. enum ColourIds
  15997. {
  15998. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15999. };
  16000. void buttonClicked (Button* button);
  16001. void closeButtonPressed();
  16002. void selectionChanged();
  16003. void fileClicked (const File& file, const MouseEvent& e);
  16004. void fileDoubleClicked (const File& file);
  16005. juce_UseDebuggingNewOperator
  16006. private:
  16007. class ContentComponent : public Component
  16008. {
  16009. public:
  16010. ContentComponent();
  16011. ~ContentComponent();
  16012. void paint (Graphics& g);
  16013. void resized();
  16014. String instructions;
  16015. GlyphArrangement text;
  16016. FileBrowserComponent* chooserComponent;
  16017. FilePreviewComponent* previewComponent;
  16018. TextButton* okButton;
  16019. TextButton* cancelButton;
  16020. };
  16021. ContentComponent* content;
  16022. const bool warnAboutOverwritingExistingFiles;
  16023. FileChooserDialogBox (const FileChooserDialogBox&);
  16024. const FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  16025. };
  16026. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  16027. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  16028. #endif
  16029. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  16030. #endif
  16031. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16032. /*** Start of inlined file: juce_FileListComponent.h ***/
  16033. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16034. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16035. class JUCE_API FileListComponent : public ListBox,
  16036. public DirectoryContentsDisplayComponent,
  16037. private ListBoxModel,
  16038. private ChangeListener
  16039. {
  16040. public:
  16041. FileListComponent (DirectoryContentsList& listToShow);
  16042. ~FileListComponent();
  16043. int getNumSelectedFiles() const;
  16044. const File getSelectedFile (int index = 0) const;
  16045. void scrollToTop();
  16046. void changeListenerCallback (void*);
  16047. int getNumRows();
  16048. void paintListBoxItem (int, Graphics&, int, int, bool);
  16049. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16050. void selectedRowsChanged (int lastRowSelected);
  16051. void deleteKeyPressed (int currentSelectedRow);
  16052. void returnKeyPressed (int currentSelectedRow);
  16053. juce_UseDebuggingNewOperator
  16054. private:
  16055. FileListComponent (const FileListComponent&);
  16056. const FileListComponent& operator= (const FileListComponent&);
  16057. File lastDirectory;
  16058. };
  16059. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16060. /*** End of inlined file: juce_FileListComponent.h ***/
  16061. #endif
  16062. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16063. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16064. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16065. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16066. class FilenameComponent;
  16067. class JUCE_API FilenameComponentListener
  16068. {
  16069. public:
  16070. virtual ~FilenameComponentListener() {}
  16071. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16072. };
  16073. class JUCE_API FilenameComponent : public Component,
  16074. public SettableTooltipClient,
  16075. public FileDragAndDropTarget,
  16076. private AsyncUpdater,
  16077. private ButtonListener,
  16078. private ComboBoxListener
  16079. {
  16080. public:
  16081. FilenameComponent (const String& name,
  16082. const File& currentFile,
  16083. const bool canEditFilename,
  16084. const bool isDirectory,
  16085. const bool isForSaving,
  16086. const String& fileBrowserWildcard,
  16087. const String& enforcedSuffix,
  16088. const String& textWhenNothingSelected);
  16089. ~FilenameComponent();
  16090. const File getCurrentFile() const;
  16091. void setCurrentFile (File newFile,
  16092. const bool addToRecentlyUsedList,
  16093. const bool sendChangeNotification = true);
  16094. void setFilenameIsEditable (const bool shouldBeEditable);
  16095. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16096. const StringArray getRecentlyUsedFilenames() const;
  16097. void setRecentlyUsedFilenames (const StringArray& filenames);
  16098. void addRecentlyUsedFile (const File& file);
  16099. void setMaxNumberOfRecentFiles (const int newMaximum);
  16100. void setBrowseButtonText (const String& browseButtonText);
  16101. void addListener (FilenameComponentListener* const listener) throw();
  16102. void removeListener (FilenameComponentListener* const listener) throw();
  16103. void setTooltip (const String& newTooltip);
  16104. void paintOverChildren (Graphics& g);
  16105. void resized();
  16106. void lookAndFeelChanged();
  16107. bool isInterestedInFileDrag (const StringArray& files);
  16108. void filesDropped (const StringArray& files, int, int);
  16109. void fileDragEnter (const StringArray& files, int, int);
  16110. void fileDragExit (const StringArray& files);
  16111. juce_UseDebuggingNewOperator
  16112. private:
  16113. ComboBox* filenameBox;
  16114. String lastFilename;
  16115. Button* browseButton;
  16116. int maxRecentFiles;
  16117. bool isDir, isSaving, isFileDragOver;
  16118. String wildcard, enforcedSuffix, browseButtonText;
  16119. SortedSet <void*> listeners;
  16120. File defaultBrowseFile;
  16121. void comboBoxChanged (ComboBox*);
  16122. void buttonClicked (Button* button);
  16123. void handleAsyncUpdate();
  16124. FilenameComponent (const FilenameComponent&);
  16125. const FilenameComponent& operator= (const FilenameComponent&);
  16126. };
  16127. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16128. /*** End of inlined file: juce_FilenameComponent.h ***/
  16129. #endif
  16130. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16131. #endif
  16132. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16133. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16134. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16135. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16136. class JUCE_API FileSearchPathListComponent : public Component,
  16137. public SettableTooltipClient,
  16138. public FileDragAndDropTarget,
  16139. private ButtonListener,
  16140. private ListBoxModel
  16141. {
  16142. public:
  16143. FileSearchPathListComponent();
  16144. ~FileSearchPathListComponent();
  16145. const FileSearchPath& getPath() const throw() { return path; }
  16146. void setPath (const FileSearchPath& newPath);
  16147. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16148. enum ColourIds
  16149. {
  16150. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16151. Make this transparent if you don't want the background to be filled. */
  16152. };
  16153. int getNumRows();
  16154. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16155. void deleteKeyPressed (int lastRowSelected);
  16156. void returnKeyPressed (int lastRowSelected);
  16157. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16158. void selectedRowsChanged (int lastRowSelected);
  16159. void resized();
  16160. void paint (Graphics& g);
  16161. bool isInterestedInFileDrag (const StringArray& files);
  16162. void filesDropped (const StringArray& files, int, int);
  16163. void buttonClicked (Button* button);
  16164. juce_UseDebuggingNewOperator
  16165. private:
  16166. FileSearchPath path;
  16167. File defaultBrowseTarget;
  16168. ListBox* listBox;
  16169. Button* addButton;
  16170. Button* removeButton;
  16171. Button* changeButton;
  16172. Button* upButton;
  16173. Button* downButton;
  16174. void changed() throw();
  16175. void updateButtons() throw();
  16176. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16177. const FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16178. };
  16179. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16180. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16181. #endif
  16182. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16183. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16184. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16185. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16186. class JUCE_API FileTreeComponent : public TreeView,
  16187. public DirectoryContentsDisplayComponent
  16188. {
  16189. public:
  16190. FileTreeComponent (DirectoryContentsList& listToShow);
  16191. ~FileTreeComponent();
  16192. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16193. const File getSelectedFile (int index = 0) const;
  16194. void scrollToTop();
  16195. void setDragAndDropDescription (const String& description) throw();
  16196. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16197. juce_UseDebuggingNewOperator
  16198. private:
  16199. String dragAndDropDescription;
  16200. FileTreeComponent (const FileTreeComponent&);
  16201. const FileTreeComponent& operator= (const FileTreeComponent&);
  16202. };
  16203. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16204. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16205. #endif
  16206. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16207. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16208. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16209. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16210. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16211. private Timer
  16212. {
  16213. public:
  16214. ImagePreviewComponent();
  16215. ~ImagePreviewComponent();
  16216. void selectedFileChanged (const File& newSelectedFile);
  16217. void paint (Graphics& g);
  16218. void timerCallback();
  16219. juce_UseDebuggingNewOperator
  16220. private:
  16221. File fileToLoad;
  16222. ScopedPointer <Image> currentThumbnail;
  16223. String currentDetails;
  16224. void getThumbSize (int& w, int& h) const;
  16225. ImagePreviewComponent (const ImagePreviewComponent&);
  16226. const ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16227. };
  16228. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16229. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16230. #endif
  16231. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16232. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16233. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16234. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16235. class JUCE_API WildcardFileFilter : public FileFilter
  16236. {
  16237. public:
  16238. WildcardFileFilter (const String& fileWildcardPatterns,
  16239. const String& directoryWildcardPatterns,
  16240. const String& description);
  16241. ~WildcardFileFilter();
  16242. bool isFileSuitable (const File& file) const;
  16243. bool isDirectorySuitable (const File& file) const;
  16244. juce_UseDebuggingNewOperator
  16245. private:
  16246. StringArray fileWildcards, directoryWildcards;
  16247. static void parse (const String& pattern, StringArray& result) throw();
  16248. static bool match (const File& file, const StringArray& wildcards) throw();
  16249. };
  16250. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16251. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16252. #endif
  16253. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16254. #endif
  16255. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16256. #endif
  16257. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16258. #endif
  16259. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16260. #endif
  16261. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16262. #endif
  16263. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16264. #endif
  16265. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16266. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16267. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16268. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16269. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16270. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16271. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16272. class JUCE_API KeyPressMappingSet : public KeyListener,
  16273. public ChangeBroadcaster,
  16274. public FocusChangeListener
  16275. {
  16276. public:
  16277. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16278. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16279. ~KeyPressMappingSet();
  16280. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16281. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16282. void addKeyPress (const CommandID commandID,
  16283. const KeyPress& newKeyPress,
  16284. int insertIndex = -1) throw();
  16285. void resetToDefaultMappings() throw();
  16286. void resetToDefaultMapping (const CommandID commandID) throw();
  16287. void clearAllKeyPresses() throw();
  16288. void clearAllKeyPresses (const CommandID commandID) throw();
  16289. void removeKeyPress (const CommandID commandID,
  16290. const int keyPressIndex) throw();
  16291. void removeKeyPress (const KeyPress& keypress) throw();
  16292. bool containsMapping (const CommandID commandID,
  16293. const KeyPress& keyPress) const throw();
  16294. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16295. bool restoreFromXml (const XmlElement& xmlVersion);
  16296. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16297. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16298. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16299. void globalFocusChanged (Component* focusedComponent);
  16300. juce_UseDebuggingNewOperator
  16301. private:
  16302. ApplicationCommandManager* commandManager;
  16303. struct CommandMapping
  16304. {
  16305. CommandID commandID;
  16306. Array <KeyPress> keypresses;
  16307. bool wantsKeyUpDownCallbacks;
  16308. };
  16309. OwnedArray <CommandMapping> mappings;
  16310. struct KeyPressTime
  16311. {
  16312. KeyPress key;
  16313. uint32 timeWhenPressed;
  16314. };
  16315. OwnedArray <KeyPressTime> keysDown;
  16316. void handleMessage (const Message& message);
  16317. void invokeCommand (const CommandID commandID,
  16318. const KeyPress& keyPress,
  16319. const bool isKeyDown,
  16320. const int millisecsSinceKeyPressed,
  16321. Component* const originatingComponent) const;
  16322. const KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16323. };
  16324. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16325. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16326. class JUCE_API KeyMappingEditorComponent : public Component,
  16327. public TreeViewItem,
  16328. public ChangeListener,
  16329. private ButtonListener
  16330. {
  16331. public:
  16332. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16333. const bool showResetToDefaultButton);
  16334. virtual ~KeyMappingEditorComponent();
  16335. void setColours (const Colour& mainBackground,
  16336. const Colour& textColour);
  16337. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16338. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16339. virtual bool isCommandReadOnly (const CommandID commandID);
  16340. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16341. enum ColourIds
  16342. {
  16343. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16344. textColourId = 0x100ad01, /**< The colour for the text. */
  16345. };
  16346. void parentHierarchyChanged();
  16347. void resized();
  16348. void changeListenerCallback (void*);
  16349. bool mightContainSubItems();
  16350. const String getUniqueName() const;
  16351. void buttonClicked (Button* button);
  16352. juce_UseDebuggingNewOperator
  16353. private:
  16354. KeyPressMappingSet* mappings;
  16355. TreeView* tree;
  16356. friend class KeyMappingTreeViewItem;
  16357. friend class KeyCategoryTreeViewItem;
  16358. friend class KeyMappingItemComponent;
  16359. friend class KeyMappingChangeButton;
  16360. TextButton* resetButton;
  16361. void assignNewKey (const CommandID commandID, int index);
  16362. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16363. const KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16364. };
  16365. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16366. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16367. #endif
  16368. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16369. #endif
  16370. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16371. #endif
  16372. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16373. #endif
  16374. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16375. #endif
  16376. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16377. #endif
  16378. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16379. #endif
  16380. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16381. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16382. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16383. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16384. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16385. {
  16386. public:
  16387. ComponentMovementWatcher (Component* const component);
  16388. ~ComponentMovementWatcher();
  16389. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16390. virtual void componentPeerChanged() = 0;
  16391. juce_UseDebuggingNewOperator
  16392. void componentParentHierarchyChanged (Component& component);
  16393. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16394. private:
  16395. Component* const component;
  16396. ComponentPeer* lastPeer;
  16397. VoidArray registeredParentComps;
  16398. bool reentrant;
  16399. Rectangle<int> lastBounds;
  16400. #ifdef JUCE_DEBUG
  16401. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  16402. #endif
  16403. void unregister() throw();
  16404. void registerWithParentComps() throw();
  16405. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16406. const ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16407. };
  16408. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16409. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16410. #endif
  16411. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16412. /*** Start of inlined file: juce_GroupComponent.h ***/
  16413. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16414. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16415. class JUCE_API GroupComponent : public Component
  16416. {
  16417. public:
  16418. GroupComponent (const String& componentName,
  16419. const String& labelText);
  16420. ~GroupComponent();
  16421. void setText (const String& newText) throw();
  16422. const String getText() const throw();
  16423. void setTextLabelPosition (const Justification& justification);
  16424. const Justification getTextLabelPosition() const throw() { return justification; }
  16425. enum ColourIds
  16426. {
  16427. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16428. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16429. };
  16430. void paint (Graphics& g);
  16431. void enablementChanged();
  16432. void colourChanged();
  16433. private:
  16434. String text;
  16435. Justification justification;
  16436. GroupComponent (const GroupComponent&);
  16437. const GroupComponent& operator= (const GroupComponent&);
  16438. };
  16439. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16440. /*** End of inlined file: juce_GroupComponent.h ***/
  16441. #endif
  16442. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16443. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16444. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16445. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16446. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16447. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16448. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16449. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16450. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16451. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16452. class TabbedButtonBar;
  16453. class JUCE_API TabBarButton : public Button
  16454. {
  16455. public:
  16456. TabBarButton (const String& name,
  16457. TabbedButtonBar* const ownerBar,
  16458. const int tabIndex);
  16459. ~TabBarButton();
  16460. virtual int getBestTabLength (const int depth);
  16461. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16462. void clicked (const ModifierKeys& mods);
  16463. bool hitTest (int x, int y);
  16464. juce_UseDebuggingNewOperator
  16465. protected:
  16466. friend class TabbedButtonBar;
  16467. TabbedButtonBar* const owner;
  16468. int tabIndex, overlapPixels;
  16469. DropShadowEffect shadow;
  16470. void getActiveArea (int& x, int& y, int& w, int& h);
  16471. private:
  16472. TabBarButton (const TabBarButton&);
  16473. const TabBarButton& operator= (const TabBarButton&);
  16474. };
  16475. class JUCE_API TabbedButtonBar : public Component,
  16476. public ChangeBroadcaster,
  16477. public ButtonListener
  16478. {
  16479. public:
  16480. enum Orientation
  16481. {
  16482. TabsAtTop,
  16483. TabsAtBottom,
  16484. TabsAtLeft,
  16485. TabsAtRight
  16486. };
  16487. TabbedButtonBar (const Orientation orientation);
  16488. ~TabbedButtonBar();
  16489. void setOrientation (const Orientation orientation);
  16490. Orientation getOrientation() const throw() { return orientation; }
  16491. void clearTabs();
  16492. void addTab (const String& tabName,
  16493. const Colour& tabBackgroundColour,
  16494. int insertIndex = -1);
  16495. void setTabName (const int tabIndex,
  16496. const String& newName);
  16497. void removeTab (const int tabIndex);
  16498. void moveTab (const int currentIndex,
  16499. const int newIndex);
  16500. int getNumTabs() const;
  16501. const StringArray getTabNames() const;
  16502. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16503. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16504. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16505. TabBarButton* getTabButton (const int index) const;
  16506. virtual void currentTabChanged (const int newCurrentTabIndex,
  16507. const String& newCurrentTabName);
  16508. virtual void popupMenuClickOnTab (const int tabIndex,
  16509. const String& tabName);
  16510. const Colour getTabBackgroundColour (const int tabIndex);
  16511. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16512. enum ColourIds
  16513. {
  16514. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16515. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16516. the look and feel will choose an appropriate colour. */
  16517. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16518. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16519. this isn't specified, the look and feel will choose an appropriate
  16520. colour. */
  16521. };
  16522. void resized();
  16523. void buttonClicked (Button* button);
  16524. void lookAndFeelChanged();
  16525. juce_UseDebuggingNewOperator
  16526. protected:
  16527. virtual TabBarButton* createTabButton (const String& tabName,
  16528. const int tabIndex);
  16529. private:
  16530. Orientation orientation;
  16531. StringArray tabs;
  16532. Array <Colour> tabColours;
  16533. int currentTabIndex;
  16534. Component* behindFrontTab;
  16535. Button* extraTabsButton;
  16536. TabbedButtonBar (const TabbedButtonBar&);
  16537. const TabbedButtonBar& operator= (const TabbedButtonBar&);
  16538. };
  16539. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16540. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16541. class JUCE_API TabbedComponent : public Component
  16542. {
  16543. public:
  16544. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16545. ~TabbedComponent();
  16546. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16547. TabbedButtonBar::Orientation getOrientation() const throw();
  16548. void setTabBarDepth (const int newDepth);
  16549. int getTabBarDepth() const throw() { return tabDepth; }
  16550. void setOutline (const int newThickness);
  16551. void setIndent (const int indentThickness);
  16552. void clearTabs();
  16553. void addTab (const String& tabName,
  16554. const Colour& tabBackgroundColour,
  16555. Component* const contentComponent,
  16556. const bool deleteComponentWhenNotNeeded,
  16557. const int insertIndex = -1);
  16558. void setTabName (const int tabIndex,
  16559. const String& newName);
  16560. void removeTab (const int tabIndex);
  16561. int getNumTabs() const;
  16562. const StringArray getTabNames() const;
  16563. Component* getTabContentComponent (const int tabIndex) const throw();
  16564. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16565. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16566. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16567. int getCurrentTabIndex() const;
  16568. const String& getCurrentTabName() const;
  16569. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16570. virtual void currentTabChanged (const int newCurrentTabIndex,
  16571. const String& newCurrentTabName);
  16572. virtual void popupMenuClickOnTab (const int tabIndex,
  16573. const String& tabName);
  16574. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16575. enum ColourIds
  16576. {
  16577. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16578. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16579. (See setOutline) */
  16580. };
  16581. void paint (Graphics& g);
  16582. void resized();
  16583. void lookAndFeelChanged();
  16584. juce_UseDebuggingNewOperator
  16585. protected:
  16586. TabbedButtonBar* tabs;
  16587. virtual TabBarButton* createTabButton (const String& tabName,
  16588. const int tabIndex);
  16589. private:
  16590. Array <Component*> contentComponents;
  16591. Component* panelComponent;
  16592. int tabDepth;
  16593. int outlineThickness, edgeIndent;
  16594. friend class TabCompButtonBar;
  16595. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16596. TabbedComponent (const TabbedComponent&);
  16597. const TabbedComponent& operator= (const TabbedComponent&);
  16598. };
  16599. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16600. /*** End of inlined file: juce_TabbedComponent.h ***/
  16601. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16602. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16603. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16604. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16605. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16606. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16607. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16608. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16609. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16610. class MenuBarModel;
  16611. class JUCE_API MenuBarModelListener
  16612. {
  16613. public:
  16614. virtual ~MenuBarModelListener() {}
  16615. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16616. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16617. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16618. };
  16619. class JUCE_API MenuBarModel : private AsyncUpdater,
  16620. private ApplicationCommandManagerListener
  16621. {
  16622. public:
  16623. MenuBarModel() throw();
  16624. virtual ~MenuBarModel();
  16625. void menuItemsChanged();
  16626. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16627. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16628. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16629. virtual const StringArray getMenuBarNames() = 0;
  16630. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16631. const String& menuName) = 0;
  16632. virtual void menuItemSelected (int menuItemID,
  16633. int topLevelMenuIndex) = 0;
  16634. #if JUCE_MAC || DOXYGEN
  16635. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16636. const PopupMenu* extraAppleMenuItems = 0);
  16637. static MenuBarModel* getMacMainMenu();
  16638. #endif
  16639. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16640. void applicationCommandListChanged();
  16641. void handleAsyncUpdate();
  16642. juce_UseDebuggingNewOperator
  16643. private:
  16644. ApplicationCommandManager* manager;
  16645. SortedSet <void*> listeners;
  16646. MenuBarModel (const MenuBarModel&);
  16647. const MenuBarModel& operator= (const MenuBarModel&);
  16648. };
  16649. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16650. /*** End of inlined file: juce_MenuBarModel.h ***/
  16651. class JUCE_API MenuBarComponent : public Component,
  16652. private MenuBarModelListener,
  16653. private Timer
  16654. {
  16655. public:
  16656. MenuBarComponent (MenuBarModel* const model);
  16657. ~MenuBarComponent();
  16658. void setModel (MenuBarModel* const newModel);
  16659. void showMenu (const int menuIndex);
  16660. void paint (Graphics& g);
  16661. void resized();
  16662. void mouseEnter (const MouseEvent& e);
  16663. void mouseExit (const MouseEvent& e);
  16664. void mouseDown (const MouseEvent& e);
  16665. void mouseDrag (const MouseEvent& e);
  16666. void mouseUp (const MouseEvent& e);
  16667. void mouseMove (const MouseEvent& e);
  16668. void inputAttemptWhenModal();
  16669. void handleCommandMessage (int commandId);
  16670. bool keyPressed (const KeyPress& key);
  16671. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16672. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16673. const ApplicationCommandTarget::InvocationInfo& info);
  16674. juce_UseDebuggingNewOperator
  16675. private:
  16676. MenuBarModel* model;
  16677. StringArray menuNames;
  16678. Array <int> xPositions;
  16679. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16680. int lastMouseX, lastMouseY;
  16681. bool inModalState;
  16682. ScopedPointer <Component> currentPopup;
  16683. int getItemAt (int x, int y);
  16684. void updateItemUnderMouse (const int x, const int y);
  16685. void hideCurrentMenu();
  16686. void timerCallback();
  16687. void repaintMenuItem (int index);
  16688. MenuBarComponent (const MenuBarComponent&);
  16689. const MenuBarComponent& operator= (const MenuBarComponent&);
  16690. };
  16691. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16692. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16693. class JUCE_API DocumentWindow : public ResizableWindow
  16694. {
  16695. public:
  16696. enum TitleBarButtons
  16697. {
  16698. minimiseButton = 1,
  16699. maximiseButton = 2,
  16700. closeButton = 4,
  16701. allButtons = 7
  16702. };
  16703. DocumentWindow (const String& name,
  16704. const Colour& backgroundColour,
  16705. const int requiredButtons,
  16706. const bool addToDesktop = true);
  16707. ~DocumentWindow();
  16708. void setName (const String& newName);
  16709. void setIcon (const Image* imageToUse);
  16710. void setTitleBarHeight (const int newHeight);
  16711. int getTitleBarHeight() const;
  16712. void setTitleBarButtonsRequired (const int requiredButtons,
  16713. const bool positionTitleBarButtonsOnLeft);
  16714. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16715. void setMenuBar (MenuBarModel* menuBarModel,
  16716. const int menuBarHeight = 0);
  16717. virtual void closeButtonPressed();
  16718. virtual void minimiseButtonPressed();
  16719. virtual void maximiseButtonPressed();
  16720. Button* getCloseButton() const throw();
  16721. Button* getMinimiseButton() const throw();
  16722. Button* getMaximiseButton() const throw();
  16723. enum ColourIds
  16724. {
  16725. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16726. and feel class how this is used. */
  16727. };
  16728. void paint (Graphics& g);
  16729. void resized();
  16730. void lookAndFeelChanged();
  16731. const BorderSize getBorderThickness();
  16732. const BorderSize getContentComponentBorder();
  16733. void mouseDoubleClick (const MouseEvent& e);
  16734. void userTriedToCloseWindow();
  16735. void activeWindowStatusChanged();
  16736. int getDesktopWindowStyleFlags() const;
  16737. void parentHierarchyChanged();
  16738. const Rectangle<int> getTitleBarArea();
  16739. juce_UseDebuggingNewOperator
  16740. private:
  16741. int titleBarHeight, menuBarHeight, requiredButtons;
  16742. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16743. ScopedPointer <Button> titleBarButtons [3];
  16744. ScopedPointer <Image> titleBarIcon;
  16745. ScopedPointer <MenuBarComponent> menuBar;
  16746. MenuBarModel* menuBarModel;
  16747. class ButtonListenerProxy;
  16748. friend class ScopedPointer <ButtonListenerProxy>;
  16749. ScopedPointer <ButtonListenerProxy> buttonListener;
  16750. void repaintTitleBar();
  16751. DocumentWindow (const DocumentWindow&);
  16752. const DocumentWindow& operator= (const DocumentWindow&);
  16753. };
  16754. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16755. /*** End of inlined file: juce_DocumentWindow.h ***/
  16756. class MultiDocumentPanel;
  16757. class MDITabbedComponentInternal;
  16758. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16759. {
  16760. public:
  16761. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16762. ~MultiDocumentPanelWindow();
  16763. void maximiseButtonPressed();
  16764. void closeButtonPressed();
  16765. void activeWindowStatusChanged();
  16766. void broughtToFront();
  16767. juce_UseDebuggingNewOperator
  16768. private:
  16769. void updateOrder();
  16770. MultiDocumentPanel* getOwner() const throw();
  16771. };
  16772. class JUCE_API MultiDocumentPanel : public Component,
  16773. private ComponentListener
  16774. {
  16775. public:
  16776. MultiDocumentPanel();
  16777. ~MultiDocumentPanel();
  16778. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16779. bool addDocument (Component* const component,
  16780. const Colour& backgroundColour,
  16781. const bool deleteWhenRemoved);
  16782. bool closeDocument (Component* component,
  16783. const bool checkItsOkToCloseFirst);
  16784. int getNumDocuments() const throw();
  16785. Component* getDocument (const int index) const throw();
  16786. Component* getActiveDocument() const throw();
  16787. void setActiveDocument (Component* component);
  16788. virtual void activeDocumentChanged();
  16789. void setMaximumNumDocuments (const int maximumNumDocuments);
  16790. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16791. bool isFullscreenWhenOneDocument() const throw();
  16792. enum LayoutMode
  16793. {
  16794. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16795. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16796. };
  16797. void setLayoutMode (const LayoutMode newLayoutMode);
  16798. LayoutMode getLayoutMode() const throw() { return mode; }
  16799. void setBackgroundColour (const Colour& newBackgroundColour);
  16800. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16801. virtual bool tryToCloseDocument (Component* component) = 0;
  16802. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16803. void paint (Graphics& g);
  16804. void resized();
  16805. void componentNameChanged (Component&);
  16806. juce_UseDebuggingNewOperator
  16807. private:
  16808. LayoutMode mode;
  16809. Array <Component*> components;
  16810. TabbedComponent* tabComponent;
  16811. Colour backgroundColour;
  16812. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16813. friend class MultiDocumentPanelWindow;
  16814. friend class MDITabbedComponentInternal;
  16815. Component* getContainerComp (Component* c) const;
  16816. void updateOrder();
  16817. void addWindow (Component* component);
  16818. };
  16819. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16820. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16821. #endif
  16822. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16823. #endif
  16824. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16825. #endif
  16826. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16827. #endif
  16828. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16829. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16830. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16831. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16832. class JUCE_API StretchableLayoutManager
  16833. {
  16834. public:
  16835. StretchableLayoutManager();
  16836. ~StretchableLayoutManager();
  16837. void setItemLayout (const int itemIndex,
  16838. const double minimumSize,
  16839. const double maximumSize,
  16840. const double preferredSize);
  16841. bool getItemLayout (const int itemIndex,
  16842. double& minimumSize,
  16843. double& maximumSize,
  16844. double& preferredSize) const;
  16845. void clearAllItems();
  16846. void layOutComponents (Component** const components,
  16847. int numComponents,
  16848. int x, int y, int width, int height,
  16849. const bool vertically,
  16850. const bool resizeOtherDimension);
  16851. int getItemCurrentPosition (const int itemIndex) const;
  16852. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16853. double getItemCurrentRelativeSize (const int itemIndex) const;
  16854. void setItemPosition (const int itemIndex,
  16855. int newPosition);
  16856. juce_UseDebuggingNewOperator
  16857. private:
  16858. struct ItemLayoutProperties
  16859. {
  16860. int itemIndex;
  16861. int currentSize;
  16862. double minSize, maxSize, preferredSize;
  16863. };
  16864. OwnedArray <ItemLayoutProperties> items;
  16865. int totalSize;
  16866. static int sizeToRealSize (double size, int totalSpace);
  16867. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16868. void setTotalSize (const int newTotalSize);
  16869. int fitComponentsIntoSpace (const int startIndex,
  16870. const int endIndex,
  16871. const int availableSpace,
  16872. int startPos);
  16873. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16874. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16875. void updatePrefSizesToMatchCurrentPositions();
  16876. StretchableLayoutManager (const StretchableLayoutManager&);
  16877. const StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16878. };
  16879. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16880. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16881. #endif
  16882. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16883. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16884. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16885. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16886. class JUCE_API StretchableLayoutResizerBar : public Component
  16887. {
  16888. public:
  16889. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16890. const int itemIndexInLayout,
  16891. const bool isBarVertical);
  16892. ~StretchableLayoutResizerBar();
  16893. virtual void hasBeenMoved();
  16894. void paint (Graphics& g);
  16895. void mouseDown (const MouseEvent& e);
  16896. void mouseDrag (const MouseEvent& e);
  16897. juce_UseDebuggingNewOperator
  16898. private:
  16899. StretchableLayoutManager* layout;
  16900. int itemIndex, mouseDownPos;
  16901. bool isVertical;
  16902. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16903. const StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16904. };
  16905. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16906. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16907. #endif
  16908. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16909. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16910. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16911. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16912. class StretchableObjectResizer
  16913. {
  16914. public:
  16915. StretchableObjectResizer();
  16916. ~StretchableObjectResizer();
  16917. void addItem (const double currentSize,
  16918. const double minSize,
  16919. const double maxSize,
  16920. const int order = 0);
  16921. void resizeToFit (const double targetSize);
  16922. int getNumItems() const throw() { return items.size(); }
  16923. double getItemSize (const int index) const throw();
  16924. juce_UseDebuggingNewOperator
  16925. private:
  16926. struct Item
  16927. {
  16928. double size;
  16929. double minSize;
  16930. double maxSize;
  16931. int order;
  16932. };
  16933. OwnedArray <Item> items;
  16934. StretchableObjectResizer (const StretchableObjectResizer&);
  16935. const StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16936. };
  16937. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16938. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16939. #endif
  16940. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16941. #endif
  16942. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16943. #endif
  16944. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16945. #endif
  16946. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16947. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16948. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16949. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16950. /*** Start of inlined file: juce_AlertWindow.h ***/
  16951. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16952. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16953. /*** Start of inlined file: juce_TextLayout.h ***/
  16954. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16955. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16956. class Graphics;
  16957. class JUCE_API TextLayout
  16958. {
  16959. public:
  16960. TextLayout() throw();
  16961. TextLayout (const TextLayout& other) throw();
  16962. TextLayout (const String& text, const Font& font) throw();
  16963. ~TextLayout() throw();
  16964. const TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16965. void clear() throw();
  16966. void appendText (const String& textToAppend,
  16967. const Font& fontToUse) throw();
  16968. void setText (const String& newText,
  16969. const Font& fontToUse) throw();
  16970. void layout (int maximumWidth,
  16971. const Justification& justification,
  16972. const bool attemptToBalanceLineLengths) throw();
  16973. int getWidth() const throw();
  16974. int getHeight() const throw();
  16975. int getNumLines() const throw() { return totalLines; }
  16976. int getLineWidth (const int lineNumber) const throw();
  16977. void draw (Graphics& g,
  16978. const int topLeftX,
  16979. const int topLeftY) const throw();
  16980. void drawWithin (Graphics& g,
  16981. int x, int y, int w, int h,
  16982. const Justification& layoutFlags) const throw();
  16983. juce_UseDebuggingNewOperator
  16984. private:
  16985. class Token;
  16986. friend class OwnedArray <Token>;
  16987. OwnedArray <Token> tokens;
  16988. int totalLines;
  16989. };
  16990. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16991. /*** End of inlined file: juce_TextLayout.h ***/
  16992. class JUCE_API AlertWindow : public TopLevelWindow,
  16993. private ButtonListener
  16994. {
  16995. public:
  16996. enum AlertIconType
  16997. {
  16998. NoIcon, /**< No icon will be shown on the dialog box. */
  16999. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  17000. user to answer a question. */
  17001. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  17002. warning about something and shouldn't be ignored. */
  17003. InfoIcon /**< An icon that indicates that the dialog box is just
  17004. giving the user some information, which doesn't require
  17005. a response from them. */
  17006. };
  17007. AlertWindow (const String& title,
  17008. const String& message,
  17009. AlertIconType iconType,
  17010. Component* associatedComponent = 0);
  17011. ~AlertWindow();
  17012. AlertIconType getAlertType() const throw() { return alertIconType; }
  17013. void setMessage (const String& message);
  17014. void addButton (const String& name,
  17015. const int returnValue,
  17016. const KeyPress& shortcutKey1 = KeyPress(),
  17017. const KeyPress& shortcutKey2 = KeyPress());
  17018. int getNumButtons() const;
  17019. void addTextEditor (const String& name,
  17020. const String& initialContents,
  17021. const String& onScreenLabel = String::empty,
  17022. const bool isPasswordBox = false);
  17023. const String getTextEditorContents (const String& nameOfTextEditor) const;
  17024. void addComboBox (const String& name,
  17025. const StringArray& items,
  17026. const String& onScreenLabel = String::empty);
  17027. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  17028. void addTextBlock (const String& text);
  17029. void addProgressBarComponent (double& progressValue);
  17030. void addCustomComponent (Component* const component);
  17031. int getNumCustomComponents() const;
  17032. Component* getCustomComponent (const int index) const;
  17033. Component* removeCustomComponent (const int index);
  17034. bool containsAnyExtraComponents() const;
  17035. // easy-to-use message box functions:
  17036. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  17037. const String& title,
  17038. const String& message,
  17039. const String& buttonText = String::empty,
  17040. Component* associatedComponent = 0);
  17041. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  17042. const String& title,
  17043. const String& message,
  17044. const String& button1Text = String::empty,
  17045. const String& button2Text = String::empty,
  17046. Component* associatedComponent = 0);
  17047. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17048. const String& title,
  17049. const String& message,
  17050. const String& button1Text = String::empty,
  17051. const String& button2Text = String::empty,
  17052. const String& button3Text = String::empty,
  17053. Component* associatedComponent = 0);
  17054. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17055. const String& bodyText,
  17056. bool isOkCancel);
  17057. enum ColourIds
  17058. {
  17059. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17060. textColourId = 0x1001810, /**< The colour for the text. */
  17061. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17062. };
  17063. juce_UseDebuggingNewOperator
  17064. protected:
  17065. void paint (Graphics& g);
  17066. void mouseDown (const MouseEvent& e);
  17067. void mouseDrag (const MouseEvent& e);
  17068. bool keyPressed (const KeyPress& key);
  17069. void buttonClicked (Button* button);
  17070. void lookAndFeelChanged();
  17071. void userTriedToCloseWindow();
  17072. int getDesktopWindowStyleFlags() const;
  17073. private:
  17074. String text;
  17075. TextLayout textLayout;
  17076. AlertIconType alertIconType;
  17077. ComponentBoundsConstrainer constrainer;
  17078. ComponentDragger dragger;
  17079. Rectangle<int> textArea;
  17080. VoidArray buttons, textBoxes, comboBoxes;
  17081. VoidArray progressBars, customComps, textBlocks, allComps;
  17082. StringArray textboxNames, comboBoxNames;
  17083. Font font;
  17084. Component* associatedComponent;
  17085. void updateLayout (const bool onlyIncreaseSize);
  17086. // disable copy constructor
  17087. AlertWindow (const AlertWindow&);
  17088. const AlertWindow& operator= (const AlertWindow&);
  17089. };
  17090. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17091. /*** End of inlined file: juce_AlertWindow.h ***/
  17092. class ToggleButton;
  17093. class TextButton;
  17094. class AlertWindow;
  17095. class TextLayout;
  17096. class ScrollBar;
  17097. class BubbleComponent;
  17098. class ComboBox;
  17099. class Button;
  17100. class FilenameComponent;
  17101. class DocumentWindow;
  17102. class ResizableWindow;
  17103. class GroupComponent;
  17104. class MenuBarComponent;
  17105. class DropShadower;
  17106. class GlyphArrangement;
  17107. class PropertyComponent;
  17108. class TableHeaderComponent;
  17109. class Toolbar;
  17110. class ToolbarItemComponent;
  17111. class PopupMenu;
  17112. class ProgressBar;
  17113. class FileBrowserComponent;
  17114. class DirectoryContentsDisplayComponent;
  17115. class FilePreviewComponent;
  17116. class ImageButton;
  17117. class JUCE_API LookAndFeel
  17118. {
  17119. public:
  17120. LookAndFeel();
  17121. virtual ~LookAndFeel();
  17122. static LookAndFeel& getDefaultLookAndFeel() throw();
  17123. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17124. const Colour findColour (const int colourId) const throw();
  17125. void setColour (const int colourId, const Colour& colour) throw();
  17126. bool isColourSpecified (const int colourId) const throw();
  17127. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17128. void setDefaultSansSerifTypefaceName (const String& newName);
  17129. virtual const MouseCursor getMouseCursorFor (Component& component);
  17130. virtual void drawButtonBackground (Graphics& g,
  17131. Button& button,
  17132. const Colour& backgroundColour,
  17133. bool isMouseOverButton,
  17134. bool isButtonDown);
  17135. virtual const Font getFontForTextButton (TextButton& button);
  17136. virtual void drawButtonText (Graphics& g,
  17137. TextButton& button,
  17138. bool isMouseOverButton,
  17139. bool isButtonDown);
  17140. virtual void drawToggleButton (Graphics& g,
  17141. ToggleButton& button,
  17142. bool isMouseOverButton,
  17143. bool isButtonDown);
  17144. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17145. virtual void drawTickBox (Graphics& g,
  17146. Component& component,
  17147. float x, float y, float w, float h,
  17148. const bool ticked,
  17149. const bool isEnabled,
  17150. const bool isMouseOverButton,
  17151. const bool isButtonDown);
  17152. virtual AlertWindow* createAlertWindow (const String& title,
  17153. const String& message,
  17154. const String& button1,
  17155. const String& button2,
  17156. const String& button3,
  17157. AlertWindow::AlertIconType iconType,
  17158. int numButtons,
  17159. Component* associatedComponent);
  17160. virtual void drawAlertBox (Graphics& g,
  17161. AlertWindow& alert,
  17162. const Rectangle<int>& textArea,
  17163. TextLayout& textLayout);
  17164. virtual int getAlertBoxWindowFlags();
  17165. virtual int getAlertWindowButtonHeight();
  17166. virtual const Font getAlertWindowFont();
  17167. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17168. int width, int height,
  17169. double progress, const String& textToShow);
  17170. // Draws a small image that spins to indicate that something's happening..
  17171. // This method should use the current time to animate itself, so just keep
  17172. // repainting it every so often.
  17173. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17174. int x, int y, int w, int h);
  17175. virtual void drawScrollbarButton (Graphics& g,
  17176. ScrollBar& scrollbar,
  17177. int width, int height,
  17178. int buttonDirection,
  17179. bool isScrollbarVertical,
  17180. bool isMouseOverButton,
  17181. bool isButtonDown);
  17182. virtual void drawScrollbar (Graphics& g,
  17183. ScrollBar& scrollbar,
  17184. int x, int y,
  17185. int width, int height,
  17186. bool isScrollbarVertical,
  17187. int thumbStartPosition,
  17188. int thumbSize,
  17189. bool isMouseOver,
  17190. bool isMouseDown);
  17191. virtual ImageEffectFilter* getScrollbarEffect();
  17192. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17193. virtual int getDefaultScrollbarWidth();
  17194. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17195. virtual const Path getTickShape (const float height);
  17196. virtual const Path getCrossShape (const float height);
  17197. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17198. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17199. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17200. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17201. virtual Image* getDefaultFolderImage();
  17202. virtual Image* getDefaultDocumentFileImage();
  17203. virtual void createFileChooserHeaderText (const String& title,
  17204. const String& instructions,
  17205. GlyphArrangement& destArrangement,
  17206. int width);
  17207. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17208. const String& filename, Image* icon,
  17209. const String& fileSizeDescription,
  17210. const String& fileTimeDescription,
  17211. const bool isDirectory,
  17212. const bool isItemSelected,
  17213. const int itemIndex);
  17214. virtual Button* createFileBrowserGoUpButton();
  17215. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17216. DirectoryContentsDisplayComponent* fileListComponent,
  17217. FilePreviewComponent* previewComp,
  17218. ComboBox* currentPathBox,
  17219. TextEditor* filenameBox,
  17220. Button* goUpButton);
  17221. virtual void drawBubble (Graphics& g,
  17222. float tipX, float tipY,
  17223. float boxX, float boxY, float boxW, float boxH);
  17224. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17225. virtual void drawPopupMenuItem (Graphics& g,
  17226. int width, int height,
  17227. const bool isSeparator,
  17228. const bool isActive,
  17229. const bool isHighlighted,
  17230. const bool isTicked,
  17231. const bool hasSubMenu,
  17232. const String& text,
  17233. const String& shortcutKeyText,
  17234. Image* image,
  17235. const Colour* const textColour);
  17236. virtual const Font getPopupMenuFont();
  17237. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17238. int width, int height,
  17239. bool isScrollUpArrow);
  17240. virtual void getIdealPopupMenuItemSize (const String& text,
  17241. const bool isSeparator,
  17242. int standardMenuItemHeight,
  17243. int& idealWidth,
  17244. int& idealHeight);
  17245. virtual int getMenuWindowFlags();
  17246. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17247. bool isMouseOverBar,
  17248. MenuBarComponent& menuBar);
  17249. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17250. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17251. virtual void drawMenuBarItem (Graphics& g,
  17252. int width, int height,
  17253. int itemIndex,
  17254. const String& itemText,
  17255. bool isMouseOverItem,
  17256. bool isMenuOpen,
  17257. bool isMouseOverBar,
  17258. MenuBarComponent& menuBar);
  17259. virtual void drawComboBox (Graphics& g, int width, int height,
  17260. const bool isButtonDown,
  17261. int buttonX, int buttonY,
  17262. int buttonW, int buttonH,
  17263. ComboBox& box);
  17264. virtual const Font getComboBoxFont (ComboBox& box);
  17265. virtual Label* createComboBoxTextBox (ComboBox& box);
  17266. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17267. virtual void drawLabel (Graphics& g, Label& label);
  17268. virtual void drawLinearSlider (Graphics& g,
  17269. int x, int y,
  17270. int width, int height,
  17271. float sliderPos,
  17272. float minSliderPos,
  17273. float maxSliderPos,
  17274. const Slider::SliderStyle style,
  17275. Slider& slider);
  17276. virtual void drawLinearSliderBackground (Graphics& g,
  17277. int x, int y,
  17278. int width, int height,
  17279. float sliderPos,
  17280. float minSliderPos,
  17281. float maxSliderPos,
  17282. const Slider::SliderStyle style,
  17283. Slider& slider);
  17284. virtual void drawLinearSliderThumb (Graphics& g,
  17285. int x, int y,
  17286. int width, int height,
  17287. float sliderPos,
  17288. float minSliderPos,
  17289. float maxSliderPos,
  17290. const Slider::SliderStyle style,
  17291. Slider& slider);
  17292. virtual int getSliderThumbRadius (Slider& slider);
  17293. virtual void drawRotarySlider (Graphics& g,
  17294. int x, int y,
  17295. int width, int height,
  17296. float sliderPosProportional,
  17297. const float rotaryStartAngle,
  17298. const float rotaryEndAngle,
  17299. Slider& slider);
  17300. virtual Button* createSliderButton (const bool isIncrement);
  17301. virtual Label* createSliderTextBox (Slider& slider);
  17302. virtual ImageEffectFilter* getSliderEffect();
  17303. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17304. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17305. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17306. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17307. ComboBox* filenameBox, Button* browseButton);
  17308. virtual void drawCornerResizer (Graphics& g,
  17309. int w, int h,
  17310. bool isMouseOver,
  17311. bool isMouseDragging);
  17312. virtual void drawResizableFrame (Graphics& g,
  17313. int w, int h,
  17314. const BorderSize& borders);
  17315. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17316. const BorderSize& border,
  17317. ResizableWindow& window);
  17318. virtual void drawResizableWindowBorder (Graphics& g,
  17319. int w, int h,
  17320. const BorderSize& border,
  17321. ResizableWindow& window);
  17322. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17323. Graphics& g, int w, int h,
  17324. int titleSpaceX, int titleSpaceW,
  17325. const Image* icon,
  17326. bool drawTitleTextOnLeft);
  17327. virtual Button* createDocumentWindowButton (int buttonType);
  17328. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17329. int titleBarX, int titleBarY,
  17330. int titleBarW, int titleBarH,
  17331. Button* minimiseButton,
  17332. Button* maximiseButton,
  17333. Button* closeButton,
  17334. bool positionTitleBarButtonsOnLeft);
  17335. virtual int getDefaultMenuBarHeight();
  17336. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17337. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17338. int w, int h,
  17339. bool isVerticalBar,
  17340. bool isMouseOver,
  17341. bool isMouseDragging);
  17342. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17343. const String& text,
  17344. const Justification& position,
  17345. GroupComponent& group);
  17346. virtual void createTabButtonShape (Path& p,
  17347. int width, int height,
  17348. int tabIndex,
  17349. const String& text,
  17350. Button& button,
  17351. TabbedButtonBar::Orientation orientation,
  17352. const bool isMouseOver,
  17353. const bool isMouseDown,
  17354. const bool isFrontTab);
  17355. virtual void fillTabButtonShape (Graphics& g,
  17356. const Path& path,
  17357. const Colour& preferredBackgroundColour,
  17358. int tabIndex,
  17359. const String& text,
  17360. Button& button,
  17361. TabbedButtonBar::Orientation orientation,
  17362. const bool isMouseOver,
  17363. const bool isMouseDown,
  17364. const bool isFrontTab);
  17365. virtual void drawTabButtonText (Graphics& g,
  17366. int x, int y, int w, int h,
  17367. const Colour& preferredBackgroundColour,
  17368. int tabIndex,
  17369. const String& text,
  17370. Button& button,
  17371. TabbedButtonBar::Orientation orientation,
  17372. const bool isMouseOver,
  17373. const bool isMouseDown,
  17374. const bool isFrontTab);
  17375. virtual int getTabButtonOverlap (int tabDepth);
  17376. virtual int getTabButtonSpaceAroundImage();
  17377. virtual int getTabButtonBestWidth (int tabIndex,
  17378. const String& text,
  17379. int tabDepth,
  17380. Button& button);
  17381. virtual void drawTabButton (Graphics& g,
  17382. int w, int h,
  17383. const Colour& preferredColour,
  17384. int tabIndex,
  17385. const String& text,
  17386. Button& button,
  17387. TabbedButtonBar::Orientation orientation,
  17388. const bool isMouseOver,
  17389. const bool isMouseDown,
  17390. const bool isFrontTab);
  17391. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17392. int w, int h,
  17393. TabbedButtonBar& tabBar,
  17394. TabbedButtonBar::Orientation orientation);
  17395. virtual Button* createTabBarExtrasButton();
  17396. virtual void drawImageButton (Graphics& g, Image* image,
  17397. int imageX, int imageY, int imageW, int imageH,
  17398. const Colour& overlayColour,
  17399. float imageOpacity,
  17400. ImageButton& button);
  17401. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17402. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17403. int width, int height,
  17404. bool isMouseOver, bool isMouseDown,
  17405. int columnFlags);
  17406. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17407. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17408. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17409. bool isMouseOver, bool isMouseDown,
  17410. ToolbarItemComponent& component);
  17411. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17412. const String& text, ToolbarItemComponent& component);
  17413. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17414. bool isOpen, int width, int height);
  17415. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17416. PropertyComponent& component);
  17417. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17418. PropertyComponent& component);
  17419. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17420. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17421. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17422. virtual void playAlertSound();
  17423. static void drawGlassSphere (Graphics& g,
  17424. const float x, const float y,
  17425. const float diameter,
  17426. const Colour& colour,
  17427. const float outlineThickness) throw();
  17428. static void drawGlassPointer (Graphics& g,
  17429. const float x, const float y,
  17430. const float diameter,
  17431. const Colour& colour, const float outlineThickness,
  17432. const int direction) throw();
  17433. static void drawGlassLozenge (Graphics& g,
  17434. const float x, const float y,
  17435. const float width, const float height,
  17436. const Colour& colour,
  17437. const float outlineThickness,
  17438. const float cornerSize,
  17439. const bool flatOnLeft, const bool flatOnRight,
  17440. const bool flatOnTop, const bool flatOnBottom) throw();
  17441. juce_UseDebuggingNewOperator
  17442. private:
  17443. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17444. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17445. Array <int> colourIds;
  17446. Array <Colour> colours;
  17447. // default typeface names
  17448. String defaultSans, defaultSerif, defaultFixed;
  17449. void drawShinyButtonShape (Graphics& g,
  17450. float x, float y, float w, float h, float maxCornerSize,
  17451. const Colour& baseColour,
  17452. const float strokeWidth,
  17453. const bool flatOnLeft,
  17454. const bool flatOnRight,
  17455. const bool flatOnTop,
  17456. const bool flatOnBottom) throw();
  17457. LookAndFeel (const LookAndFeel&);
  17458. const LookAndFeel& operator= (const LookAndFeel&);
  17459. };
  17460. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17461. /*** End of inlined file: juce_LookAndFeel.h ***/
  17462. #endif
  17463. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17464. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17465. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17466. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17467. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17468. {
  17469. public:
  17470. OldSchoolLookAndFeel();
  17471. virtual ~OldSchoolLookAndFeel();
  17472. virtual void drawButtonBackground (Graphics& g,
  17473. Button& button,
  17474. const Colour& backgroundColour,
  17475. bool isMouseOverButton,
  17476. bool isButtonDown);
  17477. virtual void drawToggleButton (Graphics& g,
  17478. ToggleButton& button,
  17479. bool isMouseOverButton,
  17480. bool isButtonDown);
  17481. virtual void drawTickBox (Graphics& g,
  17482. Component& component,
  17483. float x, float y, float w, float h,
  17484. const bool ticked,
  17485. const bool isEnabled,
  17486. const bool isMouseOverButton,
  17487. const bool isButtonDown);
  17488. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17489. int width, int height,
  17490. double progress, const String& textToShow);
  17491. virtual void drawScrollbarButton (Graphics& g,
  17492. ScrollBar& scrollbar,
  17493. int width, int height,
  17494. int buttonDirection,
  17495. bool isScrollbarVertical,
  17496. bool isMouseOverButton,
  17497. bool isButtonDown);
  17498. virtual void drawScrollbar (Graphics& g,
  17499. ScrollBar& scrollbar,
  17500. int x, int y,
  17501. int width, int height,
  17502. bool isScrollbarVertical,
  17503. int thumbStartPosition,
  17504. int thumbSize,
  17505. bool isMouseOver,
  17506. bool isMouseDown);
  17507. virtual ImageEffectFilter* getScrollbarEffect();
  17508. virtual void drawTextEditorOutline (Graphics& g,
  17509. int width, int height,
  17510. TextEditor& textEditor);
  17511. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17512. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17513. bool isMouseOverBar,
  17514. MenuBarComponent& menuBar);
  17515. virtual void drawComboBox (Graphics& g, int width, int height,
  17516. const bool isButtonDown,
  17517. int buttonX, int buttonY,
  17518. int buttonW, int buttonH,
  17519. ComboBox& box);
  17520. virtual const Font getComboBoxFont (ComboBox& box);
  17521. virtual void drawLinearSlider (Graphics& g,
  17522. int x, int y,
  17523. int width, int height,
  17524. float sliderPos,
  17525. float minSliderPos,
  17526. float maxSliderPos,
  17527. const Slider::SliderStyle style,
  17528. Slider& slider);
  17529. virtual int getSliderThumbRadius (Slider& slider);
  17530. virtual Button* createSliderButton (const bool isIncrement);
  17531. virtual ImageEffectFilter* getSliderEffect();
  17532. virtual void drawCornerResizer (Graphics& g,
  17533. int w, int h,
  17534. bool isMouseOver,
  17535. bool isMouseDragging);
  17536. virtual Button* createDocumentWindowButton (int buttonType);
  17537. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17538. int titleBarX, int titleBarY,
  17539. int titleBarW, int titleBarH,
  17540. Button* minimiseButton,
  17541. Button* maximiseButton,
  17542. Button* closeButton,
  17543. bool positionTitleBarButtonsOnLeft);
  17544. juce_UseDebuggingNewOperator
  17545. private:
  17546. DropShadowEffect scrollbarShadow;
  17547. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17548. const OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17549. };
  17550. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17551. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17552. #endif
  17553. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17554. #endif
  17555. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17556. #endif
  17557. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17558. #endif
  17559. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17560. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17561. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17562. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17563. class JUCE_API PopupMenuCustomComponent : public Component,
  17564. public ReferenceCountedObject
  17565. {
  17566. public:
  17567. ~PopupMenuCustomComponent();
  17568. virtual void getIdealSize (int& idealWidth,
  17569. int& idealHeight) = 0;
  17570. void triggerMenuItem();
  17571. bool isItemHighlighted() const throw() { return isHighlighted; }
  17572. protected:
  17573. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17574. private:
  17575. friend class PopupMenu;
  17576. friend class PopupMenu::ItemComponent;
  17577. friend class PopupMenu::Window;
  17578. bool isHighlighted, isTriggeredAutomatically;
  17579. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17580. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17581. };
  17582. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17583. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17584. #endif
  17585. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17586. #endif
  17587. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17588. #endif
  17589. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17590. #endif
  17591. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17592. #endif
  17593. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17594. /*** Start of inlined file: juce_LassoComponent.h ***/
  17595. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17596. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17597. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17598. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17599. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17600. template <class SelectableItemType>
  17601. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17602. {
  17603. public:
  17604. SelectedItemSet()
  17605. {
  17606. }
  17607. SelectedItemSet (const Array <SelectableItemType>& items)
  17608. : selectedItems (items)
  17609. {
  17610. }
  17611. SelectedItemSet (const SelectedItemSet& other)
  17612. : selectedItems (other.selectedItems)
  17613. {
  17614. }
  17615. const SelectedItemSet& operator= (const SelectedItemSet& other)
  17616. {
  17617. if (selectedItems != other.selectedItems)
  17618. {
  17619. selectedItems = other.selectedItems;
  17620. changed();
  17621. }
  17622. return *this;
  17623. }
  17624. ~SelectedItemSet()
  17625. {
  17626. }
  17627. void selectOnly (SelectableItemType item)
  17628. {
  17629. if (isSelected (item))
  17630. {
  17631. for (int i = selectedItems.size(); --i >= 0;)
  17632. {
  17633. if (selectedItems.getUnchecked(i) != item)
  17634. {
  17635. deselect (selectedItems.getUnchecked(i));
  17636. i = jmin (i, selectedItems.size());
  17637. }
  17638. }
  17639. }
  17640. else
  17641. {
  17642. deselectAll();
  17643. changed();
  17644. selectedItems.add (item);
  17645. itemSelected (item);
  17646. }
  17647. }
  17648. void addToSelection (SelectableItemType item)
  17649. {
  17650. if (! isSelected (item))
  17651. {
  17652. changed();
  17653. selectedItems.add (item);
  17654. itemSelected (item);
  17655. }
  17656. }
  17657. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17658. const ModifierKeys& modifiers)
  17659. {
  17660. if (modifiers.isShiftDown())
  17661. {
  17662. addToSelection (item);
  17663. }
  17664. else if (modifiers.isCommandDown())
  17665. {
  17666. if (isSelected (item))
  17667. deselect (item);
  17668. else
  17669. addToSelection (item);
  17670. }
  17671. else
  17672. {
  17673. selectOnly (item);
  17674. }
  17675. }
  17676. bool addToSelectionOnMouseDown (SelectableItemType item,
  17677. const ModifierKeys& modifiers)
  17678. {
  17679. if (isSelected (item))
  17680. {
  17681. return ! modifiers.isPopupMenu();
  17682. }
  17683. else
  17684. {
  17685. addToSelectionBasedOnModifiers (item, modifiers);
  17686. return false;
  17687. }
  17688. }
  17689. void addToSelectionOnMouseUp (SelectableItemType item,
  17690. const ModifierKeys& modifiers,
  17691. const bool wasItemDragged,
  17692. const bool resultOfMouseDownSelectMethod)
  17693. {
  17694. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17695. addToSelectionBasedOnModifiers (item, modifiers);
  17696. }
  17697. void deselect (SelectableItemType item)
  17698. {
  17699. const int i = selectedItems.indexOf (item);
  17700. if (i >= 0)
  17701. {
  17702. changed();
  17703. itemDeselected (selectedItems.remove (i));
  17704. }
  17705. }
  17706. void deselectAll()
  17707. {
  17708. if (selectedItems.size() > 0)
  17709. {
  17710. changed();
  17711. for (int i = selectedItems.size(); --i >= 0;)
  17712. {
  17713. itemDeselected (selectedItems.remove (i));
  17714. i = jmin (i, selectedItems.size());
  17715. }
  17716. }
  17717. }
  17718. int getNumSelected() const throw()
  17719. {
  17720. return selectedItems.size();
  17721. }
  17722. SelectableItemType getSelectedItem (const int index) const throw()
  17723. {
  17724. return selectedItems [index];
  17725. }
  17726. bool isSelected (const SelectableItemType item) const throw()
  17727. {
  17728. return selectedItems.contains (item);
  17729. }
  17730. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17731. virtual void itemSelected (SelectableItemType item) {}
  17732. virtual void itemDeselected (SelectableItemType item) {}
  17733. void changed (const bool synchronous = false)
  17734. {
  17735. if (synchronous)
  17736. sendSynchronousChangeMessage (this);
  17737. else
  17738. sendChangeMessage (this);
  17739. }
  17740. juce_UseDebuggingNewOperator
  17741. private:
  17742. Array <SelectableItemType> selectedItems;
  17743. };
  17744. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17745. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17746. template <class SelectableItemType>
  17747. class LassoSource
  17748. {
  17749. public:
  17750. virtual ~LassoSource() {}
  17751. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17752. int x, int y, int width, int height) = 0;
  17753. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17754. };
  17755. template <class SelectableItemType>
  17756. class LassoComponent : public Component
  17757. {
  17758. public:
  17759. LassoComponent (const int outlineThickness_ = 1)
  17760. : source (0),
  17761. outlineThickness (outlineThickness_)
  17762. {
  17763. }
  17764. ~LassoComponent()
  17765. {
  17766. }
  17767. void beginLasso (const MouseEvent& e,
  17768. LassoSource <SelectableItemType>* const lassoSource)
  17769. {
  17770. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17771. jassert (lassoSource != 0); // the source can't be null!
  17772. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17773. source = lassoSource;
  17774. if (lassoSource != 0)
  17775. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17776. setSize (0, 0);
  17777. }
  17778. void dragLasso (const MouseEvent& e)
  17779. {
  17780. if (source != 0)
  17781. {
  17782. const int x1 = e.getMouseDownX();
  17783. const int y1 = e.getMouseDownY();
  17784. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17785. setVisible (true);
  17786. Array <SelectableItemType> itemsInLasso;
  17787. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17788. if (e.mods.isShiftDown())
  17789. {
  17790. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17791. itemsInLasso.addArray (originalSelection);
  17792. }
  17793. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17794. {
  17795. Array <SelectableItemType> originalMinusNew (originalSelection);
  17796. originalMinusNew.removeValuesIn (itemsInLasso);
  17797. itemsInLasso.removeValuesIn (originalSelection);
  17798. itemsInLasso.addArray (originalMinusNew);
  17799. }
  17800. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17801. }
  17802. }
  17803. void endLasso()
  17804. {
  17805. source = 0;
  17806. originalSelection.clear();
  17807. setVisible (false);
  17808. }
  17809. enum ColourIds
  17810. {
  17811. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17812. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17813. };
  17814. void paint (Graphics& g)
  17815. {
  17816. g.fillAll (findColour (lassoFillColourId));
  17817. g.setColour (findColour (lassoOutlineColourId));
  17818. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17819. // this suggests that you've left a lasso comp lying around after the
  17820. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17821. // mouse-up event.
  17822. jassert (isMouseButtonDownAnywhere());
  17823. }
  17824. bool hitTest (int x, int y) { return false; }
  17825. juce_UseDebuggingNewOperator
  17826. private:
  17827. Array <SelectableItemType> originalSelection;
  17828. LassoSource <SelectableItemType>* source;
  17829. int outlineThickness;
  17830. };
  17831. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17832. /*** End of inlined file: juce_LassoComponent.h ***/
  17833. #endif
  17834. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17835. #endif
  17836. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17837. #endif
  17838. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17839. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17840. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17841. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17842. class JUCE_API MouseHoverDetector
  17843. {
  17844. public:
  17845. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17846. virtual ~MouseHoverDetector();
  17847. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17848. void setHoverComponent (Component* const newSourceComponent);
  17849. protected:
  17850. virtual void mouseHovered (int mouseX,
  17851. int mouseY) = 0;
  17852. virtual void mouseMovedAfterHover() = 0;
  17853. private:
  17854. class JUCE_API HoverDetectorInternal : public MouseListener,
  17855. public Timer
  17856. {
  17857. public:
  17858. MouseHoverDetector* owner;
  17859. int lastX, lastY;
  17860. void timerCallback();
  17861. void mouseEnter (const MouseEvent&);
  17862. void mouseExit (const MouseEvent&);
  17863. void mouseDown (const MouseEvent&);
  17864. void mouseUp (const MouseEvent&);
  17865. void mouseMove (const MouseEvent&);
  17866. void mouseWheelMove (const MouseEvent&, float, float);
  17867. } internalTimer;
  17868. friend class HoverDetectorInternal;
  17869. Component* source;
  17870. int hoverTimeMillisecs;
  17871. bool hasJustHovered;
  17872. void hoverTimerCallback();
  17873. void checkJustHoveredCallback();
  17874. MouseHoverDetector (const MouseHoverDetector&);
  17875. const MouseHoverDetector& operator= (const MouseHoverDetector&);
  17876. };
  17877. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17878. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17879. #endif
  17880. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17881. #endif
  17882. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17883. #endif
  17884. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17885. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17886. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17887. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17888. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17889. private ButtonListener
  17890. {
  17891. protected:
  17892. BooleanPropertyComponent (const String& propertyName,
  17893. const String& buttonTextWhenTrue,
  17894. const String& buttonTextWhenFalse);
  17895. public:
  17896. BooleanPropertyComponent (const Value& valueToControl,
  17897. const String& propertyName,
  17898. const String& buttonText);
  17899. ~BooleanPropertyComponent();
  17900. virtual void setState (const bool newState);
  17901. virtual bool getState() const;
  17902. void paint (Graphics& g);
  17903. void refresh();
  17904. void buttonClicked (Button*);
  17905. juce_UseDebuggingNewOperator
  17906. private:
  17907. ToggleButton* button;
  17908. String onText, offText;
  17909. void createButton();
  17910. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17911. const BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17912. };
  17913. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17914. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17915. #endif
  17916. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17917. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17918. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17919. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17920. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17921. private ButtonListener
  17922. {
  17923. public:
  17924. ButtonPropertyComponent (const String& propertyName,
  17925. const bool triggerOnMouseDown);
  17926. ~ButtonPropertyComponent();
  17927. virtual void buttonClicked() = 0;
  17928. virtual const String getButtonText() const = 0;
  17929. void refresh();
  17930. void buttonClicked (Button*);
  17931. juce_UseDebuggingNewOperator
  17932. private:
  17933. TextButton* button;
  17934. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17935. const ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17936. };
  17937. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17938. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17939. #endif
  17940. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17941. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17942. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17943. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17944. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17945. private ComboBoxListener
  17946. {
  17947. protected:
  17948. ChoicePropertyComponent (const String& propertyName);
  17949. public:
  17950. ChoicePropertyComponent (const Value& valueToControl,
  17951. const String& propertyName,
  17952. const StringArray& choices,
  17953. const Array <int>* choiceIDs = 0);
  17954. ~ChoicePropertyComponent();
  17955. virtual void setIndex (const int newIndex);
  17956. virtual int getIndex() const;
  17957. const StringArray& getChoices() const;
  17958. void refresh();
  17959. void comboBoxChanged (ComboBox*);
  17960. juce_UseDebuggingNewOperator
  17961. protected:
  17962. StringArray choices;
  17963. private:
  17964. ComboBox* comboBox;
  17965. void createComboBox (const Array <int>* choiceIDs);
  17966. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17967. const ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17968. };
  17969. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17970. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17971. #endif
  17972. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17973. #endif
  17974. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17975. #endif
  17976. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17977. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17978. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17979. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17980. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17981. private SliderListener
  17982. {
  17983. protected:
  17984. SliderPropertyComponent (const String& propertyName,
  17985. const double rangeMin,
  17986. const double rangeMax,
  17987. const double interval,
  17988. const double skewFactor = 1.0);
  17989. public:
  17990. SliderPropertyComponent (Value& valueToControl,
  17991. const String& propertyName,
  17992. const double rangeMin,
  17993. const double rangeMax,
  17994. const double interval,
  17995. const double skewFactor = 1.0);
  17996. ~SliderPropertyComponent();
  17997. virtual void setValue (const double newValue);
  17998. virtual const double getValue() const;
  17999. void refresh();
  18000. void changeListenerCallback (void*);
  18001. void sliderValueChanged (Slider*);
  18002. juce_UseDebuggingNewOperator
  18003. protected:
  18004. Slider* slider;
  18005. SliderPropertyComponent (const SliderPropertyComponent&);
  18006. const SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18007. };
  18008. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18009. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18010. #endif
  18011. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18012. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18013. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18014. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18015. class JUCE_API TextPropertyComponent : public PropertyComponent
  18016. {
  18017. protected:
  18018. TextPropertyComponent (const String& propertyName,
  18019. const int maxNumChars,
  18020. const bool isMultiLine);
  18021. public:
  18022. TextPropertyComponent (const Value& valueToControl,
  18023. const String& propertyName,
  18024. const int maxNumChars,
  18025. const bool isMultiLine);
  18026. ~TextPropertyComponent();
  18027. virtual void setText (const String& newText);
  18028. virtual const String getText() const;
  18029. void refresh();
  18030. void textWasEdited();
  18031. juce_UseDebuggingNewOperator
  18032. private:
  18033. Label* textEditor;
  18034. void createEditor (const int maxNumChars, const bool isMultiLine);
  18035. TextPropertyComponent (const TextPropertyComponent&);
  18036. const TextPropertyComponent& operator= (const TextPropertyComponent&);
  18037. };
  18038. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18039. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18040. #endif
  18041. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18042. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18043. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18044. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18045. #if JUCE_WINDOWS || DOXYGEN
  18046. class JUCE_API ActiveXControlComponent : public Component
  18047. {
  18048. public:
  18049. ActiveXControlComponent();
  18050. ~ActiveXControlComponent();
  18051. bool createControl (const void* controlIID);
  18052. void deleteControl();
  18053. bool isControlOpen() const throw() { return control != 0; }
  18054. void* queryInterface (const void* iid) const;
  18055. void setMouseEventsAllowed (const bool eventsCanReachControl);
  18056. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18057. void paint (Graphics& g);
  18058. void* originalWndProc;
  18059. juce_UseDebuggingNewOperator
  18060. private:
  18061. friend class ActiveXControlData;
  18062. void* control;
  18063. bool mouseEventsAllowed;
  18064. ActiveXControlComponent (const ActiveXControlComponent&);
  18065. const ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18066. void setControlBounds (const Rectangle<int>& bounds) const;
  18067. void setControlVisible (const bool b) const;
  18068. };
  18069. #endif
  18070. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18071. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18072. #endif
  18073. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18074. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18075. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18076. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18077. class MidiInputSelectorComponentListBox;
  18078. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18079. public ComboBoxListener,
  18080. public ButtonListener,
  18081. public ChangeListener
  18082. {
  18083. public:
  18084. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18085. const int minAudioInputChannels,
  18086. const int maxAudioInputChannels,
  18087. const int minAudioOutputChannels,
  18088. const int maxAudioOutputChannels,
  18089. const bool showMidiInputOptions,
  18090. const bool showMidiOutputSelector,
  18091. const bool showChannelsAsStereoPairs,
  18092. const bool hideAdvancedOptionsWithButton);
  18093. ~AudioDeviceSelectorComponent();
  18094. void resized();
  18095. void comboBoxChanged (ComboBox*);
  18096. void buttonClicked (Button*);
  18097. void changeListenerCallback (void*);
  18098. void childBoundsChanged (Component*);
  18099. juce_UseDebuggingNewOperator
  18100. private:
  18101. AudioDeviceManager& deviceManager;
  18102. ComboBox* deviceTypeDropDown;
  18103. Label* deviceTypeDropDownLabel;
  18104. Component* audioDeviceSettingsComp;
  18105. String audioDeviceSettingsCompType;
  18106. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18107. const bool showChannelsAsStereoPairs;
  18108. const bool hideAdvancedOptionsWithButton;
  18109. MidiInputSelectorComponentListBox* midiInputsList;
  18110. Label* midiInputsLabel;
  18111. ComboBox* midiOutputSelector;
  18112. Label* midiOutputLabel;
  18113. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18114. const AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18115. };
  18116. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18117. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18118. #endif
  18119. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18120. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18121. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18122. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18123. class JUCE_API BubbleComponent : public Component
  18124. {
  18125. protected:
  18126. BubbleComponent();
  18127. public:
  18128. ~BubbleComponent();
  18129. enum BubblePlacement
  18130. {
  18131. above = 1,
  18132. below = 2,
  18133. left = 4,
  18134. right = 8
  18135. };
  18136. void setAllowedPlacement (const int newPlacement);
  18137. void setPosition (Component* componentToPointTo);
  18138. void setPosition (const int arrowTipX,
  18139. const int arrowTipY);
  18140. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18141. protected:
  18142. virtual void getContentSize (int& width, int& height) = 0;
  18143. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18144. public:
  18145. void paint (Graphics& g);
  18146. juce_UseDebuggingNewOperator
  18147. private:
  18148. Rectangle<int> content;
  18149. int side, allowablePlacements;
  18150. float arrowTipX, arrowTipY;
  18151. DropShadowEffect shadow;
  18152. BubbleComponent (const BubbleComponent&);
  18153. const BubbleComponent& operator= (const BubbleComponent&);
  18154. };
  18155. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18156. /*** End of inlined file: juce_BubbleComponent.h ***/
  18157. #endif
  18158. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18159. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18160. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18161. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18162. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18163. private Timer
  18164. {
  18165. public:
  18166. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  18167. ~BubbleMessageComponent();
  18168. void showAt (int x, int y,
  18169. const String& message,
  18170. const int numMillisecondsBeforeRemoving,
  18171. const bool removeWhenMouseClicked = true,
  18172. const bool deleteSelfAfterUse = false);
  18173. void showAt (Component* const component,
  18174. const String& message,
  18175. const int numMillisecondsBeforeRemoving,
  18176. const bool removeWhenMouseClicked = true,
  18177. const bool deleteSelfAfterUse = false);
  18178. void getContentSize (int& w, int& h);
  18179. void paintContent (Graphics& g, int w, int h);
  18180. void timerCallback();
  18181. juce_UseDebuggingNewOperator
  18182. private:
  18183. int fadeOutLength, mouseClickCounter;
  18184. TextLayout textLayout;
  18185. int64 expiryTime;
  18186. bool deleteAfterUse;
  18187. void init (const int numMillisecondsBeforeRemoving,
  18188. const bool removeWhenMouseClicked,
  18189. const bool deleteSelfAfterUse);
  18190. BubbleMessageComponent (const BubbleMessageComponent&);
  18191. const BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18192. };
  18193. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18194. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18195. #endif
  18196. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18197. /*** Start of inlined file: juce_ColourSelector.h ***/
  18198. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18199. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18200. class JUCE_API ColourSelector : public Component,
  18201. public ChangeBroadcaster,
  18202. protected SliderListener
  18203. {
  18204. public:
  18205. enum ColourSelectorOptions
  18206. {
  18207. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18208. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18209. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18210. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18211. };
  18212. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18213. const int edgeGap = 4,
  18214. const int gapAroundColourSpaceComponent = 7);
  18215. ~ColourSelector();
  18216. const Colour getCurrentColour() const;
  18217. void setCurrentColour (const Colour& newColour);
  18218. virtual int getNumSwatches() const;
  18219. virtual const Colour getSwatchColour (const int index) const;
  18220. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  18221. enum ColourIds
  18222. {
  18223. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18224. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18225. };
  18226. juce_UseDebuggingNewOperator
  18227. private:
  18228. friend class ColourSpaceView;
  18229. friend class HueSelectorComp;
  18230. Colour colour;
  18231. float h, s, v;
  18232. Slider* sliders[4];
  18233. Component* colourSpace;
  18234. Component* hueSelector;
  18235. class SwatchComponent;
  18236. OwnedArray <SwatchComponent> swatchComponents;
  18237. const int flags;
  18238. int topSpace, edgeGap;
  18239. void setHue (float newH);
  18240. void setSV (float newS, float newV);
  18241. void updateHSV();
  18242. void update();
  18243. void sliderValueChanged (Slider*);
  18244. void paint (Graphics& g);
  18245. void resized();
  18246. ColourSelector (const ColourSelector&);
  18247. const ColourSelector& operator= (const ColourSelector&);
  18248. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18249. // have changed - if you get an error here, update your code to use the new constructor instead..
  18250. // (xxx - note to self: remember to remove this at some point in the future)
  18251. ColourSelector (const bool);
  18252. };
  18253. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18254. /*** End of inlined file: juce_ColourSelector.h ***/
  18255. #endif
  18256. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18257. #endif
  18258. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18259. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18260. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18261. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18262. class JUCE_API MagnifierComponent : public Component
  18263. {
  18264. public:
  18265. MagnifierComponent (Component* const contentComponent,
  18266. const bool deleteContentCompWhenNoLongerNeeded);
  18267. ~MagnifierComponent();
  18268. Component* getContentComponent() const { return content; }
  18269. void setScaleFactor (double newScaleFactor);
  18270. double getScaleFactor() const { return scaleFactor; }
  18271. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18272. juce_UseDebuggingNewOperator
  18273. void childBoundsChanged (Component*);
  18274. private:
  18275. Component* content;
  18276. Component* holderComp;
  18277. double scaleFactor;
  18278. ComponentPeer* peer;
  18279. bool deleteContent;
  18280. Graphics::ResamplingQuality quality;
  18281. void paint (Graphics& g);
  18282. void mouseDown (const MouseEvent& e);
  18283. void mouseUp (const MouseEvent& e);
  18284. void mouseDrag (const MouseEvent& e);
  18285. void mouseMove (const MouseEvent& e);
  18286. void mouseEnter (const MouseEvent& e);
  18287. void mouseExit (const MouseEvent& e);
  18288. void mouseWheelMove (const MouseEvent& e, float, float);
  18289. int scaleInt (const int n) const;
  18290. MagnifierComponent (const MagnifierComponent&);
  18291. const MagnifierComponent& operator= (const MagnifierComponent&);
  18292. };
  18293. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18294. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18295. #endif
  18296. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18297. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18298. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18299. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18300. class JUCE_API MidiKeyboardComponent : public Component,
  18301. public MidiKeyboardStateListener,
  18302. public ChangeBroadcaster,
  18303. private Timer,
  18304. private AsyncUpdater
  18305. {
  18306. public:
  18307. enum Orientation
  18308. {
  18309. horizontalKeyboard,
  18310. verticalKeyboardFacingLeft,
  18311. verticalKeyboardFacingRight,
  18312. };
  18313. MidiKeyboardComponent (MidiKeyboardState& state,
  18314. const Orientation orientation);
  18315. ~MidiKeyboardComponent();
  18316. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18317. void setMidiChannel (const int midiChannelNumber);
  18318. int getMidiChannel() const throw() { return midiChannel; }
  18319. void setMidiChannelsToDisplay (const int midiChannelMask);
  18320. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18321. void setKeyWidth (const float widthInPixels);
  18322. float getKeyWidth() const throw() { return keyWidth; }
  18323. void setOrientation (const Orientation newOrientation);
  18324. const Orientation getOrientation() const throw() { return orientation; }
  18325. void setAvailableRange (const int lowestNote,
  18326. const int highestNote);
  18327. int getRangeStart() const throw() { return rangeStart; }
  18328. int getRangeEnd() const throw() { return rangeEnd; }
  18329. void setLowestVisibleKey (int noteNumber);
  18330. int getLowestVisibleKey() const throw() { return firstKey; }
  18331. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18332. void setScrollButtonsVisible (const bool canScroll);
  18333. enum ColourIds
  18334. {
  18335. whiteNoteColourId = 0x1005000,
  18336. blackNoteColourId = 0x1005001,
  18337. keySeparatorLineColourId = 0x1005002,
  18338. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18339. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18340. textLabelColourId = 0x1005005,
  18341. upDownButtonBackgroundColourId = 0x1005006,
  18342. upDownButtonArrowColourId = 0x1005007
  18343. };
  18344. int getKeyStartPosition (const int midiNoteNumber) const;
  18345. void clearKeyMappings();
  18346. void setKeyPressForNote (const KeyPress& key,
  18347. const int midiNoteOffsetFromC);
  18348. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18349. void setKeyPressBaseOctave (const int newOctaveNumber);
  18350. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18351. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18352. void paint (Graphics& g);
  18353. void resized();
  18354. void mouseMove (const MouseEvent& e);
  18355. void mouseDrag (const MouseEvent& e);
  18356. void mouseDown (const MouseEvent& e);
  18357. void mouseUp (const MouseEvent& e);
  18358. void mouseEnter (const MouseEvent& e);
  18359. void mouseExit (const MouseEvent& e);
  18360. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18361. void timerCallback();
  18362. bool keyStateChanged (const bool isKeyDown);
  18363. void focusLost (FocusChangeType cause);
  18364. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18365. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18366. void handleAsyncUpdate();
  18367. void colourChanged();
  18368. juce_UseDebuggingNewOperator
  18369. protected:
  18370. friend class MidiKeyboardUpDownButton;
  18371. virtual void drawWhiteNote (int midiNoteNumber,
  18372. Graphics& g,
  18373. int x, int y, int w, int h,
  18374. bool isDown, bool isOver,
  18375. const Colour& lineColour,
  18376. const Colour& textColour);
  18377. virtual void drawBlackNote (int midiNoteNumber,
  18378. Graphics& g,
  18379. int x, int y, int w, int h,
  18380. bool isDown, bool isOver,
  18381. const Colour& noteFillColour);
  18382. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18383. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18384. const bool isMouseOver,
  18385. const bool isButtonPressed,
  18386. const bool movesOctavesUp);
  18387. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18388. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18389. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18390. int& x, int& w) const;
  18391. private:
  18392. MidiKeyboardState& state;
  18393. int xOffset, blackNoteLength;
  18394. float keyWidth;
  18395. Orientation orientation;
  18396. int midiChannel, midiInChannelMask;
  18397. float velocity;
  18398. int noteUnderMouse, mouseDownNote;
  18399. BitArray keysPressed, keysCurrentlyDrawnDown;
  18400. int rangeStart, rangeEnd, firstKey;
  18401. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18402. Button* scrollDown;
  18403. Button* scrollUp;
  18404. Array <KeyPress> keyPresses;
  18405. Array <int> keyPressNotes;
  18406. int keyMappingOctave;
  18407. int octaveNumForMiddleC;
  18408. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18409. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18410. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18411. void resetAnyKeysInUse();
  18412. void updateNoteUnderMouse (const Point<int>& pos);
  18413. void repaintNote (const int midiNoteNumber);
  18414. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18415. const MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18416. };
  18417. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18418. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18419. #endif
  18420. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18421. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18422. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18423. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18424. #if ! DOXYGEN
  18425. class NSViewComponentInternal;
  18426. #endif
  18427. #if JUCE_MAC || DOXYGEN
  18428. class JUCE_API NSViewComponent : public Component
  18429. {
  18430. public:
  18431. NSViewComponent();
  18432. ~NSViewComponent();
  18433. void setView (void* nsView);
  18434. void* getView() const;
  18435. void paint (Graphics& g);
  18436. juce_UseDebuggingNewOperator
  18437. private:
  18438. friend class NSViewComponentInternal;
  18439. ScopedPointer <NSViewComponentInternal> info;
  18440. NSViewComponent (const NSViewComponent&);
  18441. const NSViewComponent& operator= (const NSViewComponent&);
  18442. };
  18443. #endif
  18444. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18445. /*** End of inlined file: juce_NSViewComponent.h ***/
  18446. #endif
  18447. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18448. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18449. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18450. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18451. // this is used to disable OpenGL, and is defined in juce_Config.h
  18452. #if JUCE_OPENGL || DOXYGEN
  18453. class JUCE_API OpenGLPixelFormat
  18454. {
  18455. public:
  18456. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18457. const int alphaBits = 8,
  18458. const int depthBufferBits = 16,
  18459. const int stencilBufferBits = 0) throw();
  18460. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18461. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18462. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18463. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18464. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18465. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18466. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18467. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18468. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18469. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18470. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18471. static void getAvailablePixelFormats (Component* component,
  18472. OwnedArray <OpenGLPixelFormat>& results);
  18473. bool operator== (const OpenGLPixelFormat&) const throw();
  18474. juce_UseDebuggingNewOperator
  18475. };
  18476. class JUCE_API OpenGLContext
  18477. {
  18478. public:
  18479. virtual ~OpenGLContext();
  18480. virtual bool makeActive() const throw() = 0;
  18481. virtual bool makeInactive() const throw() = 0;
  18482. virtual bool isActive() const throw() = 0;
  18483. virtual void swapBuffers() = 0;
  18484. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18485. virtual int getSwapInterval() const = 0;
  18486. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18487. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18488. virtual void repaint() = 0;
  18489. virtual void* getRawContext() const throw() = 0;
  18490. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18491. const OpenGLPixelFormat& pixelFormat,
  18492. const OpenGLContext* const contextToShareWith);
  18493. static OpenGLContext* getCurrentContext();
  18494. juce_UseDebuggingNewOperator
  18495. protected:
  18496. OpenGLContext() throw();
  18497. };
  18498. class JUCE_API OpenGLComponent : public Component
  18499. {
  18500. public:
  18501. OpenGLComponent();
  18502. ~OpenGLComponent();
  18503. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18504. const OpenGLPixelFormat getPixelFormat() const;
  18505. void shareWith (OpenGLContext* contextToShareListsWith);
  18506. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18507. void swapBuffers();
  18508. virtual void renderOpenGL() = 0;
  18509. virtual void newOpenGLContextCreated() = 0;
  18510. OpenGLContext* getCurrentContext() const throw() { return context; }
  18511. bool makeCurrentContextActive();
  18512. void makeCurrentContextInactive();
  18513. bool isActiveContext() const throw();
  18514. virtual bool renderAndSwapBuffers();
  18515. CriticalSection& getContextLock() throw() { return contextLock; }
  18516. void paint (Graphics& g);
  18517. void* getNativeWindowHandle() const;
  18518. juce_UseDebuggingNewOperator
  18519. private:
  18520. class OpenGLComponentWatcher;
  18521. friend class ScopedPointer <OpenGLComponentWatcher>;
  18522. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18523. OpenGLContext* context;
  18524. OpenGLContext* contextToShareListsWith;
  18525. CriticalSection contextLock;
  18526. OpenGLPixelFormat preferredPixelFormat;
  18527. bool needToUpdateViewport;
  18528. void deleteContext();
  18529. void updateContextPosition();
  18530. void internalRepaint (int x, int y, int w, int h);
  18531. OpenGLComponent (const OpenGLComponent&);
  18532. const OpenGLComponent& operator= (const OpenGLComponent&);
  18533. };
  18534. #endif
  18535. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18536. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18537. #endif
  18538. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18539. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18540. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18541. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18542. class JUCE_API PreferencesPanel : public Component,
  18543. private ButtonListener
  18544. {
  18545. public:
  18546. PreferencesPanel();
  18547. ~PreferencesPanel();
  18548. void addSettingsPage (const String& pageTitle,
  18549. const Drawable* normalIcon,
  18550. const Drawable* overIcon,
  18551. const Drawable* downIcon);
  18552. void addSettingsPage (const String& pageTitle,
  18553. const char* imageData,
  18554. const int imageDataSize);
  18555. void showInDialogBox (const String& dialogtitle,
  18556. int dialogWidth,
  18557. int dialogHeight,
  18558. const Colour& backgroundColour = Colours::white);
  18559. virtual Component* createComponentForPage (const String& pageName) = 0;
  18560. void setCurrentPage (const String& pageName);
  18561. void resized();
  18562. void paint (Graphics& g);
  18563. void buttonClicked (Button* button);
  18564. juce_UseDebuggingNewOperator
  18565. private:
  18566. String currentPageName;
  18567. ScopedPointer <Component> currentPage;
  18568. int buttonSize;
  18569. PreferencesPanel (const PreferencesPanel&);
  18570. const PreferencesPanel& operator= (const PreferencesPanel&);
  18571. };
  18572. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18573. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18574. #endif
  18575. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18576. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18577. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18578. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18579. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18580. // amalgamated build)
  18581. #if JUCE_WINDOWS
  18582. typedef ActiveXControlComponent QTCompBaseClass;
  18583. #elif JUCE_MAC
  18584. typedef NSViewComponent QTCompBaseClass;
  18585. #endif
  18586. // this is used to disable QuickTime, and is defined in juce_Config.h
  18587. #if JUCE_QUICKTIME || DOXYGEN
  18588. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18589. {
  18590. public:
  18591. QuickTimeMovieComponent();
  18592. ~QuickTimeMovieComponent();
  18593. static bool isQuickTimeAvailable() throw();
  18594. bool loadMovie (const File& movieFile,
  18595. const bool isControllerVisible);
  18596. bool loadMovie (const URL& movieURL,
  18597. const bool isControllerVisible);
  18598. bool loadMovie (InputStream* movieStream,
  18599. const bool isControllerVisible);
  18600. void closeMovie();
  18601. const File getCurrentMovieFile() const;
  18602. bool isMovieOpen() const;
  18603. double getMovieDuration() const;
  18604. void getMovieNormalSize (int& width, int& height) const;
  18605. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18606. const RectanglePlacement& placement);
  18607. void play();
  18608. void stop();
  18609. bool isPlaying() const;
  18610. void goToStart();
  18611. void setPosition (const double seconds);
  18612. double getPosition() const;
  18613. void setSpeed (const float newSpeed);
  18614. void setMovieVolume (const float newVolume);
  18615. float getMovieVolume() const;
  18616. void setLooping (const bool shouldLoop);
  18617. bool isLooping() const;
  18618. bool isControllerVisible() const;
  18619. void paint (Graphics& g);
  18620. juce_UseDebuggingNewOperator
  18621. private:
  18622. File movieFile;
  18623. bool movieLoaded, controllerVisible, looping;
  18624. #if JUCE_WINDOWS
  18625. void parentHierarchyChanged();
  18626. void visibilityChanged();
  18627. void createControlIfNeeded();
  18628. bool isControlCreated() const;
  18629. void* internal;
  18630. #else
  18631. void* movie;
  18632. #endif
  18633. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18634. const QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18635. };
  18636. #endif
  18637. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18638. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18639. #endif
  18640. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18641. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18642. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18643. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18644. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18645. class JUCE_API SystemTrayIconComponent : public Component
  18646. {
  18647. public:
  18648. SystemTrayIconComponent();
  18649. ~SystemTrayIconComponent();
  18650. void setIconImage (const Image& newImage);
  18651. void setIconTooltip (const String& tooltip);
  18652. #if JUCE_LINUX
  18653. void paint (Graphics& g);
  18654. #endif
  18655. juce_UseDebuggingNewOperator
  18656. private:
  18657. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18658. const SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18659. };
  18660. #endif
  18661. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18662. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18663. #endif
  18664. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18665. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18666. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18667. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18668. #if JUCE_WEB_BROWSER || DOXYGEN
  18669. #if ! DOXYGEN
  18670. class WebBrowserComponentInternal;
  18671. #endif
  18672. class JUCE_API WebBrowserComponent : public Component
  18673. {
  18674. public:
  18675. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18676. ~WebBrowserComponent();
  18677. void goToURL (const String& url,
  18678. const StringArray* headers = 0,
  18679. const MemoryBlock* postData = 0);
  18680. void stop();
  18681. void goBack();
  18682. void goForward();
  18683. void refresh();
  18684. virtual bool pageAboutToLoad (const String& newURL);
  18685. void paint (Graphics& g);
  18686. void resized();
  18687. void parentHierarchyChanged();
  18688. void visibilityChanged();
  18689. juce_UseDebuggingNewOperator
  18690. private:
  18691. WebBrowserComponentInternal* browser;
  18692. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18693. String lastURL;
  18694. StringArray lastHeaders;
  18695. MemoryBlock lastPostData;
  18696. void reloadLastURL();
  18697. void checkWindowAssociation();
  18698. WebBrowserComponent (const WebBrowserComponent&);
  18699. const WebBrowserComponent& operator= (const WebBrowserComponent&);
  18700. };
  18701. #endif
  18702. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18703. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18704. #endif
  18705. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18706. #endif
  18707. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18708. #endif
  18709. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18710. /*** Start of inlined file: juce_DialogWindow.h ***/
  18711. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18712. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18713. class JUCE_API DialogWindow : public DocumentWindow
  18714. {
  18715. public:
  18716. DialogWindow (const String& name,
  18717. const Colour& backgroundColour,
  18718. const bool escapeKeyTriggersCloseButton,
  18719. const bool addToDesktop = true);
  18720. ~DialogWindow();
  18721. static int showModalDialog (const String& dialogTitle,
  18722. Component* contentComponent,
  18723. Component* componentToCentreAround,
  18724. const Colour& backgroundColour,
  18725. const bool escapeKeyTriggersCloseButton,
  18726. const bool shouldBeResizable = false,
  18727. const bool useBottomRightCornerResizer = false);
  18728. juce_UseDebuggingNewOperator
  18729. protected:
  18730. void resized();
  18731. private:
  18732. bool escapeKeyTriggersCloseButton;
  18733. DialogWindow (const DialogWindow&);
  18734. const DialogWindow& operator= (const DialogWindow&);
  18735. };
  18736. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18737. /*** End of inlined file: juce_DialogWindow.h ***/
  18738. #endif
  18739. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18740. #endif
  18741. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18742. #endif
  18743. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18744. /*** Start of inlined file: juce_SplashScreen.h ***/
  18745. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18746. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18747. class JUCE_API SplashScreen : public Component,
  18748. public Timer,
  18749. private DeletedAtShutdown
  18750. {
  18751. public:
  18752. SplashScreen();
  18753. ~SplashScreen();
  18754. void show (const String& title,
  18755. Image* const backgroundImage,
  18756. const int minimumTimeToDisplayFor,
  18757. const bool useDropShadow,
  18758. const bool removeOnMouseClick = true);
  18759. void show (const String& title,
  18760. const int width,
  18761. const int height,
  18762. const int minimumTimeToDisplayFor,
  18763. const bool useDropShadow,
  18764. const bool removeOnMouseClick = true);
  18765. void paint (Graphics& g);
  18766. void timerCallback();
  18767. juce_UseDebuggingNewOperator
  18768. private:
  18769. Image* backgroundImage;
  18770. Time earliestTimeToDelete;
  18771. int originalClickCounter;
  18772. SplashScreen (const SplashScreen&);
  18773. const SplashScreen& operator= (const SplashScreen&);
  18774. };
  18775. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18776. /*** End of inlined file: juce_SplashScreen.h ***/
  18777. #endif
  18778. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18779. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18780. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18781. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18782. class JUCE_API ThreadWithProgressWindow : public Thread,
  18783. private Timer
  18784. {
  18785. public:
  18786. ThreadWithProgressWindow (const String& windowTitle,
  18787. const bool hasProgressBar,
  18788. const bool hasCancelButton,
  18789. const int timeOutMsWhenCancelling = 10000,
  18790. const String& cancelButtonText = JUCE_T("Cancel"));
  18791. ~ThreadWithProgressWindow();
  18792. bool runThread (const int threadPriority = 5);
  18793. void setProgress (const double newProgress);
  18794. void setStatusMessage (const String& newStatusMessage);
  18795. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18796. juce_UseDebuggingNewOperator
  18797. private:
  18798. void timerCallback();
  18799. double progress;
  18800. ScopedPointer <AlertWindow> alertWindow;
  18801. String message;
  18802. CriticalSection messageLock;
  18803. const int timeOutMsWhenCancelling;
  18804. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18805. const ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18806. };
  18807. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18808. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18809. #endif
  18810. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18811. #endif
  18812. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18813. #endif
  18814. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18815. #endif
  18816. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18817. #endif
  18818. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18819. #endif
  18820. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18821. #endif
  18822. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18823. #endif
  18824. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18825. #endif
  18826. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18827. #endif
  18828. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18829. #endif
  18830. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18831. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18832. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18833. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18834. class JUCE_API LowLevelGraphicsContext
  18835. {
  18836. protected:
  18837. LowLevelGraphicsContext();
  18838. public:
  18839. virtual ~LowLevelGraphicsContext();
  18840. virtual bool isVectorDevice() const = 0;
  18841. virtual void setOrigin (int x, int y) = 0;
  18842. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18843. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18844. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18845. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18846. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18847. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18848. virtual const Rectangle<int> getClipBounds() const = 0;
  18849. virtual bool isClipEmpty() const = 0;
  18850. virtual void saveState() = 0;
  18851. virtual void restoreState() = 0;
  18852. virtual void setFill (const FillType& fillType) = 0;
  18853. virtual void setOpacity (float newOpacity) = 0;
  18854. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18855. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18856. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18857. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18858. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18859. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18860. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18861. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18862. virtual void setFont (const Font& newFont) = 0;
  18863. virtual const Font getFont() = 0;
  18864. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18865. };
  18866. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18867. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18868. #endif
  18869. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18870. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18871. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18872. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18873. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18874. {
  18875. public:
  18876. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18877. const String& documentTitle,
  18878. const int totalWidth,
  18879. const int totalHeight);
  18880. ~LowLevelGraphicsPostScriptRenderer();
  18881. bool isVectorDevice() const;
  18882. void setOrigin (int x, int y);
  18883. bool clipToRectangle (const Rectangle<int>& r);
  18884. bool clipToRectangleList (const RectangleList& clipRegion);
  18885. void excludeClipRectangle (const Rectangle<int>& r);
  18886. void clipToPath (const Path& path, const AffineTransform& transform);
  18887. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18888. void saveState();
  18889. void restoreState();
  18890. bool clipRegionIntersects (const Rectangle<int>& r);
  18891. const Rectangle<int> getClipBounds() const;
  18892. bool isClipEmpty() const;
  18893. void setFill (const FillType& fillType);
  18894. void setOpacity (float opacity);
  18895. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18896. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18897. void fillPath (const Path& path, const AffineTransform& transform);
  18898. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18899. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18900. void drawLine (double x1, double y1, double x2, double y2);
  18901. void drawVerticalLine (const int x, double top, double bottom);
  18902. void drawHorizontalLine (const int x, double top, double bottom);
  18903. const Font getFont();
  18904. void setFont (const Font& newFont);
  18905. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18906. juce_UseDebuggingNewOperator
  18907. protected:
  18908. OutputStream& out;
  18909. int totalWidth, totalHeight;
  18910. bool needToClip;
  18911. Colour lastColour;
  18912. struct SavedState
  18913. {
  18914. SavedState();
  18915. ~SavedState();
  18916. RectangleList clip;
  18917. int xOffset, yOffset;
  18918. FillType fillType;
  18919. Font font;
  18920. private:
  18921. const SavedState& operator= (const SavedState&);
  18922. };
  18923. OwnedArray <SavedState> stateStack;
  18924. void writeClip();
  18925. void writeColour (const Colour& colour);
  18926. void writePath (const Path& path) const;
  18927. void writeXY (const float x, const float y) const;
  18928. void writeTransform (const AffineTransform& trans) const;
  18929. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  18930. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18931. const LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18932. };
  18933. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18934. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18935. #endif
  18936. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18937. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18938. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18939. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18940. class LLGCSavedState;
  18941. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18942. {
  18943. public:
  18944. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18945. ~LowLevelGraphicsSoftwareRenderer();
  18946. bool isVectorDevice() const;
  18947. void setOrigin (int x, int y);
  18948. bool clipToRectangle (const Rectangle<int>& r);
  18949. bool clipToRectangleList (const RectangleList& clipRegion);
  18950. void excludeClipRectangle (const Rectangle<int>& r);
  18951. void clipToPath (const Path& path, const AffineTransform& transform);
  18952. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18953. bool clipRegionIntersects (const Rectangle<int>& r);
  18954. const Rectangle<int> getClipBounds() const;
  18955. bool isClipEmpty() const;
  18956. void saveState();
  18957. void restoreState();
  18958. void setFill (const FillType& fillType);
  18959. void setOpacity (float opacity);
  18960. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18961. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18962. void fillPath (const Path& path, const AffineTransform& transform);
  18963. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18964. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18965. void drawLine (double x1, double y1, double x2, double y2);
  18966. void drawVerticalLine (const int x, double top, double bottom);
  18967. void drawHorizontalLine (const int x, double top, double bottom);
  18968. void setFont (const Font& newFont);
  18969. const Font getFont();
  18970. void drawGlyph (int glyphNumber, float x, float y);
  18971. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18972. juce_UseDebuggingNewOperator
  18973. protected:
  18974. Image& image;
  18975. ScopedPointer <LLGCSavedState> currentState;
  18976. OwnedArray <LLGCSavedState> stateStack;
  18977. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  18978. const LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  18979. };
  18980. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18981. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18982. #endif
  18983. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  18984. #endif
  18985. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  18986. #endif
  18987. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18988. /*** Start of inlined file: juce_DrawableComposite.h ***/
  18989. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18990. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18991. class JUCE_API DrawableComposite : public Drawable
  18992. {
  18993. public:
  18994. DrawableComposite();
  18995. virtual ~DrawableComposite();
  18996. void insertDrawable (Drawable* drawable,
  18997. const AffineTransform& transform = AffineTransform::identity,
  18998. const int index = -1);
  18999. void insertDrawable (const Drawable& drawable,
  19000. const AffineTransform& transform = AffineTransform::identity,
  19001. const int index = -1);
  19002. void removeDrawable (const int index, const bool deleteDrawable = true);
  19003. int getNumDrawables() const throw() { return drawables.size(); }
  19004. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  19005. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  19006. void bringToFront (const int index);
  19007. void render (const Drawable::RenderingContext& context) const;
  19008. const Rectangle<float> getBounds() const;
  19009. bool hitTest (float x, float y) const;
  19010. Drawable* createCopy() const;
  19011. ValueTree createValueTree() const throw();
  19012. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19013. juce_UseDebuggingNewOperator
  19014. private:
  19015. OwnedArray <Drawable> drawables;
  19016. OwnedArray <AffineTransform> transforms;
  19017. DrawableComposite (const DrawableComposite&);
  19018. const DrawableComposite& operator= (const DrawableComposite&);
  19019. };
  19020. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19021. /*** End of inlined file: juce_DrawableComposite.h ***/
  19022. #endif
  19023. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19024. /*** Start of inlined file: juce_DrawableImage.h ***/
  19025. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19026. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19027. class JUCE_API DrawableImage : public Drawable
  19028. {
  19029. public:
  19030. DrawableImage();
  19031. virtual ~DrawableImage();
  19032. void setImage (const Image& imageToCopy);
  19033. void setImage (Image* imageToUse,
  19034. const bool releaseWhenNotNeeded);
  19035. Image* getImage() const throw() { return image; }
  19036. void clearImage();
  19037. void setOpacity (const float newOpacity);
  19038. float getOpacity() const throw() { return opacity; }
  19039. void setOverlayColour (const Colour& newOverlayColour);
  19040. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19041. void render (const Drawable::RenderingContext& context) const;
  19042. const Rectangle<float> getBounds() const;
  19043. bool hitTest (float x, float y) const;
  19044. Drawable* createCopy() const;
  19045. ValueTree createValueTree() const throw();
  19046. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19047. juce_UseDebuggingNewOperator
  19048. private:
  19049. Image* image;
  19050. bool canDeleteImage;
  19051. float opacity;
  19052. Colour overlayColour;
  19053. DrawableImage (const DrawableImage&);
  19054. const DrawableImage& operator= (const DrawableImage&);
  19055. };
  19056. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19057. /*** End of inlined file: juce_DrawableImage.h ***/
  19058. #endif
  19059. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19060. /*** Start of inlined file: juce_DrawablePath.h ***/
  19061. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19062. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19063. class JUCE_API DrawablePath : public Drawable
  19064. {
  19065. public:
  19066. DrawablePath();
  19067. virtual ~DrawablePath();
  19068. void setPath (const Path& newPath) throw();
  19069. const Path& getPath() const throw() { return path; }
  19070. void setFill (const FillType& newFill) throw();
  19071. const FillType& getFill() const throw() { return mainFill; }
  19072. void setStrokeFill (const FillType& newStrokeFill) throw();
  19073. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19074. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19075. void setStrokeThickness (const float newThickness) throw();
  19076. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19077. void render (const Drawable::RenderingContext& context) const;
  19078. const Rectangle<float> getBounds() const;
  19079. bool hitTest (float x, float y) const;
  19080. Drawable* createCopy() const;
  19081. ValueTree createValueTree() const throw();
  19082. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19083. juce_UseDebuggingNewOperator
  19084. private:
  19085. Path path, stroke;
  19086. FillType mainFill, strokeFill;
  19087. PathStrokeType strokeType;
  19088. void updateOutline();
  19089. DrawablePath (const DrawablePath&);
  19090. const DrawablePath& operator= (const DrawablePath&);
  19091. };
  19092. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19093. /*** End of inlined file: juce_DrawablePath.h ***/
  19094. #endif
  19095. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19096. /*** Start of inlined file: juce_DrawableText.h ***/
  19097. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19098. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19099. class JUCE_API DrawableText : public Drawable
  19100. {
  19101. public:
  19102. DrawableText();
  19103. virtual ~DrawableText();
  19104. void setText (const GlyphArrangement& newText);
  19105. void setText (const String& newText, const Font& fontToUse);
  19106. const GlyphArrangement& getText() const throw() { return text; }
  19107. void setColour (const Colour& newColour);
  19108. const Colour& getColour() const throw() { return colour; }
  19109. void render (const Drawable::RenderingContext& context) const;
  19110. const Rectangle<float> getBounds() const;
  19111. bool hitTest (float x, float y) const;
  19112. Drawable* createCopy() const;
  19113. ValueTree createValueTree() const throw();
  19114. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19115. juce_UseDebuggingNewOperator
  19116. private:
  19117. GlyphArrangement text;
  19118. Colour colour;
  19119. DrawableText (const DrawableText&);
  19120. const DrawableText& operator= (const DrawableText&);
  19121. };
  19122. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19123. /*** End of inlined file: juce_DrawableText.h ***/
  19124. #endif
  19125. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19126. #endif
  19127. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19128. /*** Start of inlined file: juce_GlowEffect.h ***/
  19129. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19130. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19131. class JUCE_API GlowEffect : public ImageEffectFilter
  19132. {
  19133. public:
  19134. GlowEffect();
  19135. ~GlowEffect();
  19136. void setGlowProperties (const float newRadius,
  19137. const Colour& newColour);
  19138. void applyEffect (Image& sourceImage, Graphics& destContext);
  19139. juce_UseDebuggingNewOperator
  19140. private:
  19141. float radius;
  19142. Colour colour;
  19143. };
  19144. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19145. /*** End of inlined file: juce_GlowEffect.h ***/
  19146. #endif
  19147. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19148. #endif
  19149. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19150. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19151. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19152. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19153. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19154. {
  19155. public:
  19156. ReduceOpacityEffect (const float opacity = 1.0f);
  19157. ~ReduceOpacityEffect();
  19158. void setOpacity (const float newOpacity);
  19159. void applyEffect (Image& sourceImage, Graphics& destContext);
  19160. juce_UseDebuggingNewOperator
  19161. private:
  19162. float opacity;
  19163. };
  19164. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19165. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19166. #endif
  19167. #ifndef __JUCE_FONT_JUCEHEADER__
  19168. #endif
  19169. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19170. #endif
  19171. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19172. #endif
  19173. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19174. #endif
  19175. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19176. #endif
  19177. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19178. #endif
  19179. #ifndef __JUCE_LINE_JUCEHEADER__
  19180. #endif
  19181. #ifndef __JUCE_PATH_JUCEHEADER__
  19182. #endif
  19183. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19184. /*** Start of inlined file: juce_PathIterator.h ***/
  19185. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19186. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19187. class JUCE_API PathFlatteningIterator
  19188. {
  19189. public:
  19190. PathFlatteningIterator (const Path& path,
  19191. const AffineTransform& transform = AffineTransform::identity,
  19192. float tolerence = 6.0f) throw();
  19193. ~PathFlatteningIterator() throw();
  19194. bool next() throw();
  19195. float x1;
  19196. float y1;
  19197. float x2;
  19198. float y2;
  19199. bool closesSubPath;
  19200. int subPathIndex;
  19201. bool isLastInSubpath() const { return stackPos == stackBase
  19202. && (index >= path.numElements
  19203. || points [index] == Path::moveMarker); }
  19204. juce_UseDebuggingNewOperator
  19205. private:
  19206. const Path& path;
  19207. const AffineTransform transform;
  19208. float* points;
  19209. float tolerence, subPathCloseX, subPathCloseY;
  19210. bool isIdentityTransform;
  19211. HeapBlock <float> stackBase;
  19212. float* stackPos;
  19213. int index, stackSize;
  19214. PathFlatteningIterator (const PathFlatteningIterator&);
  19215. const PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19216. };
  19217. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19218. /*** End of inlined file: juce_PathIterator.h ***/
  19219. #endif
  19220. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19221. #endif
  19222. #ifndef __JUCE_POINT_JUCEHEADER__
  19223. #endif
  19224. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19225. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19226. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19227. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19228. class JUCE_API PositionedRectangle
  19229. {
  19230. public:
  19231. PositionedRectangle() throw();
  19232. PositionedRectangle (const String& stringVersion) throw();
  19233. PositionedRectangle (const PositionedRectangle& other) throw();
  19234. const PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19235. ~PositionedRectangle() throw();
  19236. const String toString() const throw();
  19237. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19238. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19239. double& x,
  19240. double& y,
  19241. double& width,
  19242. double& height) const throw();
  19243. void applyToComponent (Component& comp) const throw();
  19244. void updateFrom (const Rectangle<int>& newPosition,
  19245. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19246. void updateFromDouble (const double x, const double y,
  19247. const double width, const double height,
  19248. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19249. void updateFromComponent (const Component& comp) throw();
  19250. enum AnchorPoint
  19251. {
  19252. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19253. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19254. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19255. };
  19256. enum PositionMode
  19257. {
  19258. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19259. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19260. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19261. 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. */
  19262. };
  19263. enum SizeMode
  19264. {
  19265. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19266. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19267. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19268. };
  19269. void setModes (const AnchorPoint xAnchorMode,
  19270. const PositionMode xPositionMode,
  19271. const AnchorPoint yAnchorMode,
  19272. const PositionMode yPositionMode,
  19273. const SizeMode widthMode,
  19274. const SizeMode heightMode,
  19275. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19276. AnchorPoint getAnchorPointX() const throw();
  19277. PositionMode getPositionModeX() const throw();
  19278. double getX() const throw() { return x; }
  19279. void setX (const double newX) throw() { x = newX; }
  19280. AnchorPoint getAnchorPointY() const throw();
  19281. PositionMode getPositionModeY() const throw();
  19282. double getY() const throw() { return y; }
  19283. void setY (const double newY) throw() { y = newY; }
  19284. SizeMode getWidthMode() const throw();
  19285. double getWidth() const throw() { return w; }
  19286. void setWidth (const double newWidth) throw() { w = newWidth; }
  19287. SizeMode getHeightMode() const throw();
  19288. double getHeight() const throw() { return h; }
  19289. void setHeight (const double newHeight) throw() { h = newHeight; }
  19290. bool isPositionAbsolute() const throw();
  19291. const bool operator== (const PositionedRectangle& other) const throw();
  19292. const bool operator!= (const PositionedRectangle& other) const throw();
  19293. juce_UseDebuggingNewOperator
  19294. private:
  19295. double x, y, w, h;
  19296. uint8 xMode, yMode, wMode, hMode;
  19297. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19298. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19299. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19300. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19301. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19302. const uint8 xMode, const uint8 wMode,
  19303. const int parentPos, const int parentSize) const throw();
  19304. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19305. const uint8 xMode, const uint8 wMode,
  19306. const int parentPos, const int parentSize) const throw();
  19307. };
  19308. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19309. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19310. #endif
  19311. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19312. #endif
  19313. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19314. #endif
  19315. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19316. /*** Start of inlined file: juce_CameraDevice.h ***/
  19317. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19318. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19319. #if JUCE_USE_CAMERA
  19320. class CameraImageListener
  19321. {
  19322. public:
  19323. CameraImageListener() {}
  19324. virtual ~CameraImageListener() {}
  19325. virtual void imageReceived (Image& image) = 0;
  19326. };
  19327. class JUCE_API CameraDevice
  19328. {
  19329. public:
  19330. virtual ~CameraDevice();
  19331. static const StringArray getAvailableDevices();
  19332. static CameraDevice* openDevice (int deviceIndex,
  19333. int minWidth = 128, int minHeight = 64,
  19334. int maxWidth = 1024, int maxHeight = 768);
  19335. const String getName() const { return name; }
  19336. Component* createViewerComponent();
  19337. void startRecordingToFile (const File& file);
  19338. void stopRecording();
  19339. static const String getFileExtension();
  19340. const Time getTimeOfFirstRecordedFrame() const;
  19341. void addListener (CameraImageListener* listenerToAdd);
  19342. void removeListener (CameraImageListener* listenerToRemove);
  19343. juce_UseDebuggingNewOperator
  19344. protected:
  19345. CameraDevice (const String& name, int index);
  19346. private:
  19347. void* internal;
  19348. bool isRecording;
  19349. String name;
  19350. CameraDevice (const CameraDevice&);
  19351. const CameraDevice& operator= (const CameraDevice&);
  19352. };
  19353. #endif
  19354. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19355. /*** End of inlined file: juce_CameraDevice.h ***/
  19356. #endif
  19357. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19358. #endif
  19359. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19360. /*** Start of inlined file: juce_ImageCache.h ***/
  19361. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19362. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19363. struct ImageCacheItem;
  19364. class JUCE_API ImageCache : private DeletedAtShutdown,
  19365. private Timer
  19366. {
  19367. public:
  19368. static Image* getFromFile (const File& file);
  19369. static Image* getFromMemory (const void* imageData,
  19370. const int dataSize);
  19371. static void release (Image* const imageToRelease);
  19372. static void releaseOrDelete (Image* const imageToRelease);
  19373. static bool isImageInCache (Image* const imageToLookFor);
  19374. static void incReferenceCount (Image* const image);
  19375. static Image* getFromHashCode (const int64 hashCode);
  19376. static void addImageToCache (Image* const image,
  19377. const int64 hashCode);
  19378. static void setCacheTimeout (const int millisecs);
  19379. juce_UseDebuggingNewOperator
  19380. private:
  19381. CriticalSection lock;
  19382. OwnedArray <ImageCacheItem> images;
  19383. ImageCache();
  19384. ImageCache (const ImageCache&);
  19385. const ImageCache& operator= (const ImageCache&);
  19386. ~ImageCache();
  19387. void timerCallback();
  19388. };
  19389. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19390. /*** End of inlined file: juce_ImageCache.h ***/
  19391. #endif
  19392. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19393. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19394. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19395. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19396. class JUCE_API ImageConvolutionKernel
  19397. {
  19398. public:
  19399. ImageConvolutionKernel (const int size);
  19400. ~ImageConvolutionKernel();
  19401. void clear();
  19402. void setKernelValue (const int x,
  19403. const int y,
  19404. const float value);
  19405. void setOverallSum (const float desiredTotalSum);
  19406. void rescaleAllValues (const float multiplier);
  19407. void createGaussianBlur (const float blurRadius);
  19408. int getKernelSize() const { return size; }
  19409. float** getValues() const { return values; }
  19410. void applyToImage (Image& destImage,
  19411. const Image* sourceImage,
  19412. int x,
  19413. int y,
  19414. int width,
  19415. int height) const;
  19416. juce_UseDebuggingNewOperator
  19417. private:
  19418. HeapBlock <float> values;
  19419. const int size;
  19420. // no reason not to implement these one day..
  19421. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19422. const ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19423. };
  19424. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19425. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19426. #endif
  19427. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19428. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19429. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19430. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19431. class JUCE_API ImageFileFormat
  19432. {
  19433. protected:
  19434. ImageFileFormat() {}
  19435. public:
  19436. virtual ~ImageFileFormat() {}
  19437. virtual const String getFormatName() = 0;
  19438. virtual bool canUnderstand (InputStream& input) = 0;
  19439. virtual Image* decodeImage (InputStream& input) = 0;
  19440. virtual bool writeImageToStream (const Image& sourceImage,
  19441. OutputStream& destStream) = 0;
  19442. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19443. static Image* loadFrom (InputStream& input);
  19444. static Image* loadFrom (const File& file);
  19445. static Image* loadFrom (const void* rawData,
  19446. const int numBytesOfData);
  19447. };
  19448. class JUCE_API PNGImageFormat : public ImageFileFormat
  19449. {
  19450. public:
  19451. PNGImageFormat();
  19452. ~PNGImageFormat();
  19453. const String getFormatName();
  19454. bool canUnderstand (InputStream& input);
  19455. Image* decodeImage (InputStream& input);
  19456. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19457. };
  19458. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19459. {
  19460. public:
  19461. JPEGImageFormat();
  19462. ~JPEGImageFormat();
  19463. void setQuality (const float newQuality);
  19464. const String getFormatName();
  19465. bool canUnderstand (InputStream& input);
  19466. Image* decodeImage (InputStream& input);
  19467. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19468. private:
  19469. float quality;
  19470. };
  19471. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19472. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19473. #endif
  19474. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19475. #endif
  19476. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19477. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19478. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19479. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19480. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19481. {
  19482. public:
  19483. FileBasedDocument (const String& fileExtension,
  19484. const String& fileWildCard,
  19485. const String& openFileDialogTitle,
  19486. const String& saveFileDialogTitle);
  19487. virtual ~FileBasedDocument();
  19488. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19489. virtual void changed();
  19490. void setChangedFlag (const bool hasChanged);
  19491. bool loadFrom (const File& fileToLoadFrom,
  19492. const bool showMessageOnFailure);
  19493. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19494. enum SaveResult
  19495. {
  19496. savedOk = 0, /**< indicates that a file was saved successfully. */
  19497. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19498. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19499. };
  19500. SaveResult save (const bool askUserForFileIfNotSpecified,
  19501. const bool showMessageOnFailure);
  19502. SaveResult saveIfNeededAndUserAgrees();
  19503. SaveResult saveAs (const File& newFile,
  19504. const bool warnAboutOverwritingExistingFiles,
  19505. const bool askUserForFileIfNotSpecified,
  19506. const bool showMessageOnFailure);
  19507. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19508. const File getFile() const { return documentFile; }
  19509. void setFile (const File& newFile);
  19510. protected:
  19511. virtual const String getDocumentTitle() = 0;
  19512. virtual const String loadDocument (const File& file) = 0;
  19513. virtual const String saveDocument (const File& file) = 0;
  19514. virtual const File getLastDocumentOpened() = 0;
  19515. virtual void setLastDocumentOpened (const File& file) = 0;
  19516. public:
  19517. juce_UseDebuggingNewOperator
  19518. private:
  19519. File documentFile;
  19520. bool changedSinceSave;
  19521. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19522. FileBasedDocument (const FileBasedDocument&);
  19523. const FileBasedDocument& operator= (const FileBasedDocument&);
  19524. };
  19525. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19526. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19527. #endif
  19528. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19529. #endif
  19530. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19531. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19532. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19533. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19534. class JUCE_API RecentlyOpenedFilesList
  19535. {
  19536. public:
  19537. RecentlyOpenedFilesList();
  19538. ~RecentlyOpenedFilesList();
  19539. void setMaxNumberOfItems (const int newMaxNumber);
  19540. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19541. int getNumFiles() const;
  19542. const File getFile (const int index) const;
  19543. const StringArray& getAllFilenames() const throw() { return files; }
  19544. void clear();
  19545. void addFile (const File& file);
  19546. void removeNonExistentFiles();
  19547. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19548. const int baseItemId,
  19549. const bool showFullPaths,
  19550. const bool dontAddNonExistentFiles,
  19551. const File** filesToAvoid = 0);
  19552. const String toString() const;
  19553. void restoreFromString (const String& stringifiedVersion);
  19554. juce_UseDebuggingNewOperator
  19555. private:
  19556. StringArray files;
  19557. int maxNumberOfItems;
  19558. };
  19559. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19560. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19561. #endif
  19562. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19563. #endif
  19564. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19565. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19566. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19567. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19568. class JUCE_API SystemClipboard
  19569. {
  19570. public:
  19571. static void copyTextToClipboard (const String& text) throw();
  19572. static const String getTextFromClipboard() throw();
  19573. };
  19574. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19575. /*** End of inlined file: juce_SystemClipboard.h ***/
  19576. #endif
  19577. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19578. #endif
  19579. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19580. #endif
  19581. #endif
  19582. /*** End of inlined file: juce_app_includes.h ***/
  19583. #endif
  19584. #if JUCE_MSVC
  19585. #pragma warning (pop)
  19586. #pragma pack (pop)
  19587. #endif
  19588. END_JUCE_NAMESPACE
  19589. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19590. #ifdef JUCE_NAMESPACE
  19591. // this will obviously save a lot of typing, but can be disabled by
  19592. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19593. using namespace JUCE_NAMESPACE;
  19594. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19595. #define Component JUCE_NAMESPACE::Component
  19596. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19597. #define Point JUCE_NAMESPACE::Point
  19598. #define Button JUCE_NAMESPACE::Button
  19599. #endif
  19600. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19601. #define Rectangle JUCE_NAMESPACE::Rectangle
  19602. #endif
  19603. #endif
  19604. #endif
  19605. #if JUCE_MSVC
  19606. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19607. #ifdef JUCE_DLL
  19608. #ifdef JUCE_DEBUG
  19609. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19610. #else
  19611. #define AUTOLINKEDLIB "JUCE.lib"
  19612. #endif
  19613. #else
  19614. #ifdef JUCE_DEBUG
  19615. #ifdef _WIN64
  19616. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19617. #else
  19618. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19619. #endif
  19620. #else
  19621. #ifdef _WIN64
  19622. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19623. #else
  19624. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19625. #endif
  19626. #endif
  19627. #endif
  19628. #pragma comment(lib, AUTOLINKEDLIB)
  19629. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19630. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19631. #endif
  19632. // Auto-link the other win32 libs that are needed by library calls..
  19633. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19634. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19635. // Auto-links to various win32 libs that are needed by library calls..
  19636. #pragma comment(lib, "kernel32.lib")
  19637. #pragma comment(lib, "user32.lib")
  19638. #pragma comment(lib, "shell32.lib")
  19639. #pragma comment(lib, "gdi32.lib")
  19640. #pragma comment(lib, "vfw32.lib")
  19641. #pragma comment(lib, "comdlg32.lib")
  19642. #pragma comment(lib, "winmm.lib")
  19643. #pragma comment(lib, "wininet.lib")
  19644. #pragma comment(lib, "ole32.lib")
  19645. #pragma comment(lib, "oleaut32.lib")
  19646. #pragma comment(lib, "advapi32.lib")
  19647. #pragma comment(lib, "ws2_32.lib")
  19648. #pragma comment(lib, "comsupp.lib")
  19649. #pragma comment(lib, "version.lib")
  19650. #if JUCE_OPENGL
  19651. #pragma comment(lib, "OpenGL32.Lib")
  19652. #pragma comment(lib, "GlU32.Lib")
  19653. #endif
  19654. #if JUCE_QUICKTIME
  19655. #pragma comment (lib, "QTMLClient.lib")
  19656. #endif
  19657. #if JUCE_USE_CAMERA
  19658. #pragma comment (lib, "Strmiids.lib")
  19659. #endif
  19660. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19661. #endif
  19662. #endif
  19663. #endif
  19664. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19665. #define START_JUCE_APPLICATION(AppClass) \
  19666. int main (int argc, char* argv[]) \
  19667. { \
  19668. return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
  19669. }
  19670. #elif JUCE_WINDOWS
  19671. #ifdef _CONSOLE
  19672. #define START_JUCE_APPLICATION(AppClass) \
  19673. int main (int, char* argv[]) \
  19674. { \
  19675. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19676. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19677. }
  19678. #elif ! defined (_AFXDLL)
  19679. #ifdef _WINDOWS_
  19680. #define START_JUCE_APPLICATION(AppClass) \
  19681. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19682. { \
  19683. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19684. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19685. }
  19686. #else
  19687. #define START_JUCE_APPLICATION(AppClass) \
  19688. int __stdcall WinMain (int, int, const char*, int) \
  19689. { \
  19690. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19691. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19692. }
  19693. #endif
  19694. #endif
  19695. #endif
  19696. #endif // __JUCE_JUCEHEADER__
  19697. /*** End of inlined file: juce.h ***/
  19698. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__