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.

28689 lines
742KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  19. #define __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  20. #define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
  21. /*** Start of inlined file: juce.h ***/
  22. #ifndef __JUCE_JUCEHEADER__
  23. #define __JUCE_JUCEHEADER__
  24. #define JUCE_PUBLIC_INCLUDES 1
  25. // (this includes things that need defining outside of the JUCE namespace)
  26. /*** Start of inlined file: juce_StandardHeader.h ***/
  27. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  28. #define __JUCE_STANDARDHEADER_JUCEHEADER__
  29. #define JUCE_MAJOR_VERSION 1
  30. #define JUCE_MINOR_VERSION 51
  31. #define JUCE_BUILDNUMBER 7
  32. #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
  33. /*** Start of inlined file: juce_TargetPlatform.h ***/
  34. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  35. #define __JUCE_TARGETPLATFORM_JUCEHEADER__
  36. #if (defined (_WIN32) || defined (_WIN64))
  37. #define JUCE_WIN32 1
  38. #define JUCE_WINDOWS 1
  39. #elif defined (LINUX) || defined (__linux__)
  40. #define JUCE_LINUX 1
  41. #elif defined(__APPLE_CPP__) || defined(__APPLE_CC__)
  42. #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
  43. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
  44. #define JUCE_IPHONE 1
  45. #else
  46. #define JUCE_MAC 1
  47. #endif
  48. #else
  49. #error "Unknown platform!"
  50. #endif
  51. #if JUCE_WINDOWS
  52. #ifdef _MSC_VER
  53. #ifdef _WIN64
  54. #define JUCE_64BIT 1
  55. #else
  56. #define JUCE_32BIT 1
  57. #endif
  58. #endif
  59. #ifdef _DEBUG
  60. #define JUCE_DEBUG 1
  61. #endif
  62. #ifdef __MINGW32__
  63. #define JUCE_MINGW 1
  64. #endif
  65. #define JUCE_LITTLE_ENDIAN 1
  66. #define JUCE_INTEL 1
  67. #endif
  68. #if JUCE_MAC
  69. #ifndef NDEBUG
  70. #define JUCE_DEBUG 1
  71. #endif
  72. #ifdef __LITTLE_ENDIAN__
  73. #define JUCE_LITTLE_ENDIAN 1
  74. #else
  75. #define JUCE_BIG_ENDIAN 1
  76. #endif
  77. #if defined (__ppc__) || defined (__ppc64__)
  78. #define JUCE_PPC 1
  79. #undef MAC_OS_X_VERSION_MAX_ALLOWED
  80. #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_4
  81. #else
  82. #define JUCE_INTEL 1
  83. #endif
  84. #ifdef __LP64__
  85. #define JUCE_64BIT 1
  86. #else
  87. #define JUCE_32BIT 1
  88. #endif
  89. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  90. #error "Building for OSX 10.3 is no longer supported!"
  91. #endif
  92. #ifndef MAC_OS_X_VERSION_10_5
  93. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  94. #endif
  95. #endif
  96. #if JUCE_IPHONE
  97. #ifndef NDEBUG
  98. #define JUCE_DEBUG 1
  99. #endif
  100. #ifdef __LITTLE_ENDIAN__
  101. #define JUCE_LITTLE_ENDIAN 1
  102. #else
  103. #define JUCE_BIG_ENDIAN 1
  104. #endif
  105. #endif
  106. #if JUCE_LINUX
  107. #ifdef _DEBUG
  108. #define JUCE_DEBUG 1
  109. #endif
  110. // Allow override for big-endian Linux platforms
  111. #ifndef JUCE_BIG_ENDIAN
  112. #define JUCE_LITTLE_ENDIAN 1
  113. #endif
  114. #if defined (__LP64__) || defined (_LP64)
  115. #define JUCE_64BIT 1
  116. #else
  117. #define JUCE_32BIT 1
  118. #endif
  119. #define JUCE_INTEL 1
  120. #endif
  121. // Compiler type macros.
  122. #ifdef __GNUC__
  123. #define JUCE_GCC 1
  124. #elif defined (_MSC_VER)
  125. #define JUCE_MSVC 1
  126. #if _MSC_VER >= 1400
  127. #define JUCE_USE_INTRINSICS 1
  128. #endif
  129. #else
  130. #error unknown compiler
  131. #endif
  132. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  133. /*** End of inlined file: juce_TargetPlatform.h ***/
  134. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  135. /*** Start of inlined file: juce_Config.h ***/
  136. #ifndef __JUCE_CONFIG_JUCEHEADER__
  137. #define __JUCE_CONFIG_JUCEHEADER__
  138. #ifndef JUCE_NAMESPACE
  139. #define JUCE_NAMESPACE juce
  140. #endif
  141. #ifndef JUCE_FORCE_DEBUG
  142. //#define JUCE_FORCE_DEBUG 1
  143. #endif
  144. #ifndef JUCE_LOG_ASSERTIONS
  145. // #define JUCE_LOG_ASSERTIONS 1
  146. #endif
  147. #ifndef JUCE_ASIO
  148. #define JUCE_ASIO 1
  149. #endif
  150. #ifndef JUCE_WASAPI
  151. // #define JUCE_WASAPI 1
  152. #endif
  153. #ifndef JUCE_DIRECTSOUND
  154. #define JUCE_DIRECTSOUND 1
  155. #endif
  156. #ifndef JUCE_ALSA
  157. #define JUCE_ALSA 1
  158. #endif
  159. #ifndef JUCE_JACK
  160. #define JUCE_JACK 1
  161. #endif
  162. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  163. #define JUCE_QUICKTIME 1
  164. #endif
  165. #ifndef JUCE_OPENGL
  166. #define JUCE_OPENGL 1
  167. #endif
  168. #ifndef JUCE_USE_FLAC
  169. #define JUCE_USE_FLAC 1
  170. #endif
  171. #ifndef JUCE_USE_OGGVORBIS
  172. #define JUCE_USE_OGGVORBIS 1
  173. #endif
  174. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  175. #define JUCE_USE_CDBURNER 1
  176. #endif
  177. #ifndef JUCE_USE_CDREADER
  178. #define JUCE_USE_CDREADER 1
  179. #endif
  180. #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
  181. // #define JUCE_USE_CAMERA 1
  182. #endif
  183. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  184. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  185. #endif
  186. #ifndef JUCE_USE_XINERAMA
  187. #define JUCE_USE_XINERAMA 1
  188. #endif
  189. #ifndef JUCE_USE_XSHM
  190. #define JUCE_USE_XSHM 1
  191. #endif
  192. #ifndef JUCE_PLUGINHOST_VST
  193. // #define JUCE_PLUGINHOST_VST 1
  194. #endif
  195. #ifndef JUCE_PLUGINHOST_AU
  196. // #define JUCE_PLUGINHOST_AU 1
  197. #endif
  198. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  199. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  200. #endif
  201. #ifndef JUCE_WEB_BROWSER
  202. #define JUCE_WEB_BROWSER 1
  203. #endif
  204. #ifndef JUCE_SUPPORT_CARBON
  205. #define JUCE_SUPPORT_CARBON 1
  206. #endif
  207. #ifndef JUCE_INCLUDE_ZLIB_CODE
  208. #define JUCE_INCLUDE_ZLIB_CODE 1
  209. #endif
  210. #ifndef JUCE_INCLUDE_FLAC_CODE
  211. #define JUCE_INCLUDE_FLAC_CODE 1
  212. #endif
  213. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  214. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  217. #define JUCE_INCLUDE_PNGLIB_CODE 1
  218. #endif
  219. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  220. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  221. #endif
  222. #ifndef JUCE_CHECK_MEMORY_LEAKS
  223. #define JUCE_CHECK_MEMORY_LEAKS 1
  224. #endif
  225. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  226. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  227. #endif
  228. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  229. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  230. #undef JUCE_QUICKTIME
  231. #define JUCE_QUICKTIME 0
  232. #undef JUCE_OPENGL
  233. #define JUCE_OPENGL 0
  234. #undef JUCE_USE_CDBURNER
  235. #define JUCE_USE_CDBURNER 0
  236. #undef JUCE_USE_CDREADER
  237. #define JUCE_USE_CDREADER 0
  238. #undef JUCE_WEB_BROWSER
  239. #define JUCE_WEB_BROWSER 0
  240. #undef JUCE_PLUGINHOST_AU
  241. #define JUCE_PLUGINHOST_AU 0
  242. #undef JUCE_PLUGINHOST_VST
  243. #define JUCE_PLUGINHOST_VST 0
  244. #endif
  245. #endif
  246. /*** End of inlined file: juce_Config.h ***/
  247. #ifdef JUCE_NAMESPACE
  248. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  249. #define END_JUCE_NAMESPACE }
  250. #else
  251. #define BEGIN_JUCE_NAMESPACE
  252. #define END_JUCE_NAMESPACE
  253. #endif
  254. /*** Start of inlined file: juce_PlatformDefs.h ***/
  255. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  256. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  257. #ifdef JUCE_FORCE_DEBUG
  258. #undef JUCE_DEBUG
  259. #if JUCE_FORCE_DEBUG
  260. #define JUCE_DEBUG 1
  261. #endif
  262. #endif
  263. #if JUCE_MSVC
  264. #define JUCE_CALLTYPE __stdcall
  265. #else
  266. #define JUCE_CALLTYPE
  267. #endif
  268. // Debugging and assertion macros
  269. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  270. #if JUCE_LOG_ASSERTIONS
  271. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  272. #elif defined (JUCE_DEBUG)
  273. #define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
  274. #else
  275. #define juce_LogCurrentAssertion
  276. #endif
  277. #ifdef JUCE_DEBUG
  278. // If debugging is enabled..
  279. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  280. #define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
  281. // Assertions..
  282. #if JUCE_WINDOWS || DOXYGEN
  283. #if JUCE_USE_INTRINSICS
  284. #pragma intrinsic (__debugbreak)
  285. #define juce_breakDebugger __debugbreak();
  286. #elif JUCE_GCC
  287. #define juce_breakDebugger asm("int $3");
  288. #else
  289. #define juce_breakDebugger { __asm int 3 }
  290. #endif
  291. #elif JUCE_MAC
  292. #define juce_breakDebugger Debugger();
  293. #elif JUCE_IPHONE
  294. #define juce_breakDebugger kill (0, SIGTRAP);
  295. #elif JUCE_LINUX
  296. #define juce_breakDebugger kill (0, SIGTRAP);
  297. #endif
  298. /** This will always cause an assertion failure.
  299. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  300. in juce_Config.h).
  301. @see jassert()
  302. */
  303. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  304. /** Platform-independent assertion macro.
  305. This gets optimised out when not being built with debugging turned on.
  306. Be careful not to call any functions within its arguments that are vital to
  307. the behaviour of the program, because these won't get called in the release
  308. build.
  309. @see jassertfalse
  310. */
  311. #define jassert(expression) { if (! (expression)) jassertfalse }
  312. #else
  313. // If debugging is disabled, these dummy debug and assertion macros are used..
  314. #define DBG(dbgtext)
  315. #define DBG_PRINTF(dbgprintf)
  316. #define jassertfalse { juce_LogCurrentAssertion }
  317. #if JUCE_LOG_ASSERTIONS
  318. #define jassert(expression) { if (! (expression)) jassertfalse }
  319. #else
  320. #define jassert(a) { }
  321. #endif
  322. #endif
  323. #ifndef DOXYGEN
  324. template <bool b> struct JuceStaticAssert;
  325. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  326. #endif
  327. /** A compile-time assertion macro.
  328. If the expression parameter is false, the macro will cause a compile error.
  329. */
  330. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  331. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  332. #define JUCE_TRY try
  333. #define JUCE_CATCH_EXCEPTION \
  334. catch (const std::exception& e) \
  335. { \
  336. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  337. } \
  338. catch (...) \
  339. { \
  340. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  341. }
  342. #define JUCE_CATCH_ALL catch (...) {}
  343. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  344. #else
  345. #define JUCE_TRY
  346. #define JUCE_CATCH_EXCEPTION
  347. #define JUCE_CATCH_ALL
  348. #define JUCE_CATCH_ALL_ASSERT
  349. #endif
  350. // Macros for inlining.
  351. #if JUCE_MSVC
  352. #ifndef JUCE_DEBUG
  353. #define forcedinline __forceinline
  354. #else
  355. #define forcedinline inline
  356. #endif
  357. #else
  358. #ifndef JUCE_DEBUG
  359. #define forcedinline inline __attribute__((always_inline))
  360. #else
  361. #define forcedinline inline
  362. #endif
  363. #endif
  364. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  365. /*** End of inlined file: juce_PlatformDefs.h ***/
  366. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  367. #if JUCE_MSVC
  368. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  369. #pragma warning (disable: 4284) // (spurious VC6 warning)
  370. #endif
  371. #pragma warning (push)
  372. #pragma warning (disable: 4514 4245 4100)
  373. #endif
  374. #include <cstdlib>
  375. #include <cstdarg>
  376. #include <climits>
  377. #include <limits>
  378. #include <cmath>
  379. #include <cwchar>
  380. #include <stdexcept>
  381. #include <typeinfo>
  382. #include <cstring>
  383. #include <cstdio>
  384. #include <iostream>
  385. #if JUCE_USE_INTRINSICS
  386. #include <intrin.h>
  387. #endif
  388. #if JUCE_MAC || JUCE_IPHONE
  389. #include <libkern/OSAtomic.h>
  390. #endif
  391. #if JUCE_LINUX
  392. #include <signal.h>
  393. #endif
  394. #if JUCE_MSVC && JUCE_DEBUG
  395. #include <crtdbg.h>
  396. #endif
  397. #if JUCE_MSVC
  398. #include <malloc.h>
  399. #pragma warning (pop)
  400. #if ! JUCE_PUBLIC_INCLUDES
  401. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  402. #endif
  403. #endif
  404. // DLL building settings on Win32
  405. #if JUCE_MSVC
  406. #ifdef JUCE_DLL_BUILD
  407. #define JUCE_API __declspec (dllexport)
  408. #pragma warning (disable: 4251)
  409. #elif defined (JUCE_DLL)
  410. #define JUCE_API __declspec (dllimport)
  411. #pragma warning (disable: 4251)
  412. #endif
  413. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  414. #ifdef JUCE_DLL_BUILD
  415. #define JUCE_API __attribute__ ((visibility("default")))
  416. #endif
  417. #endif
  418. #ifndef JUCE_API
  419. #define JUCE_API
  420. #endif
  421. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  422. // Now include some basics that are needed by most of the Juce classes...
  423. BEGIN_JUCE_NAMESPACE
  424. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  425. #if JUCE_LOG_ASSERTIONS
  426. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  427. #endif
  428. /*** Start of inlined file: juce_Memory.h ***/
  429. #ifndef __JUCE_MEMORY_JUCEHEADER__
  430. #define __JUCE_MEMORY_JUCEHEADER__
  431. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  432. #ifndef JUCE_DLL
  433. // Win32 debug non-DLL versions..
  434. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  435. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  436. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  437. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  438. #else
  439. // Win32 debug DLL versions..
  440. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  441. // way all juce calls in the DLL and in the host API will all use the same allocator.
  442. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  443. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  444. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  445. extern JUCE_API void juce_DebugFree (void* const block);
  446. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  447. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  448. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  449. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  450. #endif
  451. #if ! defined (_AFXDLL)
  452. #define juce_UseDebuggingNewOperator \
  453. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  454. static void* operator new (size_t, void* p) { return p; } \
  455. static void operator delete (void* p) { juce_free (p); } \
  456. static void operator delete (void*, void*) { }
  457. #endif
  458. #elif defined (JUCE_DLL)
  459. // Win32 DLL (release) versions..
  460. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  461. // way all juce calls in the DLL and in the host API will all use the same allocator.
  462. extern JUCE_API void* juce_Malloc (const int size);
  463. extern JUCE_API void* juce_Calloc (const int size);
  464. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  465. extern JUCE_API void juce_Free (void* const block);
  466. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  467. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  468. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  469. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  470. #define juce_UseDebuggingNewOperator \
  471. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  472. static void* operator new (size_t, void* p) { return p; } \
  473. static void operator delete (void* p) { juce_free (p); } \
  474. static void operator delete (void*, void*) { }
  475. #else
  476. // Mac, Linux and Win32 (release) versions..
  477. #define juce_malloc(numBytes) malloc (numBytes)
  478. #define juce_calloc(numBytes) calloc (1, numBytes)
  479. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  480. #define juce_free(location) free (location)
  481. #endif
  482. #ifndef juce_UseDebuggingNewOperator
  483. #define juce_UseDebuggingNewOperator
  484. #endif
  485. #if JUCE_MSVC
  486. #define juce_ThreadLocal __declspec(thread)
  487. #else
  488. #define juce_ThreadLocal __thread
  489. #endif
  490. #if JUCE_MINGW
  491. #define alloca __builtin_alloca
  492. #endif
  493. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  494. template <typename Type>
  495. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  496. template <typename Type>
  497. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  498. #endif // __JUCE_MEMORY_JUCEHEADER__
  499. /*** End of inlined file: juce_Memory.h ***/
  500. /*** Start of inlined file: juce_MathsFunctions.h ***/
  501. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  502. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  503. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  504. typedef signed char int8;
  505. typedef unsigned char uint8;
  506. typedef signed short int16;
  507. typedef unsigned short uint16;
  508. typedef signed int int32;
  509. typedef unsigned int uint32;
  510. #if JUCE_MSVC
  511. typedef __int64 int64;
  512. typedef unsigned __int64 uint64;
  513. #define literal64bit(longLiteral) ((__int64) longLiteral)
  514. #else
  515. typedef long long int64;
  516. typedef unsigned long long uint64;
  517. #define literal64bit(longLiteral) (longLiteral##LL)
  518. #endif
  519. #if JUCE_64BIT
  520. typedef int64 pointer_sized_int;
  521. typedef uint64 pointer_sized_uint;
  522. #elif _MSC_VER >= 1300
  523. typedef _W64 int pointer_sized_int;
  524. typedef _W64 unsigned int pointer_sized_uint;
  525. #else
  526. typedef int pointer_sized_int;
  527. typedef unsigned int pointer_sized_uint;
  528. #endif
  529. typedef wchar_t juce_wchar;
  530. // Some indispensible min/max functions
  531. template <typename Type>
  532. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  533. template <typename Type>
  534. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  535. template <typename Type>
  536. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  537. template <typename Type>
  538. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  539. template <typename Type>
  540. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  541. template <typename Type>
  542. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  543. template <typename Type>
  544. inline Type jlimit (const Type lowerLimit,
  545. const Type upperLimit,
  546. const Type valueToConstrain) throw()
  547. {
  548. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  549. return (valueToConstrain < lowerLimit) ? lowerLimit
  550. : ((valueToConstrain > upperLimit) ? upperLimit
  551. : valueToConstrain);
  552. }
  553. template <typename Type>
  554. inline void swapVariables (Type& variable1, Type& variable2)
  555. {
  556. const Type tempVal = variable1;
  557. variable1 = variable2;
  558. variable2 = tempVal;
  559. }
  560. template <typename Type>
  561. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  562. // Some useful maths functions that aren't always present with all compilers and build settings.
  563. inline double juce_hypot (double a, double b)
  564. {
  565. #if JUCE_WINDOWS
  566. return _hypot (a, b);
  567. #else
  568. return hypot (a, b);
  569. #endif
  570. }
  571. inline float juce_hypotf (float a, float b)
  572. {
  573. #if JUCE_WINDOWS
  574. return (float) _hypot (a, b);
  575. #else
  576. return hypotf (a, b);
  577. #endif
  578. }
  579. inline int64 abs64 (const int64 n)
  580. {
  581. return (n >= 0) ? n : -n;
  582. }
  583. const double double_Pi = 3.1415926535897932384626433832795;
  584. const float float_Pi = 3.14159265358979323846f;
  585. template <typename FloatingPointType>
  586. inline bool juce_isfinite (FloatingPointType value)
  587. {
  588. #if JUCE_WINDOWS
  589. return _finite (value);
  590. #else
  591. return std::isfinite (value);
  592. #endif
  593. }
  594. template <typename FloatType>
  595. inline int roundToInt (const FloatType value) throw()
  596. {
  597. union { int asInt[2]; double asDouble; } n;
  598. n.asDouble = ((double) value) + 6755399441055744.0;
  599. #if JUCE_BIG_ENDIAN
  600. return n.asInt [1];
  601. #else
  602. return n.asInt [0];
  603. #endif
  604. }
  605. inline int roundToIntAccurate (const double value) throw()
  606. {
  607. return roundToInt (value + 1.5e-8);
  608. }
  609. inline int roundDoubleToInt (const double value) throw()
  610. {
  611. return roundToInt (value);
  612. }
  613. inline int roundFloatToInt (const float value) throw()
  614. {
  615. return roundToInt (value);
  616. }
  617. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  618. /*** End of inlined file: juce_MathsFunctions.h ***/
  619. /*** Start of inlined file: juce_ByteOrder.h ***/
  620. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  621. #define __JUCE_BYTEORDER_JUCEHEADER__
  622. class JUCE_API ByteOrder
  623. {
  624. public:
  625. static uint16 swap (uint16 value);
  626. static uint32 swap (uint32 value);
  627. static uint64 swap (uint64 value);
  628. static uint16 swapIfBigEndian (const uint16 value);
  629. static uint32 swapIfBigEndian (const uint32 value);
  630. static uint64 swapIfBigEndian (const uint64 value);
  631. static uint16 swapIfLittleEndian (const uint16 value);
  632. static uint32 swapIfLittleEndian (const uint32 value);
  633. static uint64 swapIfLittleEndian (const uint64 value);
  634. static uint32 littleEndianInt (const char* const bytes);
  635. static uint16 littleEndianShort (const char* const bytes);
  636. static uint32 bigEndianInt (const char* const bytes);
  637. static uint16 bigEndianShort (const char* const bytes);
  638. static int littleEndian24Bit (const char* const bytes);
  639. static int bigEndian24Bit (const char* const bytes);
  640. static void littleEndian24BitToChars (const int value, char* const destBytes);
  641. static void bigEndian24BitToChars (const int value, char* const destBytes);
  642. static bool isBigEndian();
  643. };
  644. #if JUCE_USE_INTRINSICS
  645. #pragma intrinsic (_byteswap_ulong)
  646. #endif
  647. inline uint16 ByteOrder::swap (uint16 n)
  648. {
  649. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  650. return (uint16) _byteswap_ushort (n);
  651. #else
  652. return (uint16) ((n << 8) | (n >> 8));
  653. #endif
  654. }
  655. inline uint32 ByteOrder::swap (uint32 n)
  656. {
  657. #if JUCE_MAC || JUCE_IPHONE
  658. return OSSwapInt32 (n);
  659. #elif JUCE_GCC
  660. asm("bswap %%eax" : "=a"(n) : "a"(n));
  661. return n;
  662. #elif JUCE_USE_INTRINSICS
  663. return _byteswap_ulong (n);
  664. #else
  665. __asm {
  666. mov eax, n
  667. bswap eax
  668. mov n, eax
  669. }
  670. return n;
  671. #endif
  672. }
  673. inline uint64 ByteOrder::swap (uint64 value)
  674. {
  675. #if JUCE_MAC || JUCE_IPHONE
  676. return OSSwapInt64 (value);
  677. #elif JUCE_USE_INTRINSICS
  678. return _byteswap_uint64 (value);
  679. #else
  680. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  681. #endif
  682. }
  683. #if JUCE_LITTLE_ENDIAN
  684. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  685. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  686. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  687. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  688. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  689. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  690. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  691. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  692. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  693. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  694. inline bool ByteOrder::isBigEndian() { return false; }
  695. #else
  696. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  697. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  698. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  699. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  700. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  701. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  702. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  703. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  704. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  705. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  706. inline bool ByteOrder::isBigEndian() { return true; }
  707. #endif
  708. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  709. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  710. inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
  711. inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
  712. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  713. /*** End of inlined file: juce_ByteOrder.h ***/
  714. /*** Start of inlined file: juce_Logger.h ***/
  715. #ifndef __JUCE_LOGGER_JUCEHEADER__
  716. #define __JUCE_LOGGER_JUCEHEADER__
  717. /*** Start of inlined file: juce_String.h ***/
  718. #ifndef __JUCE_STRING_JUCEHEADER__
  719. #define __JUCE_STRING_JUCEHEADER__
  720. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  721. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  722. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  723. #define JUCE_T(stringLiteral) (L##stringLiteral)
  724. typedef juce_wchar tchar;
  725. #if ! JUCE_DONT_DEFINE_MACROS
  726. #define T(stringLiteral) JUCE_T(stringLiteral)
  727. #endif
  728. class JUCE_API CharacterFunctions
  729. {
  730. public:
  731. static int length (const char* const s) throw();
  732. static int length (const juce_wchar* const s) throw();
  733. static void copy (char* dest, const char* src, const int maxBytes) throw();
  734. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  735. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  736. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  737. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  738. static void append (char* dest, const char* src) throw();
  739. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  740. static int compare (const char* const s1, const char* const s2) throw();
  741. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  742. static int compare (const juce_wchar* s1, const char* s2) throw();
  743. static int compare (const char* s1, const juce_wchar* s2) throw();
  744. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  745. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  746. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  747. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  748. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  749. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  750. static const char* find (const char* const haystack, const char* const needle) throw();
  751. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  752. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  753. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  754. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  755. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  756. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  757. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  758. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  759. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  760. static int getIntValue (const char* const s) throw();
  761. static int getIntValue (const juce_wchar* s) throw();
  762. static int64 getInt64Value (const char* s) throw();
  763. static int64 getInt64Value (const juce_wchar* s) throw();
  764. static double getDoubleValue (const char* const s) throw();
  765. static double getDoubleValue (const juce_wchar* const s) throw();
  766. static char toUpperCase (const char character) throw();
  767. static juce_wchar toUpperCase (const juce_wchar character) throw();
  768. static void toUpperCase (char* s) throw();
  769. static void toUpperCase (juce_wchar* s) throw();
  770. static bool isUpperCase (const char character) throw();
  771. static bool isUpperCase (const juce_wchar character) throw();
  772. static char toLowerCase (const char character) throw();
  773. static juce_wchar toLowerCase (const juce_wchar character) throw();
  774. static void toLowerCase (char* s) throw();
  775. static void toLowerCase (juce_wchar* s) throw();
  776. static bool isLowerCase (const char character) throw();
  777. static bool isLowerCase (const juce_wchar character) throw();
  778. static bool isWhitespace (const char character) throw();
  779. static bool isWhitespace (const juce_wchar character) throw();
  780. static bool isDigit (const char character) throw();
  781. static bool isDigit (const juce_wchar character) throw();
  782. static bool isLetter (const char character) throw();
  783. static bool isLetter (const juce_wchar character) throw();
  784. static bool isLetterOrDigit (const char character) throw();
  785. static bool isLetterOrDigit (const juce_wchar character) throw();
  786. static int getHexDigitValue (const juce_wchar digit) throw();
  787. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  788. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  789. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  790. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  791. };
  792. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  793. /*** End of inlined file: juce_CharacterFunctions.h ***/
  794. class OutputStream;
  795. class JUCE_API String
  796. {
  797. public:
  798. String() throw();
  799. String (const String& other) throw();
  800. String (const char* const text) throw();
  801. String (const char* const text,
  802. const size_t maxChars) throw();
  803. String (const juce_wchar* const unicodeText) throw();
  804. String (const juce_wchar* const unicodeText,
  805. const size_t maxChars) throw();
  806. static const String charToString (const juce_wchar character) throw();
  807. ~String() throw();
  808. static const String empty;
  809. int hashCode() const throw();
  810. int64 hashCode64() const throw();
  811. int length() const throw();
  812. // Assignment and concatenation operators..
  813. String& operator= (const String& other) throw();
  814. String& operator+= (const tchar* const textToAppend);
  815. String& operator+= (const String& stringToAppend);
  816. String& operator+= (const char characterToAppend);
  817. String& operator+= (const juce_wchar characterToAppend);
  818. String& operator+= (const int numberToAppend);
  819. String& operator+= (const unsigned int numberToAppend);
  820. void append (const tchar* const textToAppend,
  821. const int maxCharsToTake);
  822. // Comparison methods..
  823. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  824. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  825. bool equalsIgnoreCase (const String& other) const throw();
  826. bool equalsIgnoreCase (const tchar* const other) const throw();
  827. int compare (const String& other) const throw();
  828. int compare (const char* other) const throw();
  829. int compare (const juce_wchar* other) const throw();
  830. int compareIgnoreCase (const String& other) const throw();
  831. int compareLexicographically (const String& other) const throw();
  832. bool startsWith (const tchar* const text) const throw();
  833. bool startsWithChar (const tchar character) const throw();
  834. bool startsWithIgnoreCase (const tchar* const text) const throw();
  835. bool endsWith (const tchar* const text) const throw();
  836. bool endsWithChar (const tchar character) const throw();
  837. bool endsWithIgnoreCase (const tchar* const text) const throw();
  838. bool contains (const tchar* const text) const throw();
  839. bool containsChar (const tchar character) const throw();
  840. bool containsIgnoreCase (const tchar* const text) const throw();
  841. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  842. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  843. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  844. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  845. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  846. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  847. bool containsNonWhitespaceChars() const throw();
  848. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  849. // Substring location methods..
  850. int indexOfChar (const tchar characterToLookFor) const throw();
  851. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  852. int indexOfAnyOf (const tchar* const charactersToLookFor,
  853. const int startIndex = 0,
  854. const bool ignoreCase = false) const throw();
  855. int indexOf (const tchar* const text) const throw();
  856. int indexOf (const int startIndex,
  857. const tchar* const textToLookFor) const throw();
  858. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  859. int indexOfIgnoreCase (const int startIndex,
  860. const tchar* const textToLookFor) const throw();
  861. int lastIndexOfChar (const tchar character) const throw();
  862. int lastIndexOf (const tchar* const textToLookFor) const throw();
  863. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  864. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  865. const bool ignoreCase = false) const throw();
  866. // Substring extraction and manipulation methods..
  867. /** Returns the character at this index in the string.
  868. No checks are made to see if the index is within a valid range, so be careful!
  869. */
  870. inline const juce_wchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  871. juce_wchar& operator[] (const int index) throw();
  872. juce_wchar getLastCharacter() const throw();
  873. const String substring (int startIndex,
  874. int endIndex) const throw();
  875. const String substring (const int startIndex) const throw();
  876. const String dropLastCharacters (const int numberToDrop) const throw();
  877. const String getLastCharacters (const int numCharacters) const throw();
  878. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  879. const bool includeSubStringInResult,
  880. const bool ignoreCase) const throw();
  881. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  882. const bool includeSubStringInResult,
  883. const bool ignoreCase) const throw();
  884. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  885. const bool includeSubStringInResult,
  886. const bool ignoreCase) const throw();
  887. const String upToLastOccurrenceOf (const tchar* substringToFind,
  888. const bool includeSubStringInResult,
  889. const bool ignoreCase) const throw();
  890. const String trim() const throw();
  891. const String trimStart() const throw();
  892. const String trimEnd() const throw();
  893. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  894. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  895. const String toUpperCase() const throw();
  896. const String toLowerCase() const throw();
  897. const String replaceSection (int startIndex,
  898. int numCharactersToReplace,
  899. const tchar* const stringToInsert) const throw();
  900. const String replace (const tchar* const stringToReplace,
  901. const tchar* const stringToInsertInstead,
  902. const bool ignoreCase = false) const throw();
  903. const String replaceCharacter (const tchar characterToReplace,
  904. const tchar characterToInsertInstead) const throw();
  905. const String replaceCharacters (const String& charactersToReplace,
  906. const tchar* const charactersToInsertInstead) const throw();
  907. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  908. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  909. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  910. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  911. bool isQuotedString() const throw();
  912. const String unquoted() const throw();
  913. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  914. void printf (const tchar* const format, ...) throw();
  915. static const String formatted (const tchar* const format, ...) throw();
  916. void vprintf (const tchar* const format, va_list& args) throw();
  917. static const String repeatedString (const tchar* const stringToRepeat,
  918. int numberOfTimesToRepeat);
  919. const String paddedLeft (const juce_wchar padCharacter, int minimumLength) const;
  920. const String paddedRight (const juce_wchar padCharacter, int minimumLength) const;
  921. static const String createStringFromData (const void* const data,
  922. const int size) throw();
  923. // Numeric conversions..
  924. explicit String (const int decimalInteger) throw();
  925. explicit String (const unsigned int decimalInteger) throw();
  926. explicit String (const short decimalInteger) throw();
  927. explicit String (const unsigned short decimalInteger) throw();
  928. explicit String (const int64 largeIntegerValue) throw();
  929. explicit String (const uint64 largeIntegerValue) throw();
  930. explicit String (const float floatValue,
  931. const int numberOfDecimalPlaces = 0) throw();
  932. explicit String (const double doubleValue,
  933. const int numberOfDecimalPlaces = 0) throw();
  934. int getIntValue() const throw();
  935. int64 getLargeIntValue() const throw();
  936. int getTrailingIntValue() const throw();
  937. float getFloatValue() const throw();
  938. double getDoubleValue() const throw();
  939. int getHexValue32() const throw();
  940. int64 getHexValue64() const throw();
  941. static const String toHexString (const int number) throw();
  942. static const String toHexString (const int64 number) throw();
  943. static const String toHexString (const short number) throw();
  944. static const String toHexString (const unsigned char* data,
  945. const int size,
  946. const int groupSize = 1) throw();
  947. inline operator const juce_wchar*() const throw() { return text->text; }
  948. inline operator juce_wchar*() throw() { return text->text; }
  949. const char* toUTF8() const;
  950. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  951. int getNumBytesAsUTF8() const throw();
  952. int copyToUTF8 (char* destBuffer, const int maxBufferSizeBytes) const throw();
  953. const char* toCString() const;
  954. int getNumBytesAsCString() const throw();
  955. int copyToCString (char* destBuffer, const int maxBufferSizeBytes) const throw();
  956. void copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw();
  957. void preallocateStorage (const size_t numCharsNeeded) throw();
  958. class JUCE_API Concatenator
  959. {
  960. public:
  961. Concatenator (String& stringToAppendTo);
  962. ~Concatenator();
  963. void append (const String& s);
  964. private:
  965. String& result;
  966. int nextIndex;
  967. Concatenator (const Concatenator&);
  968. Concatenator& operator= (const Concatenator&);
  969. };
  970. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  971. private:
  972. struct InternalRefCountedStringHolder
  973. {
  974. int refCount;
  975. int allocatedNumChars;
  976. wchar_t text[1];
  977. };
  978. InternalRefCountedStringHolder* text;
  979. static InternalRefCountedStringHolder emptyString;
  980. // internal constructor that preallocates a certain amount of memory
  981. String (const int numChars, const int dummyVariable) throw();
  982. void createInternal (const int numChars) throw();
  983. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  984. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  985. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  986. void dupeInternalIfMultiplyReferenced() throw();
  987. };
  988. const String operator+ (const char* string1, const String& string2);
  989. const String operator+ (const juce_wchar* string1, const String& string2);
  990. const String operator+ (char string1, const String& string2);
  991. const String operator+ (juce_wchar string1, const String& string2);
  992. const String operator+ (String string1, const String& string2);
  993. const String operator+ (String string1, const char* string2);
  994. const String operator+ (String string1, const juce_wchar* string2);
  995. const String operator+ (String string1, char characterToAppend);
  996. const String operator+ (String string1, juce_wchar characterToAppend);
  997. String& operator<< (String& string1, const char characterToAppend);
  998. String& operator<< (String& string1, const juce_wchar characterToAppend);
  999. String& operator<< (String& string1, const char* const string2);
  1000. String& operator<< (String& string1, const juce_wchar* const string2);
  1001. String& operator<< (String& string1, const String& string2);
  1002. String& operator<< (String& string1, const short number);
  1003. String& operator<< (String& string1, const int number);
  1004. String& operator<< (String& string1, const unsigned int number);
  1005. String& operator<< (String& string1, const long number);
  1006. String& operator<< (String& string1, const unsigned long number);
  1007. String& operator<< (String& string1, const float number);
  1008. String& operator<< (String& string1, const double number);
  1009. bool operator== (const String& string1, const String& string2) throw();
  1010. bool operator== (const String& string1, const char* string2) throw();
  1011. bool operator== (const String& string1, const juce_wchar* string2) throw();
  1012. bool operator!= (const String& string1, const String& string2) throw();
  1013. bool operator!= (const String& string1, const char* string2) throw();
  1014. bool operator!= (const String& string1, const juce_wchar* string2) throw();
  1015. bool operator> (const String& string1, const String& string2) throw();
  1016. bool operator< (const String& string1, const String& string2) throw();
  1017. bool operator>= (const String& string1, const String& string2) throw();
  1018. bool operator<= (const String& string1, const String& string2) throw();
  1019. template <class charT, class traits>
  1020. std::basic_ostream <charT, traits>& operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1021. {
  1022. return stream << stringToWrite.toUTF8();
  1023. }
  1024. OutputStream& operator<< (OutputStream& stream, const String& text);
  1025. #endif // __JUCE_STRING_JUCEHEADER__
  1026. /*** End of inlined file: juce_String.h ***/
  1027. class JUCE_API Logger
  1028. {
  1029. public:
  1030. virtual ~Logger();
  1031. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1032. const bool deleteOldLogger = false);
  1033. static void JUCE_CALLTYPE writeToLog (const String& message);
  1034. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1035. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1036. protected:
  1037. Logger();
  1038. virtual void logMessage (const String& message) = 0;
  1039. };
  1040. #endif // __JUCE_LOGGER_JUCEHEADER__
  1041. /*** End of inlined file: juce_Logger.h ***/
  1042. END_JUCE_NAMESPACE
  1043. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1044. /*** End of inlined file: juce_StandardHeader.h ***/
  1045. BEGIN_JUCE_NAMESPACE
  1046. #if JUCE_MSVC
  1047. // this is set explicitly in case the app is using a different packing size.
  1048. #pragma pack (push, 8)
  1049. #pragma warning (push)
  1050. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1051. #endif
  1052. // this is where all the class header files get brought in..
  1053. /*** Start of inlined file: juce_core_includes.h ***/
  1054. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1055. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1056. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1057. /*** Start of inlined file: juce_Array.h ***/
  1058. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1059. #define __JUCE_ARRAY_JUCEHEADER__
  1060. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1061. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1062. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1063. /*** Start of inlined file: juce_HeapBlock.h ***/
  1064. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1065. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1066. template <class ElementType>
  1067. class HeapBlock
  1068. {
  1069. public:
  1070. HeapBlock() throw() : data (0)
  1071. {
  1072. }
  1073. HeapBlock (const size_t numElements)
  1074. : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1075. {
  1076. }
  1077. ~HeapBlock()
  1078. {
  1079. ::juce_free (data);
  1080. }
  1081. inline operator ElementType*() const throw() { return data; }
  1082. inline ElementType* getData() const throw() { return data; }
  1083. inline operator void*() const throw() { return static_cast <void*> (data); }
  1084. inline ElementType* operator->() const throw() { return data; }
  1085. template <typename IndexType>
  1086. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1087. template <typename IndexType>
  1088. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1089. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1090. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1091. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1092. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1093. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1094. {
  1095. ::juce_free (data);
  1096. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1097. }
  1098. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1099. {
  1100. ::juce_free (data);
  1101. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1102. }
  1103. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1104. {
  1105. ::juce_free (data);
  1106. if (initialiseToZero)
  1107. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1108. else
  1109. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1110. }
  1111. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1112. {
  1113. if (data == 0)
  1114. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1115. else
  1116. data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1117. }
  1118. void free()
  1119. {
  1120. ::juce_free (data);
  1121. data = 0;
  1122. }
  1123. void swapWith (HeapBlock <ElementType>& other) throw()
  1124. {
  1125. swapVariables (data, other.data);
  1126. }
  1127. private:
  1128. ElementType* data;
  1129. HeapBlock (const HeapBlock&);
  1130. HeapBlock& operator= (const HeapBlock&);
  1131. };
  1132. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1133. /*** End of inlined file: juce_HeapBlock.h ***/
  1134. template <class ElementType, class TypeOfCriticalSectionToUse>
  1135. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1136. {
  1137. public:
  1138. ArrayAllocationBase() throw()
  1139. : numAllocated (0)
  1140. {
  1141. }
  1142. ~ArrayAllocationBase()
  1143. {
  1144. }
  1145. void setAllocatedSize (const int numElements)
  1146. {
  1147. if (numAllocated != numElements)
  1148. {
  1149. if (numElements > 0)
  1150. elements.realloc (numElements);
  1151. else
  1152. elements.free();
  1153. numAllocated = numElements;
  1154. }
  1155. }
  1156. void ensureAllocatedSize (const int minNumElements)
  1157. {
  1158. if (minNumElements > numAllocated)
  1159. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1160. }
  1161. void shrinkToNoMoreThan (const int maxNumElements)
  1162. {
  1163. if (maxNumElements < numAllocated)
  1164. setAllocatedSize (maxNumElements);
  1165. }
  1166. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1167. {
  1168. elements.swapWith (other.elements);
  1169. swapVariables (numAllocated, other.numAllocated);
  1170. }
  1171. HeapBlock <ElementType> elements;
  1172. int numAllocated;
  1173. private:
  1174. ArrayAllocationBase (const ArrayAllocationBase&);
  1175. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1176. };
  1177. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1178. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1179. /*** Start of inlined file: juce_ElementComparator.h ***/
  1180. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1181. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1182. template <class ElementType, class ElementComparator>
  1183. static void sortArray (ElementComparator& comparator,
  1184. ElementType* const array,
  1185. int firstElement,
  1186. int lastElement,
  1187. const bool retainOrderOfEquivalentItems)
  1188. {
  1189. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1190. // avoids getting warning messages about the parameter being unused
  1191. if (lastElement > firstElement)
  1192. {
  1193. if (retainOrderOfEquivalentItems)
  1194. {
  1195. for (int i = firstElement; i < lastElement; ++i)
  1196. {
  1197. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1198. {
  1199. const ElementType temp = array [i];
  1200. array [i] = array[i + 1];
  1201. array [i + 1] = temp;
  1202. if (i > firstElement)
  1203. i -= 2;
  1204. }
  1205. }
  1206. }
  1207. else
  1208. {
  1209. int fromStack[30], toStack[30];
  1210. int stackIndex = 0;
  1211. for (;;)
  1212. {
  1213. const int size = (lastElement - firstElement) + 1;
  1214. if (size <= 8)
  1215. {
  1216. int j = lastElement;
  1217. int maxIndex;
  1218. while (j > firstElement)
  1219. {
  1220. maxIndex = firstElement;
  1221. for (int k = firstElement + 1; k <= j; ++k)
  1222. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1223. maxIndex = k;
  1224. const ElementType temp = array [maxIndex];
  1225. array [maxIndex] = array[j];
  1226. array [j] = temp;
  1227. --j;
  1228. }
  1229. }
  1230. else
  1231. {
  1232. const int mid = firstElement + (size >> 1);
  1233. ElementType temp = array [mid];
  1234. array [mid] = array [firstElement];
  1235. array [firstElement] = temp;
  1236. int i = firstElement;
  1237. int j = lastElement + 1;
  1238. for (;;)
  1239. {
  1240. while (++i <= lastElement
  1241. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1242. {}
  1243. while (--j > firstElement
  1244. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1245. {}
  1246. if (j < i)
  1247. break;
  1248. temp = array[i];
  1249. array[i] = array[j];
  1250. array[j] = temp;
  1251. }
  1252. temp = array [firstElement];
  1253. array [firstElement] = array[j];
  1254. array [j] = temp;
  1255. if (j - 1 - firstElement >= lastElement - i)
  1256. {
  1257. if (firstElement + 1 < j)
  1258. {
  1259. fromStack [stackIndex] = firstElement;
  1260. toStack [stackIndex] = j - 1;
  1261. ++stackIndex;
  1262. }
  1263. if (i < lastElement)
  1264. {
  1265. firstElement = i;
  1266. continue;
  1267. }
  1268. }
  1269. else
  1270. {
  1271. if (i < lastElement)
  1272. {
  1273. fromStack [stackIndex] = i;
  1274. toStack [stackIndex] = lastElement;
  1275. ++stackIndex;
  1276. }
  1277. if (firstElement + 1 < j)
  1278. {
  1279. lastElement = j - 1;
  1280. continue;
  1281. }
  1282. }
  1283. }
  1284. if (--stackIndex < 0)
  1285. break;
  1286. jassert (stackIndex < numElementsInArray (fromStack));
  1287. firstElement = fromStack [stackIndex];
  1288. lastElement = toStack [stackIndex];
  1289. }
  1290. }
  1291. }
  1292. }
  1293. template <class ElementType, class ElementComparator>
  1294. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1295. ElementType* const array,
  1296. const ElementType newElement,
  1297. int firstElement,
  1298. int lastElement)
  1299. {
  1300. jassert (firstElement <= lastElement);
  1301. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1302. // avoids getting warning messages about the parameter being unused
  1303. while (firstElement < lastElement)
  1304. {
  1305. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1306. {
  1307. ++firstElement;
  1308. break;
  1309. }
  1310. else
  1311. {
  1312. const int halfway = (firstElement + lastElement) >> 1;
  1313. if (halfway == firstElement)
  1314. {
  1315. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1316. ++firstElement;
  1317. break;
  1318. }
  1319. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1320. {
  1321. firstElement = halfway;
  1322. }
  1323. else
  1324. {
  1325. lastElement = halfway;
  1326. }
  1327. }
  1328. }
  1329. return firstElement;
  1330. }
  1331. template <class ElementType>
  1332. class IntegerElementComparator
  1333. {
  1334. public:
  1335. static int compareElements (const ElementType first,
  1336. const ElementType second) throw()
  1337. {
  1338. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1339. }
  1340. };
  1341. template <class ElementType>
  1342. class FloatElementComparator
  1343. {
  1344. public:
  1345. static int compareElements (const ElementType first,
  1346. const ElementType second) throw()
  1347. {
  1348. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1349. }
  1350. };
  1351. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1352. /*** End of inlined file: juce_ElementComparator.h ***/
  1353. /*** Start of inlined file: juce_CriticalSection.h ***/
  1354. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1355. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1356. class JUCE_API ScopedLock;
  1357. class JUCE_API ScopedUnlock;
  1358. class JUCE_API CriticalSection
  1359. {
  1360. public:
  1361. CriticalSection() throw();
  1362. ~CriticalSection() throw();
  1363. void enter() const throw();
  1364. bool tryEnter() const throw();
  1365. void exit() const throw();
  1366. typedef ScopedLock ScopedLockType;
  1367. typedef ScopedUnlock ScopedUnlockType;
  1368. juce_UseDebuggingNewOperator
  1369. private:
  1370. #if JUCE_WIN32
  1371. #if JUCE_64BIT
  1372. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1373. // block of memory here that's big enough to be used internally as a windows critical
  1374. // section object.
  1375. uint8 internal [44];
  1376. #else
  1377. uint8 internal [24];
  1378. #endif
  1379. #else
  1380. mutable pthread_mutex_t internal;
  1381. #endif
  1382. CriticalSection (const CriticalSection&);
  1383. CriticalSection& operator= (const CriticalSection&);
  1384. };
  1385. class JUCE_API DummyCriticalSection
  1386. {
  1387. public:
  1388. inline DummyCriticalSection() throw() {}
  1389. inline ~DummyCriticalSection() throw() {}
  1390. inline void enter() const throw() {}
  1391. inline void exit() const throw() {}
  1392. struct ScopedLockType
  1393. {
  1394. ScopedLockType (const DummyCriticalSection&) throw() {}
  1395. };
  1396. typedef ScopedLockType ScopedUnlockType;
  1397. };
  1398. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1399. /*** End of inlined file: juce_CriticalSection.h ***/
  1400. template <typename ElementType,
  1401. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1402. class Array
  1403. {
  1404. public:
  1405. Array() throw()
  1406. : numUsed (0)
  1407. {
  1408. }
  1409. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1410. {
  1411. const ScopedLockType lock (other.getLock());
  1412. numUsed = other.numUsed;
  1413. data.setAllocatedSize (other.numUsed);
  1414. for (int i = 0; i < numUsed; ++i)
  1415. new (data.elements + i) ElementType (other.data.elements[i]);
  1416. }
  1417. explicit Array (const ElementType* values)
  1418. : numUsed (0)
  1419. {
  1420. while (*values != 0)
  1421. add (*values++);
  1422. }
  1423. Array (const ElementType* values, int numValues)
  1424. : numUsed (numValues)
  1425. {
  1426. data.setAllocatedSize (numValues);
  1427. for (int i = 0; i < numValues; ++i)
  1428. new (data.elements + i) ElementType (values[i]);
  1429. }
  1430. ~Array()
  1431. {
  1432. for (int i = 0; i < numUsed; ++i)
  1433. data.elements[i].~ElementType();
  1434. }
  1435. Array& operator= (const Array& other)
  1436. {
  1437. if (this != &other)
  1438. {
  1439. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1440. swapWithArray (otherCopy);
  1441. }
  1442. return *this;
  1443. }
  1444. template <class OtherArrayType>
  1445. bool operator== (const OtherArrayType& other) const
  1446. {
  1447. const ScopedLockType lock (getLock());
  1448. if (numUsed != other.numUsed)
  1449. return false;
  1450. for (int i = numUsed; --i >= 0;)
  1451. if (data.elements [i] != other.data.elements [i])
  1452. return false;
  1453. return true;
  1454. }
  1455. template <class OtherArrayType>
  1456. bool operator!= (const OtherArrayType& other) const
  1457. {
  1458. return ! operator== (other);
  1459. }
  1460. void clear()
  1461. {
  1462. const ScopedLockType lock (getLock());
  1463. for (int i = 0; i < numUsed; ++i)
  1464. data.elements[i].~ElementType();
  1465. data.setAllocatedSize (0);
  1466. numUsed = 0;
  1467. }
  1468. void clearQuick()
  1469. {
  1470. const ScopedLockType lock (getLock());
  1471. for (int i = 0; i < numUsed; ++i)
  1472. data.elements[i].~ElementType();
  1473. numUsed = 0;
  1474. }
  1475. inline int size() const throw()
  1476. {
  1477. return numUsed;
  1478. }
  1479. inline ElementType operator[] (const int index) const
  1480. {
  1481. const ScopedLockType lock (getLock());
  1482. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1483. : ElementType();
  1484. }
  1485. inline const ElementType getUnchecked (const int index) const
  1486. {
  1487. const ScopedLockType lock (getLock());
  1488. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1489. return data.elements [index];
  1490. }
  1491. inline ElementType& getReference (const int index) const throw()
  1492. {
  1493. const ScopedLockType lock (getLock());
  1494. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1495. return data.elements [index];
  1496. }
  1497. inline ElementType getFirst() const
  1498. {
  1499. const ScopedLockType lock (getLock());
  1500. return (numUsed > 0) ? data.elements [0]
  1501. : ElementType();
  1502. }
  1503. inline ElementType getLast() const
  1504. {
  1505. const ScopedLockType lock (getLock());
  1506. return (numUsed > 0) ? data.elements [numUsed - 1]
  1507. : ElementType();
  1508. }
  1509. int indexOf (const ElementType& elementToLookFor) const
  1510. {
  1511. const ScopedLockType lock (getLock());
  1512. const ElementType* e = data.elements.getData();
  1513. const ElementType* const end = e + numUsed;
  1514. while (e != end)
  1515. {
  1516. if (elementToLookFor == *e)
  1517. return (int) (e - data.elements.getData());
  1518. ++e;
  1519. }
  1520. return -1;
  1521. }
  1522. bool contains (const ElementType& elementToLookFor) const
  1523. {
  1524. const ScopedLockType lock (getLock());
  1525. const ElementType* e = data.elements.getData();
  1526. const ElementType* const end = e + numUsed;
  1527. while (e != end)
  1528. {
  1529. if (elementToLookFor == *e)
  1530. return true;
  1531. ++e;
  1532. }
  1533. return false;
  1534. }
  1535. void add (const ElementType& newElement)
  1536. {
  1537. const ScopedLockType lock (getLock());
  1538. data.ensureAllocatedSize (numUsed + 1);
  1539. new (data.elements + numUsed++) ElementType (newElement);
  1540. }
  1541. void insert (int indexToInsertAt, const ElementType& newElement)
  1542. {
  1543. const ScopedLockType lock (getLock());
  1544. data.ensureAllocatedSize (numUsed + 1);
  1545. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1546. {
  1547. ElementType* const insertPos = data.elements + indexToInsertAt;
  1548. const int numberToMove = numUsed - indexToInsertAt;
  1549. if (numberToMove > 0)
  1550. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1551. new (insertPos) ElementType (newElement);
  1552. ++numUsed;
  1553. }
  1554. else
  1555. {
  1556. new (data.elements + numUsed++) ElementType (newElement);
  1557. }
  1558. }
  1559. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1560. int numberOfTimesToInsertIt)
  1561. {
  1562. if (numberOfTimesToInsertIt > 0)
  1563. {
  1564. const ScopedLockType lock (getLock());
  1565. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1566. ElementType* insertPos;
  1567. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1568. {
  1569. insertPos = data.elements + indexToInsertAt;
  1570. const int numberToMove = numUsed - indexToInsertAt;
  1571. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1572. }
  1573. else
  1574. {
  1575. insertPos = data.elements + numUsed;
  1576. }
  1577. numUsed += numberOfTimesToInsertIt;
  1578. while (--numberOfTimesToInsertIt >= 0)
  1579. new (insertPos++) ElementType (newElement);
  1580. }
  1581. }
  1582. void insertArray (int indexToInsertAt,
  1583. const ElementType* newElements,
  1584. int numberOfElements)
  1585. {
  1586. if (numberOfElements > 0)
  1587. {
  1588. const ScopedLockType lock (getLock());
  1589. data.ensureAllocatedSize (numUsed + numberOfElements);
  1590. ElementType* insertPos;
  1591. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1592. {
  1593. insertPos = data.elements + indexToInsertAt;
  1594. const int numberToMove = numUsed - indexToInsertAt;
  1595. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1596. }
  1597. else
  1598. {
  1599. insertPos = data.elements + numUsed;
  1600. }
  1601. numUsed += numberOfElements;
  1602. while (--numberOfElements >= 0)
  1603. new (insertPos++) ElementType (*newElements++);
  1604. }
  1605. }
  1606. void addIfNotAlreadyThere (const ElementType& newElement)
  1607. {
  1608. const ScopedLockType lock (getLock());
  1609. if (! contains (newElement))
  1610. add (newElement);
  1611. }
  1612. void set (const int indexToChange, const ElementType& newValue)
  1613. {
  1614. jassert (indexToChange >= 0);
  1615. const ScopedLockType lock (getLock());
  1616. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1617. {
  1618. data.elements [indexToChange] = newValue;
  1619. }
  1620. else if (indexToChange >= 0)
  1621. {
  1622. data.ensureAllocatedSize (numUsed + 1);
  1623. new (data.elements + numUsed++) ElementType (newValue);
  1624. }
  1625. }
  1626. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1627. {
  1628. const ScopedLockType lock (getLock());
  1629. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1630. data.elements [indexToChange] = newValue;
  1631. }
  1632. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1633. {
  1634. const ScopedLockType lock (getLock());
  1635. if (numElementsToAdd > 0)
  1636. {
  1637. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1638. while (--numElementsToAdd >= 0)
  1639. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1640. }
  1641. }
  1642. void swapWithArray (Array& otherArray) throw()
  1643. {
  1644. const ScopedLockType lock1 (getLock());
  1645. const ScopedLockType lock2 (otherArray.getLock());
  1646. data.swapWith (otherArray.data);
  1647. swapVariables (numUsed, otherArray.numUsed);
  1648. }
  1649. template <class OtherArrayType>
  1650. void addArray (const OtherArrayType& arrayToAddFrom,
  1651. int startIndex = 0,
  1652. int numElementsToAdd = -1)
  1653. {
  1654. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1655. const ScopedLockType lock2 (getLock());
  1656. if (startIndex < 0)
  1657. {
  1658. jassertfalse
  1659. startIndex = 0;
  1660. }
  1661. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1662. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1663. while (--numElementsToAdd >= 0)
  1664. add (arrayToAddFrom.getUnchecked (startIndex++));
  1665. }
  1666. template <class ElementComparator>
  1667. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1668. {
  1669. const ScopedLockType lock (getLock());
  1670. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1671. }
  1672. template <class ElementComparator>
  1673. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1674. {
  1675. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1676. // avoids getting warning messages about the parameter being unused
  1677. const ScopedLockType lock (getLock());
  1678. int start = 0;
  1679. int end = numUsed;
  1680. for (;;)
  1681. {
  1682. if (start >= end)
  1683. {
  1684. return -1;
  1685. }
  1686. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1687. {
  1688. return start;
  1689. }
  1690. else
  1691. {
  1692. const int halfway = (start + end) >> 1;
  1693. if (halfway == start)
  1694. return -1;
  1695. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1696. start = halfway;
  1697. else
  1698. end = halfway;
  1699. }
  1700. }
  1701. }
  1702. ElementType remove (const int indexToRemove)
  1703. {
  1704. const ScopedLockType lock (getLock());
  1705. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1706. {
  1707. --numUsed;
  1708. ElementType* const e = data.elements + indexToRemove;
  1709. ElementType removed (*e);
  1710. e->~ElementType();
  1711. const int numberToShift = numUsed - indexToRemove;
  1712. if (numberToShift > 0)
  1713. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1714. if ((numUsed << 1) < data.numAllocated)
  1715. minimiseStorageOverheads();
  1716. return removed;
  1717. }
  1718. else
  1719. {
  1720. return ElementType();
  1721. }
  1722. }
  1723. void removeValue (const ElementType& valueToRemove)
  1724. {
  1725. const ScopedLockType lock (getLock());
  1726. ElementType* e = data.elements;
  1727. for (int i = numUsed; --i >= 0;)
  1728. {
  1729. if (valueToRemove == *e)
  1730. {
  1731. remove ((int) (e - data.elements.getData()));
  1732. break;
  1733. }
  1734. ++e;
  1735. }
  1736. }
  1737. void removeRange (int startIndex, int numberToRemove)
  1738. {
  1739. const ScopedLockType lock (getLock());
  1740. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1741. startIndex = jlimit (0, numUsed, startIndex);
  1742. if (endIndex > startIndex)
  1743. {
  1744. ElementType* e = data.elements + startIndex;
  1745. numberToRemove = endIndex - startIndex;
  1746. for (int i = 0; i < numberToRemove; ++i)
  1747. e[i].~ElementType();
  1748. const int numToShift = numUsed - endIndex;
  1749. if (numToShift > 0)
  1750. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1751. numUsed -= numberToRemove;
  1752. if ((numUsed << 1) < data.numAllocated)
  1753. minimiseStorageOverheads();
  1754. }
  1755. }
  1756. void removeLast (int howManyToRemove = 1)
  1757. {
  1758. const ScopedLockType lock (getLock());
  1759. if (howManyToRemove > numUsed)
  1760. howManyToRemove = numUsed;
  1761. for (int i = 0; i < howManyToRemove; ++i)
  1762. data.elements [numUsed - i].~ElementType();
  1763. numUsed -= howManyToRemove;
  1764. if ((numUsed << 1) < data.numAllocated)
  1765. minimiseStorageOverheads();
  1766. }
  1767. template <class OtherArrayType>
  1768. void removeValuesIn (const OtherArrayType& otherArray)
  1769. {
  1770. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1771. const ScopedLockType lock2 (getLock());
  1772. if (this == &otherArray)
  1773. {
  1774. clear();
  1775. }
  1776. else
  1777. {
  1778. if (otherArray.size() > 0)
  1779. {
  1780. for (int i = numUsed; --i >= 0;)
  1781. if (otherArray.contains (data.elements [i]))
  1782. remove (i);
  1783. }
  1784. }
  1785. }
  1786. template <class OtherArrayType>
  1787. void removeValuesNotIn (const OtherArrayType& otherArray)
  1788. {
  1789. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1790. const ScopedLockType lock2 (getLock());
  1791. if (this != &otherArray)
  1792. {
  1793. if (otherArray.size() <= 0)
  1794. {
  1795. clear();
  1796. }
  1797. else
  1798. {
  1799. for (int i = numUsed; --i >= 0;)
  1800. if (! otherArray.contains (data.elements [i]))
  1801. remove (i);
  1802. }
  1803. }
  1804. }
  1805. void swap (const int index1,
  1806. const int index2)
  1807. {
  1808. const ScopedLockType lock (getLock());
  1809. if (((unsigned int) index1) < (unsigned int) numUsed
  1810. && ((unsigned int) index2) < (unsigned int) numUsed)
  1811. {
  1812. swapVariables (data.elements [index1],
  1813. data.elements [index2]);
  1814. }
  1815. }
  1816. void move (const int currentIndex, int newIndex) throw()
  1817. {
  1818. if (currentIndex != newIndex)
  1819. {
  1820. const ScopedLockType lock (getLock());
  1821. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1822. {
  1823. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1824. newIndex = numUsed - 1;
  1825. char tempCopy [sizeof (ElementType)];
  1826. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1827. if (newIndex > currentIndex)
  1828. {
  1829. memmove (data.elements + currentIndex,
  1830. data.elements + currentIndex + 1,
  1831. (newIndex - currentIndex) * sizeof (ElementType));
  1832. }
  1833. else
  1834. {
  1835. memmove (data.elements + newIndex + 1,
  1836. data.elements + newIndex,
  1837. (currentIndex - newIndex) * sizeof (ElementType));
  1838. }
  1839. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1840. }
  1841. }
  1842. }
  1843. void minimiseStorageOverheads()
  1844. {
  1845. const ScopedLockType lock (getLock());
  1846. data.shrinkToNoMoreThan (numUsed);
  1847. }
  1848. void ensureStorageAllocated (const int minNumElements)
  1849. {
  1850. const ScopedLockType lock (getLock());
  1851. data.ensureAllocatedSize (minNumElements);
  1852. }
  1853. template <class ElementComparator>
  1854. void sort (ElementComparator& comparator,
  1855. const bool retainOrderOfEquivalentItems = false) const
  1856. {
  1857. const ScopedLockType lock (getLock());
  1858. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1859. // avoids getting warning messages about the parameter being unused
  1860. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1861. }
  1862. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1863. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1864. juce_UseDebuggingNewOperator
  1865. private:
  1866. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1867. int numUsed;
  1868. };
  1869. #endif // __JUCE_ARRAY_JUCEHEADER__
  1870. /*** End of inlined file: juce_Array.h ***/
  1871. #endif
  1872. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1873. #endif
  1874. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1875. /*** Start of inlined file: juce_BitArray.h ***/
  1876. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1877. #define __JUCE_BITARRAY_JUCEHEADER__
  1878. class MemoryBlock;
  1879. class JUCE_API BitArray
  1880. {
  1881. public:
  1882. BitArray() throw();
  1883. BitArray (const unsigned int value) throw();
  1884. BitArray (const int value) throw();
  1885. BitArray (int64 value) throw();
  1886. BitArray (const BitArray& other) throw();
  1887. ~BitArray() throw();
  1888. BitArray& operator= (const BitArray& other) throw();
  1889. bool operator== (const BitArray& other) const throw();
  1890. bool operator!= (const BitArray& other) const throw();
  1891. void clear() throw();
  1892. void clearBit (const int bitNumber) throw();
  1893. void setBit (const int bitNumber) throw();
  1894. void setBit (const int bitNumber,
  1895. const bool shouldBeSet) throw();
  1896. void setRange (int startBit,
  1897. int numBits,
  1898. const bool shouldBeSet) throw();
  1899. void insertBit (const int bitNumber,
  1900. const bool shouldBeSet) throw();
  1901. bool operator[] (const int bit) const throw();
  1902. bool isEmpty() const throw();
  1903. const BitArray getBitRange (int startBit, int numBits) const throw();
  1904. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1905. void setBitRangeAsInt (int startBit, int numBits,
  1906. unsigned int valueToSet) throw();
  1907. void orWith (const BitArray& other) throw();
  1908. void andWith (const BitArray& other) throw();
  1909. void xorWith (const BitArray& other) throw();
  1910. void add (const BitArray& other) throw();
  1911. void subtract (const BitArray& other) throw();
  1912. void multiplyBy (const BitArray& other) throw();
  1913. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1914. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1915. void modulo (const BitArray& divisor) throw();
  1916. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1917. void inverseModulo (const BitArray& modulus) throw();
  1918. void shiftBits (int howManyBitsLeft,
  1919. int startBit = 0) throw();
  1920. int compare (const BitArray& other) const throw();
  1921. int compareAbsolute (const BitArray& other) const throw();
  1922. bool isNegative() const throw();
  1923. void setNegative (const bool shouldBeNegative) throw();
  1924. void negate() throw();
  1925. int countNumberOfSetBits() const throw();
  1926. int findNextSetBit (int startIndex = 0) const throw();
  1927. int findNextClearBit (int startIndex = 0) const throw();
  1928. int getHighestBit() const throw();
  1929. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1930. void parseString (const String& text,
  1931. const int base) throw();
  1932. const MemoryBlock toMemoryBlock() const throw();
  1933. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1934. juce_UseDebuggingNewOperator
  1935. private:
  1936. void ensureSize (const int numVals) throw();
  1937. HeapBlock <unsigned int> values;
  1938. int numValues, highestBit;
  1939. bool negative;
  1940. };
  1941. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1942. /*** End of inlined file: juce_BitArray.h ***/
  1943. #endif
  1944. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1945. /*** Start of inlined file: juce_DynamicObject.h ***/
  1946. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1947. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1948. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1949. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1950. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1951. /*** Start of inlined file: juce_Variant.h ***/
  1952. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1953. #define __JUCE_VARIANT_JUCEHEADER__
  1954. /*** Start of inlined file: juce_OutputStream.h ***/
  1955. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1956. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1957. /*** Start of inlined file: juce_InputStream.h ***/
  1958. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  1959. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  1960. /*** Start of inlined file: juce_MemoryBlock.h ***/
  1961. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1962. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1963. class JUCE_API MemoryBlock
  1964. {
  1965. public:
  1966. MemoryBlock() throw();
  1967. MemoryBlock (const size_t initialSize,
  1968. const bool initialiseToZero = false) throw();
  1969. MemoryBlock (const MemoryBlock& other) throw();
  1970. MemoryBlock (const void* const dataToInitialiseFrom,
  1971. const size_t sizeInBytes) throw();
  1972. ~MemoryBlock() throw();
  1973. MemoryBlock& operator= (const MemoryBlock& other) throw();
  1974. bool operator== (const MemoryBlock& other) const throw();
  1975. bool operator!= (const MemoryBlock& other) const throw();
  1976. bool matches (const void* data, size_t dataSize) const throw();
  1977. void* getData() const throw() { return data; }
  1978. template <typename Type>
  1979. char& operator[] (const Type offset) const throw() { return data [offset]; }
  1980. size_t getSize() const throw() { return size; }
  1981. void setSize (const size_t newSize,
  1982. const bool initialiseNewSpaceToZero = false) throw();
  1983. void ensureSize (const size_t minimumSize,
  1984. const bool initialiseNewSpaceToZero = false) throw();
  1985. void fillWith (const uint8 valueToUse) throw();
  1986. void append (const void* const data,
  1987. const size_t numBytes) throw();
  1988. void swapWith (MemoryBlock& other) throw();
  1989. void copyFrom (const void* srcData,
  1990. int destinationOffset,
  1991. size_t numBytes) throw();
  1992. void copyTo (void* destData,
  1993. int sourceOffset,
  1994. size_t numBytes) const throw();
  1995. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  1996. const String toString() const throw();
  1997. void loadFromHexString (const String& sourceHexString) throw();
  1998. void setBitRange (size_t bitRangeStart,
  1999. size_t numBits,
  2000. int binaryNumberToApply) throw();
  2001. int getBitRange (size_t bitRangeStart,
  2002. size_t numBitsToRead) const throw();
  2003. const String toBase64Encoding() const throw();
  2004. bool fromBase64Encoding (const String& encodedString) throw();
  2005. juce_UseDebuggingNewOperator
  2006. private:
  2007. HeapBlock <char> data;
  2008. size_t size;
  2009. };
  2010. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2011. /*** End of inlined file: juce_MemoryBlock.h ***/
  2012. class JUCE_API InputStream
  2013. {
  2014. public:
  2015. virtual ~InputStream() {}
  2016. virtual int64 getTotalLength() = 0;
  2017. virtual bool isExhausted() = 0;
  2018. virtual int read (void* destBuffer,
  2019. int maxBytesToRead) = 0;
  2020. virtual char readByte();
  2021. virtual bool readBool();
  2022. virtual short readShort();
  2023. virtual short readShortBigEndian();
  2024. virtual int readInt();
  2025. virtual int readIntBigEndian();
  2026. virtual int64 readInt64();
  2027. virtual int64 readInt64BigEndian();
  2028. virtual float readFloat();
  2029. virtual float readFloatBigEndian();
  2030. virtual double readDouble();
  2031. virtual double readDoubleBigEndian();
  2032. virtual int readCompressedInt();
  2033. virtual const String readNextLine();
  2034. virtual const String readString();
  2035. virtual const String readEntireStreamAsString();
  2036. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2037. int maxNumBytesToRead = -1);
  2038. virtual int64 getPosition() = 0;
  2039. virtual bool setPosition (int64 newPosition) = 0;
  2040. virtual void skipNextBytes (int64 numBytesToSkip);
  2041. juce_UseDebuggingNewOperator
  2042. protected:
  2043. InputStream() throw() {}
  2044. };
  2045. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2046. /*** End of inlined file: juce_InputStream.h ***/
  2047. class JUCE_API OutputStream
  2048. {
  2049. protected:
  2050. OutputStream();
  2051. public:
  2052. virtual ~OutputStream();
  2053. virtual void flush() = 0;
  2054. virtual bool setPosition (int64 newPosition) = 0;
  2055. virtual int64 getPosition() = 0;
  2056. virtual bool write (const void* dataToWrite,
  2057. int howManyBytes) = 0;
  2058. virtual void writeByte (char byte);
  2059. virtual void writeBool (bool boolValue);
  2060. virtual void writeShort (short value);
  2061. virtual void writeShortBigEndian (short value);
  2062. virtual void writeInt (int value);
  2063. virtual void writeIntBigEndian (int value);
  2064. virtual void writeInt64 (int64 value);
  2065. virtual void writeInt64BigEndian (int64 value);
  2066. virtual void writeFloat (float value);
  2067. virtual void writeFloatBigEndian (float value);
  2068. virtual void writeDouble (double value);
  2069. virtual void writeDoubleBigEndian (double value);
  2070. virtual void writeCompressedInt (int value);
  2071. virtual void writeString (const String& text);
  2072. virtual void writeText (const String& text,
  2073. const bool asUnicode,
  2074. const bool writeUnicodeHeaderBytes);
  2075. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2076. juce_UseDebuggingNewOperator
  2077. };
  2078. OutputStream& operator<< (OutputStream& stream, const int number);
  2079. OutputStream& operator<< (OutputStream& stream, const double number);
  2080. OutputStream& operator<< (OutputStream& stream, const char character);
  2081. OutputStream& operator<< (OutputStream& stream, const char* const text);
  2082. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2083. /*** End of inlined file: juce_OutputStream.h ***/
  2084. class JUCE_API DynamicObject;
  2085. class JUCE_API var
  2086. {
  2087. public:
  2088. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2089. var() throw();
  2090. ~var() throw();
  2091. static const var null;
  2092. var (const var& valueToCopy);
  2093. var (const int value) throw();
  2094. var (const bool value) throw();
  2095. var (const double value) throw();
  2096. var (const char* const value);
  2097. var (const juce_wchar* const value);
  2098. var (const String& value);
  2099. var (DynamicObject* const object);
  2100. var (MethodFunction method) throw();
  2101. var& operator= (const var& valueToCopy);
  2102. var& operator= (int value);
  2103. var& operator= (bool value);
  2104. var& operator= (double value);
  2105. var& operator= (const char* value);
  2106. var& operator= (const juce_wchar* value);
  2107. var& operator= (const String& value);
  2108. var& operator= (DynamicObject* object);
  2109. var& operator= (MethodFunction method);
  2110. void swapWith (var& other) throw();
  2111. operator int() const;
  2112. operator bool() const;
  2113. operator float() const;
  2114. operator double() const;
  2115. operator const String() const;
  2116. const String toString() const;
  2117. DynamicObject* getObject() const;
  2118. bool isVoid() const throw() { return type == voidType; }
  2119. bool isInt() const throw() { return type == intType; }
  2120. bool isBool() const throw() { return type == boolType; }
  2121. bool isDouble() const throw() { return type == doubleType; }
  2122. bool isString() const throw() { return type == stringType; }
  2123. bool isObject() const throw() { return type == objectType; }
  2124. bool isMethod() const throw() { return type == methodType; }
  2125. void writeToStream (OutputStream& output) const;
  2126. static const var readFromStream (InputStream& input);
  2127. class JUCE_API identifier
  2128. {
  2129. public:
  2130. identifier() throw();
  2131. identifier (const char* const name);
  2132. identifier (const String& name);
  2133. ~identifier();
  2134. bool operator== (const identifier& other) const throw()
  2135. {
  2136. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2137. return hashCode == other.hashCode;
  2138. }
  2139. String name;
  2140. int hashCode;
  2141. };
  2142. const var operator[] (const identifier& propertyName) const;
  2143. const var call (const identifier& method) const;
  2144. const var call (const identifier& method, const var& arg1) const;
  2145. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2146. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2147. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2148. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2149. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2150. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2151. juce_UseDebuggingNewOperator
  2152. bool equals (const var& other) const throw();
  2153. private:
  2154. enum Type
  2155. {
  2156. voidType = 0,
  2157. intType,
  2158. boolType,
  2159. doubleType,
  2160. stringType,
  2161. objectType,
  2162. methodType
  2163. };
  2164. union ValueUnion
  2165. {
  2166. int intValue;
  2167. bool boolValue;
  2168. double doubleValue;
  2169. String* stringValue;
  2170. DynamicObject* objectValue;
  2171. MethodFunction methodValue;
  2172. };
  2173. Type type;
  2174. ValueUnion value;
  2175. };
  2176. bool operator== (const var& v1, const var& v2) throw();
  2177. bool operator!= (const var& v1, const var& v2) throw();
  2178. bool operator== (const var& v1, const String& v2) throw();
  2179. bool operator!= (const var& v1, const String& v2) throw();
  2180. #endif // __JUCE_VARIANT_JUCEHEADER__
  2181. /*** End of inlined file: juce_Variant.h ***/
  2182. class JUCE_API NamedValueSet
  2183. {
  2184. public:
  2185. NamedValueSet() throw();
  2186. NamedValueSet (const NamedValueSet& other);
  2187. NamedValueSet& operator= (const NamedValueSet& other);
  2188. ~NamedValueSet();
  2189. int size() const throw();
  2190. const var& operator[] (const var::identifier& name) const;
  2191. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2192. var* getItem (const var::identifier& name) const;
  2193. bool set (const var::identifier& name, const var& newValue);
  2194. bool contains (const var::identifier& name) const;
  2195. bool remove (const var::identifier& name);
  2196. const var::identifier getName (int index) const;
  2197. void clear();
  2198. juce_UseDebuggingNewOperator
  2199. private:
  2200. struct NamedValue
  2201. {
  2202. NamedValue() throw();
  2203. NamedValue (const var::identifier& name, const var& value);
  2204. var::identifier name;
  2205. var value;
  2206. };
  2207. Array <NamedValue> values;
  2208. };
  2209. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2210. /*** End of inlined file: juce_NamedValueSet.h ***/
  2211. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2212. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2213. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2214. /*** Start of inlined file: juce_Atomic.h ***/
  2215. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2216. #define __JUCE_ATOMIC_JUCEHEADER__
  2217. class JUCE_API Atomic
  2218. {
  2219. public:
  2220. static void increment (int32& variable);
  2221. static int32 incrementAndReturn (int32& variable);
  2222. static void decrement (int32& variable);
  2223. static int32 decrementAndReturn (int32& variable);
  2224. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2225. static void* swapPointers (void* volatile* value1, void* value2);
  2226. };
  2227. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2228. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2229. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2230. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2231. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2232. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2233. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2234. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2235. {
  2236. void* currentVal = *value1;
  2237. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2238. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2239. #else
  2240. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2241. #endif
  2242. return currentVal;
  2243. }
  2244. #elif JUCE_LINUX // Linux...
  2245. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2246. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2247. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2248. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2249. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2250. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2251. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2252. {
  2253. void* currentVal = *value1;
  2254. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2255. return currentVal;
  2256. }
  2257. #elif JUCE_USE_INTRINSICS // Windows...
  2258. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2259. // declared in juce_win32_Threads.cpp)
  2260. #pragma intrinsic (_InterlockedIncrement)
  2261. #pragma intrinsic (_InterlockedDecrement)
  2262. #pragma intrinsic (_InterlockedCompareExchange)
  2263. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2264. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2265. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2266. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2267. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2268. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2269. #endif
  2270. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2271. /*** End of inlined file: juce_Atomic.h ***/
  2272. class JUCE_API ReferenceCountedObject
  2273. {
  2274. public:
  2275. inline void incReferenceCount() throw()
  2276. {
  2277. Atomic::increment (refCounts);
  2278. jassert (refCounts > 0);
  2279. }
  2280. inline void decReferenceCount() throw()
  2281. {
  2282. jassert (refCounts > 0);
  2283. if (Atomic::decrementAndReturn (refCounts) == 0)
  2284. delete this;
  2285. }
  2286. inline int getReferenceCount() const throw()
  2287. {
  2288. return refCounts;
  2289. }
  2290. protected:
  2291. ReferenceCountedObject()
  2292. : refCounts (0)
  2293. {
  2294. }
  2295. virtual ~ReferenceCountedObject()
  2296. {
  2297. // it's dangerous to delete an object that's still referenced by something else!
  2298. jassert (refCounts == 0);
  2299. }
  2300. private:
  2301. int refCounts;
  2302. };
  2303. template <class ReferenceCountedObjectClass>
  2304. class ReferenceCountedObjectPtr
  2305. {
  2306. public:
  2307. inline ReferenceCountedObjectPtr() throw()
  2308. : referencedObject (0)
  2309. {
  2310. }
  2311. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2312. : referencedObject (refCountedObject)
  2313. {
  2314. if (refCountedObject != 0)
  2315. refCountedObject->incReferenceCount();
  2316. }
  2317. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2318. : referencedObject (other.referencedObject)
  2319. {
  2320. if (referencedObject != 0)
  2321. referencedObject->incReferenceCount();
  2322. }
  2323. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2324. {
  2325. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2326. if (newObject != referencedObject)
  2327. {
  2328. if (newObject != 0)
  2329. newObject->incReferenceCount();
  2330. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2331. referencedObject = newObject;
  2332. if (oldObject != 0)
  2333. oldObject->decReferenceCount();
  2334. }
  2335. return *this;
  2336. }
  2337. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2338. {
  2339. if (referencedObject != newObject)
  2340. {
  2341. if (newObject != 0)
  2342. newObject->incReferenceCount();
  2343. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2344. referencedObject = newObject;
  2345. if (oldObject != 0)
  2346. oldObject->decReferenceCount();
  2347. }
  2348. return *this;
  2349. }
  2350. inline ~ReferenceCountedObjectPtr()
  2351. {
  2352. if (referencedObject != 0)
  2353. referencedObject->decReferenceCount();
  2354. }
  2355. inline operator ReferenceCountedObjectClass*() const throw()
  2356. {
  2357. return referencedObject;
  2358. }
  2359. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2360. {
  2361. return referencedObject == object;
  2362. }
  2363. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2364. {
  2365. return referencedObject != object;
  2366. }
  2367. // the -> operator is called on the referenced object
  2368. inline ReferenceCountedObjectClass* operator->() const throw()
  2369. {
  2370. return referencedObject;
  2371. }
  2372. private:
  2373. ReferenceCountedObjectClass* referencedObject;
  2374. };
  2375. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2376. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2377. class JUCE_API DynamicObject : public ReferenceCountedObject
  2378. {
  2379. public:
  2380. DynamicObject();
  2381. virtual ~DynamicObject();
  2382. virtual bool hasProperty (const var::identifier& propertyName) const;
  2383. virtual const var getProperty (const var::identifier& propertyName) const;
  2384. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2385. virtual void removeProperty (const var::identifier& propertyName);
  2386. virtual bool hasMethod (const var::identifier& methodName) const;
  2387. virtual const var invokeMethod (const var::identifier& methodName,
  2388. const var* parameters,
  2389. int numParameters);
  2390. void setMethod (const var::identifier& methodName,
  2391. var::MethodFunction methodFunction);
  2392. void clear();
  2393. juce_UseDebuggingNewOperator
  2394. private:
  2395. NamedValueSet properties;
  2396. };
  2397. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2398. /*** End of inlined file: juce_DynamicObject.h ***/
  2399. #endif
  2400. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2401. #endif
  2402. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2403. #endif
  2404. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2405. #endif
  2406. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2407. #endif
  2408. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2409. /*** Start of inlined file: juce_OwnedArray.h ***/
  2410. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2411. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2412. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2413. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2414. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2415. template <class ObjectType>
  2416. class JUCE_API ScopedPointer
  2417. {
  2418. public:
  2419. inline ScopedPointer() throw() : object (0)
  2420. {
  2421. }
  2422. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2423. : object (objectToTakePossessionOf)
  2424. {
  2425. }
  2426. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2427. : object (objectToTransferFrom.object)
  2428. {
  2429. objectToTransferFrom.object = 0;
  2430. }
  2431. inline ~ScopedPointer() { delete object; }
  2432. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2433. {
  2434. if (this != objectToTransferFrom.getAddress())
  2435. {
  2436. // Two ScopedPointers should never be able to refer to the same object - if
  2437. // this happens, you must have done something dodgy!
  2438. jassert (object == 0 || object != objectToTransferFrom.object);
  2439. ObjectType* const oldObject = object;
  2440. object = objectToTransferFrom.object;
  2441. objectToTransferFrom.object = 0;
  2442. delete oldObject;
  2443. }
  2444. return *this;
  2445. }
  2446. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2447. {
  2448. if (object != newObjectToTakePossessionOf)
  2449. {
  2450. ObjectType* const oldObject = object;
  2451. object = newObjectToTakePossessionOf;
  2452. delete oldObject;
  2453. }
  2454. return *this;
  2455. }
  2456. inline operator ObjectType*() const throw() { return object; }
  2457. inline ObjectType& operator*() const throw() { return *object; }
  2458. inline ObjectType* operator->() const throw() { return object; }
  2459. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2460. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2461. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2462. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2463. {
  2464. // Two ScopedPointers should never be able to refer to the same object - if
  2465. // this happens, you must have done something dodgy!
  2466. jassert (object != other.object);
  2467. swapVariables (object, other.object);
  2468. }
  2469. private:
  2470. ObjectType* object;
  2471. // (Required as an alternative to the overloaded & operator).
  2472. const ScopedPointer* getAddress() const throw() { return this; }
  2473. };
  2474. template <class ObjectType>
  2475. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2476. {
  2477. return static_cast <ObjectType*> (pointer1) == pointer2;
  2478. }
  2479. template <class ObjectType>
  2480. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2481. {
  2482. return static_cast <ObjectType*> (pointer1) != pointer2;
  2483. }
  2484. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2485. /*** End of inlined file: juce_ScopedPointer.h ***/
  2486. template <class ObjectClass,
  2487. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2488. class OwnedArray
  2489. {
  2490. public:
  2491. OwnedArray() throw()
  2492. : numUsed (0)
  2493. {
  2494. }
  2495. ~OwnedArray()
  2496. {
  2497. clear (true);
  2498. }
  2499. void clear (const bool deleteObjects = true)
  2500. {
  2501. const ScopedLockType lock (getLock());
  2502. if (deleteObjects)
  2503. {
  2504. while (numUsed > 0)
  2505. delete data.elements [--numUsed];
  2506. }
  2507. data.setAllocatedSize (0);
  2508. numUsed = 0;
  2509. }
  2510. inline int size() const throw()
  2511. {
  2512. return numUsed;
  2513. }
  2514. inline ObjectClass* operator[] (const int index) const throw()
  2515. {
  2516. const ScopedLockType lock (getLock());
  2517. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2518. : static_cast <ObjectClass*> (0);
  2519. }
  2520. inline ObjectClass* getUnchecked (const int index) const throw()
  2521. {
  2522. const ScopedLockType lock (getLock());
  2523. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2524. return data.elements [index];
  2525. }
  2526. inline ObjectClass* getFirst() const throw()
  2527. {
  2528. const ScopedLockType lock (getLock());
  2529. return numUsed > 0 ? data.elements [0]
  2530. : static_cast <ObjectClass*> (0);
  2531. }
  2532. inline ObjectClass* getLast() const throw()
  2533. {
  2534. const ScopedLockType lock (getLock());
  2535. return numUsed > 0 ? data.elements [numUsed - 1]
  2536. : static_cast <ObjectClass*> (0);
  2537. }
  2538. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2539. {
  2540. const ScopedLockType lock (getLock());
  2541. ObjectClass* const* e = data.elements.getData();
  2542. ObjectClass* const* const end = e + numUsed;
  2543. while (e != end)
  2544. {
  2545. if (objectToLookFor == *e)
  2546. return (int) (e - data.elements.getData());
  2547. ++e;
  2548. }
  2549. return -1;
  2550. }
  2551. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2552. {
  2553. const ScopedLockType lock (getLock());
  2554. ObjectClass* const* e = data.elements.getData();
  2555. ObjectClass* const* const end = e + numUsed;
  2556. while (e != end)
  2557. {
  2558. if (objectToLookFor == *e)
  2559. return true;
  2560. ++e;
  2561. }
  2562. return false;
  2563. }
  2564. void add (const ObjectClass* const newObject) throw()
  2565. {
  2566. const ScopedLockType lock (getLock());
  2567. data.ensureAllocatedSize (numUsed + 1);
  2568. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2569. }
  2570. void insert (int indexToInsertAt,
  2571. const ObjectClass* const newObject) throw()
  2572. {
  2573. if (indexToInsertAt >= 0)
  2574. {
  2575. const ScopedLockType lock (getLock());
  2576. if (indexToInsertAt > numUsed)
  2577. indexToInsertAt = numUsed;
  2578. data.ensureAllocatedSize (numUsed + 1);
  2579. ObjectClass** const e = data.elements + indexToInsertAt;
  2580. const int numToMove = numUsed - indexToInsertAt;
  2581. if (numToMove > 0)
  2582. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2583. *e = const_cast <ObjectClass*> (newObject);
  2584. ++numUsed;
  2585. }
  2586. else
  2587. {
  2588. add (newObject);
  2589. }
  2590. }
  2591. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2592. {
  2593. const ScopedLockType lock (getLock());
  2594. if (! contains (newObject))
  2595. add (newObject);
  2596. }
  2597. void set (const int indexToChange,
  2598. const ObjectClass* const newObject,
  2599. const bool deleteOldElement = true)
  2600. {
  2601. if (indexToChange >= 0)
  2602. {
  2603. ScopedPointer <ObjectClass> toDelete;
  2604. const ScopedLockType lock (getLock());
  2605. if (indexToChange < numUsed)
  2606. {
  2607. if (deleteOldElement)
  2608. {
  2609. toDelete = data.elements [indexToChange];
  2610. if (toDelete == newObject)
  2611. toDelete = 0;
  2612. }
  2613. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2614. }
  2615. else
  2616. {
  2617. data.ensureAllocatedSize (numUsed + 1);
  2618. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2619. }
  2620. }
  2621. }
  2622. template <class ElementComparator>
  2623. void addSorted (ElementComparator& comparator,
  2624. ObjectClass* const newObject) throw()
  2625. {
  2626. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2627. // avoids getting warning messages about the parameter being unused
  2628. const ScopedLockType lock (getLock());
  2629. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2630. }
  2631. template <class ElementComparator>
  2632. int indexOfSorted (ElementComparator& comparator,
  2633. const ObjectClass* const objectToLookFor) const throw()
  2634. {
  2635. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2636. // avoids getting warning messages about the parameter being unused
  2637. const ScopedLockType lock (getLock());
  2638. int start = 0;
  2639. int end = numUsed;
  2640. for (;;)
  2641. {
  2642. if (start >= end)
  2643. {
  2644. return -1;
  2645. }
  2646. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2647. {
  2648. return start;
  2649. }
  2650. else
  2651. {
  2652. const int halfway = (start + end) >> 1;
  2653. if (halfway == start)
  2654. return -1;
  2655. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2656. start = halfway;
  2657. else
  2658. end = halfway;
  2659. }
  2660. }
  2661. }
  2662. void remove (const int indexToRemove,
  2663. const bool deleteObject = true)
  2664. {
  2665. ScopedPointer <ObjectClass> toDelete;
  2666. const ScopedLockType lock (getLock());
  2667. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2668. {
  2669. ObjectClass** const e = data.elements + indexToRemove;
  2670. if (deleteObject)
  2671. toDelete = *e;
  2672. --numUsed;
  2673. const int numToShift = numUsed - indexToRemove;
  2674. if (numToShift > 0)
  2675. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2676. if ((numUsed << 1) < data.numAllocated)
  2677. minimiseStorageOverheads();
  2678. }
  2679. }
  2680. void removeObject (const ObjectClass* const objectToRemove,
  2681. const bool deleteObject = true)
  2682. {
  2683. const ScopedLockType lock (getLock());
  2684. ObjectClass** e = data.elements.getData();
  2685. for (int i = numUsed; --i >= 0;)
  2686. {
  2687. if (objectToRemove == *e)
  2688. {
  2689. remove ((int) (e - data.elements.getData()), deleteObject);
  2690. break;
  2691. }
  2692. ++e;
  2693. }
  2694. }
  2695. void removeRange (int startIndex,
  2696. const int numberToRemove,
  2697. const bool deleteObjects = true)
  2698. {
  2699. const ScopedLockType lock (getLock());
  2700. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2701. startIndex = jlimit (0, numUsed, startIndex);
  2702. if (endIndex > startIndex)
  2703. {
  2704. if (deleteObjects)
  2705. {
  2706. for (int i = startIndex; i < endIndex; ++i)
  2707. {
  2708. delete data.elements [i];
  2709. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2710. }
  2711. }
  2712. const int rangeSize = endIndex - startIndex;
  2713. ObjectClass** e = data.elements + startIndex;
  2714. int numToShift = numUsed - endIndex;
  2715. numUsed -= rangeSize;
  2716. while (--numToShift >= 0)
  2717. {
  2718. *e = e [rangeSize];
  2719. ++e;
  2720. }
  2721. if ((numUsed << 1) < data.numAllocated)
  2722. minimiseStorageOverheads();
  2723. }
  2724. }
  2725. void removeLast (int howManyToRemove = 1,
  2726. const bool deleteObjects = true)
  2727. {
  2728. const ScopedLockType lock (getLock());
  2729. if (howManyToRemove >= numUsed)
  2730. {
  2731. clear (deleteObjects);
  2732. }
  2733. else
  2734. {
  2735. while (--howManyToRemove >= 0)
  2736. remove (numUsed - 1, deleteObjects);
  2737. }
  2738. }
  2739. void swap (const int index1,
  2740. const int index2) throw()
  2741. {
  2742. const ScopedLockType lock (getLock());
  2743. if (((unsigned int) index1) < (unsigned int) numUsed
  2744. && ((unsigned int) index2) < (unsigned int) numUsed)
  2745. {
  2746. swapVariables (data.elements [index1],
  2747. data.elements [index2]);
  2748. }
  2749. }
  2750. void move (const int currentIndex,
  2751. int newIndex) throw()
  2752. {
  2753. if (currentIndex != newIndex)
  2754. {
  2755. const ScopedLockType lock (getLock());
  2756. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2757. {
  2758. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2759. newIndex = numUsed - 1;
  2760. ObjectClass* const value = data.elements [currentIndex];
  2761. if (newIndex > currentIndex)
  2762. {
  2763. memmove (data.elements + currentIndex,
  2764. data.elements + currentIndex + 1,
  2765. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2766. }
  2767. else
  2768. {
  2769. memmove (data.elements + newIndex + 1,
  2770. data.elements + newIndex,
  2771. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2772. }
  2773. data.elements [newIndex] = value;
  2774. }
  2775. }
  2776. }
  2777. void swapWithArray (OwnedArray& otherArray) throw()
  2778. {
  2779. const ScopedLockType lock1 (getLock());
  2780. const ScopedLockType lock2 (otherArray.getLock());
  2781. data.swapWith (otherArray.data);
  2782. swapVariables (numUsed, otherArray.numUsed);
  2783. }
  2784. void minimiseStorageOverheads() throw()
  2785. {
  2786. const ScopedLockType lock (getLock());
  2787. data.shrinkToNoMoreThan (numUsed);
  2788. }
  2789. void ensureStorageAllocated (const int minNumElements) throw()
  2790. {
  2791. const ScopedLockType lock (getLock());
  2792. data.ensureAllocatedSize (minNumElements);
  2793. }
  2794. template <class ElementComparator>
  2795. void sort (ElementComparator& comparator,
  2796. const bool retainOrderOfEquivalentItems = false) const throw()
  2797. {
  2798. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2799. // avoids getting warning messages about the parameter being unused
  2800. const ScopedLockType lock (getLock());
  2801. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2802. }
  2803. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2804. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2805. juce_UseDebuggingNewOperator
  2806. private:
  2807. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2808. int numUsed;
  2809. // disallow copy constructor and assignment
  2810. OwnedArray (const OwnedArray&);
  2811. OwnedArray& operator= (const OwnedArray&);
  2812. };
  2813. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2814. /*** End of inlined file: juce_OwnedArray.h ***/
  2815. #endif
  2816. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2817. /*** Start of inlined file: juce_PropertySet.h ***/
  2818. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2819. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2820. /*** Start of inlined file: juce_StringPairArray.h ***/
  2821. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2822. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2823. /*** Start of inlined file: juce_StringArray.h ***/
  2824. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2825. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2826. #ifndef DOXYGEN
  2827. // (used in StringArray::appendNumbersToDuplicates)
  2828. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2829. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2830. #endif
  2831. class JUCE_API StringArray
  2832. {
  2833. public:
  2834. StringArray() throw();
  2835. StringArray (const StringArray& other);
  2836. StringArray (const juce_wchar** const strings,
  2837. const int numberOfStrings);
  2838. StringArray (const char** const strings,
  2839. const int numberOfStrings);
  2840. explicit StringArray (const juce_wchar** const strings);
  2841. explicit StringArray (const char** const strings);
  2842. ~StringArray();
  2843. StringArray& operator= (const StringArray& other);
  2844. bool operator== (const StringArray& other) const;
  2845. bool operator!= (const StringArray& other) const;
  2846. inline int size() const throw() { return strings.size(); };
  2847. const String& operator[] (const int index) const throw();
  2848. bool contains (const String& stringToLookFor,
  2849. const bool ignoreCase = false) const;
  2850. int indexOf (const String& stringToLookFor,
  2851. const bool ignoreCase = false,
  2852. int startIndex = 0) const;
  2853. void add (const String& stringToAdd);
  2854. void insert (const int index, const String& stringToAdd);
  2855. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2856. void set (const int index, const String& newString);
  2857. void addArray (const StringArray& other,
  2858. int startIndex = 0,
  2859. int numElementsToAdd = -1);
  2860. int addTokens (const tchar* const stringToTokenise,
  2861. const bool preserveQuotedStrings);
  2862. int addTokens (const tchar* const stringToTokenise,
  2863. const tchar* breakCharacters,
  2864. const tchar* quoteCharacters);
  2865. int addLines (const tchar* stringToBreakUp);
  2866. void clear();
  2867. void remove (const int index);
  2868. void removeString (const String& stringToRemove,
  2869. const bool ignoreCase = false);
  2870. void removeDuplicates (const bool ignoreCase);
  2871. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2872. void move (const int currentIndex, int newIndex) throw();
  2873. void trim();
  2874. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2875. const bool appendNumberToFirstInstance,
  2876. const tchar* const preNumberString = defaultPreNumberString,
  2877. const tchar* const postNumberString = defaultPostNumberString);
  2878. const String joinIntoString (const String& separatorString,
  2879. int startIndex = 0,
  2880. int numberOfElements = -1) const;
  2881. void sort (const bool ignoreCase);
  2882. void minimiseStorageOverheads();
  2883. juce_UseDebuggingNewOperator
  2884. private:
  2885. Array <String> strings;
  2886. };
  2887. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2888. /*** End of inlined file: juce_StringArray.h ***/
  2889. class JUCE_API StringPairArray
  2890. {
  2891. public:
  2892. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2893. StringPairArray (const StringPairArray& other) throw();
  2894. ~StringPairArray() throw();
  2895. StringPairArray& operator= (const StringPairArray& other) throw();
  2896. bool operator== (const StringPairArray& other) const throw();
  2897. bool operator!= (const StringPairArray& other) const throw();
  2898. const String& operator[] (const String& key) const throw();
  2899. const String getValue (const String& key, const String& defaultReturnValue) const;
  2900. const StringArray& getAllKeys() const throw() { return keys; }
  2901. const StringArray& getAllValues() const throw() { return values; }
  2902. inline int size() const throw() { return keys.size(); };
  2903. void set (const String& key,
  2904. const String& value) throw();
  2905. void addArray (const StringPairArray& other);
  2906. void clear() throw();
  2907. void remove (const String& key) throw();
  2908. void remove (const int index) throw();
  2909. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2910. const String getDescription() const;
  2911. void minimiseStorageOverheads() throw();
  2912. juce_UseDebuggingNewOperator
  2913. private:
  2914. StringArray keys, values;
  2915. bool ignoreCase;
  2916. };
  2917. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2918. /*** End of inlined file: juce_StringPairArray.h ***/
  2919. /*** Start of inlined file: juce_XmlElement.h ***/
  2920. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  2921. #define __JUCE_XMLELEMENT_JUCEHEADER__
  2922. /*** Start of inlined file: juce_File.h ***/
  2923. #ifndef __JUCE_FILE_JUCEHEADER__
  2924. #define __JUCE_FILE_JUCEHEADER__
  2925. /*** Start of inlined file: juce_Time.h ***/
  2926. #ifndef __JUCE_TIME_JUCEHEADER__
  2927. #define __JUCE_TIME_JUCEHEADER__
  2928. /*** Start of inlined file: juce_RelativeTime.h ***/
  2929. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  2930. #define __JUCE_RELATIVETIME_JUCEHEADER__
  2931. class JUCE_API RelativeTime
  2932. {
  2933. public:
  2934. explicit RelativeTime (const double seconds = 0.0) throw();
  2935. RelativeTime (const RelativeTime& other) throw();
  2936. RelativeTime& operator= (const RelativeTime& other) throw();
  2937. ~RelativeTime() throw();
  2938. static const RelativeTime milliseconds (const int milliseconds) throw();
  2939. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  2940. static const RelativeTime minutes (const double numberOfMinutes) throw();
  2941. static const RelativeTime hours (const double numberOfHours) throw();
  2942. static const RelativeTime days (const double numberOfDays) throw();
  2943. static const RelativeTime weeks (const double numberOfWeeks) throw();
  2944. int64 inMilliseconds() const throw();
  2945. double inSeconds() const throw() { return seconds; }
  2946. double inMinutes() const throw();
  2947. double inHours() const throw();
  2948. double inDays() const throw();
  2949. double inWeeks() const throw();
  2950. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  2951. bool operator== (const RelativeTime& other) const throw();
  2952. bool operator!= (const RelativeTime& other) const throw();
  2953. bool operator> (const RelativeTime& other) const throw();
  2954. bool operator< (const RelativeTime& other) const throw();
  2955. bool operator>= (const RelativeTime& other) const throw();
  2956. bool operator<= (const RelativeTime& other) const throw();
  2957. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  2958. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  2959. const RelativeTime operator+ (const double secondsToAdd) const throw();
  2960. const RelativeTime operator- (const double secondsToSubtract) const throw();
  2961. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  2962. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  2963. const RelativeTime& operator+= (const double secondsToAdd) throw();
  2964. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  2965. juce_UseDebuggingNewOperator
  2966. private:
  2967. double seconds;
  2968. };
  2969. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  2970. /*** End of inlined file: juce_RelativeTime.h ***/
  2971. class JUCE_API Time
  2972. {
  2973. public:
  2974. Time() throw();
  2975. Time (const Time& other) throw();
  2976. Time (const int64 millisecondsSinceEpoch) throw();
  2977. Time (const int year,
  2978. const int month,
  2979. const int day,
  2980. const int hours,
  2981. const int minutes,
  2982. const int seconds = 0,
  2983. const int milliseconds = 0,
  2984. const bool useLocalTime = true) throw();
  2985. ~Time() throw();
  2986. Time& operator= (const Time& other) throw();
  2987. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  2988. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  2989. int getYear() const throw();
  2990. int getMonth() const throw();
  2991. const String getMonthName (const bool threeLetterVersion) const throw();
  2992. int getDayOfMonth() const throw();
  2993. int getDayOfWeek() const throw();
  2994. const String getWeekdayName (const bool threeLetterVersion) const throw();
  2995. int getHours() const throw();
  2996. bool isAfternoon() const throw();
  2997. int getHoursInAmPmFormat() const throw();
  2998. int getMinutes() const throw();
  2999. int getSeconds() const throw();
  3000. int getMilliseconds() const throw();
  3001. bool isDaylightSavingTime() const throw();
  3002. const String getTimeZone() const throw();
  3003. const String toString (const bool includeDate,
  3004. const bool includeTime,
  3005. const bool includeSeconds = true,
  3006. const bool use24HourClock = false) const throw();
  3007. const String formatted (const tchar* const format) const throw();
  3008. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3009. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3010. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3011. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3012. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3013. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3014. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3015. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3016. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3017. bool setSystemTimeToThisTime() const throw();
  3018. static const String getWeekdayName (int dayNumber,
  3019. const bool threeLetterVersion) throw();
  3020. static const String getMonthName (int monthNumber,
  3021. const bool threeLetterVersion) throw();
  3022. // Static methods for getting system timers directly..
  3023. static int64 currentTimeMillis() throw();
  3024. static uint32 getMillisecondCounter() throw();
  3025. static double getMillisecondCounterHiRes() throw();
  3026. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  3027. static uint32 getApproximateMillisecondCounter() throw();
  3028. // High-resolution timers..
  3029. static int64 getHighResolutionTicks() throw();
  3030. static int64 getHighResolutionTicksPerSecond() throw();
  3031. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  3032. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  3033. private:
  3034. int64 millisSinceEpoch;
  3035. };
  3036. #endif // __JUCE_TIME_JUCEHEADER__
  3037. /*** End of inlined file: juce_Time.h ***/
  3038. class FileInputStream;
  3039. class FileOutputStream;
  3040. class JUCE_API File
  3041. {
  3042. public:
  3043. File() {}
  3044. File (const String& path);
  3045. File (const File& other);
  3046. ~File() {}
  3047. File& operator= (const String& newFilePath);
  3048. File& operator= (const File& otherFile);
  3049. static const File nonexistent;
  3050. bool exists() const;
  3051. bool existsAsFile() const;
  3052. bool isDirectory() const;
  3053. int64 getSize() const;
  3054. static const String descriptionOfSizeInBytes (const int64 bytes);
  3055. const String& getFullPathName() const throw() { return fullPath; }
  3056. const String getFileName() const;
  3057. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3058. const String getFileExtension() const;
  3059. bool hasFileExtension (const String& extensionToTest) const;
  3060. const File withFileExtension (const String& newExtension) const;
  3061. const String getFileNameWithoutExtension() const;
  3062. int hashCode() const;
  3063. int64 hashCode64() const;
  3064. const File getChildFile (String relativePath) const;
  3065. const File getSiblingFile (const String& siblingFileName) const;
  3066. const File getParentDirectory() const;
  3067. bool isAChildOf (const File& potentialParentDirectory) const;
  3068. const File getNonexistentChildFile (const String& prefix,
  3069. const String& suffix,
  3070. bool putNumbersInBrackets = true) const;
  3071. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3072. bool operator== (const File& otherFile) const;
  3073. bool operator!= (const File& otherFile) const;
  3074. bool hasWriteAccess() const;
  3075. bool setReadOnly (const bool shouldBeReadOnly,
  3076. const bool applyRecursively = false) const;
  3077. bool isHidden() const;
  3078. const File getLinkedTarget() const;
  3079. const Time getLastModificationTime() const;
  3080. const Time getLastAccessTime() const;
  3081. const Time getCreationTime() const;
  3082. bool setLastModificationTime (const Time& newTime) const;
  3083. bool setLastAccessTime (const Time& newTime) const;
  3084. bool setCreationTime (const Time& newTime) const;
  3085. const String getVersion() const;
  3086. bool create() const;
  3087. bool createDirectory() const;
  3088. bool deleteFile() const;
  3089. bool deleteRecursively() const;
  3090. bool moveToTrash() const;
  3091. bool moveFileTo (const File& targetLocation) const;
  3092. bool copyFileTo (const File& targetLocation) const;
  3093. bool copyDirectoryTo (const File& newDirectory) const;
  3094. enum TypesOfFileToFind
  3095. {
  3096. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3097. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3098. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3099. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3100. };
  3101. int findChildFiles (Array<File>& results,
  3102. const int whatToLookFor,
  3103. const bool searchRecursively,
  3104. const String& wildCardPattern = JUCE_T("*")) const;
  3105. int getNumberOfChildFiles (const int whatToLookFor,
  3106. const String& wildCardPattern = JUCE_T("*")) const;
  3107. bool containsSubDirectories() const;
  3108. FileInputStream* createInputStream() const;
  3109. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3110. bool loadFileAsData (MemoryBlock& result) const;
  3111. const String loadFileAsString() const;
  3112. bool appendData (const void* const dataToAppend,
  3113. const int numberOfBytes) const;
  3114. bool replaceWithData (const void* const dataToWrite,
  3115. const int numberOfBytes) const;
  3116. bool appendText (const String& textToAppend,
  3117. const bool asUnicode = false,
  3118. const bool writeUnicodeHeaderBytes = false) const;
  3119. bool replaceWithText (const String& textToWrite,
  3120. const bool asUnicode = false,
  3121. const bool writeUnicodeHeaderBytes = false) const;
  3122. static void findFileSystemRoots (Array<File>& results);
  3123. const String getVolumeLabel() const;
  3124. int getVolumeSerialNumber() const;
  3125. int64 getBytesFreeOnVolume() const;
  3126. int64 getVolumeTotalSize() const;
  3127. bool isOnCDRomDrive() const;
  3128. bool isOnHardDisk() const;
  3129. bool isOnRemovableDrive() const;
  3130. bool startAsProcess (const String& parameters = String::empty) const;
  3131. void revealToUser() const;
  3132. enum SpecialLocationType
  3133. {
  3134. userHomeDirectory,
  3135. userDocumentsDirectory,
  3136. userDesktopDirectory,
  3137. userApplicationDataDirectory,
  3138. commonApplicationDataDirectory,
  3139. tempDirectory,
  3140. currentExecutableFile,
  3141. currentApplicationFile,
  3142. invokedExecutableFile,
  3143. globalApplicationsDirectory,
  3144. userMusicDirectory,
  3145. userMoviesDirectory,
  3146. };
  3147. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3148. static const File createTempFile (const String& fileNameEnding);
  3149. static const File getCurrentWorkingDirectory();
  3150. bool setAsCurrentWorkingDirectory() const;
  3151. static const tchar separator;
  3152. static const tchar* separatorString;
  3153. static const String createLegalFileName (const String& fileNameToFix);
  3154. static const String createLegalPathName (const String& pathNameToFix);
  3155. static bool areFileNamesCaseSensitive();
  3156. static bool isAbsolutePath (const String& path);
  3157. static const File createFileWithoutCheckingPath (const String& path);
  3158. juce_UseDebuggingNewOperator
  3159. private:
  3160. String fullPath;
  3161. // internal way of contructing a file without checking the path
  3162. friend class DirectoryIterator;
  3163. File (const String&, int);
  3164. const String getPathUpToLastSlash() const;
  3165. };
  3166. #endif // __JUCE_FILE_JUCEHEADER__
  3167. /*** End of inlined file: juce_File.h ***/
  3168. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3169. \
  3170. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3171. childElementVariableName != 0; \
  3172. childElementVariableName = childElementVariableName->getNextElement())
  3173. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3174. \
  3175. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3176. childElementVariableName != 0; \
  3177. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3178. class JUCE_API XmlElement
  3179. {
  3180. public:
  3181. XmlElement (const String& tagName) throw();
  3182. XmlElement (const XmlElement& other) throw();
  3183. XmlElement& operator= (const XmlElement& other) throw();
  3184. ~XmlElement() throw();
  3185. bool isEquivalentTo (const XmlElement* const other,
  3186. const bool ignoreOrderOfAttributes) const throw();
  3187. const String createDocument (const String& dtdToUse,
  3188. const bool allOnOneLine = false,
  3189. const bool includeXmlHeader = true,
  3190. const String& encodingType = JUCE_T("UTF-8"),
  3191. const int lineWrapLength = 60) const throw();
  3192. void writeToStream (OutputStream& output,
  3193. const String& dtdToUse,
  3194. const bool allOnOneLine = false,
  3195. const bool includeXmlHeader = true,
  3196. const String& encodingType = JUCE_T("UTF-8"),
  3197. const int lineWrapLength = 60) const throw();
  3198. bool writeToFile (const File& destinationFile,
  3199. const String& dtdToUse,
  3200. const String& encodingType = JUCE_T("UTF-8"),
  3201. const int lineWrapLength = 60) const throw();
  3202. inline const String& getTagName() const throw() { return tagName; }
  3203. bool hasTagName (const String& possibleTagName) const throw();
  3204. int getNumAttributes() const throw();
  3205. const String& getAttributeName (const int attributeIndex) const throw();
  3206. const String& getAttributeValue (const int attributeIndex) const throw();
  3207. // Attribute-handling methods..
  3208. bool hasAttribute (const String& attributeName) const throw();
  3209. const String getStringAttribute (const String& attributeName,
  3210. const String& defaultReturnValue = String::empty) const throw();
  3211. bool compareAttribute (const String& attributeName,
  3212. const String& stringToCompareAgainst,
  3213. const bool ignoreCase = false) const throw();
  3214. int getIntAttribute (const String& attributeName,
  3215. const int defaultReturnValue = 0) const throw();
  3216. double getDoubleAttribute (const String& attributeName,
  3217. const double defaultReturnValue = 0.0) const throw();
  3218. bool getBoolAttribute (const String& attributeName,
  3219. const bool defaultReturnValue = false) const throw();
  3220. void setAttribute (const String& attributeName,
  3221. const String& newValue) throw();
  3222. void setAttribute (const String& attributeName,
  3223. const int newValue) throw();
  3224. void setAttribute (const String& attributeName,
  3225. const double newValue) throw();
  3226. void removeAttribute (const String& attributeName) throw();
  3227. void removeAllAttributes() throw();
  3228. // Child element methods..
  3229. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3230. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3231. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3232. int getNumChildElements() const throw();
  3233. XmlElement* getChildElement (const int index) const throw();
  3234. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3235. void addChildElement (XmlElement* const newChildElement) throw();
  3236. void insertChildElement (XmlElement* const newChildNode,
  3237. int indexToInsertAt) throw();
  3238. XmlElement* createNewChildElement (const String& tagName);
  3239. bool replaceChildElement (XmlElement* const currentChildElement,
  3240. XmlElement* const newChildNode) throw();
  3241. void removeChildElement (XmlElement* const childToRemove,
  3242. const bool shouldDeleteTheChild) throw();
  3243. void deleteAllChildElements() throw();
  3244. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3245. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3246. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3247. template <class ElementComparator>
  3248. void sortChildElements (ElementComparator& comparator,
  3249. const bool retainOrderOfEquivalentItems = false) throw()
  3250. {
  3251. const int num = getNumChildElements();
  3252. if (num > 1)
  3253. {
  3254. HeapBlock <XmlElement*> elems (num);
  3255. getChildElementsAsArray (elems);
  3256. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3257. reorderChildElements (elems, num);
  3258. }
  3259. }
  3260. bool isTextElement() const throw();
  3261. const String getText() const throw();
  3262. void setText (const String& newText) throw();
  3263. const String getAllSubText() const throw();
  3264. const String getChildElementAllSubText (const String& childTagName,
  3265. const String& defaultReturnValue) const throw();
  3266. void addTextElement (const String& text) throw();
  3267. void deleteAllTextElements() throw();
  3268. static XmlElement* createTextElement (const String& text) throw();
  3269. juce_UseDebuggingNewOperator
  3270. private:
  3271. friend class XmlDocument;
  3272. String tagName;
  3273. XmlElement* firstChildElement;
  3274. XmlElement* nextElement;
  3275. struct XmlAttributeNode
  3276. {
  3277. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3278. XmlAttributeNode (const String& name, const String& value) throw();
  3279. String name, value;
  3280. XmlAttributeNode* next;
  3281. private:
  3282. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3283. };
  3284. XmlAttributeNode* attributes;
  3285. XmlElement (int) throw(); // for internal use
  3286. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3287. void writeElementAsText (OutputStream& out,
  3288. const int indentationLevel,
  3289. const int lineWrapLength) const throw();
  3290. void getChildElementsAsArray (XmlElement**) const throw();
  3291. void reorderChildElements (XmlElement** const, const int) throw();
  3292. };
  3293. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3294. /*** End of inlined file: juce_XmlElement.h ***/
  3295. class JUCE_API PropertySet
  3296. {
  3297. public:
  3298. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3299. PropertySet (const PropertySet& other) throw();
  3300. PropertySet& operator= (const PropertySet& other) throw();
  3301. virtual ~PropertySet();
  3302. const String getValue (const String& keyName,
  3303. const String& defaultReturnValue = String::empty) const throw();
  3304. int getIntValue (const String& keyName,
  3305. const int defaultReturnValue = 0) const throw();
  3306. double getDoubleValue (const String& keyName,
  3307. const double defaultReturnValue = 0.0) const throw();
  3308. bool getBoolValue (const String& keyName,
  3309. const bool defaultReturnValue = false) const throw();
  3310. XmlElement* getXmlValue (const String& keyName) const;
  3311. void setValue (const String& keyName, const String& value) throw();
  3312. void setValue (const String& keyName, const tchar* const value) throw();
  3313. void setValue (const String& keyName, const int value) throw();
  3314. void setValue (const String& keyName, const double value) throw();
  3315. void setValue (const String& keyName, const bool value) throw();
  3316. void setValue (const String& keyName, const XmlElement* const xml);
  3317. void removeValue (const String& keyName) throw();
  3318. bool containsKey (const String& keyName) const throw();
  3319. void clear();
  3320. StringPairArray& getAllProperties() throw() { return properties; }
  3321. const CriticalSection& getLock() const throw() { return lock; }
  3322. XmlElement* createXml (const String& nodeName) const throw();
  3323. void restoreFromXml (const XmlElement& xml) throw();
  3324. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3325. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3326. juce_UseDebuggingNewOperator
  3327. protected:
  3328. virtual void propertyChanged();
  3329. private:
  3330. StringPairArray properties;
  3331. PropertySet* fallbackProperties;
  3332. CriticalSection lock;
  3333. bool ignoreCaseOfKeys;
  3334. };
  3335. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3336. /*** End of inlined file: juce_PropertySet.h ***/
  3337. #endif
  3338. #ifndef __JUCE_RANGE_JUCEHEADER__
  3339. /*** Start of inlined file: juce_Range.h ***/
  3340. #ifndef __JUCE_RANGE_JUCEHEADER__
  3341. #define __JUCE_RANGE_JUCEHEADER__
  3342. template <typename ValueType>
  3343. class Range
  3344. {
  3345. public:
  3346. Range() throw()
  3347. : start (ValueType()), end (ValueType())
  3348. {
  3349. }
  3350. Range (const ValueType start_, const ValueType end_) throw()
  3351. : start (start_), end (jmax (start_, end_))
  3352. {
  3353. }
  3354. Range (const Range& other) throw()
  3355. : start (other.start), end (other.end)
  3356. {
  3357. }
  3358. Range& operator= (const Range& other) throw()
  3359. {
  3360. start = other.start;
  3361. end = other.end;
  3362. return *this;
  3363. }
  3364. ~Range() throw()
  3365. {
  3366. }
  3367. static const Range between (const ValueType position1, const ValueType position2) throw()
  3368. {
  3369. return (position1 < position2) ? Range (position1, position2)
  3370. : Range (position2, position1);
  3371. }
  3372. static const Range emptyRange (const ValueType start) throw()
  3373. {
  3374. return Range (start, start);
  3375. }
  3376. inline ValueType getStart() const throw() { return start; }
  3377. inline ValueType getLength() const throw() { return end - start; }
  3378. inline ValueType getEnd() const throw() { return end; }
  3379. inline bool isEmpty() const throw() { return start == end; }
  3380. void setStart (const ValueType newStart) throw()
  3381. {
  3382. start = newStart;
  3383. if (newStart > end)
  3384. end = newStart;
  3385. }
  3386. const Range withStart (const ValueType newStart) const throw()
  3387. {
  3388. return Range (newStart, jmax (newStart, end));
  3389. }
  3390. void setEnd (const ValueType newEnd) throw()
  3391. {
  3392. end = newEnd;
  3393. if (newEnd < start)
  3394. start = newEnd;
  3395. }
  3396. const Range withEnd (const ValueType newEnd) const throw()
  3397. {
  3398. return Range (jmin (start, newEnd), newEnd);
  3399. }
  3400. void setLength (const ValueType newLength) throw()
  3401. {
  3402. end = start + jmax (ValueType(), newLength);
  3403. }
  3404. const Range withLength (const ValueType newLength) const throw()
  3405. {
  3406. return Range (start, start + newLength);
  3407. }
  3408. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3409. {
  3410. start += amountToAdd;
  3411. end += amountToAdd;
  3412. return *this;
  3413. }
  3414. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3415. {
  3416. start -= amountToSubtract;
  3417. end -= amountToSubtract;
  3418. return *this;
  3419. }
  3420. const Range operator+ (const ValueType amountToAdd) const throw()
  3421. {
  3422. return Range (start + amountToAdd, end + amountToAdd);
  3423. }
  3424. const Range operator- (const ValueType amountToSubtract) const throw()
  3425. {
  3426. return Range (start - amountToSubtract, end - amountToSubtract);
  3427. }
  3428. bool contains (const ValueType position) const throw()
  3429. {
  3430. return position >= start && position < end;
  3431. }
  3432. ValueType clipValue (const ValueType value) const throw()
  3433. {
  3434. return jlimit (start, end, value);
  3435. }
  3436. bool intersects (const Range& other) const throw()
  3437. {
  3438. return other.start < end && other.end > start;
  3439. }
  3440. const Range getIntersectionWith (const Range& other) const throw()
  3441. {
  3442. return Range (jmax (start, other.start),
  3443. jmin (end, other.end));
  3444. }
  3445. const Range getUnionWith (const Range& other) const throw()
  3446. {
  3447. return Range (jmin (start, other.start),
  3448. jmax (end, other.end));
  3449. }
  3450. juce_UseDebuggingNewOperator
  3451. private:
  3452. ValueType start, end;
  3453. };
  3454. #endif // __JUCE_RANGE_JUCEHEADER__
  3455. /*** End of inlined file: juce_Range.h ***/
  3456. #endif
  3457. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3458. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3459. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3460. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3461. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3462. class ReferenceCountedArray
  3463. {
  3464. public:
  3465. ReferenceCountedArray() throw()
  3466. : numUsed (0)
  3467. {
  3468. }
  3469. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3470. {
  3471. const ScopedLockType lock (other.getLock());
  3472. numUsed = other.numUsed;
  3473. data.setAllocatedSize (numUsed);
  3474. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3475. for (int i = numUsed; --i >= 0;)
  3476. if (data.elements[i] != 0)
  3477. data.elements[i]->incReferenceCount();
  3478. }
  3479. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3480. {
  3481. if (this != &other)
  3482. {
  3483. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3484. swapWithArray (other);
  3485. }
  3486. return *this;
  3487. }
  3488. ~ReferenceCountedArray()
  3489. {
  3490. clear();
  3491. }
  3492. void clear()
  3493. {
  3494. const ScopedLockType lock (getLock());
  3495. while (numUsed > 0)
  3496. if (data.elements [--numUsed] != 0)
  3497. data.elements [numUsed]->decReferenceCount();
  3498. jassert (numUsed == 0);
  3499. data.setAllocatedSize (0);
  3500. }
  3501. inline int size() const throw()
  3502. {
  3503. return numUsed;
  3504. }
  3505. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3506. {
  3507. const ScopedLockType lock (getLock());
  3508. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3509. : static_cast <ObjectClass*> (0);
  3510. }
  3511. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3512. {
  3513. const ScopedLockType lock (getLock());
  3514. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3515. return data.elements [index];
  3516. }
  3517. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3518. {
  3519. const ScopedLockType lock (getLock());
  3520. return numUsed > 0 ? data.elements [0]
  3521. : static_cast <ObjectClass*> (0);
  3522. }
  3523. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3524. {
  3525. const ScopedLockType lock (getLock());
  3526. return numUsed > 0 ? data.elements [numUsed - 1]
  3527. : static_cast <ObjectClass*> (0);
  3528. }
  3529. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3530. {
  3531. const ScopedLockType lock (getLock());
  3532. ObjectClass** e = data.elements.getData();
  3533. ObjectClass** const end = e + numUsed;
  3534. while (e != end)
  3535. {
  3536. if (objectToLookFor == *e)
  3537. return (int) (e - data.elements.getData());
  3538. ++e;
  3539. }
  3540. return -1;
  3541. }
  3542. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3543. {
  3544. const ScopedLockType lock (getLock());
  3545. ObjectClass** e = data.elements.getData();
  3546. ObjectClass** const end = e + numUsed;
  3547. while (e != end)
  3548. {
  3549. if (objectToLookFor == *e)
  3550. return true;
  3551. ++e;
  3552. }
  3553. return false;
  3554. }
  3555. void add (ObjectClass* const newObject) throw()
  3556. {
  3557. const ScopedLockType lock (getLock());
  3558. data.ensureAllocatedSize (numUsed + 1);
  3559. data.elements [numUsed++] = newObject;
  3560. if (newObject != 0)
  3561. newObject->incReferenceCount();
  3562. }
  3563. void insert (int indexToInsertAt,
  3564. ObjectClass* const newObject) throw()
  3565. {
  3566. if (indexToInsertAt >= 0)
  3567. {
  3568. const ScopedLockType lock (getLock());
  3569. if (indexToInsertAt > numUsed)
  3570. indexToInsertAt = numUsed;
  3571. data.ensureAllocatedSize (numUsed + 1);
  3572. ObjectClass** const e = data.elements + indexToInsertAt;
  3573. const int numToMove = numUsed - indexToInsertAt;
  3574. if (numToMove > 0)
  3575. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3576. *e = newObject;
  3577. if (newObject != 0)
  3578. newObject->incReferenceCount();
  3579. ++numUsed;
  3580. }
  3581. else
  3582. {
  3583. add (newObject);
  3584. }
  3585. }
  3586. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3587. {
  3588. const ScopedLockType lock (getLock());
  3589. if (! contains (newObject))
  3590. add (newObject);
  3591. }
  3592. void set (const int indexToChange,
  3593. ObjectClass* const newObject)
  3594. {
  3595. if (indexToChange >= 0)
  3596. {
  3597. const ScopedLockType lock (getLock());
  3598. if (newObject != 0)
  3599. newObject->incReferenceCount();
  3600. if (indexToChange < numUsed)
  3601. {
  3602. if (data.elements [indexToChange] != 0)
  3603. data.elements [indexToChange]->decReferenceCount();
  3604. data.elements [indexToChange] = newObject;
  3605. }
  3606. else
  3607. {
  3608. data.ensureAllocatedSize (numUsed + 1);
  3609. data.elements [numUsed++] = newObject;
  3610. }
  3611. }
  3612. }
  3613. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3614. int startIndex = 0,
  3615. int numElementsToAdd = -1) throw()
  3616. {
  3617. arrayToAddFrom.lockArray();
  3618. const ScopedLockType lock (getLock());
  3619. if (startIndex < 0)
  3620. {
  3621. jassertfalse
  3622. startIndex = 0;
  3623. }
  3624. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3625. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3626. if (numElementsToAdd > 0)
  3627. {
  3628. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3629. while (--numElementsToAdd >= 0)
  3630. add (arrayToAddFrom.getUnchecked (startIndex++));
  3631. }
  3632. arrayToAddFrom.unlockArray();
  3633. }
  3634. template <class ElementComparator>
  3635. void addSorted (ElementComparator& comparator,
  3636. ObjectClass* newObject) throw()
  3637. {
  3638. const ScopedLockType lock (getLock());
  3639. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3640. }
  3641. template <class ElementComparator>
  3642. void addOrReplaceSorted (ElementComparator& comparator,
  3643. ObjectClass* newObject) throw()
  3644. {
  3645. const ScopedLockType lock (getLock());
  3646. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3647. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3648. set (index - 1, newObject); // replace an existing object that matches
  3649. else
  3650. insert (index, newObject); // no match, so insert the new one
  3651. }
  3652. void remove (const int indexToRemove)
  3653. {
  3654. const ScopedLockType lock (getLock());
  3655. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3656. {
  3657. ObjectClass** const e = data.elements + indexToRemove;
  3658. if (*e != 0)
  3659. (*e)->decReferenceCount();
  3660. --numUsed;
  3661. const int numberToShift = numUsed - indexToRemove;
  3662. if (numberToShift > 0)
  3663. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3664. if ((numUsed << 1) < data.numAllocated)
  3665. minimiseStorageOverheads();
  3666. }
  3667. }
  3668. void removeObject (ObjectClass* const objectToRemove)
  3669. {
  3670. const ScopedLockType lock (getLock());
  3671. remove (indexOf (objectToRemove));
  3672. }
  3673. void removeRange (const int startIndex,
  3674. const int numberToRemove)
  3675. {
  3676. const ScopedLockType lock (getLock());
  3677. const int start = jlimit (0, numUsed, startIndex);
  3678. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3679. if (end > start)
  3680. {
  3681. int i;
  3682. for (i = start; i < end; ++i)
  3683. {
  3684. if (data.elements[i] != 0)
  3685. {
  3686. data.elements[i]->decReferenceCount();
  3687. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3688. }
  3689. }
  3690. const int rangeSize = end - start;
  3691. ObjectClass** e = data.elements + start;
  3692. i = numUsed - end;
  3693. numUsed -= rangeSize;
  3694. while (--i >= 0)
  3695. {
  3696. *e = e [rangeSize];
  3697. ++e;
  3698. }
  3699. if ((numUsed << 1) < data.numAllocated)
  3700. minimiseStorageOverheads();
  3701. }
  3702. }
  3703. void removeLast (int howManyToRemove = 1)
  3704. {
  3705. const ScopedLockType lock (getLock());
  3706. if (howManyToRemove > numUsed)
  3707. howManyToRemove = numUsed;
  3708. while (--howManyToRemove >= 0)
  3709. remove (numUsed - 1);
  3710. }
  3711. void swap (const int index1,
  3712. const int index2) throw()
  3713. {
  3714. const ScopedLockType lock (getLock());
  3715. if (((unsigned int) index1) < (unsigned int) numUsed
  3716. && ((unsigned int) index2) < (unsigned int) numUsed)
  3717. {
  3718. swapVariables (data.elements [index1],
  3719. data.elements [index2]);
  3720. }
  3721. }
  3722. void move (const int currentIndex,
  3723. int newIndex) throw()
  3724. {
  3725. if (currentIndex != newIndex)
  3726. {
  3727. const ScopedLockType lock (getLock());
  3728. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3729. {
  3730. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3731. newIndex = numUsed - 1;
  3732. ObjectClass* const value = data.elements [currentIndex];
  3733. if (newIndex > currentIndex)
  3734. {
  3735. memmove (data.elements + currentIndex,
  3736. data.elements + currentIndex + 1,
  3737. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3738. }
  3739. else
  3740. {
  3741. memmove (data.elements + newIndex + 1,
  3742. data.elements + newIndex,
  3743. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3744. }
  3745. data.elements [newIndex] = value;
  3746. }
  3747. }
  3748. }
  3749. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3750. {
  3751. const ScopedLockType lock1 (getLock());
  3752. const ScopedLockType lock2 (otherArray.getLock());
  3753. data.swapWith (otherArray.data);
  3754. swapVariables (numUsed, otherArray.numUsed);
  3755. }
  3756. bool operator== (const ReferenceCountedArray& other) const throw()
  3757. {
  3758. const ScopedLockType lock2 (other.getLock());
  3759. const ScopedLockType lock1 (getLock());
  3760. if (numUsed != other.numUsed)
  3761. return false;
  3762. for (int i = numUsed; --i >= 0;)
  3763. if (data.elements [i] != other.data.elements [i])
  3764. return false;
  3765. return true;
  3766. }
  3767. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3768. {
  3769. return ! operator== (other);
  3770. }
  3771. template <class ElementComparator>
  3772. void sort (ElementComparator& comparator,
  3773. const bool retainOrderOfEquivalentItems = false) const throw()
  3774. {
  3775. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3776. // avoids getting warning messages about the parameter being unused
  3777. const ScopedLockType lock (getLock());
  3778. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3779. }
  3780. void minimiseStorageOverheads() throw()
  3781. {
  3782. const ScopedLockType lock (getLock());
  3783. data.shrinkToNoMoreThan (numUsed);
  3784. }
  3785. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3786. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3787. juce_UseDebuggingNewOperator
  3788. private:
  3789. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3790. int numUsed;
  3791. };
  3792. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3793. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3794. #endif
  3795. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3796. #endif
  3797. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3798. #endif
  3799. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3800. /*** Start of inlined file: juce_SortedSet.h ***/
  3801. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3802. #define __JUCE_SORTEDSET_JUCEHEADER__
  3803. #if JUCE_MSVC
  3804. #pragma warning (push)
  3805. #pragma warning (disable: 4512)
  3806. #endif
  3807. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3808. class SortedSet
  3809. {
  3810. public:
  3811. SortedSet() throw()
  3812. : numUsed (0)
  3813. {
  3814. }
  3815. SortedSet (const SortedSet& other) throw()
  3816. {
  3817. const ScopedLockType lock (other.getLock());
  3818. numUsed = other.numUsed;
  3819. data.setAllocatedSize (other.numUsed);
  3820. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3821. }
  3822. ~SortedSet() throw()
  3823. {
  3824. }
  3825. SortedSet& operator= (const SortedSet& other) throw()
  3826. {
  3827. if (this != &other)
  3828. {
  3829. const ScopedLockType lock1 (other.getLock());
  3830. const ScopedLockType lock2 (getLock());
  3831. data.ensureAllocatedSize (other.size());
  3832. numUsed = other.numUsed;
  3833. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3834. minimiseStorageOverheads();
  3835. }
  3836. return *this;
  3837. }
  3838. bool operator== (const SortedSet<ElementType>& other) const throw()
  3839. {
  3840. const ScopedLockType lock (getLock());
  3841. if (numUsed != other.numUsed)
  3842. return false;
  3843. for (int i = numUsed; --i >= 0;)
  3844. if (data.elements[i] != other.data.elements[i])
  3845. return false;
  3846. return true;
  3847. }
  3848. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3849. {
  3850. return ! operator== (other);
  3851. }
  3852. void clear() throw()
  3853. {
  3854. const ScopedLockType lock (getLock());
  3855. data.setAllocatedSize (0);
  3856. numUsed = 0;
  3857. }
  3858. void clearQuick() throw()
  3859. {
  3860. const ScopedLockType lock (getLock());
  3861. numUsed = 0;
  3862. }
  3863. inline int size() const throw()
  3864. {
  3865. return numUsed;
  3866. }
  3867. inline ElementType operator[] (const int index) const throw()
  3868. {
  3869. const ScopedLockType lock (getLock());
  3870. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3871. : ElementType();
  3872. }
  3873. inline ElementType getUnchecked (const int index) const throw()
  3874. {
  3875. const ScopedLockType lock (getLock());
  3876. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3877. return data.elements [index];
  3878. }
  3879. inline ElementType getFirst() const throw()
  3880. {
  3881. const ScopedLockType lock (getLock());
  3882. return numUsed > 0 ? data.elements [0] : ElementType();
  3883. }
  3884. inline ElementType getLast() const throw()
  3885. {
  3886. const ScopedLockType lock (getLock());
  3887. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3888. }
  3889. int indexOf (const ElementType elementToLookFor) const throw()
  3890. {
  3891. const ScopedLockType lock (getLock());
  3892. int start = 0;
  3893. int end = numUsed;
  3894. for (;;)
  3895. {
  3896. if (start >= end)
  3897. {
  3898. return -1;
  3899. }
  3900. else if (elementToLookFor == data.elements [start])
  3901. {
  3902. return start;
  3903. }
  3904. else
  3905. {
  3906. const int halfway = (start + end) >> 1;
  3907. if (halfway == start)
  3908. return -1;
  3909. else if (elementToLookFor >= data.elements [halfway])
  3910. start = halfway;
  3911. else
  3912. end = halfway;
  3913. }
  3914. }
  3915. }
  3916. bool contains (const ElementType elementToLookFor) const throw()
  3917. {
  3918. const ScopedLockType lock (getLock());
  3919. int start = 0;
  3920. int end = numUsed;
  3921. for (;;)
  3922. {
  3923. if (start >= end)
  3924. {
  3925. return false;
  3926. }
  3927. else if (elementToLookFor == data.elements [start])
  3928. {
  3929. return true;
  3930. }
  3931. else
  3932. {
  3933. const int halfway = (start + end) >> 1;
  3934. if (halfway == start)
  3935. return false;
  3936. else if (elementToLookFor >= data.elements [halfway])
  3937. start = halfway;
  3938. else
  3939. end = halfway;
  3940. }
  3941. }
  3942. }
  3943. void add (const ElementType newElement) throw()
  3944. {
  3945. const ScopedLockType lock (getLock());
  3946. int start = 0;
  3947. int end = numUsed;
  3948. for (;;)
  3949. {
  3950. if (start >= end)
  3951. {
  3952. jassert (start <= end);
  3953. insertInternal (start, newElement);
  3954. break;
  3955. }
  3956. else if (newElement == data.elements [start])
  3957. {
  3958. break;
  3959. }
  3960. else
  3961. {
  3962. const int halfway = (start + end) >> 1;
  3963. if (halfway == start)
  3964. {
  3965. if (newElement >= data.elements [halfway])
  3966. insertInternal (start + 1, newElement);
  3967. else
  3968. insertInternal (start, newElement);
  3969. break;
  3970. }
  3971. else if (newElement >= data.elements [halfway])
  3972. start = halfway;
  3973. else
  3974. end = halfway;
  3975. }
  3976. }
  3977. }
  3978. void addArray (const ElementType* elementsToAdd,
  3979. int numElementsToAdd) throw()
  3980. {
  3981. const ScopedLockType lock (getLock());
  3982. while (--numElementsToAdd >= 0)
  3983. add (*elementsToAdd++);
  3984. }
  3985. template <class OtherSetType>
  3986. void addSet (const OtherSetType& setToAddFrom,
  3987. int startIndex = 0,
  3988. int numElementsToAdd = -1) throw()
  3989. {
  3990. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  3991. const ScopedLockType lock2 (getLock());
  3992. jassert (this != &setToAddFrom);
  3993. if (this != &setToAddFrom)
  3994. {
  3995. if (startIndex < 0)
  3996. {
  3997. jassertfalse
  3998. startIndex = 0;
  3999. }
  4000. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4001. numElementsToAdd = setToAddFrom.size() - startIndex;
  4002. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4003. }
  4004. }
  4005. ElementType remove (const int indexToRemove) throw()
  4006. {
  4007. const ScopedLockType lock (getLock());
  4008. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4009. {
  4010. --numUsed;
  4011. ElementType* const e = data.elements + indexToRemove;
  4012. ElementType const removed = *e;
  4013. const int numberToShift = numUsed - indexToRemove;
  4014. if (numberToShift > 0)
  4015. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4016. if ((numUsed << 1) < data.numAllocated)
  4017. minimiseStorageOverheads();
  4018. return removed;
  4019. }
  4020. return 0;
  4021. }
  4022. void removeValue (const ElementType valueToRemove) throw()
  4023. {
  4024. const ScopedLockType lock (getLock());
  4025. remove (indexOf (valueToRemove));
  4026. }
  4027. template <class OtherSetType>
  4028. void removeValuesIn (const OtherSetType& otherSet) throw()
  4029. {
  4030. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4031. const ScopedLockType lock2 (getLock());
  4032. if (this == &otherSet)
  4033. {
  4034. clear();
  4035. }
  4036. else
  4037. {
  4038. if (otherSet.size() > 0)
  4039. {
  4040. for (int i = numUsed; --i >= 0;)
  4041. if (otherSet.contains (data.elements [i]))
  4042. remove (i);
  4043. }
  4044. }
  4045. }
  4046. template <class OtherSetType>
  4047. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4048. {
  4049. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4050. const ScopedLockType lock2 (getLock());
  4051. if (this != &otherSet)
  4052. {
  4053. if (otherSet.size() <= 0)
  4054. {
  4055. clear();
  4056. }
  4057. else
  4058. {
  4059. for (int i = numUsed; --i >= 0;)
  4060. if (! otherSet.contains (data.elements [i]))
  4061. remove (i);
  4062. }
  4063. }
  4064. }
  4065. void minimiseStorageOverheads() throw()
  4066. {
  4067. const ScopedLockType lock (getLock());
  4068. data.shrinkToNoMoreThan (numUsed);
  4069. }
  4070. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4071. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4072. juce_UseDebuggingNewOperator
  4073. private:
  4074. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4075. int numUsed;
  4076. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4077. {
  4078. data.ensureAllocatedSize (numUsed + 1);
  4079. ElementType* const insertPos = data.elements + indexToInsertAt;
  4080. const int numberToMove = numUsed - indexToInsertAt;
  4081. if (numberToMove > 0)
  4082. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4083. *insertPos = newElement;
  4084. ++numUsed;
  4085. }
  4086. };
  4087. #if JUCE_MSVC
  4088. #pragma warning (pop)
  4089. #endif
  4090. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4091. /*** End of inlined file: juce_SortedSet.h ***/
  4092. #endif
  4093. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4094. /*** Start of inlined file: juce_SparseSet.h ***/
  4095. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4096. #define __JUCE_SPARSESET_JUCEHEADER__
  4097. template <class Type>
  4098. class SparseSet
  4099. {
  4100. public:
  4101. SparseSet() throw()
  4102. {
  4103. }
  4104. SparseSet (const SparseSet<Type>& other) throw()
  4105. : values (other.values)
  4106. {
  4107. }
  4108. ~SparseSet() throw()
  4109. {
  4110. }
  4111. void clear() throw()
  4112. {
  4113. values.clear();
  4114. }
  4115. bool isEmpty() const throw()
  4116. {
  4117. return values.size() == 0;
  4118. }
  4119. Type size() const throw()
  4120. {
  4121. Type num = 0;
  4122. for (int i = 0; i < values.size(); i += 2)
  4123. num += values[i + 1] - values[i];
  4124. return num;
  4125. }
  4126. Type operator[] (int index) const throw()
  4127. {
  4128. for (int i = 0; i < values.size(); i += 2)
  4129. {
  4130. const Type s = values.getUnchecked(i);
  4131. const Type e = values.getUnchecked(i + 1);
  4132. if (index < e - s)
  4133. return s + index;
  4134. index -= e - s;
  4135. }
  4136. return (Type) 0;
  4137. }
  4138. bool contains (const Type valueToLookFor) const throw()
  4139. {
  4140. bool on = false;
  4141. for (int i = 0; i < values.size(); ++i)
  4142. {
  4143. if (values.getUnchecked(i) > valueToLookFor)
  4144. return on;
  4145. on = ! on;
  4146. }
  4147. return false;
  4148. }
  4149. int getNumRanges() const throw()
  4150. {
  4151. return values.size() >> 1;
  4152. }
  4153. bool getRange (const int rangeIndex,
  4154. Type& startValue,
  4155. Type& numValues) const throw()
  4156. {
  4157. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4158. {
  4159. startValue = values [rangeIndex << 1];
  4160. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4161. return true;
  4162. }
  4163. return false;
  4164. }
  4165. bool getTotalRange (Type& lowestValue,
  4166. Type& highestValue) const throw()
  4167. {
  4168. if (values.size() > 0)
  4169. {
  4170. lowestValue = values.getUnchecked (0);
  4171. highestValue = values.getUnchecked (values.size() - 1);
  4172. return true;
  4173. }
  4174. return false;
  4175. }
  4176. void addRange (const Type firstValue,
  4177. const Type numValuesToAdd) throw()
  4178. {
  4179. jassert (numValuesToAdd >= 0);
  4180. if (numValuesToAdd > 0)
  4181. {
  4182. removeRange (firstValue, numValuesToAdd);
  4183. IntegerElementComparator<Type> sorter;
  4184. values.addSorted (sorter, firstValue);
  4185. values.addSorted (sorter, firstValue + numValuesToAdd);
  4186. simplify();
  4187. }
  4188. }
  4189. void removeRange (const Type firstValue,
  4190. const Type numValuesToRemove) throw()
  4191. {
  4192. jassert (numValuesToRemove >= 0);
  4193. if (numValuesToRemove >= 0
  4194. && firstValue < values.getLast())
  4195. {
  4196. const bool onAtStart = contains (firstValue - 1);
  4197. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4198. const bool onAtEnd = contains (lastValue);
  4199. for (int i = values.size(); --i >= 0;)
  4200. {
  4201. if (values.getUnchecked(i) <= lastValue)
  4202. {
  4203. while (values.getUnchecked(i) >= firstValue)
  4204. {
  4205. values.remove (i);
  4206. if (--i < 0)
  4207. break;
  4208. }
  4209. break;
  4210. }
  4211. }
  4212. IntegerElementComparator<Type> sorter;
  4213. if (onAtStart)
  4214. values.addSorted (sorter, firstValue);
  4215. if (onAtEnd)
  4216. values.addSorted (sorter, lastValue);
  4217. simplify();
  4218. }
  4219. }
  4220. void invertRange (const Type firstValue,
  4221. const Type numValues)
  4222. {
  4223. SparseSet newItems;
  4224. newItems.addRange (firstValue, numValues);
  4225. int i;
  4226. for (i = getNumRanges(); --i >= 0;)
  4227. {
  4228. const int start = values [i << 1];
  4229. const int end = values [(i << 1) + 1];
  4230. newItems.removeRange (start, end);
  4231. }
  4232. removeRange (firstValue, numValues);
  4233. for (i = newItems.getNumRanges(); --i >= 0;)
  4234. {
  4235. const int start = newItems.values [i << 1];
  4236. const int end = newItems.values [(i << 1) + 1];
  4237. addRange (start, end);
  4238. }
  4239. }
  4240. bool overlapsRange (const Type firstValue,
  4241. const Type numValues) throw()
  4242. {
  4243. jassert (numValues >= 0);
  4244. if (numValues > 0)
  4245. {
  4246. for (int i = getNumRanges(); --i >= 0;)
  4247. {
  4248. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4249. return false;
  4250. if (firstValue + numValues > values.getUnchecked (i << 1))
  4251. return true;
  4252. }
  4253. }
  4254. return false;
  4255. }
  4256. bool containsRange (const Type firstValue,
  4257. const Type numValues) throw()
  4258. {
  4259. jassert (numValues >= 0);
  4260. if (numValues > 0)
  4261. {
  4262. for (int i = getNumRanges(); --i >= 0;)
  4263. {
  4264. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4265. return false;
  4266. if (firstValue >= values.getUnchecked (i << 1)
  4267. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4268. return true;
  4269. }
  4270. }
  4271. return false;
  4272. }
  4273. bool operator== (const SparseSet<Type>& other) throw()
  4274. {
  4275. return values == other.values;
  4276. }
  4277. bool operator!= (const SparseSet<Type>& other) throw()
  4278. {
  4279. return values != other.values;
  4280. }
  4281. juce_UseDebuggingNewOperator
  4282. private:
  4283. // alternating start/end values of ranges of values that are present.
  4284. Array<Type, DummyCriticalSection> values;
  4285. void simplify() throw()
  4286. {
  4287. jassert ((values.size() & 1) == 0);
  4288. for (int i = values.size(); --i > 0;)
  4289. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4290. values.removeRange (i - 1, 2);
  4291. }
  4292. };
  4293. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4294. /*** End of inlined file: juce_SparseSet.h ***/
  4295. #endif
  4296. #ifndef __JUCE_VALUE_JUCEHEADER__
  4297. /*** Start of inlined file: juce_Value.h ***/
  4298. #ifndef __JUCE_VALUE_JUCEHEADER__
  4299. #define __JUCE_VALUE_JUCEHEADER__
  4300. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4301. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4302. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4303. /*** Start of inlined file: juce_MessageListener.h ***/
  4304. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4305. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4306. /*** Start of inlined file: juce_Message.h ***/
  4307. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4308. #define __JUCE_MESSAGE_JUCEHEADER__
  4309. class MessageListener;
  4310. class MessageManager;
  4311. class JUCE_API Message
  4312. {
  4313. public:
  4314. Message() throw();
  4315. Message (const int intParameter1,
  4316. const int intParameter2,
  4317. const int intParameter3,
  4318. void* const pointerParameter) throw();
  4319. virtual ~Message() throw();
  4320. // These values can be used for carrying simple data that the application needs to
  4321. // pass around. For more complex messages, just create a subclass.
  4322. int intParameter1; /**< user-defined integer value. */
  4323. int intParameter2; /**< user-defined integer value. */
  4324. int intParameter3; /**< user-defined integer value. */
  4325. void* pointerParameter; /**< user-defined pointer value. */
  4326. juce_UseDebuggingNewOperator
  4327. private:
  4328. friend class MessageListener;
  4329. friend class MessageManager;
  4330. MessageListener* messageRecipient;
  4331. Message (const Message&);
  4332. Message& operator= (const Message&);
  4333. };
  4334. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4335. /*** End of inlined file: juce_Message.h ***/
  4336. class JUCE_API MessageListener
  4337. {
  4338. protected:
  4339. MessageListener() throw();
  4340. public:
  4341. virtual ~MessageListener();
  4342. virtual void handleMessage (const Message& message) = 0;
  4343. void postMessage (Message* const message) const throw();
  4344. bool isValidMessageListener() const throw();
  4345. };
  4346. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4347. /*** End of inlined file: juce_MessageListener.h ***/
  4348. class JUCE_API AsyncUpdater
  4349. {
  4350. public:
  4351. AsyncUpdater() throw();
  4352. virtual ~AsyncUpdater();
  4353. void triggerAsyncUpdate() throw();
  4354. void cancelPendingUpdate() throw();
  4355. void handleUpdateNowIfNeeded();
  4356. virtual void handleAsyncUpdate() = 0;
  4357. private:
  4358. class AsyncUpdaterInternal : public MessageListener
  4359. {
  4360. public:
  4361. AsyncUpdaterInternal() throw() {}
  4362. ~AsyncUpdaterInternal() {}
  4363. void handleMessage (const Message&);
  4364. AsyncUpdater* owner;
  4365. private:
  4366. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4367. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4368. };
  4369. AsyncUpdaterInternal internalAsyncHandler;
  4370. bool asyncMessagePending;
  4371. };
  4372. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4373. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4374. /*** Start of inlined file: juce_ListenerList.h ***/
  4375. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4376. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4377. template <class ListenerClass,
  4378. class ArrayType = Array <ListenerClass*> >
  4379. class ListenerList
  4380. {
  4381. public:
  4382. ListenerList()
  4383. {
  4384. }
  4385. ~ListenerList()
  4386. {
  4387. }
  4388. void add (ListenerClass* const listenerToAdd)
  4389. {
  4390. // Listeners can't be null pointers!
  4391. jassert (listenerToAdd != 0);
  4392. if (listenerToAdd != 0)
  4393. listeners.add (listenerToAdd);
  4394. }
  4395. void remove (ListenerClass* const listenerToRemove)
  4396. {
  4397. // Listeners can't be null pointers!
  4398. jassert (listenerToRemove != 0);
  4399. listeners.removeValue (listenerToRemove);
  4400. }
  4401. int size() const throw()
  4402. {
  4403. return listeners.size();
  4404. }
  4405. bool isEmpty() const throw()
  4406. {
  4407. return listeners.size() == 0;
  4408. }
  4409. bool contains (ListenerClass* const listener) const throw()
  4410. {
  4411. return listeners.contains (listener);
  4412. }
  4413. void call (void (ListenerClass::*callbackFunction) ())
  4414. {
  4415. callChecked (DummyBailOutChecker(), callbackFunction);
  4416. }
  4417. template <class BailOutCheckerType>
  4418. void callChecked (const BailOutCheckerType& bailOutChecker,
  4419. void (ListenerClass::*callbackFunction) ())
  4420. {
  4421. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4422. (iter.getListener()->*callbackFunction) ();
  4423. }
  4424. template <typename P1, typename P2>
  4425. void call (void (ListenerClass::*callbackFunction) (P1),
  4426. P2& param1)
  4427. {
  4428. for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
  4429. (iter.getListener()->*callbackFunction) (param1);
  4430. }
  4431. template <class BailOutCheckerType, typename P1, typename P2>
  4432. void callChecked (const BailOutCheckerType& bailOutChecker,
  4433. void (ListenerClass::*callbackFunction) (P1),
  4434. P2& param1)
  4435. {
  4436. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4437. (iter.getListener()->*callbackFunction) (param1);
  4438. }
  4439. template <typename P1, typename P2, typename P3, typename P4>
  4440. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4441. P3& param1, P4& param2)
  4442. {
  4443. for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
  4444. (iter.getListener()->*callbackFunction) (param1, param2);
  4445. }
  4446. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4>
  4447. void callChecked (const BailOutCheckerType& bailOutChecker,
  4448. void (ListenerClass::*callbackFunction) (P1, P2),
  4449. P3& param1, P4& param2)
  4450. {
  4451. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4452. (iter.getListener()->*callbackFunction) (param1, param2);
  4453. }
  4454. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4455. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4456. P4& param1, P5& param2, P6& param3)
  4457. {
  4458. for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
  4459. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4460. }
  4461. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4462. void callChecked (const BailOutCheckerType& bailOutChecker,
  4463. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4464. P4& param1, P5& param2, P6& param3)
  4465. {
  4466. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4467. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4468. }
  4469. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4470. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4471. P5& param1, P6& param2, P7& param3, P8& param4)
  4472. {
  4473. for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
  4474. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4475. }
  4476. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4477. void callChecked (const BailOutCheckerType& bailOutChecker,
  4478. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4479. P5& param1, P6& param2, P7& param3, P8& param4)
  4480. {
  4481. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4482. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4483. }
  4484. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4485. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4486. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4487. {
  4488. for (Iterator<DummyBailOutChecker> iter (*this, DummyBailOutChecker()); iter.next();)
  4489. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4490. }
  4491. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4492. void callChecked (const BailOutCheckerType& bailOutChecker,
  4493. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4494. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4495. {
  4496. for (Iterator<BailOutCheckerType> iter (*this, bailOutChecker); iter.next();)
  4497. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4498. }
  4499. class DummyBailOutChecker
  4500. {
  4501. public:
  4502. inline bool shouldBailOut() const throw() { return false; }
  4503. };
  4504. template <class BailOutCheckerType>
  4505. class Iterator
  4506. {
  4507. public:
  4508. Iterator (const ListenerList& list_, const BailOutCheckerType& bailOutChecker_)
  4509. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4510. {}
  4511. ~Iterator() {}
  4512. bool next()
  4513. {
  4514. if (index <= 0 || bailOutChecker.shouldBailOut())
  4515. return false;
  4516. const int listSize = list.size();
  4517. if (--index < listSize)
  4518. return true;
  4519. index = listSize - 1;
  4520. return index >= 0;
  4521. }
  4522. ListenerClass* getListener() const throw()
  4523. {
  4524. return list.listeners.getUnchecked (index);
  4525. }
  4526. private:
  4527. const ListenerList& list;
  4528. const BailOutCheckerType& bailOutChecker;
  4529. int index;
  4530. Iterator (const Iterator&);
  4531. Iterator& operator= (const Iterator&);
  4532. };
  4533. private:
  4534. ArrayType listeners;
  4535. ListenerList (const ListenerList&);
  4536. ListenerList& operator= (const ListenerList&);
  4537. };
  4538. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4539. /*** End of inlined file: juce_ListenerList.h ***/
  4540. class JUCE_API Value
  4541. {
  4542. public:
  4543. Value();
  4544. Value (const Value& other);
  4545. Value (const var& initialValue);
  4546. ~Value();
  4547. const var getValue() const;
  4548. operator const var() const;
  4549. const String toString() const;
  4550. void setValue (const var& newValue);
  4551. Value& operator= (const var& newValue);
  4552. void referTo (const Value& valueToReferTo);
  4553. bool refersToSameSourceAs (const Value& other) const;
  4554. bool operator== (const Value& other) const;
  4555. bool operator!= (const Value& other) const;
  4556. class JUCE_API Listener
  4557. {
  4558. public:
  4559. Listener() {}
  4560. virtual ~Listener() {}
  4561. virtual void valueChanged (Value& value) = 0;
  4562. };
  4563. void addListener (Listener* const listener);
  4564. void removeListener (Listener* const listener);
  4565. class JUCE_API ValueSource : public ReferenceCountedObject,
  4566. public AsyncUpdater
  4567. {
  4568. public:
  4569. ValueSource();
  4570. virtual ~ValueSource();
  4571. virtual const var getValue() const = 0;
  4572. virtual void setValue (const var& newValue) = 0;
  4573. void sendChangeMessage (const bool dispatchSynchronously);
  4574. juce_UseDebuggingNewOperator
  4575. protected:
  4576. friend class Value;
  4577. SortedSet <Value*> valuesWithListeners;
  4578. void handleAsyncUpdate();
  4579. ValueSource (const ValueSource&);
  4580. ValueSource& operator= (const ValueSource&);
  4581. };
  4582. explicit Value (ValueSource* const valueSource);
  4583. ValueSource& getValueSource() { return *value; }
  4584. juce_UseDebuggingNewOperator
  4585. private:
  4586. friend class ValueSource;
  4587. ReferenceCountedObjectPtr <ValueSource> value;
  4588. ListenerList <Listener> listeners;
  4589. void callListeners();
  4590. // This is disallowed to avoid confusion about whether it should
  4591. // do a by-value or by-reference copy.
  4592. Value& operator= (const Value& other);
  4593. };
  4594. #endif // __JUCE_VALUE_JUCEHEADER__
  4595. /*** End of inlined file: juce_Value.h ***/
  4596. #endif
  4597. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4598. /*** Start of inlined file: juce_ValueTree.h ***/
  4599. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4600. #define __JUCE_VALUETREE_JUCEHEADER__
  4601. /*** Start of inlined file: juce_UndoManager.h ***/
  4602. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4603. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4604. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4605. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4606. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4607. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4608. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4609. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4610. /*** Start of inlined file: juce_ChangeListener.h ***/
  4611. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4612. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4613. class JUCE_API ChangeListener
  4614. {
  4615. public:
  4616. virtual ~ChangeListener() {}
  4617. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4618. };
  4619. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4620. /*** End of inlined file: juce_ChangeListener.h ***/
  4621. /*** Start of inlined file: juce_ScopedLock.h ***/
  4622. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4623. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4624. class JUCE_API ScopedLock
  4625. {
  4626. public:
  4627. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4628. inline ~ScopedLock() throw() { lock_.exit(); }
  4629. private:
  4630. const CriticalSection& lock_;
  4631. ScopedLock (const ScopedLock&);
  4632. ScopedLock& operator= (const ScopedLock&);
  4633. };
  4634. class ScopedUnlock
  4635. {
  4636. public:
  4637. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4638. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4639. private:
  4640. const CriticalSection& lock_;
  4641. ScopedUnlock (const ScopedLock&);
  4642. ScopedUnlock& operator= (const ScopedUnlock&);
  4643. };
  4644. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4645. /*** End of inlined file: juce_ScopedLock.h ***/
  4646. class JUCE_API ChangeListenerList : public MessageListener
  4647. {
  4648. public:
  4649. ChangeListenerList() throw();
  4650. ~ChangeListenerList() throw();
  4651. void addChangeListener (ChangeListener* const listener) throw();
  4652. void removeChangeListener (ChangeListener* const listener) throw();
  4653. void removeAllChangeListeners() throw();
  4654. void sendChangeMessage (void* objectThatHasChanged) throw();
  4655. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4656. void dispatchPendingMessages();
  4657. void handleMessage (const Message&);
  4658. juce_UseDebuggingNewOperator
  4659. private:
  4660. SortedSet <void*> listeners;
  4661. CriticalSection lock;
  4662. void* lastChangedObject;
  4663. bool messagePending;
  4664. ChangeListenerList (const ChangeListenerList&);
  4665. ChangeListenerList& operator= (const ChangeListenerList&);
  4666. };
  4667. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4668. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4669. class JUCE_API ChangeBroadcaster
  4670. {
  4671. public:
  4672. ChangeBroadcaster() throw();
  4673. virtual ~ChangeBroadcaster();
  4674. void addChangeListener (ChangeListener* const listener) throw();
  4675. void removeChangeListener (ChangeListener* const listener) throw();
  4676. void removeAllChangeListeners() throw();
  4677. void sendChangeMessage (void* objectThatHasChanged) throw();
  4678. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4679. void dispatchPendingMessages();
  4680. private:
  4681. ChangeListenerList changeListenerList;
  4682. ChangeBroadcaster (const ChangeBroadcaster&);
  4683. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4684. };
  4685. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4686. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4687. /*** Start of inlined file: juce_UndoableAction.h ***/
  4688. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4689. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4690. class JUCE_API UndoableAction
  4691. {
  4692. protected:
  4693. UndoableAction() throw() {}
  4694. public:
  4695. virtual ~UndoableAction() {}
  4696. virtual bool perform() = 0;
  4697. virtual bool undo() = 0;
  4698. virtual int getSizeInUnits() { return 10; }
  4699. };
  4700. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4701. /*** End of inlined file: juce_UndoableAction.h ***/
  4702. class JUCE_API UndoManager : public ChangeBroadcaster
  4703. {
  4704. public:
  4705. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4706. const int minimumTransactionsToKeep = 30);
  4707. ~UndoManager();
  4708. void clearUndoHistory();
  4709. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4710. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4711. const int minimumTransactionsToKeep);
  4712. bool perform (UndoableAction* const action,
  4713. const String& actionName = String::empty);
  4714. void beginNewTransaction (const String& actionName = String::empty);
  4715. void setCurrentTransactionName (const String& newName);
  4716. bool canUndo() const;
  4717. const String getUndoDescription() const;
  4718. bool undo();
  4719. bool undoCurrentTransactionOnly();
  4720. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4721. int getNumActionsInCurrentTransaction() const;
  4722. bool canRedo() const;
  4723. const String getRedoDescription() const;
  4724. bool redo();
  4725. juce_UseDebuggingNewOperator
  4726. private:
  4727. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4728. StringArray transactionNames;
  4729. String currentTransactionName;
  4730. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4731. bool newTransaction, reentrancyCheck;
  4732. // disallow copy constructor
  4733. UndoManager (const UndoManager&);
  4734. UndoManager& operator= (const UndoManager&);
  4735. };
  4736. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4737. /*** End of inlined file: juce_UndoManager.h ***/
  4738. class JUCE_API ValueTree
  4739. {
  4740. public:
  4741. ValueTree (const String& type);
  4742. ValueTree (const ValueTree& other);
  4743. ValueTree& operator= (const ValueTree& other);
  4744. ~ValueTree();
  4745. bool operator== (const ValueTree& other) const;
  4746. bool operator!= (const ValueTree& other) const;
  4747. bool isValid() const { return object != 0; }
  4748. ValueTree createCopy() const;
  4749. const String getType() const;
  4750. bool hasType (const String& typeName) const;
  4751. const var& getProperty (const var::identifier& name) const;
  4752. const var& operator[] (const var::identifier& name) const;
  4753. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4754. bool hasProperty (const var::identifier& name) const;
  4755. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4756. void removeAllProperties (UndoManager* const undoManager);
  4757. int getNumProperties() const;
  4758. const var::identifier getPropertyName (int index) const;
  4759. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4760. int getNumChildren() const;
  4761. ValueTree getChild (int index) const;
  4762. ValueTree getChildWithName (const String& type) const;
  4763. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4764. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4765. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4766. void removeChild (const int childIndex, UndoManager* const undoManager);
  4767. void removeAllChildren (UndoManager* const undoManager);
  4768. bool isAChildOf (const ValueTree& possibleParent) const;
  4769. ValueTree getParent() const;
  4770. XmlElement* createXml() const;
  4771. static ValueTree fromXml (const XmlElement& xml);
  4772. void writeToStream (OutputStream& output);
  4773. static ValueTree readFromStream (InputStream& input);
  4774. class JUCE_API Listener
  4775. {
  4776. public:
  4777. virtual ~Listener() {}
  4778. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4779. const var::identifier& property) = 0;
  4780. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4781. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4782. };
  4783. void addListener (Listener* listener);
  4784. void removeListener (Listener* listener);
  4785. template <typename ElementComparator>
  4786. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4787. {
  4788. if (object != 0)
  4789. {
  4790. ComparatorAdapter <ElementComparator> adapter (comparator);
  4791. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4792. object->sendChildChangeMessage();
  4793. }
  4794. }
  4795. juce_UseDebuggingNewOperator
  4796. private:
  4797. friend class ValueTreeSetPropertyAction;
  4798. friend class ValueTreeChildChangeAction;
  4799. class JUCE_API SharedObject : public ReferenceCountedObject
  4800. {
  4801. public:
  4802. SharedObject (const String& type);
  4803. SharedObject (const SharedObject& other);
  4804. ~SharedObject();
  4805. const String type;
  4806. NamedValueSet properties;
  4807. ReferenceCountedArray <SharedObject> children;
  4808. SortedSet <ValueTree*> valueTreesWithListeners;
  4809. SharedObject* parent;
  4810. void sendPropertyChangeMessage (const var::identifier& property);
  4811. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4812. void sendChildChangeMessage();
  4813. void sendChildChangeMessage (ValueTree& tree);
  4814. void sendParentChangeMessage();
  4815. const var& getProperty (const var::identifier& name) const;
  4816. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4817. bool hasProperty (const var::identifier& name) const;
  4818. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4819. void removeAllProperties (UndoManager* const undoManager);
  4820. bool isAChildOf (const SharedObject* const possibleParent) const;
  4821. ValueTree getChildWithName (const String& type) const;
  4822. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4823. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4824. void removeChild (const int childIndex, UndoManager* const undoManager);
  4825. void removeAllChildren (UndoManager* const undoManager);
  4826. XmlElement* createXml() const;
  4827. juce_UseDebuggingNewOperator
  4828. private:
  4829. SharedObject& operator= (const SharedObject&);
  4830. };
  4831. template <typename ElementComparator>
  4832. class ComparatorAdapter
  4833. {
  4834. public:
  4835. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4836. int compareElements (SharedObject* const first, SharedObject* const second)
  4837. {
  4838. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4839. }
  4840. private:
  4841. ElementComparator& comparator;
  4842. };
  4843. friend class SharedObject;
  4844. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4845. ReferenceCountedObjectPtr <SharedObject> object;
  4846. ListenerList <Listener> listeners;
  4847. ValueTree (SharedObject* const object_);
  4848. };
  4849. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4850. /*** End of inlined file: juce_ValueTree.h ***/
  4851. #endif
  4852. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4853. #endif
  4854. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4855. /*** Start of inlined file: juce_VoidArray.h ***/
  4856. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4857. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4858. typedef Array <void*> VoidArray;
  4859. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4860. /*** End of inlined file: juce_VoidArray.h ***/
  4861. #endif
  4862. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4863. #endif
  4864. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4865. #endif
  4866. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4867. /*** Start of inlined file: juce_FileLogger.h ***/
  4868. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4869. #define __JUCE_FILELOGGER_JUCEHEADER__
  4870. class JUCE_API FileLogger : public Logger
  4871. {
  4872. public:
  4873. FileLogger (const File& fileToWriteTo,
  4874. const String& welcomeMessage,
  4875. const int maxInitialFileSizeBytes = 128 * 1024);
  4876. ~FileLogger();
  4877. void logMessage (const String& message);
  4878. const File getLogFile() const { return logFile; }
  4879. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4880. const String& logFileName,
  4881. const String& welcomeMessage,
  4882. const int maxInitialFileSizeBytes = 128 * 1024);
  4883. juce_UseDebuggingNewOperator
  4884. private:
  4885. File logFile;
  4886. CriticalSection logLock;
  4887. ScopedPointer <FileOutputStream> logStream;
  4888. void trimFileSize (int maxFileSizeBytes) const;
  4889. FileLogger (const FileLogger&);
  4890. FileLogger& operator= (const FileLogger&);
  4891. };
  4892. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4893. /*** End of inlined file: juce_FileLogger.h ***/
  4894. #endif
  4895. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4896. /*** Start of inlined file: juce_Initialisation.h ***/
  4897. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4898. #define __JUCE_INITIALISATION_JUCEHEADER__
  4899. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4900. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4901. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4902. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4903. class ScopedJuceInitialiser_NonGUI
  4904. {
  4905. public:
  4906. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4907. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4908. };
  4909. class ScopedJuceInitialiser_GUI
  4910. {
  4911. public:
  4912. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4913. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4914. };
  4915. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4916. /*** End of inlined file: juce_Initialisation.h ***/
  4917. #endif
  4918. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4919. #endif
  4920. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4921. #endif
  4922. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4923. #endif
  4924. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4925. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4926. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4927. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4928. class JUCE_API PerformanceCounter
  4929. {
  4930. public:
  4931. PerformanceCounter (const String& counterName,
  4932. int runsPerPrintout = 100,
  4933. const File& loggingFile = File::nonexistent);
  4934. ~PerformanceCounter();
  4935. void start();
  4936. void stop();
  4937. void printStatistics();
  4938. juce_UseDebuggingNewOperator
  4939. private:
  4940. String name;
  4941. int numRuns, runsPerPrint;
  4942. double totalTime;
  4943. int64 started;
  4944. File outputFile;
  4945. };
  4946. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4947. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4948. #endif
  4949. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4950. #endif
  4951. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4952. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4953. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4954. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4955. class JUCE_API PlatformUtilities
  4956. {
  4957. public:
  4958. static void beep();
  4959. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4960. const String& emailSubject,
  4961. const String& bodyText,
  4962. const StringArray& filesToAttach);
  4963. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4964. static const String cfStringToJuceString (CFStringRef cfString);
  4965. static CFStringRef juceStringToCFString (const String& s);
  4966. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4967. static const String makePathFromFSRef (FSRef* file);
  4968. static const String convertToPrecomposedUnicode (const String& s);
  4969. static OSType getTypeOfFile (const String& filename);
  4970. static bool isBundle (const String& filename);
  4971. static void addItemToDock (const File& file);
  4972. static int getOSXMinorVersionNumber();
  4973. #endif
  4974. #if JUCE_WINDOWS || DOXYGEN
  4975. // Some registry helper functions:
  4976. static const String getRegistryValue (const String& regValuePath,
  4977. const String& defaultValue = String::empty);
  4978. static void setRegistryValue (const String& regValuePath,
  4979. const String& value);
  4980. static bool registryValueExists (const String& regValuePath);
  4981. static void deleteRegistryValue (const String& regValuePath);
  4982. static void deleteRegistryKey (const String& regKeyPath);
  4983. static void registerFileAssociation (const String& fileExtension,
  4984. const String& symbolicDescription,
  4985. const String& fullDescription,
  4986. const File& targetExecutable,
  4987. int iconResourceNumber);
  4988. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  4989. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  4990. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  4991. #endif
  4992. static void fpuReset();
  4993. #if JUCE_LINUX || JUCE_WINDOWS
  4994. static void* loadDynamicLibrary (const String& pathOrFilename);
  4995. static void freeDynamicLibrary (void* libraryHandle);
  4996. static void* getProcedureEntryPoint (void* libraryHandle,
  4997. const String& procedureName);
  4998. #endif
  4999. #if JUCE_LINUX || DOXYGEN
  5000. #endif
  5001. };
  5002. #if JUCE_MAC || JUCE_IPHONE
  5003. class ScopedAutoReleasePool
  5004. {
  5005. public:
  5006. ScopedAutoReleasePool();
  5007. ~ScopedAutoReleasePool();
  5008. private:
  5009. void* pool;
  5010. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5011. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5012. };
  5013. #endif
  5014. #if JUCE_LINUX
  5015. class ScopedXLock
  5016. {
  5017. public:
  5018. ScopedXLock();
  5019. ~ScopedXLock();
  5020. };
  5021. #endif
  5022. #if JUCE_MAC
  5023. class JUCE_API AppleRemoteDevice
  5024. {
  5025. public:
  5026. AppleRemoteDevice();
  5027. virtual ~AppleRemoteDevice();
  5028. enum ButtonType
  5029. {
  5030. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5031. playButton, /**< The play button. */
  5032. plusButton, /**< The plus or volume-up button. */
  5033. minusButton, /**< The minus or volume-down button. */
  5034. rightButton, /**< The right button (if it's held for a short time). */
  5035. leftButton, /**< The left button (if it's held for a short time). */
  5036. rightButton_Long, /**< The right button (if it's held for a long time). */
  5037. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5038. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5039. playButtonSleepMode,
  5040. switched
  5041. };
  5042. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5043. bool start (const bool inExclusiveMode);
  5044. void stop();
  5045. bool isActive() const;
  5046. int getRemoteId() const { return remoteId; }
  5047. juce_UseDebuggingNewOperator
  5048. void handleCallbackInternal();
  5049. private:
  5050. void* device;
  5051. void* queue;
  5052. int remoteId;
  5053. bool open (const bool openInExclusiveMode);
  5054. AppleRemoteDevice (const AppleRemoteDevice&);
  5055. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5056. };
  5057. #endif
  5058. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5059. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5060. #endif
  5061. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5062. /*** Start of inlined file: juce_Random.h ***/
  5063. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5064. #define __JUCE_RANDOM_JUCEHEADER__
  5065. class JUCE_API Random
  5066. {
  5067. public:
  5068. Random (const int64 seedValue) throw();
  5069. ~Random() throw();
  5070. int nextInt() throw();
  5071. int nextInt (const int maxValue) throw();
  5072. int64 nextInt64() throw();
  5073. float nextFloat() throw();
  5074. double nextDouble() throw();
  5075. bool nextBool() throw();
  5076. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  5077. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  5078. static Random& getSystemRandom() throw();
  5079. void setSeed (const int64 newSeed) throw();
  5080. void combineSeed (const int64 seedValue) throw();
  5081. void setSeedRandomly();
  5082. juce_UseDebuggingNewOperator
  5083. private:
  5084. int64 seed;
  5085. };
  5086. #endif // __JUCE_RANDOM_JUCEHEADER__
  5087. /*** End of inlined file: juce_Random.h ***/
  5088. #endif
  5089. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5090. #endif
  5091. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5092. /*** Start of inlined file: juce_Singleton.h ***/
  5093. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5094. #define __JUCE_SINGLETON_JUCEHEADER__
  5095. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5096. \
  5097. static classname* _singletonInstance; \
  5098. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5099. \
  5100. static classname* getInstance() \
  5101. { \
  5102. if (_singletonInstance == 0) \
  5103. {\
  5104. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5105. \
  5106. if (_singletonInstance == 0) \
  5107. { \
  5108. static bool alreadyInside = false; \
  5109. static bool createdOnceAlready = false; \
  5110. \
  5111. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5112. jassert (! problem); \
  5113. if (! problem) \
  5114. { \
  5115. createdOnceAlready = true; \
  5116. alreadyInside = true; \
  5117. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5118. alreadyInside = false; \
  5119. \
  5120. _singletonInstance = newObject; \
  5121. } \
  5122. } \
  5123. } \
  5124. \
  5125. return _singletonInstance; \
  5126. } \
  5127. \
  5128. static inline classname* getInstanceWithoutCreating() throw() \
  5129. { \
  5130. return _singletonInstance; \
  5131. } \
  5132. \
  5133. static void deleteInstance() \
  5134. { \
  5135. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5136. if (_singletonInstance != 0) \
  5137. { \
  5138. classname* const old = _singletonInstance; \
  5139. _singletonInstance = 0; \
  5140. delete old; \
  5141. } \
  5142. } \
  5143. \
  5144. void clearSingletonInstance() throw() \
  5145. { \
  5146. if (_singletonInstance == this) \
  5147. _singletonInstance = 0; \
  5148. }
  5149. #define juce_ImplementSingleton(classname) \
  5150. \
  5151. classname* classname::_singletonInstance = 0; \
  5152. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5153. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5154. \
  5155. static classname* _singletonInstance; \
  5156. \
  5157. static classname* getInstance() \
  5158. { \
  5159. if (_singletonInstance == 0) \
  5160. { \
  5161. static bool alreadyInside = false; \
  5162. static bool createdOnceAlready = false; \
  5163. \
  5164. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5165. jassert (! problem); \
  5166. if (! problem) \
  5167. { \
  5168. createdOnceAlready = true; \
  5169. alreadyInside = true; \
  5170. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5171. alreadyInside = false; \
  5172. \
  5173. _singletonInstance = newObject; \
  5174. } \
  5175. } \
  5176. \
  5177. return _singletonInstance; \
  5178. } \
  5179. \
  5180. static inline classname* getInstanceWithoutCreating() throw() \
  5181. { \
  5182. return _singletonInstance; \
  5183. } \
  5184. \
  5185. static void deleteInstance() \
  5186. { \
  5187. if (_singletonInstance != 0) \
  5188. { \
  5189. classname* const old = _singletonInstance; \
  5190. _singletonInstance = 0; \
  5191. delete old; \
  5192. } \
  5193. } \
  5194. \
  5195. void clearSingletonInstance() throw() \
  5196. { \
  5197. if (_singletonInstance == this) \
  5198. _singletonInstance = 0; \
  5199. }
  5200. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5201. \
  5202. static classname* _singletonInstance; \
  5203. \
  5204. static classname* getInstance() \
  5205. { \
  5206. if (_singletonInstance == 0) \
  5207. _singletonInstance = new classname(); \
  5208. \
  5209. return _singletonInstance; \
  5210. } \
  5211. \
  5212. static inline classname* getInstanceWithoutCreating() throw() \
  5213. { \
  5214. return _singletonInstance; \
  5215. } \
  5216. \
  5217. static void deleteInstance() \
  5218. { \
  5219. if (_singletonInstance != 0) \
  5220. { \
  5221. classname* const old = _singletonInstance; \
  5222. _singletonInstance = 0; \
  5223. delete old; \
  5224. } \
  5225. } \
  5226. \
  5227. void clearSingletonInstance() throw() \
  5228. { \
  5229. if (_singletonInstance == this) \
  5230. _singletonInstance = 0; \
  5231. }
  5232. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5233. \
  5234. classname* classname::_singletonInstance = 0;
  5235. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5236. /*** End of inlined file: juce_Singleton.h ***/
  5237. #endif
  5238. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5239. #endif
  5240. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5241. /*** Start of inlined file: juce_SystemStats.h ***/
  5242. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5243. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5244. class JUCE_API SystemStats
  5245. {
  5246. public:
  5247. static const String getJUCEVersion() throw();
  5248. enum OperatingSystemType
  5249. {
  5250. UnknownOS = 0,
  5251. MacOSX = 0x1000,
  5252. Linux = 0x2000,
  5253. Win95 = 0x4001,
  5254. Win98 = 0x4002,
  5255. WinNT351 = 0x4103,
  5256. WinNT40 = 0x4104,
  5257. Win2000 = 0x4105,
  5258. WinXP = 0x4106,
  5259. WinVista = 0x4107,
  5260. Windows7 = 0x4108,
  5261. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5262. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5263. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5264. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5265. };
  5266. static OperatingSystemType getOperatingSystemType() throw();
  5267. static const String getOperatingSystemName() throw();
  5268. static bool isOperatingSystem64Bit() throw();
  5269. static const String getLogonName();
  5270. static const String getFullUserName();
  5271. // CPU and memory information..
  5272. static int getCpuSpeedInMegaherz() throw();
  5273. static const String getCpuVendor() throw();
  5274. static bool hasMMX() throw();
  5275. static bool hasSSE() throw();
  5276. static bool hasSSE2() throw();
  5277. static bool has3DNow() throw();
  5278. static int getNumCpus() throw();
  5279. static int64 getClockCycleCounter() throw();
  5280. static int getMemorySizeInMegabytes() throw();
  5281. static int getPageSize() throw();
  5282. static int getMACAddresses (int64* addresses, int maxNum,
  5283. #if JUCE_MAC
  5284. const bool littleEndian = true) throw();
  5285. #else
  5286. const bool littleEndian = false) throw();
  5287. #endif
  5288. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5289. static void initialiseStats() throw();
  5290. };
  5291. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5292. /*** End of inlined file: juce_SystemStats.h ***/
  5293. #endif
  5294. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5295. #endif
  5296. #ifndef __JUCE_TIME_JUCEHEADER__
  5297. #endif
  5298. #ifndef __JUCE_UUID_JUCEHEADER__
  5299. /*** Start of inlined file: juce_Uuid.h ***/
  5300. #ifndef __JUCE_UUID_JUCEHEADER__
  5301. #define __JUCE_UUID_JUCEHEADER__
  5302. class JUCE_API Uuid
  5303. {
  5304. public:
  5305. Uuid();
  5306. ~Uuid() throw();
  5307. Uuid (const Uuid& other);
  5308. Uuid& operator= (const Uuid& other);
  5309. bool isNull() const throw();
  5310. bool operator== (const Uuid& other) const;
  5311. bool operator!= (const Uuid& other) const;
  5312. const String toString() const;
  5313. Uuid (const String& uuidString);
  5314. Uuid& operator= (const String& uuidString);
  5315. const uint8* getRawData() const throw() { return value.asBytes; }
  5316. Uuid (const uint8* const rawData);
  5317. Uuid& operator= (const uint8* const rawData);
  5318. juce_UseDebuggingNewOperator
  5319. private:
  5320. union
  5321. {
  5322. uint8 asBytes [16];
  5323. int asInt[4];
  5324. int64 asInt64[2];
  5325. } value;
  5326. };
  5327. #endif // __JUCE_UUID_JUCEHEADER__
  5328. /*** End of inlined file: juce_Uuid.h ***/
  5329. #endif
  5330. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5331. /*** Start of inlined file: juce_BlowFish.h ***/
  5332. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5333. #define __JUCE_BLOWFISH_JUCEHEADER__
  5334. class JUCE_API BlowFish
  5335. {
  5336. public:
  5337. BlowFish (const uint8* keyData, int keyBytes);
  5338. BlowFish (const BlowFish& other);
  5339. BlowFish& operator= (const BlowFish& other);
  5340. ~BlowFish();
  5341. void encrypt (uint32& data1, uint32& data2) const;
  5342. void decrypt (uint32& data1, uint32& data2) const;
  5343. juce_UseDebuggingNewOperator
  5344. private:
  5345. uint32 p[18];
  5346. HeapBlock <uint32> s[4];
  5347. uint32 F (uint32 x) const;
  5348. };
  5349. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5350. /*** End of inlined file: juce_BlowFish.h ***/
  5351. #endif
  5352. #ifndef __JUCE_MD5_JUCEHEADER__
  5353. /*** Start of inlined file: juce_MD5.h ***/
  5354. #ifndef __JUCE_MD5_JUCEHEADER__
  5355. #define __JUCE_MD5_JUCEHEADER__
  5356. class JUCE_API MD5
  5357. {
  5358. public:
  5359. MD5();
  5360. MD5 (const MD5& other);
  5361. MD5& operator= (const MD5& other);
  5362. MD5 (const MemoryBlock& data);
  5363. MD5 (const char* data, const size_t numBytes);
  5364. MD5 (const String& text);
  5365. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5366. MD5 (const File& file);
  5367. ~MD5();
  5368. const MemoryBlock getRawChecksumData() const;
  5369. const String toHexString() const;
  5370. bool operator== (const MD5& other) const;
  5371. bool operator!= (const MD5& other) const;
  5372. juce_UseDebuggingNewOperator
  5373. private:
  5374. uint8 result [16];
  5375. struct ProcessContext
  5376. {
  5377. uint8 buffer [64];
  5378. uint32 state [4];
  5379. uint32 count [2];
  5380. ProcessContext();
  5381. void processBlock (const uint8* const data, size_t dataSize);
  5382. void transform (const uint8* const buffer);
  5383. void finish (uint8* const result);
  5384. };
  5385. void processStream (InputStream& input, int64 numBytesToRead);
  5386. };
  5387. #endif // __JUCE_MD5_JUCEHEADER__
  5388. /*** End of inlined file: juce_MD5.h ***/
  5389. #endif
  5390. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5391. /*** Start of inlined file: juce_Primes.h ***/
  5392. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5393. #define __JUCE_PRIMES_JUCEHEADER__
  5394. class JUCE_API Primes
  5395. {
  5396. public:
  5397. static const BitArray createProbablePrime (int bitLength,
  5398. int certainty,
  5399. const int* randomSeeds = 0,
  5400. int numRandomSeeds = 0) throw();
  5401. static bool isProbablyPrime (const BitArray& number,
  5402. int certainty) throw();
  5403. };
  5404. #endif // __JUCE_PRIMES_JUCEHEADER__
  5405. /*** End of inlined file: juce_Primes.h ***/
  5406. #endif
  5407. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5408. /*** Start of inlined file: juce_RSAKey.h ***/
  5409. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5410. #define __JUCE_RSAKEY_JUCEHEADER__
  5411. class JUCE_API RSAKey
  5412. {
  5413. public:
  5414. RSAKey() throw();
  5415. RSAKey (const String& stringRepresentation) throw();
  5416. ~RSAKey() throw();
  5417. const String toString() const throw();
  5418. bool applyToValue (BitArray& value) const throw();
  5419. static void createKeyPair (RSAKey& publicKey,
  5420. RSAKey& privateKey,
  5421. const int numBits,
  5422. const int* randomSeeds = 0,
  5423. const int numRandomSeeds = 0) throw();
  5424. juce_UseDebuggingNewOperator
  5425. protected:
  5426. BitArray part1, part2;
  5427. };
  5428. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5429. /*** End of inlined file: juce_RSAKey.h ***/
  5430. #endif
  5431. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5432. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5433. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5434. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5435. class JUCE_API DirectoryIterator
  5436. {
  5437. public:
  5438. DirectoryIterator (const File& directory,
  5439. bool isRecursive,
  5440. const String& wildCard = JUCE_T("*"),
  5441. const int whatToLookFor = File::findFiles);
  5442. ~DirectoryIterator();
  5443. bool next();
  5444. const File getFile() const;
  5445. float getEstimatedProgress() const;
  5446. juce_UseDebuggingNewOperator
  5447. private:
  5448. Array <File> filesFound;
  5449. Array <File> dirsFound;
  5450. String wildCard;
  5451. int index;
  5452. const int whatToLookFor;
  5453. ScopedPointer <DirectoryIterator> subIterator;
  5454. DirectoryIterator (const DirectoryIterator&);
  5455. DirectoryIterator& operator= (const DirectoryIterator&);
  5456. };
  5457. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5458. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5459. #endif
  5460. #ifndef __JUCE_FILE_JUCEHEADER__
  5461. #endif
  5462. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5463. /*** Start of inlined file: juce_FileInputStream.h ***/
  5464. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5465. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5466. class JUCE_API FileInputStream : public InputStream
  5467. {
  5468. public:
  5469. FileInputStream (const File& fileToRead);
  5470. ~FileInputStream();
  5471. const File& getFile() const throw() { return file; }
  5472. int64 getTotalLength();
  5473. int read (void* destBuffer, int maxBytesToRead);
  5474. bool isExhausted();
  5475. int64 getPosition();
  5476. bool setPosition (int64 pos);
  5477. juce_UseDebuggingNewOperator
  5478. private:
  5479. File file;
  5480. void* fileHandle;
  5481. int64 currentPosition, totalSize;
  5482. bool needToSeek;
  5483. FileInputStream (const FileInputStream&);
  5484. FileInputStream& operator= (const FileInputStream&);
  5485. };
  5486. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5487. /*** End of inlined file: juce_FileInputStream.h ***/
  5488. #endif
  5489. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5490. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5491. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5492. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5493. class JUCE_API FileOutputStream : public OutputStream
  5494. {
  5495. public:
  5496. FileOutputStream (const File& fileToWriteTo,
  5497. const int bufferSizeToUse = 16384);
  5498. ~FileOutputStream();
  5499. const File& getFile() const { return file; }
  5500. bool failedToOpen() const { return fileHandle == 0; }
  5501. void flush();
  5502. int64 getPosition();
  5503. bool setPosition (int64 pos);
  5504. bool write (const void* data, int numBytes);
  5505. juce_UseDebuggingNewOperator
  5506. private:
  5507. File file;
  5508. void* fileHandle;
  5509. int64 currentPosition;
  5510. int bufferSize, bytesInBuffer;
  5511. HeapBlock <char> buffer;
  5512. };
  5513. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5514. /*** End of inlined file: juce_FileOutputStream.h ***/
  5515. #endif
  5516. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5517. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5518. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5519. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5520. class JUCE_API FileSearchPath
  5521. {
  5522. public:
  5523. FileSearchPath();
  5524. FileSearchPath (const String& path);
  5525. FileSearchPath (const FileSearchPath& other);
  5526. ~FileSearchPath();
  5527. FileSearchPath& operator= (const String& path);
  5528. int getNumPaths() const;
  5529. const File operator[] (const int index) const;
  5530. const String toString() const;
  5531. void add (const File& directoryToAdd,
  5532. const int insertIndex = -1);
  5533. void addIfNotAlreadyThere (const File& directoryToAdd);
  5534. void remove (const int indexToRemove);
  5535. void addPath (const FileSearchPath& other);
  5536. void removeRedundantPaths();
  5537. void removeNonExistentPaths();
  5538. int findChildFiles (Array<File>& results,
  5539. const int whatToLookFor,
  5540. const bool searchRecursively,
  5541. const String& wildCardPattern = JUCE_T("*")) const;
  5542. bool isFileInPath (const File& fileToCheck,
  5543. const bool checkRecursively) const;
  5544. juce_UseDebuggingNewOperator
  5545. private:
  5546. StringArray directories;
  5547. void init (const String& path);
  5548. };
  5549. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5550. /*** End of inlined file: juce_FileSearchPath.h ***/
  5551. #endif
  5552. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5553. /*** Start of inlined file: juce_NamedPipe.h ***/
  5554. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5555. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5556. class JUCE_API NamedPipe
  5557. {
  5558. public:
  5559. NamedPipe();
  5560. ~NamedPipe();
  5561. bool openExisting (const String& pipeName);
  5562. bool createNewPipe (const String& pipeName);
  5563. void close();
  5564. bool isOpen() const;
  5565. const String getName() const;
  5566. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5567. int write (const void* sourceBuffer, int numBytesToWrite,
  5568. int timeOutMilliseconds = 2000);
  5569. void cancelPendingReads();
  5570. juce_UseDebuggingNewOperator
  5571. private:
  5572. void* internal;
  5573. String currentPipeName;
  5574. NamedPipe (const NamedPipe&);
  5575. NamedPipe& operator= (const NamedPipe&);
  5576. bool openInternal (const String& pipeName, const bool createPipe);
  5577. };
  5578. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5579. /*** End of inlined file: juce_NamedPipe.h ***/
  5580. #endif
  5581. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5582. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5583. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5584. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5585. class JUCE_API TemporaryFile
  5586. {
  5587. public:
  5588. enum OptionFlags
  5589. {
  5590. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5591. i.e. its name should start with a dot. */
  5592. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5593. the file is unique, they should go in brackets rather
  5594. than just being appended (see File::getNonexistentSibling() )*/
  5595. };
  5596. TemporaryFile (const String& suffix = String::empty,
  5597. const int optionFlags = 0);
  5598. TemporaryFile (const File& targetFile,
  5599. const int optionFlags = 0);
  5600. ~TemporaryFile();
  5601. const File getFile() const { return temporaryFile; }
  5602. const File getTargetFile() const { return targetFile; }
  5603. bool overwriteTargetFileWithTemporary() const;
  5604. juce_UseDebuggingNewOperator
  5605. private:
  5606. File temporaryFile, targetFile;
  5607. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5608. TemporaryFile (const TemporaryFile&);
  5609. TemporaryFile& operator= (const TemporaryFile&);
  5610. };
  5611. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5612. /*** End of inlined file: juce_TemporaryFile.h ***/
  5613. #endif
  5614. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5615. /*** Start of inlined file: juce_ZipFile.h ***/
  5616. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5617. #define __JUCE_ZIPFILE_JUCEHEADER__
  5618. /*** Start of inlined file: juce_InputSource.h ***/
  5619. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5620. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5621. class JUCE_API InputSource
  5622. {
  5623. public:
  5624. InputSource() throw() {}
  5625. virtual ~InputSource() {}
  5626. virtual InputStream* createInputStream() = 0;
  5627. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5628. virtual int64 hashCode() const = 0;
  5629. juce_UseDebuggingNewOperator
  5630. };
  5631. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5632. /*** End of inlined file: juce_InputSource.h ***/
  5633. class JUCE_API ZipFile
  5634. {
  5635. public:
  5636. ZipFile (InputStream* const inputStream,
  5637. const bool deleteStreamWhenDestroyed) throw();
  5638. ZipFile (const File& file);
  5639. ZipFile (InputSource* const inputSource);
  5640. ~ZipFile() throw();
  5641. struct ZipEntry
  5642. {
  5643. String filename;
  5644. unsigned int uncompressedSize;
  5645. Time fileTime;
  5646. };
  5647. int getNumEntries() const throw();
  5648. const ZipEntry* getEntry (const int index) const throw();
  5649. int getIndexOfFileName (const String& fileName) const throw();
  5650. const ZipEntry* getEntry (const String& fileName) const throw();
  5651. void sortEntriesByFilename();
  5652. InputStream* createStreamForEntry (const int index);
  5653. void uncompressTo (const File& targetDirectory,
  5654. const bool shouldOverwriteFiles = true);
  5655. juce_UseDebuggingNewOperator
  5656. private:
  5657. class ZipInputStream;
  5658. class ZipFilenameComparator;
  5659. class ZipEntryInfo;
  5660. friend class ZipInputStream;
  5661. friend class ZipFilenameComparator;
  5662. friend class ZipEntryInfo;
  5663. OwnedArray <ZipEntryInfo> entries;
  5664. CriticalSection lock;
  5665. InputStream* inputStream;
  5666. ScopedPointer <InputStream> streamToDelete;
  5667. ScopedPointer <InputSource> inputSource;
  5668. #ifdef JUCE_DEBUG
  5669. int numOpenStreams;
  5670. #endif
  5671. void init();
  5672. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5673. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5674. ZipFile (const ZipFile&);
  5675. ZipFile& operator= (const ZipFile&);
  5676. };
  5677. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5678. /*** End of inlined file: juce_ZipFile.h ***/
  5679. #endif
  5680. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5681. /*** Start of inlined file: juce_Socket.h ***/
  5682. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5683. #define __JUCE_SOCKET_JUCEHEADER__
  5684. class JUCE_API StreamingSocket
  5685. {
  5686. public:
  5687. StreamingSocket();
  5688. ~StreamingSocket();
  5689. bool bindToPort (const int localPortNumber);
  5690. bool connect (const String& remoteHostname,
  5691. const int remotePortNumber,
  5692. const int timeOutMillisecs = 3000);
  5693. bool isConnected() const throw() { return connected; }
  5694. void close();
  5695. const String& getHostName() const throw() { return hostName; }
  5696. int getPort() const throw() { return portNumber; }
  5697. bool isLocal() const throw();
  5698. int waitUntilReady (const bool readyForReading,
  5699. const int timeoutMsecs) const;
  5700. int read (void* destBuffer, const int maxBytesToRead,
  5701. const bool blockUntilSpecifiedAmountHasArrived);
  5702. int write (const void* sourceBuffer, const int numBytesToWrite);
  5703. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5704. StreamingSocket* waitForNextConnection() const;
  5705. juce_UseDebuggingNewOperator
  5706. private:
  5707. String hostName;
  5708. int volatile portNumber, handle;
  5709. bool connected, isListener;
  5710. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5711. StreamingSocket (const StreamingSocket&);
  5712. StreamingSocket& operator= (const StreamingSocket&);
  5713. };
  5714. class JUCE_API DatagramSocket
  5715. {
  5716. public:
  5717. DatagramSocket (const int localPortNumber,
  5718. const bool enableBroadcasting = false);
  5719. ~DatagramSocket();
  5720. bool bindToPort (const int localPortNumber);
  5721. bool connect (const String& remoteHostname,
  5722. const int remotePortNumber,
  5723. const int timeOutMillisecs = 3000);
  5724. bool isConnected() const throw() { return connected; }
  5725. void close();
  5726. const String& getHostName() const throw() { return hostName; }
  5727. int getPort() const throw() { return portNumber; }
  5728. bool isLocal() const throw();
  5729. int waitUntilReady (const bool readyForReading,
  5730. const int timeoutMsecs) const;
  5731. int read (void* destBuffer, const int maxBytesToRead,
  5732. const bool blockUntilSpecifiedAmountHasArrived);
  5733. int write (const void* sourceBuffer, const int numBytesToWrite);
  5734. DatagramSocket* waitForNextConnection() const;
  5735. juce_UseDebuggingNewOperator
  5736. private:
  5737. String hostName;
  5738. int volatile portNumber, handle;
  5739. bool connected, allowBroadcast;
  5740. void* serverAddress;
  5741. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5742. DatagramSocket (const DatagramSocket&);
  5743. DatagramSocket& operator= (const DatagramSocket&);
  5744. };
  5745. #endif // __JUCE_SOCKET_JUCEHEADER__
  5746. /*** End of inlined file: juce_Socket.h ***/
  5747. #endif
  5748. #ifndef __JUCE_URL_JUCEHEADER__
  5749. /*** Start of inlined file: juce_URL.h ***/
  5750. #ifndef __JUCE_URL_JUCEHEADER__
  5751. #define __JUCE_URL_JUCEHEADER__
  5752. class JUCE_API URL
  5753. {
  5754. public:
  5755. URL();
  5756. URL (const String& url);
  5757. URL (const URL& other);
  5758. ~URL();
  5759. URL& operator= (const URL& other);
  5760. const String toString (const bool includeGetParameters) const;
  5761. bool isWellFormed() const;
  5762. const String getDomain() const;
  5763. const String getSubPath() const;
  5764. const String getScheme() const;
  5765. const URL withNewSubPath (const String& newPath) const;
  5766. const URL withParameter (const String& parameterName,
  5767. const String& parameterValue) const;
  5768. const URL withFileToUpload (const String& parameterName,
  5769. const File& fileToUpload,
  5770. const String& mimeType) const;
  5771. const StringPairArray& getParameters() const;
  5772. const StringPairArray& getFilesToUpload() const;
  5773. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5774. const URL withPOSTData (const String& postData) const;
  5775. const String getPostData() const { return postData; }
  5776. bool launchInDefaultBrowser() const;
  5777. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5778. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5779. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5780. InputStream* createInputStream (const bool usePostCommand,
  5781. OpenStreamProgressCallback* const progressCallback = 0,
  5782. void* const progressCallbackContext = 0,
  5783. const String& extraHeaders = String::empty,
  5784. const int connectionTimeOutMs = 0) const;
  5785. bool readEntireBinaryStream (MemoryBlock& destData,
  5786. const bool usePostCommand = false) const;
  5787. const String readEntireTextStream (const bool usePostCommand = false) const;
  5788. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5789. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5790. const bool isParameter);
  5791. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5792. juce_UseDebuggingNewOperator
  5793. private:
  5794. String url, postData;
  5795. StringPairArray parameters, filesToUpload, mimeTypes;
  5796. };
  5797. #endif // __JUCE_URL_JUCEHEADER__
  5798. /*** End of inlined file: juce_URL.h ***/
  5799. #endif
  5800. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5801. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5802. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5803. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5804. class JUCE_API BufferedInputStream : public InputStream
  5805. {
  5806. public:
  5807. BufferedInputStream (InputStream* const sourceStream,
  5808. const int bufferSize,
  5809. const bool deleteSourceWhenDestroyed);
  5810. ~BufferedInputStream();
  5811. int64 getTotalLength();
  5812. int64 getPosition();
  5813. bool setPosition (int64 newPosition);
  5814. int read (void* destBuffer, int maxBytesToRead);
  5815. const String readString();
  5816. bool isExhausted();
  5817. juce_UseDebuggingNewOperator
  5818. private:
  5819. InputStream* const source;
  5820. ScopedPointer <InputStream> sourceToDelete;
  5821. int bufferSize;
  5822. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5823. HeapBlock <char> buffer;
  5824. void ensureBuffered();
  5825. BufferedInputStream (const BufferedInputStream&);
  5826. BufferedInputStream& operator= (const BufferedInputStream&);
  5827. };
  5828. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5829. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5830. #endif
  5831. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5832. /*** Start of inlined file: juce_FileInputSource.h ***/
  5833. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5834. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5835. class JUCE_API FileInputSource : public InputSource
  5836. {
  5837. public:
  5838. FileInputSource (const File& file);
  5839. ~FileInputSource();
  5840. InputStream* createInputStream();
  5841. InputStream* createInputStreamFor (const String& relatedItemPath);
  5842. int64 hashCode() const;
  5843. juce_UseDebuggingNewOperator
  5844. private:
  5845. const File file;
  5846. FileInputSource (const FileInputSource&);
  5847. FileInputSource& operator= (const FileInputSource&);
  5848. };
  5849. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5850. /*** End of inlined file: juce_FileInputSource.h ***/
  5851. #endif
  5852. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5853. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5854. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5855. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5856. class GZIPCompressorHelper;
  5857. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5858. {
  5859. public:
  5860. GZIPCompressorOutputStream (OutputStream* const destStream,
  5861. int compressionLevel = 0,
  5862. const bool deleteDestStreamWhenDestroyed = false,
  5863. const bool noWrap = false);
  5864. ~GZIPCompressorOutputStream();
  5865. void flush();
  5866. int64 getPosition();
  5867. bool setPosition (int64 newPosition);
  5868. bool write (const void* destBuffer, int howMany);
  5869. juce_UseDebuggingNewOperator
  5870. private:
  5871. OutputStream* const destStream;
  5872. ScopedPointer <OutputStream> streamToDelete;
  5873. HeapBlock <uint8> buffer;
  5874. ScopedPointer <GZIPCompressorHelper> helper;
  5875. bool doNextBlock();
  5876. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5877. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5878. };
  5879. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5880. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5881. #endif
  5882. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5883. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5884. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5885. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5886. class GZIPDecompressHelper;
  5887. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5888. {
  5889. public:
  5890. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5891. const bool deleteSourceWhenDestroyed,
  5892. const bool noWrap = false,
  5893. const int64 uncompressedStreamLength = -1);
  5894. ~GZIPDecompressorInputStream();
  5895. int64 getPosition();
  5896. bool setPosition (int64 pos);
  5897. int64 getTotalLength();
  5898. bool isExhausted();
  5899. int read (void* destBuffer, int maxBytesToRead);
  5900. juce_UseDebuggingNewOperator
  5901. private:
  5902. InputStream* const sourceStream;
  5903. ScopedPointer <InputStream> streamToDelete;
  5904. const int64 uncompressedStreamLength;
  5905. const bool noWrap;
  5906. bool isEof;
  5907. int activeBufferSize;
  5908. int64 originalSourcePos, currentPos;
  5909. HeapBlock <uint8> buffer;
  5910. ScopedPointer <GZIPDecompressHelper> helper;
  5911. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5912. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5913. };
  5914. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5915. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5916. #endif
  5917. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5918. #endif
  5919. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5920. #endif
  5921. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5922. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5923. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5924. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5925. class JUCE_API MemoryInputStream : public InputStream
  5926. {
  5927. public:
  5928. MemoryInputStream (const void* const sourceData,
  5929. const size_t sourceDataSize,
  5930. const bool keepInternalCopyOfData);
  5931. ~MemoryInputStream();
  5932. int64 getPosition();
  5933. bool setPosition (int64 pos);
  5934. int64 getTotalLength();
  5935. bool isExhausted();
  5936. int read (void* destBuffer, int maxBytesToRead);
  5937. juce_UseDebuggingNewOperator
  5938. private:
  5939. const char* data;
  5940. size_t dataSize, position;
  5941. MemoryBlock internalCopy;
  5942. };
  5943. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5944. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5945. #endif
  5946. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5947. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5948. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5949. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5950. class JUCE_API MemoryOutputStream : public OutputStream
  5951. {
  5952. public:
  5953. MemoryOutputStream (const size_t initialSize = 256,
  5954. const size_t granularity = 256,
  5955. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5956. ~MemoryOutputStream() throw();
  5957. const char* getData() const throw();
  5958. size_t getDataSize() const throw();
  5959. void reset() throw();
  5960. void flush();
  5961. bool write (const void* buffer, int howMany);
  5962. int64 getPosition();
  5963. bool setPosition (int64 newPosition);
  5964. juce_UseDebuggingNewOperator
  5965. private:
  5966. MemoryBlock* data;
  5967. ScopedPointer <MemoryBlock> dataToDelete;
  5968. size_t position, size, blockSize;
  5969. };
  5970. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5971. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  5972. #endif
  5973. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  5974. #endif
  5975. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5976. /*** Start of inlined file: juce_SubregionStream.h ***/
  5977. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5978. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5979. class JUCE_API SubregionStream : public InputStream
  5980. {
  5981. public:
  5982. SubregionStream (InputStream* const sourceStream,
  5983. const int64 startPositionInSourceStream,
  5984. const int64 lengthOfSourceStream,
  5985. const bool deleteSourceWhenDestroyed) throw();
  5986. ~SubregionStream() throw();
  5987. int64 getTotalLength();
  5988. int64 getPosition();
  5989. bool setPosition (int64 newPosition);
  5990. int read (void* destBuffer, int maxBytesToRead);
  5991. bool isExhausted();
  5992. juce_UseDebuggingNewOperator
  5993. private:
  5994. InputStream* const source;
  5995. ScopedPointer <InputStream> sourceToDelete;
  5996. const int64 startPositionInSourceStream, lengthOfSourceStream;
  5997. SubregionStream (const SubregionStream&);
  5998. SubregionStream& operator= (const SubregionStream&);
  5999. };
  6000. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6001. /*** End of inlined file: juce_SubregionStream.h ***/
  6002. #endif
  6003. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6004. #endif
  6005. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6006. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6007. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6008. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6009. #define TRANS(stringLiteral) \
  6010. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6011. class JUCE_API LocalisedStrings
  6012. {
  6013. public:
  6014. LocalisedStrings (const String& fileContents);
  6015. LocalisedStrings (const File& fileToLoad);
  6016. ~LocalisedStrings();
  6017. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6018. static LocalisedStrings* getCurrentMappings();
  6019. static const String translateWithCurrentMappings (const String& text);
  6020. static const String translateWithCurrentMappings (const char* text);
  6021. const String translate (const String& text) const;
  6022. const String getLanguageName() const { return languageName; }
  6023. const StringArray getCountryCodes() const { return countryCodes; }
  6024. void setIgnoresCase (const bool shouldIgnoreCase);
  6025. juce_UseDebuggingNewOperator
  6026. private:
  6027. String languageName;
  6028. StringArray countryCodes;
  6029. StringPairArray translations;
  6030. void loadFromText (const String& fileContents);
  6031. };
  6032. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6033. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6034. #endif
  6035. #ifndef __JUCE_STRING_JUCEHEADER__
  6036. #endif
  6037. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6038. #endif
  6039. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6040. #endif
  6041. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6042. /*** Start of inlined file: juce_XmlDocument.h ***/
  6043. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6044. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6045. class JUCE_API XmlDocument
  6046. {
  6047. public:
  6048. XmlDocument (const String& documentText) throw();
  6049. XmlDocument (const File& file);
  6050. ~XmlDocument() throw();
  6051. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6052. const String& getLastParseError() const throw();
  6053. void setInputSource (InputSource* const newSource) throw();
  6054. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6055. juce_UseDebuggingNewOperator
  6056. private:
  6057. String originalText;
  6058. const tchar* input;
  6059. bool outOfData, errorOccurred;
  6060. bool identifierLookupTable [128];
  6061. String lastError, dtdText;
  6062. StringArray tokenisedDTD;
  6063. bool needToLoadDTD, ignoreEmptyTextElements;
  6064. ScopedPointer <InputSource> inputSource;
  6065. void setLastError (const String& desc, const bool carryOn) throw();
  6066. void skipHeader() throw();
  6067. void skipNextWhiteSpace() throw();
  6068. tchar readNextChar() throw();
  6069. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  6070. void readChildElements (XmlElement* parent) throw();
  6071. int findNextTokenLength() throw();
  6072. void readQuotedString (String& result) throw();
  6073. void readEntity (String& result) throw();
  6074. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  6075. bool isXmlIdentifierChar (const tchar c) const throw();
  6076. const String getFileContents (const String& filename) const;
  6077. const String expandEntity (const String& entity);
  6078. const String expandExternalEntity (const String& entity);
  6079. const String getParameterEntity (const String& entity);
  6080. };
  6081. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6082. /*** End of inlined file: juce_XmlDocument.h ***/
  6083. #endif
  6084. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6085. #endif
  6086. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6087. #endif
  6088. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6089. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6090. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6091. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6092. class JUCE_API InterProcessLock
  6093. {
  6094. public:
  6095. InterProcessLock (const String& name);
  6096. ~InterProcessLock();
  6097. bool enter (int timeOutMillisecs = -1);
  6098. void exit();
  6099. juce_UseDebuggingNewOperator
  6100. private:
  6101. #if JUCE_WINDOWS
  6102. void* internal;
  6103. // #elif JUCE_64BIT
  6104. // long long internal;
  6105. #else
  6106. int internal;
  6107. #endif
  6108. String name;
  6109. int reentrancyLevel;
  6110. InterProcessLock (const InterProcessLock&);
  6111. InterProcessLock& operator= (const InterProcessLock&);
  6112. };
  6113. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6114. /*** End of inlined file: juce_InterProcessLock.h ***/
  6115. #endif
  6116. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6117. /*** Start of inlined file: juce_Process.h ***/
  6118. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6119. #define __JUCE_PROCESS_JUCEHEADER__
  6120. class JUCE_API Process
  6121. {
  6122. public:
  6123. enum ProcessPriority
  6124. {
  6125. LowPriority = 0,
  6126. NormalPriority = 1,
  6127. HighPriority = 2,
  6128. RealtimePriority = 3
  6129. };
  6130. static void setPriority (const ProcessPriority priority);
  6131. static void terminate();
  6132. static bool isForegroundProcess();
  6133. static void raisePrivilege();
  6134. static void lowerPrivilege();
  6135. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6136. };
  6137. #endif // __JUCE_PROCESS_JUCEHEADER__
  6138. /*** End of inlined file: juce_Process.h ***/
  6139. #endif
  6140. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6141. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6142. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6143. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6144. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6145. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6146. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6147. class JUCE_API WaitableEvent
  6148. {
  6149. public:
  6150. WaitableEvent() throw();
  6151. ~WaitableEvent() throw();
  6152. bool wait (const int timeOutMilliseconds = -1) const throw();
  6153. void signal() const throw();
  6154. void reset() const throw();
  6155. juce_UseDebuggingNewOperator
  6156. private:
  6157. void* internal;
  6158. WaitableEvent (const WaitableEvent&);
  6159. WaitableEvent& operator= (const WaitableEvent&);
  6160. };
  6161. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6162. /*** End of inlined file: juce_WaitableEvent.h ***/
  6163. /*** Start of inlined file: juce_Thread.h ***/
  6164. #ifndef __JUCE_THREAD_JUCEHEADER__
  6165. #define __JUCE_THREAD_JUCEHEADER__
  6166. class JUCE_API Thread
  6167. {
  6168. public:
  6169. Thread (const String& threadName);
  6170. virtual ~Thread();
  6171. virtual void run() = 0;
  6172. // Thread control functions..
  6173. void startThread();
  6174. void startThread (const int priority);
  6175. void stopThread (const int timeOutMilliseconds);
  6176. bool isThreadRunning() const;
  6177. void signalThreadShouldExit();
  6178. inline bool threadShouldExit() const { return threadShouldExit_; }
  6179. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6180. bool setPriority (const int priority);
  6181. static bool setCurrentThreadPriority (const int priority);
  6182. void setAffinityMask (const uint32 affinityMask);
  6183. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6184. // this can be called from any thread that needs to pause..
  6185. static void JUCE_CALLTYPE sleep (int milliseconds);
  6186. static void JUCE_CALLTYPE yield();
  6187. bool wait (const int timeOutMilliseconds) const;
  6188. void notify() const;
  6189. typedef void* ThreadID;
  6190. static ThreadID getCurrentThreadId();
  6191. static Thread* getCurrentThread();
  6192. ThreadID getThreadId() const { return threadId_; }
  6193. const String getThreadName() const { return threadName_; }
  6194. static int getNumRunningThreads();
  6195. static void stopAllThreads (const int timeoutInMillisecs);
  6196. juce_UseDebuggingNewOperator
  6197. private:
  6198. const String threadName_;
  6199. void* volatile threadHandle_;
  6200. CriticalSection startStopLock;
  6201. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6202. int threadPriority_;
  6203. ThreadID threadId_;
  6204. uint32 affinityMask_;
  6205. bool volatile threadShouldExit_;
  6206. friend void JUCE_API juce_threadEntryPoint (void*);
  6207. static void threadEntryPoint (Thread* thread);
  6208. static Array<Thread*> runningThreads;
  6209. static CriticalSection runningThreadsLock;
  6210. Thread (const Thread&);
  6211. Thread& operator= (const Thread&);
  6212. };
  6213. #endif // __JUCE_THREAD_JUCEHEADER__
  6214. /*** End of inlined file: juce_Thread.h ***/
  6215. class JUCE_API ReadWriteLock
  6216. {
  6217. public:
  6218. ReadWriteLock() throw();
  6219. ~ReadWriteLock() throw();
  6220. void enterRead() const throw();
  6221. void exitRead() const throw();
  6222. void enterWrite() const throw();
  6223. bool tryEnterWrite() const throw();
  6224. void exitWrite() const throw();
  6225. juce_UseDebuggingNewOperator
  6226. private:
  6227. CriticalSection accessLock;
  6228. WaitableEvent waitEvent;
  6229. mutable int numWaitingWriters, numWriters;
  6230. mutable Thread::ThreadID writerThreadId;
  6231. mutable Array <Thread::ThreadID> readerThreads;
  6232. ReadWriteLock (const ReadWriteLock&);
  6233. ReadWriteLock& operator= (const ReadWriteLock&);
  6234. };
  6235. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6236. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6237. #endif
  6238. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6239. #endif
  6240. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6241. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6242. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6243. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6244. class JUCE_API ScopedReadLock
  6245. {
  6246. public:
  6247. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6248. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6249. private:
  6250. const ReadWriteLock& lock_;
  6251. ScopedReadLock (const ScopedReadLock&);
  6252. ScopedReadLock& operator= (const ScopedReadLock&);
  6253. };
  6254. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6255. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6256. #endif
  6257. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6258. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6259. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6260. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6261. class JUCE_API ScopedTryLock
  6262. {
  6263. public:
  6264. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6265. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6266. bool isLocked() const throw() { return lockWasSuccessful; }
  6267. private:
  6268. const CriticalSection& lock_;
  6269. const bool lockWasSuccessful;
  6270. ScopedTryLock (const ScopedTryLock&);
  6271. ScopedTryLock& operator= (const ScopedTryLock&);
  6272. };
  6273. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6274. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6275. #endif
  6276. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6277. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6278. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6279. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6280. class JUCE_API ScopedWriteLock
  6281. {
  6282. public:
  6283. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6284. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6285. private:
  6286. const ReadWriteLock& lock_;
  6287. ScopedWriteLock (const ScopedWriteLock&);
  6288. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6289. };
  6290. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6291. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6292. #endif
  6293. #ifndef __JUCE_THREAD_JUCEHEADER__
  6294. #endif
  6295. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6296. /*** Start of inlined file: juce_ThreadPool.h ***/
  6297. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6298. #define __JUCE_THREADPOOL_JUCEHEADER__
  6299. class ThreadPool;
  6300. class ThreadPoolThread;
  6301. class JUCE_API ThreadPoolJob
  6302. {
  6303. public:
  6304. ThreadPoolJob (const String& name);
  6305. virtual ~ThreadPoolJob();
  6306. const String getJobName() const;
  6307. void setJobName (const String& newName);
  6308. enum JobStatus
  6309. {
  6310. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6311. removed from the pool. */
  6312. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6313. should be automatically deleted by the pool. */
  6314. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6315. again when a thread is free. */
  6316. };
  6317. virtual JobStatus runJob() = 0;
  6318. bool isRunning() const { return isActive; }
  6319. bool shouldExit() const { return shouldStop; }
  6320. void signalJobShouldExit();
  6321. juce_UseDebuggingNewOperator
  6322. private:
  6323. friend class ThreadPool;
  6324. friend class ThreadPoolThread;
  6325. String jobName;
  6326. ThreadPool* pool;
  6327. bool shouldStop, isActive, shouldBeDeleted;
  6328. ThreadPoolJob (const ThreadPoolJob&);
  6329. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6330. };
  6331. class JUCE_API ThreadPool
  6332. {
  6333. public:
  6334. ThreadPool (const int numberOfThreads,
  6335. const bool startThreadsOnlyWhenNeeded = true,
  6336. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6337. ~ThreadPool();
  6338. class JUCE_API JobSelector
  6339. {
  6340. public:
  6341. virtual ~JobSelector() {}
  6342. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6343. };
  6344. void addJob (ThreadPoolJob* const job);
  6345. bool removeJob (ThreadPoolJob* const job,
  6346. const bool interruptIfRunning,
  6347. const int timeOutMilliseconds);
  6348. bool removeAllJobs (const bool interruptRunningJobs,
  6349. const int timeOutMilliseconds,
  6350. const bool deleteInactiveJobs = false,
  6351. JobSelector* selectedJobsToRemove = 0);
  6352. int getNumJobs() const;
  6353. ThreadPoolJob* getJob (const int index) const;
  6354. bool contains (const ThreadPoolJob* const job) const;
  6355. bool isJobRunning (const ThreadPoolJob* const job) const;
  6356. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6357. const int timeOutMilliseconds) const;
  6358. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6359. bool setThreadPriorities (const int newPriority);
  6360. juce_UseDebuggingNewOperator
  6361. private:
  6362. const int threadStopTimeout;
  6363. int priority;
  6364. class ThreadPoolThread;
  6365. OwnedArray <ThreadPoolThread> threads;
  6366. Array <ThreadPoolJob*> jobs;
  6367. CriticalSection lock;
  6368. uint32 lastJobEndTime;
  6369. WaitableEvent jobFinishedSignal;
  6370. friend class ThreadPoolThread;
  6371. bool runNextJob();
  6372. ThreadPool (const ThreadPool&);
  6373. ThreadPool& operator= (const ThreadPool&);
  6374. };
  6375. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6376. /*** End of inlined file: juce_ThreadPool.h ***/
  6377. #endif
  6378. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6379. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6380. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6381. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6382. class JUCE_API TimeSliceClient
  6383. {
  6384. public:
  6385. virtual ~TimeSliceClient() {}
  6386. virtual bool useTimeSlice() = 0;
  6387. };
  6388. class JUCE_API TimeSliceThread : public Thread
  6389. {
  6390. public:
  6391. TimeSliceThread (const String& threadName);
  6392. ~TimeSliceThread();
  6393. void addTimeSliceClient (TimeSliceClient* const client);
  6394. void removeTimeSliceClient (TimeSliceClient* const client);
  6395. int getNumClients() const;
  6396. TimeSliceClient* getClient (const int index) const;
  6397. void run();
  6398. juce_UseDebuggingNewOperator
  6399. private:
  6400. CriticalSection callbackLock, listLock;
  6401. Array <TimeSliceClient*> clients;
  6402. int index;
  6403. TimeSliceClient* clientBeingCalled;
  6404. bool clientsChanged;
  6405. TimeSliceThread (const TimeSliceThread&);
  6406. TimeSliceThread& operator= (const TimeSliceThread&);
  6407. };
  6408. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6409. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6410. #endif
  6411. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6412. #endif
  6413. #endif
  6414. /*** End of inlined file: juce_core_includes.h ***/
  6415. // if you're compiling a command-line app, you might want to just include the core headers,
  6416. // so you can set this macro before including juce.h
  6417. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6418. /*** Start of inlined file: juce_app_includes.h ***/
  6419. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6420. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6421. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6422. /*** Start of inlined file: juce_Application.h ***/
  6423. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6424. #define __JUCE_APPLICATION_JUCEHEADER__
  6425. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6426. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6427. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6428. /*** Start of inlined file: juce_Component.h ***/
  6429. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6430. #define __JUCE_COMPONENT_JUCEHEADER__
  6431. /*** Start of inlined file: juce_MouseCursor.h ***/
  6432. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6433. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6434. class Image;
  6435. class SharedMouseCursorInternal;
  6436. class ComponentPeer;
  6437. class Component;
  6438. class JUCE_API MouseCursor
  6439. {
  6440. public:
  6441. enum StandardCursorType
  6442. {
  6443. NoCursor = 0, /**< An invisible cursor. */
  6444. NormalCursor, /**< The stardard arrow cursor. */
  6445. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6446. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6447. CrosshairCursor, /**< A pair of crosshairs. */
  6448. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6449. that you're dragging a copy of something. */
  6450. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6451. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6452. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6453. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6454. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6455. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6456. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6457. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6458. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6459. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6460. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6461. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6462. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6463. };
  6464. MouseCursor() throw();
  6465. MouseCursor (const StandardCursorType type) throw();
  6466. MouseCursor (const Image& image,
  6467. const int hotSpotX,
  6468. const int hotSpotY) throw();
  6469. MouseCursor (const MouseCursor& other) throw();
  6470. MouseCursor& operator= (const MouseCursor& other) throw();
  6471. ~MouseCursor() throw();
  6472. bool operator== (const MouseCursor& other) const throw();
  6473. bool operator!= (const MouseCursor& other) const throw();
  6474. static void showWaitCursor() throw();
  6475. static void hideWaitCursor() throw();
  6476. juce_UseDebuggingNewOperator
  6477. private:
  6478. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6479. friend class MouseInputSourceInternal;
  6480. void showInWindow (ComponentPeer* window) const throw();
  6481. void showInAllWindows() const throw();
  6482. void* getHandle() const throw();
  6483. };
  6484. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6485. /*** End of inlined file: juce_MouseCursor.h ***/
  6486. /*** Start of inlined file: juce_MouseListener.h ***/
  6487. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6488. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6489. class MouseEvent;
  6490. class JUCE_API MouseListener
  6491. {
  6492. public:
  6493. virtual ~MouseListener() {}
  6494. virtual void mouseMove (const MouseEvent& e);
  6495. virtual void mouseEnter (const MouseEvent& e);
  6496. virtual void mouseExit (const MouseEvent& e);
  6497. virtual void mouseDown (const MouseEvent& e);
  6498. virtual void mouseDrag (const MouseEvent& e);
  6499. virtual void mouseUp (const MouseEvent& e);
  6500. virtual void mouseDoubleClick (const MouseEvent& e);
  6501. virtual void mouseWheelMove (const MouseEvent& e,
  6502. float wheelIncrementX,
  6503. float wheelIncrementY);
  6504. };
  6505. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6506. /*** End of inlined file: juce_MouseListener.h ***/
  6507. /*** Start of inlined file: juce_MouseEvent.h ***/
  6508. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6509. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6510. class Component;
  6511. class MouseInputSource;
  6512. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6513. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6514. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6515. class JUCE_API ModifierKeys
  6516. {
  6517. public:
  6518. ModifierKeys (const int flags = 0) throw();
  6519. ModifierKeys (const ModifierKeys& other) throw();
  6520. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6521. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6522. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6523. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6524. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6525. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6526. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6527. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6528. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6529. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6530. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6531. enum Flags
  6532. {
  6533. shiftModifier = 1,
  6534. ctrlModifier = 2,
  6535. altModifier = 4,
  6536. leftButtonModifier = 16,
  6537. rightButtonModifier = 32,
  6538. middleButtonModifier = 64,
  6539. #if JUCE_MAC
  6540. commandModifier = 8,
  6541. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6542. #else
  6543. commandModifier = ctrlModifier,
  6544. popupMenuClickModifier = rightButtonModifier,
  6545. #endif
  6546. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6547. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6548. };
  6549. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6550. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6551. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6552. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6553. inline int getRawFlags() const throw() { return flags; }
  6554. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6555. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6556. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6557. int getNumMouseButtonsDown() const throw();
  6558. static const ModifierKeys getCurrentModifiers() throw();
  6559. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6560. private:
  6561. int flags;
  6562. static ModifierKeys currentModifiers;
  6563. friend class ComponentPeer;
  6564. friend class MouseInputSource;
  6565. friend class MouseInputSourceInternal;
  6566. static void updateCurrentModifiers() throw();
  6567. };
  6568. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6569. /*** End of inlined file: juce_ModifierKeys.h ***/
  6570. /*** Start of inlined file: juce_Point.h ***/
  6571. #ifndef __JUCE_POINT_JUCEHEADER__
  6572. #define __JUCE_POINT_JUCEHEADER__
  6573. /*** Start of inlined file: juce_AffineTransform.h ***/
  6574. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6575. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6576. class JUCE_API AffineTransform
  6577. {
  6578. public:
  6579. AffineTransform() throw();
  6580. AffineTransform (const AffineTransform& other) throw();
  6581. AffineTransform (const float mat00, const float mat01, const float mat02,
  6582. const float mat10, const float mat11, const float mat12) throw();
  6583. AffineTransform& operator= (const AffineTransform& other) throw();
  6584. bool operator== (const AffineTransform& other) const throw();
  6585. bool operator!= (const AffineTransform& other) const throw();
  6586. static const AffineTransform identity;
  6587. void transformPoint (float& x,
  6588. float& y) const throw();
  6589. void transformPoint (double& x,
  6590. double& y) const throw();
  6591. const AffineTransform translated (const float deltaX,
  6592. const float deltaY) const throw();
  6593. static const AffineTransform translation (const float deltaX,
  6594. const float deltaY) throw();
  6595. const AffineTransform rotated (const float angleInRadians) const throw();
  6596. const AffineTransform rotated (const float angleInRadians,
  6597. const float pivotX,
  6598. const float pivotY) const throw();
  6599. static const AffineTransform rotation (const float angleInRadians) throw();
  6600. static const AffineTransform rotation (const float angleInRadians,
  6601. const float pivotX,
  6602. const float pivotY) throw();
  6603. const AffineTransform scaled (const float factorX,
  6604. const float factorY) const throw();
  6605. static const AffineTransform scale (const float factorX,
  6606. const float factorY) throw();
  6607. const AffineTransform sheared (const float shearX,
  6608. const float shearY) const throw();
  6609. const AffineTransform inverted() const throw();
  6610. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6611. bool isIdentity() const throw();
  6612. bool isSingularity() const throw();
  6613. bool isOnlyTranslation() const throw();
  6614. float getTranslationX() const throw() { return mat02; }
  6615. float getTranslationY() const throw() { return mat12; }
  6616. juce_UseDebuggingNewOperator
  6617. float mat00, mat01, mat02;
  6618. float mat10, mat11, mat12;
  6619. private:
  6620. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6621. const float mat10, const float mat11, const float mat12) const throw();
  6622. };
  6623. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6624. /*** End of inlined file: juce_AffineTransform.h ***/
  6625. template <typename ValueType>
  6626. class Point
  6627. {
  6628. public:
  6629. Point() throw() : x (0), y (0) {}
  6630. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6631. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6632. ~Point() throw() {}
  6633. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6634. inline ValueType getX() const throw() { return x; }
  6635. inline ValueType getY() const throw() { return y; }
  6636. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6637. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6638. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6639. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6640. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6641. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6642. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6643. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6644. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6645. const Point operator-() const throw() { return Point (-x, -y); }
  6646. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6647. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6648. const String toString() const { return String (x) + ", " + String (y); }
  6649. juce_UseDebuggingNewOperator
  6650. private:
  6651. ValueType x, y;
  6652. };
  6653. #endif // __JUCE_POINT_JUCEHEADER__
  6654. /*** End of inlined file: juce_Point.h ***/
  6655. class JUCE_API MouseEvent
  6656. {
  6657. public:
  6658. MouseEvent (MouseInputSource& source,
  6659. const Point<int>& position,
  6660. const ModifierKeys& modifiers,
  6661. Component* const originator,
  6662. const Time& eventTime,
  6663. const Point<int> mouseDownPos,
  6664. const Time& mouseDownTime,
  6665. const int numberOfClicks,
  6666. const bool mouseWasDragged) throw();
  6667. ~MouseEvent() throw();
  6668. const int x;
  6669. const int y;
  6670. const ModifierKeys mods;
  6671. Component* const eventComponent;
  6672. Component* const originalComponent;
  6673. const Time eventTime;
  6674. MouseInputSource& source;
  6675. int getMouseDownX() const throw();
  6676. int getMouseDownY() const throw();
  6677. const Point<int> getMouseDownPosition() const throw();
  6678. int getDistanceFromDragStart() const throw();
  6679. int getDistanceFromDragStartX() const throw();
  6680. int getDistanceFromDragStartY() const throw();
  6681. const Point<int> getOffsetFromDragStart() const throw();
  6682. bool mouseWasClicked() const throw();
  6683. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6684. int getLengthOfMousePress() const throw();
  6685. const Point<int> getPosition() const throw();
  6686. int getScreenX() const;
  6687. int getScreenY() const;
  6688. const Point<int> getScreenPosition() const;
  6689. int getMouseDownScreenX() const;
  6690. int getMouseDownScreenY() const;
  6691. const Point<int> getMouseDownScreenPosition() const;
  6692. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6693. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6694. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6695. static int getDoubleClickTimeout() throw();
  6696. juce_UseDebuggingNewOperator
  6697. private:
  6698. const Point<int> mouseDownPos;
  6699. const Time mouseDownTime;
  6700. const int numberOfClicks;
  6701. const bool wasMovedSinceMouseDown;
  6702. MouseEvent& operator= (const MouseEvent&);
  6703. };
  6704. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6705. /*** End of inlined file: juce_MouseEvent.h ***/
  6706. /*** Start of inlined file: juce_ComponentListener.h ***/
  6707. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6708. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6709. class Component;
  6710. class JUCE_API ComponentListener
  6711. {
  6712. public:
  6713. virtual ~ComponentListener() {}
  6714. virtual void componentMovedOrResized (Component& component,
  6715. bool wasMoved,
  6716. bool wasResized);
  6717. virtual void componentBroughtToFront (Component& component);
  6718. virtual void componentVisibilityChanged (Component& component);
  6719. virtual void componentChildrenChanged (Component& component);
  6720. virtual void componentParentHierarchyChanged (Component& component);
  6721. virtual void componentNameChanged (Component& component);
  6722. virtual void componentBeingDeleted (Component& component);
  6723. };
  6724. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6725. /*** End of inlined file: juce_ComponentListener.h ***/
  6726. /*** Start of inlined file: juce_KeyListener.h ***/
  6727. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6728. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6729. /*** Start of inlined file: juce_KeyPress.h ***/
  6730. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6731. #define __JUCE_KEYPRESS_JUCEHEADER__
  6732. class JUCE_API KeyPress
  6733. {
  6734. public:
  6735. KeyPress() throw();
  6736. KeyPress (const int keyCode,
  6737. const ModifierKeys& modifiers,
  6738. const juce_wchar textCharacter) throw();
  6739. KeyPress (const int keyCode) throw();
  6740. KeyPress (const KeyPress& other) throw();
  6741. KeyPress& operator= (const KeyPress& other) throw();
  6742. bool operator== (const KeyPress& other) const throw();
  6743. bool operator!= (const KeyPress& other) const throw();
  6744. bool isValid() const throw() { return keyCode != 0; }
  6745. int getKeyCode() const throw() { return keyCode; }
  6746. const ModifierKeys getModifiers() const throw() { return mods; }
  6747. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6748. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6749. static const KeyPress createFromDescription (const String& textVersion) throw();
  6750. const String getTextDescription() const throw();
  6751. bool isCurrentlyDown() const throw();
  6752. static bool isKeyCurrentlyDown (int keyCode) throw();
  6753. // Key codes
  6754. //
  6755. // Note that the actual values of these are platform-specific and may change
  6756. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6757. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6758. //
  6759. static const int spaceKey; /**< key-code for the space bar */
  6760. static const int escapeKey; /**< key-code for the escape key */
  6761. static const int returnKey; /**< key-code for the return key*/
  6762. static const int tabKey; /**< key-code for the tab key*/
  6763. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6764. static const int backspaceKey; /**< key-code for the backspace key */
  6765. static const int insertKey; /**< key-code for the insert key */
  6766. static const int upKey; /**< key-code for the cursor-up key */
  6767. static const int downKey; /**< key-code for the cursor-down key */
  6768. static const int leftKey; /**< key-code for the cursor-left key */
  6769. static const int rightKey; /**< key-code for the cursor-right key */
  6770. static const int pageUpKey; /**< key-code for the page-up key */
  6771. static const int pageDownKey; /**< key-code for the page-down key */
  6772. static const int homeKey; /**< key-code for the home key */
  6773. static const int endKey; /**< key-code for the end key */
  6774. static const int F1Key; /**< key-code for the F1 key */
  6775. static const int F2Key; /**< key-code for the F2 key */
  6776. static const int F3Key; /**< key-code for the F3 key */
  6777. static const int F4Key; /**< key-code for the F4 key */
  6778. static const int F5Key; /**< key-code for the F5 key */
  6779. static const int F6Key; /**< key-code for the F6 key */
  6780. static const int F7Key; /**< key-code for the F7 key */
  6781. static const int F8Key; /**< key-code for the F8 key */
  6782. static const int F9Key; /**< key-code for the F9 key */
  6783. static const int F10Key; /**< key-code for the F10 key */
  6784. static const int F11Key; /**< key-code for the F11 key */
  6785. static const int F12Key; /**< key-code for the F12 key */
  6786. static const int F13Key; /**< key-code for the F13 key */
  6787. static const int F14Key; /**< key-code for the F14 key */
  6788. static const int F15Key; /**< key-code for the F15 key */
  6789. static const int F16Key; /**< key-code for the F16 key */
  6790. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6791. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6792. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6793. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6794. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6795. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6796. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6797. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6798. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6799. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6800. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6801. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6802. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6803. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6804. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6805. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6806. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6807. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6808. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6809. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6810. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6811. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6812. juce_UseDebuggingNewOperator
  6813. private:
  6814. int keyCode;
  6815. ModifierKeys mods;
  6816. juce_wchar textCharacter;
  6817. };
  6818. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6819. /*** End of inlined file: juce_KeyPress.h ***/
  6820. class Component;
  6821. class JUCE_API KeyListener
  6822. {
  6823. public:
  6824. virtual ~KeyListener() {}
  6825. virtual bool keyPressed (const KeyPress& key,
  6826. Component* originatingComponent) = 0;
  6827. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6828. };
  6829. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6830. /*** End of inlined file: juce_KeyListener.h ***/
  6831. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6832. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6833. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6834. class Component;
  6835. class JUCE_API KeyboardFocusTraverser
  6836. {
  6837. public:
  6838. KeyboardFocusTraverser();
  6839. virtual ~KeyboardFocusTraverser();
  6840. virtual Component* getNextComponent (Component* current);
  6841. virtual Component* getPreviousComponent (Component* current);
  6842. virtual Component* getDefaultComponent (Component* parentComponent);
  6843. };
  6844. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6845. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6846. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6847. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6848. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6849. /*** Start of inlined file: juce_Graphics.h ***/
  6850. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6851. #define __JUCE_GRAPHICS_JUCEHEADER__
  6852. /*** Start of inlined file: juce_Font.h ***/
  6853. #ifndef __JUCE_FONT_JUCEHEADER__
  6854. #define __JUCE_FONT_JUCEHEADER__
  6855. /*** Start of inlined file: juce_Typeface.h ***/
  6856. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6857. #define __JUCE_TYPEFACE_JUCEHEADER__
  6858. /*** Start of inlined file: juce_Path.h ***/
  6859. #ifndef __JUCE_PATH_JUCEHEADER__
  6860. #define __JUCE_PATH_JUCEHEADER__
  6861. /*** Start of inlined file: juce_Rectangle.h ***/
  6862. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6863. #define __JUCE_RECTANGLE_JUCEHEADER__
  6864. class RectangleList;
  6865. template <typename ValueType>
  6866. class Rectangle
  6867. {
  6868. public:
  6869. Rectangle() throw()
  6870. : x (0), y (0), w (0), h (0)
  6871. {
  6872. }
  6873. Rectangle (const Rectangle& other) throw()
  6874. : x (other.x), y (other.y),
  6875. w (other.w), h (other.h)
  6876. {
  6877. }
  6878. Rectangle (const ValueType initialX, const ValueType initialY,
  6879. const ValueType width, const ValueType height) throw()
  6880. : x (initialX), y (initialY),
  6881. w (width), h (height)
  6882. {
  6883. }
  6884. Rectangle (const ValueType width, const ValueType height) throw()
  6885. : x (0), y (0), w (width), h (height)
  6886. {
  6887. }
  6888. Rectangle& operator= (const Rectangle& other) throw()
  6889. {
  6890. x = other.x; y = other.y;
  6891. w = other.w; h = other.h;
  6892. return *this;
  6893. }
  6894. ~Rectangle() throw() {}
  6895. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6896. inline ValueType getX() const throw() { return x; }
  6897. inline ValueType getY() const throw() { return y; }
  6898. inline ValueType getWidth() const throw() { return w; }
  6899. inline ValueType getHeight() const throw() { return h; }
  6900. inline ValueType getRight() const throw() { return x + w; }
  6901. inline ValueType getBottom() const throw() { return y + h; }
  6902. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6903. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6904. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6905. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  6906. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6907. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6908. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6909. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  6910. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6911. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  6912. void setBounds (const ValueType newX, const ValueType newY,
  6913. const ValueType newWidth, const ValueType newHeight) throw()
  6914. {
  6915. x = newX; y = newY; w = newWidth; h = newHeight;
  6916. }
  6917. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6918. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6919. void setLeft (const ValueType newLeft) throw()
  6920. {
  6921. w = jmax (ValueType(), x + w - newLeft);
  6922. x = newLeft;
  6923. }
  6924. void setTop (const ValueType newTop) throw()
  6925. {
  6926. h = jmax (ValueType(), y + h - newTop);
  6927. y = newTop;
  6928. }
  6929. void setRight (const ValueType newRight) throw()
  6930. {
  6931. x = jmin (x, newRight);
  6932. w = newRight - x;
  6933. }
  6934. void setBottom (const ValueType newBottom) throw()
  6935. {
  6936. y = jmin (y, newBottom);
  6937. h = newBottom - y;
  6938. }
  6939. void translate (const ValueType deltaX,
  6940. const ValueType deltaY) throw()
  6941. {
  6942. x += deltaX;
  6943. y += deltaY;
  6944. }
  6945. const Rectangle translated (const ValueType deltaX,
  6946. const ValueType deltaY) const throw()
  6947. {
  6948. return Rectangle (x + deltaX, y + deltaY, w, h);
  6949. }
  6950. void expand (const ValueType deltaX,
  6951. const ValueType deltaY) throw()
  6952. {
  6953. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6954. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6955. setBounds (x - deltaX, y - deltaY, nw, nh);
  6956. }
  6957. const Rectangle expanded (const ValueType deltaX,
  6958. const ValueType deltaY) const throw()
  6959. {
  6960. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6961. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6962. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  6963. }
  6964. void reduce (const ValueType deltaX,
  6965. const ValueType deltaY) throw()
  6966. {
  6967. expand (-deltaX, -deltaY);
  6968. }
  6969. const Rectangle reduced (const ValueType deltaX,
  6970. const ValueType deltaY) const throw()
  6971. {
  6972. return expanded (-deltaX, -deltaY);
  6973. }
  6974. bool operator== (const Rectangle& other) const throw()
  6975. {
  6976. return x == other.x && y == other.y
  6977. && w == other.w && h == other.h;
  6978. }
  6979. bool operator!= (const Rectangle& other) const throw()
  6980. {
  6981. return x != other.x || y != other.y
  6982. || w != other.w || h != other.h;
  6983. }
  6984. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  6985. {
  6986. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  6987. }
  6988. bool contains (const Point<ValueType> point) const throw()
  6989. {
  6990. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  6991. }
  6992. bool contains (const Rectangle& other) const throw()
  6993. {
  6994. return x <= other.x && y <= other.y
  6995. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  6996. }
  6997. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  6998. {
  6999. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7000. jlimit (y, y + h, point.getY()));
  7001. }
  7002. bool intersects (const Rectangle& other) const throw()
  7003. {
  7004. return x + w > other.x
  7005. && y + h > other.y
  7006. && x < other.x + other.w
  7007. && y < other.y + other.h
  7008. && w > ValueType() && h > ValueType();
  7009. }
  7010. const Rectangle getIntersection (const Rectangle& other) const throw()
  7011. {
  7012. const ValueType nx = jmax (x, other.x);
  7013. const ValueType ny = jmax (y, other.y);
  7014. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7015. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7016. if (nw >= ValueType() && nh >= ValueType())
  7017. return Rectangle (nx, ny, nw, nh);
  7018. return Rectangle();
  7019. }
  7020. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7021. {
  7022. const int maxX = jmax (otherX, x);
  7023. otherW = jmin (otherX + otherW, x + w) - maxX;
  7024. if (otherW > 0)
  7025. {
  7026. const int maxY = jmax (otherY, y);
  7027. otherH = jmin (otherY + otherH, y + h) - maxY;
  7028. if (otherH > 0)
  7029. {
  7030. otherX = maxX; otherY = maxY;
  7031. return true;
  7032. }
  7033. }
  7034. return false;
  7035. }
  7036. const Rectangle getUnion (const Rectangle& other) const throw()
  7037. {
  7038. const ValueType newX = jmin (x, other.x);
  7039. const ValueType newY = jmin (y, other.y);
  7040. return Rectangle (newX, newY,
  7041. jmax (x + w, other.x + other.w) - newX,
  7042. jmax (y + h, other.y + other.h) - newY);
  7043. }
  7044. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7045. {
  7046. if (x == other.x && getRight() == other.getRight()
  7047. && (other.getBottom() >= y && other.y <= getBottom()))
  7048. {
  7049. const ValueType newY = jmin (y, other.y);
  7050. h = jmax (getBottom(), other.getBottom()) - newY;
  7051. y = newY;
  7052. return true;
  7053. }
  7054. else if (y == other.y && getBottom() == other.getBottom()
  7055. && (other.getRight() >= x && other.x <= getRight()))
  7056. {
  7057. const ValueType newX = jmin (x, other.x);
  7058. w = jmax (getRight(), other.getRight()) - newX;
  7059. x = newX;
  7060. return true;
  7061. }
  7062. return false;
  7063. }
  7064. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7065. {
  7066. int inside = 0;
  7067. const int otherR = other.getRight();
  7068. if (x >= other.x && x < otherR) inside = 1;
  7069. const int otherB = other.getBottom();
  7070. if (y >= other.y && y < otherB) inside |= 2;
  7071. const int r = x + w;
  7072. if (r >= other.x && r < otherR) inside |= 4;
  7073. const int b = y + h;
  7074. if (b >= other.y && b < otherB) inside |= 8;
  7075. switch (inside)
  7076. {
  7077. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7078. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7079. case 2 + 4 + 8: w = other.x - x; return true;
  7080. case 1 + 4 + 8: h = other.y - y; return true;
  7081. }
  7082. return false;
  7083. }
  7084. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7085. {
  7086. float x1 = x, y1 = y;
  7087. float x2 = x + w, y2 = y;
  7088. float x3 = x, y3 = y + h;
  7089. float x4 = x2, y4 = y3;
  7090. transform.transformPoint (x1, y1);
  7091. transform.transformPoint (x2, y2);
  7092. transform.transformPoint (x3, y3);
  7093. transform.transformPoint (x4, y4);
  7094. const float x = jmin (x1, x2, x3, x4);
  7095. const float y = jmin (y1, y2, y3, y4);
  7096. return Rectangle (x, y,
  7097. jmax (x1, x2, x3, x4) - x,
  7098. jmax (y1, y2, y3, y4) - y);
  7099. }
  7100. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7101. {
  7102. const int x1 = (int) floorf ((float) x);
  7103. const int y1 = (int) floorf ((float) y);
  7104. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7105. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7106. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7107. }
  7108. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7109. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7110. {
  7111. const ValueType x = jmax (x1, x2);
  7112. w1 = jmin (x1 + w1, x2 + w2) - x;
  7113. if (w1 > 0)
  7114. {
  7115. const ValueType y = jmax (y1, y2);
  7116. h1 = jmin (y1 + h1, y2 + h2) - y;
  7117. if (h1 > 0)
  7118. {
  7119. x1 = x; y1 = y;
  7120. return true;
  7121. }
  7122. }
  7123. return false;
  7124. }
  7125. const String toString() const
  7126. {
  7127. String s;
  7128. s.preallocateStorage (16);
  7129. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  7130. return s;
  7131. }
  7132. static const Rectangle fromString (const String& stringVersion)
  7133. {
  7134. StringArray toks;
  7135. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), 0);
  7136. return Rectangle (toks[0].trim().getIntValue(),
  7137. toks[1].trim().getIntValue(),
  7138. toks[2].trim().getIntValue(),
  7139. toks[3].trim().getIntValue());
  7140. }
  7141. juce_UseDebuggingNewOperator
  7142. private:
  7143. friend class RectangleList;
  7144. ValueType x, y, w, h;
  7145. };
  7146. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7147. /*** End of inlined file: juce_Rectangle.h ***/
  7148. /*** Start of inlined file: juce_Justification.h ***/
  7149. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7150. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7151. class JUCE_API Justification
  7152. {
  7153. public:
  7154. inline Justification (const int flags_) throw() : flags (flags_) {}
  7155. Justification (const Justification& other) throw();
  7156. Justification& operator= (const Justification& other) throw();
  7157. inline int getFlags() const throw() { return flags; }
  7158. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7159. int getOnlyVerticalFlags() const throw();
  7160. int getOnlyHorizontalFlags() const throw();
  7161. void applyToRectangle (int& x, int& y,
  7162. const int w, const int h,
  7163. const int spaceX, const int spaceY,
  7164. const int spaceW, const int spaceH) const throw();
  7165. enum
  7166. {
  7167. left = 1,
  7168. right = 2,
  7169. horizontallyCentred = 4,
  7170. top = 8,
  7171. bottom = 16,
  7172. verticallyCentred = 32,
  7173. horizontallyJustified = 64,
  7174. centred = 36,
  7175. centredLeft = 33,
  7176. centredRight = 34,
  7177. centredTop = 12,
  7178. centredBottom = 20,
  7179. topLeft = 9,
  7180. topRight = 10,
  7181. bottomLeft = 17,
  7182. bottomRight = 18
  7183. };
  7184. private:
  7185. int flags;
  7186. };
  7187. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7188. /*** End of inlined file: juce_Justification.h ***/
  7189. /*** Start of inlined file: juce_EdgeTable.h ***/
  7190. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7191. #define __JUCE_EDGETABLE_JUCEHEADER__
  7192. class Path;
  7193. class RectangleList;
  7194. class Image;
  7195. class JUCE_API EdgeTable
  7196. {
  7197. public:
  7198. EdgeTable (const Rectangle<int>& clipLimits,
  7199. const Path& pathToAdd,
  7200. const AffineTransform& transform) throw();
  7201. EdgeTable (const Rectangle<int>& rectangleToAdd) throw();
  7202. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  7203. EdgeTable (const float x, const float y,
  7204. const float w, const float h) throw();
  7205. EdgeTable (const EdgeTable& other) throw();
  7206. EdgeTable& operator= (const EdgeTable& other) throw();
  7207. ~EdgeTable() throw();
  7208. void clipToRectangle (const Rectangle<int>& r) throw();
  7209. void excludeRectangle (const Rectangle<int>& r) throw();
  7210. void clipToEdgeTable (const EdgeTable& other);
  7211. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7212. bool isEmpty() throw();
  7213. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7214. void translate (float dx, int dy) throw();
  7215. void optimiseTable() throw();
  7216. template <class EdgeTableIterationCallback>
  7217. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7218. {
  7219. const int* lineStart = table;
  7220. for (int y = 0; y < bounds.getHeight(); ++y)
  7221. {
  7222. const int* line = lineStart;
  7223. lineStart += lineStrideElements;
  7224. int numPoints = line[0];
  7225. if (--numPoints > 0)
  7226. {
  7227. int x = *++line;
  7228. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7229. int levelAccumulator = 0;
  7230. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7231. while (--numPoints >= 0)
  7232. {
  7233. const int level = *++line;
  7234. jassert (((unsigned int) level) < (unsigned int) 256);
  7235. const int endX = *++line;
  7236. jassert (endX >= x);
  7237. const int endOfRun = (endX >> 8);
  7238. if (endOfRun == (x >> 8))
  7239. {
  7240. // small segment within the same pixel, so just save it for the next
  7241. // time round..
  7242. levelAccumulator += (endX - x) * level;
  7243. }
  7244. else
  7245. {
  7246. // plot the fist pixel of this segment, including any accumulated
  7247. // levels from smaller segments that haven't been drawn yet
  7248. levelAccumulator += (0xff - (x & 0xff)) * level;
  7249. levelAccumulator >>= 8;
  7250. x >>= 8;
  7251. if (levelAccumulator > 0)
  7252. {
  7253. if (levelAccumulator >> 8)
  7254. levelAccumulator = 0xff;
  7255. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7256. }
  7257. // if there's a run of similar pixels, do it all in one go..
  7258. if (level > 0)
  7259. {
  7260. jassert (endOfRun <= bounds.getRight());
  7261. const int numPix = endOfRun - ++x;
  7262. if (numPix > 0)
  7263. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7264. }
  7265. // save the bit at the end to be drawn next time round the loop.
  7266. levelAccumulator = (endX & 0xff) * level;
  7267. }
  7268. x = endX;
  7269. }
  7270. if (levelAccumulator > 0)
  7271. {
  7272. levelAccumulator >>= 8;
  7273. if (levelAccumulator >> 8)
  7274. levelAccumulator = 0xff;
  7275. x >>= 8;
  7276. jassert (x >= bounds.getX() && x < bounds.getRight());
  7277. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7278. }
  7279. }
  7280. }
  7281. }
  7282. juce_UseDebuggingNewOperator
  7283. private:
  7284. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7285. HeapBlock<int> table;
  7286. Rectangle<int> bounds;
  7287. int maxEdgesPerLine, lineStrideElements;
  7288. bool needToCheckEmptinesss;
  7289. void addEdgePoint (const int x, const int y, const int winding) throw();
  7290. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7291. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7292. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7293. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7294. static void copyEdgeTableData (int* dest, const int destLineStride, const int* src, const int srcLineStride, int numLines) throw();
  7295. };
  7296. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7297. /*** End of inlined file: juce_EdgeTable.h ***/
  7298. class Image;
  7299. class JUCE_API Path
  7300. {
  7301. public:
  7302. Path() throw();
  7303. Path (const Path& other) throw();
  7304. ~Path() throw();
  7305. Path& operator= (const Path& other) throw();
  7306. bool isEmpty() const throw();
  7307. const Rectangle<float> getBounds() const throw();
  7308. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7309. bool contains (const float x,
  7310. const float y,
  7311. const float tolerence = 10.0f) const throw();
  7312. bool intersectsLine (const float x1, const float y1,
  7313. const float x2, const float y2,
  7314. const float tolerence = 10.0f) throw();
  7315. void clear() throw();
  7316. void startNewSubPath (const float startX,
  7317. const float startY) throw();
  7318. void closeSubPath() throw();
  7319. void lineTo (const float endX,
  7320. const float endY) throw();
  7321. void quadraticTo (const float controlPointX,
  7322. const float controlPointY,
  7323. const float endPointX,
  7324. const float endPointY) throw();
  7325. void cubicTo (const float controlPoint1X,
  7326. const float controlPoint1Y,
  7327. const float controlPoint2X,
  7328. const float controlPoint2Y,
  7329. const float endPointX,
  7330. const float endPointY) throw();
  7331. const Point<float> getCurrentPosition() const;
  7332. void addRectangle (const float x, const float y,
  7333. const float w, const float h) throw();
  7334. void addRectangle (const Rectangle<int>& rectangle) throw();
  7335. void addRoundedRectangle (const float x, const float y,
  7336. const float w, const float h,
  7337. float cornerSize) throw();
  7338. void addRoundedRectangle (const float x, const float y,
  7339. const float w, const float h,
  7340. float cornerSizeX,
  7341. float cornerSizeY) throw();
  7342. void addTriangle (const float x1, const float y1,
  7343. const float x2, const float y2,
  7344. const float x3, const float y3) throw();
  7345. void addQuadrilateral (const float x1, const float y1,
  7346. const float x2, const float y2,
  7347. const float x3, const float y3,
  7348. const float x4, const float y4) throw();
  7349. void addEllipse (const float x, const float y,
  7350. const float width, const float height) throw();
  7351. void addArc (const float x, const float y,
  7352. const float width, const float height,
  7353. const float fromRadians,
  7354. const float toRadians,
  7355. const bool startAsNewSubPath = false) throw();
  7356. void addCentredArc (const float centreX, const float centreY,
  7357. const float radiusX, const float radiusY,
  7358. const float rotationOfEllipse,
  7359. const float fromRadians,
  7360. const float toRadians,
  7361. const bool startAsNewSubPath = false) throw();
  7362. void addPieSegment (const float x, const float y,
  7363. const float width, const float height,
  7364. const float fromRadians,
  7365. const float toRadians,
  7366. const float innerCircleProportionalSize);
  7367. void addLineSegment (const float startX, const float startY,
  7368. const float endX, const float endY,
  7369. float lineThickness) throw();
  7370. void addArrow (const float startX, const float startY,
  7371. const float endX, const float endY,
  7372. float lineThickness,
  7373. float arrowheadWidth,
  7374. float arrowheadLength) throw();
  7375. void addStar (const float centreX,
  7376. const float centreY,
  7377. const int numberOfPoints,
  7378. const float innerRadius,
  7379. const float outerRadius,
  7380. const float startAngle = 0.0f);
  7381. void addBubble (float bodyX, float bodyY,
  7382. float bodyW, float bodyH,
  7383. float cornerSize,
  7384. float arrowTipX,
  7385. float arrowTipY,
  7386. int whichSide,
  7387. float arrowPositionAlongEdgeProportional,
  7388. float arrowWidth);
  7389. void addPath (const Path& pathToAppend) throw();
  7390. void addPath (const Path& pathToAppend,
  7391. const AffineTransform& transformToApply) throw();
  7392. void swapWithPath (Path& other);
  7393. void applyTransform (const AffineTransform& transform) throw();
  7394. void scaleToFit (const float x, const float y,
  7395. const float width, const float height,
  7396. const bool preserveProportions) throw();
  7397. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7398. const float width, const float height,
  7399. const bool preserveProportions,
  7400. const Justification& justificationType = Justification::centred) const throw();
  7401. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7402. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7403. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7404. class JUCE_API Iterator
  7405. {
  7406. public:
  7407. Iterator (const Path& path);
  7408. ~Iterator();
  7409. bool next();
  7410. enum PathElementType
  7411. {
  7412. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7413. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7414. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7415. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7416. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7417. };
  7418. PathElementType elementType;
  7419. float x1, y1, x2, y2, x3, y3;
  7420. private:
  7421. const Path& path;
  7422. int index;
  7423. Iterator (const Iterator&);
  7424. Iterator& operator= (const Iterator&);
  7425. };
  7426. void loadPathFromStream (InputStream& source);
  7427. void loadPathFromData (const unsigned char* const data,
  7428. const int numberOfBytes) throw();
  7429. void writePathToStream (OutputStream& destination) const;
  7430. const String toString() const;
  7431. void restoreFromString (const String& stringVersion);
  7432. juce_UseDebuggingNewOperator
  7433. private:
  7434. friend class PathFlatteningIterator;
  7435. friend class Path::Iterator;
  7436. ArrayAllocationBase <float, DummyCriticalSection> data;
  7437. int numElements;
  7438. float pathXMin, pathXMax, pathYMin, pathYMax;
  7439. bool useNonZeroWinding;
  7440. static const float lineMarker;
  7441. static const float moveMarker;
  7442. static const float quadMarker;
  7443. static const float cubicMarker;
  7444. static const float closeSubPathMarker;
  7445. };
  7446. #endif // __JUCE_PATH_JUCEHEADER__
  7447. /*** End of inlined file: juce_Path.h ***/
  7448. class Font;
  7449. class JUCE_API Typeface : public ReferenceCountedObject
  7450. {
  7451. public:
  7452. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7453. const String getName() const throw() { return name; }
  7454. static const Ptr createSystemTypefaceFor (const Font& font);
  7455. virtual ~Typeface();
  7456. virtual float getAscent() const = 0;
  7457. virtual float getDescent() const = 0;
  7458. virtual float getStringWidth (const String& text) = 0;
  7459. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7460. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7461. juce_UseDebuggingNewOperator
  7462. protected:
  7463. String name;
  7464. Typeface (const String& name) throw();
  7465. private:
  7466. Typeface (const Typeface&);
  7467. Typeface& operator= (const Typeface&);
  7468. };
  7469. class JUCE_API CustomTypeface : public Typeface
  7470. {
  7471. public:
  7472. CustomTypeface();
  7473. CustomTypeface (InputStream& serialisedTypefaceStream);
  7474. ~CustomTypeface();
  7475. void clear();
  7476. void setCharacteristics (const String& name, const float ascent,
  7477. const bool isBold, const bool isItalic,
  7478. const juce_wchar defaultCharacter) throw();
  7479. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7480. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7481. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7482. bool writeToStream (OutputStream& outputStream);
  7483. // The following methods implement the basic Typeface behaviour.
  7484. float getAscent() const;
  7485. float getDescent() const;
  7486. float getStringWidth (const String& text);
  7487. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7488. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7489. int getGlyphForCharacter (juce_wchar character);
  7490. juce_UseDebuggingNewOperator
  7491. protected:
  7492. juce_wchar defaultCharacter;
  7493. float ascent;
  7494. bool isBold, isItalic;
  7495. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7496. private:
  7497. class GlyphInfo;
  7498. friend class OwnedArray<GlyphInfo>;
  7499. OwnedArray <GlyphInfo> glyphs;
  7500. short lookupTable [128];
  7501. CustomTypeface (const CustomTypeface&);
  7502. CustomTypeface& operator= (const CustomTypeface&);
  7503. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7504. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7505. };
  7506. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7507. /*** End of inlined file: juce_Typeface.h ***/
  7508. class LowLevelGraphicsContext;
  7509. class JUCE_API Font
  7510. {
  7511. public:
  7512. enum FontStyleFlags
  7513. {
  7514. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7515. bold = 1, /**< boldens the font. @see setStyleFlags */
  7516. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7517. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7518. };
  7519. Font (const float fontHeight,
  7520. const int styleFlags = plain) throw();
  7521. Font (const String& typefaceName,
  7522. const float fontHeight,
  7523. const int styleFlags) throw();
  7524. Font (const Font& other) throw();
  7525. Font (const Typeface::Ptr& typeface) throw();
  7526. Font() throw();
  7527. Font& operator= (const Font& other) throw();
  7528. bool operator== (const Font& other) const throw();
  7529. bool operator!= (const Font& other) const throw();
  7530. ~Font() throw();
  7531. void setTypefaceName (const String& faceName) throw();
  7532. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7533. static const String getDefaultSansSerifFontName() throw();
  7534. static const String getDefaultSerifFontName() throw();
  7535. static const String getDefaultMonospacedFontName() throw();
  7536. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7537. float getHeight() const throw() { return font->height; }
  7538. void setHeight (float newHeight) throw();
  7539. void setHeightWithoutChangingWidth (float newHeight) throw();
  7540. float getAscent() const throw();
  7541. float getDescent() const throw();
  7542. int getStyleFlags() const throw() { return font->styleFlags; }
  7543. void setStyleFlags (const int newFlags) throw();
  7544. void setBold (const bool shouldBeBold) throw();
  7545. bool isBold() const throw();
  7546. void setItalic (const bool shouldBeItalic) throw();
  7547. bool isItalic() const throw();
  7548. void setUnderline (const bool shouldBeUnderlined) throw();
  7549. bool isUnderlined() const throw();
  7550. void setHorizontalScale (const float scaleFactor) throw();
  7551. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7552. void setExtraKerningFactor (const float extraKerning) throw();
  7553. float getExtraKerningFactor() const throw() { return font->kerning; }
  7554. void setSizeAndStyle (float newHeight,
  7555. const int newStyleFlags,
  7556. const float newHorizontalScale,
  7557. const float newKerningAmount) throw();
  7558. int getStringWidth (const String& text) const throw();
  7559. float getStringWidthFloat (const String& text) const throw();
  7560. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7561. Typeface* getTypeface() const throw();
  7562. static void findFonts (Array<Font>& results) throw();
  7563. static const StringArray findAllTypefaceNames() throw();
  7564. static const String getFallbackFontName() throw();
  7565. static void setFallbackFontName (const String& name) throw();
  7566. juce_UseDebuggingNewOperator
  7567. private:
  7568. friend class FontGlyphAlphaMap;
  7569. friend class TypefaceCache;
  7570. class SharedFontInternal : public ReferenceCountedObject
  7571. {
  7572. public:
  7573. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7574. const float kerning, const float ascent, const int styleFlags,
  7575. Typeface* const typeface) throw();
  7576. SharedFontInternal (const SharedFontInternal& other) throw();
  7577. String typefaceName;
  7578. float height, horizontalScale, kerning, ascent;
  7579. int styleFlags;
  7580. Typeface::Ptr typeface;
  7581. };
  7582. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7583. void dupeInternalIfShared() throw();
  7584. };
  7585. #endif // __JUCE_FONT_JUCEHEADER__
  7586. /*** End of inlined file: juce_Font.h ***/
  7587. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7588. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7589. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7590. class JUCE_API PathStrokeType
  7591. {
  7592. public:
  7593. enum JointStyle
  7594. {
  7595. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7596. Note that for angles that curve back on themselves, drawing a
  7597. mitre could require extending the point too far away from the
  7598. path, so a mitre limit is imposed and any corners that exceed it
  7599. are drawn as bevelled instead. */
  7600. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7601. beveled /**< Indicates that corners should be drawn with a line flattening their
  7602. outside edge. */
  7603. };
  7604. enum EndCapStyle
  7605. {
  7606. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7607. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7608. the thickness of the stroke. */
  7609. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7610. };
  7611. PathStrokeType (const float strokeThickness,
  7612. const JointStyle jointStyle = mitered,
  7613. const EndCapStyle endStyle = butt) throw();
  7614. PathStrokeType (const PathStrokeType& other) throw();
  7615. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7616. ~PathStrokeType() throw();
  7617. void createStrokedPath (Path& destPath,
  7618. const Path& sourcePath,
  7619. const AffineTransform& transform = AffineTransform::identity,
  7620. const float extraAccuracy = 1.0f) const;
  7621. void createDashedStroke (Path& destPath,
  7622. const Path& sourcePath,
  7623. const float* dashLengths,
  7624. int numDashLengths,
  7625. const AffineTransform& transform = AffineTransform::identity,
  7626. const float extraAccuracy = 1.0f) const;
  7627. float getStrokeThickness() const throw() { return thickness; }
  7628. JointStyle getJointStyle() const throw() { return jointStyle; }
  7629. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7630. juce_UseDebuggingNewOperator
  7631. bool operator== (const PathStrokeType& other) const throw();
  7632. bool operator!= (const PathStrokeType& other) const throw();
  7633. private:
  7634. float thickness;
  7635. JointStyle jointStyle;
  7636. EndCapStyle endStyle;
  7637. };
  7638. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7639. /*** End of inlined file: juce_PathStrokeType.h ***/
  7640. /*** Start of inlined file: juce_Line.h ***/
  7641. #ifndef __JUCE_LINE_JUCEHEADER__
  7642. #define __JUCE_LINE_JUCEHEADER__
  7643. class JUCE_API Line
  7644. {
  7645. public:
  7646. Line() throw();
  7647. Line (const Line& other) throw();
  7648. Line (const float startX,
  7649. const float startY,
  7650. const float endX,
  7651. const float endY) throw();
  7652. Line (const Point<float>& start,
  7653. const Point<float>& end) throw();
  7654. Line& operator= (const Line& other) throw();
  7655. ~Line() throw();
  7656. inline float getStartX() const throw() { return startX; }
  7657. inline float getStartY() const throw() { return startY; }
  7658. inline float getEndX() const throw() { return endX; }
  7659. inline float getEndY() const throw() { return endY; }
  7660. const Point<float> getStart() const throw();
  7661. const Point<float> getEnd() const throw();
  7662. void setStart (const float newStartX,
  7663. const float newStartY) throw();
  7664. void setEnd (const float newEndX,
  7665. const float newEndY) throw();
  7666. void setStart (const Point<float>& newStart) throw();
  7667. void setEnd (const Point<float>& newEnd) throw();
  7668. void applyTransform (const AffineTransform& transform) throw();
  7669. float getLength() const throw();
  7670. bool isVertical() const throw();
  7671. bool isHorizontal() const throw();
  7672. float getAngle() const throw();
  7673. bool operator== (const Line& other) const throw();
  7674. bool operator!= (const Line& other) const throw();
  7675. bool intersects (const Line& line,
  7676. float& intersectionX,
  7677. float& intersectionY) const throw();
  7678. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7679. const Point<float> getPointAlongLine (const float distanceFromStart,
  7680. const float perpendicularDistance) const throw();
  7681. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7682. float getDistanceFromLine (const float x,
  7683. const float y) const throw();
  7684. float findNearestPointTo (const float x,
  7685. const float y) const throw();
  7686. bool isPointAbove (const float x, const float y) const throw();
  7687. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7688. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7689. bool clipToPath (const Path& path,
  7690. const bool keepSectionOutsidePath) throw();
  7691. juce_UseDebuggingNewOperator
  7692. private:
  7693. float startX, startY, endX, endY;
  7694. };
  7695. #endif // __JUCE_LINE_JUCEHEADER__
  7696. /*** End of inlined file: juce_Line.h ***/
  7697. /*** Start of inlined file: juce_Colours.h ***/
  7698. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7699. #define __JUCE_COLOURS_JUCEHEADER__
  7700. /*** Start of inlined file: juce_Colour.h ***/
  7701. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7702. #define __JUCE_COLOUR_JUCEHEADER__
  7703. /*** Start of inlined file: juce_PixelFormats.h ***/
  7704. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7705. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7706. #if JUCE_MSVC
  7707. #pragma pack (push, 1)
  7708. #define PACKED
  7709. #elif JUCE_GCC
  7710. #define PACKED __attribute__((packed))
  7711. #else
  7712. #define PACKED
  7713. #endif
  7714. class PixelRGB;
  7715. class PixelAlpha;
  7716. class JUCE_API PixelARGB
  7717. {
  7718. public:
  7719. PixelARGB() throw() {}
  7720. ~PixelARGB() throw() {}
  7721. PixelARGB (const uint32 argb_) throw()
  7722. : argb (argb_)
  7723. {
  7724. }
  7725. forcedinline uint32 getARGB() const throw() { return argb; }
  7726. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7727. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7728. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7729. forcedinline uint8 getRed() const throw() { return components.r; }
  7730. forcedinline uint8 getGreen() const throw() { return components.g; }
  7731. forcedinline uint8 getBlue() const throw() { return components.b; }
  7732. forcedinline void blend (const PixelARGB& src) throw()
  7733. {
  7734. uint32 sargb = src.getARGB();
  7735. const uint32 alpha = 0x100 - (sargb >> 24);
  7736. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7737. sargb += 0xff00ff00 & (getAG() * alpha);
  7738. argb = sargb;
  7739. }
  7740. forcedinline void blend (const PixelAlpha& src) throw();
  7741. forcedinline void blend (const PixelRGB& src) throw();
  7742. template <class Pixel>
  7743. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7744. {
  7745. ++extraAlpha;
  7746. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7747. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7748. const uint32 alpha = 0x100 - (sargb >> 24);
  7749. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7750. sargb += 0xff00ff00 & (getAG() * alpha);
  7751. argb = sargb;
  7752. }
  7753. template <class Pixel>
  7754. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7755. {
  7756. uint32 drb = getRB();
  7757. drb += (((src.getRB() - drb) * amount) >> 8);
  7758. drb &= 0x00ff00ff;
  7759. uint32 dag = getAG();
  7760. dag += (((src.getAG() - dag) * amount) >> 8);
  7761. dag &= 0x00ff00ff;
  7762. dag <<= 8;
  7763. dag |= drb;
  7764. argb = dag;
  7765. }
  7766. template <class Pixel>
  7767. forcedinline void set (const Pixel& src) throw()
  7768. {
  7769. argb = src.getARGB();
  7770. }
  7771. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7772. {
  7773. components.a = newAlpha;
  7774. }
  7775. forcedinline void multiplyAlpha (int multiplier) throw()
  7776. {
  7777. ++multiplier;
  7778. argb = ((multiplier * getAG()) & 0xff00ff00)
  7779. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7780. }
  7781. forcedinline void multiplyAlpha (const float multiplier) throw()
  7782. {
  7783. multiplyAlpha ((int) (multiplier * 256.0f));
  7784. }
  7785. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7786. {
  7787. components.b = b;
  7788. components.g = g;
  7789. components.r = r;
  7790. components.a = a;
  7791. }
  7792. forcedinline void premultiply() throw()
  7793. {
  7794. const uint32 alpha = components.a;
  7795. if (alpha < 0xff)
  7796. {
  7797. if (alpha == 0)
  7798. {
  7799. components.b = 0;
  7800. components.g = 0;
  7801. components.r = 0;
  7802. }
  7803. else
  7804. {
  7805. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7806. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7807. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7808. }
  7809. }
  7810. }
  7811. forcedinline void unpremultiply() throw()
  7812. {
  7813. const uint32 alpha = components.a;
  7814. if (alpha < 0xff)
  7815. {
  7816. if (alpha == 0)
  7817. {
  7818. components.b = 0;
  7819. components.g = 0;
  7820. components.r = 0;
  7821. }
  7822. else
  7823. {
  7824. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7825. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7826. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7827. }
  7828. }
  7829. }
  7830. forcedinline void desaturate() throw()
  7831. {
  7832. if (components.a < 0xff && components.a > 0)
  7833. {
  7834. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7835. components.r = components.g = components.b
  7836. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7837. }
  7838. else
  7839. {
  7840. components.r = components.g = components.b
  7841. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7842. }
  7843. }
  7844. #if JUCE_BIG_ENDIAN
  7845. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7846. #else
  7847. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7848. #endif
  7849. private:
  7850. union
  7851. {
  7852. uint32 argb;
  7853. struct
  7854. {
  7855. #if JUCE_BIG_ENDIAN
  7856. uint8 a : 8, r : 8, g : 8, b : 8;
  7857. #else
  7858. uint8 b, g, r, a;
  7859. #endif
  7860. } PACKED components;
  7861. };
  7862. } PACKED;
  7863. class JUCE_API PixelRGB
  7864. {
  7865. public:
  7866. PixelRGB() throw() {}
  7867. ~PixelRGB() throw() {}
  7868. PixelRGB (const uint32 argb) throw()
  7869. {
  7870. r = (uint8) (argb >> 16);
  7871. g = (uint8) (argb >> 8);
  7872. b = (uint8) (argb);
  7873. }
  7874. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7875. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7876. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7877. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7878. forcedinline uint8 getRed() const throw() { return r; }
  7879. forcedinline uint8 getGreen() const throw() { return g; }
  7880. forcedinline uint8 getBlue() const throw() { return b; }
  7881. forcedinline void blend (const PixelARGB& src) throw()
  7882. {
  7883. uint32 sargb = src.getARGB();
  7884. const uint32 alpha = 0x100 - (sargb >> 24);
  7885. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7886. sargb += 0x0000ff00 & (g * alpha);
  7887. r = (uint8) (sargb >> 16);
  7888. g = (uint8) (sargb >> 8);
  7889. b = (uint8) sargb;
  7890. }
  7891. forcedinline void blend (const PixelRGB& src) throw()
  7892. {
  7893. set (src);
  7894. }
  7895. forcedinline void blend (const PixelAlpha& src) throw();
  7896. template <class Pixel>
  7897. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7898. {
  7899. ++extraAlpha;
  7900. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7901. const uint32 sag = extraAlpha * src.getAG();
  7902. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7903. const uint32 alpha = 0x100 - (sargb >> 24);
  7904. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7905. sargb += 0x0000ff00 & (g * alpha);
  7906. b = (uint8) sargb;
  7907. g = (uint8) (sargb >> 8);
  7908. r = (uint8) (sargb >> 16);
  7909. }
  7910. template <class Pixel>
  7911. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7912. {
  7913. uint32 drb = getRB();
  7914. drb += (((src.getRB() - drb) * amount) >> 8);
  7915. uint32 dag = getAG();
  7916. dag += (((src.getAG() - dag) * amount) >> 8);
  7917. b = (uint8) drb;
  7918. g = (uint8) dag;
  7919. r = (uint8) (drb >> 16);
  7920. }
  7921. template <class Pixel>
  7922. forcedinline void set (const Pixel& src) throw()
  7923. {
  7924. b = src.getBlue();
  7925. g = src.getGreen();
  7926. r = src.getRed();
  7927. }
  7928. forcedinline void setAlpha (const uint8) throw() {}
  7929. forcedinline void multiplyAlpha (int) throw() {}
  7930. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7931. {
  7932. r = r_;
  7933. g = g_;
  7934. b = b_;
  7935. }
  7936. forcedinline void premultiply() throw() {}
  7937. forcedinline void unpremultiply() throw() {}
  7938. forcedinline void desaturate() throw()
  7939. {
  7940. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7941. }
  7942. #if JUCE_MAC
  7943. enum { indexR = 0, indexG = 1, indexB = 2 };
  7944. #else
  7945. enum { indexR = 2, indexG = 1, indexB = 0 };
  7946. #endif
  7947. private:
  7948. #if JUCE_MAC
  7949. uint8 r, g, b;
  7950. #else
  7951. uint8 b, g, r;
  7952. #endif
  7953. } PACKED;
  7954. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7955. {
  7956. set (src);
  7957. }
  7958. class JUCE_API PixelAlpha
  7959. {
  7960. public:
  7961. PixelAlpha() throw() {}
  7962. ~PixelAlpha() throw() {}
  7963. PixelAlpha (const uint32 argb) throw()
  7964. {
  7965. a = (uint8) (argb >> 24);
  7966. }
  7967. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7968. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7969. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7970. forcedinline uint8 getAlpha() const throw() { return a; }
  7971. forcedinline uint8 getRed() const throw() { return 0; }
  7972. forcedinline uint8 getGreen() const throw() { return 0; }
  7973. forcedinline uint8 getBlue() const throw() { return 0; }
  7974. template <class Pixel>
  7975. forcedinline void blend (const Pixel& src) throw()
  7976. {
  7977. const int srcA = src.getAlpha();
  7978. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7979. }
  7980. template <class Pixel>
  7981. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7982. {
  7983. ++extraAlpha;
  7984. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  7985. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  7986. }
  7987. template <class Pixel>
  7988. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7989. {
  7990. a += ((src,getAlpha() - a) * amount) >> 8;
  7991. }
  7992. template <class Pixel>
  7993. forcedinline void set (const Pixel& src) throw()
  7994. {
  7995. a = src.getAlpha();
  7996. }
  7997. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7998. {
  7999. a = newAlpha;
  8000. }
  8001. forcedinline void multiplyAlpha (int multiplier) throw()
  8002. {
  8003. ++multiplier;
  8004. a = (uint8) ((a * multiplier) >> 8);
  8005. }
  8006. forcedinline void multiplyAlpha (const float multiplier) throw()
  8007. {
  8008. a = (uint8) (a * multiplier);
  8009. }
  8010. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8011. {
  8012. a = a_;
  8013. }
  8014. forcedinline void premultiply() throw()
  8015. {
  8016. }
  8017. forcedinline void unpremultiply() throw()
  8018. {
  8019. }
  8020. forcedinline void desaturate() throw()
  8021. {
  8022. }
  8023. private:
  8024. uint8 a : 8;
  8025. } PACKED;
  8026. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8027. {
  8028. blend (PixelARGB (src.getARGB()));
  8029. }
  8030. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8031. {
  8032. uint32 sargb = src.getARGB();
  8033. const uint32 alpha = 0x100 - (sargb >> 24);
  8034. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8035. sargb += 0xff00ff00 & (getAG() * alpha);
  8036. argb = sargb;
  8037. }
  8038. #if JUCE_MSVC
  8039. #pragma pack (pop)
  8040. #endif
  8041. #undef PACKED
  8042. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8043. /*** End of inlined file: juce_PixelFormats.h ***/
  8044. class JUCE_API Colour
  8045. {
  8046. public:
  8047. Colour() throw();
  8048. Colour (const Colour& other) throw();
  8049. explicit Colour (const uint32 argb) throw();
  8050. Colour (const uint8 red,
  8051. const uint8 green,
  8052. const uint8 blue) throw();
  8053. static const Colour fromRGB (const uint8 red,
  8054. const uint8 green,
  8055. const uint8 blue) throw();
  8056. Colour (const uint8 red,
  8057. const uint8 green,
  8058. const uint8 blue,
  8059. const uint8 alpha) throw();
  8060. static const Colour fromRGBA (const uint8 red,
  8061. const uint8 green,
  8062. const uint8 blue,
  8063. const uint8 alpha) throw();
  8064. Colour (const uint8 red,
  8065. const uint8 green,
  8066. const uint8 blue,
  8067. const float alpha) throw();
  8068. static const Colour fromRGBAFloat (const uint8 red,
  8069. const uint8 green,
  8070. const uint8 blue,
  8071. const float alpha) throw();
  8072. Colour (const float hue,
  8073. const float saturation,
  8074. const float brightness,
  8075. const uint8 alpha) throw();
  8076. Colour (const float hue,
  8077. const float saturation,
  8078. const float brightness,
  8079. const float alpha) throw();
  8080. static const Colour fromHSV (const float hue,
  8081. const float saturation,
  8082. const float brightness,
  8083. const float alpha) throw();
  8084. ~Colour() throw();
  8085. Colour& operator= (const Colour& other) throw();
  8086. bool operator== (const Colour& other) const throw();
  8087. bool operator!= (const Colour& other) const throw();
  8088. uint8 getRed() const throw() { return argb.getRed(); }
  8089. uint8 getGreen() const throw() { return argb.getGreen(); }
  8090. uint8 getBlue() const throw() { return argb.getBlue(); }
  8091. float getFloatRed() const throw();
  8092. float getFloatGreen() const throw();
  8093. float getFloatBlue() const throw();
  8094. const PixelARGB getPixelARGB() const throw();
  8095. uint32 getARGB() const throw();
  8096. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8097. float getFloatAlpha() const throw();
  8098. bool isOpaque() const throw();
  8099. bool isTransparent() const throw();
  8100. const Colour withAlpha (const uint8 newAlpha) const throw();
  8101. const Colour withAlpha (const float newAlpha) const throw();
  8102. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  8103. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8104. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8105. float getHue() const throw();
  8106. float getSaturation() const throw();
  8107. float getBrightness() const throw();
  8108. void getHSB (float& hue,
  8109. float& saturation,
  8110. float& brightness) const throw();
  8111. const Colour withHue (const float newHue) const throw();
  8112. const Colour withSaturation (const float newSaturation) const throw();
  8113. const Colour withBrightness (const float newBrightness) const throw();
  8114. const Colour withRotatedHue (const float amountToRotate) const throw();
  8115. const Colour withMultipliedSaturation (const float multiplier) const throw();
  8116. const Colour withMultipliedBrightness (const float amount) const throw();
  8117. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8118. const Colour darker (float amountDarker = 0.4f) const throw();
  8119. const Colour contrasting (const float amount = 1.0f) const throw();
  8120. static const Colour contrasting (const Colour& colour1,
  8121. const Colour& colour2) throw();
  8122. static const Colour greyLevel (const float brightness) throw();
  8123. const String toString() const throw();
  8124. static const Colour fromString (const String& encodedColourString);
  8125. juce_UseDebuggingNewOperator
  8126. private:
  8127. PixelARGB argb;
  8128. };
  8129. #endif // __JUCE_COLOUR_JUCEHEADER__
  8130. /*** End of inlined file: juce_Colour.h ***/
  8131. class Colours
  8132. {
  8133. public:
  8134. static JUCE_API const Colour
  8135. transparentBlack, /**< ARGB = 0x00000000 */
  8136. transparentWhite, /**< ARGB = 0x00ffffff */
  8137. black, /**< ARGB = 0xff000000 */
  8138. white, /**< ARGB = 0xffffffff */
  8139. blue, /**< ARGB = 0xff0000ff */
  8140. grey, /**< ARGB = 0xff808080 */
  8141. green, /**< ARGB = 0xff008000 */
  8142. red, /**< ARGB = 0xffff0000 */
  8143. yellow, /**< ARGB = 0xffffff00 */
  8144. aliceblue, antiquewhite, aqua, aquamarine,
  8145. azure, beige, bisque, blanchedalmond,
  8146. blueviolet, brown, burlywood, cadetblue,
  8147. chartreuse, chocolate, coral, cornflowerblue,
  8148. cornsilk, crimson, cyan, darkblue,
  8149. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8150. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8151. darkorchid, darkred, darksalmon, darkseagreen,
  8152. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8153. deeppink, deepskyblue, dimgrey, dodgerblue,
  8154. firebrick, floralwhite, forestgreen, fuchsia,
  8155. gainsboro, gold, goldenrod, greenyellow,
  8156. honeydew, hotpink, indianred, indigo,
  8157. ivory, khaki, lavender, lavenderblush,
  8158. lemonchiffon, lightblue, lightcoral, lightcyan,
  8159. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8160. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8161. lightsteelblue, lightyellow, lime, limegreen,
  8162. linen, magenta, maroon, mediumaquamarine,
  8163. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8164. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8165. midnightblue, mintcream, mistyrose, navajowhite,
  8166. navy, oldlace, olive, olivedrab,
  8167. orange, orangered, orchid, palegoldenrod,
  8168. palegreen, paleturquoise, palevioletred, papayawhip,
  8169. peachpuff, peru, pink, plum,
  8170. powderblue, purple, rosybrown, royalblue,
  8171. saddlebrown, salmon, sandybrown, seagreen,
  8172. seashell, sienna, silver, skyblue,
  8173. slateblue, slategrey, snow, springgreen,
  8174. steelblue, tan, teal, thistle,
  8175. tomato, turquoise, violet, wheat,
  8176. whitesmoke, yellowgreen;
  8177. static JUCE_API const Colour findColourForName (const String& colourName,
  8178. const Colour& defaultColour);
  8179. private:
  8180. // this isn't a class you should ever instantiate - it's just here for the
  8181. // static values in it.
  8182. Colours();
  8183. };
  8184. #endif // __JUCE_COLOURS_JUCEHEADER__
  8185. /*** End of inlined file: juce_Colours.h ***/
  8186. /*** Start of inlined file: juce_FillType.h ***/
  8187. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8188. #define __JUCE_FILLTYPE_JUCEHEADER__
  8189. /*** Start of inlined file: juce_ColourGradient.h ***/
  8190. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8191. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8192. class JUCE_API ColourGradient
  8193. {
  8194. public:
  8195. ColourGradient (const Colour& colour1,
  8196. const float x1,
  8197. const float y1,
  8198. const Colour& colour2,
  8199. const float x2,
  8200. const float y2,
  8201. const bool isRadial) throw();
  8202. ColourGradient() throw();
  8203. ~ColourGradient() throw();
  8204. void clearColours() throw();
  8205. void addColour (const double proportionAlongGradient,
  8206. const Colour& colour) throw();
  8207. void multiplyOpacity (const float multiplier) throw();
  8208. int getNumColours() const throw();
  8209. double getColourPosition (const int index) const throw();
  8210. const Colour getColour (const int index) const throw();
  8211. const Colour getColourAtPosition (const float position) const throw();
  8212. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8213. bool isOpaque() const throw();
  8214. bool isInvisible() const throw();
  8215. float x1;
  8216. float y1;
  8217. float x2;
  8218. float y2;
  8219. bool isRadial;
  8220. juce_UseDebuggingNewOperator
  8221. private:
  8222. Array <uint32> colours;
  8223. };
  8224. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8225. /*** End of inlined file: juce_ColourGradient.h ***/
  8226. class Image;
  8227. class JUCE_API FillType
  8228. {
  8229. public:
  8230. FillType() throw();
  8231. FillType (const Colour& colour) throw();
  8232. FillType (const ColourGradient& gradient) throw();
  8233. FillType (const Image& image, const AffineTransform& transform) throw();
  8234. FillType (const FillType& other) throw();
  8235. FillType& operator= (const FillType& other) throw();
  8236. ~FillType() throw();
  8237. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8238. bool isGradient() const throw() { return gradient != 0; }
  8239. bool isTiledImage() const throw() { return image != 0; }
  8240. void setColour (const Colour& newColour) throw();
  8241. void setGradient (const ColourGradient& newGradient) throw();
  8242. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8243. void setOpacity (const float newOpacity) throw();
  8244. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8245. Colour colour;
  8246. ScopedPointer <ColourGradient> gradient;
  8247. const Image* image;
  8248. AffineTransform transform;
  8249. juce_UseDebuggingNewOperator
  8250. };
  8251. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8252. /*** End of inlined file: juce_FillType.h ***/
  8253. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8254. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8255. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8256. class JUCE_API RectanglePlacement
  8257. {
  8258. public:
  8259. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  8260. RectanglePlacement (const RectanglePlacement& other) throw();
  8261. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8262. enum
  8263. {
  8264. xLeft = 1,
  8265. xRight = 2,
  8266. xMid = 4,
  8267. yTop = 8,
  8268. yBottom = 16,
  8269. yMid = 32,
  8270. stretchToFit = 64,
  8271. fillDestination = 128,
  8272. onlyReduceInSize = 256,
  8273. onlyIncreaseInSize = 512,
  8274. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8275. centred = 4 + 32
  8276. };
  8277. inline int getFlags() const throw() { return flags; }
  8278. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8279. void applyTo (double& sourceX,
  8280. double& sourceY,
  8281. double& sourceW,
  8282. double& sourceH,
  8283. const double destinationX,
  8284. const double destinationY,
  8285. const double destinationW,
  8286. const double destinationH) const throw();
  8287. const AffineTransform getTransformToFit (float sourceX,
  8288. float sourceY,
  8289. float sourceW,
  8290. float sourceH,
  8291. const float destinationX,
  8292. const float destinationY,
  8293. const float destinationW,
  8294. const float destinationH) const throw();
  8295. private:
  8296. int flags;
  8297. };
  8298. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8299. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8300. class LowLevelGraphicsContext;
  8301. class Image;
  8302. class RectangleList;
  8303. class JUCE_API Graphics
  8304. {
  8305. public:
  8306. Graphics (Image& imageToDrawOnto) throw();
  8307. ~Graphics() throw();
  8308. void setColour (const Colour& newColour) throw();
  8309. void setOpacity (const float newOpacity) throw();
  8310. void setGradientFill (const ColourGradient& gradient) throw();
  8311. void setTiledImageFill (const Image& imageToUse,
  8312. const int anchorX,
  8313. const int anchorY,
  8314. const float opacity) throw();
  8315. void setFillType (const FillType& newFill) throw();
  8316. void setFont (const Font& newFont) throw();
  8317. void setFont (const float newFontHeight,
  8318. const int fontStyleFlags = Font::plain) throw();
  8319. void drawSingleLineText (const String& text,
  8320. const int startX,
  8321. const int baselineY) const throw();
  8322. void drawMultiLineText (const String& text,
  8323. const int startX,
  8324. const int baselineY,
  8325. const int maximumLineWidth) const throw();
  8326. void drawTextAsPath (const String& text,
  8327. const AffineTransform& transform) const throw();
  8328. void drawText (const String& text,
  8329. const int x,
  8330. const int y,
  8331. const int width,
  8332. const int height,
  8333. const Justification& justificationType,
  8334. const bool useEllipsesIfTooBig) const throw();
  8335. void drawFittedText (const String& text,
  8336. const int x,
  8337. const int y,
  8338. const int width,
  8339. const int height,
  8340. const Justification& justificationFlags,
  8341. const int maximumNumberOfLines,
  8342. const float minimumHorizontalScale = 0.7f) const throw();
  8343. void fillAll() const throw();
  8344. void fillAll (const Colour& colourToUse) const throw();
  8345. void fillRect (int x,
  8346. int y,
  8347. int width,
  8348. int height) const throw();
  8349. void fillRect (const Rectangle<int>& rectangle) const throw();
  8350. void fillRect (const float x,
  8351. const float y,
  8352. const float width,
  8353. const float height) const throw();
  8354. void fillRoundedRectangle (const float x,
  8355. const float y,
  8356. const float width,
  8357. const float height,
  8358. const float cornerSize) const throw();
  8359. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8360. const float cornerSize) const throw();
  8361. void fillCheckerBoard (int x, int y,
  8362. int width, int height,
  8363. const int checkWidth,
  8364. const int checkHeight,
  8365. const Colour& colour1,
  8366. const Colour& colour2) const throw();
  8367. void drawRect (const int x,
  8368. const int y,
  8369. const int width,
  8370. const int height,
  8371. const int lineThickness = 1) const throw();
  8372. void drawRect (const float x,
  8373. const float y,
  8374. const float width,
  8375. const float height,
  8376. const float lineThickness = 1.0f) const throw();
  8377. void drawRect (const Rectangle<int>& rectangle,
  8378. const int lineThickness = 1) const throw();
  8379. void drawRoundedRectangle (const float x,
  8380. const float y,
  8381. const float width,
  8382. const float height,
  8383. const float cornerSize,
  8384. const float lineThickness) const throw();
  8385. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8386. const float cornerSize,
  8387. const float lineThickness) const throw();
  8388. void drawBevel (const int x,
  8389. const int y,
  8390. const int width,
  8391. const int height,
  8392. const int bevelThickness,
  8393. const Colour& topLeftColour = Colours::white,
  8394. const Colour& bottomRightColour = Colours::black,
  8395. const bool useGradient = true,
  8396. const bool sharpEdgeOnOutside = true) const throw();
  8397. void setPixel (int x, int y) const throw();
  8398. void fillEllipse (const float x,
  8399. const float y,
  8400. const float width,
  8401. const float height) const throw();
  8402. void drawEllipse (const float x,
  8403. const float y,
  8404. const float width,
  8405. const float height,
  8406. const float lineThickness) const throw();
  8407. void drawLine (float startX,
  8408. float startY,
  8409. float endX,
  8410. float endY) const throw();
  8411. void drawLine (const float startX,
  8412. const float startY,
  8413. const float endX,
  8414. const float endY,
  8415. const float lineThickness) const throw();
  8416. void drawLine (const Line& line) const throw();
  8417. void drawLine (const Line& line,
  8418. const float lineThickness) const throw();
  8419. void drawDashedLine (const float startX,
  8420. const float startY,
  8421. const float endX,
  8422. const float endY,
  8423. const float* const dashLengths,
  8424. const int numDashLengths,
  8425. const float lineThickness = 1.0f) const throw();
  8426. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8427. void drawHorizontalLine (const int y, float left, float right) const throw();
  8428. void fillPath (const Path& path,
  8429. const AffineTransform& transform = AffineTransform::identity) const throw();
  8430. void strokePath (const Path& path,
  8431. const PathStrokeType& strokeType,
  8432. const AffineTransform& transform = AffineTransform::identity) const throw();
  8433. void drawArrow (const float startX,
  8434. const float startY,
  8435. const float endX,
  8436. const float endY,
  8437. const float lineThickness,
  8438. const float arrowheadWidth,
  8439. const float arrowheadLength) const throw();
  8440. enum ResamplingQuality
  8441. {
  8442. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8443. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8444. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8445. };
  8446. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8447. void drawImageAt (const Image* const imageToDraw,
  8448. const int topLeftX,
  8449. const int topLeftY,
  8450. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8451. void drawImage (const Image* const imageToDraw,
  8452. int destX,
  8453. int destY,
  8454. int destWidth,
  8455. int destHeight,
  8456. int sourceX,
  8457. int sourceY,
  8458. int sourceWidth,
  8459. int sourceHeight,
  8460. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8461. void drawImageTransformed (const Image* const imageToDraw,
  8462. const Rectangle<int>& imageSubRegion,
  8463. const AffineTransform& transform,
  8464. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8465. void drawImageWithin (const Image* const imageToDraw,
  8466. const int destX,
  8467. const int destY,
  8468. const int destWidth,
  8469. const int destHeight,
  8470. const RectanglePlacement& placementWithinTarget,
  8471. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8472. const Rectangle<int> getClipBounds() const throw();
  8473. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8474. bool reduceClipRegion (const int x, const int y,
  8475. const int width, const int height) throw();
  8476. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8477. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8478. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8479. const AffineTransform& transform) throw();
  8480. void excludeClipRegion (const int x, const int y,
  8481. const int width, const int height) throw();
  8482. bool isClipEmpty() const throw();
  8483. void saveState() throw();
  8484. void restoreState() throw();
  8485. void setOrigin (const int newOriginX,
  8486. const int newOriginY) throw();
  8487. void resetToDefaultState() throw();
  8488. bool isVectorDevice() const throw();
  8489. juce_UseDebuggingNewOperator
  8490. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8491. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8492. private:
  8493. LowLevelGraphicsContext* const context;
  8494. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8495. bool saveStatePending;
  8496. void saveStateIfPending() throw();
  8497. Graphics (const Graphics&);
  8498. Graphics& operator= (const Graphics& other);
  8499. };
  8500. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8501. /*** End of inlined file: juce_Graphics.h ***/
  8502. class JUCE_API ImageEffectFilter
  8503. {
  8504. public:
  8505. virtual void applyEffect (Image& sourceImage,
  8506. Graphics& destContext) = 0;
  8507. virtual ~ImageEffectFilter() {}
  8508. };
  8509. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8510. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8511. /*** Start of inlined file: juce_RectangleList.h ***/
  8512. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8513. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8514. class JUCE_API RectangleList
  8515. {
  8516. public:
  8517. RectangleList() throw();
  8518. RectangleList (const RectangleList& other) throw();
  8519. RectangleList (const Rectangle<int>& rect) throw();
  8520. RectangleList& operator= (const RectangleList& other) throw();
  8521. ~RectangleList() throw();
  8522. bool isEmpty() const throw();
  8523. int getNumRectangles() const throw() { return rects.size(); }
  8524. const Rectangle<int> getRectangle (const int index) const throw();
  8525. void clear() throw();
  8526. void add (const int x, const int y,
  8527. const int w, const int h) throw();
  8528. void add (const Rectangle<int>& rect) throw();
  8529. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8530. void add (const RectangleList& other) throw();
  8531. void subtract (const Rectangle<int>& rect) throw();
  8532. void subtract (const RectangleList& otherList) throw();
  8533. bool clipTo (const Rectangle<int>& rect) throw();
  8534. bool clipTo (const RectangleList& other) throw();
  8535. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8536. void swapWith (RectangleList& otherList) throw();
  8537. bool containsPoint (const int x, const int y) const throw();
  8538. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8539. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8540. bool intersects (const RectangleList& other) const throw();
  8541. const Rectangle<int> getBounds() const throw();
  8542. void consolidate() throw();
  8543. void offsetAll (const int dx, const int dy) throw();
  8544. const Path toPath() const throw();
  8545. class Iterator
  8546. {
  8547. public:
  8548. Iterator (const RectangleList& list) throw();
  8549. ~Iterator() throw();
  8550. bool next() throw();
  8551. const Rectangle<int>* getRectangle() const throw() { return current; }
  8552. juce_UseDebuggingNewOperator
  8553. private:
  8554. const Rectangle<int>* current;
  8555. const RectangleList& owner;
  8556. int index;
  8557. Iterator (const Iterator&);
  8558. Iterator& operator= (const Iterator&);
  8559. };
  8560. juce_UseDebuggingNewOperator
  8561. private:
  8562. friend class Iterator;
  8563. Array <Rectangle<int> > rects;
  8564. };
  8565. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8566. /*** End of inlined file: juce_RectangleList.h ***/
  8567. /*** Start of inlined file: juce_BorderSize.h ***/
  8568. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8569. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8570. class JUCE_API BorderSize
  8571. {
  8572. public:
  8573. BorderSize() throw();
  8574. BorderSize (const BorderSize& other) throw();
  8575. BorderSize (const int topGap,
  8576. const int leftGap,
  8577. const int bottomGap,
  8578. const int rightGap) throw();
  8579. BorderSize (const int allGaps) throw();
  8580. ~BorderSize() throw();
  8581. int getTop() const throw() { return top; }
  8582. int getLeft() const throw() { return left; }
  8583. int getBottom() const throw() { return bottom; }
  8584. int getRight() const throw() { return right; }
  8585. int getTopAndBottom() const throw() { return top + bottom; }
  8586. int getLeftAndRight() const throw() { return left + right; }
  8587. void setTop (const int newTopGap) throw();
  8588. void setLeft (const int newLeftGap) throw();
  8589. void setBottom (const int newBottomGap) throw();
  8590. void setRight (const int newRightGap) throw();
  8591. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8592. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8593. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8594. void addTo (Rectangle<int>& original) const throw();
  8595. bool operator== (const BorderSize& other) const throw();
  8596. bool operator!= (const BorderSize& other) const throw();
  8597. juce_UseDebuggingNewOperator
  8598. private:
  8599. int top, left, bottom, right;
  8600. };
  8601. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8602. /*** End of inlined file: juce_BorderSize.h ***/
  8603. class LookAndFeel;
  8604. class MouseInputSource;
  8605. class MouseInputSourceInternal;
  8606. class ComponentPeer;
  8607. class JUCE_API Component : public MouseListener,
  8608. protected MessageListener
  8609. {
  8610. public:
  8611. Component() throw();
  8612. virtual ~Component();
  8613. Component (const String& componentName) throw();
  8614. const String& getName() const throw() { return componentName_; }
  8615. virtual void setName (const String& newName);
  8616. bool isValidComponent() const throw();
  8617. virtual void setVisible (bool shouldBeVisible);
  8618. bool isVisible() const throw() { return flags.visibleFlag; }
  8619. virtual void visibilityChanged();
  8620. bool isShowing() const throw();
  8621. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8622. const int deltaXToMove = 0,
  8623. const int deltaYToMove = 0,
  8624. const float scaleFactorAtEnd = 1.0f);
  8625. virtual void addToDesktop (int windowStyleFlags,
  8626. void* nativeWindowToAttachTo = 0);
  8627. void removeFromDesktop();
  8628. bool isOnDesktop() const throw();
  8629. ComponentPeer* getPeer() const throw();
  8630. virtual void userTriedToCloseWindow();
  8631. virtual void minimisationStateChanged (bool isNowMinimised);
  8632. void toFront (const bool shouldAlsoGainFocus);
  8633. void toBack();
  8634. void toBehind (Component* const other);
  8635. void setAlwaysOnTop (const bool shouldStayOnTop);
  8636. bool isAlwaysOnTop() const throw();
  8637. inline int getX() const throw() { return bounds_.getX(); }
  8638. inline int getY() const throw() { return bounds_.getY(); }
  8639. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8640. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8641. int getRight() const throw() { return bounds_.getRight(); }
  8642. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8643. int getBottom() const throw() { return bounds_.getBottom(); }
  8644. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8645. void getVisibleArea (RectangleList& result,
  8646. const bool includeSiblings) const;
  8647. int getScreenX() const;
  8648. int getScreenY() const;
  8649. const Point<int> getScreenPosition() const;
  8650. const Rectangle<int> getScreenBounds() const;
  8651. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8652. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8653. const Point<int> relativePositionToOtherComponent (const Component* const targetComponent,
  8654. const Point<int>& positionRelativeToThis) const;
  8655. void setTopLeftPosition (const int x, const int y);
  8656. void setTopRightPosition (const int x, const int y);
  8657. void setSize (const int newWidth, const int newHeight);
  8658. void setBounds (int x, int y, int width, int height);
  8659. void setBounds (const Rectangle<int>& newBounds);
  8660. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8661. const float proportionalWidth, const float proportionalHeight);
  8662. void setBoundsInset (const BorderSize& borders);
  8663. void setBoundsToFit (int x, int y, int width, int height,
  8664. const Justification& justification,
  8665. const bool onlyReduceInSize);
  8666. void setCentrePosition (const int x, const int y);
  8667. void setCentreRelative (const float x, const float y);
  8668. void centreWithSize (const int width, const int height);
  8669. int proportionOfWidth (const float proportion) const throw();
  8670. int proportionOfHeight (const float proportion) const throw();
  8671. int getParentWidth() const throw();
  8672. int getParentHeight() const throw();
  8673. const Rectangle<int> getParentMonitorArea() const throw();
  8674. int getNumChildComponents() const throw();
  8675. Component* getChildComponent (const int index) const throw();
  8676. int getIndexOfChildComponent (const Component* const child) const throw();
  8677. void addChildComponent (Component* const child,
  8678. int zOrder = -1);
  8679. void addAndMakeVisible (Component* const child,
  8680. int zOrder = -1);
  8681. void removeChildComponent (Component* const childToRemove);
  8682. Component* removeChildComponent (const int childIndexToRemove);
  8683. void removeAllChildren();
  8684. void deleteAllChildren();
  8685. Component* getParentComponent() const throw() { return parentComponent_; }
  8686. template <class TargetClass>
  8687. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8688. {
  8689. (void) dummyParameter;
  8690. Component* p = parentComponent_;
  8691. while (p != 0)
  8692. {
  8693. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8694. if (target != 0)
  8695. return target;
  8696. p = p->parentComponent_;
  8697. }
  8698. return 0;
  8699. }
  8700. Component* getTopLevelComponent() const throw();
  8701. bool isParentOf (const Component* possibleChild) const throw();
  8702. virtual void parentHierarchyChanged();
  8703. virtual void childrenChanged();
  8704. virtual bool hitTest (int x, int y);
  8705. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8706. const bool allowClicksOnChildComponents) throw();
  8707. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8708. bool& allowsClicksOnChildComponents) const throw();
  8709. virtual bool contains (int x, int y);
  8710. bool reallyContains (int x, int y,
  8711. const bool returnTrueIfWithinAChild);
  8712. Component* getComponentAt (const int x, const int y);
  8713. Component* getComponentAt (const Point<int>& position);
  8714. void repaint() throw();
  8715. void repaint (const int x, const int y,
  8716. const int width, const int height) throw();
  8717. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8718. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8719. const bool clipImageToComponentBounds = true);
  8720. void paintEntireComponent (Graphics& context);
  8721. void setComponentEffect (ImageEffectFilter* const newEffect);
  8722. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8723. LookAndFeel& getLookAndFeel() const throw();
  8724. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8725. virtual void lookAndFeelChanged();
  8726. void sendLookAndFeelChange();
  8727. void setOpaque (const bool shouldBeOpaque) throw();
  8728. bool isOpaque() const throw();
  8729. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8730. bool isBroughtToFrontOnMouseClick() const throw();
  8731. // Keyboard focus methods
  8732. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8733. bool getWantsKeyboardFocus() const throw();
  8734. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8735. bool getMouseClickGrabsKeyboardFocus() const throw();
  8736. void grabKeyboardFocus();
  8737. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8738. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8739. void moveKeyboardFocusToSibling (const bool moveToNext);
  8740. virtual KeyboardFocusTraverser* createFocusTraverser();
  8741. int getExplicitFocusOrder() const throw();
  8742. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8743. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8744. bool isFocusContainer() const throw();
  8745. bool isEnabled() const throw();
  8746. void setEnabled (const bool shouldBeEnabled);
  8747. virtual void enablementChanged();
  8748. void setMouseCursor (const MouseCursor& cursorType) throw();
  8749. virtual const MouseCursor getMouseCursor();
  8750. void updateMouseCursor() const throw();
  8751. virtual void paint (Graphics& g);
  8752. virtual void paintOverChildren (Graphics& g);
  8753. virtual void mouseMove (const MouseEvent& e);
  8754. virtual void mouseEnter (const MouseEvent& e);
  8755. virtual void mouseExit (const MouseEvent& e);
  8756. virtual void mouseDown (const MouseEvent& e);
  8757. virtual void mouseDrag (const MouseEvent& e);
  8758. virtual void mouseUp (const MouseEvent& e);
  8759. virtual void mouseDoubleClick (const MouseEvent& e);
  8760. virtual void mouseWheelMove (const MouseEvent& e,
  8761. float wheelIncrementX,
  8762. float wheelIncrementY);
  8763. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8764. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8765. void addMouseListener (MouseListener* const newListener,
  8766. const bool wantsEventsForAllNestedChildComponents) throw();
  8767. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8768. void addKeyListener (KeyListener* const newListener) throw();
  8769. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8770. virtual bool keyPressed (const KeyPress& key);
  8771. virtual bool keyStateChanged (const bool isKeyDown);
  8772. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8773. enum FocusChangeType
  8774. {
  8775. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8776. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8777. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8778. };
  8779. virtual void focusGained (FocusChangeType cause);
  8780. virtual void focusLost (FocusChangeType cause);
  8781. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8782. bool isMouseOver() const throw();
  8783. bool isMouseButtonDown() const throw();
  8784. bool isMouseOverOrDragging() const throw();
  8785. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8786. const Point<int> getMouseXYRelative() const;
  8787. virtual void resized();
  8788. virtual void moved();
  8789. virtual void childBoundsChanged (Component* child);
  8790. virtual void parentSizeChanged();
  8791. virtual void broughtToFront();
  8792. void addComponentListener (ComponentListener* const newListener) throw();
  8793. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8794. void postCommandMessage (const int commandId) throw();
  8795. virtual void handleCommandMessage (int commandId);
  8796. int runModalLoop();
  8797. void enterModalState (const bool takeKeyboardFocus = true);
  8798. void exitModalState (const int returnValue);
  8799. bool isCurrentlyModal() const throw();
  8800. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8801. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8802. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8803. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8804. virtual void inputAttemptWhenModal();
  8805. NamedValueSet& getProperties() throw() { return properties; }
  8806. const NamedValueSet& getProperties() const throw() { return properties; }
  8807. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8808. void setColour (const int colourId, const Colour& colour);
  8809. void removeColour (const int colourId);
  8810. bool isColourSpecified (const int colourId) const throw();
  8811. void copyAllExplicitColoursTo (Component& target) const throw();
  8812. virtual void colourChanged();
  8813. void* getWindowHandle() const throw();
  8814. uint32 getComponentUID() const throw() { return componentUID; }
  8815. template <class ComponentType>
  8816. class JUCE_API SafePointer : private ComponentListener
  8817. {
  8818. public:
  8819. SafePointer() : comp (0) {}
  8820. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8821. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8822. ~SafePointer() { detach(); }
  8823. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8824. SafePointer& operator= (ComponentType* const newComponent)
  8825. {
  8826. detach();
  8827. comp = newComponent;
  8828. attach();
  8829. return *this;
  8830. }
  8831. operator ComponentType*() const throw() { return comp; }
  8832. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8833. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8834. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8835. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8836. juce_UseDebuggingNewOperator
  8837. private:
  8838. ComponentType* comp;
  8839. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8840. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8841. void componentBeingDeleted (Component&) { comp = 0; }
  8842. };
  8843. class BailOutChecker
  8844. {
  8845. public:
  8846. BailOutChecker (Component* const component1,
  8847. Component* const component2 = 0);
  8848. bool shouldBailOut() const throw();
  8849. private:
  8850. Component::SafePointer<Component> safePointer1, safePointer2;
  8851. Component* const component2;
  8852. BailOutChecker (const BailOutChecker&);
  8853. BailOutChecker& operator= (const BailOutChecker&);
  8854. };
  8855. juce_UseDebuggingNewOperator
  8856. private:
  8857. friend class ComponentPeer;
  8858. friend class InternalDragRepeater;
  8859. friend class MouseInputSource;
  8860. friend class MouseInputSourceInternal;
  8861. static Component* currentlyFocusedComponent;
  8862. String componentName_;
  8863. Component* parentComponent_;
  8864. uint32 componentUID;
  8865. Rectangle<int> bounds_;
  8866. int numDeepMouseListeners;
  8867. Array <Component*> childComponentList_;
  8868. LookAndFeel* lookAndFeel_;
  8869. MouseCursor cursor_;
  8870. ImageEffectFilter* effect_;
  8871. Image* bufferedImage_;
  8872. VoidArray* mouseListeners_;
  8873. VoidArray* keyListeners_;
  8874. ListenerList <ComponentListener> componentListeners;
  8875. NamedValueSet properties;
  8876. struct ComponentFlags
  8877. {
  8878. bool hasHeavyweightPeerFlag : 1;
  8879. bool visibleFlag : 1;
  8880. bool opaqueFlag : 1;
  8881. bool ignoresMouseClicksFlag : 1;
  8882. bool allowChildMouseClicksFlag : 1;
  8883. bool wantsFocusFlag : 1;
  8884. bool isFocusContainerFlag : 1;
  8885. bool dontFocusOnMouseClickFlag : 1;
  8886. bool alwaysOnTopFlag : 1;
  8887. bool bufferToImageFlag : 1;
  8888. bool bringToFrontOnClickFlag : 1;
  8889. bool repaintOnMouseActivityFlag : 1;
  8890. bool draggingFlag : 1;
  8891. bool mouseOverFlag : 1;
  8892. bool mouseInsideFlag : 1;
  8893. bool currentlyModalFlag : 1;
  8894. bool isDisabledFlag : 1;
  8895. bool childCompFocusedFlag : 1;
  8896. #ifdef JUCE_DEBUG
  8897. bool isInsidePaintCall : 1;
  8898. #endif
  8899. };
  8900. union
  8901. {
  8902. uint32 componentFlags_;
  8903. ComponentFlags flags;
  8904. };
  8905. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8906. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8907. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8908. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8909. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8910. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8911. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const float amountX, const float amountY);
  8912. void internalBroughtToFront();
  8913. void internalFocusGain (const FocusChangeType cause);
  8914. void internalFocusLoss (const FocusChangeType cause);
  8915. void internalChildFocusChange (FocusChangeType cause);
  8916. void internalModalInputAttempt();
  8917. void internalModifierKeysChanged();
  8918. void internalChildrenChanged();
  8919. void internalHierarchyChanged();
  8920. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8921. void repaintParent() throw();
  8922. void sendFakeMouseMove() const;
  8923. void takeKeyboardFocus (const FocusChangeType cause);
  8924. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8925. static void giveAwayFocus();
  8926. void sendEnablementChangeMessage();
  8927. static void* runModalLoopCallback (void*);
  8928. static void bringModalComponentToFront();
  8929. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  8930. const Rectangle<int>& clipRect,
  8931. const Component* const compToAvoid) const throw();
  8932. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8933. const int deltaX, const int deltaY) const throw();
  8934. // how much of the component is not off the edges of its parents
  8935. const Rectangle<int> getUnclippedArea() const;
  8936. void sendVisibilityChangeMessage();
  8937. // This is included here just to cause a compile error if your code is still handling
  8938. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8939. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8940. // implement its methods instead of this Component method).
  8941. virtual void filesDropped (const StringArray&, int, int) {}
  8942. // components aren't allowed to have copy constructors, as this would mess up parent
  8943. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8944. // this one to avoid compiler warnings.
  8945. Component (const Component&);
  8946. Component& operator= (const Component&);
  8947. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8948. // subclass to use the new parameters to keyStateChanged)
  8949. virtual void keyStateChanged() {};
  8950. protected:
  8951. virtual void internalRepaint (int x, int y, int w, int h);
  8952. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8953. void handleMessage (const Message&);
  8954. };
  8955. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8956. /*** End of inlined file: juce_Component.h ***/
  8957. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8958. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8959. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8960. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  8961. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8962. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8963. typedef int CommandID;
  8964. namespace StandardApplicationCommandIDs
  8965. {
  8966. static const CommandID quit = 0x1001;
  8967. static const CommandID del = 0x1002;
  8968. static const CommandID cut = 0x1003;
  8969. static const CommandID copy = 0x1004;
  8970. static const CommandID paste = 0x1005;
  8971. static const CommandID selectAll = 0x1006;
  8972. static const CommandID deselectAll = 0x1007;
  8973. }
  8974. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8975. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  8976. struct JUCE_API ApplicationCommandInfo
  8977. {
  8978. ApplicationCommandInfo (const CommandID commandID) throw();
  8979. void setInfo (const String& shortName,
  8980. const String& description,
  8981. const String& categoryName,
  8982. const int flags) throw();
  8983. void setActive (const bool isActive) throw();
  8984. void setTicked (const bool isTicked) throw();
  8985. void addDefaultKeypress (const int keyCode,
  8986. const ModifierKeys& modifiers) throw();
  8987. CommandID commandID;
  8988. String shortName;
  8989. String description;
  8990. String categoryName;
  8991. Array <KeyPress> defaultKeypresses;
  8992. enum CommandFlags
  8993. {
  8994. isDisabled = 1 << 0,
  8995. isTicked = 1 << 1,
  8996. wantsKeyUpDownCallbacks = 1 << 2,
  8997. hiddenFromKeyEditor = 1 << 3,
  8998. readOnlyInKeyEditor = 1 << 4,
  8999. dontTriggerVisualFeedback = 1 << 5
  9000. };
  9001. int flags;
  9002. };
  9003. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9004. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9005. class JUCE_API ApplicationCommandTarget
  9006. {
  9007. public:
  9008. ApplicationCommandTarget();
  9009. virtual ~ApplicationCommandTarget();
  9010. struct JUCE_API InvocationInfo
  9011. {
  9012. InvocationInfo (const CommandID commandID) throw();
  9013. CommandID commandID;
  9014. int commandFlags;
  9015. enum InvocationMethod
  9016. {
  9017. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9018. fromKeyPress, /**< The command is being invoked by a key-press. */
  9019. fromMenu, /**< The command is being invoked by a menu selection. */
  9020. fromButton /**< The command is being invoked by a button click. */
  9021. };
  9022. InvocationMethod invocationMethod;
  9023. Component* originatingComponent;
  9024. KeyPress keyPress;
  9025. bool isKeyDown;
  9026. int millisecsSinceKeyPressed;
  9027. };
  9028. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9029. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9030. virtual void getCommandInfo (const CommandID commandID,
  9031. ApplicationCommandInfo& result) = 0;
  9032. virtual bool perform (const InvocationInfo& info) = 0;
  9033. bool invoke (const InvocationInfo& invocationInfo,
  9034. const bool asynchronously);
  9035. bool invokeDirectly (const CommandID commandID,
  9036. const bool asynchronously);
  9037. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9038. bool isCommandActive (const CommandID commandID);
  9039. ApplicationCommandTarget* findFirstTargetParentComponent();
  9040. juce_UseDebuggingNewOperator
  9041. private:
  9042. // (for async invocation of commands)
  9043. class CommandTargetMessageInvoker : public MessageListener
  9044. {
  9045. public:
  9046. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9047. ~CommandTargetMessageInvoker();
  9048. void handleMessage (const Message& message);
  9049. private:
  9050. ApplicationCommandTarget* const owner;
  9051. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9052. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9053. };
  9054. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9055. friend class CommandTargetMessageInvoker;
  9056. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9057. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9058. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9059. };
  9060. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9061. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9062. /*** Start of inlined file: juce_ActionListener.h ***/
  9063. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9064. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9065. class JUCE_API ActionListener
  9066. {
  9067. public:
  9068. virtual ~ActionListener() {}
  9069. virtual void actionListenerCallback (const String& message) = 0;
  9070. };
  9071. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9072. /*** End of inlined file: juce_ActionListener.h ***/
  9073. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9074. private ActionListener
  9075. {
  9076. protected:
  9077. JUCEApplication();
  9078. public:
  9079. virtual ~JUCEApplication();
  9080. static JUCEApplication* getInstance() throw();
  9081. virtual void initialise (const String& commandLineParameters) = 0;
  9082. bool isInitialising() const throw();
  9083. virtual void shutdown() = 0;
  9084. virtual const String getApplicationName() = 0;
  9085. virtual const String getApplicationVersion();
  9086. virtual bool moreThanOneInstanceAllowed();
  9087. virtual void anotherInstanceStarted (const String& commandLine);
  9088. virtual void systemRequestedQuit();
  9089. virtual void unhandledException (const std::exception* e,
  9090. const String& sourceFilename,
  9091. const int lineNumber);
  9092. static void quit();
  9093. void setApplicationReturnValue (const int newReturnValue) throw();
  9094. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9095. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9096. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9097. static int main (String& commandLine, JUCEApplication* const newApp);
  9098. static int main (int argc, const char* argv[], JUCEApplication* const newApp);
  9099. static void sendUnhandledException (const std::exception* const e,
  9100. const char* const sourceFile,
  9101. const int lineNumber);
  9102. ApplicationCommandTarget* getNextCommandTarget();
  9103. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  9104. void getAllCommands (Array <CommandID>& commands);
  9105. bool perform (const InvocationInfo& info);
  9106. void actionListenerCallback (const String& message);
  9107. private:
  9108. String commandLineParameters;
  9109. int appReturnValue;
  9110. bool stillInitialising;
  9111. ScopedPointer<InterProcessLock> appLock;
  9112. JUCEApplication (const JUCEApplication&);
  9113. JUCEApplication& operator= (const JUCEApplication&);
  9114. public:
  9115. bool initialiseApp (String& commandLine);
  9116. static int shutdownAppAndClearUp();
  9117. };
  9118. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9119. /*** End of inlined file: juce_Application.h ***/
  9120. #endif
  9121. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9122. #endif
  9123. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9124. #endif
  9125. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9126. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9127. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9128. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9129. /*** Start of inlined file: juce_Desktop.h ***/
  9130. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9131. #define __JUCE_DESKTOP_JUCEHEADER__
  9132. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9133. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9134. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9135. class JUCE_API DeletedAtShutdown
  9136. {
  9137. protected:
  9138. DeletedAtShutdown();
  9139. virtual ~DeletedAtShutdown();
  9140. public:
  9141. static void deleteAll();
  9142. private:
  9143. DeletedAtShutdown (const DeletedAtShutdown&);
  9144. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9145. };
  9146. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9147. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9148. /*** Start of inlined file: juce_Timer.h ***/
  9149. #ifndef __JUCE_TIMER_JUCEHEADER__
  9150. #define __JUCE_TIMER_JUCEHEADER__
  9151. class InternalTimerThread;
  9152. class JUCE_API Timer
  9153. {
  9154. protected:
  9155. Timer() throw();
  9156. Timer (const Timer& other) throw();
  9157. public:
  9158. virtual ~Timer();
  9159. virtual void timerCallback() = 0;
  9160. void startTimer (const int intervalInMilliseconds) throw();
  9161. void stopTimer() throw();
  9162. bool isTimerRunning() const throw() { return periodMs > 0; }
  9163. int getTimerInterval() const throw() { return periodMs; }
  9164. private:
  9165. friend class InternalTimerThread;
  9166. int countdownMs, periodMs;
  9167. Timer* previous;
  9168. Timer* next;
  9169. Timer& operator= (const Timer&);
  9170. };
  9171. #endif // __JUCE_TIMER_JUCEHEADER__
  9172. /*** End of inlined file: juce_Timer.h ***/
  9173. class MouseInputSource;
  9174. class MouseInputSourceInternal;
  9175. class MouseListener;
  9176. class JUCE_API FocusChangeListener
  9177. {
  9178. public:
  9179. virtual ~FocusChangeListener() {}
  9180. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9181. };
  9182. class JUCE_API Desktop : private DeletedAtShutdown,
  9183. private Timer,
  9184. private AsyncUpdater
  9185. {
  9186. public:
  9187. static Desktop& JUCE_CALLTYPE getInstance();
  9188. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9189. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9190. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, const bool clippedToWorkArea = true) const;
  9191. static const Point<int> getMousePosition();
  9192. static void setMousePosition (const Point<int>& newPosition);
  9193. static const Point<int> getLastMouseDownPosition() throw();
  9194. static int getMouseButtonClickCounter() throw();
  9195. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9196. static bool isScreenSaverEnabled() throw();
  9197. void addGlobalMouseListener (MouseListener* const listener);
  9198. void removeGlobalMouseListener (MouseListener* const listener);
  9199. void addFocusChangeListener (FocusChangeListener* const listener);
  9200. void removeFocusChangeListener (FocusChangeListener* const listener);
  9201. void setKioskModeComponent (Component* componentToUse,
  9202. const bool allowMenusAndBars = true);
  9203. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9204. int getNumComponents() const throw();
  9205. Component* getComponent (const int index) const throw();
  9206. Component* findComponentAt (const Point<int>& screenPosition) const;
  9207. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9208. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9209. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9210. int getNumDraggingMouseSources() const throw();
  9211. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9212. juce_UseDebuggingNewOperator
  9213. void refreshMonitorSizes();
  9214. static bool canUseSemiTransparentWindows() throw();
  9215. private:
  9216. static Desktop* instance;
  9217. friend class Component;
  9218. friend class ComponentPeer;
  9219. friend class MouseInputSource;
  9220. friend class MouseInputSourceInternal;
  9221. friend class DeletedAtShutdown;
  9222. friend class TopLevelWindowManager;
  9223. OwnedArray <MouseInputSource> mouseSources;
  9224. void createMouseInputSources();
  9225. ListenerList <MouseListener> mouseListeners;
  9226. ListenerList <FocusChangeListener> focusListeners;
  9227. Array <Component*> desktopComponents;
  9228. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9229. Point<int> lastFakeMouseMove;
  9230. void sendMouseMove();
  9231. int mouseClickCounter;
  9232. void incrementMouseClickCounter() throw();
  9233. Component* kioskModeComponent;
  9234. Rectangle<int> kioskComponentOriginalBounds;
  9235. void timerCallback();
  9236. void resetTimer();
  9237. int getNumDisplayMonitors() const throw();
  9238. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9239. void addDesktopComponent (Component* const c);
  9240. void removeDesktopComponent (Component* const c);
  9241. void componentBroughtToFront (Component* const c);
  9242. void triggerFocusCallback();
  9243. void handleAsyncUpdate();
  9244. Desktop();
  9245. ~Desktop();
  9246. Desktop (const Desktop&);
  9247. Desktop& operator= (const Desktop&);
  9248. };
  9249. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9250. /*** End of inlined file: juce_Desktop.h ***/
  9251. class KeyPressMappingSet;
  9252. class ApplicationCommandManagerListener;
  9253. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9254. private FocusChangeListener
  9255. {
  9256. public:
  9257. ApplicationCommandManager();
  9258. virtual ~ApplicationCommandManager();
  9259. void clearCommands();
  9260. void registerCommand (const ApplicationCommandInfo& newCommand);
  9261. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9262. void removeCommand (const CommandID commandID);
  9263. void commandStatusChanged();
  9264. int getNumCommands() const throw() { return commands.size(); }
  9265. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9266. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9267. const String getNameOfCommand (const CommandID commandID) const throw();
  9268. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9269. const StringArray getCommandCategories() const throw();
  9270. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9271. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9272. bool invokeDirectly (const CommandID commandID,
  9273. const bool asynchronously);
  9274. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9275. const bool asynchronously);
  9276. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9277. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9278. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9279. ApplicationCommandInfo& upToDateInfo);
  9280. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9281. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9282. static ApplicationCommandTarget* findDefaultComponentTarget();
  9283. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9284. juce_UseDebuggingNewOperator
  9285. private:
  9286. OwnedArray <ApplicationCommandInfo> commands;
  9287. ListenerList <ApplicationCommandManagerListener> listeners;
  9288. ScopedPointer <KeyPressMappingSet> keyMappings;
  9289. ApplicationCommandTarget* firstTarget;
  9290. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9291. void handleAsyncUpdate();
  9292. void globalFocusChanged (Component*);
  9293. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9294. // version of this method.
  9295. virtual short getFirstCommandTarget() { return 0; }
  9296. };
  9297. class JUCE_API ApplicationCommandManagerListener
  9298. {
  9299. public:
  9300. virtual ~ApplicationCommandManagerListener() {}
  9301. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9302. virtual void applicationCommandListChanged() = 0;
  9303. };
  9304. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9305. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9306. #endif
  9307. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9308. #endif
  9309. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9310. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9311. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9312. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9313. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9314. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9315. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9316. class JUCE_API PropertiesFile : public PropertySet,
  9317. public ChangeBroadcaster,
  9318. private Timer
  9319. {
  9320. public:
  9321. enum FileFormatOptions
  9322. {
  9323. ignoreCaseOfKeyNames = 1,
  9324. storeAsBinary = 2,
  9325. storeAsCompressedBinary = 4,
  9326. storeAsXML = 8
  9327. };
  9328. PropertiesFile (const File& file,
  9329. const int millisecondsBeforeSaving,
  9330. const int options);
  9331. ~PropertiesFile();
  9332. bool saveIfNeeded();
  9333. bool save();
  9334. bool needsToBeSaved() const;
  9335. const File getFile() const { return file; }
  9336. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9337. const String& fileNameSuffix,
  9338. const String& folderName,
  9339. const bool commonToAllUsers,
  9340. const int millisecondsBeforeSaving,
  9341. const int propertiesFileOptions);
  9342. static const File getDefaultAppSettingsFile (const String& applicationName,
  9343. const String& fileNameSuffix,
  9344. const String& folderName,
  9345. const bool commonToAllUsers);
  9346. juce_UseDebuggingNewOperator
  9347. protected:
  9348. virtual void propertyChanged();
  9349. private:
  9350. File file;
  9351. int timerInterval;
  9352. const int options;
  9353. bool needsWriting;
  9354. void timerCallback();
  9355. PropertiesFile (const PropertiesFile&);
  9356. PropertiesFile& operator= (const PropertiesFile&);
  9357. };
  9358. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9359. /*** End of inlined file: juce_PropertiesFile.h ***/
  9360. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9361. {
  9362. public:
  9363. ApplicationProperties() throw();
  9364. ~ApplicationProperties();
  9365. juce_DeclareSingleton (ApplicationProperties, false)
  9366. void setStorageParameters (const String& applicationName,
  9367. const String& fileNameSuffix,
  9368. const String& folderName,
  9369. const int millisecondsBeforeSaving,
  9370. const int propertiesFileOptions) throw();
  9371. bool testWriteAccess (const bool testUserSettings,
  9372. const bool testCommonSettings,
  9373. const bool showWarningDialogOnFailure);
  9374. PropertiesFile* getUserSettings() throw();
  9375. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9376. bool saveIfNeeded();
  9377. void closeFiles();
  9378. juce_UseDebuggingNewOperator
  9379. private:
  9380. ScopedPointer <PropertiesFile> userProps, commonProps;
  9381. String appName, fileSuffix, folderName;
  9382. int msBeforeSaving, options;
  9383. int commonSettingsAreReadOnly;
  9384. ApplicationProperties (const ApplicationProperties&);
  9385. ApplicationProperties& operator= (const ApplicationProperties&);
  9386. void openFiles() throw();
  9387. };
  9388. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9389. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9390. #endif
  9391. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9392. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9393. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9394. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9395. /*** Start of inlined file: juce_AudioFormat.h ***/
  9396. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9397. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9398. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9399. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9400. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9401. class AudioFormat;
  9402. class JUCE_API AudioFormatReader
  9403. {
  9404. protected:
  9405. AudioFormatReader (InputStream* const sourceStream,
  9406. const String& formatName);
  9407. public:
  9408. virtual ~AudioFormatReader();
  9409. const String getFormatName() const throw() { return formatName; }
  9410. bool read (int** destSamples,
  9411. int numDestChannels,
  9412. int64 startSampleInSource,
  9413. int numSamplesToRead,
  9414. const bool fillLeftoverChannelsWithCopies);
  9415. virtual void readMaxLevels (int64 startSample,
  9416. int64 numSamples,
  9417. float& lowestLeft,
  9418. float& highestLeft,
  9419. float& lowestRight,
  9420. float& highestRight);
  9421. int64 searchForLevel (int64 startSample,
  9422. int64 numSamplesToSearch,
  9423. const double magnitudeRangeMinimum,
  9424. const double magnitudeRangeMaximum,
  9425. const int minimumConsecutiveSamples);
  9426. double sampleRate;
  9427. unsigned int bitsPerSample;
  9428. int64 lengthInSamples;
  9429. unsigned int numChannels;
  9430. bool usesFloatingPointData;
  9431. StringPairArray metadataValues;
  9432. InputStream* input;
  9433. virtual bool readSamples (int** destSamples,
  9434. int numDestChannels,
  9435. int startOffsetInDestBuffer,
  9436. int64 startSampleInFile,
  9437. int numSamples) = 0;
  9438. juce_UseDebuggingNewOperator
  9439. private:
  9440. String formatName;
  9441. AudioFormatReader (const AudioFormatReader&);
  9442. AudioFormatReader& operator= (const AudioFormatReader&);
  9443. };
  9444. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9445. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9446. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9447. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9448. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9449. /*** Start of inlined file: juce_AudioSource.h ***/
  9450. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9451. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9452. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9453. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9454. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9455. class AudioFormatReader;
  9456. class AudioFormatWriter;
  9457. class JUCE_API AudioSampleBuffer
  9458. {
  9459. public:
  9460. AudioSampleBuffer (const int numChannels,
  9461. const int numSamples) throw();
  9462. AudioSampleBuffer (float** dataToReferTo,
  9463. const int numChannels,
  9464. const int numSamples) throw();
  9465. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9466. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9467. virtual ~AudioSampleBuffer() throw();
  9468. int getNumChannels() const throw() { return numChannels; }
  9469. int getNumSamples() const throw() { return size; }
  9470. float* getSampleData (const int channelNumber) const throw()
  9471. {
  9472. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9473. return channels [channelNumber];
  9474. }
  9475. float* getSampleData (const int channelNumber,
  9476. const int sampleOffset) const throw()
  9477. {
  9478. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9479. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9480. return channels [channelNumber] + sampleOffset;
  9481. }
  9482. float** getArrayOfChannels() const throw() { return channels; }
  9483. void setSize (const int newNumChannels,
  9484. const int newNumSamples,
  9485. const bool keepExistingContent = false,
  9486. const bool clearExtraSpace = false,
  9487. const bool avoidReallocating = false) throw();
  9488. void setDataToReferTo (float** dataToReferTo,
  9489. const int numChannels,
  9490. const int numSamples) throw();
  9491. void clear() throw();
  9492. void clear (const int startSample,
  9493. const int numSamples) throw();
  9494. void clear (const int channel,
  9495. const int startSample,
  9496. const int numSamples) throw();
  9497. void applyGain (const int channel,
  9498. const int startSample,
  9499. int numSamples,
  9500. const float gain) throw();
  9501. void applyGain (const int startSample,
  9502. const int numSamples,
  9503. const float gain) throw();
  9504. void applyGainRamp (const int channel,
  9505. const int startSample,
  9506. int numSamples,
  9507. float startGain,
  9508. float endGain) throw();
  9509. void addFrom (const int destChannel,
  9510. const int destStartSample,
  9511. const AudioSampleBuffer& source,
  9512. const int sourceChannel,
  9513. const int sourceStartSample,
  9514. int numSamples,
  9515. const float gainToApplyToSource = 1.0f) throw();
  9516. void addFrom (const int destChannel,
  9517. const int destStartSample,
  9518. const float* source,
  9519. int numSamples,
  9520. const float gainToApplyToSource = 1.0f) throw();
  9521. void addFromWithRamp (const int destChannel,
  9522. const int destStartSample,
  9523. const float* source,
  9524. int numSamples,
  9525. float startGain,
  9526. float endGain) throw();
  9527. void copyFrom (const int destChannel,
  9528. const int destStartSample,
  9529. const AudioSampleBuffer& source,
  9530. const int sourceChannel,
  9531. const int sourceStartSample,
  9532. int numSamples) throw();
  9533. void copyFrom (const int destChannel,
  9534. const int destStartSample,
  9535. const float* source,
  9536. int numSamples) throw();
  9537. void copyFrom (const int destChannel,
  9538. const int destStartSample,
  9539. const float* source,
  9540. int numSamples,
  9541. const float gain) throw();
  9542. void copyFromWithRamp (const int destChannel,
  9543. const int destStartSample,
  9544. const float* source,
  9545. int numSamples,
  9546. float startGain,
  9547. float endGain) throw();
  9548. void findMinMax (const int channel,
  9549. const int startSample,
  9550. int numSamples,
  9551. float& minVal,
  9552. float& maxVal) const throw();
  9553. float getMagnitude (const int channel,
  9554. const int startSample,
  9555. const int numSamples) const throw();
  9556. float getMagnitude (const int startSample,
  9557. const int numSamples) const throw();
  9558. float getRMSLevel (const int channel,
  9559. const int startSample,
  9560. const int numSamples) const throw();
  9561. void readFromAudioReader (AudioFormatReader* reader,
  9562. const int startSample,
  9563. const int numSamples,
  9564. const int readerStartSample,
  9565. const bool useReaderLeftChan,
  9566. const bool useReaderRightChan) throw();
  9567. void writeToAudioWriter (AudioFormatWriter* writer,
  9568. const int startSample,
  9569. const int numSamples) const throw();
  9570. juce_UseDebuggingNewOperator
  9571. private:
  9572. int numChannels, size;
  9573. size_t allocatedBytes;
  9574. float** channels;
  9575. HeapBlock <char> allocatedData;
  9576. float* preallocatedChannelSpace [32];
  9577. void allocateData();
  9578. void allocateChannels (float** const dataToReferTo);
  9579. };
  9580. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9581. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9582. struct JUCE_API AudioSourceChannelInfo
  9583. {
  9584. AudioSampleBuffer* buffer;
  9585. int startSample;
  9586. int numSamples;
  9587. void clearActiveBufferRegion() const
  9588. {
  9589. if (buffer != 0)
  9590. buffer->clear (startSample, numSamples);
  9591. }
  9592. };
  9593. class JUCE_API AudioSource
  9594. {
  9595. protected:
  9596. AudioSource() throw() {}
  9597. public:
  9598. virtual ~AudioSource() {}
  9599. virtual void prepareToPlay (int samplesPerBlockExpected,
  9600. double sampleRate) = 0;
  9601. virtual void releaseResources() = 0;
  9602. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9603. };
  9604. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9605. /*** End of inlined file: juce_AudioSource.h ***/
  9606. class JUCE_API AudioFormatWriter
  9607. {
  9608. protected:
  9609. AudioFormatWriter (OutputStream* const destStream,
  9610. const String& formatName,
  9611. const double sampleRate,
  9612. const unsigned int numberOfChannels,
  9613. const unsigned int bitsPerSample);
  9614. public:
  9615. virtual ~AudioFormatWriter();
  9616. const String getFormatName() const throw() { return formatName; }
  9617. virtual bool write (const int** samplesToWrite,
  9618. int numSamples) = 0;
  9619. bool writeFromAudioReader (AudioFormatReader& reader,
  9620. int64 startSample,
  9621. int64 numSamplesToRead);
  9622. bool writeFromAudioSource (AudioSource& source,
  9623. int numSamplesToRead,
  9624. const int samplesPerBlock = 2048);
  9625. double getSampleRate() const throw() { return sampleRate; }
  9626. int getNumChannels() const throw() { return numChannels; }
  9627. int getBitsPerSample() const throw() { return bitsPerSample; }
  9628. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9629. juce_UseDebuggingNewOperator
  9630. protected:
  9631. double sampleRate;
  9632. unsigned int numChannels;
  9633. unsigned int bitsPerSample;
  9634. bool usesFloatingPointData;
  9635. OutputStream* output;
  9636. private:
  9637. String formatName;
  9638. };
  9639. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9640. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9641. class JUCE_API AudioFormat
  9642. {
  9643. public:
  9644. virtual ~AudioFormat();
  9645. const String& getFormatName() const;
  9646. const StringArray& getFileExtensions() const;
  9647. virtual bool canHandleFile (const File& fileToTest);
  9648. virtual const Array <int> getPossibleSampleRates() = 0;
  9649. virtual const Array <int> getPossibleBitDepths() = 0;
  9650. virtual bool canDoStereo() = 0;
  9651. virtual bool canDoMono() = 0;
  9652. virtual bool isCompressed();
  9653. virtual const StringArray getQualityOptions();
  9654. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9655. const bool deleteStreamIfOpeningFails) = 0;
  9656. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9657. double sampleRateToUse,
  9658. unsigned int numberOfChannels,
  9659. int bitsPerSample,
  9660. const StringPairArray& metadataValues,
  9661. int qualityOptionIndex) = 0;
  9662. protected:
  9663. AudioFormat (const String& formatName,
  9664. const tchar** const fileExtensions);
  9665. private:
  9666. String formatName;
  9667. StringArray fileExtensions;
  9668. };
  9669. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9670. /*** End of inlined file: juce_AudioFormat.h ***/
  9671. class JUCE_API AiffAudioFormat : public AudioFormat
  9672. {
  9673. public:
  9674. AiffAudioFormat();
  9675. ~AiffAudioFormat();
  9676. const Array <int> getPossibleSampleRates();
  9677. const Array <int> getPossibleBitDepths();
  9678. bool canDoStereo();
  9679. bool canDoMono();
  9680. #if JUCE_MAC
  9681. bool canHandleFile (const File& fileToTest);
  9682. #endif
  9683. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9684. const bool deleteStreamIfOpeningFails);
  9685. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9686. double sampleRateToUse,
  9687. unsigned int numberOfChannels,
  9688. int bitsPerSample,
  9689. const StringPairArray& metadataValues,
  9690. int qualityOptionIndex);
  9691. juce_UseDebuggingNewOperator
  9692. };
  9693. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9694. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9695. #endif
  9696. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9697. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9698. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9699. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9700. #if JUCE_USE_CDBURNER
  9701. class AudioCDBurner : public ChangeBroadcaster
  9702. {
  9703. public:
  9704. static const StringArray findAvailableDevices();
  9705. static AudioCDBurner* openDevice (const int deviceIndex);
  9706. ~AudioCDBurner();
  9707. enum DiskState
  9708. {
  9709. unknown, /**< An error condition, if the device isn't responding. */
  9710. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9711. may seem to be permanently open. */
  9712. noDisc, /**< The drive has no disk in it. */
  9713. writableDiskPresent, /**< The drive contains a writeable disk. */
  9714. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9715. };
  9716. DiskState getDiskState() const;
  9717. bool isDiskPresent() const;
  9718. bool openTray();
  9719. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9720. const Array<int> getAvailableWriteSpeeds() const;
  9721. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9722. int getNumAvailableAudioBlocks() const;
  9723. bool addAudioTrack (AudioSource* source, int numSamples);
  9724. class BurnProgressListener
  9725. {
  9726. public:
  9727. BurnProgressListener() throw() {}
  9728. virtual ~BurnProgressListener() {}
  9729. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9730. };
  9731. const String burn (BurnProgressListener* listener,
  9732. bool ejectDiscAfterwards,
  9733. bool performFakeBurnForTesting,
  9734. int writeSpeed);
  9735. void abortBurn();
  9736. juce_UseDebuggingNewOperator
  9737. private:
  9738. AudioCDBurner (const int deviceIndex);
  9739. class Pimpl;
  9740. friend class ScopedPointer<Pimpl>;
  9741. ScopedPointer<Pimpl> pimpl;
  9742. };
  9743. #endif
  9744. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9745. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9746. #endif
  9747. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9748. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9749. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9750. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9751. #if JUCE_USE_CDREADER
  9752. #if JUCE_MAC
  9753. #endif
  9754. class JUCE_API AudioCDReader : public AudioFormatReader
  9755. {
  9756. public:
  9757. static const StringArray getAvailableCDNames();
  9758. static AudioCDReader* createReaderForCD (const int index);
  9759. ~AudioCDReader();
  9760. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9761. int64 startSampleInFile, int numSamples);
  9762. bool isCDStillPresent() const;
  9763. int getNumTracks() const;
  9764. int getPositionOfTrackStart (int trackNum) const;
  9765. bool isTrackAudio (int trackNum) const;
  9766. void refreshTrackLengths();
  9767. void enableIndexScanning (bool enabled);
  9768. int getLastIndex() const;
  9769. const Array <int> findIndexesInTrack (const int trackNumber);
  9770. int getCDDBId();
  9771. void ejectDisk();
  9772. juce_UseDebuggingNewOperator
  9773. private:
  9774. #if JUCE_MAC
  9775. File volumeDir;
  9776. Array<File> tracks;
  9777. Array<int> trackStartSamples;
  9778. int currentReaderTrack;
  9779. ScopedPointer <AudioFormatReader> reader;
  9780. AudioCDReader (const File& volume);
  9781. public:
  9782. static int compareElements (const File&, const File&);
  9783. private:
  9784. #elif JUCE_WINDOWS
  9785. int numTracks;
  9786. int trackStarts[100];
  9787. bool audioTracks [100];
  9788. void* handle;
  9789. bool indexingEnabled;
  9790. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9791. MemoryBlock buffer;
  9792. AudioCDReader (void* handle);
  9793. int getIndexAt (int samplePos);
  9794. #elif JUCE_LINUX
  9795. AudioCDReader();
  9796. #endif
  9797. AudioCDReader (const AudioCDReader&);
  9798. AudioCDReader& operator= (const AudioCDReader&);
  9799. };
  9800. #endif
  9801. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9802. /*** End of inlined file: juce_AudioCDReader.h ***/
  9803. #endif
  9804. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9805. #endif
  9806. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9807. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9808. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9809. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9810. class JUCE_API AudioFormatManager
  9811. {
  9812. public:
  9813. AudioFormatManager();
  9814. ~AudioFormatManager();
  9815. juce_DeclareSingleton (AudioFormatManager, false);
  9816. void registerFormat (AudioFormat* newFormat,
  9817. const bool makeThisTheDefaultFormat);
  9818. void registerBasicFormats();
  9819. void clearFormats();
  9820. int getNumKnownFormats() const;
  9821. AudioFormat* getKnownFormat (const int index) const;
  9822. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9823. AudioFormat* getDefaultFormat() const;
  9824. const String getWildcardForAllFormats() const;
  9825. AudioFormatReader* createReaderFor (const File& audioFile);
  9826. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9827. juce_UseDebuggingNewOperator
  9828. private:
  9829. VoidArray knownFormats;
  9830. int defaultFormatIndex;
  9831. };
  9832. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9833. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9834. #endif
  9835. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9836. #endif
  9837. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9838. #endif
  9839. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9840. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9841. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9842. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9843. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9844. {
  9845. public:
  9846. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9847. const int64 subsectionStartSample,
  9848. const int64 subsectionLength,
  9849. const bool deleteSourceWhenDeleted);
  9850. ~AudioSubsectionReader();
  9851. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9852. int64 startSampleInFile, int numSamples);
  9853. void readMaxLevels (int64 startSample,
  9854. int64 numSamples,
  9855. float& lowestLeft,
  9856. float& highestLeft,
  9857. float& lowestRight,
  9858. float& highestRight);
  9859. juce_UseDebuggingNewOperator
  9860. private:
  9861. AudioFormatReader* const source;
  9862. int64 startSample, length;
  9863. const bool deleteSourceWhenDeleted;
  9864. AudioSubsectionReader (const AudioSubsectionReader&);
  9865. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9866. };
  9867. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9868. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9869. #endif
  9870. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9871. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9872. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9873. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9874. class AudioThumbnailCache;
  9875. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9876. public TimeSliceClient,
  9877. private Timer
  9878. {
  9879. public:
  9880. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9881. AudioFormatManager& formatManagerToUse,
  9882. AudioThumbnailCache& cacheToUse);
  9883. ~AudioThumbnail();
  9884. void setSource (InputSource* const newSource);
  9885. void loadFrom (InputStream& input);
  9886. void saveTo (OutputStream& output) const;
  9887. int getNumChannels() const throw();
  9888. double getTotalLength() const throw();
  9889. void drawChannel (Graphics& g,
  9890. int x, int y, int w, int h,
  9891. double startTimeSeconds,
  9892. double endTimeSeconds,
  9893. int channelNum,
  9894. const float verticalZoomFactor);
  9895. bool isFullyLoaded() const throw();
  9896. bool useTimeSlice();
  9897. void timerCallback();
  9898. juce_UseDebuggingNewOperator
  9899. private:
  9900. AudioFormatManager& formatManagerToUse;
  9901. AudioThumbnailCache& cache;
  9902. ScopedPointer <InputSource> source;
  9903. CriticalSection readerLock;
  9904. ScopedPointer <AudioFormatReader> reader;
  9905. MemoryBlock data, cachedLevels;
  9906. int orginalSamplesPerThumbnailSample;
  9907. int numChannelsCached, numSamplesCached;
  9908. double cachedStart, cachedTimePerPixel;
  9909. bool cacheNeedsRefilling;
  9910. void clear();
  9911. AudioFormatReader* createReader() const;
  9912. void generateSection (AudioFormatReader& reader,
  9913. int64 startSample,
  9914. int numSamples);
  9915. char* getChannelData (int channel) const;
  9916. void refillCache (const int numSamples,
  9917. double startTime,
  9918. const double timePerPixel);
  9919. friend class AudioThumbnailCache;
  9920. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9921. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9922. // returns true if more needs to be read
  9923. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9924. };
  9925. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9926. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9927. #endif
  9928. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9929. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9930. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9931. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9932. struct ThumbnailCacheEntry;
  9933. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9934. {
  9935. public:
  9936. AudioThumbnailCache (const int maxNumThumbsToStore);
  9937. ~AudioThumbnailCache();
  9938. void clear();
  9939. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9940. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9941. juce_UseDebuggingNewOperator
  9942. private:
  9943. OwnedArray <ThumbnailCacheEntry> thumbs;
  9944. int maxNumThumbsToStore;
  9945. friend class AudioThumbnail;
  9946. void addThumbnail (AudioThumbnail* const thumb);
  9947. void removeThumbnail (AudioThumbnail* const thumb);
  9948. };
  9949. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9950. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9951. #endif
  9952. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9953. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  9954. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9955. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9956. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9957. class JUCE_API FlacAudioFormat : public AudioFormat
  9958. {
  9959. public:
  9960. FlacAudioFormat();
  9961. ~FlacAudioFormat();
  9962. const Array <int> getPossibleSampleRates();
  9963. const Array <int> getPossibleBitDepths();
  9964. bool canDoStereo();
  9965. bool canDoMono();
  9966. bool isCompressed();
  9967. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9968. const bool deleteStreamIfOpeningFails);
  9969. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9970. double sampleRateToUse,
  9971. unsigned int numberOfChannels,
  9972. int bitsPerSample,
  9973. const StringPairArray& metadataValues,
  9974. int qualityOptionIndex);
  9975. juce_UseDebuggingNewOperator
  9976. };
  9977. #endif
  9978. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9979. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  9980. #endif
  9981. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9982. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  9983. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9984. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9985. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9986. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9987. {
  9988. public:
  9989. OggVorbisAudioFormat();
  9990. ~OggVorbisAudioFormat();
  9991. const Array <int> getPossibleSampleRates();
  9992. const Array <int> getPossibleBitDepths();
  9993. bool canDoStereo();
  9994. bool canDoMono();
  9995. bool isCompressed();
  9996. const StringArray getQualityOptions();
  9997. int estimateOggFileQuality (const File& source);
  9998. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9999. const bool deleteStreamIfOpeningFails);
  10000. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10001. double sampleRateToUse,
  10002. unsigned int numberOfChannels,
  10003. int bitsPerSample,
  10004. const StringPairArray& metadataValues,
  10005. int qualityOptionIndex);
  10006. juce_UseDebuggingNewOperator
  10007. };
  10008. #endif
  10009. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10010. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10011. #endif
  10012. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10013. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10014. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10015. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10016. #if JUCE_QUICKTIME
  10017. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10018. {
  10019. public:
  10020. QuickTimeAudioFormat();
  10021. ~QuickTimeAudioFormat();
  10022. const Array <int> getPossibleSampleRates();
  10023. const Array <int> getPossibleBitDepths();
  10024. bool canDoStereo();
  10025. bool canDoMono();
  10026. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10027. const bool deleteStreamIfOpeningFails);
  10028. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10029. double sampleRateToUse,
  10030. unsigned int numberOfChannels,
  10031. int bitsPerSample,
  10032. const StringPairArray& metadataValues,
  10033. int qualityOptionIndex);
  10034. juce_UseDebuggingNewOperator
  10035. };
  10036. #endif
  10037. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10038. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10039. #endif
  10040. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10041. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10042. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10043. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10044. class JUCE_API WavAudioFormat : public AudioFormat
  10045. {
  10046. public:
  10047. WavAudioFormat();
  10048. ~WavAudioFormat();
  10049. static const tchar* const bwavDescription;
  10050. static const tchar* const bwavOriginator;
  10051. static const tchar* const bwavOriginatorRef;
  10052. static const tchar* const bwavOriginationDate;
  10053. static const tchar* const bwavOriginationTime;
  10054. static const tchar* const bwavTimeReference;
  10055. static const tchar* const bwavCodingHistory;
  10056. static const StringPairArray createBWAVMetadata (const String& description,
  10057. const String& originator,
  10058. const String& originatorRef,
  10059. const Time& dateAndTime,
  10060. const int64 timeReferenceSamples,
  10061. const String& codingHistory);
  10062. const Array <int> getPossibleSampleRates();
  10063. const Array <int> getPossibleBitDepths();
  10064. bool canDoStereo();
  10065. bool canDoMono();
  10066. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10067. const bool deleteStreamIfOpeningFails);
  10068. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10069. double sampleRateToUse,
  10070. unsigned int numberOfChannels,
  10071. int bitsPerSample,
  10072. const StringPairArray& metadataValues,
  10073. int qualityOptionIndex);
  10074. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10075. juce_UseDebuggingNewOperator
  10076. };
  10077. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10078. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10079. #endif
  10080. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10081. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10082. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10083. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10084. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10085. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10086. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10087. class JUCE_API PositionableAudioSource : public AudioSource
  10088. {
  10089. protected:
  10090. PositionableAudioSource() throw() {}
  10091. public:
  10092. ~PositionableAudioSource() {}
  10093. virtual void setNextReadPosition (int newPosition) = 0;
  10094. virtual int getNextReadPosition() const = 0;
  10095. virtual int getTotalLength() const = 0;
  10096. virtual bool isLooping() const = 0;
  10097. };
  10098. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10099. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10100. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10101. {
  10102. public:
  10103. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10104. const bool deleteReaderWhenThisIsDeleted);
  10105. ~AudioFormatReaderSource();
  10106. void setLooping (const bool shouldLoop) throw();
  10107. bool isLooping() const { return looping; }
  10108. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10109. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10110. void releaseResources();
  10111. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10112. void setNextReadPosition (int newPosition);
  10113. int getNextReadPosition() const;
  10114. int getTotalLength() const;
  10115. juce_UseDebuggingNewOperator
  10116. private:
  10117. AudioFormatReader* reader;
  10118. bool deleteReader;
  10119. int volatile nextPlayPos;
  10120. bool volatile looping;
  10121. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10122. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10123. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10124. };
  10125. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10126. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10127. #endif
  10128. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10129. #endif
  10130. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10131. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10132. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10133. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10134. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10135. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10136. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10137. class AudioIODevice;
  10138. class JUCE_API AudioIODeviceCallback
  10139. {
  10140. public:
  10141. virtual ~AudioIODeviceCallback() {}
  10142. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10143. int numInputChannels,
  10144. float** outputChannelData,
  10145. int numOutputChannels,
  10146. int numSamples) = 0;
  10147. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10148. virtual void audioDeviceStopped() = 0;
  10149. };
  10150. class JUCE_API AudioIODevice
  10151. {
  10152. public:
  10153. virtual ~AudioIODevice();
  10154. const String& getName() const throw() { return name; }
  10155. const String& getTypeName() const throw() { return typeName; }
  10156. virtual const StringArray getOutputChannelNames() = 0;
  10157. virtual const StringArray getInputChannelNames() = 0;
  10158. virtual int getNumSampleRates() = 0;
  10159. virtual double getSampleRate (int index) = 0;
  10160. virtual int getNumBufferSizesAvailable() = 0;
  10161. virtual int getBufferSizeSamples (int index) = 0;
  10162. virtual int getDefaultBufferSize() = 0;
  10163. virtual const String open (const BitArray& inputChannels,
  10164. const BitArray& outputChannels,
  10165. double sampleRate,
  10166. int bufferSizeSamples) = 0;
  10167. virtual void close() = 0;
  10168. virtual bool isOpen() = 0;
  10169. virtual void start (AudioIODeviceCallback* callback) = 0;
  10170. virtual void stop() = 0;
  10171. virtual bool isPlaying() = 0;
  10172. virtual const String getLastError() = 0;
  10173. virtual int getCurrentBufferSizeSamples() = 0;
  10174. virtual double getCurrentSampleRate() = 0;
  10175. virtual int getCurrentBitDepth() = 0;
  10176. virtual const BitArray getActiveOutputChannels() const = 0;
  10177. virtual const BitArray getActiveInputChannels() const = 0;
  10178. virtual int getOutputLatencyInSamples() = 0;
  10179. virtual int getInputLatencyInSamples() = 0;
  10180. virtual bool hasControlPanel() const;
  10181. virtual bool showControlPanel();
  10182. protected:
  10183. AudioIODevice (const String& deviceName,
  10184. const String& typeName);
  10185. String name, typeName;
  10186. };
  10187. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10188. /*** End of inlined file: juce_AudioIODevice.h ***/
  10189. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10190. {
  10191. public:
  10192. AudioSourcePlayer();
  10193. virtual ~AudioSourcePlayer();
  10194. void setSource (AudioSource* newSource);
  10195. AudioSource* getCurrentSource() const throw() { return source; }
  10196. void setGain (const float newGain) throw();
  10197. void audioDeviceIOCallback (const float** inputChannelData,
  10198. int totalNumInputChannels,
  10199. float** outputChannelData,
  10200. int totalNumOutputChannels,
  10201. int numSamples);
  10202. void audioDeviceAboutToStart (AudioIODevice* device);
  10203. void audioDeviceStopped();
  10204. juce_UseDebuggingNewOperator
  10205. private:
  10206. CriticalSection readLock;
  10207. AudioSource* source;
  10208. double sampleRate;
  10209. int bufferSize;
  10210. float* channels [128];
  10211. float* outputChans [128];
  10212. const float* inputChans [128];
  10213. AudioSampleBuffer tempBuffer;
  10214. float lastGain, gain;
  10215. AudioSourcePlayer (const AudioSourcePlayer&);
  10216. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10217. };
  10218. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10219. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10220. #endif
  10221. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10222. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10223. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10224. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10225. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10226. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10227. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10228. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10229. {
  10230. public:
  10231. BufferingAudioSource (PositionableAudioSource* source,
  10232. const bool deleteSourceWhenDeleted,
  10233. int numberOfSamplesToBuffer);
  10234. ~BufferingAudioSource();
  10235. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10236. void releaseResources();
  10237. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10238. void setNextReadPosition (int newPosition);
  10239. int getNextReadPosition() const;
  10240. int getTotalLength() const { return source->getTotalLength(); }
  10241. bool isLooping() const { return source->isLooping(); }
  10242. juce_UseDebuggingNewOperator
  10243. private:
  10244. PositionableAudioSource* source;
  10245. bool deleteSourceWhenDeleted;
  10246. int numberOfSamplesToBuffer;
  10247. AudioSampleBuffer buffer;
  10248. CriticalSection bufferStartPosLock;
  10249. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10250. bool wasSourceLooping;
  10251. double volatile sampleRate;
  10252. friend class SharedBufferingAudioSourceThread;
  10253. bool readNextBufferChunk();
  10254. void readBufferSection (int start, int length, int bufferOffset);
  10255. BufferingAudioSource (const BufferingAudioSource&);
  10256. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10257. };
  10258. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10259. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10260. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10261. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10262. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10263. class JUCE_API ResamplingAudioSource : public AudioSource
  10264. {
  10265. public:
  10266. ResamplingAudioSource (AudioSource* const inputSource,
  10267. const bool deleteInputWhenDeleted);
  10268. ~ResamplingAudioSource();
  10269. void setResamplingRatio (const double samplesInPerOutputSample);
  10270. double getResamplingRatio() const throw() { return ratio; }
  10271. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10272. void releaseResources();
  10273. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10274. juce_UseDebuggingNewOperator
  10275. private:
  10276. AudioSource* const input;
  10277. const bool deleteInputWhenDeleted;
  10278. double ratio, lastRatio;
  10279. AudioSampleBuffer buffer;
  10280. int bufferPos, sampsInBuffer;
  10281. double subSampleOffset;
  10282. double coefficients[6];
  10283. CriticalSection ratioLock;
  10284. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10285. void createLowPass (const double proportionalRate);
  10286. struct FilterState
  10287. {
  10288. double x1, x2, y1, y2;
  10289. };
  10290. FilterState filterStates[2];
  10291. void resetFilters();
  10292. void applyFilter (float* samples, int num, FilterState& fs);
  10293. ResamplingAudioSource (const ResamplingAudioSource&);
  10294. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10295. };
  10296. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10297. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10298. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10299. public ChangeBroadcaster
  10300. {
  10301. public:
  10302. AudioTransportSource();
  10303. ~AudioTransportSource();
  10304. void setSource (PositionableAudioSource* const newSource,
  10305. int readAheadBufferSize = 0,
  10306. double sourceSampleRateToCorrectFor = 0.0);
  10307. void setPosition (double newPosition);
  10308. double getCurrentPosition() const;
  10309. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10310. void start();
  10311. void stop();
  10312. bool isPlaying() const throw() { return playing; }
  10313. void setGain (const float newGain) throw();
  10314. float getGain() const throw() { return gain; }
  10315. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10316. void releaseResources();
  10317. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10318. void setNextReadPosition (int newPosition);
  10319. int getNextReadPosition() const;
  10320. int getTotalLength() const;
  10321. bool isLooping() const;
  10322. juce_UseDebuggingNewOperator
  10323. private:
  10324. PositionableAudioSource* source;
  10325. ResamplingAudioSource* resamplerSource;
  10326. BufferingAudioSource* bufferingSource;
  10327. PositionableAudioSource* positionableSource;
  10328. AudioSource* masterSource;
  10329. CriticalSection callbackLock;
  10330. float volatile gain, lastGain;
  10331. bool volatile playing, stopped;
  10332. double sampleRate, sourceSampleRate;
  10333. int blockSize, readAheadBufferSize;
  10334. bool isPrepared, inputStreamEOF;
  10335. AudioTransportSource (const AudioTransportSource&);
  10336. AudioTransportSource& operator= (const AudioTransportSource&);
  10337. };
  10338. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10339. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10340. #endif
  10341. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10342. #endif
  10343. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10344. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10345. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10346. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10347. class ChannelRemappingAudioSource : public AudioSource
  10348. {
  10349. public:
  10350. ChannelRemappingAudioSource (AudioSource* const source,
  10351. const bool deleteSourceWhenDeleted);
  10352. ~ChannelRemappingAudioSource();
  10353. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10354. void clearAllMappings() throw();
  10355. void setInputChannelMapping (const int destChannelIndex,
  10356. const int sourceChannelIndex) throw();
  10357. void setOutputChannelMapping (const int sourceChannelIndex,
  10358. const int destChannelIndex) throw();
  10359. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10360. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10361. XmlElement* createXml() const throw();
  10362. void restoreFromXml (const XmlElement& e) throw();
  10363. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10364. void releaseResources();
  10365. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10366. juce_UseDebuggingNewOperator
  10367. private:
  10368. int requiredNumberOfChannels;
  10369. Array <int> remappedInputs, remappedOutputs;
  10370. AudioSource* const source;
  10371. const bool deleteSourceWhenDeleted;
  10372. AudioSampleBuffer buffer;
  10373. AudioSourceChannelInfo remappedInfo;
  10374. CriticalSection lock;
  10375. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10376. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10377. };
  10378. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10379. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10380. #endif
  10381. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10382. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10383. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10384. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10385. /*** Start of inlined file: juce_IIRFilter.h ***/
  10386. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10387. #define __JUCE_IIRFILTER_JUCEHEADER__
  10388. class JUCE_API IIRFilter
  10389. {
  10390. public:
  10391. IIRFilter() throw();
  10392. IIRFilter (const IIRFilter& other) throw();
  10393. ~IIRFilter() throw();
  10394. void reset() throw();
  10395. void processSamples (float* const samples,
  10396. const int numSamples) throw();
  10397. float processSingleSampleRaw (const float sample) throw();
  10398. void makeLowPass (const double sampleRate,
  10399. const double frequency) throw();
  10400. void makeHighPass (const double sampleRate,
  10401. const double frequency) throw();
  10402. void makeLowShelf (const double sampleRate,
  10403. const double cutOffFrequency,
  10404. const double Q,
  10405. const float gainFactor) throw();
  10406. void makeHighShelf (const double sampleRate,
  10407. const double cutOffFrequency,
  10408. const double Q,
  10409. const float gainFactor) throw();
  10410. void makeBandPass (const double sampleRate,
  10411. const double centreFrequency,
  10412. const double Q,
  10413. const float gainFactor) throw();
  10414. void makeInactive() throw();
  10415. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10416. juce_UseDebuggingNewOperator
  10417. protected:
  10418. CriticalSection processLock;
  10419. void setCoefficients (double c1, double c2, double c3,
  10420. double c4, double c5, double c6) throw();
  10421. bool active;
  10422. float coefficients[6];
  10423. float x1, x2, y1, y2;
  10424. // (use the copyCoefficientsFrom() method instead of this operator)
  10425. IIRFilter& operator= (const IIRFilter&);
  10426. };
  10427. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10428. /*** End of inlined file: juce_IIRFilter.h ***/
  10429. class JUCE_API IIRFilterAudioSource : public AudioSource
  10430. {
  10431. public:
  10432. IIRFilterAudioSource (AudioSource* const inputSource,
  10433. const bool deleteInputWhenDeleted);
  10434. ~IIRFilterAudioSource();
  10435. void setFilterParameters (const IIRFilter& newSettings);
  10436. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10437. void releaseResources();
  10438. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10439. juce_UseDebuggingNewOperator
  10440. private:
  10441. AudioSource* const input;
  10442. const bool deleteInputWhenDeleted;
  10443. OwnedArray <IIRFilter> iirFilters;
  10444. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10445. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10446. };
  10447. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10448. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10449. #endif
  10450. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10451. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10452. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10453. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10454. class JUCE_API MixerAudioSource : public AudioSource
  10455. {
  10456. public:
  10457. MixerAudioSource();
  10458. ~MixerAudioSource();
  10459. void addInputSource (AudioSource* newInput,
  10460. const bool deleteWhenRemoved);
  10461. void removeInputSource (AudioSource* input,
  10462. const bool deleteSource);
  10463. void removeAllInputs();
  10464. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10465. void releaseResources();
  10466. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10467. juce_UseDebuggingNewOperator
  10468. private:
  10469. VoidArray inputs;
  10470. BitArray inputsToDelete;
  10471. CriticalSection lock;
  10472. AudioSampleBuffer tempBuffer;
  10473. double currentSampleRate;
  10474. int bufferSizeExpected;
  10475. MixerAudioSource (const MixerAudioSource&);
  10476. MixerAudioSource& operator= (const MixerAudioSource&);
  10477. };
  10478. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10479. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10480. #endif
  10481. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10482. #endif
  10483. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10484. #endif
  10485. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10486. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10487. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10488. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10489. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10490. {
  10491. public:
  10492. ToneGeneratorAudioSource();
  10493. ~ToneGeneratorAudioSource();
  10494. void setAmplitude (const float newAmplitude);
  10495. void setFrequency (const double newFrequencyHz);
  10496. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10497. void releaseResources();
  10498. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10499. juce_UseDebuggingNewOperator
  10500. private:
  10501. double frequency, sampleRate;
  10502. double currentPhase, phasePerSample;
  10503. float amplitude;
  10504. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10505. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10506. };
  10507. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10508. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10509. #endif
  10510. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10511. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10512. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10513. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10514. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10515. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10516. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10517. class AudioDeviceManager;
  10518. class Component;
  10519. class JUCE_API AudioIODeviceType
  10520. {
  10521. public:
  10522. const String& getTypeName() const throw() { return typeName; }
  10523. virtual void scanForDevices() = 0;
  10524. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10525. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10526. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10527. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10528. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10529. const String& inputDeviceName) = 0;
  10530. struct DeviceSetupDetails
  10531. {
  10532. AudioDeviceManager* manager;
  10533. int minNumInputChannels, maxNumInputChannels;
  10534. int minNumOutputChannels, maxNumOutputChannels;
  10535. bool useStereoPairs;
  10536. };
  10537. virtual ~AudioIODeviceType();
  10538. protected:
  10539. AudioIODeviceType (const tchar* const typeName);
  10540. private:
  10541. String typeName;
  10542. AudioIODeviceType (const AudioIODeviceType&);
  10543. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10544. };
  10545. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10546. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10547. /*** Start of inlined file: juce_MidiInput.h ***/
  10548. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10549. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10550. /*** Start of inlined file: juce_MidiMessage.h ***/
  10551. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10552. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10553. class JUCE_API MidiMessage
  10554. {
  10555. public:
  10556. MidiMessage (const int byte1,
  10557. const int byte2,
  10558. const int byte3,
  10559. const double timeStamp = 0) throw();
  10560. MidiMessage (const int byte1,
  10561. const int byte2,
  10562. const double timeStamp = 0) throw();
  10563. MidiMessage (const int byte1,
  10564. const double timeStamp = 0) throw();
  10565. MidiMessage (const uint8* const data,
  10566. const int dataSize,
  10567. const double timeStamp = 0) throw();
  10568. MidiMessage (const uint8* data,
  10569. int size,
  10570. int& numBytesUsed,
  10571. uint8 lastStatusByte,
  10572. double timeStamp = 0) throw();
  10573. MidiMessage (const MidiMessage& other) throw();
  10574. MidiMessage (const MidiMessage& other,
  10575. const double newTimeStamp) throw();
  10576. ~MidiMessage() throw();
  10577. MidiMessage& operator= (const MidiMessage& other) throw();
  10578. uint8* getRawData() const throw() { return data; }
  10579. int getRawDataSize() const throw() { return size; }
  10580. double getTimeStamp() const throw() { return timeStamp; }
  10581. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10582. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10583. int getChannel() const throw();
  10584. bool isForChannel (const int channelNumber) const throw();
  10585. void setChannel (const int newChannelNumber) throw();
  10586. bool isSysEx() const throw();
  10587. const uint8* getSysExData() const throw();
  10588. int getSysExDataSize() const throw();
  10589. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10590. static const MidiMessage noteOn (const int channel,
  10591. const int noteNumber,
  10592. const float velocity) throw();
  10593. static const MidiMessage noteOn (const int channel,
  10594. const int noteNumber,
  10595. const uint8 velocity) throw();
  10596. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10597. static const MidiMessage noteOff (const int channel,
  10598. const int noteNumber) throw();
  10599. bool isNoteOnOrOff() const throw();
  10600. int getNoteNumber() const throw();
  10601. void setNoteNumber (const int newNoteNumber) throw();
  10602. uint8 getVelocity() const throw();
  10603. float getFloatVelocity() const throw();
  10604. void setVelocity (const float newVelocity) throw();
  10605. void multiplyVelocity (const float scaleFactor) throw();
  10606. bool isProgramChange() const throw();
  10607. int getProgramChangeNumber() const throw();
  10608. static const MidiMessage programChange (const int channel,
  10609. const int programNumber) throw();
  10610. bool isPitchWheel() const throw();
  10611. int getPitchWheelValue() const throw();
  10612. static const MidiMessage pitchWheel (const int channel,
  10613. const int position) throw();
  10614. bool isAftertouch() const throw();
  10615. int getAfterTouchValue() const throw();
  10616. static const MidiMessage aftertouchChange (const int channel,
  10617. const int noteNumber,
  10618. const int aftertouchAmount) throw();
  10619. bool isChannelPressure() const throw();
  10620. int getChannelPressureValue() const throw();
  10621. static const MidiMessage channelPressureChange (const int channel,
  10622. const int pressure) throw();
  10623. bool isController() const throw();
  10624. int getControllerNumber() const throw();
  10625. int getControllerValue() const throw();
  10626. static const MidiMessage controllerEvent (const int channel,
  10627. const int controllerType,
  10628. const int value) throw();
  10629. bool isAllNotesOff() const throw();
  10630. bool isAllSoundOff() const throw();
  10631. static const MidiMessage allNotesOff (const int channel) throw();
  10632. static const MidiMessage allSoundOff (const int channel) throw();
  10633. static const MidiMessage allControllersOff (const int channel) throw();
  10634. bool isMetaEvent() const throw();
  10635. int getMetaEventType() const throw();
  10636. const uint8* getMetaEventData() const throw();
  10637. int getMetaEventLength() const throw();
  10638. bool isTrackMetaEvent() const throw();
  10639. bool isEndOfTrackMetaEvent() const throw();
  10640. static const MidiMessage endOfTrack() throw();
  10641. bool isTrackNameEvent() const throw();
  10642. bool isTextMetaEvent() const throw();
  10643. const String getTextFromTextMetaEvent() const throw();
  10644. bool isTempoMetaEvent() const throw();
  10645. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10646. double getTempoSecondsPerQuarterNote() const throw();
  10647. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10648. bool isTimeSignatureMetaEvent() const throw();
  10649. void getTimeSignatureInfo (int& numerator,
  10650. int& denominator) const throw();
  10651. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10652. const int denominator) throw();
  10653. bool isKeySignatureMetaEvent() const throw();
  10654. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10655. bool isMidiChannelMetaEvent() const throw();
  10656. int getMidiChannelMetaEventChannel() const throw();
  10657. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10658. bool isActiveSense() const throw();
  10659. bool isMidiStart() const throw();
  10660. static const MidiMessage midiStart() throw();
  10661. bool isMidiContinue() const throw();
  10662. static const MidiMessage midiContinue() throw();
  10663. bool isMidiStop() const throw();
  10664. static const MidiMessage midiStop() throw();
  10665. bool isMidiClock() const throw();
  10666. static const MidiMessage midiClock() throw();
  10667. bool isSongPositionPointer() const throw();
  10668. int getSongPositionPointerMidiBeat() const throw();
  10669. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10670. bool isQuarterFrame() const throw();
  10671. int getQuarterFrameSequenceNumber() const throw();
  10672. int getQuarterFrameValue() const throw();
  10673. static const MidiMessage quarterFrame (const int sequenceNumber,
  10674. const int value) throw();
  10675. enum SmpteTimecodeType
  10676. {
  10677. fps24 = 0,
  10678. fps25 = 1,
  10679. fps30drop = 2,
  10680. fps30 = 3
  10681. };
  10682. bool isFullFrame() const throw();
  10683. void getFullFrameParameters (int& hours,
  10684. int& minutes,
  10685. int& seconds,
  10686. int& frames,
  10687. SmpteTimecodeType& timecodeType) const throw();
  10688. static const MidiMessage fullFrame (const int hours,
  10689. const int minutes,
  10690. const int seconds,
  10691. const int frames,
  10692. SmpteTimecodeType timecodeType);
  10693. enum MidiMachineControlCommand
  10694. {
  10695. mmc_stop = 1,
  10696. mmc_play = 2,
  10697. mmc_deferredplay = 3,
  10698. mmc_fastforward = 4,
  10699. mmc_rewind = 5,
  10700. mmc_recordStart = 6,
  10701. mmc_recordStop = 7,
  10702. mmc_pause = 9
  10703. };
  10704. bool isMidiMachineControlMessage() const throw();
  10705. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10706. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10707. bool isMidiMachineControlGoto (int& hours,
  10708. int& minutes,
  10709. int& seconds,
  10710. int& frames) const throw();
  10711. static const MidiMessage midiMachineControlGoto (int hours,
  10712. int minutes,
  10713. int seconds,
  10714. int frames);
  10715. static const MidiMessage masterVolume (const float volume) throw();
  10716. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10717. const int dataSize) throw();
  10718. static int readVariableLengthVal (const uint8* data,
  10719. int& numBytesUsed) throw();
  10720. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10721. static const String getMidiNoteName (int noteNumber,
  10722. bool useSharps,
  10723. bool includeOctaveNumber,
  10724. int octaveNumForMiddleC) throw();
  10725. static const double getMidiNoteInHertz (int noteNumber) throw();
  10726. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10727. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10728. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10729. static const String getControllerName (int controllerNumber) throw();
  10730. juce_UseDebuggingNewOperator
  10731. private:
  10732. double timeStamp;
  10733. uint8* data;
  10734. int message, size;
  10735. };
  10736. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10737. /*** End of inlined file: juce_MidiMessage.h ***/
  10738. class MidiInput;
  10739. class JUCE_API MidiInputCallback
  10740. {
  10741. public:
  10742. virtual ~MidiInputCallback() {}
  10743. virtual void handleIncomingMidiMessage (MidiInput* source,
  10744. const MidiMessage& message) = 0;
  10745. virtual void handlePartialSysexMessage (MidiInput* source,
  10746. const uint8* messageData,
  10747. const int numBytesSoFar,
  10748. const double timestamp)
  10749. {
  10750. // (this bit is just to avoid compiler warnings about unused variables)
  10751. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10752. }
  10753. };
  10754. class JUCE_API MidiInput
  10755. {
  10756. public:
  10757. static const StringArray getDevices();
  10758. static int getDefaultDeviceIndex();
  10759. static MidiInput* openDevice (int deviceIndex,
  10760. MidiInputCallback* callback);
  10761. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10762. static MidiInput* createNewDevice (const String& deviceName,
  10763. MidiInputCallback* callback);
  10764. #endif
  10765. virtual ~MidiInput();
  10766. virtual const String getName() const throw() { return name; }
  10767. virtual void setName (const String& newName) throw() { name = newName; }
  10768. virtual void start();
  10769. virtual void stop();
  10770. juce_UseDebuggingNewOperator
  10771. protected:
  10772. String name;
  10773. void* internal;
  10774. MidiInput (const String& name);
  10775. MidiInput (const MidiInput&);
  10776. };
  10777. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10778. /*** End of inlined file: juce_MidiInput.h ***/
  10779. /*** Start of inlined file: juce_MidiOutput.h ***/
  10780. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10781. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10782. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10783. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10784. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10785. class JUCE_API MidiBuffer
  10786. {
  10787. public:
  10788. MidiBuffer() throw();
  10789. MidiBuffer (const MidiMessage& message) throw();
  10790. MidiBuffer (const MidiBuffer& other) throw();
  10791. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10792. ~MidiBuffer() throw();
  10793. void clear() throw();
  10794. void clear (const int start,
  10795. const int numSamples) throw();
  10796. bool isEmpty() const throw();
  10797. int getNumEvents() const throw();
  10798. void addEvent (const MidiMessage& midiMessage,
  10799. const int sampleNumber) throw();
  10800. void addEvent (const uint8* const rawMidiData,
  10801. const int maxBytesOfMidiData,
  10802. const int sampleNumber) throw();
  10803. void addEvents (const MidiBuffer& otherBuffer,
  10804. const int startSample,
  10805. const int numSamples,
  10806. const int sampleDeltaToAdd) throw();
  10807. int getFirstEventTime() const throw();
  10808. int getLastEventTime() const throw();
  10809. void swap (MidiBuffer& other);
  10810. class Iterator
  10811. {
  10812. public:
  10813. Iterator (const MidiBuffer& buffer) throw();
  10814. ~Iterator() throw();
  10815. void setNextSamplePosition (const int samplePosition) throw();
  10816. bool getNextEvent (MidiMessage& result,
  10817. int& samplePosition) throw();
  10818. bool getNextEvent (const uint8* &midiData,
  10819. int& numBytesOfMidiData,
  10820. int& samplePosition) throw();
  10821. juce_UseDebuggingNewOperator
  10822. private:
  10823. const MidiBuffer& buffer;
  10824. const uint8* data;
  10825. Iterator (const Iterator&);
  10826. Iterator& operator= (const Iterator&);
  10827. };
  10828. juce_UseDebuggingNewOperator
  10829. private:
  10830. friend class MidiBuffer::Iterator;
  10831. MemoryBlock data;
  10832. int bytesUsed;
  10833. uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
  10834. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10835. };
  10836. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10837. /*** End of inlined file: juce_MidiBuffer.h ***/
  10838. class JUCE_API MidiOutput : private Thread
  10839. {
  10840. public:
  10841. static const StringArray getDevices();
  10842. static int getDefaultDeviceIndex();
  10843. static MidiOutput* openDevice (int deviceIndex);
  10844. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10845. static MidiOutput* createNewDevice (const String& deviceName);
  10846. #endif
  10847. virtual ~MidiOutput();
  10848. virtual void sendMessageNow (const MidiMessage& message);
  10849. virtual void reset();
  10850. virtual bool getVolume (float& leftVol,
  10851. float& rightVol);
  10852. virtual void setVolume (float leftVol,
  10853. float rightVol);
  10854. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10855. const double millisecondCounterToStartAt,
  10856. double samplesPerSecondForBuffer) throw();
  10857. virtual void clearAllPendingMessages() throw();
  10858. virtual void startBackgroundThread() throw();
  10859. virtual void stopBackgroundThread() throw();
  10860. juce_UseDebuggingNewOperator
  10861. protected:
  10862. void* internal;
  10863. struct PendingMessage
  10864. {
  10865. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10866. MidiMessage message;
  10867. PendingMessage* next;
  10868. juce_UseDebuggingNewOperator
  10869. };
  10870. CriticalSection lock;
  10871. PendingMessage* firstMessage;
  10872. MidiOutput() throw();
  10873. MidiOutput (const MidiOutput&);
  10874. void run();
  10875. };
  10876. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10877. /*** End of inlined file: juce_MidiOutput.h ***/
  10878. /*** Start of inlined file: juce_ComboBox.h ***/
  10879. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10880. #define __JUCE_COMBOBOX_JUCEHEADER__
  10881. /*** Start of inlined file: juce_Label.h ***/
  10882. #ifndef __JUCE_LABEL_JUCEHEADER__
  10883. #define __JUCE_LABEL_JUCEHEADER__
  10884. /*** Start of inlined file: juce_TextEditor.h ***/
  10885. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10886. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10887. /*** Start of inlined file: juce_Viewport.h ***/
  10888. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10889. #define __JUCE_VIEWPORT_JUCEHEADER__
  10890. /*** Start of inlined file: juce_ScrollBar.h ***/
  10891. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10892. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10893. /*** Start of inlined file: juce_Button.h ***/
  10894. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10895. #define __JUCE_BUTTON_JUCEHEADER__
  10896. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10897. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10898. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10899. /*** Start of inlined file: juce_TooltipClient.h ***/
  10900. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10901. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10902. class JUCE_API TooltipClient
  10903. {
  10904. public:
  10905. virtual ~TooltipClient() {}
  10906. virtual const String getTooltip() = 0;
  10907. };
  10908. class JUCE_API SettableTooltipClient : public TooltipClient
  10909. {
  10910. public:
  10911. virtual ~SettableTooltipClient() {}
  10912. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10913. virtual const String getTooltip() { return tooltipString; }
  10914. juce_UseDebuggingNewOperator
  10915. protected:
  10916. String tooltipString;
  10917. };
  10918. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10919. /*** End of inlined file: juce_TooltipClient.h ***/
  10920. class JUCE_API TooltipWindow : public Component,
  10921. private Timer
  10922. {
  10923. public:
  10924. TooltipWindow (Component* parentComponent = 0,
  10925. const int millisecondsBeforeTipAppears = 700);
  10926. ~TooltipWindow();
  10927. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10928. enum ColourIds
  10929. {
  10930. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10931. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10932. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10933. };
  10934. juce_UseDebuggingNewOperator
  10935. private:
  10936. int millisecondsBeforeTipAppears;
  10937. Point<int> lastMousePos;
  10938. int mouseClicks;
  10939. unsigned int lastCompChangeTime, lastHideTime;
  10940. Component* lastComponentUnderMouse;
  10941. bool changedCompsSinceShown;
  10942. String tipShowing, lastTipUnderMouse;
  10943. void paint (Graphics& g);
  10944. void mouseEnter (const MouseEvent& e);
  10945. void timerCallback();
  10946. static const String getTipFor (Component* const c);
  10947. void showFor (const String& tip);
  10948. void hide();
  10949. TooltipWindow (const TooltipWindow&);
  10950. TooltipWindow& operator= (const TooltipWindow&);
  10951. };
  10952. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10953. /*** End of inlined file: juce_TooltipWindow.h ***/
  10954. class Button;
  10955. class JUCE_API ButtonListener
  10956. {
  10957. public:
  10958. virtual ~ButtonListener() {}
  10959. virtual void buttonClicked (Button* button) = 0;
  10960. virtual void buttonStateChanged (Button*) {}
  10961. };
  10962. class JUCE_API Button : public Component,
  10963. public SettableTooltipClient,
  10964. public ApplicationCommandManagerListener,
  10965. public Value::Listener,
  10966. private KeyListener
  10967. {
  10968. protected:
  10969. Button (const String& buttonName);
  10970. public:
  10971. virtual ~Button();
  10972. void setButtonText (const String& newText);
  10973. const String getButtonText() const { return text; }
  10974. bool isDown() const throw();
  10975. bool isOver() const throw();
  10976. void setToggleState (const bool shouldBeOn,
  10977. const bool sendChangeNotification);
  10978. bool getToggleState() const throw() { return isOn.getValue(); }
  10979. Value& getToggleStateValue() { return isOn; }
  10980. void setClickingTogglesState (const bool shouldToggle) throw();
  10981. bool getClickingTogglesState() const throw();
  10982. void setRadioGroupId (const int newGroupId);
  10983. int getRadioGroupId() const throw() { return radioGroupId; }
  10984. void addButtonListener (ButtonListener* const newListener);
  10985. void removeButtonListener (ButtonListener* const listener);
  10986. virtual void triggerClick();
  10987. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10988. const int commandID,
  10989. const bool generateTooltip);
  10990. int getCommandID() const throw() { return commandID; }
  10991. void addShortcut (const KeyPress& key);
  10992. void clearShortcuts();
  10993. bool isRegisteredForShortcut (const KeyPress& key) const;
  10994. void setRepeatSpeed (const int initialDelayInMillisecs,
  10995. const int repeatDelayInMillisecs,
  10996. const int minimumDelayInMillisecs = -1) throw();
  10997. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  10998. uint32 getMillisecondsSinceButtonDown() const throw();
  10999. void setVisible (bool shouldBeVisible);
  11000. void setTooltip (const String& newTooltip);
  11001. // (implementation of the TooltipClient method)
  11002. const String getTooltip();
  11003. enum ConnectedEdgeFlags
  11004. {
  11005. ConnectedOnLeft = 1,
  11006. ConnectedOnRight = 2,
  11007. ConnectedOnTop = 4,
  11008. ConnectedOnBottom = 8
  11009. };
  11010. void setConnectedEdges (const int connectedEdgeFlags);
  11011. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11012. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11013. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11014. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11015. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11016. enum ButtonState
  11017. {
  11018. buttonNormal,
  11019. buttonOver,
  11020. buttonDown
  11021. };
  11022. void setState (const ButtonState newState);
  11023. juce_UseDebuggingNewOperator
  11024. protected:
  11025. virtual void clicked();
  11026. virtual void clicked (const ModifierKeys& modifiers);
  11027. virtual void paintButton (Graphics& g,
  11028. bool isMouseOverButton,
  11029. bool isButtonDown) = 0;
  11030. virtual void buttonStateChanged();
  11031. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11032. void handleCommandMessage (int commandId);
  11033. void mouseEnter (const MouseEvent& e);
  11034. void mouseExit (const MouseEvent& e);
  11035. void mouseDown (const MouseEvent& e);
  11036. void mouseDrag (const MouseEvent& e);
  11037. void mouseUp (const MouseEvent& e);
  11038. bool keyPressed (const KeyPress& key);
  11039. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11040. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  11041. void paint (Graphics& g);
  11042. void parentHierarchyChanged();
  11043. void focusGained (FocusChangeType cause);
  11044. void focusLost (FocusChangeType cause);
  11045. void enablementChanged();
  11046. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11047. void applicationCommandListChanged();
  11048. void valueChanged (Value& value);
  11049. private:
  11050. Array <KeyPress> shortcuts;
  11051. Component::SafePointer<Component> keySource;
  11052. String text;
  11053. ListenerList <ButtonListener> buttonListeners;
  11054. class RepeatTimer;
  11055. friend class RepeatTimer;
  11056. friend class ScopedPointer <RepeatTimer>;
  11057. ScopedPointer <RepeatTimer> repeatTimer;
  11058. uint32 buttonPressTime, lastTimeCallbackTime;
  11059. ApplicationCommandManager* commandManagerToUse;
  11060. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11061. int radioGroupId, commandID, connectedEdgeFlags;
  11062. ButtonState buttonState;
  11063. Value isOn;
  11064. bool lastToggleState : 1;
  11065. bool clickTogglesState : 1;
  11066. bool needsToRelease : 1;
  11067. bool needsRepainting : 1;
  11068. bool isKeyDown : 1;
  11069. bool triggerOnMouseDown : 1;
  11070. bool generateTooltip : 1;
  11071. void repeatTimerCallback();
  11072. RepeatTimer& getRepeatTimer();
  11073. ButtonState updateState (const MouseEvent* const e);
  11074. bool isShortcutPressed() const;
  11075. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11076. void flashButtonState();
  11077. void sendClickMessage (const ModifierKeys& modifiers);
  11078. void sendStateMessage();
  11079. Button (const Button&);
  11080. Button& operator= (const Button&);
  11081. };
  11082. #endif // __JUCE_BUTTON_JUCEHEADER__
  11083. /*** End of inlined file: juce_Button.h ***/
  11084. class ScrollBar;
  11085. class JUCE_API ScrollBarListener
  11086. {
  11087. public:
  11088. virtual ~ScrollBarListener() {}
  11089. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11090. const double newRangeStart) = 0;
  11091. };
  11092. class JUCE_API ScrollBar : public Component,
  11093. public AsyncUpdater,
  11094. private Timer
  11095. {
  11096. public:
  11097. ScrollBar (const bool isVertical,
  11098. const bool buttonsAreVisible = true);
  11099. ~ScrollBar();
  11100. bool isVertical() const throw() { return vertical; }
  11101. void setOrientation (const bool shouldBeVertical) throw();
  11102. void setButtonVisibility (const bool buttonsAreVisible);
  11103. void setAutoHide (const bool shouldHideWhenFullRange);
  11104. void setRangeLimits (const double minimum,
  11105. const double maximum) throw();
  11106. double getMinimumRangeLimit() const throw() { return minimum; }
  11107. double getMaximumRangeLimit() const throw() { return maximum; }
  11108. void setCurrentRange (double newStart,
  11109. double newSize) throw();
  11110. void setCurrentRangeStart (double newStart) throw();
  11111. double getCurrentRangeStart() const throw() { return rangeStart; }
  11112. double getCurrentRangeSize() const throw() { return rangeSize; }
  11113. void setSingleStepSize (const double newSingleStepSize) throw();
  11114. void moveScrollbarInSteps (const int howManySteps) throw();
  11115. void moveScrollbarInPages (const int howManyPages) throw();
  11116. void scrollToTop() throw();
  11117. void scrollToBottom() throw();
  11118. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  11119. const int repeatDelayInMillisecs,
  11120. const int minimumDelayInMillisecs = -1) throw();
  11121. enum ColourIds
  11122. {
  11123. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11124. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11125. 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. */
  11126. };
  11127. void addListener (ScrollBarListener* const listener) throw();
  11128. void removeListener (ScrollBarListener* const listener) throw();
  11129. bool keyPressed (const KeyPress& key);
  11130. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11131. void lookAndFeelChanged();
  11132. void handleAsyncUpdate();
  11133. void mouseDown (const MouseEvent& e);
  11134. void mouseDrag (const MouseEvent& e);
  11135. void mouseUp (const MouseEvent& e);
  11136. void paint (Graphics& g);
  11137. void resized();
  11138. juce_UseDebuggingNewOperator
  11139. private:
  11140. double minimum, maximum;
  11141. double rangeStart, rangeSize;
  11142. double singleStepSize, dragStartRange;
  11143. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11144. int dragStartMousePos, lastMousePos;
  11145. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11146. bool vertical, isDraggingThumb, alwaysVisible;
  11147. Button* upButton;
  11148. Button* downButton;
  11149. ListenerList <ScrollBarListener> listeners;
  11150. void updateThumbPosition() throw();
  11151. void timerCallback();
  11152. ScrollBar (const ScrollBar&);
  11153. ScrollBar& operator= (const ScrollBar&);
  11154. };
  11155. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11156. /*** End of inlined file: juce_ScrollBar.h ***/
  11157. class JUCE_API Viewport : public Component,
  11158. private ComponentListener,
  11159. private ScrollBarListener
  11160. {
  11161. public:
  11162. Viewport (const String& componentName = String::empty);
  11163. ~Viewport();
  11164. void setViewedComponent (Component* const newViewedComponent);
  11165. Component* getViewedComponent() const throw() { return contentComp; }
  11166. void setViewPosition (const int xPixelsOffset,
  11167. const int yPixelsOffset);
  11168. void setViewPositionProportionately (const double proportionX,
  11169. const double proportionY);
  11170. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11171. int getViewPositionX() const throw() { return lastVX; }
  11172. int getViewPositionY() const throw() { return lastVY; }
  11173. int getViewWidth() const throw() { return lastVW; }
  11174. int getViewHeight() const throw() { return lastVH; }
  11175. int getMaximumVisibleWidth() const throw();
  11176. int getMaximumVisibleHeight() const throw();
  11177. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11178. int visibleW, int visibleH);
  11179. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11180. const bool showHorizontalScrollbarIfNeeded);
  11181. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11182. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11183. void setScrollBarThickness (const int thickness);
  11184. int getScrollBarThickness() const throw();
  11185. void setSingleStepSizes (const int stepX, const int stepY);
  11186. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11187. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11188. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11189. juce_UseDebuggingNewOperator
  11190. void resized();
  11191. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  11192. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11193. bool keyPressed (const KeyPress& key);
  11194. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11195. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11196. private:
  11197. Component::SafePointer<Component> contentComp;
  11198. int lastVX, lastVY, lastVW, lastVH;
  11199. int scrollBarThickness;
  11200. int singleStepX, singleStepY;
  11201. bool showHScrollbar, showVScrollbar;
  11202. Component* contentHolder;
  11203. ScrollBar* verticalScrollBar;
  11204. ScrollBar* horizontalScrollBar;
  11205. void updateVisibleRegion();
  11206. Viewport (const Viewport&);
  11207. Viewport& operator= (const Viewport&);
  11208. };
  11209. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11210. /*** End of inlined file: juce_Viewport.h ***/
  11211. /*** Start of inlined file: juce_PopupMenu.h ***/
  11212. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11213. #define __JUCE_POPUPMENU_JUCEHEADER__
  11214. class PopupMenuCustomComponent;
  11215. class JUCE_API PopupMenu
  11216. {
  11217. public:
  11218. PopupMenu();
  11219. PopupMenu (const PopupMenu& other);
  11220. ~PopupMenu();
  11221. PopupMenu& operator= (const PopupMenu& other);
  11222. void clear();
  11223. void addItem (const int itemResultId,
  11224. const String& itemText,
  11225. const bool isActive = true,
  11226. const bool isTicked = false,
  11227. const Image* const iconToUse = 0);
  11228. void addCommandItem (ApplicationCommandManager* commandManager,
  11229. const int commandID,
  11230. const String& displayName = String::empty);
  11231. void addColouredItem (const int itemResultId,
  11232. const String& itemText,
  11233. const Colour& itemTextColour,
  11234. const bool isActive = true,
  11235. const bool isTicked = false,
  11236. const Image* const iconToUse = 0);
  11237. void addCustomItem (const int itemResultId,
  11238. PopupMenuCustomComponent* const customComponent);
  11239. void addCustomItem (const int itemResultId,
  11240. Component* customComponent,
  11241. int idealWidth, int idealHeight,
  11242. const bool triggerMenuItemAutomaticallyWhenClicked);
  11243. void addSubMenu (const String& subMenuName,
  11244. const PopupMenu& subMenu,
  11245. const bool isActive = true,
  11246. Image* const iconToUse = 0,
  11247. const bool isTicked = false);
  11248. void addSeparator();
  11249. void addSectionHeader (const String& title);
  11250. int getNumItems() const throw();
  11251. bool containsCommandItem (const int commandID) const;
  11252. bool containsAnyActiveItems() const throw();
  11253. int show (const int itemIdThatMustBeVisible = 0,
  11254. const int minimumWidth = 0,
  11255. const int maximumNumColumns = 0,
  11256. const int standardItemHeight = 0);
  11257. int showAt (const int screenX,
  11258. const int screenY,
  11259. const int itemIdThatMustBeVisible = 0,
  11260. const int minimumWidth = 0,
  11261. const int maximumNumColumns = 0,
  11262. const int standardItemHeight = 0);
  11263. int showAt (Component* componentToAttachTo,
  11264. const int itemIdThatMustBeVisible = 0,
  11265. const int minimumWidth = 0,
  11266. const int maximumNumColumns = 0,
  11267. const int standardItemHeight = 0);
  11268. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11269. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11270. enum ColourIds
  11271. {
  11272. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11273. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11274. colour is specified when the item is added). */
  11275. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11276. addSectionHeader() method). */
  11277. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11278. highlighted menu item. */
  11279. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11280. highlighted item. */
  11281. };
  11282. class JUCE_API MenuItemIterator
  11283. {
  11284. public:
  11285. MenuItemIterator (const PopupMenu& menu);
  11286. ~MenuItemIterator();
  11287. bool next();
  11288. String itemName;
  11289. const PopupMenu* subMenu;
  11290. int itemId;
  11291. bool isSeparator;
  11292. bool isTicked;
  11293. bool isEnabled;
  11294. bool isCustomComponent;
  11295. bool isSectionHeader;
  11296. const Colour* customColour;
  11297. const Image* customImage;
  11298. ApplicationCommandManager* commandManager;
  11299. juce_UseDebuggingNewOperator
  11300. private:
  11301. const PopupMenu& menu;
  11302. int index;
  11303. MenuItemIterator (const MenuItemIterator&);
  11304. MenuItemIterator& operator= (const MenuItemIterator&);
  11305. };
  11306. juce_UseDebuggingNewOperator
  11307. private:
  11308. class Item;
  11309. class ItemComponent;
  11310. class Window;
  11311. friend class MenuItemIterator;
  11312. friend class ItemComponent;
  11313. friend class Window;
  11314. friend class PopupMenuCustomComponent;
  11315. friend class OwnedArray <Item>;
  11316. friend class ScopedPointer <Window>;
  11317. OwnedArray <Item> items;
  11318. LookAndFeel* lookAndFeel;
  11319. bool separatorPending;
  11320. void addSeparatorIfPending();
  11321. int showMenu (const int x, const int y, const int w, const int h,
  11322. const int itemIdThatMustBeVisible,
  11323. const int minimumWidth,
  11324. const int maximumNumColumns,
  11325. const int standardItemHeight,
  11326. const bool alignToRectangle,
  11327. Component* const componentAttachedTo);
  11328. friend class MenuBarComponent;
  11329. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11330. const int itemIdThatMustBeVisible,
  11331. const int minimumWidth,
  11332. const int maximumNumColumns,
  11333. const int standardItemHeight,
  11334. const bool alignToRectangle,
  11335. Component* menuBarComponent,
  11336. ApplicationCommandManager** managerOfChosenCommand,
  11337. Component* const componentAttachedTo);
  11338. };
  11339. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11340. /*** End of inlined file: juce_PopupMenu.h ***/
  11341. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11342. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11343. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11344. class JUCE_API TextInputTarget
  11345. {
  11346. public:
  11347. TextInputTarget() {}
  11348. virtual ~TextInputTarget() {}
  11349. virtual const Range<int> getHighlightedRegion() const = 0;
  11350. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11351. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11352. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11353. };
  11354. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11355. /*** End of inlined file: juce_TextInputTarget.h ***/
  11356. class TextEditor;
  11357. class TextHolderComponent;
  11358. class JUCE_API TextEditorListener
  11359. {
  11360. public:
  11361. virtual ~TextEditorListener() {}
  11362. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11363. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11364. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11365. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11366. };
  11367. class JUCE_API TextEditor : public Component,
  11368. public TextInputTarget,
  11369. public SettableTooltipClient
  11370. {
  11371. public:
  11372. TextEditor (const String& componentName = String::empty,
  11373. const tchar passwordCharacter = 0);
  11374. virtual ~TextEditor();
  11375. void setMultiLine (const bool shouldBeMultiLine,
  11376. const bool shouldWordWrap = true);
  11377. bool isMultiLine() const;
  11378. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11379. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11380. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11381. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11382. void setReadOnly (const bool shouldBeReadOnly);
  11383. bool isReadOnly() const;
  11384. void setCaretVisible (const bool shouldBeVisible);
  11385. bool isCaretVisible() const { return caretVisible; }
  11386. void setScrollbarsShown (bool shouldBeEnabled);
  11387. bool areScrollbarsShown() const { return scrollbarVisible; }
  11388. void setPasswordCharacter (const tchar passwordCharacter);
  11389. tchar getPasswordCharacter() const { return passwordCharacter; }
  11390. void setPopupMenuEnabled (const bool menuEnabled);
  11391. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11392. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11393. enum ColourIds
  11394. {
  11395. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11396. transparent if necessary. */
  11397. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11398. that because the editor can contain multiple colours, calling this
  11399. method won't change the colour of existing text - to do that, call
  11400. applyFontToAllText() after calling this method.*/
  11401. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11402. the text - this can be transparent if you don't want to show any
  11403. highlighting.*/
  11404. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11405. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11406. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11407. the edge of the component. */
  11408. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11409. the edge of the component when it has focus. */
  11410. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11411. around the edge of the editor. */
  11412. };
  11413. void setFont (const Font& newFont);
  11414. void applyFontToAllText (const Font& newFont);
  11415. const Font getFont() const;
  11416. void setSelectAllWhenFocused (const bool b);
  11417. void setInputRestrictions (const int maxTextLength,
  11418. const String& allowedCharacters = String::empty);
  11419. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11420. void setScrollBarThickness (const int newThicknessPixels);
  11421. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11422. void addListener (TextEditorListener* const newListener);
  11423. void removeListener (TextEditorListener* const listenerToRemove);
  11424. const String getText() const;
  11425. const String getTextInRange (const Range<int>& textRange) const;
  11426. bool isEmpty() const;
  11427. void setText (const String& newText,
  11428. const bool sendTextChangeMessage = true);
  11429. Value& getTextValue();
  11430. void insertTextAtCaret (const String& textToInsert);
  11431. void clear();
  11432. void cut();
  11433. void copy();
  11434. void paste();
  11435. void setCaretPosition (const int newIndex);
  11436. int getCaretPosition() const;
  11437. void scrollEditorToPositionCaret (const int desiredCaretX,
  11438. const int desiredCaretY);
  11439. const Rectangle<int> getCaretRectangle();
  11440. void setHighlightedRegion (const Range<int>& newSelection);
  11441. const Range<int> getHighlightedRegion() const { return selection; }
  11442. const String getHighlightedText() const;
  11443. int getTextIndexAt (const int x, const int y);
  11444. int getTotalNumChars() const;
  11445. int getTextWidth() const;
  11446. int getTextHeight() const;
  11447. void setIndents (const int newLeftIndent, const int newTopIndent);
  11448. void setBorder (const BorderSize& border);
  11449. const BorderSize getBorder() const;
  11450. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11451. void paint (Graphics& g);
  11452. void paintOverChildren (Graphics& g);
  11453. void mouseDown (const MouseEvent& e);
  11454. void mouseUp (const MouseEvent& e);
  11455. void mouseDrag (const MouseEvent& e);
  11456. void mouseDoubleClick (const MouseEvent& e);
  11457. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11458. bool keyPressed (const KeyPress& key);
  11459. bool keyStateChanged (const bool isKeyDown);
  11460. void focusGained (FocusChangeType cause);
  11461. void focusLost (FocusChangeType cause);
  11462. void resized();
  11463. void enablementChanged();
  11464. void colourChanged();
  11465. juce_UseDebuggingNewOperator
  11466. protected:
  11467. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11468. const MouseEvent* mouseClickEvent);
  11469. virtual void performPopupMenuAction (const int menuItemID);
  11470. void scrollToMakeSureCursorIsVisible();
  11471. void moveCaret (int newCaretPos);
  11472. void moveCursorTo (const int newPosition, const bool isSelecting);
  11473. void textChanged();
  11474. void newTransaction();
  11475. void doUndoRedo (const bool isRedo);
  11476. virtual void returnPressed();
  11477. virtual void escapePressed();
  11478. void handleCommandMessage (int commandId);
  11479. private:
  11480. ScopedPointer <Viewport> viewport;
  11481. TextHolderComponent* textHolder;
  11482. BorderSize borderSize;
  11483. bool readOnly : 1;
  11484. bool multiline : 1;
  11485. bool wordWrap : 1;
  11486. bool returnKeyStartsNewLine : 1;
  11487. bool caretVisible : 1;
  11488. bool popupMenuEnabled : 1;
  11489. bool selectAllTextWhenFocused : 1;
  11490. bool scrollbarVisible : 1;
  11491. bool wasFocused : 1;
  11492. bool caretFlashState : 1;
  11493. bool keepCursorOnScreen : 1;
  11494. bool tabKeyUsed : 1;
  11495. bool menuActive : 1;
  11496. bool valueTextNeedsUpdating : 1;
  11497. UndoManager undoManager;
  11498. float cursorX, cursorY, cursorHeight;
  11499. int maxTextLength;
  11500. Range<int> selection;
  11501. int leftIndent, topIndent;
  11502. unsigned int lastTransactionTime;
  11503. Font currentFont;
  11504. mutable int totalNumChars;
  11505. int caretPosition;
  11506. VoidArray sections;
  11507. String textToShowWhenEmpty;
  11508. Colour colourForTextWhenEmpty;
  11509. tchar passwordCharacter;
  11510. Value textValue;
  11511. enum
  11512. {
  11513. notDragging,
  11514. draggingSelectionStart,
  11515. draggingSelectionEnd
  11516. } dragType;
  11517. String allowedCharacters;
  11518. ListenerList <TextEditorListener> listeners;
  11519. friend class TextEditorInsertAction;
  11520. friend class TextEditorRemoveAction;
  11521. void coalesceSimilarSections();
  11522. void splitSection (const int sectionIndex, const int charToSplitAt);
  11523. void clearInternal (UndoManager* const um);
  11524. void insert (const String& text,
  11525. const int insertIndex,
  11526. const Font& font,
  11527. const Colour& colour,
  11528. UndoManager* const um,
  11529. const int caretPositionToMoveTo);
  11530. void reinsert (const int insertIndex,
  11531. const VoidArray& sections);
  11532. void remove (const Range<int>& range,
  11533. UndoManager* const um,
  11534. const int caretPositionToMoveTo);
  11535. void getCharPosition (const int index,
  11536. float& x, float& y,
  11537. float& lineHeight) const;
  11538. void updateCaretPosition();
  11539. void textWasChangedByValue();
  11540. int indexAtPosition (const float x,
  11541. const float y);
  11542. int findWordBreakAfter (const int position) const;
  11543. int findWordBreakBefore (const int position) const;
  11544. friend class TextHolderComponent;
  11545. friend class TextEditorViewport;
  11546. void drawContent (Graphics& g);
  11547. void updateTextHolderSize();
  11548. float getWordWrapWidth() const;
  11549. void timerCallbackInt();
  11550. void repaintCaret();
  11551. void repaintText (const Range<int>& range);
  11552. UndoManager* getUndoManager() throw();
  11553. TextEditor (const TextEditor&);
  11554. TextEditor& operator= (const TextEditor&);
  11555. };
  11556. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11557. /*** End of inlined file: juce_TextEditor.h ***/
  11558. class Label;
  11559. class JUCE_API LabelListener
  11560. {
  11561. public:
  11562. virtual ~LabelListener() {}
  11563. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11564. };
  11565. class JUCE_API Label : public Component,
  11566. public SettableTooltipClient,
  11567. protected TextEditorListener,
  11568. private ComponentListener,
  11569. private Value::Listener
  11570. {
  11571. public:
  11572. Label (const String& componentName,
  11573. const String& labelText);
  11574. ~Label();
  11575. void setText (const String& newText,
  11576. const bool broadcastChangeMessage);
  11577. const String getText (const bool returnActiveEditorContents = false) const throw();
  11578. Value& getTextValue() { return textValue; }
  11579. void setFont (const Font& newFont) throw();
  11580. const Font& getFont() const throw();
  11581. enum ColourIds
  11582. {
  11583. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11584. textColourId = 0x1000281, /**< The colour for the text. */
  11585. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11586. Leave this transparent to not have an outline. */
  11587. };
  11588. void setJustificationType (const Justification& justification) throw();
  11589. const Justification getJustificationType() const throw() { return justification; }
  11590. void setBorderSize (int horizontalBorder, int verticalBorder);
  11591. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11592. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11593. void attachToComponent (Component* owner,
  11594. const bool onLeft);
  11595. Component* getAttachedComponent() const;
  11596. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11597. void setMinimumHorizontalScale (const float newScale);
  11598. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11599. void addListener (LabelListener* const listener) throw();
  11600. void removeListener (LabelListener* const listener) throw();
  11601. void setEditable (const bool editOnSingleClick,
  11602. const bool editOnDoubleClick = false,
  11603. const bool lossOfFocusDiscardsChanges = false) throw();
  11604. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11605. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11606. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11607. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11608. void showEditor();
  11609. void hideEditor (const bool discardCurrentEditorContents);
  11610. bool isBeingEdited() const throw();
  11611. juce_UseDebuggingNewOperator
  11612. protected:
  11613. virtual TextEditor* createEditorComponent();
  11614. virtual void textWasEdited();
  11615. virtual void textWasChanged();
  11616. virtual void editorShown (TextEditor* editorComponent);
  11617. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11618. void paint (Graphics& g);
  11619. void resized();
  11620. void mouseUp (const MouseEvent& e);
  11621. void mouseDoubleClick (const MouseEvent& e);
  11622. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11623. void componentParentHierarchyChanged (Component& component);
  11624. void componentVisibilityChanged (Component& component);
  11625. void inputAttemptWhenModal();
  11626. void focusGained (FocusChangeType);
  11627. void enablementChanged();
  11628. KeyboardFocusTraverser* createFocusTraverser();
  11629. void textEditorTextChanged (TextEditor& editor);
  11630. void textEditorReturnKeyPressed (TextEditor& editor);
  11631. void textEditorEscapeKeyPressed (TextEditor& editor);
  11632. void textEditorFocusLost (TextEditor& editor);
  11633. void colourChanged();
  11634. void valueChanged (Value&);
  11635. private:
  11636. Value textValue;
  11637. String lastTextValue;
  11638. Font font;
  11639. Justification justification;
  11640. ScopedPointer <TextEditor> editor;
  11641. ListenerList <LabelListener> listeners;
  11642. Component::SafePointer<Component> ownerComponent;
  11643. int horizontalBorderSize, verticalBorderSize;
  11644. float minimumHorizontalScale;
  11645. bool editSingleClick : 1;
  11646. bool editDoubleClick : 1;
  11647. bool lossOfFocusDiscardsChanges : 1;
  11648. bool leftOfOwnerComp : 1;
  11649. bool updateFromTextEditorContents();
  11650. void callChangeListeners();
  11651. Label (const Label&);
  11652. Label& operator= (const Label&);
  11653. };
  11654. #endif // __JUCE_LABEL_JUCEHEADER__
  11655. /*** End of inlined file: juce_Label.h ***/
  11656. class ComboBox;
  11657. class JUCE_API ComboBoxListener
  11658. {
  11659. public:
  11660. virtual ~ComboBoxListener() {}
  11661. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11662. };
  11663. class JUCE_API ComboBox : public Component,
  11664. public SettableTooltipClient,
  11665. private LabelListener,
  11666. private AsyncUpdater,
  11667. private Value::Listener
  11668. {
  11669. public:
  11670. ComboBox (const String& componentName);
  11671. ~ComboBox();
  11672. void setEditableText (const bool isEditable);
  11673. bool isTextEditable() const throw();
  11674. void setJustificationType (const Justification& justification) throw();
  11675. const Justification getJustificationType() const throw();
  11676. void addItem (const String& newItemText,
  11677. const int newItemId) throw();
  11678. void addSeparator() throw();
  11679. void addSectionHeading (const String& headingName) throw();
  11680. void setItemEnabled (const int itemId,
  11681. const bool shouldBeEnabled) throw();
  11682. void changeItemText (const int itemId,
  11683. const String& newText) throw();
  11684. void clear (const bool dontSendChangeMessage = false);
  11685. int getNumItems() const throw();
  11686. const String getItemText (const int index) const throw();
  11687. int getItemId (const int index) const throw();
  11688. int indexOfItemId (const int itemId) const throw();
  11689. int getSelectedId() const throw();
  11690. Value& getSelectedIdAsValue() throw() { return currentId; }
  11691. void setSelectedId (const int newItemId,
  11692. const bool dontSendChangeMessage = false) throw();
  11693. int getSelectedItemIndex() const throw();
  11694. void setSelectedItemIndex (const int newItemIndex,
  11695. const bool dontSendChangeMessage = false) throw();
  11696. const String getText() const throw();
  11697. void setText (const String& newText,
  11698. const bool dontSendChangeMessage = false) throw();
  11699. void showEditor();
  11700. void addListener (ComboBoxListener* const listener) throw();
  11701. void removeListener (ComboBoxListener* const listener) throw();
  11702. void setTextWhenNothingSelected (const String& newMessage) throw();
  11703. const String getTextWhenNothingSelected() const throw();
  11704. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11705. const String getTextWhenNoChoicesAvailable() const throw();
  11706. void setTooltip (const String& newTooltip);
  11707. enum ColourIds
  11708. {
  11709. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11710. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11711. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11712. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11713. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11714. };
  11715. void labelTextChanged (Label*);
  11716. void enablementChanged();
  11717. void colourChanged();
  11718. void focusGained (Component::FocusChangeType cause);
  11719. void focusLost (Component::FocusChangeType cause);
  11720. void handleAsyncUpdate();
  11721. const String getTooltip() { return label->getTooltip(); }
  11722. void mouseDown (const MouseEvent&);
  11723. void mouseDrag (const MouseEvent&);
  11724. void mouseUp (const MouseEvent&);
  11725. void lookAndFeelChanged();
  11726. void paint (Graphics&);
  11727. void resized();
  11728. bool keyStateChanged (const bool isKeyDown);
  11729. bool keyPressed (const KeyPress&);
  11730. void valueChanged (Value&);
  11731. juce_UseDebuggingNewOperator
  11732. private:
  11733. struct ItemInfo
  11734. {
  11735. String name;
  11736. int itemId;
  11737. bool isEnabled : 1, isHeading : 1;
  11738. bool isSeparator() const throw();
  11739. bool isRealItem() const throw();
  11740. };
  11741. OwnedArray <ItemInfo> items;
  11742. Value currentId;
  11743. int lastCurrentId;
  11744. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11745. ListenerList <ComboBoxListener> listeners;
  11746. ScopedPointer<Label> label;
  11747. String textWhenNothingSelected, noChoicesMessage;
  11748. void showPopup();
  11749. ItemInfo* getItemForId (const int itemId) const throw();
  11750. ItemInfo* getItemForIndex (const int index) const throw();
  11751. ComboBox (const ComboBox&);
  11752. ComboBox& operator= (const ComboBox&);
  11753. };
  11754. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11755. /*** End of inlined file: juce_ComboBox.h ***/
  11756. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11757. {
  11758. public:
  11759. AudioDeviceManager();
  11760. ~AudioDeviceManager();
  11761. struct JUCE_API AudioDeviceSetup
  11762. {
  11763. AudioDeviceSetup();
  11764. bool operator== (const AudioDeviceSetup& other) const;
  11765. String outputDeviceName;
  11766. String inputDeviceName;
  11767. double sampleRate;
  11768. int bufferSize;
  11769. BitArray inputChannels;
  11770. bool useDefaultInputChannels;
  11771. BitArray outputChannels;
  11772. bool useDefaultOutputChannels;
  11773. };
  11774. const String initialise (const int numInputChannelsNeeded,
  11775. const int numOutputChannelsNeeded,
  11776. const XmlElement* const savedState,
  11777. const bool selectDefaultDeviceOnFailure,
  11778. const String& preferredDefaultDeviceName = String::empty,
  11779. const AudioDeviceSetup* preferredSetupOptions = 0);
  11780. XmlElement* createStateXml() const;
  11781. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11782. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11783. const bool treatAsChosenDevice);
  11784. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11785. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11786. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11787. void setCurrentAudioDeviceType (const String& type,
  11788. const bool treatAsChosenDevice);
  11789. void closeAudioDevice();
  11790. void restartLastAudioDevice();
  11791. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11792. void removeAudioCallback (AudioIODeviceCallback* callback);
  11793. double getCpuUsage() const;
  11794. void setMidiInputEnabled (const String& midiInputDeviceName,
  11795. const bool enabled);
  11796. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11797. void addMidiInputCallback (const String& midiInputDeviceName,
  11798. MidiInputCallback* callback);
  11799. void removeMidiInputCallback (const String& midiInputDeviceName,
  11800. MidiInputCallback* callback);
  11801. void setDefaultMidiOutput (const String& deviceName);
  11802. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11803. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11804. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11805. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11806. void playTestSound();
  11807. void enableInputLevelMeasurement (const bool enableMeasurement);
  11808. double getCurrentInputLevel() const;
  11809. juce_UseDebuggingNewOperator
  11810. private:
  11811. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11812. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11813. AudioDeviceSetup currentSetup;
  11814. ScopedPointer <AudioIODevice> currentAudioDevice;
  11815. SortedSet <AudioIODeviceCallback*> callbacks;
  11816. int numInputChansNeeded, numOutputChansNeeded;
  11817. String currentDeviceType;
  11818. BitArray inputChannels, outputChannels;
  11819. ScopedPointer <XmlElement> lastExplicitSettings;
  11820. mutable bool listNeedsScanning;
  11821. bool useInputNames;
  11822. int inputLevelMeasurementEnabledCount;
  11823. double inputLevel;
  11824. ScopedPointer <AudioSampleBuffer> testSound;
  11825. int testSoundPosition;
  11826. AudioSampleBuffer tempBuffer;
  11827. StringArray midiInsFromXml;
  11828. OwnedArray <MidiInput> enabledMidiInputs;
  11829. Array <MidiInputCallback*> midiCallbacks;
  11830. Array <MidiInput*> midiCallbackDevices;
  11831. String defaultMidiOutputName;
  11832. ScopedPointer <MidiOutput> defaultMidiOutput;
  11833. CriticalSection audioCallbackLock, midiCallbackLock;
  11834. double cpuUsageMs, timeToCpuScale;
  11835. class CallbackHandler : public AudioIODeviceCallback,
  11836. public MidiInputCallback
  11837. {
  11838. public:
  11839. AudioDeviceManager* owner;
  11840. void audioDeviceIOCallback (const float** inputChannelData,
  11841. int totalNumInputChannels,
  11842. float** outputChannelData,
  11843. int totalNumOutputChannels,
  11844. int numSamples);
  11845. void audioDeviceAboutToStart (AudioIODevice*);
  11846. void audioDeviceStopped();
  11847. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11848. };
  11849. CallbackHandler callbackHandler;
  11850. friend class CallbackHandler;
  11851. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11852. int totalNumInputChannels,
  11853. float** outputChannelData,
  11854. int totalNumOutputChannels,
  11855. int numSamples);
  11856. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11857. void audioDeviceStoppedInt();
  11858. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11859. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11860. const BitArray& ins, const BitArray& outs);
  11861. void stopDevice();
  11862. void updateXml();
  11863. void createDeviceTypesIfNeeded();
  11864. void scanDevicesIfNeeded();
  11865. void deleteCurrentDevice();
  11866. double chooseBestSampleRate (double preferred) const;
  11867. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11868. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11869. AudioDeviceManager (const AudioDeviceManager&);
  11870. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11871. };
  11872. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11873. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11874. #endif
  11875. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11876. #endif
  11877. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11878. #endif
  11879. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11880. #endif
  11881. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11882. #endif
  11883. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11884. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11885. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11886. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11887. class JUCE_API AudioDataConverters
  11888. {
  11889. public:
  11890. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11891. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11892. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11893. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11894. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11895. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11896. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11897. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11898. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11899. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11900. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11901. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11902. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11903. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11904. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11905. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11906. enum DataFormat
  11907. {
  11908. int16LE,
  11909. int16BE,
  11910. int24LE,
  11911. int24BE,
  11912. int32LE,
  11913. int32BE,
  11914. float32LE,
  11915. float32BE,
  11916. };
  11917. static void convertFloatToFormat (const DataFormat destFormat,
  11918. const float* source, void* dest, int numSamples);
  11919. static void convertFormatToFloat (const DataFormat sourceFormat,
  11920. const void* source, float* dest, int numSamples);
  11921. static void interleaveSamples (const float** source, float* dest,
  11922. const int numSamples, const int numChannels);
  11923. static void deinterleaveSamples (const float* source, float** dest,
  11924. const int numSamples, const int numChannels);
  11925. };
  11926. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11927. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11928. #endif
  11929. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11930. #endif
  11931. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11932. #endif
  11933. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11934. #endif
  11935. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11936. /*** Start of inlined file: juce_MidiFile.h ***/
  11937. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11938. #define __JUCE_MIDIFILE_JUCEHEADER__
  11939. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11940. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11941. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11942. class JUCE_API MidiMessageSequence
  11943. {
  11944. public:
  11945. MidiMessageSequence();
  11946. MidiMessageSequence (const MidiMessageSequence& other);
  11947. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11948. ~MidiMessageSequence();
  11949. class MidiEventHolder
  11950. {
  11951. public:
  11952. ~MidiEventHolder();
  11953. MidiMessage message;
  11954. MidiEventHolder* noteOffObject;
  11955. juce_UseDebuggingNewOperator
  11956. private:
  11957. friend class MidiMessageSequence;
  11958. MidiEventHolder (const MidiMessage& message);
  11959. };
  11960. void clear();
  11961. int getNumEvents() const;
  11962. MidiEventHolder* getEventPointer (const int index) const;
  11963. double getTimeOfMatchingKeyUp (const int index) const;
  11964. int getIndexOfMatchingKeyUp (const int index) const;
  11965. int getIndexOf (MidiEventHolder* const event) const;
  11966. int getNextIndexAtTime (const double timeStamp) const;
  11967. double getStartTime() const;
  11968. double getEndTime() const;
  11969. double getEventTime (const int index) const;
  11970. void addEvent (const MidiMessage& newMessage,
  11971. double timeAdjustment = 0);
  11972. void deleteEvent (const int index,
  11973. const bool deleteMatchingNoteUp);
  11974. void addSequence (const MidiMessageSequence& other,
  11975. double timeAdjustmentDelta,
  11976. double firstAllowableDestTime,
  11977. double endOfAllowableDestTimes);
  11978. void updateMatchedPairs();
  11979. void extractMidiChannelMessages (const int channelNumberToExtract,
  11980. MidiMessageSequence& destSequence,
  11981. const bool alsoIncludeMetaEvents) const;
  11982. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11983. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11984. void deleteSysExMessages();
  11985. void addTimeToMessages (const double deltaTime);
  11986. void createControllerUpdatesForTime (const int channelNumber,
  11987. const double time,
  11988. OwnedArray<MidiMessage>& resultMessages);
  11989. void swapWith (MidiMessageSequence& other) throw();
  11990. juce_UseDebuggingNewOperator
  11991. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11992. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11993. private:
  11994. friend class MidiFile;
  11995. OwnedArray <MidiEventHolder> list;
  11996. void sort();
  11997. };
  11998. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11999. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12000. class JUCE_API MidiFile
  12001. {
  12002. public:
  12003. MidiFile() throw();
  12004. ~MidiFile() throw();
  12005. int getNumTracks() const throw();
  12006. const MidiMessageSequence* getTrack (const int index) const throw();
  12007. void addTrack (const MidiMessageSequence& trackSequence) throw();
  12008. void clear() throw();
  12009. short getTimeFormat() const throw();
  12010. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12011. void setSmpteTimeFormat (const int framesPerSecond,
  12012. const int subframeResolution) throw();
  12013. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12014. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12015. double getLastTimestamp() const;
  12016. bool readFrom (InputStream& sourceStream);
  12017. bool writeTo (OutputStream& destStream);
  12018. void convertTimestampTicksToSeconds();
  12019. juce_UseDebuggingNewOperator
  12020. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12021. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12022. private:
  12023. OwnedArray <MidiMessageSequence> tracks;
  12024. short timeFormat;
  12025. MidiFile (const MidiFile&);
  12026. MidiFile& operator= (const MidiFile&);
  12027. void readNextTrack (const char* data, int size);
  12028. void writeTrack (OutputStream& mainOut, const int trackNum);
  12029. };
  12030. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12031. /*** End of inlined file: juce_MidiFile.h ***/
  12032. #endif
  12033. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12034. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12035. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12036. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12037. class MidiKeyboardState;
  12038. class JUCE_API MidiKeyboardStateListener
  12039. {
  12040. public:
  12041. MidiKeyboardStateListener() throw() {}
  12042. virtual ~MidiKeyboardStateListener() {}
  12043. virtual void handleNoteOn (MidiKeyboardState* source,
  12044. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12045. virtual void handleNoteOff (MidiKeyboardState* source,
  12046. int midiChannel, int midiNoteNumber) = 0;
  12047. };
  12048. class JUCE_API MidiKeyboardState
  12049. {
  12050. public:
  12051. MidiKeyboardState();
  12052. ~MidiKeyboardState();
  12053. void reset();
  12054. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12055. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12056. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12057. void noteOff (const int midiChannel, const int midiNoteNumber);
  12058. void allNotesOff (const int midiChannel);
  12059. void processNextMidiEvent (const MidiMessage& message);
  12060. void processNextMidiBuffer (MidiBuffer& buffer,
  12061. const int startSample,
  12062. const int numSamples,
  12063. const bool injectIndirectEvents);
  12064. void addListener (MidiKeyboardStateListener* const listener) throw();
  12065. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12066. juce_UseDebuggingNewOperator
  12067. private:
  12068. CriticalSection lock;
  12069. uint16 noteStates [128];
  12070. MidiBuffer eventsToAdd;
  12071. VoidArray listeners;
  12072. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12073. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12074. MidiKeyboardState (const MidiKeyboardState&);
  12075. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12076. };
  12077. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12078. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12079. #endif
  12080. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12081. #endif
  12082. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12083. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12084. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12085. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12086. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12087. public MidiInputCallback
  12088. {
  12089. public:
  12090. MidiMessageCollector();
  12091. ~MidiMessageCollector();
  12092. void reset (const double sampleRate);
  12093. void addMessageToQueue (const MidiMessage& message);
  12094. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12095. const int numSamples);
  12096. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12097. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12098. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12099. juce_UseDebuggingNewOperator
  12100. private:
  12101. double lastCallbackTime;
  12102. CriticalSection midiCallbackLock;
  12103. MidiBuffer incomingMessages;
  12104. double sampleRate;
  12105. MidiMessageCollector (const MidiMessageCollector&);
  12106. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12107. };
  12108. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12109. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12110. #endif
  12111. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12112. #endif
  12113. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12114. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12115. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12116. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12117. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12118. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12119. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12120. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12121. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12122. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12123. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12124. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12125. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12126. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12127. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12128. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12129. class AudioProcessor;
  12130. class JUCE_API AudioProcessorEditor : public Component
  12131. {
  12132. protected:
  12133. AudioProcessorEditor (AudioProcessor* const owner);
  12134. public:
  12135. ~AudioProcessorEditor();
  12136. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12137. private:
  12138. AudioProcessor* const owner;
  12139. };
  12140. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12141. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12142. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12143. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12144. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12145. class AudioProcessor;
  12146. class JUCE_API AudioProcessorListener
  12147. {
  12148. public:
  12149. virtual ~AudioProcessorListener() {}
  12150. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12151. int parameterIndex,
  12152. float newValue) = 0;
  12153. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12154. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12155. int parameterIndex);
  12156. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12157. int parameterIndex);
  12158. };
  12159. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12160. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12161. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12162. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12163. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12164. class JUCE_API AudioPlayHead
  12165. {
  12166. protected:
  12167. AudioPlayHead() {}
  12168. public:
  12169. virtual ~AudioPlayHead() {}
  12170. enum FrameRateType
  12171. {
  12172. fps24 = 0,
  12173. fps25 = 1,
  12174. fps2997 = 2,
  12175. fps30 = 3,
  12176. fps2997drop = 4,
  12177. fps30drop = 5,
  12178. fpsUnknown = 99
  12179. };
  12180. struct CurrentPositionInfo
  12181. {
  12182. double bpm;
  12183. int timeSigNumerator;
  12184. int timeSigDenominator;
  12185. double timeInSeconds;
  12186. double editOriginTime;
  12187. double ppqPosition;
  12188. double ppqPositionOfLastBarStart;
  12189. FrameRateType frameRate;
  12190. bool isPlaying;
  12191. bool isRecording;
  12192. };
  12193. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12194. };
  12195. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12196. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12197. class JUCE_API AudioProcessor
  12198. {
  12199. protected:
  12200. AudioProcessor();
  12201. public:
  12202. virtual ~AudioProcessor();
  12203. virtual const String getName() const = 0;
  12204. virtual void prepareToPlay (double sampleRate,
  12205. int estimatedSamplesPerBlock) = 0;
  12206. virtual void releaseResources() = 0;
  12207. virtual void processBlock (AudioSampleBuffer& buffer,
  12208. MidiBuffer& midiMessages) = 0;
  12209. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12210. double getSampleRate() const throw() { return sampleRate; }
  12211. int getBlockSize() const throw() { return blockSize; }
  12212. int getNumInputChannels() const throw() { return numInputChannels; }
  12213. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12214. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12215. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12216. virtual bool isInputChannelStereoPair (int index) const = 0;
  12217. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12218. int getLatencySamples() const throw() { return latencySamples; }
  12219. void setLatencySamples (const int newLatency);
  12220. virtual bool acceptsMidi() const = 0;
  12221. virtual bool producesMidi() const = 0;
  12222. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12223. void suspendProcessing (const bool shouldBeSuspended);
  12224. bool isSuspended() const throw() { return suspended; }
  12225. virtual void reset();
  12226. bool isNonRealtime() const throw() { return nonRealtime; }
  12227. void setNonRealtime (const bool isNonRealtime) throw();
  12228. virtual AudioProcessorEditor* createEditor() = 0;
  12229. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12230. AudioProcessorEditor* createEditorIfNeeded();
  12231. virtual int getNumParameters() = 0;
  12232. virtual const String getParameterName (int parameterIndex) = 0;
  12233. virtual float getParameter (int parameterIndex) = 0;
  12234. virtual const String getParameterText (int parameterIndex) = 0;
  12235. virtual void setParameter (int parameterIndex,
  12236. float newValue) = 0;
  12237. void setParameterNotifyingHost (int parameterIndex,
  12238. float newValue);
  12239. virtual bool isParameterAutomatable (int parameterIndex) const;
  12240. virtual bool isMetaParameter (int parameterIndex) const;
  12241. void beginParameterChangeGesture (int parameterIndex);
  12242. void endParameterChangeGesture (int parameterIndex);
  12243. void updateHostDisplay();
  12244. virtual int getNumPrograms() = 0;
  12245. virtual int getCurrentProgram() = 0;
  12246. virtual void setCurrentProgram (int index) = 0;
  12247. virtual const String getProgramName (int index) = 0;
  12248. virtual void changeProgramName (int index, const String& newName) = 0;
  12249. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12250. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12251. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12252. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12253. void addListener (AudioProcessorListener* const newListener) throw();
  12254. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12255. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12256. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12257. void setPlayConfigDetails (const int numIns, const int numOuts,
  12258. const double sampleRate,
  12259. const int blockSize) throw();
  12260. juce_UseDebuggingNewOperator
  12261. protected:
  12262. static void copyXmlToBinary (const XmlElement& xml,
  12263. JUCE_NAMESPACE::MemoryBlock& destData);
  12264. static XmlElement* getXmlFromBinary (const void* data,
  12265. const int sizeInBytes);
  12266. AudioPlayHead* playHead;
  12267. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12268. private:
  12269. VoidArray listeners;
  12270. AudioProcessorEditor* activeEditor;
  12271. double sampleRate;
  12272. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12273. bool suspended, nonRealtime;
  12274. CriticalSection callbackLock, listenerLock;
  12275. #ifdef JUCE_DEBUG
  12276. BitArray changingParams;
  12277. #endif
  12278. AudioProcessor (const AudioProcessor&);
  12279. AudioProcessor& operator= (const AudioProcessor&);
  12280. };
  12281. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12282. /*** End of inlined file: juce_AudioProcessor.h ***/
  12283. /*** Start of inlined file: juce_PluginDescription.h ***/
  12284. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12285. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12286. class JUCE_API PluginDescription
  12287. {
  12288. public:
  12289. PluginDescription() throw();
  12290. PluginDescription (const PluginDescription& other) throw();
  12291. PluginDescription& operator= (const PluginDescription& other) throw();
  12292. ~PluginDescription() throw();
  12293. String name;
  12294. String pluginFormatName;
  12295. String category;
  12296. String manufacturerName;
  12297. String version;
  12298. String fileOrIdentifier;
  12299. Time lastFileModTime;
  12300. int uid;
  12301. bool isInstrument;
  12302. int numInputChannels;
  12303. int numOutputChannels;
  12304. bool isDuplicateOf (const PluginDescription& other) const;
  12305. const String createIdentifierString() const throw();
  12306. XmlElement* createXml() const;
  12307. bool loadFromXml (const XmlElement& xml);
  12308. juce_UseDebuggingNewOperator
  12309. };
  12310. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12311. /*** End of inlined file: juce_PluginDescription.h ***/
  12312. class JUCE_API AudioPluginInstance : public AudioProcessor
  12313. {
  12314. public:
  12315. virtual ~AudioPluginInstance();
  12316. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12317. juce_UseDebuggingNewOperator
  12318. protected:
  12319. AudioPluginInstance();
  12320. AudioPluginInstance (const AudioPluginInstance&);
  12321. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12322. };
  12323. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12324. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12325. class PluginDescription;
  12326. class JUCE_API AudioPluginFormat
  12327. {
  12328. public:
  12329. virtual ~AudioPluginFormat();
  12330. virtual const String getName() const = 0;
  12331. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12332. const String& fileOrIdentifier) = 0;
  12333. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12334. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12335. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12336. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12337. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12338. const bool recursive) = 0;
  12339. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12340. juce_UseDebuggingNewOperator
  12341. protected:
  12342. AudioPluginFormat() throw();
  12343. AudioPluginFormat (const AudioPluginFormat&);
  12344. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12345. };
  12346. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12347. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12348. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12349. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12350. {
  12351. public:
  12352. AudioUnitPluginFormat();
  12353. ~AudioUnitPluginFormat();
  12354. const String getName() const { return "AudioUnit"; }
  12355. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12356. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12357. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12358. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12359. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12360. bool doesPluginStillExist (const PluginDescription& desc);
  12361. const FileSearchPath getDefaultLocationsToSearch();
  12362. juce_UseDebuggingNewOperator
  12363. private:
  12364. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12365. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12366. };
  12367. #endif
  12368. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12369. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12370. #endif
  12371. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12372. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12373. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12374. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12375. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12376. // Sorry, this file is just a placeholder at the moment!...
  12377. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12378. {
  12379. public:
  12380. DirectXPluginFormat();
  12381. ~DirectXPluginFormat();
  12382. const String getName() const { return "DirectX"; }
  12383. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12384. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12385. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12386. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12387. const FileSearchPath getDefaultLocationsToSearch();
  12388. juce_UseDebuggingNewOperator
  12389. private:
  12390. DirectXPluginFormat (const DirectXPluginFormat&);
  12391. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12392. };
  12393. #endif
  12394. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12395. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12396. #endif
  12397. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12398. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12399. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12400. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12401. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12402. // Sorry, this file is just a placeholder at the moment!...
  12403. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12404. {
  12405. public:
  12406. LADSPAPluginFormat();
  12407. ~LADSPAPluginFormat();
  12408. const String getName() const { return "LADSPA"; }
  12409. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12410. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12411. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12412. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12413. const FileSearchPath getDefaultLocationsToSearch();
  12414. juce_UseDebuggingNewOperator
  12415. private:
  12416. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12417. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12418. };
  12419. #endif
  12420. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12421. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12422. #endif
  12423. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12424. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12425. #ifdef __aeffect__
  12426. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12427. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12428. class VSTMidiEventList
  12429. {
  12430. public:
  12431. VSTMidiEventList()
  12432. : numEventsUsed (0), numEventsAllocated (0)
  12433. {
  12434. }
  12435. ~VSTMidiEventList()
  12436. {
  12437. freeEvents();
  12438. }
  12439. void clear()
  12440. {
  12441. numEventsUsed = 0;
  12442. if (events != 0)
  12443. events->numEvents = 0;
  12444. }
  12445. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12446. {
  12447. ensureSize (numEventsUsed + 1);
  12448. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12449. events->numEvents = ++numEventsUsed;
  12450. if (numBytes <= 4)
  12451. {
  12452. if (e->type == kVstSysExType)
  12453. {
  12454. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12455. e->type = kVstMidiType;
  12456. e->byteSize = sizeof (VstMidiEvent);
  12457. e->noteLength = 0;
  12458. e->noteOffset = 0;
  12459. e->detune = 0;
  12460. e->noteOffVelocity = 0;
  12461. }
  12462. e->deltaFrames = frameOffset;
  12463. memcpy (e->midiData, midiData, numBytes);
  12464. }
  12465. else
  12466. {
  12467. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12468. if (se->type == kVstSysExType)
  12469. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12470. else
  12471. se->sysexDump = (char*) juce_malloc (numBytes);
  12472. memcpy (se->sysexDump, midiData, numBytes);
  12473. se->type = kVstSysExType;
  12474. se->byteSize = sizeof (VstMidiSysexEvent);
  12475. se->deltaFrames = frameOffset;
  12476. se->flags = 0;
  12477. se->dumpBytes = numBytes;
  12478. se->resvd1 = 0;
  12479. se->resvd2 = 0;
  12480. }
  12481. }
  12482. // Handy method to pull the events out of an event buffer supplied by the host
  12483. // or plugin.
  12484. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12485. {
  12486. for (int i = 0; i < events->numEvents; ++i)
  12487. {
  12488. const VstEvent* const e = events->events[i];
  12489. if (e != 0)
  12490. {
  12491. if (e->type == kVstMidiType)
  12492. {
  12493. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12494. 4, e->deltaFrames);
  12495. }
  12496. else if (e->type == kVstSysExType)
  12497. {
  12498. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12499. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12500. e->deltaFrames);
  12501. }
  12502. }
  12503. }
  12504. }
  12505. void ensureSize (int numEventsNeeded)
  12506. {
  12507. if (numEventsNeeded > numEventsAllocated)
  12508. {
  12509. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12510. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12511. if (events == 0)
  12512. events.calloc (size, 1);
  12513. else
  12514. events.realloc (size, 1);
  12515. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12516. {
  12517. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12518. (int) sizeof (VstMidiSysexEvent)));
  12519. e->type = kVstMidiType;
  12520. e->byteSize = sizeof (VstMidiEvent);
  12521. events->events[i] = (VstEvent*) e;
  12522. }
  12523. numEventsAllocated = numEventsNeeded;
  12524. }
  12525. }
  12526. void freeEvents()
  12527. {
  12528. if (events != 0)
  12529. {
  12530. for (int i = numEventsAllocated; --i >= 0;)
  12531. {
  12532. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12533. if (e->type == kVstSysExType)
  12534. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12535. juce_free (e);
  12536. }
  12537. events.free();
  12538. numEventsUsed = 0;
  12539. numEventsAllocated = 0;
  12540. }
  12541. }
  12542. HeapBlock <VstEvents> events;
  12543. private:
  12544. int numEventsUsed, numEventsAllocated;
  12545. };
  12546. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12547. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12548. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12549. #endif
  12550. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12551. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12552. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12553. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12554. #if JUCE_PLUGINHOST_VST
  12555. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12556. {
  12557. public:
  12558. VSTPluginFormat();
  12559. ~VSTPluginFormat();
  12560. const String getName() const { return "VST"; }
  12561. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12562. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12563. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12564. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12565. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12566. bool doesPluginStillExist (const PluginDescription& desc);
  12567. const FileSearchPath getDefaultLocationsToSearch();
  12568. juce_UseDebuggingNewOperator
  12569. private:
  12570. VSTPluginFormat (const VSTPluginFormat&);
  12571. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12572. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12573. };
  12574. #endif
  12575. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12576. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12577. #endif
  12578. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12579. #endif
  12580. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12581. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12582. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12583. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12584. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12585. {
  12586. public:
  12587. AudioPluginFormatManager() throw();
  12588. ~AudioPluginFormatManager() throw();
  12589. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12590. void addDefaultFormats();
  12591. int getNumFormats() throw();
  12592. AudioPluginFormat* getFormat (const int index) throw();
  12593. void addFormat (AudioPluginFormat* const format) throw();
  12594. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12595. String& errorMessage) const;
  12596. bool doesPluginStillExist (const PluginDescription& description) const;
  12597. juce_UseDebuggingNewOperator
  12598. private:
  12599. OwnedArray <AudioPluginFormat> formats;
  12600. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12601. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12602. };
  12603. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12604. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12605. #endif
  12606. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12607. #endif
  12608. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12609. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12610. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12611. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12612. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12613. {
  12614. public:
  12615. KnownPluginList();
  12616. ~KnownPluginList();
  12617. void clear();
  12618. int getNumTypes() const throw() { return types.size(); }
  12619. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12620. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12621. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12622. bool addType (const PluginDescription& type);
  12623. void removeType (const int index) throw();
  12624. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12625. const bool dontRescanIfAlreadyInList,
  12626. OwnedArray <PluginDescription>& typesFound,
  12627. AudioPluginFormat& formatToUse);
  12628. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12629. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12630. OwnedArray <PluginDescription>& typesFound);
  12631. enum SortMethod
  12632. {
  12633. defaultOrder = 0,
  12634. sortAlphabetically,
  12635. sortByCategory,
  12636. sortByManufacturer,
  12637. sortByFileSystemLocation
  12638. };
  12639. void addToMenu (PopupMenu& menu,
  12640. const SortMethod sortMethod) const;
  12641. int getIndexChosenByMenu (const int menuResultCode) const;
  12642. void sort (const SortMethod method);
  12643. XmlElement* createXml() const;
  12644. void recreateFromXml (const XmlElement& xml);
  12645. juce_UseDebuggingNewOperator
  12646. private:
  12647. OwnedArray <PluginDescription> types;
  12648. KnownPluginList (const KnownPluginList&);
  12649. KnownPluginList& operator= (const KnownPluginList&);
  12650. };
  12651. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12652. /*** End of inlined file: juce_KnownPluginList.h ***/
  12653. #endif
  12654. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12655. #endif
  12656. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12657. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12658. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12659. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12660. class JUCE_API PluginDirectoryScanner
  12661. {
  12662. public:
  12663. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12664. AudioPluginFormat& formatToLookFor,
  12665. FileSearchPath directoriesToSearch,
  12666. const bool searchRecursively,
  12667. const File& deadMansPedalFile);
  12668. ~PluginDirectoryScanner();
  12669. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12670. const String getNextPluginFileThatWillBeScanned() const throw();
  12671. float getProgress() const { return progress; }
  12672. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12673. juce_UseDebuggingNewOperator
  12674. private:
  12675. KnownPluginList& list;
  12676. AudioPluginFormat& format;
  12677. StringArray filesOrIdentifiersToScan;
  12678. File deadMansPedalFile;
  12679. StringArray failedFiles;
  12680. int nextIndex;
  12681. float progress;
  12682. const StringArray getDeadMansPedalFile() throw();
  12683. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12684. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12685. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12686. };
  12687. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12688. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12689. #endif
  12690. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12691. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12692. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12693. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12694. /*** Start of inlined file: juce_ListBox.h ***/
  12695. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12696. #define __JUCE_LISTBOX_JUCEHEADER__
  12697. class ListViewport;
  12698. class JUCE_API ListBoxModel
  12699. {
  12700. public:
  12701. virtual ~ListBoxModel() {}
  12702. virtual int getNumRows() = 0;
  12703. virtual void paintListBoxItem (int rowNumber,
  12704. Graphics& g,
  12705. int width, int height,
  12706. bool rowIsSelected) = 0;
  12707. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12708. Component* existingComponentToUpdate);
  12709. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12710. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12711. virtual void backgroundClicked();
  12712. virtual void selectedRowsChanged (int lastRowSelected);
  12713. virtual void deleteKeyPressed (int lastRowSelected);
  12714. virtual void returnKeyPressed (int lastRowSelected);
  12715. virtual void listWasScrolled();
  12716. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12717. virtual const String getTooltipForRow (int row);
  12718. };
  12719. class JUCE_API ListBox : public Component,
  12720. public SettableTooltipClient
  12721. {
  12722. public:
  12723. ListBox (const String& componentName,
  12724. ListBoxModel* const model);
  12725. ~ListBox();
  12726. void setModel (ListBoxModel* const newModel);
  12727. ListBoxModel* getModel() const throw() { return model; }
  12728. void updateContent();
  12729. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12730. void setMouseMoveSelectsRows (bool shouldSelect);
  12731. void selectRow (const int rowNumber,
  12732. bool dontScrollToShowThisRow = false,
  12733. bool deselectOthersFirst = true);
  12734. void selectRangeOfRows (int firstRow,
  12735. int lastRow);
  12736. void deselectRow (const int rowNumber);
  12737. void deselectAllRows();
  12738. void flipRowSelection (const int rowNumber);
  12739. const SparseSet<int> getSelectedRows() const;
  12740. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12741. const bool sendNotificationEventToModel = true);
  12742. bool isRowSelected (const int rowNumber) const;
  12743. int getNumSelectedRows() const;
  12744. int getSelectedRow (const int index = 0) const;
  12745. int getLastRowSelected() const;
  12746. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12747. const ModifierKeys& modifiers);
  12748. void setVerticalPosition (const double newProportion);
  12749. double getVerticalPosition() const;
  12750. void scrollToEnsureRowIsOnscreen (const int row);
  12751. ScrollBar* getVerticalScrollBar() const throw();
  12752. ScrollBar* getHorizontalScrollBar() const throw();
  12753. int getRowContainingPosition (const int x, const int y) const throw();
  12754. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12755. const Rectangle<int> getRowPosition (const int rowNumber,
  12756. const bool relativeToComponentTopLeft) const throw();
  12757. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12758. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12759. int getVisibleRowWidth() const throw();
  12760. void setRowHeight (const int newHeight);
  12761. int getRowHeight() const throw() { return rowHeight; }
  12762. int getNumRowsOnScreen() const throw();
  12763. enum ColourIds
  12764. {
  12765. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12766. Make this transparent if you don't want the background to be filled. */
  12767. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12768. Make this transparent to not have an outline. */
  12769. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12770. };
  12771. void setOutlineThickness (const int outlineThickness);
  12772. int getOutlineThickness() const throw() { return outlineThickness; }
  12773. void setHeaderComponent (Component* const newHeaderComponent);
  12774. void setMinimumContentWidth (const int newMinimumWidth);
  12775. int getVisibleContentWidth() const throw();
  12776. void repaintRow (const int rowNumber) throw();
  12777. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12778. Viewport* getViewport() const throw();
  12779. bool keyPressed (const KeyPress& key);
  12780. bool keyStateChanged (const bool isKeyDown);
  12781. void paint (Graphics& g);
  12782. void paintOverChildren (Graphics& g);
  12783. void resized();
  12784. void visibilityChanged();
  12785. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12786. void mouseMove (const MouseEvent&);
  12787. void mouseExit (const MouseEvent&);
  12788. void mouseUp (const MouseEvent&);
  12789. void colourChanged();
  12790. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12791. juce_UseDebuggingNewOperator
  12792. private:
  12793. friend class ListViewport;
  12794. friend class TableListBox;
  12795. ListBoxModel* model;
  12796. ListViewport* viewport;
  12797. Component* headerComponent;
  12798. int totalItems, rowHeight, minimumRowWidth;
  12799. int outlineThickness;
  12800. int lastRowSelected;
  12801. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12802. SparseSet <int> selected;
  12803. void selectRowInternal (const int rowNumber,
  12804. bool dontScrollToShowThisRow,
  12805. bool deselectOthersFirst,
  12806. bool isMouseClick);
  12807. ListBox (const ListBox&);
  12808. ListBox& operator= (const ListBox&);
  12809. };
  12810. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12811. /*** End of inlined file: juce_ListBox.h ***/
  12812. /*** Start of inlined file: juce_TextButton.h ***/
  12813. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12814. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12815. class JUCE_API TextButton : public Button
  12816. {
  12817. public:
  12818. TextButton (const String& buttonName,
  12819. const String& toolTip = String::empty);
  12820. ~TextButton();
  12821. enum ColourIds
  12822. {
  12823. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12824. 'off'). The look-and-feel class might re-interpret this to add
  12825. effects, etc. */
  12826. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12827. 'on'). The look-and-feel class might re-interpret this to add
  12828. effects, etc. */
  12829. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12830. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12831. };
  12832. void changeWidthToFitText (const int newHeight = -1);
  12833. virtual const Font getFont();
  12834. juce_UseDebuggingNewOperator
  12835. protected:
  12836. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12837. void colourChanged();
  12838. private:
  12839. TextButton (const TextButton&);
  12840. TextButton& operator= (const TextButton&);
  12841. };
  12842. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12843. /*** End of inlined file: juce_TextButton.h ***/
  12844. class JUCE_API PluginListComponent : public Component,
  12845. public ListBoxModel,
  12846. public ChangeListener,
  12847. public ButtonListener,
  12848. public Timer
  12849. {
  12850. public:
  12851. PluginListComponent (KnownPluginList& listToRepresent,
  12852. const File& deadMansPedalFile,
  12853. PropertiesFile* const propertiesToUse);
  12854. ~PluginListComponent();
  12855. void resized();
  12856. bool isInterestedInFileDrag (const StringArray& files);
  12857. void filesDropped (const StringArray& files, int, int);
  12858. int getNumRows();
  12859. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12860. void deleteKeyPressed (int lastRowSelected);
  12861. void buttonClicked (Button* b);
  12862. void changeListenerCallback (void*);
  12863. void timerCallback();
  12864. juce_UseDebuggingNewOperator
  12865. private:
  12866. KnownPluginList& list;
  12867. File deadMansPedalFile;
  12868. ListBox* listBox;
  12869. TextButton* optionsButton;
  12870. PropertiesFile* propertiesToUse;
  12871. int typeToScan;
  12872. void scanFor (AudioPluginFormat* format);
  12873. PluginListComponent (const PluginListComponent&);
  12874. PluginListComponent& operator= (const PluginListComponent&);
  12875. };
  12876. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12877. /*** End of inlined file: juce_PluginListComponent.h ***/
  12878. #endif
  12879. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12880. #endif
  12881. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12882. #endif
  12883. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12884. #endif
  12885. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12886. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12887. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12888. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12889. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12890. public AsyncUpdater
  12891. {
  12892. public:
  12893. AudioProcessorGraph();
  12894. ~AudioProcessorGraph();
  12895. class JUCE_API Node : public ReferenceCountedObject
  12896. {
  12897. public:
  12898. ~Node();
  12899. const uint32 id;
  12900. AudioProcessor* const processor;
  12901. NamedValueSet properties;
  12902. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12903. juce_UseDebuggingNewOperator
  12904. private:
  12905. friend class AudioProcessorGraph;
  12906. bool isPrepared;
  12907. Node (const uint32 id, AudioProcessor* const processor);
  12908. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12909. void unprepare();
  12910. Node (const Node&);
  12911. Node& operator= (const Node&);
  12912. };
  12913. struct JUCE_API Connection
  12914. {
  12915. public:
  12916. uint32 sourceNodeId;
  12917. int sourceChannelIndex;
  12918. uint32 destNodeId;
  12919. int destChannelIndex;
  12920. juce_UseDebuggingNewOperator
  12921. private:
  12922. };
  12923. void clear();
  12924. int getNumNodes() const { return nodes.size(); }
  12925. Node* getNode (const int index) const { return nodes [index]; }
  12926. Node* getNodeForId (const uint32 nodeId) const;
  12927. Node* addNode (AudioProcessor* const newProcessor,
  12928. uint32 nodeId = 0);
  12929. bool removeNode (const uint32 nodeId);
  12930. int getNumConnections() const { return connections.size(); }
  12931. const Connection* getConnection (const int index) const { return connections [index]; }
  12932. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12933. const int sourceChannelIndex,
  12934. const uint32 destNodeId,
  12935. const int destChannelIndex) const;
  12936. bool isConnected (const uint32 possibleSourceNodeId,
  12937. const uint32 possibleDestNodeId) const;
  12938. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12939. const uint32 destNodeId, const int destChannelIndex) const;
  12940. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12941. const uint32 destNodeId, const int destChannelIndex);
  12942. void removeConnection (const int index);
  12943. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12944. const uint32 destNodeId, const int destChannelIndex);
  12945. bool disconnectNode (const uint32 nodeId);
  12946. bool removeIllegalConnections();
  12947. static const int midiChannelIndex;
  12948. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12949. {
  12950. public:
  12951. enum IODeviceType
  12952. {
  12953. audioInputNode, /**< In this mode, the processor has output channels
  12954. representing all the audio input channels that are
  12955. coming into its parent audio graph. */
  12956. audioOutputNode, /**< In this mode, the processor has input channels
  12957. representing all the audio output channels that are
  12958. going out of its parent audio graph. */
  12959. midiInputNode, /**< In this mode, the processor has a midi output which
  12960. delivers the same midi data that is arriving at its
  12961. parent graph. */
  12962. midiOutputNode /**< In this mode, the processor has a midi input and
  12963. any data sent to it will be passed out of the parent
  12964. graph. */
  12965. };
  12966. IODeviceType getType() const { return type; }
  12967. AudioProcessorGraph* getParentGraph() const { return graph; }
  12968. bool isInput() const;
  12969. bool isOutput() const;
  12970. AudioGraphIOProcessor (const IODeviceType type);
  12971. ~AudioGraphIOProcessor();
  12972. const String getName() const;
  12973. void fillInPluginDescription (PluginDescription& d) const;
  12974. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12975. void releaseResources();
  12976. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12977. const String getInputChannelName (const int channelIndex) const;
  12978. const String getOutputChannelName (const int channelIndex) const;
  12979. bool isInputChannelStereoPair (int index) const;
  12980. bool isOutputChannelStereoPair (int index) const;
  12981. bool acceptsMidi() const;
  12982. bool producesMidi() const;
  12983. AudioProcessorEditor* createEditor();
  12984. int getNumParameters();
  12985. const String getParameterName (int);
  12986. float getParameter (int);
  12987. const String getParameterText (int);
  12988. void setParameter (int, float);
  12989. int getNumPrograms();
  12990. int getCurrentProgram();
  12991. void setCurrentProgram (int);
  12992. const String getProgramName (int);
  12993. void changeProgramName (int, const String&);
  12994. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12995. void setStateInformation (const void* data, int sizeInBytes);
  12996. void setParentGraph (AudioProcessorGraph* const graph);
  12997. juce_UseDebuggingNewOperator
  12998. private:
  12999. const IODeviceType type;
  13000. AudioProcessorGraph* graph;
  13001. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13002. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13003. };
  13004. // AudioProcessor methods:
  13005. const String getName() const;
  13006. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13007. void releaseResources();
  13008. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13009. const String getInputChannelName (const int channelIndex) const;
  13010. const String getOutputChannelName (const int channelIndex) const;
  13011. bool isInputChannelStereoPair (int index) const;
  13012. bool isOutputChannelStereoPair (int index) const;
  13013. bool acceptsMidi() const;
  13014. bool producesMidi() const;
  13015. AudioProcessorEditor* createEditor() { return 0; }
  13016. int getNumParameters() { return 0; }
  13017. const String getParameterName (int) { return String::empty; }
  13018. float getParameter (int) { return 0; }
  13019. const String getParameterText (int) { return String::empty; }
  13020. void setParameter (int, float) { }
  13021. int getNumPrograms() { return 0; }
  13022. int getCurrentProgram() { return 0; }
  13023. void setCurrentProgram (int) { }
  13024. const String getProgramName (int) { return String::empty; }
  13025. void changeProgramName (int, const String&) { }
  13026. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13027. void setStateInformation (const void* data, int sizeInBytes);
  13028. void handleAsyncUpdate();
  13029. juce_UseDebuggingNewOperator
  13030. private:
  13031. ReferenceCountedArray <Node> nodes;
  13032. OwnedArray <Connection> connections;
  13033. int lastNodeId;
  13034. AudioSampleBuffer renderingBuffers;
  13035. OwnedArray <MidiBuffer> midiBuffers;
  13036. CriticalSection renderLock;
  13037. VoidArray renderingOps;
  13038. friend class AudioGraphIOProcessor;
  13039. AudioSampleBuffer* currentAudioInputBuffer;
  13040. AudioSampleBuffer currentAudioOutputBuffer;
  13041. MidiBuffer* currentMidiInputBuffer;
  13042. MidiBuffer currentMidiOutputBuffer;
  13043. void clearRenderingSequence();
  13044. void buildRenderingSequence();
  13045. bool isAnInputTo (const uint32 possibleInputId,
  13046. const uint32 possibleDestinationId,
  13047. const int recursionCheck) const;
  13048. AudioProcessorGraph (const AudioProcessorGraph&);
  13049. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13050. };
  13051. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13052. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13053. #endif
  13054. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13055. #endif
  13056. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13057. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13058. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13059. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13060. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13061. public MidiInputCallback
  13062. {
  13063. public:
  13064. AudioProcessorPlayer();
  13065. virtual ~AudioProcessorPlayer();
  13066. void setProcessor (AudioProcessor* const processorToPlay);
  13067. AudioProcessor* getCurrentProcessor() const { return processor; }
  13068. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13069. void audioDeviceIOCallback (const float** inputChannelData,
  13070. int totalNumInputChannels,
  13071. float** outputChannelData,
  13072. int totalNumOutputChannels,
  13073. int numSamples);
  13074. void audioDeviceAboutToStart (AudioIODevice* device);
  13075. void audioDeviceStopped();
  13076. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13077. juce_UseDebuggingNewOperator
  13078. private:
  13079. AudioProcessor* processor;
  13080. CriticalSection lock;
  13081. double sampleRate;
  13082. int blockSize;
  13083. bool isPrepared;
  13084. int numInputChans, numOutputChans;
  13085. float* channels [128];
  13086. AudioSampleBuffer tempBuffer;
  13087. MidiBuffer incomingMidi;
  13088. MidiMessageCollector messageCollector;
  13089. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13090. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13091. };
  13092. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13093. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13094. #endif
  13095. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13096. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13097. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13098. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13099. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13100. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13101. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13102. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13103. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13104. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13105. class EditableProperty;
  13106. class JUCE_API PropertyComponent : public Component,
  13107. public SettableTooltipClient
  13108. {
  13109. public:
  13110. PropertyComponent (const String& propertyName,
  13111. const int preferredHeight = 25);
  13112. ~PropertyComponent();
  13113. int getPreferredHeight() const throw() { return preferredHeight; }
  13114. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13115. virtual void refresh() = 0;
  13116. void paint (Graphics& g);
  13117. void resized();
  13118. void enablementChanged();
  13119. juce_UseDebuggingNewOperator
  13120. protected:
  13121. int preferredHeight;
  13122. };
  13123. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13124. /*** End of inlined file: juce_PropertyComponent.h ***/
  13125. class JUCE_API PropertyPanel : public Component
  13126. {
  13127. public:
  13128. PropertyPanel();
  13129. ~PropertyPanel();
  13130. void clear();
  13131. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13132. void addSection (const String& sectionTitle,
  13133. const Array <PropertyComponent*>& newPropertyComponents,
  13134. const bool shouldSectionInitiallyBeOpen = true);
  13135. void refreshAll() const;
  13136. const StringArray getSectionNames() const;
  13137. bool isSectionOpen (const int sectionIndex) const;
  13138. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  13139. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  13140. XmlElement* getOpennessState() const;
  13141. void restoreOpennessState (const XmlElement& newState);
  13142. void setMessageWhenEmpty (const String& newMessage);
  13143. const String& getMessageWhenEmpty() const;
  13144. void paint (Graphics& g);
  13145. void resized();
  13146. juce_UseDebuggingNewOperator
  13147. private:
  13148. Viewport* viewport;
  13149. Component* propertyHolderComponent;
  13150. String messageWhenEmpty;
  13151. void updatePropHolderLayout() const;
  13152. void updatePropHolderLayout (const int width) const;
  13153. };
  13154. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13155. /*** End of inlined file: juce_PropertyPanel.h ***/
  13156. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13157. {
  13158. public:
  13159. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13160. ~GenericAudioProcessorEditor();
  13161. void paint (Graphics& g);
  13162. void resized();
  13163. juce_UseDebuggingNewOperator
  13164. private:
  13165. PropertyPanel* panel;
  13166. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13167. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13168. };
  13169. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13170. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13171. #endif
  13172. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13173. /*** Start of inlined file: juce_Sampler.h ***/
  13174. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13175. #define __JUCE_SAMPLER_JUCEHEADER__
  13176. /*** Start of inlined file: juce_Synthesiser.h ***/
  13177. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13178. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13179. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13180. {
  13181. protected:
  13182. SynthesiserSound();
  13183. public:
  13184. virtual ~SynthesiserSound();
  13185. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13186. virtual bool appliesToChannel (const int midiChannel) = 0;
  13187. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13188. juce_UseDebuggingNewOperator
  13189. };
  13190. class JUCE_API SynthesiserVoice
  13191. {
  13192. public:
  13193. SynthesiserVoice();
  13194. virtual ~SynthesiserVoice();
  13195. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13196. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13197. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13198. virtual void startNote (const int midiNoteNumber,
  13199. const float velocity,
  13200. SynthesiserSound* sound,
  13201. const int currentPitchWheelPosition) = 0;
  13202. virtual void stopNote (const bool allowTailOff) = 0;
  13203. virtual void pitchWheelMoved (const int newValue) = 0;
  13204. virtual void controllerMoved (const int controllerNumber,
  13205. const int newValue) = 0;
  13206. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13207. int startSample,
  13208. int numSamples) = 0;
  13209. bool isPlayingChannel (const int midiChannel) const;
  13210. void setCurrentPlaybackSampleRate (const double newRate);
  13211. juce_UseDebuggingNewOperator
  13212. protected:
  13213. double getSampleRate() const { return currentSampleRate; }
  13214. void clearCurrentNote();
  13215. private:
  13216. friend class Synthesiser;
  13217. double currentSampleRate;
  13218. int currentlyPlayingNote;
  13219. uint32 noteOnTime;
  13220. SynthesiserSound::Ptr currentlyPlayingSound;
  13221. };
  13222. class JUCE_API Synthesiser
  13223. {
  13224. public:
  13225. Synthesiser();
  13226. virtual ~Synthesiser();
  13227. void clearVoices();
  13228. int getNumVoices() const { return voices.size(); }
  13229. SynthesiserVoice* getVoice (const int index) const;
  13230. void addVoice (SynthesiserVoice* const newVoice);
  13231. void removeVoice (const int index);
  13232. void clearSounds();
  13233. int getNumSounds() const { return sounds.size(); }
  13234. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13235. void addSound (const SynthesiserSound::Ptr& newSound);
  13236. void removeSound (const int index);
  13237. void setNoteStealingEnabled (const bool shouldStealNotes);
  13238. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13239. virtual void noteOn (const int midiChannel,
  13240. const int midiNoteNumber,
  13241. const float velocity);
  13242. virtual void noteOff (const int midiChannel,
  13243. const int midiNoteNumber,
  13244. const bool allowTailOff);
  13245. virtual void allNotesOff (const int midiChannel,
  13246. const bool allowTailOff);
  13247. virtual void handlePitchWheel (const int midiChannel,
  13248. const int wheelValue);
  13249. virtual void handleController (const int midiChannel,
  13250. const int controllerNumber,
  13251. const int controllerValue);
  13252. void setCurrentPlaybackSampleRate (const double sampleRate);
  13253. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13254. const MidiBuffer& inputMidi,
  13255. int startSample,
  13256. int numSamples);
  13257. juce_UseDebuggingNewOperator
  13258. protected:
  13259. CriticalSection lock;
  13260. OwnedArray <SynthesiserVoice> voices;
  13261. ReferenceCountedArray <SynthesiserSound> sounds;
  13262. int lastPitchWheelValues [16];
  13263. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13264. const bool stealIfNoneAvailable) const;
  13265. void startVoice (SynthesiserVoice* const voice,
  13266. SynthesiserSound* const sound,
  13267. const int midiChannel,
  13268. const int midiNoteNumber,
  13269. const float velocity);
  13270. int findFreeVoice (const bool) const { return 0; }
  13271. private:
  13272. double sampleRate;
  13273. uint32 lastNoteOnCounter;
  13274. bool shouldStealNotes;
  13275. Synthesiser (const Synthesiser&);
  13276. Synthesiser& operator= (const Synthesiser&);
  13277. };
  13278. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13279. /*** End of inlined file: juce_Synthesiser.h ***/
  13280. class JUCE_API SamplerSound : public SynthesiserSound
  13281. {
  13282. public:
  13283. SamplerSound (const String& name,
  13284. AudioFormatReader& source,
  13285. const BitArray& midiNotes,
  13286. const int midiNoteForNormalPitch,
  13287. const double attackTimeSecs,
  13288. const double releaseTimeSecs,
  13289. const double maxSampleLengthSeconds);
  13290. ~SamplerSound();
  13291. const String& getName() const { return name; }
  13292. AudioSampleBuffer* getAudioData() const { return data; }
  13293. bool appliesToNote (const int midiNoteNumber);
  13294. bool appliesToChannel (const int midiChannel);
  13295. juce_UseDebuggingNewOperator
  13296. private:
  13297. friend class SamplerVoice;
  13298. String name;
  13299. ScopedPointer <AudioSampleBuffer> data;
  13300. double sourceSampleRate;
  13301. BitArray midiNotes;
  13302. int length, attackSamples, releaseSamples;
  13303. int midiRootNote;
  13304. };
  13305. class JUCE_API SamplerVoice : public SynthesiserVoice
  13306. {
  13307. public:
  13308. SamplerVoice();
  13309. ~SamplerVoice();
  13310. bool canPlaySound (SynthesiserSound* sound);
  13311. void startNote (const int midiNoteNumber,
  13312. const float velocity,
  13313. SynthesiserSound* sound,
  13314. const int currentPitchWheelPosition);
  13315. void stopNote (const bool allowTailOff);
  13316. void pitchWheelMoved (const int newValue);
  13317. void controllerMoved (const int controllerNumber,
  13318. const int newValue);
  13319. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13320. juce_UseDebuggingNewOperator
  13321. private:
  13322. double pitchRatio;
  13323. double sourceSamplePosition;
  13324. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13325. bool isInAttack, isInRelease;
  13326. };
  13327. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13328. /*** End of inlined file: juce_Sampler.h ***/
  13329. #endif
  13330. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13331. #endif
  13332. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13333. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13334. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13335. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13336. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13337. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13338. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13339. class JUCE_API ActionListenerList : public MessageListener
  13340. {
  13341. public:
  13342. ActionListenerList() throw();
  13343. ~ActionListenerList() throw();
  13344. void addActionListener (ActionListener* const listener) throw();
  13345. void removeActionListener (ActionListener* const listener) throw();
  13346. void removeAllActionListeners() throw();
  13347. void sendActionMessage (const String& message) const;
  13348. void handleMessage (const Message&);
  13349. juce_UseDebuggingNewOperator
  13350. private:
  13351. SortedSet <void*> actionListeners_;
  13352. CriticalSection actionListenerLock_;
  13353. ActionListenerList (const ActionListenerList&);
  13354. ActionListenerList& operator= (const ActionListenerList&);
  13355. };
  13356. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13357. /*** End of inlined file: juce_ActionListenerList.h ***/
  13358. class JUCE_API ActionBroadcaster
  13359. {
  13360. public:
  13361. ActionBroadcaster() throw();
  13362. virtual ~ActionBroadcaster();
  13363. void addActionListener (ActionListener* const listener);
  13364. void removeActionListener (ActionListener* const listener);
  13365. void removeAllActionListeners();
  13366. void sendActionMessage (const String& message) const;
  13367. private:
  13368. ActionListenerList actionListenerList;
  13369. ActionBroadcaster (const ActionBroadcaster&);
  13370. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13371. };
  13372. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13373. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13374. #endif
  13375. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13376. #endif
  13377. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13378. #endif
  13379. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13380. #endif
  13381. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13382. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13383. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13384. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13385. class JUCE_API CallbackMessage : public Message
  13386. {
  13387. public:
  13388. CallbackMessage() throw();
  13389. ~CallbackMessage() throw();
  13390. virtual void messageCallback() = 0;
  13391. void post();
  13392. juce_UseDebuggingNewOperator
  13393. private:
  13394. CallbackMessage (const CallbackMessage&);
  13395. CallbackMessage& operator= (const CallbackMessage&);
  13396. };
  13397. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13398. /*** End of inlined file: juce_CallbackMessage.h ***/
  13399. #endif
  13400. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13401. #endif
  13402. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13403. #endif
  13404. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13405. #endif
  13406. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13407. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13408. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13409. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13410. class InterprocessConnectionServer;
  13411. class JUCE_API InterprocessConnection : public Thread,
  13412. private MessageListener
  13413. {
  13414. public:
  13415. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13416. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13417. ~InterprocessConnection();
  13418. bool connectToSocket (const String& hostName,
  13419. const int portNumber,
  13420. const int timeOutMillisecs);
  13421. bool connectToPipe (const String& pipeName,
  13422. const int pipeReceiveMessageTimeoutMs = -1);
  13423. bool createPipe (const String& pipeName,
  13424. const int pipeReceiveMessageTimeoutMs = -1);
  13425. void disconnect();
  13426. bool isConnected() const;
  13427. StreamingSocket* getSocket() const throw() { return socket; }
  13428. NamedPipe* getPipe() const throw() { return pipe; }
  13429. const String getConnectedHostName() const;
  13430. bool sendMessage (const MemoryBlock& message);
  13431. virtual void connectionMade() = 0;
  13432. virtual void connectionLost() = 0;
  13433. virtual void messageReceived (const MemoryBlock& message) = 0;
  13434. juce_UseDebuggingNewOperator
  13435. private:
  13436. CriticalSection pipeAndSocketLock;
  13437. ScopedPointer <StreamingSocket> socket;
  13438. ScopedPointer <NamedPipe> pipe;
  13439. bool callbackConnectionState;
  13440. const bool useMessageThread;
  13441. const uint32 magicMessageHeader;
  13442. int pipeReceiveMessageTimeout;
  13443. friend class InterprocessConnectionServer;
  13444. void initialiseWithSocket (StreamingSocket* const socket_);
  13445. void initialiseWithPipe (NamedPipe* const pipe_);
  13446. void handleMessage (const Message& message);
  13447. void connectionMadeInt();
  13448. void connectionLostInt();
  13449. void deliverDataInt (const MemoryBlock& data);
  13450. bool readNextMessageInt();
  13451. void run();
  13452. InterprocessConnection (const InterprocessConnection&);
  13453. InterprocessConnection& operator= (const InterprocessConnection&);
  13454. };
  13455. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13456. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13457. #endif
  13458. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13459. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13460. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13461. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13462. class JUCE_API InterprocessConnectionServer : private Thread
  13463. {
  13464. public:
  13465. InterprocessConnectionServer();
  13466. ~InterprocessConnectionServer();
  13467. bool beginWaitingForSocket (const int portNumber);
  13468. void stop();
  13469. protected:
  13470. virtual InterprocessConnection* createConnectionObject() = 0;
  13471. public:
  13472. juce_UseDebuggingNewOperator
  13473. private:
  13474. ScopedPointer <StreamingSocket> socket;
  13475. void run();
  13476. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13477. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13478. };
  13479. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13480. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13481. #endif
  13482. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13483. #endif
  13484. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13485. #endif
  13486. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13487. #endif
  13488. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13489. /*** Start of inlined file: juce_MessageManager.h ***/
  13490. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13491. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13492. class Component;
  13493. class MessageManagerLock;
  13494. typedef void* (MessageCallbackFunction) (void* userData);
  13495. class JUCE_API MessageManager
  13496. {
  13497. public:
  13498. static MessageManager* getInstance() throw();
  13499. void runDispatchLoop();
  13500. void stopDispatchLoop();
  13501. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13502. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13503. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13504. void* userData);
  13505. bool isThisTheMessageThread() const throw();
  13506. void setCurrentThreadAsMessageThread();
  13507. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13508. bool currentThreadHasLockedMessageManager() const throw();
  13509. static void broadcastMessage (const String& messageText) throw();
  13510. void registerBroadcastListener (ActionListener* listener) throw();
  13511. void deregisterBroadcastListener (ActionListener* listener) throw();
  13512. void deliverMessage (void*);
  13513. void deliverBroadcastMessage (const String&);
  13514. ~MessageManager() throw();
  13515. juce_UseDebuggingNewOperator
  13516. private:
  13517. MessageManager() throw();
  13518. friend class MessageListener;
  13519. friend class ChangeBroadcaster;
  13520. friend class ActionBroadcaster;
  13521. friend class CallbackMessage;
  13522. static MessageManager* instance;
  13523. SortedSet <const MessageListener*> messageListeners;
  13524. ScopedPointer <ActionListenerList> broadcastListeners;
  13525. friend class JUCEApplication;
  13526. bool quitMessagePosted, quitMessageReceived;
  13527. Thread::ThreadID messageThreadId;
  13528. VoidArray modalComponents;
  13529. static void* exitModalLoopCallback (void*);
  13530. void postMessageToQueue (Message* const message);
  13531. void postCallbackMessage (Message* const message);
  13532. static void doPlatformSpecificInitialisation();
  13533. static void doPlatformSpecificShutdown();
  13534. friend class MessageManagerLock;
  13535. Thread::ThreadID volatile threadWithLock;
  13536. CriticalSection lockingLock;
  13537. MessageManager (const MessageManager&);
  13538. MessageManager& operator= (const MessageManager&);
  13539. };
  13540. class JUCE_API MessageManagerLock
  13541. {
  13542. public:
  13543. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13544. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13545. ~MessageManagerLock() throw();
  13546. bool lockWasGained() const throw() { return locked; }
  13547. private:
  13548. class SharedEvents;
  13549. class BlockingMessage;
  13550. friend class SharedEvents;
  13551. friend class BlockingMessage;
  13552. SharedEvents* sharedEvents;
  13553. bool locked;
  13554. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13555. MessageManagerLock (const MessageManagerLock&);
  13556. MessageManagerLock& operator= (const MessageManagerLock&);
  13557. };
  13558. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13559. /*** End of inlined file: juce_MessageManager.h ***/
  13560. #endif
  13561. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13562. /*** Start of inlined file: juce_MultiTimer.h ***/
  13563. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13564. #define __JUCE_MULTITIMER_JUCEHEADER__
  13565. class JUCE_API MultiTimer
  13566. {
  13567. protected:
  13568. MultiTimer() throw();
  13569. MultiTimer (const MultiTimer& other) throw();
  13570. public:
  13571. virtual ~MultiTimer();
  13572. virtual void timerCallback (const int timerId) = 0;
  13573. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13574. void stopTimer (const int timerId) throw();
  13575. bool isTimerRunning (const int timerId) const throw();
  13576. int getTimerInterval (const int timerId) const throw();
  13577. private:
  13578. class MultiTimerCallback;
  13579. CriticalSection timerListLock;
  13580. OwnedArray <MultiTimerCallback> timers;
  13581. MultiTimer& operator= (const MultiTimer&);
  13582. };
  13583. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13584. /*** End of inlined file: juce_MultiTimer.h ***/
  13585. #endif
  13586. #ifndef __JUCE_TIMER_JUCEHEADER__
  13587. #endif
  13588. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13589. /*** Start of inlined file: juce_ArrowButton.h ***/
  13590. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13591. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13592. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13593. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13594. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13595. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13596. {
  13597. public:
  13598. DropShadowEffect();
  13599. ~DropShadowEffect();
  13600. void setShadowProperties (const float newRadius,
  13601. const float newOpacity,
  13602. const int newShadowOffsetX,
  13603. const int newShadowOffsetY);
  13604. void applyEffect (Image& sourceImage, Graphics& destContext);
  13605. juce_UseDebuggingNewOperator
  13606. private:
  13607. int offsetX, offsetY;
  13608. float radius, opacity;
  13609. };
  13610. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13611. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13612. class JUCE_API ArrowButton : public Button
  13613. {
  13614. public:
  13615. ArrowButton (const String& buttonName,
  13616. float arrowDirection,
  13617. const Colour& arrowColour);
  13618. ~ArrowButton();
  13619. juce_UseDebuggingNewOperator
  13620. protected:
  13621. void paintButton (Graphics& g,
  13622. bool isMouseOverButton,
  13623. bool isButtonDown);
  13624. void buttonStateChanged();
  13625. private:
  13626. Colour colour;
  13627. DropShadowEffect shadow;
  13628. Path path;
  13629. int offset;
  13630. ArrowButton (const ArrowButton&);
  13631. ArrowButton& operator= (const ArrowButton&);
  13632. };
  13633. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13634. /*** End of inlined file: juce_ArrowButton.h ***/
  13635. #endif
  13636. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13637. #endif
  13638. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13639. /*** Start of inlined file: juce_DrawableButton.h ***/
  13640. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13641. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13642. /*** Start of inlined file: juce_Drawable.h ***/
  13643. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13644. #define __JUCE_DRAWABLE_JUCEHEADER__
  13645. class JUCE_API Drawable
  13646. {
  13647. protected:
  13648. Drawable();
  13649. public:
  13650. virtual ~Drawable();
  13651. virtual Drawable* createCopy() const = 0;
  13652. void draw (Graphics& g, const float opacity,
  13653. const AffineTransform& transform = AffineTransform::identity) const;
  13654. void drawAt (Graphics& g,
  13655. const float x,
  13656. const float y,
  13657. const float opacity) const;
  13658. void drawWithin (Graphics& g,
  13659. const int destX,
  13660. const int destY,
  13661. const int destWidth,
  13662. const int destHeight,
  13663. const RectanglePlacement& placement,
  13664. const float opacity) const;
  13665. class RenderingContext
  13666. {
  13667. public:
  13668. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13669. Graphics& g;
  13670. AffineTransform transform;
  13671. float opacity;
  13672. private:
  13673. RenderingContext& operator= (const RenderingContext&);
  13674. };
  13675. virtual void render (const RenderingContext& context) const = 0;
  13676. virtual const Rectangle<float> getBounds() const = 0;
  13677. virtual bool hitTest (float x, float y) const = 0;
  13678. const String& getName() const throw() { return name; }
  13679. void setName (const String& newName) throw() { name = newName; }
  13680. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13681. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13682. static Drawable* createFromImageFile (const File& file);
  13683. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13684. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13685. virtual ValueTree createValueTree() const throw() = 0;
  13686. juce_UseDebuggingNewOperator
  13687. private:
  13688. Drawable (const Drawable&);
  13689. Drawable& operator= (const Drawable&);
  13690. String name;
  13691. };
  13692. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13693. /*** End of inlined file: juce_Drawable.h ***/
  13694. class JUCE_API DrawableButton : public Button
  13695. {
  13696. public:
  13697. enum ButtonStyle
  13698. {
  13699. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13700. ImageRaw, /**< The button will just display the images in their normal size and position.
  13701. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13702. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13703. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13704. };
  13705. DrawableButton (const String& buttonName,
  13706. const ButtonStyle buttonStyle);
  13707. ~DrawableButton();
  13708. void setImages (const Drawable* normalImage,
  13709. const Drawable* overImage = 0,
  13710. const Drawable* downImage = 0,
  13711. const Drawable* disabledImage = 0,
  13712. const Drawable* normalImageOn = 0,
  13713. const Drawable* overImageOn = 0,
  13714. const Drawable* downImageOn = 0,
  13715. const Drawable* disabledImageOn = 0);
  13716. void setButtonStyle (const ButtonStyle newStyle);
  13717. void setBackgroundColours (const Colour& toggledOffColour,
  13718. const Colour& toggledOnColour);
  13719. const Colour& getBackgroundColour() const throw();
  13720. void setEdgeIndent (const int numPixelsIndent);
  13721. const Drawable* getCurrentImage() const throw();
  13722. const Drawable* getNormalImage() const throw();
  13723. const Drawable* getOverImage() const throw();
  13724. const Drawable* getDownImage() const throw();
  13725. juce_UseDebuggingNewOperator
  13726. protected:
  13727. void paintButton (Graphics& g,
  13728. bool isMouseOverButton,
  13729. bool isButtonDown);
  13730. private:
  13731. ButtonStyle style;
  13732. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13733. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13734. Colour backgroundOff, backgroundOn;
  13735. int edgeIndent;
  13736. void deleteImages();
  13737. DrawableButton (const DrawableButton&);
  13738. DrawableButton& operator= (const DrawableButton&);
  13739. };
  13740. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13741. /*** End of inlined file: juce_DrawableButton.h ***/
  13742. #endif
  13743. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13744. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13745. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13746. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13747. class JUCE_API HyperlinkButton : public Button
  13748. {
  13749. public:
  13750. HyperlinkButton (const String& linkText,
  13751. const URL& linkURL);
  13752. ~HyperlinkButton();
  13753. void setFont (const Font& newFont,
  13754. const bool resizeToMatchComponentHeight,
  13755. const Justification& justificationType = Justification::horizontallyCentred);
  13756. enum ColourIds
  13757. {
  13758. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13759. };
  13760. void setURL (const URL& newURL) throw();
  13761. const URL& getURL() const throw() { return url; }
  13762. void changeWidthToFitText();
  13763. juce_UseDebuggingNewOperator
  13764. protected:
  13765. void clicked();
  13766. void colourChanged();
  13767. void paintButton (Graphics& g,
  13768. bool isMouseOverButton,
  13769. bool isButtonDown);
  13770. private:
  13771. URL url;
  13772. Font font;
  13773. bool resizeFont;
  13774. Justification justification;
  13775. const Font getFontToUse() const;
  13776. HyperlinkButton (const HyperlinkButton&);
  13777. HyperlinkButton& operator= (const HyperlinkButton&);
  13778. };
  13779. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13780. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13781. #endif
  13782. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13783. /*** Start of inlined file: juce_ImageButton.h ***/
  13784. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13785. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13786. class JUCE_API ImageButton : public Button
  13787. {
  13788. public:
  13789. ImageButton (const String& name);
  13790. ~ImageButton();
  13791. void setImages (const bool resizeButtonNowToFitThisImage,
  13792. const bool rescaleImagesWhenButtonSizeChanges,
  13793. const bool preserveImageProportions,
  13794. Image* const normalImage,
  13795. const float imageOpacityWhenNormal,
  13796. const Colour& overlayColourWhenNormal,
  13797. Image* const overImage,
  13798. const float imageOpacityWhenOver,
  13799. const Colour& overlayColourWhenOver,
  13800. Image* const downImage,
  13801. const float imageOpacityWhenDown,
  13802. const Colour& overlayColourWhenDown,
  13803. const float hitTestAlphaThreshold = 0.0f);
  13804. Image* getNormalImage() const throw();
  13805. Image* getOverImage() const throw();
  13806. Image* getDownImage() const throw();
  13807. juce_UseDebuggingNewOperator
  13808. protected:
  13809. bool hitTest (int x, int y);
  13810. void paintButton (Graphics& g,
  13811. bool isMouseOverButton,
  13812. bool isButtonDown);
  13813. private:
  13814. bool scaleImageToFit, preserveProportions;
  13815. unsigned char alphaThreshold;
  13816. int imageX, imageY, imageW, imageH;
  13817. Image* normalImage;
  13818. Image* overImage;
  13819. Image* downImage;
  13820. float normalOpacity, overOpacity, downOpacity;
  13821. Colour normalOverlay, overOverlay, downOverlay;
  13822. Image* getCurrentImage() const;
  13823. void deleteImages();
  13824. ImageButton (const ImageButton&);
  13825. ImageButton& operator= (const ImageButton&);
  13826. };
  13827. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13828. /*** End of inlined file: juce_ImageButton.h ***/
  13829. #endif
  13830. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13831. /*** Start of inlined file: juce_ShapeButton.h ***/
  13832. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13833. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13834. class JUCE_API ShapeButton : public Button
  13835. {
  13836. public:
  13837. ShapeButton (const String& name,
  13838. const Colour& normalColour,
  13839. const Colour& overColour,
  13840. const Colour& downColour);
  13841. ~ShapeButton();
  13842. void setShape (const Path& newShape,
  13843. const bool resizeNowToFitThisShape,
  13844. const bool maintainShapeProportions,
  13845. const bool hasDropShadow);
  13846. void setColours (const Colour& normalColour,
  13847. const Colour& overColour,
  13848. const Colour& downColour);
  13849. void setOutline (const Colour& outlineColour,
  13850. const float outlineStrokeWidth);
  13851. juce_UseDebuggingNewOperator
  13852. protected:
  13853. void paintButton (Graphics& g,
  13854. bool isMouseOverButton,
  13855. bool isButtonDown);
  13856. private:
  13857. Colour normalColour, overColour, downColour, outlineColour;
  13858. DropShadowEffect shadow;
  13859. Path shape;
  13860. bool maintainShapeProportions;
  13861. float outlineWidth;
  13862. ShapeButton (const ShapeButton&);
  13863. ShapeButton& operator= (const ShapeButton&);
  13864. };
  13865. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13866. /*** End of inlined file: juce_ShapeButton.h ***/
  13867. #endif
  13868. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13869. #endif
  13870. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13871. /*** Start of inlined file: juce_ToggleButton.h ***/
  13872. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13873. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13874. class JUCE_API ToggleButton : public Button
  13875. {
  13876. public:
  13877. ToggleButton (const String& buttonText);
  13878. ~ToggleButton();
  13879. void changeWidthToFitText();
  13880. enum ColourIds
  13881. {
  13882. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13883. };
  13884. juce_UseDebuggingNewOperator
  13885. protected:
  13886. void paintButton (Graphics& g,
  13887. bool isMouseOverButton,
  13888. bool isButtonDown);
  13889. void colourChanged();
  13890. private:
  13891. ToggleButton (const ToggleButton&);
  13892. ToggleButton& operator= (const ToggleButton&);
  13893. };
  13894. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13895. /*** End of inlined file: juce_ToggleButton.h ***/
  13896. #endif
  13897. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13898. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13899. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13900. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13901. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13902. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13903. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13904. /*** Start of inlined file: juce_Toolbar.h ***/
  13905. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13906. #define __JUCE_TOOLBAR_JUCEHEADER__
  13907. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13908. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13909. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13910. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13911. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13912. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13913. class JUCE_API DragAndDropTarget
  13914. {
  13915. public:
  13916. virtual ~DragAndDropTarget() {}
  13917. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13918. Component* sourceComponent) = 0;
  13919. virtual void itemDragEnter (const String& sourceDescription,
  13920. Component* sourceComponent,
  13921. int x,
  13922. int y);
  13923. virtual void itemDragMove (const String& sourceDescription,
  13924. Component* sourceComponent,
  13925. int x,
  13926. int y);
  13927. virtual void itemDragExit (const String& sourceDescription,
  13928. Component* sourceComponent);
  13929. virtual void itemDropped (const String& sourceDescription,
  13930. Component* sourceComponent,
  13931. int x,
  13932. int y) = 0;
  13933. virtual bool shouldDrawDragImageWhenOver();
  13934. };
  13935. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13936. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13937. class JUCE_API DragAndDropContainer
  13938. {
  13939. public:
  13940. DragAndDropContainer();
  13941. virtual ~DragAndDropContainer();
  13942. void startDragging (const String& sourceDescription,
  13943. Component* sourceComponent,
  13944. Image* dragImage = 0,
  13945. const bool allowDraggingToOtherJuceWindows = false,
  13946. const Point<int>* imageOffsetFromMouse = 0);
  13947. bool isDragAndDropActive() const;
  13948. const String getCurrentDragDescription() const;
  13949. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13950. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  13951. static bool performExternalDragDropOfText (const String& text);
  13952. juce_UseDebuggingNewOperator
  13953. protected:
  13954. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13955. Component* dragSourceComponent,
  13956. StringArray& files,
  13957. bool& canMoveFiles);
  13958. private:
  13959. friend class DragImageComponent;
  13960. ScopedPointer <Component> dragImageComponent;
  13961. String currentDragDesc;
  13962. };
  13963. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13964. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  13965. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  13966. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13967. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13968. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13969. private Timer
  13970. {
  13971. public:
  13972. ComponentAnimator();
  13973. ~ComponentAnimator();
  13974. void animateComponent (Component* const component,
  13975. const Rectangle<int>& finalPosition,
  13976. const int millisecondsToSpendMoving,
  13977. const double startSpeed = 1.0,
  13978. const double endSpeed = 1.0);
  13979. void cancelAnimation (Component* const component,
  13980. const bool moveComponentToItsFinalPosition);
  13981. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13982. const Rectangle<int> getComponentDestination (Component* const component);
  13983. bool isAnimating (Component* component) const;
  13984. juce_UseDebuggingNewOperator
  13985. private:
  13986. VoidArray tasks;
  13987. uint32 lastTime;
  13988. void* findTaskFor (Component* const component) const;
  13989. void timerCallback();
  13990. };
  13991. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13992. /*** End of inlined file: juce_ComponentAnimator.h ***/
  13993. class ToolbarItemComponent;
  13994. class ToolbarItemFactory;
  13995. class MissingItemsComponent;
  13996. class JUCE_API Toolbar : public Component,
  13997. public DragAndDropContainer,
  13998. public DragAndDropTarget,
  13999. private ButtonListener
  14000. {
  14001. public:
  14002. Toolbar();
  14003. ~Toolbar();
  14004. void setVertical (const bool shouldBeVertical);
  14005. bool isVertical() const throw() { return vertical; }
  14006. int getThickness() const throw();
  14007. int getLength() const throw();
  14008. void clear();
  14009. void addItem (ToolbarItemFactory& factory,
  14010. const int itemId,
  14011. const int insertIndex = -1);
  14012. void removeToolbarItem (const int itemIndex);
  14013. int getNumItems() const throw();
  14014. int getItemId (const int itemIndex) const throw();
  14015. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  14016. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14017. enum ToolbarItemStyle
  14018. {
  14019. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14020. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14021. textOnly /**< Means that the toolbar only display text labels for each item. */
  14022. };
  14023. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14024. void setStyle (const ToolbarItemStyle& newStyle);
  14025. enum CustomisationFlags
  14026. {
  14027. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14028. show the "icons only" option on its choice of toolbar styles. */
  14029. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14030. show the "icons with text" option on its choice of toolbar styles. */
  14031. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14032. show the "text only" option on its choice of toolbar styles. */
  14033. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14034. show a button to reset the toolbar to its default set of items. */
  14035. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14036. };
  14037. void showCustomisationDialog (ToolbarItemFactory& factory,
  14038. const int optionFlags = allCustomisationOptionsEnabled);
  14039. void setEditingActive (const bool editingEnabled);
  14040. enum ColourIds
  14041. {
  14042. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14043. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14044. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14045. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14046. over them. */
  14047. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14048. held down on them. */
  14049. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14050. when the style is set to iconsWithText or textOnly. */
  14051. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14052. the customisation dialog is active and the mouse moves over them. */
  14053. };
  14054. const String toString() const;
  14055. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14056. const String& savedVersion);
  14057. void paint (Graphics& g);
  14058. void resized();
  14059. void buttonClicked (Button*);
  14060. void mouseDown (const MouseEvent&);
  14061. bool isInterestedInDragSource (const String&, Component*);
  14062. void itemDragMove (const String&, Component*, int, int);
  14063. void itemDragExit (const String&, Component*);
  14064. void itemDropped (const String&, Component*, int, int);
  14065. void updateAllItemPositions (const bool animate);
  14066. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14067. juce_UseDebuggingNewOperator
  14068. private:
  14069. Button* missingItemsButton;
  14070. bool vertical, isEditingActive;
  14071. ToolbarItemStyle toolbarStyle;
  14072. ComponentAnimator animator;
  14073. friend class MissingItemsComponent;
  14074. Array <ToolbarItemComponent*> items;
  14075. friend class ItemDragAndDropOverlayComponent;
  14076. static const tchar* const toolbarDragDescriptor;
  14077. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14078. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14079. Toolbar (const Toolbar&);
  14080. Toolbar& operator= (const Toolbar&);
  14081. };
  14082. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14083. /*** End of inlined file: juce_Toolbar.h ***/
  14084. class ItemDragAndDropOverlayComponent;
  14085. class JUCE_API ToolbarItemComponent : public Button
  14086. {
  14087. public:
  14088. ToolbarItemComponent (const int itemId,
  14089. const String& labelText,
  14090. const bool isBeingUsedAsAButton);
  14091. ~ToolbarItemComponent();
  14092. int getItemId() const throw() { return itemId; }
  14093. Toolbar* getToolbar() const;
  14094. bool isToolbarVertical() const;
  14095. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14096. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14097. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14098. virtual bool getToolbarItemSizes (int toolbarThickness,
  14099. bool isToolbarVertical,
  14100. int& preferredSize,
  14101. int& minSize,
  14102. int& maxSize) = 0;
  14103. virtual void paintButtonArea (Graphics& g,
  14104. int width, int height,
  14105. bool isMouseOver, bool isMouseDown) = 0;
  14106. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14107. enum ToolbarEditingMode
  14108. {
  14109. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14110. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14111. customisation mode, and the items can be dragged around. */
  14112. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14113. dragged onto a toolbar to add it to that bar.*/
  14114. };
  14115. void setEditingMode (const ToolbarEditingMode newMode);
  14116. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14117. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14118. void resized();
  14119. juce_UseDebuggingNewOperator
  14120. private:
  14121. friend class Toolbar;
  14122. friend class ItemDragAndDropOverlayComponent;
  14123. const int itemId;
  14124. ToolbarEditingMode mode;
  14125. Toolbar::ToolbarItemStyle toolbarStyle;
  14126. ScopedPointer <Component> overlayComp;
  14127. int dragOffsetX, dragOffsetY;
  14128. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14129. Rectangle<int> contentArea;
  14130. ToolbarItemComponent (const ToolbarItemComponent&);
  14131. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14132. };
  14133. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14134. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14135. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14136. {
  14137. public:
  14138. ToolbarButton (const int itemId,
  14139. const String& labelText,
  14140. Drawable* const normalImage,
  14141. Drawable* const toggledOnImage);
  14142. ~ToolbarButton();
  14143. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14144. int& minSize, int& maxSize);
  14145. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14146. void contentAreaChanged (const Rectangle<int>& newBounds);
  14147. juce_UseDebuggingNewOperator
  14148. private:
  14149. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14150. ToolbarButton (const ToolbarButton&);
  14151. ToolbarButton& operator= (const ToolbarButton&);
  14152. };
  14153. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14154. /*** End of inlined file: juce_ToolbarButton.h ***/
  14155. #endif
  14156. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14157. /*** Start of inlined file: juce_CodeDocument.h ***/
  14158. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14159. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14160. class CodeDocumentLine;
  14161. class JUCE_API CodeDocument
  14162. {
  14163. public:
  14164. CodeDocument();
  14165. ~CodeDocument();
  14166. class JUCE_API Position
  14167. {
  14168. public:
  14169. Position() throw();
  14170. Position (const CodeDocument* const ownerDocument,
  14171. const int line, const int indexInLine) throw();
  14172. Position (const CodeDocument* const ownerDocument,
  14173. const int charactersFromStartOfDocument) throw();
  14174. Position (const Position& other) throw();
  14175. ~Position() throw();
  14176. Position& operator= (const Position& other) throw();
  14177. bool operator== (const Position& other) const throw();
  14178. bool operator!= (const Position& other) const throw();
  14179. void setPosition (const int charactersFromStartOfDocument) throw();
  14180. int getPosition() const throw() { return characterPos; }
  14181. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14182. int getLineNumber() const throw() { return line; }
  14183. int getIndexInLine() const throw() { return indexInLine; }
  14184. void setPositionMaintained (const bool isMaintained) throw();
  14185. void moveBy (int characterDelta) throw();
  14186. const Position movedBy (const int characterDelta) const throw();
  14187. const Position movedByLines (const int deltaLines) const throw();
  14188. const tchar getCharacter() const throw();
  14189. const String getLineText() const throw();
  14190. private:
  14191. CodeDocument* owner;
  14192. int characterPos, line, indexInLine;
  14193. bool positionMaintained;
  14194. };
  14195. const String getAllContent() const throw();
  14196. const String getTextBetween (const Position& start, const Position& end) const throw();
  14197. const String getLine (const int lineIndex) const throw();
  14198. int getNumCharacters() const throw();
  14199. int getNumLines() const throw() { return lines.size(); }
  14200. int getMaximumLineLength() throw();
  14201. void deleteSection (const Position& startPosition, const Position& endPosition);
  14202. void insertText (const Position& position, const String& text);
  14203. void replaceAllContent (const String& newContent);
  14204. bool loadFromStream (InputStream& stream);
  14205. bool writeToStream (OutputStream& stream);
  14206. const String getNewLineCharacters() const throw() { return newLineChars; }
  14207. void setNewLineCharacters (const String& newLine) throw();
  14208. void newTransaction();
  14209. void undo();
  14210. void redo();
  14211. void clearUndoHistory();
  14212. UndoManager& getUndoManager() throw() { return undoManager; }
  14213. void setSavePoint() throw();
  14214. bool hasChangedSinceSavePoint() const throw();
  14215. const Position findWordBreakAfter (const Position& position) const throw();
  14216. const Position findWordBreakBefore (const Position& position) const throw();
  14217. class JUCE_API Listener
  14218. {
  14219. public:
  14220. Listener() {}
  14221. virtual ~Listener() {}
  14222. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14223. const Position& affectedTextEnd) = 0;
  14224. };
  14225. void addListener (Listener* const listener) throw();
  14226. void removeListener (Listener* const listener) throw();
  14227. class Iterator
  14228. {
  14229. public:
  14230. Iterator (CodeDocument* const document);
  14231. Iterator (const Iterator& other);
  14232. Iterator& operator= (const Iterator& other) throw();
  14233. ~Iterator() throw();
  14234. juce_wchar nextChar();
  14235. juce_wchar peekNextChar() const;
  14236. void skip();
  14237. int getPosition() const throw() { return position; }
  14238. void skipWhitespace();
  14239. void skipToEndOfLine();
  14240. int getLine() const throw() { return line; }
  14241. bool isEOF() const throw();
  14242. private:
  14243. CodeDocument* document;
  14244. CodeDocumentLine* currentLine;
  14245. int line, position;
  14246. };
  14247. juce_UseDebuggingNewOperator
  14248. private:
  14249. friend class CodeDocumentInsertAction;
  14250. friend class CodeDocumentDeleteAction;
  14251. friend class Iterator;
  14252. friend class Position;
  14253. OwnedArray <CodeDocumentLine> lines;
  14254. Array <Position*> positionsToMaintain;
  14255. UndoManager undoManager;
  14256. int currentActionIndex, indexOfSavedState;
  14257. int maximumLineLength;
  14258. VoidArray listeners;
  14259. String newLineChars;
  14260. void sendListenerChangeMessage (const int startLine, const int endLine);
  14261. void insert (const String& text, const int insertPos, const bool undoable);
  14262. void remove (const int startPos, const int endPos, const bool undoable);
  14263. void checkLastLineStatus();
  14264. CodeDocument (const CodeDocument&);
  14265. CodeDocument& operator= (const CodeDocument&);
  14266. };
  14267. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14268. /*** End of inlined file: juce_CodeDocument.h ***/
  14269. #endif
  14270. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14271. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14272. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14273. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14274. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14275. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14276. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14277. class JUCE_API CodeTokeniser
  14278. {
  14279. public:
  14280. CodeTokeniser() {}
  14281. virtual ~CodeTokeniser() {}
  14282. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14283. virtual const StringArray getTokenTypes() = 0;
  14284. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14285. juce_UseDebuggingNewOperator
  14286. };
  14287. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14288. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14289. class JUCE_API CodeEditorComponent : public Component,
  14290. public TextInputTarget,
  14291. public Timer,
  14292. public ScrollBarListener,
  14293. public CodeDocument::Listener,
  14294. public AsyncUpdater
  14295. {
  14296. public:
  14297. CodeEditorComponent (CodeDocument& document,
  14298. CodeTokeniser* const codeTokeniser);
  14299. ~CodeEditorComponent();
  14300. CodeDocument& getDocument() const throw() { return document; }
  14301. void loadContent (const String& newContent);
  14302. float getCharWidth() const throw() { return charWidth; }
  14303. int getLineHeight() const throw() { return lineHeight; }
  14304. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14305. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14306. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14307. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14308. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14309. const CodeDocument::Position getPositionAt (int x, int y);
  14310. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14311. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14312. void cursorDown (const bool selecting);
  14313. void cursorUp (const bool selecting);
  14314. void pageDown (const bool selecting);
  14315. void pageUp (const bool selecting);
  14316. void scrollDown();
  14317. void scrollUp();
  14318. void scrollToLine (int newFirstLineOnScreen);
  14319. void scrollBy (int deltaLines);
  14320. void scrollToColumn (int newFirstColumnOnScreen);
  14321. void scrollToKeepCaretOnScreen();
  14322. void goToStartOfDocument (const bool selecting);
  14323. void goToStartOfLine (const bool selecting);
  14324. void goToEndOfDocument (const bool selecting);
  14325. void goToEndOfLine (const bool selecting);
  14326. void deselectAll();
  14327. void selectAll();
  14328. void insertTextAtCaret (const String& textToInsert);
  14329. void insertTabAtCaret();
  14330. void cut();
  14331. void copy();
  14332. void copyThenCut();
  14333. void paste();
  14334. void backspace (const bool moveInWholeWordSteps);
  14335. void deleteForward (const bool moveInWholeWordSteps);
  14336. void undo();
  14337. void redo();
  14338. const Range<int> getHighlightedRegion() const;
  14339. void setHighlightedRegion (const Range<int>& newRange);
  14340. const String getTextInRange (const Range<int>& range) const;
  14341. void setTabSize (const int numSpacesPerTab,
  14342. const bool insertSpacesInsteadOfTabCharacters) throw();
  14343. int getTabSize() const throw() { return spacesPerTab; }
  14344. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14345. void setFont (const Font& newFont);
  14346. void resetToDefaultColours();
  14347. void setColourForTokenType (const int tokenType, const Colour& colour);
  14348. const Colour getColourForTokenType (const int tokenType) const throw();
  14349. enum ColourIds
  14350. {
  14351. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14352. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14353. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14354. selected text. */
  14355. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14356. enabled. */
  14357. };
  14358. void setScrollbarThickness (const int thickness) throw();
  14359. void resized();
  14360. void paint (Graphics& g);
  14361. bool keyPressed (const KeyPress& key);
  14362. void mouseDown (const MouseEvent& e);
  14363. void mouseDrag (const MouseEvent& e);
  14364. void mouseUp (const MouseEvent& e);
  14365. void mouseDoubleClick (const MouseEvent& e);
  14366. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14367. void timerCallback();
  14368. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14369. void handleAsyncUpdate();
  14370. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14371. const CodeDocument::Position& affectedTextEnd);
  14372. juce_UseDebuggingNewOperator
  14373. private:
  14374. CodeDocument& document;
  14375. Font font;
  14376. int firstLineOnScreen, gutter, spacesPerTab;
  14377. float charWidth;
  14378. int lineHeight, linesOnScreen, columnsOnScreen;
  14379. int scrollbarThickness, columnToTryToMaintain;
  14380. bool useSpacesForTabs;
  14381. double xOffset;
  14382. CodeDocument::Position caretPos;
  14383. CodeDocument::Position selectionStart, selectionEnd;
  14384. Component* caret;
  14385. ScrollBar* verticalScrollBar;
  14386. ScrollBar* horizontalScrollBar;
  14387. enum DragType
  14388. {
  14389. notDragging,
  14390. draggingSelectionStart,
  14391. draggingSelectionEnd
  14392. };
  14393. DragType dragType;
  14394. CodeTokeniser* codeTokeniser;
  14395. Array <Colour> coloursForTokenCategories;
  14396. class CodeEditorLine;
  14397. OwnedArray <CodeEditorLine> lines;
  14398. void rebuildLineTokens();
  14399. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14400. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14401. void updateCachedIterators (int maxLineNum);
  14402. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14403. void moveLineDelta (const int delta, const bool selecting);
  14404. void updateScrollBars();
  14405. void scrollToLineInternal (int line);
  14406. void scrollToColumnInternal (double column);
  14407. void newTransaction();
  14408. int indexToColumn (int line, int index) const throw();
  14409. int columnToIndex (int line, int column) const throw();
  14410. CodeEditorComponent (const CodeEditorComponent&);
  14411. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14412. };
  14413. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14414. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14415. #endif
  14416. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14417. #endif
  14418. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14419. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14420. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14421. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14422. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14423. {
  14424. public:
  14425. CPlusPlusCodeTokeniser();
  14426. ~CPlusPlusCodeTokeniser();
  14427. enum TokenType
  14428. {
  14429. tokenType_error = 0,
  14430. tokenType_comment,
  14431. tokenType_builtInKeyword,
  14432. tokenType_identifier,
  14433. tokenType_integerLiteral,
  14434. tokenType_floatLiteral,
  14435. tokenType_stringLiteral,
  14436. tokenType_operator,
  14437. tokenType_bracket,
  14438. tokenType_punctuation,
  14439. tokenType_preprocessor
  14440. };
  14441. int readNextToken (CodeDocument::Iterator& source);
  14442. const StringArray getTokenTypes();
  14443. const Colour getDefaultColour (const int tokenType);
  14444. juce_UseDebuggingNewOperator
  14445. };
  14446. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14447. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14448. #endif
  14449. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14450. #endif
  14451. #ifndef __JUCE_LABEL_JUCEHEADER__
  14452. #endif
  14453. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14454. #endif
  14455. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14456. /*** Start of inlined file: juce_ProgressBar.h ***/
  14457. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14458. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14459. class JUCE_API ProgressBar : public Component,
  14460. public SettableTooltipClient,
  14461. private Timer
  14462. {
  14463. public:
  14464. ProgressBar (double& progress);
  14465. ~ProgressBar();
  14466. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14467. void setTextToDisplay (const String& text);
  14468. enum ColourIds
  14469. {
  14470. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14471. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14472. classes will probably use variations on this colour. */
  14473. };
  14474. juce_UseDebuggingNewOperator
  14475. protected:
  14476. void paint (Graphics& g);
  14477. void lookAndFeelChanged();
  14478. void visibilityChanged();
  14479. void colourChanged();
  14480. private:
  14481. double& progress;
  14482. double currentValue;
  14483. bool displayPercentage;
  14484. String displayedMessage, currentMessage;
  14485. uint32 lastCallbackTime;
  14486. void timerCallback();
  14487. ProgressBar (const ProgressBar&);
  14488. ProgressBar& operator= (const ProgressBar&);
  14489. };
  14490. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14491. /*** End of inlined file: juce_ProgressBar.h ***/
  14492. #endif
  14493. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14494. /*** Start of inlined file: juce_Slider.h ***/
  14495. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14496. #define __JUCE_SLIDER_JUCEHEADER__
  14497. /*** Start of inlined file: juce_SliderListener.h ***/
  14498. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14499. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14500. class Slider;
  14501. class JUCE_API SliderListener
  14502. {
  14503. public:
  14504. virtual ~SliderListener() {}
  14505. virtual void sliderValueChanged (Slider* slider) = 0;
  14506. virtual void sliderDragStarted (Slider* slider);
  14507. virtual void sliderDragEnded (Slider* slider);
  14508. };
  14509. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14510. /*** End of inlined file: juce_SliderListener.h ***/
  14511. class JUCE_API Slider : public Component,
  14512. public SettableTooltipClient,
  14513. private AsyncUpdater,
  14514. private ButtonListener,
  14515. private LabelListener,
  14516. private Value::Listener
  14517. {
  14518. public:
  14519. Slider (const String& componentName);
  14520. ~Slider();
  14521. enum SliderStyle
  14522. {
  14523. LinearHorizontal, /**< A traditional horizontal slider. */
  14524. LinearVertical, /**< A traditional vertical slider. */
  14525. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14526. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14527. @see setRotaryParameters */
  14528. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14529. @see setRotaryParameters */
  14530. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14531. @see setRotaryParameters */
  14532. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14533. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14534. @see setMinValue, setMaxValue */
  14535. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14536. @see setMinValue, setMaxValue */
  14537. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14538. value, with the current value being somewhere between them.
  14539. @see setMinValue, setMaxValue */
  14540. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14541. value, with the current value being somewhere between them.
  14542. @see setMinValue, setMaxValue */
  14543. };
  14544. void setSliderStyle (const SliderStyle newStyle);
  14545. SliderStyle getSliderStyle() const { return style; }
  14546. void setRotaryParameters (const float startAngleRadians,
  14547. const float endAngleRadians,
  14548. const bool stopAtEnd);
  14549. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14550. void setVelocityBasedMode (const bool isVelocityBased);
  14551. bool getVelocityBasedMode() const { return isVelocityBased; }
  14552. void setVelocityModeParameters (const double sensitivity = 1.0,
  14553. const int threshold = 1,
  14554. const double offset = 0.0,
  14555. const bool userCanPressKeyToSwapMode = true);
  14556. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14557. int getVelocityThreshold() const { return velocityModeThreshold; }
  14558. double getVelocityOffset() const { return velocityModeOffset; }
  14559. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14560. void setSkewFactor (const double factor);
  14561. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14562. double getSkewFactor() const { return skewFactor; }
  14563. enum IncDecButtonMode
  14564. {
  14565. incDecButtonsNotDraggable,
  14566. incDecButtonsDraggable_AutoDirection,
  14567. incDecButtonsDraggable_Horizontal,
  14568. incDecButtonsDraggable_Vertical
  14569. };
  14570. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14571. enum TextEntryBoxPosition
  14572. {
  14573. NoTextBox, /**< Doesn't display a text box. */
  14574. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14575. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14576. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14577. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14578. };
  14579. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14580. const bool isReadOnly,
  14581. const int textEntryBoxWidth,
  14582. const int textEntryBoxHeight);
  14583. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14584. int getTextBoxWidth() const { return textBoxWidth; }
  14585. int getTextBoxHeight() const { return textBoxHeight; }
  14586. void setTextBoxIsEditable (const bool shouldBeEditable);
  14587. bool isTextBoxEditable() const { return editableText; }
  14588. void showTextBox();
  14589. void hideTextBox (const bool discardCurrentEditorContents);
  14590. void setValue (double newValue,
  14591. const bool sendUpdateMessage = true,
  14592. const bool sendMessageSynchronously = false);
  14593. double getValue() const;
  14594. Value& getValueObject() { return currentValue; }
  14595. void setRange (const double newMinimum,
  14596. const double newMaximum,
  14597. const double newInterval = 0);
  14598. double getMaximum() const { return maximum; }
  14599. double getMinimum() const { return minimum; }
  14600. double getInterval() const { return interval; }
  14601. double getMinValue() const;
  14602. Value& getMinValueObject() { return valueMin; }
  14603. void setMinValue (double newValue,
  14604. const bool sendUpdateMessage = true,
  14605. const bool sendMessageSynchronously = false,
  14606. const bool allowNudgingOfOtherValues = false);
  14607. double getMaxValue() const;
  14608. Value& getMaxValueObject() { return valueMax; }
  14609. void setMaxValue (double newValue,
  14610. const bool sendUpdateMessage = true,
  14611. const bool sendMessageSynchronously = false,
  14612. const bool allowNudgingOfOtherValues = false);
  14613. void addListener (SliderListener* const listener);
  14614. void removeListener (SliderListener* const listener);
  14615. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14616. const double valueToSetOnDoubleClick);
  14617. double getDoubleClickReturnValue (bool& isEnabled) const;
  14618. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14619. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14620. void setPopupDisplayEnabled (const bool isEnabled,
  14621. Component* const parentComponentToUse);
  14622. void setPopupMenuEnabled (const bool menuEnabled);
  14623. void setScrollWheelEnabled (const bool enabled);
  14624. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14625. virtual void startedDragging();
  14626. virtual void stoppedDragging();
  14627. virtual void valueChanged();
  14628. /** Callback to indicate that the user has just moved the slider.
  14629. Note - the valueChanged() method has changed its format and now no longer has
  14630. any parameters. Update your code to use the new version.
  14631. This version has been left here with an int as its return value to cause
  14632. a syntax error if you've got existing code that uses the old version.
  14633. */
  14634. virtual int valueChanged (double) { jassertfalse; return 0; }
  14635. virtual double getValueFromText (const String& text);
  14636. virtual const String getTextFromValue (double value);
  14637. void setTextValueSuffix (const String& suffix);
  14638. virtual double proportionOfLengthToValue (double proportion);
  14639. virtual double valueToProportionOfLength (double value);
  14640. float getPositionOfValue (const double value);
  14641. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14642. void updateText();
  14643. bool isHorizontal() const;
  14644. bool isVertical() const;
  14645. enum ColourIds
  14646. {
  14647. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14648. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14649. and feel class how this is used. */
  14650. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14651. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14652. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14653. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14654. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14655. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14656. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14657. };
  14658. juce_UseDebuggingNewOperator
  14659. protected:
  14660. void labelTextChanged (Label*);
  14661. void paint (Graphics& g);
  14662. void resized();
  14663. void mouseDown (const MouseEvent& e);
  14664. void mouseUp (const MouseEvent& e);
  14665. void mouseDrag (const MouseEvent& e);
  14666. void mouseDoubleClick (const MouseEvent& e);
  14667. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14668. void modifierKeysChanged (const ModifierKeys& modifiers);
  14669. void buttonClicked (Button* button);
  14670. void lookAndFeelChanged();
  14671. void enablementChanged();
  14672. void focusOfChildComponentChanged (FocusChangeType cause);
  14673. void handleAsyncUpdate();
  14674. void colourChanged();
  14675. void valueChanged (Value& value);
  14676. private:
  14677. ListenerList <SliderListener> listeners;
  14678. Value currentValue, valueMin, valueMax;
  14679. double lastCurrentValue, lastValueMin, lastValueMax;
  14680. double minimum, maximum, interval, doubleClickReturnValue;
  14681. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14682. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14683. int velocityModeThreshold;
  14684. float rotaryStart, rotaryEnd;
  14685. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14686. int mouseDragStartX, mouseDragStartY;
  14687. int sliderRegionStart, sliderRegionSize;
  14688. int sliderBeingDragged;
  14689. int pixelsForFullDragExtent;
  14690. Rectangle<int> sliderRect;
  14691. String textSuffix;
  14692. SliderStyle style;
  14693. TextEntryBoxPosition textBoxPos;
  14694. int textBoxWidth, textBoxHeight;
  14695. IncDecButtonMode incDecButtonMode;
  14696. bool editableText : 1, doubleClickToValue : 1;
  14697. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14698. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14699. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14700. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14701. Font font;
  14702. Label* valueBox;
  14703. Button* incButton;
  14704. Button* decButton;
  14705. ScopedPointer <Component> popupDisplay;
  14706. Component* parentForPopupDisplay;
  14707. float getLinearSliderPos (const double value);
  14708. void restoreMouseIfHidden();
  14709. void sendDragStart();
  14710. void sendDragEnd();
  14711. double constrainedValue (double value) const;
  14712. void triggerChangeMessage (const bool synchronous);
  14713. bool incDecDragDirectionIsHorizontal() const;
  14714. Slider (const Slider&);
  14715. Slider& operator= (const Slider&);
  14716. };
  14717. #endif // __JUCE_SLIDER_JUCEHEADER__
  14718. /*** End of inlined file: juce_Slider.h ***/
  14719. #endif
  14720. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14721. #endif
  14722. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14723. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14724. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14725. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14726. class TableHeaderComponent;
  14727. class JUCE_API TableHeaderListener
  14728. {
  14729. public:
  14730. TableHeaderListener() {}
  14731. virtual ~TableHeaderListener() {}
  14732. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14733. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14734. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14735. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14736. int columnIdNowBeingDragged);
  14737. };
  14738. class JUCE_API TableHeaderComponent : public Component,
  14739. private AsyncUpdater
  14740. {
  14741. public:
  14742. TableHeaderComponent();
  14743. ~TableHeaderComponent();
  14744. enum ColumnPropertyFlags
  14745. {
  14746. 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. */
  14747. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14748. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14749. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14750. 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. */
  14751. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14752. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14753. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14754. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14755. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14756. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14757. };
  14758. void addColumn (const String& columnName,
  14759. const int columnId,
  14760. const int width,
  14761. const int minimumWidth = 30,
  14762. const int maximumWidth = -1,
  14763. const int propertyFlags = defaultFlags,
  14764. const int insertIndex = -1);
  14765. void removeColumn (const int columnIdToRemove);
  14766. void removeAllColumns();
  14767. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14768. const String getColumnName (const int columnId) const;
  14769. void setColumnName (const int columnId, const String& newName);
  14770. void moveColumn (const int columnId, int newVisibleIndex);
  14771. int getColumnWidth (const int columnId) const;
  14772. void setColumnWidth (const int columnId, const int newWidth);
  14773. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14774. bool isColumnVisible (const int columnId) const;
  14775. void setSortColumnId (const int columnId, const bool sortForwards);
  14776. int getSortColumnId() const;
  14777. bool isSortedForwards() const;
  14778. void reSortTable();
  14779. int getTotalWidth() const;
  14780. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14781. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14782. const Rectangle<int> getColumnPosition (const int index) const;
  14783. int getColumnIdAtX (const int xToFind) const;
  14784. void setStretchToFitActive (const bool shouldStretchToFit);
  14785. bool isStretchToFitActive() const;
  14786. void resizeAllColumnsToFit (int targetTotalWidth);
  14787. void setPopupMenuActive (const bool hasMenu);
  14788. bool isPopupMenuActive() const;
  14789. const String toString() const;
  14790. void restoreFromString (const String& storedVersion);
  14791. void addListener (TableHeaderListener* const newListener);
  14792. void removeListener (TableHeaderListener* const listenerToRemove);
  14793. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14794. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14795. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14796. void paint (Graphics& g);
  14797. void resized();
  14798. void mouseMove (const MouseEvent&);
  14799. void mouseEnter (const MouseEvent&);
  14800. void mouseExit (const MouseEvent&);
  14801. void mouseDown (const MouseEvent&);
  14802. void mouseDrag (const MouseEvent&);
  14803. void mouseUp (const MouseEvent&);
  14804. const MouseCursor getMouseCursor();
  14805. virtual void showColumnChooserMenu (const int columnIdClicked);
  14806. juce_UseDebuggingNewOperator
  14807. private:
  14808. struct ColumnInfo
  14809. {
  14810. String name;
  14811. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14812. double lastDeliberateWidth;
  14813. bool isVisible() const;
  14814. };
  14815. OwnedArray <ColumnInfo> columns;
  14816. Array <TableHeaderListener*> listeners;
  14817. ScopedPointer <Component> dragOverlayComp;
  14818. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14819. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14820. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14821. ColumnInfo* getInfoForId (const int columnId) const;
  14822. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14823. void sendColumnsChanged();
  14824. void handleAsyncUpdate();
  14825. void beginDrag (const MouseEvent&);
  14826. void endDrag (const int finalIndex);
  14827. int getResizeDraggerAt (const int mouseX) const;
  14828. void updateColumnUnderMouse (int x, int y);
  14829. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14830. TableHeaderComponent (const TableHeaderComponent&);
  14831. TableHeaderComponent operator= (const TableHeaderComponent&);
  14832. };
  14833. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14834. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14835. #endif
  14836. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14837. /*** Start of inlined file: juce_TableListBox.h ***/
  14838. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14839. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14840. class JUCE_API TableListBoxModel
  14841. {
  14842. public:
  14843. TableListBoxModel() {}
  14844. virtual ~TableListBoxModel() {}
  14845. virtual int getNumRows() = 0;
  14846. virtual void paintRowBackground (Graphics& g,
  14847. int rowNumber,
  14848. int width, int height,
  14849. bool rowIsSelected) = 0;
  14850. virtual void paintCell (Graphics& g,
  14851. int rowNumber,
  14852. int columnId,
  14853. int width, int height,
  14854. bool rowIsSelected) = 0;
  14855. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14856. Component* existingComponentToUpdate);
  14857. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14858. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14859. virtual void backgroundClicked();
  14860. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14861. virtual int getColumnAutoSizeWidth (int columnId);
  14862. virtual const String getCellTooltip (int rowNumber, int columnId);
  14863. virtual void selectedRowsChanged (int lastRowSelected);
  14864. virtual void deleteKeyPressed (int lastRowSelected);
  14865. virtual void returnKeyPressed (int lastRowSelected);
  14866. virtual void listWasScrolled();
  14867. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14868. };
  14869. class JUCE_API TableListBox : public ListBox,
  14870. private ListBoxModel,
  14871. private TableHeaderListener
  14872. {
  14873. public:
  14874. TableListBox (const String& componentName,
  14875. TableListBoxModel* const model);
  14876. ~TableListBox();
  14877. void setModel (TableListBoxModel* const newModel);
  14878. TableListBoxModel* getModel() const { return model; }
  14879. TableHeaderComponent* getHeader() const { return header; }
  14880. void setHeaderHeight (const int newHeight);
  14881. int getHeaderHeight() const;
  14882. void autoSizeColumn (const int columnId);
  14883. void autoSizeAllColumns();
  14884. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14885. bool isAutoSizeMenuOptionShown() const;
  14886. const Rectangle<int> getCellPosition (const int columnId,
  14887. const int rowNumber,
  14888. const bool relativeToComponentTopLeft) const;
  14889. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14890. int getNumRows();
  14891. void paintListBoxItem (int, Graphics&, int, int, bool);
  14892. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14893. void selectedRowsChanged (int lastRowSelected);
  14894. void deleteKeyPressed (int currentSelectedRow);
  14895. void returnKeyPressed (int currentSelectedRow);
  14896. void backgroundClicked();
  14897. void listWasScrolled();
  14898. void tableColumnsChanged (TableHeaderComponent*);
  14899. void tableColumnsResized (TableHeaderComponent*);
  14900. void tableSortOrderChanged (TableHeaderComponent*);
  14901. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14902. void resized();
  14903. juce_UseDebuggingNewOperator
  14904. private:
  14905. TableHeaderComponent* header;
  14906. TableListBoxModel* model;
  14907. int columnIdNowBeingDragged;
  14908. bool autoSizeOptionsShown;
  14909. void updateColumnComponents() const;
  14910. TableListBox (const TableListBox&);
  14911. TableListBox& operator= (const TableListBox&);
  14912. };
  14913. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14914. /*** End of inlined file: juce_TableListBox.h ***/
  14915. #endif
  14916. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14917. #endif
  14918. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14919. #endif
  14920. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14921. #endif
  14922. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14923. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14924. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14925. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14926. class JUCE_API ToolbarItemFactory
  14927. {
  14928. public:
  14929. ToolbarItemFactory();
  14930. virtual ~ToolbarItemFactory();
  14931. enum SpecialItemIds
  14932. {
  14933. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14934. can be placed between sets of items to break them into groups. */
  14935. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14936. items.*/
  14937. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14938. either side of it, filling any available space. */
  14939. };
  14940. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14941. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14942. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14943. };
  14944. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14945. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14946. #endif
  14947. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14948. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  14949. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14950. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14951. class JUCE_API ToolbarItemPalette : public Component,
  14952. public DragAndDropContainer
  14953. {
  14954. public:
  14955. ToolbarItemPalette (ToolbarItemFactory& factory,
  14956. Toolbar* const toolbar);
  14957. ~ToolbarItemPalette();
  14958. void resized();
  14959. juce_UseDebuggingNewOperator
  14960. private:
  14961. ToolbarItemFactory& factory;
  14962. Toolbar* toolbar;
  14963. Viewport* viewport;
  14964. friend class Toolbar;
  14965. void replaceComponent (ToolbarItemComponent* const comp);
  14966. ToolbarItemPalette (const ToolbarItemPalette&);
  14967. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14968. };
  14969. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14970. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  14971. #endif
  14972. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14973. /*** Start of inlined file: juce_TreeView.h ***/
  14974. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14975. #define __JUCE_TREEVIEW_JUCEHEADER__
  14976. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  14977. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14978. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14979. class JUCE_API FileDragAndDropTarget
  14980. {
  14981. public:
  14982. virtual ~FileDragAndDropTarget() {}
  14983. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14984. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14985. virtual void fileDragMove (const StringArray& files, int x, int y);
  14986. virtual void fileDragExit (const StringArray& files);
  14987. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14988. };
  14989. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14990. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  14991. class TreeView;
  14992. class JUCE_API TreeViewItem
  14993. {
  14994. public:
  14995. TreeViewItem();
  14996. virtual ~TreeViewItem();
  14997. int getNumSubItems() const throw();
  14998. TreeViewItem* getSubItem (const int index) const throw();
  14999. void clearSubItems();
  15000. void addSubItem (TreeViewItem* const newItem,
  15001. const int insertPosition = -1);
  15002. void removeSubItem (const int index,
  15003. const bool deleteItem = true);
  15004. TreeView* getOwnerView() const throw() { return ownerView; }
  15005. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15006. bool isOpen() const throw();
  15007. void setOpen (const bool shouldBeOpen);
  15008. bool isSelected() const throw();
  15009. void setSelected (const bool shouldBeSelected,
  15010. const bool deselectOtherItemsFirst);
  15011. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  15012. void treeHasChanged() const throw();
  15013. void repaintItem() const;
  15014. int getRowNumberInTree() const throw();
  15015. bool areAllParentsOpen() const throw();
  15016. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  15017. virtual bool mightContainSubItems() = 0;
  15018. virtual const String getUniqueName() const;
  15019. virtual void itemOpennessChanged (bool isNowOpen);
  15020. virtual int getItemWidth() const { return -1; }
  15021. virtual int getItemHeight() const { return 20; }
  15022. virtual bool canBeSelected() const { return true; }
  15023. virtual Component* createItemComponent() { return 0; }
  15024. virtual void paintItem (Graphics& g, int width, int height);
  15025. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15026. virtual void itemClicked (const MouseEvent& e);
  15027. virtual void itemDoubleClicked (const MouseEvent& e);
  15028. virtual void itemSelectionChanged (bool isNowSelected);
  15029. virtual const String getTooltip();
  15030. virtual const String getDragSourceDescription();
  15031. virtual bool isInterestedInFileDrag (const StringArray& files);
  15032. virtual void filesDropped (const StringArray& files, int insertIndex);
  15033. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15034. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15035. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15036. XmlElement* getOpennessState() const throw();
  15037. void restoreOpennessState (const XmlElement& xml) throw();
  15038. int getIndexInParent() const throw();
  15039. bool isLastOfSiblings() const throw();
  15040. const String getItemIdentifierString() const;
  15041. juce_UseDebuggingNewOperator
  15042. private:
  15043. TreeView* ownerView;
  15044. TreeViewItem* parentItem;
  15045. OwnedArray <TreeViewItem> subItems;
  15046. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15047. int uid;
  15048. bool selected : 1;
  15049. bool redrawNeeded : 1;
  15050. bool drawLinesInside : 1;
  15051. bool drawsInLeftMargin : 1;
  15052. unsigned int openness : 2;
  15053. friend class TreeView;
  15054. friend class TreeViewContentComponent;
  15055. void updatePositions (int newY);
  15056. int getIndentX() const throw();
  15057. void setOwnerView (TreeView* const newOwner) throw();
  15058. void paintRecursively (Graphics& g, int width);
  15059. TreeViewItem* getTopLevelItem() throw();
  15060. TreeViewItem* findItemRecursively (int y) throw();
  15061. TreeViewItem* getDeepestOpenParentItem() throw();
  15062. int getNumRows() const throw();
  15063. TreeViewItem* getItemOnRow (int index) throw();
  15064. void deselectAllRecursively();
  15065. int countSelectedItemsRecursively() const throw();
  15066. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15067. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  15068. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15069. TreeViewItem (const TreeViewItem&);
  15070. TreeViewItem& operator= (const TreeViewItem&);
  15071. };
  15072. class JUCE_API TreeView : public Component,
  15073. public SettableTooltipClient,
  15074. public FileDragAndDropTarget,
  15075. public DragAndDropTarget,
  15076. private AsyncUpdater
  15077. {
  15078. public:
  15079. TreeView (const String& componentName = String::empty);
  15080. ~TreeView();
  15081. void setRootItem (TreeViewItem* const newRootItem);
  15082. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15083. void deleteRootItem();
  15084. void setRootItemVisible (const bool shouldBeVisible);
  15085. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15086. void setDefaultOpenness (const bool isOpenByDefault);
  15087. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15088. void setMultiSelectEnabled (const bool canMultiSelect);
  15089. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15090. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  15091. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15092. void clearSelectedItems();
  15093. int getNumSelectedItems() const throw();
  15094. TreeViewItem* getSelectedItem (const int index) const throw();
  15095. int getNumRowsInTree() const;
  15096. TreeViewItem* getItemOnRow (int index) const;
  15097. TreeViewItem* getItemAt (int yPosition) const throw();
  15098. void scrollToKeepItemVisible (TreeViewItem* item);
  15099. Viewport* getViewport() const throw() { return viewport; }
  15100. int getIndentSize() const throw() { return indentSize; }
  15101. void setIndentSize (const int newIndentSize);
  15102. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15103. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  15104. void restoreOpennessState (const XmlElement& newState);
  15105. enum ColourIds
  15106. {
  15107. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15108. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15109. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15110. };
  15111. void paint (Graphics& g);
  15112. void resized();
  15113. bool keyPressed (const KeyPress& key);
  15114. void colourChanged();
  15115. void enablementChanged();
  15116. bool isInterestedInFileDrag (const StringArray& files);
  15117. void fileDragEnter (const StringArray& files, int x, int y);
  15118. void fileDragMove (const StringArray& files, int x, int y);
  15119. void fileDragExit (const StringArray& files);
  15120. void filesDropped (const StringArray& files, int x, int y);
  15121. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15122. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15123. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15124. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15125. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15126. juce_UseDebuggingNewOperator
  15127. private:
  15128. friend class TreeViewItem;
  15129. friend class TreeViewContentComponent;
  15130. Viewport* viewport;
  15131. CriticalSection nodeAlterationLock;
  15132. TreeViewItem* rootItem;
  15133. Component* dragInsertPointHighlight;
  15134. Component* dragTargetGroupHighlight;
  15135. int indentSize;
  15136. bool defaultOpenness : 1;
  15137. bool needsRecalculating : 1;
  15138. bool rootItemVisible : 1;
  15139. bool multiSelectEnabled : 1;
  15140. bool openCloseButtonsVisible : 1;
  15141. void itemsChanged() throw();
  15142. void handleAsyncUpdate();
  15143. void moveSelectedRow (int delta);
  15144. void updateButtonUnderMouse (const MouseEvent& e);
  15145. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15146. void hideDragHighlight() throw();
  15147. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15148. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15149. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15150. const StringArray& files, const String& sourceDescription,
  15151. Component* sourceComponent) const throw();
  15152. TreeView (const TreeView&);
  15153. TreeView& operator= (const TreeView&);
  15154. };
  15155. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15156. /*** End of inlined file: juce_TreeView.h ***/
  15157. #endif
  15158. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15159. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15160. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15161. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15162. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15163. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15164. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15165. /*** Start of inlined file: juce_FileFilter.h ***/
  15166. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15167. #define __JUCE_FILEFILTER_JUCEHEADER__
  15168. class JUCE_API FileFilter
  15169. {
  15170. public:
  15171. FileFilter (const String& filterDescription);
  15172. virtual ~FileFilter();
  15173. const String& getDescription() const throw();
  15174. virtual bool isFileSuitable (const File& file) const = 0;
  15175. virtual bool isDirectorySuitable (const File& file) const = 0;
  15176. protected:
  15177. String description;
  15178. };
  15179. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15180. /*** End of inlined file: juce_FileFilter.h ***/
  15181. /*** Start of inlined file: juce_Image.h ***/
  15182. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15183. #define __JUCE_IMAGE_JUCEHEADER__
  15184. class JUCE_API Image
  15185. {
  15186. public:
  15187. enum PixelFormat
  15188. {
  15189. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15190. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15191. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15192. };
  15193. Image (const PixelFormat format,
  15194. const int imageWidth,
  15195. const int imageHeight,
  15196. const bool clearImage);
  15197. Image (const Image& other);
  15198. virtual ~Image();
  15199. static Image* createNativeImage (const PixelFormat format,
  15200. const int imageWidth,
  15201. const int imageHeight,
  15202. const bool clearImage);
  15203. int getWidth() const throw() { return imageWidth; }
  15204. int getHeight() const throw() { return imageHeight; }
  15205. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15206. PixelFormat getFormat() const throw() { return format; }
  15207. bool isARGB() const throw() { return format == ARGB; }
  15208. bool isRGB() const throw() { return format == RGB; }
  15209. bool hasAlphaChannel() const throw() { return format != RGB; }
  15210. virtual void clear (int x, int y, int w, int h,
  15211. const Colour& colourToClearTo = Colour (0x00000000));
  15212. virtual Image* createCopy (int newWidth = -1,
  15213. int newHeight = -1,
  15214. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15215. virtual Image* createCopyOfAlphaChannel() const;
  15216. virtual const Colour getPixelAt (const int x, const int y) const;
  15217. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  15218. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  15219. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  15220. virtual void desaturate();
  15221. class BitmapData
  15222. {
  15223. public:
  15224. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  15225. BitmapData (const Image& image, int x, int y, int w, int h);
  15226. ~BitmapData();
  15227. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  15228. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  15229. uint8* data;
  15230. int lineStride, pixelStride, width, height;
  15231. private:
  15232. BitmapData (const BitmapData&);
  15233. BitmapData& operator= (const BitmapData&);
  15234. };
  15235. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15236. const uint8* sourcePixelData, int sourceLineStride);
  15237. virtual void moveImageSection (int destX, int destY,
  15238. int sourceX, int sourceY,
  15239. int width, int height);
  15240. void createSolidAreaMask (RectangleList& result,
  15241. const float alphaThreshold = 0.5f) const;
  15242. juce_UseDebuggingNewOperator
  15243. virtual LowLevelGraphicsContext* createLowLevelContext();
  15244. protected:
  15245. friend class BitmapData;
  15246. const PixelFormat format;
  15247. const int imageWidth, imageHeight;
  15248. Image (const PixelFormat format,
  15249. const int imageWidth,
  15250. const int imageHeight);
  15251. int pixelStride, lineStride;
  15252. HeapBlock <uint8> imageDataAllocated;
  15253. uint8* imageData;
  15254. private:
  15255. Image& operator= (const Image&);
  15256. };
  15257. #endif // __JUCE_IMAGE_JUCEHEADER__
  15258. /*** End of inlined file: juce_Image.h ***/
  15259. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15260. public TimeSliceClient
  15261. {
  15262. public:
  15263. DirectoryContentsList (const FileFilter* const fileFilter,
  15264. TimeSliceThread& threadToUse);
  15265. ~DirectoryContentsList();
  15266. void setDirectory (const File& directory,
  15267. const bool includeDirectories,
  15268. const bool includeFiles);
  15269. const File& getDirectory() const;
  15270. void clear();
  15271. void refresh();
  15272. bool isStillLoading() const;
  15273. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15274. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15275. struct FileInfo
  15276. {
  15277. String filename;
  15278. int64 fileSize;
  15279. Time modificationTime;
  15280. Time creationTime;
  15281. bool isDirectory;
  15282. bool isReadOnly;
  15283. };
  15284. int getNumFiles() const;
  15285. bool getFileInfo (const int index,
  15286. FileInfo& resultInfo) const;
  15287. const File getFile (const int index) const;
  15288. const FileFilter* getFilter() const { return fileFilter; }
  15289. bool useTimeSlice();
  15290. TimeSliceThread& getTimeSliceThread() { return thread; }
  15291. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15292. const DirectoryContentsList::FileInfo* const second);
  15293. juce_UseDebuggingNewOperator
  15294. private:
  15295. File root;
  15296. const FileFilter* fileFilter;
  15297. TimeSliceThread& thread;
  15298. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15299. CriticalSection fileListLock;
  15300. OwnedArray <FileInfo> files;
  15301. void* volatile fileFindHandle;
  15302. bool volatile shouldStop;
  15303. void changed();
  15304. bool checkNextFile (bool& hasChanged);
  15305. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15306. const int64 fileSize, const Time& modTime,
  15307. const Time& creationTime, const bool isReadOnly);
  15308. DirectoryContentsList (const DirectoryContentsList&);
  15309. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15310. };
  15311. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15312. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15313. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15314. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15315. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15316. class JUCE_API FileBrowserListener
  15317. {
  15318. public:
  15319. virtual ~FileBrowserListener();
  15320. virtual void selectionChanged() = 0;
  15321. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15322. virtual void fileDoubleClicked (const File& file) = 0;
  15323. };
  15324. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15325. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15326. class JUCE_API DirectoryContentsDisplayComponent
  15327. {
  15328. public:
  15329. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15330. virtual ~DirectoryContentsDisplayComponent();
  15331. virtual int getNumSelectedFiles() const = 0;
  15332. virtual const File getSelectedFile (int index) const = 0;
  15333. virtual void scrollToTop() = 0;
  15334. void addListener (FileBrowserListener* const listener) throw();
  15335. void removeListener (FileBrowserListener* const listener) throw();
  15336. enum ColourIds
  15337. {
  15338. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15339. textColourId = 0x1000541, /**< The colour for the text. */
  15340. };
  15341. void sendSelectionChangeMessage();
  15342. void sendDoubleClickMessage (const File& file);
  15343. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15344. juce_UseDebuggingNewOperator
  15345. protected:
  15346. DirectoryContentsList& fileList;
  15347. ListenerList <FileBrowserListener> listeners;
  15348. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15349. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15350. };
  15351. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15352. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15353. #endif
  15354. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15355. #endif
  15356. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15357. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15358. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15359. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15360. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15361. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15362. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15363. class JUCE_API FilePreviewComponent : public Component
  15364. {
  15365. public:
  15366. FilePreviewComponent();
  15367. ~FilePreviewComponent();
  15368. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15369. juce_UseDebuggingNewOperator
  15370. private:
  15371. FilePreviewComponent (const FilePreviewComponent&);
  15372. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15373. };
  15374. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15375. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15376. class JUCE_API FileBrowserComponent : public Component,
  15377. public ChangeBroadcaster,
  15378. private FileBrowserListener,
  15379. private TextEditorListener,
  15380. private ButtonListener,
  15381. private ComboBoxListener,
  15382. private FileFilter
  15383. {
  15384. public:
  15385. enum FileChooserFlags
  15386. {
  15387. openMode = 1, /**< specifies that the component should allow the user to
  15388. choose an existing file with the intention of opening it. */
  15389. saveMode = 2, /**< specifies that the component should allow the user to specify
  15390. the name of a file that will be used to save something. */
  15391. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15392. conjunction with canSelectDirectories). */
  15393. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15394. conjuction with canSelectFiles). */
  15395. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15396. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15397. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15398. };
  15399. FileBrowserComponent (int flags,
  15400. const File& initialFileOrDirectory,
  15401. const FileFilter* fileFilter,
  15402. FilePreviewComponent* previewComp);
  15403. ~FileBrowserComponent();
  15404. int getNumSelectedFiles() const throw();
  15405. const File getSelectedFile (int index) const throw();
  15406. bool currentFileIsValid() const;
  15407. const File getHighlightedFile() const throw();
  15408. const File getRoot() const;
  15409. void setRoot (const File& newRootDirectory);
  15410. void goUp();
  15411. void refresh();
  15412. virtual const String getActionVerb() const;
  15413. bool isSaveMode() const throw();
  15414. void addListener (FileBrowserListener* const listener) throw();
  15415. void removeListener (FileBrowserListener* const listener) throw();
  15416. void resized();
  15417. void buttonClicked (Button* b);
  15418. void comboBoxChanged (ComboBox*);
  15419. void textEditorTextChanged (TextEditor& editor);
  15420. void textEditorReturnKeyPressed (TextEditor& editor);
  15421. void textEditorEscapeKeyPressed (TextEditor& editor);
  15422. void textEditorFocusLost (TextEditor& editor);
  15423. bool keyPressed (const KeyPress& key);
  15424. void selectionChanged();
  15425. void fileClicked (const File& f, const MouseEvent& e);
  15426. void fileDoubleClicked (const File& f);
  15427. bool isFileSuitable (const File& file) const;
  15428. bool isDirectorySuitable (const File&) const;
  15429. FilePreviewComponent* getPreviewComponent() const throw();
  15430. juce_UseDebuggingNewOperator
  15431. protected:
  15432. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15433. private:
  15434. ScopedPointer <DirectoryContentsList> fileList;
  15435. const FileFilter* fileFilter;
  15436. int flags;
  15437. File currentRoot;
  15438. Array<File> chosenFiles;
  15439. ListenerList <FileBrowserListener> listeners;
  15440. DirectoryContentsDisplayComponent* fileListComponent;
  15441. FilePreviewComponent* previewComp;
  15442. ComboBox* currentPathBox;
  15443. TextEditor* filenameBox;
  15444. Button* goUpButton;
  15445. TimeSliceThread thread;
  15446. void sendListenerChangeMessage();
  15447. bool isFileOrDirSuitable (const File& f) const;
  15448. FileBrowserComponent (const FileBrowserComponent&);
  15449. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15450. };
  15451. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15452. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15453. #endif
  15454. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15455. #endif
  15456. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15457. /*** Start of inlined file: juce_FileChooser.h ***/
  15458. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15459. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15460. class JUCE_API FileChooser
  15461. {
  15462. public:
  15463. FileChooser (const String& dialogBoxTitle,
  15464. const File& initialFileOrDirectory = File::nonexistent,
  15465. const String& filePatternsAllowed = String::empty,
  15466. const bool useOSNativeDialogBox = true);
  15467. ~FileChooser();
  15468. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15469. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15470. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15471. bool browseForDirectory();
  15472. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15473. const File getResult() const;
  15474. const Array<File>& getResults() const;
  15475. juce_UseDebuggingNewOperator
  15476. private:
  15477. String title, filters;
  15478. File startingFile;
  15479. Array<File> results;
  15480. bool useNativeDialogBox;
  15481. bool showDialog (const bool selectsDirectories,
  15482. const bool selectsFiles,
  15483. const bool isSave,
  15484. const bool warnAboutOverwritingExistingFiles,
  15485. const bool selectMultipleFiles,
  15486. FilePreviewComponent* const previewComponent);
  15487. static void showPlatformDialog (Array<File>& results,
  15488. const String& title,
  15489. const File& file,
  15490. const String& filters,
  15491. bool selectsDirectories,
  15492. bool selectsFiles,
  15493. bool isSave,
  15494. bool warnAboutOverwritingExistingFiles,
  15495. bool selectMultipleFiles,
  15496. FilePreviewComponent* previewComponent);
  15497. };
  15498. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15499. /*** End of inlined file: juce_FileChooser.h ***/
  15500. #endif
  15501. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15502. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15503. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15504. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15505. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15506. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15507. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15508. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15509. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15510. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15511. /*** Start of inlined file: juce_DropShadower.h ***/
  15512. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15513. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15514. class JUCE_API DropShadower : public ComponentListener
  15515. {
  15516. public:
  15517. DropShadower (const float alpha = 0.5f,
  15518. const int xOffset = 1,
  15519. const int yOffset = 5,
  15520. const float blurRadius = 10.0f);
  15521. virtual ~DropShadower();
  15522. void setOwner (Component* componentToFollow);
  15523. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15524. void componentBroughtToFront (Component& component);
  15525. void componentChildrenChanged (Component& component);
  15526. void componentParentHierarchyChanged (Component& component);
  15527. void componentVisibilityChanged (Component& component);
  15528. juce_UseDebuggingNewOperator
  15529. private:
  15530. Component* owner;
  15531. int numShadows;
  15532. Component* shadowWindows[4];
  15533. Image* shadowImageSections[12];
  15534. const int shadowEdge, xOffset, yOffset;
  15535. const float alpha, blurRadius;
  15536. bool inDestructor, reentrant;
  15537. void updateShadows();
  15538. void setShadowImage (Image* const src,
  15539. const int num,
  15540. const int w, const int h,
  15541. const int sx, const int sy);
  15542. void bringShadowWindowsToFront();
  15543. void deleteShadowWindows();
  15544. DropShadower (const DropShadower&);
  15545. DropShadower& operator= (const DropShadower&);
  15546. };
  15547. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15548. /*** End of inlined file: juce_DropShadower.h ***/
  15549. class JUCE_API TopLevelWindow : public Component
  15550. {
  15551. public:
  15552. TopLevelWindow (const String& name,
  15553. const bool addToDesktop);
  15554. ~TopLevelWindow();
  15555. bool isActiveWindow() const throw() { return windowIsActive_; }
  15556. void centreAroundComponent (Component* componentToCentreAround,
  15557. const int width, const int height);
  15558. void setDropShadowEnabled (const bool useShadow);
  15559. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15560. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15561. static int getNumTopLevelWindows() throw();
  15562. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15563. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15564. juce_UseDebuggingNewOperator
  15565. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15566. protected:
  15567. virtual void activeWindowStatusChanged();
  15568. void focusOfChildComponentChanged (FocusChangeType cause);
  15569. void parentHierarchyChanged();
  15570. void visibilityChanged();
  15571. virtual int getDesktopWindowStyleFlags() const;
  15572. void recreateDesktopWindow();
  15573. private:
  15574. friend class TopLevelWindowManager;
  15575. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15576. ScopedPointer <DropShadower> shadower;
  15577. void setWindowActive (const bool isNowActive) throw();
  15578. TopLevelWindow (const TopLevelWindow&);
  15579. TopLevelWindow& operator= (const TopLevelWindow&);
  15580. };
  15581. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15582. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15583. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15584. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15585. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15586. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15587. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15588. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15589. class JUCE_API ComponentBoundsConstrainer
  15590. {
  15591. public:
  15592. ComponentBoundsConstrainer() throw();
  15593. virtual ~ComponentBoundsConstrainer();
  15594. void setMinimumWidth (const int minimumWidth) throw();
  15595. int getMinimumWidth() const throw() { return minW; }
  15596. void setMaximumWidth (const int maximumWidth) throw();
  15597. int getMaximumWidth() const throw() { return maxW; }
  15598. void setMinimumHeight (const int minimumHeight) throw();
  15599. int getMinimumHeight() const throw() { return minH; }
  15600. void setMaximumHeight (const int maximumHeight) throw();
  15601. int getMaximumHeight() const throw() { return maxH; }
  15602. void setMinimumSize (const int minimumWidth,
  15603. const int minimumHeight) throw();
  15604. void setMaximumSize (const int maximumWidth,
  15605. const int maximumHeight) throw();
  15606. void setSizeLimits (const int minimumWidth,
  15607. const int minimumHeight,
  15608. const int maximumWidth,
  15609. const int maximumHeight) throw();
  15610. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15611. const int minimumWhenOffTheLeft,
  15612. const int minimumWhenOffTheBottom,
  15613. const int minimumWhenOffTheRight) throw();
  15614. void setFixedAspectRatio (const double widthOverHeight) throw();
  15615. double getFixedAspectRatio() const throw();
  15616. virtual void checkBounds (Rectangle<int>& bounds,
  15617. const Rectangle<int>& previousBounds,
  15618. const Rectangle<int>& limits,
  15619. const bool isStretchingTop,
  15620. const bool isStretchingLeft,
  15621. const bool isStretchingBottom,
  15622. const bool isStretchingRight);
  15623. virtual void resizeStart();
  15624. virtual void resizeEnd();
  15625. void setBoundsForComponent (Component* const component,
  15626. const Rectangle<int>& bounds,
  15627. const bool isStretchingTop,
  15628. const bool isStretchingLeft,
  15629. const bool isStretchingBottom,
  15630. const bool isStretchingRight);
  15631. void checkComponentBounds (Component* component);
  15632. virtual void applyBoundsToComponent (Component* component,
  15633. const Rectangle<int>& bounds);
  15634. juce_UseDebuggingNewOperator
  15635. private:
  15636. int minW, maxW, minH, maxH;
  15637. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15638. double aspectRatio;
  15639. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15640. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15641. };
  15642. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15643. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15644. class JUCE_API ComponentDragger
  15645. {
  15646. public:
  15647. ComponentDragger();
  15648. virtual ~ComponentDragger();
  15649. void startDraggingComponent (Component* const componentToDrag,
  15650. ComponentBoundsConstrainer* constrainer);
  15651. void dragComponent (Component* const componentToDrag,
  15652. const MouseEvent& e);
  15653. juce_UseDebuggingNewOperator
  15654. private:
  15655. ComponentBoundsConstrainer* constrainer;
  15656. Point<int> originalPos;
  15657. };
  15658. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15659. /*** End of inlined file: juce_ComponentDragger.h ***/
  15660. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15661. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15662. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15663. class JUCE_API ResizableBorderComponent : public Component
  15664. {
  15665. public:
  15666. ResizableBorderComponent (Component* const componentToResize,
  15667. ComponentBoundsConstrainer* const constrainer);
  15668. ~ResizableBorderComponent();
  15669. void setBorderThickness (const BorderSize& newBorderSize);
  15670. const BorderSize getBorderThickness() const;
  15671. juce_UseDebuggingNewOperator
  15672. protected:
  15673. void paint (Graphics& g);
  15674. void mouseEnter (const MouseEvent& e);
  15675. void mouseMove (const MouseEvent& e);
  15676. void mouseDown (const MouseEvent& e);
  15677. void mouseDrag (const MouseEvent& e);
  15678. void mouseUp (const MouseEvent& e);
  15679. bool hitTest (int x, int y);
  15680. private:
  15681. Component::SafePointer<Component> component;
  15682. ComponentBoundsConstrainer* constrainer;
  15683. BorderSize borderSize;
  15684. Rectangle<int> originalBounds;
  15685. int mouseZone;
  15686. void updateMouseZone (const MouseEvent& e);
  15687. ResizableBorderComponent (const ResizableBorderComponent&);
  15688. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15689. };
  15690. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15691. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15692. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15693. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15694. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15695. class JUCE_API ResizableCornerComponent : public Component
  15696. {
  15697. public:
  15698. ResizableCornerComponent (Component* const componentToResize,
  15699. ComponentBoundsConstrainer* const constrainer);
  15700. ~ResizableCornerComponent();
  15701. juce_UseDebuggingNewOperator
  15702. protected:
  15703. void paint (Graphics& g);
  15704. void mouseDown (const MouseEvent& e);
  15705. void mouseDrag (const MouseEvent& e);
  15706. void mouseUp (const MouseEvent& e);
  15707. bool hitTest (int x, int y);
  15708. private:
  15709. Component::SafePointer<Component> component;
  15710. ComponentBoundsConstrainer* constrainer;
  15711. Rectangle<int> originalBounds;
  15712. ResizableCornerComponent (const ResizableCornerComponent&);
  15713. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15714. };
  15715. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15716. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15717. class JUCE_API ResizableWindow : public TopLevelWindow
  15718. {
  15719. public:
  15720. ResizableWindow (const String& name,
  15721. const bool addToDesktop);
  15722. ResizableWindow (const String& name,
  15723. const Colour& backgroundColour,
  15724. const bool addToDesktop);
  15725. ~ResizableWindow();
  15726. const Colour getBackgroundColour() const throw();
  15727. void setBackgroundColour (const Colour& newColour);
  15728. void setResizable (const bool shouldBeResizable,
  15729. const bool useBottomRightCornerResizer);
  15730. bool isResizable() const throw();
  15731. void setResizeLimits (const int newMinimumWidth,
  15732. const int newMinimumHeight,
  15733. const int newMaximumWidth,
  15734. const int newMaximumHeight) throw();
  15735. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15736. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15737. void setBoundsConstrained (const Rectangle<int>& bounds);
  15738. bool isFullScreen() const;
  15739. void setFullScreen (const bool shouldBeFullScreen);
  15740. bool isMinimised() const;
  15741. void setMinimised (const bool shouldMinimise);
  15742. const String getWindowStateAsString();
  15743. bool restoreWindowStateFromString (const String& previousState);
  15744. Component* getContentComponent() const throw() { return contentComponent; }
  15745. void setContentComponent (Component* const newContentComponent,
  15746. const bool deleteOldOne = true,
  15747. const bool resizeToFit = false);
  15748. void setContentComponentSize (int width, int height);
  15749. enum ColourIds
  15750. {
  15751. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15752. };
  15753. juce_UseDebuggingNewOperator
  15754. protected:
  15755. void paint (Graphics& g);
  15756. void moved();
  15757. void resized();
  15758. void mouseDown (const MouseEvent& e);
  15759. void mouseDrag (const MouseEvent& e);
  15760. void lookAndFeelChanged();
  15761. void childBoundsChanged (Component* child);
  15762. void parentSizeChanged();
  15763. void visibilityChanged();
  15764. void activeWindowStatusChanged();
  15765. int getDesktopWindowStyleFlags() const;
  15766. virtual const BorderSize getBorderThickness();
  15767. virtual const BorderSize getContentComponentBorder();
  15768. #ifdef JUCE_DEBUG
  15769. void addChildComponent (Component* const child, int zOrder = -1);
  15770. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15771. #endif
  15772. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15773. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15774. private:
  15775. ScopedPointer <Component> contentComponent;
  15776. bool resizeToFitContent, fullscreen;
  15777. ComponentDragger dragger;
  15778. Rectangle<int> lastNonFullScreenPos;
  15779. ComponentBoundsConstrainer defaultConstrainer;
  15780. ComponentBoundsConstrainer* constrainer;
  15781. #ifdef JUCE_DEBUG
  15782. bool hasBeenResized;
  15783. #endif
  15784. void updateLastPos();
  15785. ResizableWindow (const ResizableWindow&);
  15786. ResizableWindow& operator= (const ResizableWindow&);
  15787. // (xxx remove these eventually)
  15788. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15789. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15790. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15791. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15792. };
  15793. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15794. /*** End of inlined file: juce_ResizableWindow.h ***/
  15795. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15796. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15797. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15798. class JUCE_API PositionedGlyph
  15799. {
  15800. public:
  15801. juce_wchar getCharacter() const { return character; }
  15802. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15803. float getLeft() const { return x; }
  15804. float getRight() const { return x + w; }
  15805. float getBaselineY() const { return y; }
  15806. float getTop() const { return y - font.getAscent(); }
  15807. float getBottom() const { return y + font.getDescent(); }
  15808. void moveBy (const float deltaX,
  15809. const float deltaY);
  15810. void draw (const Graphics& g) const;
  15811. void draw (const Graphics& g, const AffineTransform& transform) const;
  15812. void createPath (Path& path) const;
  15813. bool hitTest (float x, float y) const;
  15814. juce_UseDebuggingNewOperator
  15815. private:
  15816. friend class GlyphArrangement;
  15817. float x, y, w;
  15818. Font font;
  15819. juce_wchar character;
  15820. int glyph;
  15821. PositionedGlyph();
  15822. };
  15823. class JUCE_API GlyphArrangement
  15824. {
  15825. public:
  15826. GlyphArrangement();
  15827. GlyphArrangement (const GlyphArrangement& other);
  15828. GlyphArrangement& operator= (const GlyphArrangement& other);
  15829. ~GlyphArrangement();
  15830. int getNumGlyphs() const { return glyphs.size(); }
  15831. PositionedGlyph& getGlyph (const int index) const;
  15832. void clear();
  15833. void addLineOfText (const Font& font,
  15834. const String& text,
  15835. const float x,
  15836. const float y);
  15837. void addCurtailedLineOfText (const Font& font,
  15838. const String& text,
  15839. float x,
  15840. const float y,
  15841. const float maxWidthPixels,
  15842. const bool useEllipsis);
  15843. void addJustifiedText (const Font& font,
  15844. const String& text,
  15845. float x, float y,
  15846. const float maxLineWidth,
  15847. const Justification& horizontalLayout);
  15848. void addFittedText (const Font& font,
  15849. const String& text,
  15850. const float x, const float y,
  15851. const float width, const float height,
  15852. const Justification& layout,
  15853. int maximumLinesToUse,
  15854. const float minimumHorizontalScale = 0.7f);
  15855. void addGlyphArrangement (const GlyphArrangement& other);
  15856. void draw (const Graphics& g) const;
  15857. void draw (const Graphics& g, const AffineTransform& transform) const;
  15858. void createPath (Path& path) const;
  15859. int findGlyphIndexAt (float x, float y) const;
  15860. void getBoundingBox (int startIndex,
  15861. int numGlyphs,
  15862. float& left,
  15863. float& top,
  15864. float& right,
  15865. float& bottom,
  15866. const bool includeWhitespace) const;
  15867. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15868. const float deltaX,
  15869. const float deltaY);
  15870. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15871. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15872. const float horizontalScaleFactor);
  15873. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15874. const float x,
  15875. const float y,
  15876. const float width,
  15877. const float height,
  15878. const Justification& justification);
  15879. juce_UseDebuggingNewOperator
  15880. private:
  15881. OwnedArray <PositionedGlyph> glyphs;
  15882. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15883. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15884. const Justification& justification, float minimumHorizontalScale);
  15885. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15886. };
  15887. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15888. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15889. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15890. public ButtonListener,
  15891. public FileBrowserListener
  15892. {
  15893. public:
  15894. FileChooserDialogBox (const String& title,
  15895. const String& instructions,
  15896. FileBrowserComponent& browserComponent,
  15897. const bool warnAboutOverwritingExistingFiles,
  15898. const Colour& backgroundColour);
  15899. ~FileChooserDialogBox();
  15900. bool show (int width = 0,int height = 0);
  15901. enum ColourIds
  15902. {
  15903. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15904. };
  15905. void buttonClicked (Button* button);
  15906. void closeButtonPressed();
  15907. void selectionChanged();
  15908. void fileClicked (const File& file, const MouseEvent& e);
  15909. void fileDoubleClicked (const File& file);
  15910. juce_UseDebuggingNewOperator
  15911. private:
  15912. class ContentComponent : public Component
  15913. {
  15914. public:
  15915. ContentComponent();
  15916. ~ContentComponent();
  15917. void paint (Graphics& g);
  15918. void resized();
  15919. String instructions;
  15920. GlyphArrangement text;
  15921. FileBrowserComponent* chooserComponent;
  15922. FilePreviewComponent* previewComponent;
  15923. TextButton* okButton;
  15924. TextButton* cancelButton;
  15925. };
  15926. ContentComponent* content;
  15927. const bool warnAboutOverwritingExistingFiles;
  15928. FileChooserDialogBox (const FileChooserDialogBox&);
  15929. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15930. };
  15931. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15932. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15933. #endif
  15934. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15935. #endif
  15936. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15937. /*** Start of inlined file: juce_FileListComponent.h ***/
  15938. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15939. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15940. class JUCE_API FileListComponent : public ListBox,
  15941. public DirectoryContentsDisplayComponent,
  15942. private ListBoxModel,
  15943. private ChangeListener
  15944. {
  15945. public:
  15946. FileListComponent (DirectoryContentsList& listToShow);
  15947. ~FileListComponent();
  15948. int getNumSelectedFiles() const;
  15949. const File getSelectedFile (int index = 0) const;
  15950. void scrollToTop();
  15951. void changeListenerCallback (void*);
  15952. int getNumRows();
  15953. void paintListBoxItem (int, Graphics&, int, int, bool);
  15954. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15955. void selectedRowsChanged (int lastRowSelected);
  15956. void deleteKeyPressed (int currentSelectedRow);
  15957. void returnKeyPressed (int currentSelectedRow);
  15958. juce_UseDebuggingNewOperator
  15959. private:
  15960. FileListComponent (const FileListComponent&);
  15961. FileListComponent& operator= (const FileListComponent&);
  15962. File lastDirectory;
  15963. };
  15964. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15965. /*** End of inlined file: juce_FileListComponent.h ***/
  15966. #endif
  15967. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15968. /*** Start of inlined file: juce_FilenameComponent.h ***/
  15969. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15970. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15971. class FilenameComponent;
  15972. class JUCE_API FilenameComponentListener
  15973. {
  15974. public:
  15975. virtual ~FilenameComponentListener() {}
  15976. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15977. };
  15978. class JUCE_API FilenameComponent : public Component,
  15979. public SettableTooltipClient,
  15980. public FileDragAndDropTarget,
  15981. private AsyncUpdater,
  15982. private ButtonListener,
  15983. private ComboBoxListener
  15984. {
  15985. public:
  15986. FilenameComponent (const String& name,
  15987. const File& currentFile,
  15988. const bool canEditFilename,
  15989. const bool isDirectory,
  15990. const bool isForSaving,
  15991. const String& fileBrowserWildcard,
  15992. const String& enforcedSuffix,
  15993. const String& textWhenNothingSelected);
  15994. ~FilenameComponent();
  15995. const File getCurrentFile() const;
  15996. void setCurrentFile (File newFile,
  15997. const bool addToRecentlyUsedList,
  15998. const bool sendChangeNotification = true);
  15999. void setFilenameIsEditable (const bool shouldBeEditable);
  16000. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16001. const StringArray getRecentlyUsedFilenames() const;
  16002. void setRecentlyUsedFilenames (const StringArray& filenames);
  16003. void addRecentlyUsedFile (const File& file);
  16004. void setMaxNumberOfRecentFiles (const int newMaximum);
  16005. void setBrowseButtonText (const String& browseButtonText);
  16006. void addListener (FilenameComponentListener* const listener) throw();
  16007. void removeListener (FilenameComponentListener* const listener) throw();
  16008. void setTooltip (const String& newTooltip);
  16009. void paintOverChildren (Graphics& g);
  16010. void resized();
  16011. void lookAndFeelChanged();
  16012. bool isInterestedInFileDrag (const StringArray& files);
  16013. void filesDropped (const StringArray& files, int, int);
  16014. void fileDragEnter (const StringArray& files, int, int);
  16015. void fileDragExit (const StringArray& files);
  16016. juce_UseDebuggingNewOperator
  16017. private:
  16018. ComboBox* filenameBox;
  16019. String lastFilename;
  16020. Button* browseButton;
  16021. int maxRecentFiles;
  16022. bool isDir, isSaving, isFileDragOver;
  16023. String wildcard, enforcedSuffix, browseButtonText;
  16024. ListenerList <FilenameComponentListener> listeners;
  16025. File defaultBrowseFile;
  16026. void comboBoxChanged (ComboBox*);
  16027. void buttonClicked (Button* button);
  16028. void handleAsyncUpdate();
  16029. FilenameComponent (const FilenameComponent&);
  16030. FilenameComponent& operator= (const FilenameComponent&);
  16031. };
  16032. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16033. /*** End of inlined file: juce_FilenameComponent.h ***/
  16034. #endif
  16035. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16036. #endif
  16037. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16038. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16039. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16040. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16041. class JUCE_API FileSearchPathListComponent : public Component,
  16042. public SettableTooltipClient,
  16043. public FileDragAndDropTarget,
  16044. private ButtonListener,
  16045. private ListBoxModel
  16046. {
  16047. public:
  16048. FileSearchPathListComponent();
  16049. ~FileSearchPathListComponent();
  16050. const FileSearchPath& getPath() const throw() { return path; }
  16051. void setPath (const FileSearchPath& newPath);
  16052. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16053. enum ColourIds
  16054. {
  16055. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16056. Make this transparent if you don't want the background to be filled. */
  16057. };
  16058. int getNumRows();
  16059. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16060. void deleteKeyPressed (int lastRowSelected);
  16061. void returnKeyPressed (int lastRowSelected);
  16062. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16063. void selectedRowsChanged (int lastRowSelected);
  16064. void resized();
  16065. void paint (Graphics& g);
  16066. bool isInterestedInFileDrag (const StringArray& files);
  16067. void filesDropped (const StringArray& files, int, int);
  16068. void buttonClicked (Button* button);
  16069. juce_UseDebuggingNewOperator
  16070. private:
  16071. FileSearchPath path;
  16072. File defaultBrowseTarget;
  16073. ListBox* listBox;
  16074. Button* addButton;
  16075. Button* removeButton;
  16076. Button* changeButton;
  16077. Button* upButton;
  16078. Button* downButton;
  16079. void changed() throw();
  16080. void updateButtons() throw();
  16081. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16082. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16083. };
  16084. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16085. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16086. #endif
  16087. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16088. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16089. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16090. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16091. class JUCE_API FileTreeComponent : public TreeView,
  16092. public DirectoryContentsDisplayComponent
  16093. {
  16094. public:
  16095. FileTreeComponent (DirectoryContentsList& listToShow);
  16096. ~FileTreeComponent();
  16097. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16098. const File getSelectedFile (int index = 0) const;
  16099. void scrollToTop();
  16100. void setDragAndDropDescription (const String& description) throw();
  16101. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16102. juce_UseDebuggingNewOperator
  16103. private:
  16104. String dragAndDropDescription;
  16105. FileTreeComponent (const FileTreeComponent&);
  16106. FileTreeComponent& operator= (const FileTreeComponent&);
  16107. };
  16108. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16109. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16110. #endif
  16111. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16112. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16113. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16114. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16115. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16116. private Timer
  16117. {
  16118. public:
  16119. ImagePreviewComponent();
  16120. ~ImagePreviewComponent();
  16121. void selectedFileChanged (const File& newSelectedFile);
  16122. void paint (Graphics& g);
  16123. void timerCallback();
  16124. juce_UseDebuggingNewOperator
  16125. private:
  16126. File fileToLoad;
  16127. ScopedPointer <Image> currentThumbnail;
  16128. String currentDetails;
  16129. void getThumbSize (int& w, int& h) const;
  16130. ImagePreviewComponent (const ImagePreviewComponent&);
  16131. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16132. };
  16133. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16134. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16135. #endif
  16136. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16137. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16138. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16139. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16140. class JUCE_API WildcardFileFilter : public FileFilter
  16141. {
  16142. public:
  16143. WildcardFileFilter (const String& fileWildcardPatterns,
  16144. const String& directoryWildcardPatterns,
  16145. const String& description);
  16146. ~WildcardFileFilter();
  16147. bool isFileSuitable (const File& file) const;
  16148. bool isDirectorySuitable (const File& file) const;
  16149. juce_UseDebuggingNewOperator
  16150. private:
  16151. StringArray fileWildcards, directoryWildcards;
  16152. static void parse (const String& pattern, StringArray& result) throw();
  16153. static bool match (const File& file, const StringArray& wildcards) throw();
  16154. };
  16155. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16156. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16157. #endif
  16158. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16159. #endif
  16160. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16161. /*** Start of inlined file: juce_ComponentDeletionWatcher.h ***/
  16162. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16163. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16164. class JUCE_API ComponentDeletionWatcher
  16165. {
  16166. public:
  16167. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  16168. ~ComponentDeletionWatcher() throw();
  16169. bool hasBeenDeleted() const throw();
  16170. const Component* getComponent() const throw();
  16171. juce_UseDebuggingNewOperator
  16172. private:
  16173. const Component* const componentToWatch;
  16174. const uint32 componentUID;
  16175. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  16176. ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  16177. };
  16178. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16179. /*** End of inlined file: juce_ComponentDeletionWatcher.h ***/
  16180. #endif
  16181. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16182. #endif
  16183. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16184. #endif
  16185. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16186. #endif
  16187. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16188. #endif
  16189. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16190. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16191. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16192. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16193. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16194. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16195. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16196. class JUCE_API KeyPressMappingSet : public KeyListener,
  16197. public ChangeBroadcaster,
  16198. public FocusChangeListener
  16199. {
  16200. public:
  16201. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16202. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16203. ~KeyPressMappingSet();
  16204. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16205. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16206. void addKeyPress (const CommandID commandID,
  16207. const KeyPress& newKeyPress,
  16208. int insertIndex = -1) throw();
  16209. void resetToDefaultMappings() throw();
  16210. void resetToDefaultMapping (const CommandID commandID) throw();
  16211. void clearAllKeyPresses() throw();
  16212. void clearAllKeyPresses (const CommandID commandID) throw();
  16213. void removeKeyPress (const CommandID commandID,
  16214. const int keyPressIndex) throw();
  16215. void removeKeyPress (const KeyPress& keypress) throw();
  16216. bool containsMapping (const CommandID commandID,
  16217. const KeyPress& keyPress) const throw();
  16218. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16219. bool restoreFromXml (const XmlElement& xmlVersion);
  16220. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16221. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16222. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16223. void globalFocusChanged (Component* focusedComponent);
  16224. juce_UseDebuggingNewOperator
  16225. private:
  16226. ApplicationCommandManager* commandManager;
  16227. struct CommandMapping
  16228. {
  16229. CommandID commandID;
  16230. Array <KeyPress> keypresses;
  16231. bool wantsKeyUpDownCallbacks;
  16232. };
  16233. OwnedArray <CommandMapping> mappings;
  16234. struct KeyPressTime
  16235. {
  16236. KeyPress key;
  16237. uint32 timeWhenPressed;
  16238. };
  16239. OwnedArray <KeyPressTime> keysDown;
  16240. void handleMessage (const Message& message);
  16241. void invokeCommand (const CommandID commandID,
  16242. const KeyPress& keyPress,
  16243. const bool isKeyDown,
  16244. const int millisecsSinceKeyPressed,
  16245. Component* const originatingComponent) const;
  16246. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16247. };
  16248. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16249. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16250. class JUCE_API KeyMappingEditorComponent : public Component,
  16251. public TreeViewItem,
  16252. public ChangeListener,
  16253. private ButtonListener
  16254. {
  16255. public:
  16256. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16257. const bool showResetToDefaultButton);
  16258. virtual ~KeyMappingEditorComponent();
  16259. void setColours (const Colour& mainBackground,
  16260. const Colour& textColour);
  16261. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16262. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16263. virtual bool isCommandReadOnly (const CommandID commandID);
  16264. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16265. enum ColourIds
  16266. {
  16267. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16268. textColourId = 0x100ad01, /**< The colour for the text. */
  16269. };
  16270. void parentHierarchyChanged();
  16271. void resized();
  16272. void changeListenerCallback (void*);
  16273. bool mightContainSubItems();
  16274. const String getUniqueName() const;
  16275. void buttonClicked (Button* button);
  16276. juce_UseDebuggingNewOperator
  16277. private:
  16278. KeyPressMappingSet* mappings;
  16279. TreeView* tree;
  16280. friend class KeyMappingTreeViewItem;
  16281. friend class KeyCategoryTreeViewItem;
  16282. friend class KeyMappingItemComponent;
  16283. friend class KeyMappingChangeButton;
  16284. TextButton* resetButton;
  16285. void assignNewKey (const CommandID commandID, int index);
  16286. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16287. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16288. };
  16289. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16290. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16291. #endif
  16292. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16293. #endif
  16294. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16295. #endif
  16296. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16297. #endif
  16298. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16299. #endif
  16300. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16301. #endif
  16302. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16303. #endif
  16304. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16305. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16306. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16307. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16308. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16309. {
  16310. public:
  16311. ComponentMovementWatcher (Component* const component);
  16312. ~ComponentMovementWatcher();
  16313. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16314. virtual void componentPeerChanged() = 0;
  16315. juce_UseDebuggingNewOperator
  16316. void componentParentHierarchyChanged (Component& component);
  16317. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16318. private:
  16319. Component::SafePointer<Component> component;
  16320. ComponentPeer* lastPeer;
  16321. VoidArray registeredParentComps;
  16322. bool reentrant;
  16323. Rectangle<int> lastBounds;
  16324. void unregister() throw();
  16325. void registerWithParentComps() throw();
  16326. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16327. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16328. };
  16329. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16330. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16331. #endif
  16332. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16333. /*** Start of inlined file: juce_GroupComponent.h ***/
  16334. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16335. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16336. class JUCE_API GroupComponent : public Component
  16337. {
  16338. public:
  16339. GroupComponent (const String& componentName,
  16340. const String& labelText);
  16341. ~GroupComponent();
  16342. void setText (const String& newText) throw();
  16343. const String getText() const throw();
  16344. void setTextLabelPosition (const Justification& justification);
  16345. const Justification getTextLabelPosition() const throw() { return justification; }
  16346. enum ColourIds
  16347. {
  16348. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16349. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16350. };
  16351. void paint (Graphics& g);
  16352. void enablementChanged();
  16353. void colourChanged();
  16354. private:
  16355. String text;
  16356. Justification justification;
  16357. GroupComponent (const GroupComponent&);
  16358. GroupComponent& operator= (const GroupComponent&);
  16359. };
  16360. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16361. /*** End of inlined file: juce_GroupComponent.h ***/
  16362. #endif
  16363. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16364. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16365. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16366. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16367. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16368. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16369. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16370. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16371. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16372. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16373. class TabbedButtonBar;
  16374. class JUCE_API TabBarButton : public Button
  16375. {
  16376. public:
  16377. TabBarButton (const String& name,
  16378. TabbedButtonBar* const ownerBar,
  16379. const int tabIndex);
  16380. ~TabBarButton();
  16381. virtual int getBestTabLength (const int depth);
  16382. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16383. void clicked (const ModifierKeys& mods);
  16384. bool hitTest (int x, int y);
  16385. juce_UseDebuggingNewOperator
  16386. protected:
  16387. friend class TabbedButtonBar;
  16388. TabbedButtonBar* const owner;
  16389. int tabIndex, overlapPixels;
  16390. DropShadowEffect shadow;
  16391. void getActiveArea (int& x, int& y, int& w, int& h);
  16392. private:
  16393. TabBarButton (const TabBarButton&);
  16394. TabBarButton& operator= (const TabBarButton&);
  16395. };
  16396. class JUCE_API TabbedButtonBar : public Component,
  16397. public ChangeBroadcaster,
  16398. public ButtonListener
  16399. {
  16400. public:
  16401. enum Orientation
  16402. {
  16403. TabsAtTop,
  16404. TabsAtBottom,
  16405. TabsAtLeft,
  16406. TabsAtRight
  16407. };
  16408. TabbedButtonBar (const Orientation orientation);
  16409. ~TabbedButtonBar();
  16410. void setOrientation (const Orientation orientation);
  16411. Orientation getOrientation() const throw() { return orientation; }
  16412. void clearTabs();
  16413. void addTab (const String& tabName,
  16414. const Colour& tabBackgroundColour,
  16415. int insertIndex = -1);
  16416. void setTabName (const int tabIndex,
  16417. const String& newName);
  16418. void removeTab (const int tabIndex);
  16419. void moveTab (const int currentIndex,
  16420. const int newIndex);
  16421. int getNumTabs() const;
  16422. const StringArray getTabNames() const;
  16423. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16424. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16425. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16426. TabBarButton* getTabButton (const int index) const;
  16427. virtual void currentTabChanged (const int newCurrentTabIndex,
  16428. const String& newCurrentTabName);
  16429. virtual void popupMenuClickOnTab (const int tabIndex,
  16430. const String& tabName);
  16431. const Colour getTabBackgroundColour (const int tabIndex);
  16432. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16433. enum ColourIds
  16434. {
  16435. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16436. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16437. the look and feel will choose an appropriate colour. */
  16438. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16439. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16440. this isn't specified, the look and feel will choose an appropriate
  16441. colour. */
  16442. };
  16443. void resized();
  16444. void buttonClicked (Button* button);
  16445. void lookAndFeelChanged();
  16446. juce_UseDebuggingNewOperator
  16447. protected:
  16448. virtual TabBarButton* createTabButton (const String& tabName,
  16449. const int tabIndex);
  16450. private:
  16451. Orientation orientation;
  16452. StringArray tabs;
  16453. Array <Colour> tabColours;
  16454. int currentTabIndex;
  16455. Component* behindFrontTab;
  16456. Button* extraTabsButton;
  16457. TabbedButtonBar (const TabbedButtonBar&);
  16458. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16459. };
  16460. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16461. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16462. class JUCE_API TabbedComponent : public Component
  16463. {
  16464. public:
  16465. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16466. ~TabbedComponent();
  16467. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16468. TabbedButtonBar::Orientation getOrientation() const throw();
  16469. void setTabBarDepth (const int newDepth);
  16470. int getTabBarDepth() const throw() { return tabDepth; }
  16471. void setOutline (const int newThickness);
  16472. void setIndent (const int indentThickness);
  16473. void clearTabs();
  16474. void addTab (const String& tabName,
  16475. const Colour& tabBackgroundColour,
  16476. Component* const contentComponent,
  16477. const bool deleteComponentWhenNotNeeded,
  16478. const int insertIndex = -1);
  16479. void setTabName (const int tabIndex,
  16480. const String& newName);
  16481. void removeTab (const int tabIndex);
  16482. int getNumTabs() const;
  16483. const StringArray getTabNames() const;
  16484. Component* getTabContentComponent (const int tabIndex) const throw();
  16485. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16486. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16487. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16488. int getCurrentTabIndex() const;
  16489. const String& getCurrentTabName() const;
  16490. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16491. virtual void currentTabChanged (const int newCurrentTabIndex,
  16492. const String& newCurrentTabName);
  16493. virtual void popupMenuClickOnTab (const int tabIndex,
  16494. const String& tabName);
  16495. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16496. enum ColourIds
  16497. {
  16498. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16499. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16500. (See setOutline) */
  16501. };
  16502. void paint (Graphics& g);
  16503. void resized();
  16504. void lookAndFeelChanged();
  16505. juce_UseDebuggingNewOperator
  16506. protected:
  16507. TabbedButtonBar* tabs;
  16508. virtual TabBarButton* createTabButton (const String& tabName,
  16509. const int tabIndex);
  16510. private:
  16511. Array <Component*> contentComponents;
  16512. Component* panelComponent;
  16513. int tabDepth;
  16514. int outlineThickness, edgeIndent;
  16515. friend class TabCompButtonBar;
  16516. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16517. TabbedComponent (const TabbedComponent&);
  16518. TabbedComponent& operator= (const TabbedComponent&);
  16519. };
  16520. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16521. /*** End of inlined file: juce_TabbedComponent.h ***/
  16522. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16523. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16524. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16525. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16526. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16527. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16528. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16529. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16530. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16531. class MenuBarModel;
  16532. class JUCE_API MenuBarModelListener
  16533. {
  16534. public:
  16535. virtual ~MenuBarModelListener() {}
  16536. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16537. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16538. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16539. };
  16540. class JUCE_API MenuBarModel : private AsyncUpdater,
  16541. private ApplicationCommandManagerListener
  16542. {
  16543. public:
  16544. MenuBarModel() throw();
  16545. virtual ~MenuBarModel();
  16546. void menuItemsChanged();
  16547. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16548. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16549. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16550. virtual const StringArray getMenuBarNames() = 0;
  16551. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16552. const String& menuName) = 0;
  16553. virtual void menuItemSelected (int menuItemID,
  16554. int topLevelMenuIndex) = 0;
  16555. #if JUCE_MAC || DOXYGEN
  16556. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16557. const PopupMenu* extraAppleMenuItems = 0);
  16558. static MenuBarModel* getMacMainMenu();
  16559. #endif
  16560. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16561. void applicationCommandListChanged();
  16562. void handleAsyncUpdate();
  16563. juce_UseDebuggingNewOperator
  16564. private:
  16565. ApplicationCommandManager* manager;
  16566. ListenerList <MenuBarModelListener> listeners;
  16567. MenuBarModel (const MenuBarModel&);
  16568. MenuBarModel& operator= (const MenuBarModel&);
  16569. };
  16570. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16571. /*** End of inlined file: juce_MenuBarModel.h ***/
  16572. class JUCE_API MenuBarComponent : public Component,
  16573. private MenuBarModelListener,
  16574. private Timer
  16575. {
  16576. public:
  16577. MenuBarComponent (MenuBarModel* const model);
  16578. ~MenuBarComponent();
  16579. void setModel (MenuBarModel* const newModel);
  16580. void showMenu (const int menuIndex);
  16581. void paint (Graphics& g);
  16582. void resized();
  16583. void mouseEnter (const MouseEvent& e);
  16584. void mouseExit (const MouseEvent& e);
  16585. void mouseDown (const MouseEvent& e);
  16586. void mouseDrag (const MouseEvent& e);
  16587. void mouseUp (const MouseEvent& e);
  16588. void mouseMove (const MouseEvent& e);
  16589. void inputAttemptWhenModal();
  16590. void handleCommandMessage (int commandId);
  16591. bool keyPressed (const KeyPress& key);
  16592. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16593. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16594. const ApplicationCommandTarget::InvocationInfo& info);
  16595. juce_UseDebuggingNewOperator
  16596. private:
  16597. MenuBarModel* model;
  16598. StringArray menuNames;
  16599. Array <int> xPositions;
  16600. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16601. int lastMouseX, lastMouseY;
  16602. bool inModalState;
  16603. ScopedPointer <Component> currentPopup;
  16604. int getItemAt (int x, int y);
  16605. void updateItemUnderMouse (const int x, const int y);
  16606. void hideCurrentMenu();
  16607. void timerCallback();
  16608. void repaintMenuItem (int index);
  16609. MenuBarComponent (const MenuBarComponent&);
  16610. MenuBarComponent& operator= (const MenuBarComponent&);
  16611. };
  16612. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16613. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16614. class JUCE_API DocumentWindow : public ResizableWindow
  16615. {
  16616. public:
  16617. enum TitleBarButtons
  16618. {
  16619. minimiseButton = 1,
  16620. maximiseButton = 2,
  16621. closeButton = 4,
  16622. allButtons = 7
  16623. };
  16624. DocumentWindow (const String& name,
  16625. const Colour& backgroundColour,
  16626. const int requiredButtons,
  16627. const bool addToDesktop = true);
  16628. ~DocumentWindow();
  16629. void setName (const String& newName);
  16630. void setIcon (const Image* imageToUse);
  16631. void setTitleBarHeight (const int newHeight);
  16632. int getTitleBarHeight() const;
  16633. void setTitleBarButtonsRequired (const int requiredButtons,
  16634. const bool positionTitleBarButtonsOnLeft);
  16635. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16636. void setMenuBar (MenuBarModel* menuBarModel,
  16637. const int menuBarHeight = 0);
  16638. virtual void closeButtonPressed();
  16639. virtual void minimiseButtonPressed();
  16640. virtual void maximiseButtonPressed();
  16641. Button* getCloseButton() const throw();
  16642. Button* getMinimiseButton() const throw();
  16643. Button* getMaximiseButton() const throw();
  16644. enum ColourIds
  16645. {
  16646. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16647. and feel class how this is used. */
  16648. };
  16649. void paint (Graphics& g);
  16650. void resized();
  16651. void lookAndFeelChanged();
  16652. const BorderSize getBorderThickness();
  16653. const BorderSize getContentComponentBorder();
  16654. void mouseDoubleClick (const MouseEvent& e);
  16655. void userTriedToCloseWindow();
  16656. void activeWindowStatusChanged();
  16657. int getDesktopWindowStyleFlags() const;
  16658. void parentHierarchyChanged();
  16659. const Rectangle<int> getTitleBarArea();
  16660. juce_UseDebuggingNewOperator
  16661. private:
  16662. int titleBarHeight, menuBarHeight, requiredButtons;
  16663. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16664. ScopedPointer <Button> titleBarButtons [3];
  16665. ScopedPointer <Image> titleBarIcon;
  16666. ScopedPointer <MenuBarComponent> menuBar;
  16667. MenuBarModel* menuBarModel;
  16668. class ButtonListenerProxy;
  16669. friend class ScopedPointer <ButtonListenerProxy>;
  16670. ScopedPointer <ButtonListenerProxy> buttonListener;
  16671. void repaintTitleBar();
  16672. DocumentWindow (const DocumentWindow&);
  16673. DocumentWindow& operator= (const DocumentWindow&);
  16674. };
  16675. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16676. /*** End of inlined file: juce_DocumentWindow.h ***/
  16677. class MultiDocumentPanel;
  16678. class MDITabbedComponentInternal;
  16679. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16680. {
  16681. public:
  16682. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16683. ~MultiDocumentPanelWindow();
  16684. void maximiseButtonPressed();
  16685. void closeButtonPressed();
  16686. void activeWindowStatusChanged();
  16687. void broughtToFront();
  16688. juce_UseDebuggingNewOperator
  16689. private:
  16690. void updateOrder();
  16691. MultiDocumentPanel* getOwner() const throw();
  16692. };
  16693. class JUCE_API MultiDocumentPanel : public Component,
  16694. private ComponentListener
  16695. {
  16696. public:
  16697. MultiDocumentPanel();
  16698. ~MultiDocumentPanel();
  16699. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16700. bool addDocument (Component* const component,
  16701. const Colour& backgroundColour,
  16702. const bool deleteWhenRemoved);
  16703. bool closeDocument (Component* component,
  16704. const bool checkItsOkToCloseFirst);
  16705. int getNumDocuments() const throw();
  16706. Component* getDocument (const int index) const throw();
  16707. Component* getActiveDocument() const throw();
  16708. void setActiveDocument (Component* component);
  16709. virtual void activeDocumentChanged();
  16710. void setMaximumNumDocuments (const int maximumNumDocuments);
  16711. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16712. bool isFullscreenWhenOneDocument() const throw();
  16713. enum LayoutMode
  16714. {
  16715. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16716. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16717. };
  16718. void setLayoutMode (const LayoutMode newLayoutMode);
  16719. LayoutMode getLayoutMode() const throw() { return mode; }
  16720. void setBackgroundColour (const Colour& newBackgroundColour);
  16721. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16722. virtual bool tryToCloseDocument (Component* component) = 0;
  16723. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16724. void paint (Graphics& g);
  16725. void resized();
  16726. void componentNameChanged (Component&);
  16727. juce_UseDebuggingNewOperator
  16728. private:
  16729. LayoutMode mode;
  16730. Array <Component*> components;
  16731. TabbedComponent* tabComponent;
  16732. Colour backgroundColour;
  16733. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16734. friend class MultiDocumentPanelWindow;
  16735. friend class MDITabbedComponentInternal;
  16736. Component* getContainerComp (Component* c) const;
  16737. void updateOrder();
  16738. void addWindow (Component* component);
  16739. };
  16740. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16741. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16742. #endif
  16743. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16744. #endif
  16745. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16746. #endif
  16747. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16748. #endif
  16749. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16750. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16751. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16752. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16753. class JUCE_API StretchableLayoutManager
  16754. {
  16755. public:
  16756. StretchableLayoutManager();
  16757. ~StretchableLayoutManager();
  16758. void setItemLayout (const int itemIndex,
  16759. const double minimumSize,
  16760. const double maximumSize,
  16761. const double preferredSize);
  16762. bool getItemLayout (const int itemIndex,
  16763. double& minimumSize,
  16764. double& maximumSize,
  16765. double& preferredSize) const;
  16766. void clearAllItems();
  16767. void layOutComponents (Component** const components,
  16768. int numComponents,
  16769. int x, int y, int width, int height,
  16770. const bool vertically,
  16771. const bool resizeOtherDimension);
  16772. int getItemCurrentPosition (const int itemIndex) const;
  16773. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16774. double getItemCurrentRelativeSize (const int itemIndex) const;
  16775. void setItemPosition (const int itemIndex,
  16776. int newPosition);
  16777. juce_UseDebuggingNewOperator
  16778. private:
  16779. struct ItemLayoutProperties
  16780. {
  16781. int itemIndex;
  16782. int currentSize;
  16783. double minSize, maxSize, preferredSize;
  16784. };
  16785. OwnedArray <ItemLayoutProperties> items;
  16786. int totalSize;
  16787. static int sizeToRealSize (double size, int totalSpace);
  16788. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16789. void setTotalSize (const int newTotalSize);
  16790. int fitComponentsIntoSpace (const int startIndex,
  16791. const int endIndex,
  16792. const int availableSpace,
  16793. int startPos);
  16794. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16795. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16796. void updatePrefSizesToMatchCurrentPositions();
  16797. StretchableLayoutManager (const StretchableLayoutManager&);
  16798. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16799. };
  16800. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16801. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16802. #endif
  16803. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16804. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16805. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16806. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16807. class JUCE_API StretchableLayoutResizerBar : public Component
  16808. {
  16809. public:
  16810. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16811. const int itemIndexInLayout,
  16812. const bool isBarVertical);
  16813. ~StretchableLayoutResizerBar();
  16814. virtual void hasBeenMoved();
  16815. void paint (Graphics& g);
  16816. void mouseDown (const MouseEvent& e);
  16817. void mouseDrag (const MouseEvent& e);
  16818. juce_UseDebuggingNewOperator
  16819. private:
  16820. StretchableLayoutManager* layout;
  16821. int itemIndex, mouseDownPos;
  16822. bool isVertical;
  16823. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16824. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16825. };
  16826. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16827. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16828. #endif
  16829. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16830. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16831. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16832. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16833. class StretchableObjectResizer
  16834. {
  16835. public:
  16836. StretchableObjectResizer();
  16837. ~StretchableObjectResizer();
  16838. void addItem (const double currentSize,
  16839. const double minSize,
  16840. const double maxSize,
  16841. const int order = 0);
  16842. void resizeToFit (const double targetSize);
  16843. int getNumItems() const throw() { return items.size(); }
  16844. double getItemSize (const int index) const throw();
  16845. juce_UseDebuggingNewOperator
  16846. private:
  16847. struct Item
  16848. {
  16849. double size;
  16850. double minSize;
  16851. double maxSize;
  16852. int order;
  16853. };
  16854. OwnedArray <Item> items;
  16855. StretchableObjectResizer (const StretchableObjectResizer&);
  16856. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16857. };
  16858. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16859. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16860. #endif
  16861. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16862. #endif
  16863. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16864. #endif
  16865. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16866. #endif
  16867. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16868. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16869. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16870. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16871. /*** Start of inlined file: juce_AlertWindow.h ***/
  16872. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16873. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16874. /*** Start of inlined file: juce_TextLayout.h ***/
  16875. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16876. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16877. class Graphics;
  16878. class JUCE_API TextLayout
  16879. {
  16880. public:
  16881. TextLayout() throw();
  16882. TextLayout (const TextLayout& other) throw();
  16883. TextLayout (const String& text, const Font& font) throw();
  16884. ~TextLayout() throw();
  16885. TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16886. void clear() throw();
  16887. void appendText (const String& textToAppend,
  16888. const Font& fontToUse) throw();
  16889. void setText (const String& newText,
  16890. const Font& fontToUse) throw();
  16891. void layout (int maximumWidth,
  16892. const Justification& justification,
  16893. const bool attemptToBalanceLineLengths) throw();
  16894. int getWidth() const throw();
  16895. int getHeight() const throw();
  16896. int getNumLines() const throw() { return totalLines; }
  16897. int getLineWidth (const int lineNumber) const throw();
  16898. void draw (Graphics& g,
  16899. const int topLeftX,
  16900. const int topLeftY) const throw();
  16901. void drawWithin (Graphics& g,
  16902. int x, int y, int w, int h,
  16903. const Justification& layoutFlags) const throw();
  16904. juce_UseDebuggingNewOperator
  16905. private:
  16906. class Token;
  16907. friend class OwnedArray <Token>;
  16908. OwnedArray <Token> tokens;
  16909. int totalLines;
  16910. };
  16911. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16912. /*** End of inlined file: juce_TextLayout.h ***/
  16913. class JUCE_API AlertWindow : public TopLevelWindow,
  16914. private ButtonListener
  16915. {
  16916. public:
  16917. enum AlertIconType
  16918. {
  16919. NoIcon, /**< No icon will be shown on the dialog box. */
  16920. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16921. user to answer a question. */
  16922. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16923. warning about something and shouldn't be ignored. */
  16924. InfoIcon /**< An icon that indicates that the dialog box is just
  16925. giving the user some information, which doesn't require
  16926. a response from them. */
  16927. };
  16928. AlertWindow (const String& title,
  16929. const String& message,
  16930. AlertIconType iconType,
  16931. Component* associatedComponent = 0);
  16932. ~AlertWindow();
  16933. AlertIconType getAlertType() const throw() { return alertIconType; }
  16934. void setMessage (const String& message);
  16935. void addButton (const String& name,
  16936. const int returnValue,
  16937. const KeyPress& shortcutKey1 = KeyPress(),
  16938. const KeyPress& shortcutKey2 = KeyPress());
  16939. int getNumButtons() const;
  16940. void addTextEditor (const String& name,
  16941. const String& initialContents,
  16942. const String& onScreenLabel = String::empty,
  16943. const bool isPasswordBox = false);
  16944. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16945. void addComboBox (const String& name,
  16946. const StringArray& items,
  16947. const String& onScreenLabel = String::empty);
  16948. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16949. void addTextBlock (const String& text);
  16950. void addProgressBarComponent (double& progressValue);
  16951. void addCustomComponent (Component* const component);
  16952. int getNumCustomComponents() const;
  16953. Component* getCustomComponent (const int index) const;
  16954. Component* removeCustomComponent (const int index);
  16955. bool containsAnyExtraComponents() const;
  16956. // easy-to-use message box functions:
  16957. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16958. const String& title,
  16959. const String& message,
  16960. const String& buttonText = String::empty,
  16961. Component* associatedComponent = 0);
  16962. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16963. const String& title,
  16964. const String& message,
  16965. const String& button1Text = String::empty,
  16966. const String& button2Text = String::empty,
  16967. Component* associatedComponent = 0);
  16968. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16969. const String& title,
  16970. const String& message,
  16971. const String& button1Text = String::empty,
  16972. const String& button2Text = String::empty,
  16973. const String& button3Text = String::empty,
  16974. Component* associatedComponent = 0);
  16975. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16976. const String& bodyText,
  16977. bool isOkCancel);
  16978. enum ColourIds
  16979. {
  16980. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16981. textColourId = 0x1001810, /**< The colour for the text. */
  16982. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16983. };
  16984. juce_UseDebuggingNewOperator
  16985. protected:
  16986. void paint (Graphics& g);
  16987. void mouseDown (const MouseEvent& e);
  16988. void mouseDrag (const MouseEvent& e);
  16989. bool keyPressed (const KeyPress& key);
  16990. void buttonClicked (Button* button);
  16991. void lookAndFeelChanged();
  16992. void userTriedToCloseWindow();
  16993. int getDesktopWindowStyleFlags() const;
  16994. private:
  16995. String text;
  16996. TextLayout textLayout;
  16997. AlertIconType alertIconType;
  16998. ComponentBoundsConstrainer constrainer;
  16999. ComponentDragger dragger;
  17000. Rectangle<int> textArea;
  17001. VoidArray buttons, textBoxes, comboBoxes;
  17002. VoidArray progressBars, customComps, textBlocks, allComps;
  17003. StringArray textboxNames, comboBoxNames;
  17004. Font font;
  17005. Component* associatedComponent;
  17006. void updateLayout (const bool onlyIncreaseSize);
  17007. // disable copy constructor
  17008. AlertWindow (const AlertWindow&);
  17009. AlertWindow& operator= (const AlertWindow&);
  17010. };
  17011. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17012. /*** End of inlined file: juce_AlertWindow.h ***/
  17013. class ToggleButton;
  17014. class TextButton;
  17015. class AlertWindow;
  17016. class TextLayout;
  17017. class ScrollBar;
  17018. class BubbleComponent;
  17019. class ComboBox;
  17020. class Button;
  17021. class FilenameComponent;
  17022. class DocumentWindow;
  17023. class ResizableWindow;
  17024. class GroupComponent;
  17025. class MenuBarComponent;
  17026. class DropShadower;
  17027. class GlyphArrangement;
  17028. class PropertyComponent;
  17029. class TableHeaderComponent;
  17030. class Toolbar;
  17031. class ToolbarItemComponent;
  17032. class PopupMenu;
  17033. class ProgressBar;
  17034. class FileBrowserComponent;
  17035. class DirectoryContentsDisplayComponent;
  17036. class FilePreviewComponent;
  17037. class ImageButton;
  17038. class JUCE_API LookAndFeel
  17039. {
  17040. public:
  17041. LookAndFeel();
  17042. virtual ~LookAndFeel();
  17043. static LookAndFeel& getDefaultLookAndFeel() throw();
  17044. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17045. const Colour findColour (const int colourId) const throw();
  17046. void setColour (const int colourId, const Colour& colour) throw();
  17047. bool isColourSpecified (const int colourId) const throw();
  17048. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17049. void setDefaultSansSerifTypefaceName (const String& newName);
  17050. virtual const MouseCursor getMouseCursorFor (Component& component);
  17051. virtual void drawButtonBackground (Graphics& g,
  17052. Button& button,
  17053. const Colour& backgroundColour,
  17054. bool isMouseOverButton,
  17055. bool isButtonDown);
  17056. virtual const Font getFontForTextButton (TextButton& button);
  17057. virtual void drawButtonText (Graphics& g,
  17058. TextButton& button,
  17059. bool isMouseOverButton,
  17060. bool isButtonDown);
  17061. virtual void drawToggleButton (Graphics& g,
  17062. ToggleButton& button,
  17063. bool isMouseOverButton,
  17064. bool isButtonDown);
  17065. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17066. virtual void drawTickBox (Graphics& g,
  17067. Component& component,
  17068. float x, float y, float w, float h,
  17069. const bool ticked,
  17070. const bool isEnabled,
  17071. const bool isMouseOverButton,
  17072. const bool isButtonDown);
  17073. virtual AlertWindow* createAlertWindow (const String& title,
  17074. const String& message,
  17075. const String& button1,
  17076. const String& button2,
  17077. const String& button3,
  17078. AlertWindow::AlertIconType iconType,
  17079. int numButtons,
  17080. Component* associatedComponent);
  17081. virtual void drawAlertBox (Graphics& g,
  17082. AlertWindow& alert,
  17083. const Rectangle<int>& textArea,
  17084. TextLayout& textLayout);
  17085. virtual int getAlertBoxWindowFlags();
  17086. virtual int getAlertWindowButtonHeight();
  17087. virtual const Font getAlertWindowFont();
  17088. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17089. int width, int height,
  17090. double progress, const String& textToShow);
  17091. // Draws a small image that spins to indicate that something's happening..
  17092. // This method should use the current time to animate itself, so just keep
  17093. // repainting it every so often.
  17094. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17095. int x, int y, int w, int h);
  17096. virtual void drawScrollbarButton (Graphics& g,
  17097. ScrollBar& scrollbar,
  17098. int width, int height,
  17099. int buttonDirection,
  17100. bool isScrollbarVertical,
  17101. bool isMouseOverButton,
  17102. bool isButtonDown);
  17103. virtual void drawScrollbar (Graphics& g,
  17104. ScrollBar& scrollbar,
  17105. int x, int y,
  17106. int width, int height,
  17107. bool isScrollbarVertical,
  17108. int thumbStartPosition,
  17109. int thumbSize,
  17110. bool isMouseOver,
  17111. bool isMouseDown);
  17112. virtual ImageEffectFilter* getScrollbarEffect();
  17113. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17114. virtual int getDefaultScrollbarWidth();
  17115. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17116. virtual const Path getTickShape (const float height);
  17117. virtual const Path getCrossShape (const float height);
  17118. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17119. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17120. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17121. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17122. virtual Image* getDefaultFolderImage();
  17123. virtual Image* getDefaultDocumentFileImage();
  17124. virtual void createFileChooserHeaderText (const String& title,
  17125. const String& instructions,
  17126. GlyphArrangement& destArrangement,
  17127. int width);
  17128. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17129. const String& filename, Image* icon,
  17130. const String& fileSizeDescription,
  17131. const String& fileTimeDescription,
  17132. const bool isDirectory,
  17133. const bool isItemSelected,
  17134. const int itemIndex);
  17135. virtual Button* createFileBrowserGoUpButton();
  17136. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17137. DirectoryContentsDisplayComponent* fileListComponent,
  17138. FilePreviewComponent* previewComp,
  17139. ComboBox* currentPathBox,
  17140. TextEditor* filenameBox,
  17141. Button* goUpButton);
  17142. virtual void drawBubble (Graphics& g,
  17143. float tipX, float tipY,
  17144. float boxX, float boxY, float boxW, float boxH);
  17145. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17146. virtual void drawPopupMenuItem (Graphics& g,
  17147. int width, int height,
  17148. const bool isSeparator,
  17149. const bool isActive,
  17150. const bool isHighlighted,
  17151. const bool isTicked,
  17152. const bool hasSubMenu,
  17153. const String& text,
  17154. const String& shortcutKeyText,
  17155. Image* image,
  17156. const Colour* const textColour);
  17157. virtual const Font getPopupMenuFont();
  17158. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17159. int width, int height,
  17160. bool isScrollUpArrow);
  17161. virtual void getIdealPopupMenuItemSize (const String& text,
  17162. const bool isSeparator,
  17163. int standardMenuItemHeight,
  17164. int& idealWidth,
  17165. int& idealHeight);
  17166. virtual int getMenuWindowFlags();
  17167. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17168. bool isMouseOverBar,
  17169. MenuBarComponent& menuBar);
  17170. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17171. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17172. virtual void drawMenuBarItem (Graphics& g,
  17173. int width, int height,
  17174. int itemIndex,
  17175. const String& itemText,
  17176. bool isMouseOverItem,
  17177. bool isMenuOpen,
  17178. bool isMouseOverBar,
  17179. MenuBarComponent& menuBar);
  17180. virtual void drawComboBox (Graphics& g, int width, int height,
  17181. const bool isButtonDown,
  17182. int buttonX, int buttonY,
  17183. int buttonW, int buttonH,
  17184. ComboBox& box);
  17185. virtual const Font getComboBoxFont (ComboBox& box);
  17186. virtual Label* createComboBoxTextBox (ComboBox& box);
  17187. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17188. virtual void drawLabel (Graphics& g, Label& label);
  17189. virtual void drawLinearSlider (Graphics& g,
  17190. int x, int y,
  17191. int width, int height,
  17192. float sliderPos,
  17193. float minSliderPos,
  17194. float maxSliderPos,
  17195. const Slider::SliderStyle style,
  17196. Slider& slider);
  17197. virtual void drawLinearSliderBackground (Graphics& g,
  17198. int x, int y,
  17199. int width, int height,
  17200. float sliderPos,
  17201. float minSliderPos,
  17202. float maxSliderPos,
  17203. const Slider::SliderStyle style,
  17204. Slider& slider);
  17205. virtual void drawLinearSliderThumb (Graphics& g,
  17206. int x, int y,
  17207. int width, int height,
  17208. float sliderPos,
  17209. float minSliderPos,
  17210. float maxSliderPos,
  17211. const Slider::SliderStyle style,
  17212. Slider& slider);
  17213. virtual int getSliderThumbRadius (Slider& slider);
  17214. virtual void drawRotarySlider (Graphics& g,
  17215. int x, int y,
  17216. int width, int height,
  17217. float sliderPosProportional,
  17218. const float rotaryStartAngle,
  17219. const float rotaryEndAngle,
  17220. Slider& slider);
  17221. virtual Button* createSliderButton (const bool isIncrement);
  17222. virtual Label* createSliderTextBox (Slider& slider);
  17223. virtual ImageEffectFilter* getSliderEffect();
  17224. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17225. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17226. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17227. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17228. ComboBox* filenameBox, Button* browseButton);
  17229. virtual void drawCornerResizer (Graphics& g,
  17230. int w, int h,
  17231. bool isMouseOver,
  17232. bool isMouseDragging);
  17233. virtual void drawResizableFrame (Graphics& g,
  17234. int w, int h,
  17235. const BorderSize& borders);
  17236. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17237. const BorderSize& border,
  17238. ResizableWindow& window);
  17239. virtual void drawResizableWindowBorder (Graphics& g,
  17240. int w, int h,
  17241. const BorderSize& border,
  17242. ResizableWindow& window);
  17243. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17244. Graphics& g, int w, int h,
  17245. int titleSpaceX, int titleSpaceW,
  17246. const Image* icon,
  17247. bool drawTitleTextOnLeft);
  17248. virtual Button* createDocumentWindowButton (int buttonType);
  17249. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17250. int titleBarX, int titleBarY,
  17251. int titleBarW, int titleBarH,
  17252. Button* minimiseButton,
  17253. Button* maximiseButton,
  17254. Button* closeButton,
  17255. bool positionTitleBarButtonsOnLeft);
  17256. virtual int getDefaultMenuBarHeight();
  17257. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17258. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17259. int w, int h,
  17260. bool isVerticalBar,
  17261. bool isMouseOver,
  17262. bool isMouseDragging);
  17263. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17264. const String& text,
  17265. const Justification& position,
  17266. GroupComponent& group);
  17267. virtual void createTabButtonShape (Path& p,
  17268. int width, int height,
  17269. int tabIndex,
  17270. const String& text,
  17271. Button& button,
  17272. TabbedButtonBar::Orientation orientation,
  17273. const bool isMouseOver,
  17274. const bool isMouseDown,
  17275. const bool isFrontTab);
  17276. virtual void fillTabButtonShape (Graphics& g,
  17277. const Path& path,
  17278. const Colour& preferredBackgroundColour,
  17279. int tabIndex,
  17280. const String& text,
  17281. Button& button,
  17282. TabbedButtonBar::Orientation orientation,
  17283. const bool isMouseOver,
  17284. const bool isMouseDown,
  17285. const bool isFrontTab);
  17286. virtual void drawTabButtonText (Graphics& g,
  17287. int x, int y, int w, int h,
  17288. const Colour& preferredBackgroundColour,
  17289. int tabIndex,
  17290. const String& text,
  17291. Button& button,
  17292. TabbedButtonBar::Orientation orientation,
  17293. const bool isMouseOver,
  17294. const bool isMouseDown,
  17295. const bool isFrontTab);
  17296. virtual int getTabButtonOverlap (int tabDepth);
  17297. virtual int getTabButtonSpaceAroundImage();
  17298. virtual int getTabButtonBestWidth (int tabIndex,
  17299. const String& text,
  17300. int tabDepth,
  17301. Button& button);
  17302. virtual void drawTabButton (Graphics& g,
  17303. int w, int h,
  17304. const Colour& preferredColour,
  17305. int tabIndex,
  17306. const String& text,
  17307. Button& button,
  17308. TabbedButtonBar::Orientation orientation,
  17309. const bool isMouseOver,
  17310. const bool isMouseDown,
  17311. const bool isFrontTab);
  17312. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17313. int w, int h,
  17314. TabbedButtonBar& tabBar,
  17315. TabbedButtonBar::Orientation orientation);
  17316. virtual Button* createTabBarExtrasButton();
  17317. virtual void drawImageButton (Graphics& g, Image* image,
  17318. int imageX, int imageY, int imageW, int imageH,
  17319. const Colour& overlayColour,
  17320. float imageOpacity,
  17321. ImageButton& button);
  17322. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17323. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17324. int width, int height,
  17325. bool isMouseOver, bool isMouseDown,
  17326. int columnFlags);
  17327. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17328. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17329. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17330. bool isMouseOver, bool isMouseDown,
  17331. ToolbarItemComponent& component);
  17332. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17333. const String& text, ToolbarItemComponent& component);
  17334. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17335. bool isOpen, int width, int height);
  17336. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17337. PropertyComponent& component);
  17338. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17339. PropertyComponent& component);
  17340. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17341. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17342. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17343. virtual void playAlertSound();
  17344. static void drawGlassSphere (Graphics& g,
  17345. const float x, const float y,
  17346. const float diameter,
  17347. const Colour& colour,
  17348. const float outlineThickness) throw();
  17349. static void drawGlassPointer (Graphics& g,
  17350. const float x, const float y,
  17351. const float diameter,
  17352. const Colour& colour, const float outlineThickness,
  17353. const int direction) throw();
  17354. static void drawGlassLozenge (Graphics& g,
  17355. const float x, const float y,
  17356. const float width, const float height,
  17357. const Colour& colour,
  17358. const float outlineThickness,
  17359. const float cornerSize,
  17360. const bool flatOnLeft, const bool flatOnRight,
  17361. const bool flatOnTop, const bool flatOnBottom) throw();
  17362. juce_UseDebuggingNewOperator
  17363. private:
  17364. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17365. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17366. Array <int> colourIds;
  17367. Array <Colour> colours;
  17368. // default typeface names
  17369. String defaultSans, defaultSerif, defaultFixed;
  17370. void drawShinyButtonShape (Graphics& g,
  17371. float x, float y, float w, float h, float maxCornerSize,
  17372. const Colour& baseColour,
  17373. const float strokeWidth,
  17374. const bool flatOnLeft,
  17375. const bool flatOnRight,
  17376. const bool flatOnTop,
  17377. const bool flatOnBottom) throw();
  17378. LookAndFeel (const LookAndFeel&);
  17379. LookAndFeel& operator= (const LookAndFeel&);
  17380. };
  17381. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17382. /*** End of inlined file: juce_LookAndFeel.h ***/
  17383. #endif
  17384. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17385. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17386. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17387. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17388. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17389. {
  17390. public:
  17391. OldSchoolLookAndFeel();
  17392. virtual ~OldSchoolLookAndFeel();
  17393. virtual void drawButtonBackground (Graphics& g,
  17394. Button& button,
  17395. const Colour& backgroundColour,
  17396. bool isMouseOverButton,
  17397. bool isButtonDown);
  17398. virtual void drawToggleButton (Graphics& g,
  17399. ToggleButton& button,
  17400. bool isMouseOverButton,
  17401. bool isButtonDown);
  17402. virtual void drawTickBox (Graphics& g,
  17403. Component& component,
  17404. float x, float y, float w, float h,
  17405. const bool ticked,
  17406. const bool isEnabled,
  17407. const bool isMouseOverButton,
  17408. const bool isButtonDown);
  17409. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17410. int width, int height,
  17411. double progress, const String& textToShow);
  17412. virtual void drawScrollbarButton (Graphics& g,
  17413. ScrollBar& scrollbar,
  17414. int width, int height,
  17415. int buttonDirection,
  17416. bool isScrollbarVertical,
  17417. bool isMouseOverButton,
  17418. bool isButtonDown);
  17419. virtual void drawScrollbar (Graphics& g,
  17420. ScrollBar& scrollbar,
  17421. int x, int y,
  17422. int width, int height,
  17423. bool isScrollbarVertical,
  17424. int thumbStartPosition,
  17425. int thumbSize,
  17426. bool isMouseOver,
  17427. bool isMouseDown);
  17428. virtual ImageEffectFilter* getScrollbarEffect();
  17429. virtual void drawTextEditorOutline (Graphics& g,
  17430. int width, int height,
  17431. TextEditor& textEditor);
  17432. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17433. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17434. bool isMouseOverBar,
  17435. MenuBarComponent& menuBar);
  17436. virtual void drawComboBox (Graphics& g, int width, int height,
  17437. const bool isButtonDown,
  17438. int buttonX, int buttonY,
  17439. int buttonW, int buttonH,
  17440. ComboBox& box);
  17441. virtual const Font getComboBoxFont (ComboBox& box);
  17442. virtual void drawLinearSlider (Graphics& g,
  17443. int x, int y,
  17444. int width, int height,
  17445. float sliderPos,
  17446. float minSliderPos,
  17447. float maxSliderPos,
  17448. const Slider::SliderStyle style,
  17449. Slider& slider);
  17450. virtual int getSliderThumbRadius (Slider& slider);
  17451. virtual Button* createSliderButton (const bool isIncrement);
  17452. virtual ImageEffectFilter* getSliderEffect();
  17453. virtual void drawCornerResizer (Graphics& g,
  17454. int w, int h,
  17455. bool isMouseOver,
  17456. bool isMouseDragging);
  17457. virtual Button* createDocumentWindowButton (int buttonType);
  17458. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17459. int titleBarX, int titleBarY,
  17460. int titleBarW, int titleBarH,
  17461. Button* minimiseButton,
  17462. Button* maximiseButton,
  17463. Button* closeButton,
  17464. bool positionTitleBarButtonsOnLeft);
  17465. juce_UseDebuggingNewOperator
  17466. private:
  17467. DropShadowEffect scrollbarShadow;
  17468. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17469. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17470. };
  17471. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17472. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17473. #endif
  17474. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17475. #endif
  17476. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17477. #endif
  17478. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17479. #endif
  17480. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17481. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17482. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17483. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17484. class JUCE_API PopupMenuCustomComponent : public Component,
  17485. public ReferenceCountedObject
  17486. {
  17487. public:
  17488. ~PopupMenuCustomComponent();
  17489. virtual void getIdealSize (int& idealWidth,
  17490. int& idealHeight) = 0;
  17491. void triggerMenuItem();
  17492. bool isItemHighlighted() const throw() { return isHighlighted; }
  17493. protected:
  17494. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17495. private:
  17496. friend class PopupMenu;
  17497. friend class PopupMenu::ItemComponent;
  17498. friend class PopupMenu::Window;
  17499. bool isHighlighted, isTriggeredAutomatically;
  17500. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17501. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17502. };
  17503. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17504. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17505. #endif
  17506. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17507. #endif
  17508. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17509. #endif
  17510. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17511. #endif
  17512. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17513. #endif
  17514. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17515. /*** Start of inlined file: juce_LassoComponent.h ***/
  17516. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17517. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17518. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17519. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17520. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17521. template <class SelectableItemType>
  17522. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17523. {
  17524. public:
  17525. SelectedItemSet()
  17526. {
  17527. }
  17528. SelectedItemSet (const Array <SelectableItemType>& items)
  17529. : selectedItems (items)
  17530. {
  17531. }
  17532. SelectedItemSet (const SelectedItemSet& other)
  17533. : selectedItems (other.selectedItems)
  17534. {
  17535. }
  17536. SelectedItemSet& operator= (const SelectedItemSet& other)
  17537. {
  17538. if (selectedItems != other.selectedItems)
  17539. {
  17540. selectedItems = other.selectedItems;
  17541. changed();
  17542. }
  17543. return *this;
  17544. }
  17545. ~SelectedItemSet()
  17546. {
  17547. }
  17548. void selectOnly (SelectableItemType item)
  17549. {
  17550. if (isSelected (item))
  17551. {
  17552. for (int i = selectedItems.size(); --i >= 0;)
  17553. {
  17554. if (selectedItems.getUnchecked(i) != item)
  17555. {
  17556. deselect (selectedItems.getUnchecked(i));
  17557. i = jmin (i, selectedItems.size());
  17558. }
  17559. }
  17560. }
  17561. else
  17562. {
  17563. deselectAll();
  17564. changed();
  17565. selectedItems.add (item);
  17566. itemSelected (item);
  17567. }
  17568. }
  17569. void addToSelection (SelectableItemType item)
  17570. {
  17571. if (! isSelected (item))
  17572. {
  17573. changed();
  17574. selectedItems.add (item);
  17575. itemSelected (item);
  17576. }
  17577. }
  17578. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17579. const ModifierKeys& modifiers)
  17580. {
  17581. if (modifiers.isShiftDown())
  17582. {
  17583. addToSelection (item);
  17584. }
  17585. else if (modifiers.isCommandDown())
  17586. {
  17587. if (isSelected (item))
  17588. deselect (item);
  17589. else
  17590. addToSelection (item);
  17591. }
  17592. else
  17593. {
  17594. selectOnly (item);
  17595. }
  17596. }
  17597. bool addToSelectionOnMouseDown (SelectableItemType item,
  17598. const ModifierKeys& modifiers)
  17599. {
  17600. if (isSelected (item))
  17601. {
  17602. return ! modifiers.isPopupMenu();
  17603. }
  17604. else
  17605. {
  17606. addToSelectionBasedOnModifiers (item, modifiers);
  17607. return false;
  17608. }
  17609. }
  17610. void addToSelectionOnMouseUp (SelectableItemType item,
  17611. const ModifierKeys& modifiers,
  17612. const bool wasItemDragged,
  17613. const bool resultOfMouseDownSelectMethod)
  17614. {
  17615. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17616. addToSelectionBasedOnModifiers (item, modifiers);
  17617. }
  17618. void deselect (SelectableItemType item)
  17619. {
  17620. const int i = selectedItems.indexOf (item);
  17621. if (i >= 0)
  17622. {
  17623. changed();
  17624. itemDeselected (selectedItems.remove (i));
  17625. }
  17626. }
  17627. void deselectAll()
  17628. {
  17629. if (selectedItems.size() > 0)
  17630. {
  17631. changed();
  17632. for (int i = selectedItems.size(); --i >= 0;)
  17633. {
  17634. itemDeselected (selectedItems.remove (i));
  17635. i = jmin (i, selectedItems.size());
  17636. }
  17637. }
  17638. }
  17639. int getNumSelected() const throw()
  17640. {
  17641. return selectedItems.size();
  17642. }
  17643. SelectableItemType getSelectedItem (const int index) const throw()
  17644. {
  17645. return selectedItems [index];
  17646. }
  17647. bool isSelected (const SelectableItemType item) const throw()
  17648. {
  17649. return selectedItems.contains (item);
  17650. }
  17651. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17652. virtual void itemSelected (SelectableItemType item) {}
  17653. virtual void itemDeselected (SelectableItemType item) {}
  17654. void changed (const bool synchronous = false)
  17655. {
  17656. if (synchronous)
  17657. sendSynchronousChangeMessage (this);
  17658. else
  17659. sendChangeMessage (this);
  17660. }
  17661. juce_UseDebuggingNewOperator
  17662. private:
  17663. Array <SelectableItemType> selectedItems;
  17664. };
  17665. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17666. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17667. template <class SelectableItemType>
  17668. class LassoSource
  17669. {
  17670. public:
  17671. virtual ~LassoSource() {}
  17672. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17673. int x, int y, int width, int height) = 0;
  17674. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17675. };
  17676. template <class SelectableItemType>
  17677. class LassoComponent : public Component
  17678. {
  17679. public:
  17680. LassoComponent (const int outlineThickness_ = 1)
  17681. : source (0),
  17682. outlineThickness (outlineThickness_)
  17683. {
  17684. }
  17685. ~LassoComponent()
  17686. {
  17687. }
  17688. void beginLasso (const MouseEvent& e,
  17689. LassoSource <SelectableItemType>* const lassoSource)
  17690. {
  17691. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17692. jassert (lassoSource != 0); // the source can't be null!
  17693. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17694. source = lassoSource;
  17695. if (lassoSource != 0)
  17696. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17697. setSize (0, 0);
  17698. }
  17699. void dragLasso (const MouseEvent& e)
  17700. {
  17701. if (source != 0)
  17702. {
  17703. const int x1 = e.getMouseDownX();
  17704. const int y1 = e.getMouseDownY();
  17705. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17706. setVisible (true);
  17707. Array <SelectableItemType> itemsInLasso;
  17708. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17709. if (e.mods.isShiftDown())
  17710. {
  17711. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17712. itemsInLasso.addArray (originalSelection);
  17713. }
  17714. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17715. {
  17716. Array <SelectableItemType> originalMinusNew (originalSelection);
  17717. originalMinusNew.removeValuesIn (itemsInLasso);
  17718. itemsInLasso.removeValuesIn (originalSelection);
  17719. itemsInLasso.addArray (originalMinusNew);
  17720. }
  17721. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17722. }
  17723. }
  17724. void endLasso()
  17725. {
  17726. source = 0;
  17727. originalSelection.clear();
  17728. setVisible (false);
  17729. }
  17730. enum ColourIds
  17731. {
  17732. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17733. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17734. };
  17735. void paint (Graphics& g)
  17736. {
  17737. g.fillAll (findColour (lassoFillColourId));
  17738. g.setColour (findColour (lassoOutlineColourId));
  17739. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17740. // this suggests that you've left a lasso comp lying around after the
  17741. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17742. // mouse-up event.
  17743. jassert (isMouseButtonDownAnywhere());
  17744. }
  17745. bool hitTest (int x, int y) { return false; }
  17746. juce_UseDebuggingNewOperator
  17747. private:
  17748. Array <SelectableItemType> originalSelection;
  17749. LassoSource <SelectableItemType>* source;
  17750. int outlineThickness;
  17751. };
  17752. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17753. /*** End of inlined file: juce_LassoComponent.h ***/
  17754. #endif
  17755. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17756. #endif
  17757. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17758. #endif
  17759. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17760. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17761. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17762. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17763. class JUCE_API MouseHoverDetector
  17764. {
  17765. public:
  17766. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17767. virtual ~MouseHoverDetector();
  17768. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17769. void setHoverComponent (Component* const newSourceComponent);
  17770. protected:
  17771. virtual void mouseHovered (int mouseX,
  17772. int mouseY) = 0;
  17773. virtual void mouseMovedAfterHover() = 0;
  17774. private:
  17775. class JUCE_API HoverDetectorInternal : public MouseListener,
  17776. public Timer
  17777. {
  17778. public:
  17779. MouseHoverDetector* owner;
  17780. int lastX, lastY;
  17781. void timerCallback();
  17782. void mouseEnter (const MouseEvent&);
  17783. void mouseExit (const MouseEvent&);
  17784. void mouseDown (const MouseEvent&);
  17785. void mouseUp (const MouseEvent&);
  17786. void mouseMove (const MouseEvent&);
  17787. void mouseWheelMove (const MouseEvent&, float, float);
  17788. } internalTimer;
  17789. friend class HoverDetectorInternal;
  17790. Component* source;
  17791. int hoverTimeMillisecs;
  17792. bool hasJustHovered;
  17793. void hoverTimerCallback();
  17794. void checkJustHoveredCallback();
  17795. MouseHoverDetector (const MouseHoverDetector&);
  17796. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17797. };
  17798. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17799. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17800. #endif
  17801. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17802. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17803. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17804. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17805. class Component;
  17806. class ComponentPeer;
  17807. class MouseInputSourceInternal;
  17808. class JUCE_API MouseInputSource
  17809. {
  17810. public:
  17811. MouseInputSource (int index, bool isMouseDevice);
  17812. ~MouseInputSource();
  17813. bool isMouse() const;
  17814. bool isTouch() const;
  17815. bool canHover() const;
  17816. bool hasMouseWheel() const;
  17817. int getIndex() const;
  17818. bool isDragging() const;
  17819. const Point<int> getScreenPosition() const;
  17820. const ModifierKeys getCurrentModifiers() const;
  17821. Component* getComponentUnderMouse() const;
  17822. void triggerFakeMove() const;
  17823. int getNumberOfMultipleClicks() const throw();
  17824. const Time getLastMouseDownTime() const throw();
  17825. const Point<int> getLastMouseDownPosition() const throw();
  17826. bool hasMouseMovedSignificantlySincePressed() const throw();
  17827. bool hasMouseCursor() const throw();
  17828. void showMouseCursor (const MouseCursor& cursor);
  17829. void hideCursor();
  17830. void revealCursor();
  17831. bool canDoUnboundedMovement() const throw();
  17832. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17833. juce_UseDebuggingNewOperator
  17834. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17835. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17836. private:
  17837. friend class Desktop;
  17838. friend class ComponentPeer;
  17839. friend class MouseInputSourceInternal;
  17840. ScopedPointer<MouseInputSourceInternal> pimpl;
  17841. MouseInputSource (const MouseInputSource&);
  17842. MouseInputSource& operator= (const MouseInputSource&);
  17843. };
  17844. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17845. /*** End of inlined file: juce_MouseInputSource.h ***/
  17846. #endif
  17847. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17848. #endif
  17849. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17850. #endif
  17851. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17852. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17853. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17854. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17855. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17856. private ButtonListener
  17857. {
  17858. protected:
  17859. BooleanPropertyComponent (const String& propertyName,
  17860. const String& buttonTextWhenTrue,
  17861. const String& buttonTextWhenFalse);
  17862. public:
  17863. BooleanPropertyComponent (const Value& valueToControl,
  17864. const String& propertyName,
  17865. const String& buttonText);
  17866. ~BooleanPropertyComponent();
  17867. virtual void setState (const bool newState);
  17868. virtual bool getState() const;
  17869. void paint (Graphics& g);
  17870. void refresh();
  17871. void buttonClicked (Button*);
  17872. juce_UseDebuggingNewOperator
  17873. private:
  17874. ToggleButton* button;
  17875. String onText, offText;
  17876. void createButton();
  17877. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17878. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17879. };
  17880. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17881. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17882. #endif
  17883. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17884. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17885. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17886. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17887. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17888. private ButtonListener
  17889. {
  17890. public:
  17891. ButtonPropertyComponent (const String& propertyName,
  17892. const bool triggerOnMouseDown);
  17893. ~ButtonPropertyComponent();
  17894. virtual void buttonClicked() = 0;
  17895. virtual const String getButtonText() const = 0;
  17896. void refresh();
  17897. void buttonClicked (Button*);
  17898. juce_UseDebuggingNewOperator
  17899. private:
  17900. TextButton* button;
  17901. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17902. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17903. };
  17904. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17905. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17906. #endif
  17907. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17908. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17909. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17910. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17911. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17912. private ComboBoxListener
  17913. {
  17914. protected:
  17915. ChoicePropertyComponent (const String& propertyName);
  17916. public:
  17917. ChoicePropertyComponent (const Value& valueToControl,
  17918. const String& propertyName,
  17919. const StringArray& choices,
  17920. const Array <int>* choiceIDs = 0);
  17921. ~ChoicePropertyComponent();
  17922. virtual void setIndex (const int newIndex);
  17923. virtual int getIndex() const;
  17924. const StringArray& getChoices() const;
  17925. void refresh();
  17926. void comboBoxChanged (ComboBox*);
  17927. juce_UseDebuggingNewOperator
  17928. protected:
  17929. StringArray choices;
  17930. private:
  17931. ComboBox* comboBox;
  17932. void createComboBox (const Array <int>* choiceIDs);
  17933. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17934. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17935. };
  17936. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17937. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17938. #endif
  17939. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17940. #endif
  17941. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17942. #endif
  17943. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17944. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17945. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17946. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17947. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17948. private SliderListener
  17949. {
  17950. protected:
  17951. SliderPropertyComponent (const String& propertyName,
  17952. const double rangeMin,
  17953. const double rangeMax,
  17954. const double interval,
  17955. const double skewFactor = 1.0);
  17956. public:
  17957. SliderPropertyComponent (Value& valueToControl,
  17958. const String& propertyName,
  17959. const double rangeMin,
  17960. const double rangeMax,
  17961. const double interval,
  17962. const double skewFactor = 1.0);
  17963. ~SliderPropertyComponent();
  17964. virtual void setValue (const double newValue);
  17965. virtual const double getValue() const;
  17966. void refresh();
  17967. void changeListenerCallback (void*);
  17968. void sliderValueChanged (Slider*);
  17969. juce_UseDebuggingNewOperator
  17970. protected:
  17971. Slider* slider;
  17972. SliderPropertyComponent (const SliderPropertyComponent&);
  17973. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17974. };
  17975. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17976. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  17977. #endif
  17978. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17979. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  17980. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17981. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17982. class JUCE_API TextPropertyComponent : public PropertyComponent
  17983. {
  17984. protected:
  17985. TextPropertyComponent (const String& propertyName,
  17986. const int maxNumChars,
  17987. const bool isMultiLine);
  17988. public:
  17989. TextPropertyComponent (const Value& valueToControl,
  17990. const String& propertyName,
  17991. const int maxNumChars,
  17992. const bool isMultiLine);
  17993. ~TextPropertyComponent();
  17994. virtual void setText (const String& newText);
  17995. virtual const String getText() const;
  17996. void refresh();
  17997. void textWasEdited();
  17998. juce_UseDebuggingNewOperator
  17999. private:
  18000. Label* textEditor;
  18001. void createEditor (const int maxNumChars, const bool isMultiLine);
  18002. TextPropertyComponent (const TextPropertyComponent&);
  18003. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18004. };
  18005. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18006. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18007. #endif
  18008. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18009. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18010. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18011. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18012. #if JUCE_WINDOWS || DOXYGEN
  18013. class JUCE_API ActiveXControlComponent : public Component
  18014. {
  18015. public:
  18016. ActiveXControlComponent();
  18017. ~ActiveXControlComponent();
  18018. bool createControl (const void* controlIID);
  18019. void deleteControl();
  18020. bool isControlOpen() const throw() { return control != 0; }
  18021. void* queryInterface (const void* iid) const;
  18022. void setMouseEventsAllowed (const bool eventsCanReachControl);
  18023. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18024. void paint (Graphics& g);
  18025. void* originalWndProc;
  18026. juce_UseDebuggingNewOperator
  18027. private:
  18028. class ActiveXControlData;
  18029. friend class ActiveXControlData;
  18030. void* control;
  18031. bool mouseEventsAllowed;
  18032. ActiveXControlComponent (const ActiveXControlComponent&);
  18033. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18034. void setControlBounds (const Rectangle<int>& bounds) const;
  18035. void setControlVisible (const bool b) const;
  18036. };
  18037. #endif
  18038. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18039. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18040. #endif
  18041. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18042. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18043. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18044. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18045. class MidiInputSelectorComponentListBox;
  18046. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18047. public ComboBoxListener,
  18048. public ButtonListener,
  18049. public ChangeListener
  18050. {
  18051. public:
  18052. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18053. const int minAudioInputChannels,
  18054. const int maxAudioInputChannels,
  18055. const int minAudioOutputChannels,
  18056. const int maxAudioOutputChannels,
  18057. const bool showMidiInputOptions,
  18058. const bool showMidiOutputSelector,
  18059. const bool showChannelsAsStereoPairs,
  18060. const bool hideAdvancedOptionsWithButton);
  18061. ~AudioDeviceSelectorComponent();
  18062. void resized();
  18063. void comboBoxChanged (ComboBox*);
  18064. void buttonClicked (Button*);
  18065. void changeListenerCallback (void*);
  18066. void childBoundsChanged (Component*);
  18067. juce_UseDebuggingNewOperator
  18068. private:
  18069. AudioDeviceManager& deviceManager;
  18070. ComboBox* deviceTypeDropDown;
  18071. Label* deviceTypeDropDownLabel;
  18072. Component* audioDeviceSettingsComp;
  18073. String audioDeviceSettingsCompType;
  18074. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18075. const bool showChannelsAsStereoPairs;
  18076. const bool hideAdvancedOptionsWithButton;
  18077. MidiInputSelectorComponentListBox* midiInputsList;
  18078. Label* midiInputsLabel;
  18079. ComboBox* midiOutputSelector;
  18080. Label* midiOutputLabel;
  18081. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18082. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18083. };
  18084. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18085. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18086. #endif
  18087. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18088. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18089. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18090. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18091. class JUCE_API BubbleComponent : public Component
  18092. {
  18093. protected:
  18094. BubbleComponent();
  18095. public:
  18096. ~BubbleComponent();
  18097. enum BubblePlacement
  18098. {
  18099. above = 1,
  18100. below = 2,
  18101. left = 4,
  18102. right = 8
  18103. };
  18104. void setAllowedPlacement (const int newPlacement);
  18105. void setPosition (Component* componentToPointTo);
  18106. void setPosition (const int arrowTipX,
  18107. const int arrowTipY);
  18108. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18109. protected:
  18110. virtual void getContentSize (int& width, int& height) = 0;
  18111. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18112. public:
  18113. void paint (Graphics& g);
  18114. juce_UseDebuggingNewOperator
  18115. private:
  18116. Rectangle<int> content;
  18117. int side, allowablePlacements;
  18118. float arrowTipX, arrowTipY;
  18119. DropShadowEffect shadow;
  18120. BubbleComponent (const BubbleComponent&);
  18121. BubbleComponent& operator= (const BubbleComponent&);
  18122. };
  18123. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18124. /*** End of inlined file: juce_BubbleComponent.h ***/
  18125. #endif
  18126. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18127. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18128. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18129. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18130. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18131. private Timer
  18132. {
  18133. public:
  18134. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  18135. ~BubbleMessageComponent();
  18136. void showAt (int x, int y,
  18137. const String& message,
  18138. const int numMillisecondsBeforeRemoving,
  18139. const bool removeWhenMouseClicked = true,
  18140. const bool deleteSelfAfterUse = false);
  18141. void showAt (Component* const component,
  18142. const String& message,
  18143. const int numMillisecondsBeforeRemoving,
  18144. const bool removeWhenMouseClicked = true,
  18145. const bool deleteSelfAfterUse = false);
  18146. void getContentSize (int& w, int& h);
  18147. void paintContent (Graphics& g, int w, int h);
  18148. void timerCallback();
  18149. juce_UseDebuggingNewOperator
  18150. private:
  18151. int fadeOutLength, mouseClickCounter;
  18152. TextLayout textLayout;
  18153. int64 expiryTime;
  18154. bool deleteAfterUse;
  18155. void init (const int numMillisecondsBeforeRemoving,
  18156. const bool removeWhenMouseClicked,
  18157. const bool deleteSelfAfterUse);
  18158. BubbleMessageComponent (const BubbleMessageComponent&);
  18159. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18160. };
  18161. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18162. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18163. #endif
  18164. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18165. /*** Start of inlined file: juce_ColourSelector.h ***/
  18166. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18167. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18168. class JUCE_API ColourSelector : public Component,
  18169. public ChangeBroadcaster,
  18170. protected SliderListener
  18171. {
  18172. public:
  18173. enum ColourSelectorOptions
  18174. {
  18175. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18176. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18177. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18178. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18179. };
  18180. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18181. const int edgeGap = 4,
  18182. const int gapAroundColourSpaceComponent = 7);
  18183. ~ColourSelector();
  18184. const Colour getCurrentColour() const;
  18185. void setCurrentColour (const Colour& newColour);
  18186. virtual int getNumSwatches() const;
  18187. virtual const Colour getSwatchColour (const int index) const;
  18188. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  18189. enum ColourIds
  18190. {
  18191. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18192. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18193. };
  18194. juce_UseDebuggingNewOperator
  18195. private:
  18196. friend class ColourSpaceView;
  18197. friend class HueSelectorComp;
  18198. Colour colour;
  18199. float h, s, v;
  18200. Slider* sliders[4];
  18201. Component* colourSpace;
  18202. Component* hueSelector;
  18203. class SwatchComponent;
  18204. OwnedArray <SwatchComponent> swatchComponents;
  18205. const int flags;
  18206. int topSpace, edgeGap;
  18207. void setHue (float newH);
  18208. void setSV (float newS, float newV);
  18209. void updateHSV();
  18210. void update();
  18211. void sliderValueChanged (Slider*);
  18212. void paint (Graphics& g);
  18213. void resized();
  18214. ColourSelector (const ColourSelector&);
  18215. ColourSelector& operator= (const ColourSelector&);
  18216. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18217. // have changed - if you get an error here, update your code to use the new constructor instead..
  18218. // (xxx - note to self: remember to remove this at some point in the future)
  18219. ColourSelector (const bool);
  18220. };
  18221. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18222. /*** End of inlined file: juce_ColourSelector.h ***/
  18223. #endif
  18224. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18225. #endif
  18226. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18227. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18228. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18229. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18230. class JUCE_API MagnifierComponent : public Component
  18231. {
  18232. public:
  18233. MagnifierComponent (Component* const contentComponent,
  18234. const bool deleteContentCompWhenNoLongerNeeded);
  18235. ~MagnifierComponent();
  18236. Component* getContentComponent() const { return content; }
  18237. void setScaleFactor (double newScaleFactor);
  18238. double getScaleFactor() const { return scaleFactor; }
  18239. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18240. juce_UseDebuggingNewOperator
  18241. void childBoundsChanged (Component*);
  18242. private:
  18243. Component* content;
  18244. Component* holderComp;
  18245. double scaleFactor;
  18246. ComponentPeer* peer;
  18247. bool deleteContent;
  18248. Graphics::ResamplingQuality quality;
  18249. MouseInputSource mouseSource;
  18250. void paint (Graphics& g);
  18251. void mouseDown (const MouseEvent& e);
  18252. void mouseUp (const MouseEvent& e);
  18253. void mouseDrag (const MouseEvent& e);
  18254. void mouseMove (const MouseEvent& e);
  18255. void mouseEnter (const MouseEvent& e);
  18256. void mouseExit (const MouseEvent& e);
  18257. void mouseWheelMove (const MouseEvent& e, float, float);
  18258. void passOnMouseEventToPeer (const MouseEvent& e);
  18259. int scaleInt (const int n) const;
  18260. MagnifierComponent (const MagnifierComponent&);
  18261. MagnifierComponent& operator= (const MagnifierComponent&);
  18262. };
  18263. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18264. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18265. #endif
  18266. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18267. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18268. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18269. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18270. class JUCE_API MidiKeyboardComponent : public Component,
  18271. public MidiKeyboardStateListener,
  18272. public ChangeBroadcaster,
  18273. private Timer,
  18274. private AsyncUpdater
  18275. {
  18276. public:
  18277. enum Orientation
  18278. {
  18279. horizontalKeyboard,
  18280. verticalKeyboardFacingLeft,
  18281. verticalKeyboardFacingRight,
  18282. };
  18283. MidiKeyboardComponent (MidiKeyboardState& state,
  18284. const Orientation orientation);
  18285. ~MidiKeyboardComponent();
  18286. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18287. void setMidiChannel (const int midiChannelNumber);
  18288. int getMidiChannel() const throw() { return midiChannel; }
  18289. void setMidiChannelsToDisplay (const int midiChannelMask);
  18290. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18291. void setKeyWidth (const float widthInPixels);
  18292. float getKeyWidth() const throw() { return keyWidth; }
  18293. void setOrientation (const Orientation newOrientation);
  18294. const Orientation getOrientation() const throw() { return orientation; }
  18295. void setAvailableRange (const int lowestNote,
  18296. const int highestNote);
  18297. int getRangeStart() const throw() { return rangeStart; }
  18298. int getRangeEnd() const throw() { return rangeEnd; }
  18299. void setLowestVisibleKey (int noteNumber);
  18300. int getLowestVisibleKey() const throw() { return firstKey; }
  18301. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18302. void setScrollButtonsVisible (const bool canScroll);
  18303. enum ColourIds
  18304. {
  18305. whiteNoteColourId = 0x1005000,
  18306. blackNoteColourId = 0x1005001,
  18307. keySeparatorLineColourId = 0x1005002,
  18308. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18309. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18310. textLabelColourId = 0x1005005,
  18311. upDownButtonBackgroundColourId = 0x1005006,
  18312. upDownButtonArrowColourId = 0x1005007
  18313. };
  18314. int getKeyStartPosition (const int midiNoteNumber) const;
  18315. void clearKeyMappings();
  18316. void setKeyPressForNote (const KeyPress& key,
  18317. const int midiNoteOffsetFromC);
  18318. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18319. void setKeyPressBaseOctave (const int newOctaveNumber);
  18320. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18321. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18322. void paint (Graphics& g);
  18323. void resized();
  18324. void mouseMove (const MouseEvent& e);
  18325. void mouseDrag (const MouseEvent& e);
  18326. void mouseDown (const MouseEvent& e);
  18327. void mouseUp (const MouseEvent& e);
  18328. void mouseEnter (const MouseEvent& e);
  18329. void mouseExit (const MouseEvent& e);
  18330. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18331. void timerCallback();
  18332. bool keyStateChanged (const bool isKeyDown);
  18333. void focusLost (FocusChangeType cause);
  18334. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18335. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18336. void handleAsyncUpdate();
  18337. void colourChanged();
  18338. juce_UseDebuggingNewOperator
  18339. protected:
  18340. friend class MidiKeyboardUpDownButton;
  18341. virtual void drawWhiteNote (int midiNoteNumber,
  18342. Graphics& g,
  18343. int x, int y, int w, int h,
  18344. bool isDown, bool isOver,
  18345. const Colour& lineColour,
  18346. const Colour& textColour);
  18347. virtual void drawBlackNote (int midiNoteNumber,
  18348. Graphics& g,
  18349. int x, int y, int w, int h,
  18350. bool isDown, bool isOver,
  18351. const Colour& noteFillColour);
  18352. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18353. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18354. const bool isMouseOver,
  18355. const bool isButtonPressed,
  18356. const bool movesOctavesUp);
  18357. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18358. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18359. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18360. int& x, int& w) const;
  18361. private:
  18362. MidiKeyboardState& state;
  18363. int xOffset, blackNoteLength;
  18364. float keyWidth;
  18365. Orientation orientation;
  18366. int midiChannel, midiInChannelMask;
  18367. float velocity;
  18368. int noteUnderMouse, mouseDownNote;
  18369. BitArray keysPressed, keysCurrentlyDrawnDown;
  18370. int rangeStart, rangeEnd, firstKey;
  18371. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18372. Button* scrollDown;
  18373. Button* scrollUp;
  18374. Array <KeyPress> keyPresses;
  18375. Array <int> keyPressNotes;
  18376. int keyMappingOctave;
  18377. int octaveNumForMiddleC;
  18378. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18379. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18380. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18381. void resetAnyKeysInUse();
  18382. void updateNoteUnderMouse (const Point<int>& pos);
  18383. void repaintNote (const int midiNoteNumber);
  18384. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18385. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18386. };
  18387. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18388. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18389. #endif
  18390. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18391. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18392. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18393. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18394. #if ! DOXYGEN
  18395. class NSViewComponentInternal;
  18396. #endif
  18397. #if JUCE_MAC || DOXYGEN
  18398. class JUCE_API NSViewComponent : public Component
  18399. {
  18400. public:
  18401. NSViewComponent();
  18402. ~NSViewComponent();
  18403. void setView (void* nsView);
  18404. void* getView() const;
  18405. void paint (Graphics& g);
  18406. juce_UseDebuggingNewOperator
  18407. private:
  18408. friend class NSViewComponentInternal;
  18409. ScopedPointer <NSViewComponentInternal> info;
  18410. NSViewComponent (const NSViewComponent&);
  18411. NSViewComponent& operator= (const NSViewComponent&);
  18412. };
  18413. #endif
  18414. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18415. /*** End of inlined file: juce_NSViewComponent.h ***/
  18416. #endif
  18417. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18418. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18419. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18420. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18421. // this is used to disable OpenGL, and is defined in juce_Config.h
  18422. #if JUCE_OPENGL || DOXYGEN
  18423. class JUCE_API OpenGLPixelFormat
  18424. {
  18425. public:
  18426. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18427. const int alphaBits = 8,
  18428. const int depthBufferBits = 16,
  18429. const int stencilBufferBits = 0) throw();
  18430. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18431. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18432. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18433. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18434. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18435. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18436. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18437. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18438. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18439. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18440. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18441. static void getAvailablePixelFormats (Component* component,
  18442. OwnedArray <OpenGLPixelFormat>& results);
  18443. bool operator== (const OpenGLPixelFormat&) const throw();
  18444. juce_UseDebuggingNewOperator
  18445. };
  18446. class JUCE_API OpenGLContext
  18447. {
  18448. public:
  18449. virtual ~OpenGLContext();
  18450. virtual bool makeActive() const throw() = 0;
  18451. virtual bool makeInactive() const throw() = 0;
  18452. virtual bool isActive() const throw() = 0;
  18453. virtual void swapBuffers() = 0;
  18454. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18455. virtual int getSwapInterval() const = 0;
  18456. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18457. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18458. virtual void repaint() = 0;
  18459. virtual void* getRawContext() const throw() = 0;
  18460. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18461. const OpenGLPixelFormat& pixelFormat,
  18462. const OpenGLContext* const contextToShareWith);
  18463. static OpenGLContext* getCurrentContext();
  18464. juce_UseDebuggingNewOperator
  18465. protected:
  18466. OpenGLContext() throw();
  18467. };
  18468. class JUCE_API OpenGLComponent : public Component
  18469. {
  18470. public:
  18471. OpenGLComponent();
  18472. ~OpenGLComponent();
  18473. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18474. const OpenGLPixelFormat getPixelFormat() const;
  18475. void shareWith (OpenGLContext* contextToShareListsWith);
  18476. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18477. void swapBuffers();
  18478. virtual void renderOpenGL() = 0;
  18479. virtual void newOpenGLContextCreated() = 0;
  18480. OpenGLContext* getCurrentContext() const throw() { return context; }
  18481. bool makeCurrentContextActive();
  18482. void makeCurrentContextInactive();
  18483. bool isActiveContext() const throw();
  18484. virtual bool renderAndSwapBuffers();
  18485. CriticalSection& getContextLock() throw() { return contextLock; }
  18486. void paint (Graphics& g);
  18487. void* getNativeWindowHandle() const;
  18488. juce_UseDebuggingNewOperator
  18489. private:
  18490. class OpenGLComponentWatcher;
  18491. friend class OpenGLComponentWatcher;
  18492. friend class ScopedPointer <OpenGLComponentWatcher>;
  18493. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18494. OpenGLContext* context;
  18495. OpenGLContext* contextToShareListsWith;
  18496. CriticalSection contextLock;
  18497. OpenGLPixelFormat preferredPixelFormat;
  18498. bool needToUpdateViewport;
  18499. void deleteContext();
  18500. void updateContextPosition();
  18501. void internalRepaint (int x, int y, int w, int h);
  18502. OpenGLComponent (const OpenGLComponent&);
  18503. OpenGLComponent& operator= (const OpenGLComponent&);
  18504. };
  18505. #endif
  18506. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18507. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18508. #endif
  18509. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18510. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18511. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18512. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18513. class JUCE_API PreferencesPanel : public Component,
  18514. private ButtonListener
  18515. {
  18516. public:
  18517. PreferencesPanel();
  18518. ~PreferencesPanel();
  18519. void addSettingsPage (const String& pageTitle,
  18520. const Drawable* normalIcon,
  18521. const Drawable* overIcon,
  18522. const Drawable* downIcon);
  18523. void addSettingsPage (const String& pageTitle,
  18524. const char* imageData,
  18525. const int imageDataSize);
  18526. void showInDialogBox (const String& dialogtitle,
  18527. int dialogWidth,
  18528. int dialogHeight,
  18529. const Colour& backgroundColour = Colours::white);
  18530. virtual Component* createComponentForPage (const String& pageName) = 0;
  18531. void setCurrentPage (const String& pageName);
  18532. void resized();
  18533. void paint (Graphics& g);
  18534. void buttonClicked (Button* button);
  18535. juce_UseDebuggingNewOperator
  18536. private:
  18537. String currentPageName;
  18538. ScopedPointer <Component> currentPage;
  18539. int buttonSize;
  18540. PreferencesPanel (const PreferencesPanel&);
  18541. PreferencesPanel& operator= (const PreferencesPanel&);
  18542. };
  18543. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18544. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18545. #endif
  18546. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18547. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18548. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18549. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18550. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18551. // amalgamated build)
  18552. #if JUCE_WINDOWS
  18553. typedef ActiveXControlComponent QTCompBaseClass;
  18554. #elif JUCE_MAC
  18555. typedef NSViewComponent QTCompBaseClass;
  18556. #endif
  18557. // this is used to disable QuickTime, and is defined in juce_Config.h
  18558. #if JUCE_QUICKTIME || DOXYGEN
  18559. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18560. {
  18561. public:
  18562. QuickTimeMovieComponent();
  18563. ~QuickTimeMovieComponent();
  18564. static bool isQuickTimeAvailable() throw();
  18565. bool loadMovie (const File& movieFile,
  18566. const bool isControllerVisible);
  18567. bool loadMovie (const URL& movieURL,
  18568. const bool isControllerVisible);
  18569. bool loadMovie (InputStream* movieStream,
  18570. const bool isControllerVisible);
  18571. void closeMovie();
  18572. const File getCurrentMovieFile() const;
  18573. bool isMovieOpen() const;
  18574. double getMovieDuration() const;
  18575. void getMovieNormalSize (int& width, int& height) const;
  18576. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18577. const RectanglePlacement& placement);
  18578. void play();
  18579. void stop();
  18580. bool isPlaying() const;
  18581. void goToStart();
  18582. void setPosition (const double seconds);
  18583. double getPosition() const;
  18584. void setSpeed (const float newSpeed);
  18585. void setMovieVolume (const float newVolume);
  18586. float getMovieVolume() const;
  18587. void setLooping (const bool shouldLoop);
  18588. bool isLooping() const;
  18589. bool isControllerVisible() const;
  18590. void paint (Graphics& g);
  18591. juce_UseDebuggingNewOperator
  18592. private:
  18593. File movieFile;
  18594. bool movieLoaded, controllerVisible, looping;
  18595. #if JUCE_WINDOWS
  18596. void parentHierarchyChanged();
  18597. void visibilityChanged();
  18598. void createControlIfNeeded();
  18599. bool isControlCreated() const;
  18600. void* internal;
  18601. #else
  18602. void* movie;
  18603. #endif
  18604. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18605. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18606. };
  18607. #endif
  18608. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18609. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18610. #endif
  18611. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18612. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18613. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18614. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18615. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18616. class JUCE_API SystemTrayIconComponent : public Component
  18617. {
  18618. public:
  18619. SystemTrayIconComponent();
  18620. ~SystemTrayIconComponent();
  18621. void setIconImage (const Image& newImage);
  18622. void setIconTooltip (const String& tooltip);
  18623. #if JUCE_LINUX
  18624. void paint (Graphics& g);
  18625. #endif
  18626. juce_UseDebuggingNewOperator
  18627. private:
  18628. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18629. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18630. };
  18631. #endif
  18632. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18633. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18634. #endif
  18635. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18636. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18637. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18638. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18639. #if JUCE_WEB_BROWSER || DOXYGEN
  18640. #if ! DOXYGEN
  18641. class WebBrowserComponentInternal;
  18642. #endif
  18643. class JUCE_API WebBrowserComponent : public Component
  18644. {
  18645. public:
  18646. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18647. ~WebBrowserComponent();
  18648. void goToURL (const String& url,
  18649. const StringArray* headers = 0,
  18650. const MemoryBlock* postData = 0);
  18651. void stop();
  18652. void goBack();
  18653. void goForward();
  18654. void refresh();
  18655. virtual bool pageAboutToLoad (const String& newURL);
  18656. void paint (Graphics& g);
  18657. void resized();
  18658. void parentHierarchyChanged();
  18659. void visibilityChanged();
  18660. juce_UseDebuggingNewOperator
  18661. private:
  18662. WebBrowserComponentInternal* browser;
  18663. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18664. String lastURL;
  18665. StringArray lastHeaders;
  18666. MemoryBlock lastPostData;
  18667. void reloadLastURL();
  18668. void checkWindowAssociation();
  18669. WebBrowserComponent (const WebBrowserComponent&);
  18670. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18671. };
  18672. #endif
  18673. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18674. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18675. #endif
  18676. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18677. #endif
  18678. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18679. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18680. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18681. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18682. class ComponentBoundsConstrainer;
  18683. class JUCE_API ComponentPeer
  18684. {
  18685. public:
  18686. enum StyleFlags
  18687. {
  18688. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18689. entry on the taskbar (ignored on MacOSX) */
  18690. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18691. tooltip, etc. */
  18692. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18693. through it (may not be possible on some platforms). */
  18694. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18695. title bar and frame\. if not specified, the window will be
  18696. borderless. */
  18697. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18698. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18699. minimise button on it. */
  18700. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18701. maximise button on it. */
  18702. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18703. close button on it. */
  18704. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18705. not be possible on all platforms). */
  18706. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18707. do its own repainting, but only to repaint when the
  18708. performAnyPendingRepaintsNow() method is called. */
  18709. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18710. be used for things like plugin windows, to stop them interfering
  18711. with the host's shortcut keys */
  18712. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18713. };
  18714. ComponentPeer (Component* const component,
  18715. const int styleFlags) throw();
  18716. virtual ~ComponentPeer();
  18717. Component* getComponent() const throw() { return component; }
  18718. int getStyleFlags() const throw() { return styleFlags; }
  18719. virtual void* getNativeHandle() const = 0;
  18720. virtual void setVisible (bool shouldBeVisible) = 0;
  18721. virtual void setTitle (const String& title) = 0;
  18722. virtual void setPosition (int x, int y) = 0;
  18723. virtual void setSize (int w, int h) = 0;
  18724. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  18725. virtual const Rectangle<int> getBounds() const = 0;
  18726. virtual const Point<int> getScreenPosition() const = 0;
  18727. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18728. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18729. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18730. virtual bool isMinimised() const = 0;
  18731. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18732. virtual bool isFullScreen() const = 0;
  18733. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18734. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18735. virtual void setIcon (const Image& newIcon) = 0;
  18736. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  18737. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18738. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18739. virtual const BorderSize getFrameSize() const = 0;
  18740. void handleMovedOrResized();
  18741. void handleScreenSizeChange();
  18742. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18743. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18744. virtual void toFront (bool makeActive) = 0;
  18745. virtual void toBehind (ComponentPeer* other) = 0;
  18746. void handleBroughtToFront();
  18747. virtual bool isFocused() const = 0;
  18748. virtual void grabFocus() = 0;
  18749. virtual void textInputRequired (const Point<int>& position) = 0;
  18750. void handleFocusGain();
  18751. void handleFocusLoss();
  18752. Component* getLastFocusedSubcomponent() const throw();
  18753. bool handleKeyPress (const int keyCode,
  18754. const juce_wchar textCharacter);
  18755. bool handleKeyUpOrDown (const bool isKeyDown);
  18756. void handleModifierKeysChange();
  18757. TextInputTarget* findCurrentTextInputTarget();
  18758. virtual void repaint (int x, int y, int w, int h) = 0;
  18759. virtual void performAnyPendingRepaintsNow() = 0;
  18760. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, const int64 time);
  18761. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, const int64 time, float x, float y);
  18762. void handleUserClosingWindow();
  18763. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18764. void handleFileDragExit (const StringArray& files);
  18765. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18766. void clearMaskedRegion() throw();
  18767. void addMaskedRegion (int x, int y, int w, int h) throw();
  18768. static int getNumPeers() throw();
  18769. static ComponentPeer* getPeer (const int index) throw();
  18770. static bool isValidPeer (const ComponentPeer* const peer) throw();
  18771. static void bringModalComponentToFront();
  18772. virtual const StringArray getAvailableRenderingEngines() throw();
  18773. virtual int getCurrentRenderingEngine() throw();
  18774. virtual void setCurrentRenderingEngine (int index) throw();
  18775. juce_UseDebuggingNewOperator
  18776. protected:
  18777. Component* const component;
  18778. const int styleFlags;
  18779. RectangleList maskedRegion;
  18780. Rectangle<int> lastNonFullscreenBounds;
  18781. uint32 lastPaintTime;
  18782. ComponentBoundsConstrainer* constrainer;
  18783. static void updateCurrentModifiers() throw();
  18784. private:
  18785. Component* lastFocusedComponent;
  18786. Component::SafePointer<Component> dragAndDropTargetComponent;
  18787. Component* lastDragAndDropCompUnderMouse;
  18788. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18789. friend class Component;
  18790. static ComponentPeer* getPeerFor (const Component* const component) throw();
  18791. void setLastDragDropTarget (Component* comp);
  18792. ComponentPeer (const ComponentPeer&);
  18793. ComponentPeer& operator= (const ComponentPeer&);
  18794. };
  18795. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18796. /*** End of inlined file: juce_ComponentPeer.h ***/
  18797. #endif
  18798. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18799. /*** Start of inlined file: juce_DialogWindow.h ***/
  18800. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18801. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18802. class JUCE_API DialogWindow : public DocumentWindow
  18803. {
  18804. public:
  18805. DialogWindow (const String& name,
  18806. const Colour& backgroundColour,
  18807. const bool escapeKeyTriggersCloseButton,
  18808. const bool addToDesktop = true);
  18809. ~DialogWindow();
  18810. static int showModalDialog (const String& dialogTitle,
  18811. Component* contentComponent,
  18812. Component* componentToCentreAround,
  18813. const Colour& backgroundColour,
  18814. const bool escapeKeyTriggersCloseButton,
  18815. const bool shouldBeResizable = false,
  18816. const bool useBottomRightCornerResizer = false);
  18817. juce_UseDebuggingNewOperator
  18818. protected:
  18819. void resized();
  18820. private:
  18821. bool escapeKeyTriggersCloseButton;
  18822. DialogWindow (const DialogWindow&);
  18823. DialogWindow& operator= (const DialogWindow&);
  18824. };
  18825. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18826. /*** End of inlined file: juce_DialogWindow.h ***/
  18827. #endif
  18828. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18829. #endif
  18830. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18831. #endif
  18832. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18833. /*** Start of inlined file: juce_SplashScreen.h ***/
  18834. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18835. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18836. class JUCE_API SplashScreen : public Component,
  18837. public Timer,
  18838. private DeletedAtShutdown
  18839. {
  18840. public:
  18841. SplashScreen();
  18842. ~SplashScreen();
  18843. void show (const String& title,
  18844. Image* const backgroundImage,
  18845. const int minimumTimeToDisplayFor,
  18846. const bool useDropShadow,
  18847. const bool removeOnMouseClick = true);
  18848. void show (const String& title,
  18849. const int width,
  18850. const int height,
  18851. const int minimumTimeToDisplayFor,
  18852. const bool useDropShadow,
  18853. const bool removeOnMouseClick = true);
  18854. void paint (Graphics& g);
  18855. void timerCallback();
  18856. juce_UseDebuggingNewOperator
  18857. private:
  18858. Image* backgroundImage;
  18859. Time earliestTimeToDelete;
  18860. int originalClickCounter;
  18861. SplashScreen (const SplashScreen&);
  18862. SplashScreen& operator= (const SplashScreen&);
  18863. };
  18864. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18865. /*** End of inlined file: juce_SplashScreen.h ***/
  18866. #endif
  18867. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18868. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18869. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18870. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18871. class JUCE_API ThreadWithProgressWindow : public Thread,
  18872. private Timer
  18873. {
  18874. public:
  18875. ThreadWithProgressWindow (const String& windowTitle,
  18876. const bool hasProgressBar,
  18877. const bool hasCancelButton,
  18878. const int timeOutMsWhenCancelling = 10000,
  18879. const String& cancelButtonText = JUCE_T("Cancel"));
  18880. ~ThreadWithProgressWindow();
  18881. bool runThread (const int threadPriority = 5);
  18882. void setProgress (const double newProgress);
  18883. void setStatusMessage (const String& newStatusMessage);
  18884. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18885. juce_UseDebuggingNewOperator
  18886. private:
  18887. void timerCallback();
  18888. double progress;
  18889. ScopedPointer <AlertWindow> alertWindow;
  18890. String message;
  18891. CriticalSection messageLock;
  18892. const int timeOutMsWhenCancelling;
  18893. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18894. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18895. };
  18896. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18897. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18898. #endif
  18899. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18900. #endif
  18901. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18902. #endif
  18903. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18904. #endif
  18905. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18906. #endif
  18907. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18908. #endif
  18909. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18910. #endif
  18911. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18912. #endif
  18913. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18914. #endif
  18915. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18916. #endif
  18917. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18918. #endif
  18919. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18920. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18921. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18922. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18923. class JUCE_API LowLevelGraphicsContext
  18924. {
  18925. protected:
  18926. LowLevelGraphicsContext();
  18927. public:
  18928. virtual ~LowLevelGraphicsContext();
  18929. virtual bool isVectorDevice() const = 0;
  18930. virtual void setOrigin (int x, int y) = 0;
  18931. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18932. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18933. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18934. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18935. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18936. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18937. virtual const Rectangle<int> getClipBounds() const = 0;
  18938. virtual bool isClipEmpty() const = 0;
  18939. virtual void saveState() = 0;
  18940. virtual void restoreState() = 0;
  18941. virtual void setFill (const FillType& fillType) = 0;
  18942. virtual void setOpacity (float newOpacity) = 0;
  18943. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18944. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18945. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18946. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18947. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18948. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18949. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18950. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18951. virtual void setFont (const Font& newFont) = 0;
  18952. virtual const Font getFont() = 0;
  18953. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18954. };
  18955. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18956. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18957. #endif
  18958. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18959. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18960. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18961. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18962. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18963. {
  18964. public:
  18965. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18966. const String& documentTitle,
  18967. const int totalWidth,
  18968. const int totalHeight);
  18969. ~LowLevelGraphicsPostScriptRenderer();
  18970. bool isVectorDevice() const;
  18971. void setOrigin (int x, int y);
  18972. bool clipToRectangle (const Rectangle<int>& r);
  18973. bool clipToRectangleList (const RectangleList& clipRegion);
  18974. void excludeClipRectangle (const Rectangle<int>& r);
  18975. void clipToPath (const Path& path, const AffineTransform& transform);
  18976. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18977. void saveState();
  18978. void restoreState();
  18979. bool clipRegionIntersects (const Rectangle<int>& r);
  18980. const Rectangle<int> getClipBounds() const;
  18981. bool isClipEmpty() const;
  18982. void setFill (const FillType& fillType);
  18983. void setOpacity (float opacity);
  18984. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18985. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18986. void fillPath (const Path& path, const AffineTransform& transform);
  18987. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18988. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18989. void drawLine (double x1, double y1, double x2, double y2);
  18990. void drawVerticalLine (const int x, double top, double bottom);
  18991. void drawHorizontalLine (const int x, double top, double bottom);
  18992. const Font getFont();
  18993. void setFont (const Font& newFont);
  18994. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18995. juce_UseDebuggingNewOperator
  18996. protected:
  18997. OutputStream& out;
  18998. int totalWidth, totalHeight;
  18999. bool needToClip;
  19000. Colour lastColour;
  19001. struct SavedState
  19002. {
  19003. SavedState();
  19004. ~SavedState();
  19005. RectangleList clip;
  19006. int xOffset, yOffset;
  19007. FillType fillType;
  19008. Font font;
  19009. private:
  19010. SavedState& operator= (const SavedState&);
  19011. };
  19012. OwnedArray <SavedState> stateStack;
  19013. void writeClip();
  19014. void writeColour (const Colour& colour);
  19015. void writePath (const Path& path) const;
  19016. void writeXY (const float x, const float y) const;
  19017. void writeTransform (const AffineTransform& trans) const;
  19018. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  19019. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19020. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19021. };
  19022. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19023. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19024. #endif
  19025. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19026. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19027. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19028. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19029. class LLGCSavedState;
  19030. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19031. {
  19032. public:
  19033. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19034. ~LowLevelGraphicsSoftwareRenderer();
  19035. bool isVectorDevice() const;
  19036. void setOrigin (int x, int y);
  19037. bool clipToRectangle (const Rectangle<int>& r);
  19038. bool clipToRectangleList (const RectangleList& clipRegion);
  19039. void excludeClipRectangle (const Rectangle<int>& r);
  19040. void clipToPath (const Path& path, const AffineTransform& transform);
  19041. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19042. bool clipRegionIntersects (const Rectangle<int>& r);
  19043. const Rectangle<int> getClipBounds() const;
  19044. bool isClipEmpty() const;
  19045. void saveState();
  19046. void restoreState();
  19047. void setFill (const FillType& fillType);
  19048. void setOpacity (float opacity);
  19049. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19050. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  19051. void fillPath (const Path& path, const AffineTransform& transform);
  19052. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19053. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  19054. void drawLine (double x1, double y1, double x2, double y2);
  19055. void drawVerticalLine (const int x, double top, double bottom);
  19056. void drawHorizontalLine (const int x, double top, double bottom);
  19057. void setFont (const Font& newFont);
  19058. const Font getFont();
  19059. void drawGlyph (int glyphNumber, float x, float y);
  19060. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19061. juce_UseDebuggingNewOperator
  19062. protected:
  19063. Image& image;
  19064. ScopedPointer <LLGCSavedState> currentState;
  19065. OwnedArray <LLGCSavedState> stateStack;
  19066. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19067. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19068. };
  19069. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19070. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19071. #endif
  19072. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19073. #endif
  19074. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19075. #endif
  19076. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19077. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19078. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19079. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19080. class JUCE_API DrawableComposite : public Drawable
  19081. {
  19082. public:
  19083. DrawableComposite();
  19084. virtual ~DrawableComposite();
  19085. void insertDrawable (Drawable* drawable,
  19086. const AffineTransform& transform = AffineTransform::identity,
  19087. const int index = -1);
  19088. void insertDrawable (const Drawable& drawable,
  19089. const AffineTransform& transform = AffineTransform::identity,
  19090. const int index = -1);
  19091. void removeDrawable (const int index, const bool deleteDrawable = true);
  19092. int getNumDrawables() const throw() { return drawables.size(); }
  19093. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  19094. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  19095. void bringToFront (const int index);
  19096. void render (const Drawable::RenderingContext& context) const;
  19097. const Rectangle<float> getBounds() const;
  19098. bool hitTest (float x, float y) const;
  19099. Drawable* createCopy() const;
  19100. ValueTree createValueTree() const throw();
  19101. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19102. juce_UseDebuggingNewOperator
  19103. private:
  19104. OwnedArray <Drawable> drawables;
  19105. OwnedArray <AffineTransform> transforms;
  19106. DrawableComposite (const DrawableComposite&);
  19107. DrawableComposite& operator= (const DrawableComposite&);
  19108. };
  19109. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19110. /*** End of inlined file: juce_DrawableComposite.h ***/
  19111. #endif
  19112. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19113. /*** Start of inlined file: juce_DrawableImage.h ***/
  19114. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19115. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19116. class JUCE_API DrawableImage : public Drawable
  19117. {
  19118. public:
  19119. DrawableImage();
  19120. virtual ~DrawableImage();
  19121. void setImage (const Image& imageToCopy);
  19122. void setImage (Image* imageToUse,
  19123. const bool releaseWhenNotNeeded);
  19124. Image* getImage() const throw() { return image; }
  19125. void clearImage();
  19126. void setOpacity (const float newOpacity);
  19127. float getOpacity() const throw() { return opacity; }
  19128. void setOverlayColour (const Colour& newOverlayColour);
  19129. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19130. void render (const Drawable::RenderingContext& context) const;
  19131. const Rectangle<float> getBounds() const;
  19132. bool hitTest (float x, float y) const;
  19133. Drawable* createCopy() const;
  19134. ValueTree createValueTree() const throw();
  19135. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19136. juce_UseDebuggingNewOperator
  19137. private:
  19138. Image* image;
  19139. bool canDeleteImage;
  19140. float opacity;
  19141. Colour overlayColour;
  19142. DrawableImage (const DrawableImage&);
  19143. DrawableImage& operator= (const DrawableImage&);
  19144. };
  19145. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19146. /*** End of inlined file: juce_DrawableImage.h ***/
  19147. #endif
  19148. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19149. /*** Start of inlined file: juce_DrawablePath.h ***/
  19150. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19151. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19152. class JUCE_API DrawablePath : public Drawable
  19153. {
  19154. public:
  19155. DrawablePath();
  19156. virtual ~DrawablePath();
  19157. void setPath (const Path& newPath) throw();
  19158. const Path& getPath() const throw() { return path; }
  19159. void setFill (const FillType& newFill) throw();
  19160. const FillType& getFill() const throw() { return mainFill; }
  19161. void setStrokeFill (const FillType& newStrokeFill) throw();
  19162. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19163. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19164. void setStrokeThickness (const float newThickness) throw();
  19165. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19166. void render (const Drawable::RenderingContext& context) const;
  19167. const Rectangle<float> getBounds() const;
  19168. bool hitTest (float x, float y) const;
  19169. Drawable* createCopy() const;
  19170. ValueTree createValueTree() const throw();
  19171. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19172. juce_UseDebuggingNewOperator
  19173. private:
  19174. Path path, stroke;
  19175. FillType mainFill, strokeFill;
  19176. PathStrokeType strokeType;
  19177. void updateOutline();
  19178. DrawablePath (const DrawablePath&);
  19179. DrawablePath& operator= (const DrawablePath&);
  19180. };
  19181. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19182. /*** End of inlined file: juce_DrawablePath.h ***/
  19183. #endif
  19184. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19185. /*** Start of inlined file: juce_DrawableText.h ***/
  19186. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19187. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19188. class JUCE_API DrawableText : public Drawable
  19189. {
  19190. public:
  19191. DrawableText();
  19192. virtual ~DrawableText();
  19193. void setText (const GlyphArrangement& newText);
  19194. void setText (const String& newText, const Font& fontToUse);
  19195. const GlyphArrangement& getText() const throw() { return text; }
  19196. void setColour (const Colour& newColour);
  19197. const Colour& getColour() const throw() { return colour; }
  19198. void render (const Drawable::RenderingContext& context) const;
  19199. const Rectangle<float> getBounds() const;
  19200. bool hitTest (float x, float y) const;
  19201. Drawable* createCopy() const;
  19202. ValueTree createValueTree() const throw();
  19203. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19204. juce_UseDebuggingNewOperator
  19205. private:
  19206. GlyphArrangement text;
  19207. Colour colour;
  19208. DrawableText (const DrawableText&);
  19209. DrawableText& operator= (const DrawableText&);
  19210. };
  19211. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19212. /*** End of inlined file: juce_DrawableText.h ***/
  19213. #endif
  19214. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19215. #endif
  19216. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19217. /*** Start of inlined file: juce_GlowEffect.h ***/
  19218. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19219. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19220. class JUCE_API GlowEffect : public ImageEffectFilter
  19221. {
  19222. public:
  19223. GlowEffect();
  19224. ~GlowEffect();
  19225. void setGlowProperties (const float newRadius,
  19226. const Colour& newColour);
  19227. void applyEffect (Image& sourceImage, Graphics& destContext);
  19228. juce_UseDebuggingNewOperator
  19229. private:
  19230. float radius;
  19231. Colour colour;
  19232. };
  19233. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19234. /*** End of inlined file: juce_GlowEffect.h ***/
  19235. #endif
  19236. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19237. #endif
  19238. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19239. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19240. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19241. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19242. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19243. {
  19244. public:
  19245. ReduceOpacityEffect (const float opacity = 1.0f);
  19246. ~ReduceOpacityEffect();
  19247. void setOpacity (const float newOpacity);
  19248. void applyEffect (Image& sourceImage, Graphics& destContext);
  19249. juce_UseDebuggingNewOperator
  19250. private:
  19251. float opacity;
  19252. };
  19253. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19254. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19255. #endif
  19256. #ifndef __JUCE_FONT_JUCEHEADER__
  19257. #endif
  19258. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19259. #endif
  19260. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19261. #endif
  19262. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19263. #endif
  19264. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19265. #endif
  19266. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19267. #endif
  19268. #ifndef __JUCE_LINE_JUCEHEADER__
  19269. #endif
  19270. #ifndef __JUCE_PATH_JUCEHEADER__
  19271. #endif
  19272. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19273. /*** Start of inlined file: juce_PathIterator.h ***/
  19274. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19275. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19276. class JUCE_API PathFlatteningIterator
  19277. {
  19278. public:
  19279. PathFlatteningIterator (const Path& path,
  19280. const AffineTransform& transform = AffineTransform::identity,
  19281. float tolerence = 6.0f) throw();
  19282. ~PathFlatteningIterator() throw();
  19283. bool next() throw();
  19284. float x1;
  19285. float y1;
  19286. float x2;
  19287. float y2;
  19288. bool closesSubPath;
  19289. int subPathIndex;
  19290. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19291. && (index >= path.numElements
  19292. || points [index] == Path::moveMarker); }
  19293. juce_UseDebuggingNewOperator
  19294. private:
  19295. const Path& path;
  19296. const AffineTransform transform;
  19297. float* points;
  19298. float tolerence, subPathCloseX, subPathCloseY;
  19299. bool isIdentityTransform;
  19300. HeapBlock <float> stackBase;
  19301. float* stackPos;
  19302. int index, stackSize;
  19303. PathFlatteningIterator (const PathFlatteningIterator&);
  19304. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19305. };
  19306. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19307. /*** End of inlined file: juce_PathIterator.h ***/
  19308. #endif
  19309. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19310. #endif
  19311. #ifndef __JUCE_POINT_JUCEHEADER__
  19312. #endif
  19313. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19314. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19315. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19316. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19317. class JUCE_API PositionedRectangle
  19318. {
  19319. public:
  19320. PositionedRectangle() throw();
  19321. PositionedRectangle (const String& stringVersion) throw();
  19322. PositionedRectangle (const PositionedRectangle& other) throw();
  19323. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19324. ~PositionedRectangle() throw();
  19325. const String toString() const throw();
  19326. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19327. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19328. double& x,
  19329. double& y,
  19330. double& width,
  19331. double& height) const throw();
  19332. void applyToComponent (Component& comp) const throw();
  19333. void updateFrom (const Rectangle<int>& newPosition,
  19334. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19335. void updateFromDouble (const double x, const double y,
  19336. const double width, const double height,
  19337. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19338. void updateFromComponent (const Component& comp) throw();
  19339. enum AnchorPoint
  19340. {
  19341. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19342. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19343. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19344. };
  19345. enum PositionMode
  19346. {
  19347. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19348. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19349. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19350. 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. */
  19351. };
  19352. enum SizeMode
  19353. {
  19354. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19355. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19356. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19357. };
  19358. void setModes (const AnchorPoint xAnchorMode,
  19359. const PositionMode xPositionMode,
  19360. const AnchorPoint yAnchorMode,
  19361. const PositionMode yPositionMode,
  19362. const SizeMode widthMode,
  19363. const SizeMode heightMode,
  19364. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19365. AnchorPoint getAnchorPointX() const throw();
  19366. PositionMode getPositionModeX() const throw();
  19367. double getX() const throw() { return x; }
  19368. void setX (const double newX) throw() { x = newX; }
  19369. AnchorPoint getAnchorPointY() const throw();
  19370. PositionMode getPositionModeY() const throw();
  19371. double getY() const throw() { return y; }
  19372. void setY (const double newY) throw() { y = newY; }
  19373. SizeMode getWidthMode() const throw();
  19374. double getWidth() const throw() { return w; }
  19375. void setWidth (const double newWidth) throw() { w = newWidth; }
  19376. SizeMode getHeightMode() const throw();
  19377. double getHeight() const throw() { return h; }
  19378. void setHeight (const double newHeight) throw() { h = newHeight; }
  19379. bool isPositionAbsolute() const throw();
  19380. bool operator== (const PositionedRectangle& other) const throw();
  19381. bool operator!= (const PositionedRectangle& other) const throw();
  19382. juce_UseDebuggingNewOperator
  19383. private:
  19384. double x, y, w, h;
  19385. uint8 xMode, yMode, wMode, hMode;
  19386. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19387. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19388. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19389. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19390. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19391. const uint8 xMode, const uint8 wMode,
  19392. const int parentPos, const int parentSize) const throw();
  19393. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19394. const uint8 xMode, const uint8 wMode,
  19395. const int parentPos, const int parentSize) const throw();
  19396. };
  19397. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19398. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19399. #endif
  19400. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19401. #endif
  19402. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19403. #endif
  19404. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19405. /*** Start of inlined file: juce_CameraDevice.h ***/
  19406. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19407. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19408. #if JUCE_USE_CAMERA
  19409. class CameraImageListener
  19410. {
  19411. public:
  19412. CameraImageListener() {}
  19413. virtual ~CameraImageListener() {}
  19414. virtual void imageReceived (Image& image) = 0;
  19415. };
  19416. class JUCE_API CameraDevice
  19417. {
  19418. public:
  19419. virtual ~CameraDevice();
  19420. static const StringArray getAvailableDevices();
  19421. static CameraDevice* openDevice (int deviceIndex,
  19422. int minWidth = 128, int minHeight = 64,
  19423. int maxWidth = 1024, int maxHeight = 768);
  19424. const String getName() const { return name; }
  19425. Component* createViewerComponent();
  19426. void startRecordingToFile (const File& file, int quality = 2);
  19427. void stopRecording();
  19428. static const String getFileExtension();
  19429. const Time getTimeOfFirstRecordedFrame() const;
  19430. void addListener (CameraImageListener* listenerToAdd);
  19431. void removeListener (CameraImageListener* listenerToRemove);
  19432. juce_UseDebuggingNewOperator
  19433. protected:
  19434. CameraDevice (const String& name, int index);
  19435. private:
  19436. void* internal;
  19437. bool isRecording;
  19438. String name;
  19439. CameraDevice (const CameraDevice&);
  19440. CameraDevice& operator= (const CameraDevice&);
  19441. };
  19442. #endif
  19443. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19444. /*** End of inlined file: juce_CameraDevice.h ***/
  19445. #endif
  19446. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19447. #endif
  19448. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19449. /*** Start of inlined file: juce_ImageCache.h ***/
  19450. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19451. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19452. struct ImageCacheItem;
  19453. class JUCE_API ImageCache : private DeletedAtShutdown,
  19454. private Timer
  19455. {
  19456. public:
  19457. static Image* getFromFile (const File& file);
  19458. static Image* getFromMemory (const void* imageData,
  19459. const int dataSize);
  19460. static void release (Image* const imageToRelease);
  19461. static void releaseOrDelete (Image* const imageToRelease);
  19462. static bool isImageInCache (Image* const imageToLookFor);
  19463. static void incReferenceCount (Image* const image);
  19464. static Image* getFromHashCode (const int64 hashCode);
  19465. static void addImageToCache (Image* const image,
  19466. const int64 hashCode);
  19467. static void setCacheTimeout (const int millisecs);
  19468. juce_UseDebuggingNewOperator
  19469. private:
  19470. CriticalSection lock;
  19471. OwnedArray <ImageCacheItem> images;
  19472. ImageCache();
  19473. ImageCache (const ImageCache&);
  19474. ImageCache& operator= (const ImageCache&);
  19475. ~ImageCache();
  19476. void timerCallback();
  19477. };
  19478. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19479. /*** End of inlined file: juce_ImageCache.h ***/
  19480. #endif
  19481. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19482. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19483. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19484. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19485. class JUCE_API ImageConvolutionKernel
  19486. {
  19487. public:
  19488. ImageConvolutionKernel (const int size);
  19489. ~ImageConvolutionKernel();
  19490. void clear();
  19491. float getKernelValue (int x, int y) const throw();
  19492. void setKernelValue (int x, int y, float value) throw();
  19493. void setOverallSum (const float desiredTotalSum);
  19494. void rescaleAllValues (const float multiplier);
  19495. void createGaussianBlur (const float blurRadius);
  19496. int getKernelSize() const { return size; }
  19497. void applyToImage (Image& destImage,
  19498. const Image* sourceImage,
  19499. int x,
  19500. int y,
  19501. int width,
  19502. int height) const;
  19503. juce_UseDebuggingNewOperator
  19504. private:
  19505. HeapBlock <float> values;
  19506. const int size;
  19507. // no reason not to implement these one day..
  19508. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19509. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19510. };
  19511. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19512. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19513. #endif
  19514. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19515. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19516. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19517. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19518. class JUCE_API ImageFileFormat
  19519. {
  19520. protected:
  19521. ImageFileFormat() {}
  19522. public:
  19523. virtual ~ImageFileFormat() {}
  19524. virtual const String getFormatName() = 0;
  19525. virtual bool canUnderstand (InputStream& input) = 0;
  19526. virtual Image* decodeImage (InputStream& input) = 0;
  19527. virtual bool writeImageToStream (const Image& sourceImage,
  19528. OutputStream& destStream) = 0;
  19529. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19530. static Image* loadFrom (InputStream& input);
  19531. static Image* loadFrom (const File& file);
  19532. static Image* loadFrom (const void* rawData,
  19533. const int numBytesOfData);
  19534. };
  19535. class JUCE_API PNGImageFormat : public ImageFileFormat
  19536. {
  19537. public:
  19538. PNGImageFormat();
  19539. ~PNGImageFormat();
  19540. const String getFormatName();
  19541. bool canUnderstand (InputStream& input);
  19542. Image* decodeImage (InputStream& input);
  19543. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19544. };
  19545. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19546. {
  19547. public:
  19548. JPEGImageFormat();
  19549. ~JPEGImageFormat();
  19550. void setQuality (const float newQuality);
  19551. const String getFormatName();
  19552. bool canUnderstand (InputStream& input);
  19553. Image* decodeImage (InputStream& input);
  19554. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19555. private:
  19556. float quality;
  19557. };
  19558. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19559. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19560. #endif
  19561. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19562. #endif
  19563. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19564. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19565. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19566. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19567. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19568. {
  19569. public:
  19570. FileBasedDocument (const String& fileExtension,
  19571. const String& fileWildCard,
  19572. const String& openFileDialogTitle,
  19573. const String& saveFileDialogTitle);
  19574. virtual ~FileBasedDocument();
  19575. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19576. virtual void changed();
  19577. void setChangedFlag (const bool hasChanged);
  19578. bool loadFrom (const File& fileToLoadFrom,
  19579. const bool showMessageOnFailure);
  19580. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19581. enum SaveResult
  19582. {
  19583. savedOk = 0, /**< indicates that a file was saved successfully. */
  19584. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19585. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19586. };
  19587. SaveResult save (const bool askUserForFileIfNotSpecified,
  19588. const bool showMessageOnFailure);
  19589. SaveResult saveIfNeededAndUserAgrees();
  19590. SaveResult saveAs (const File& newFile,
  19591. const bool warnAboutOverwritingExistingFiles,
  19592. const bool askUserForFileIfNotSpecified,
  19593. const bool showMessageOnFailure);
  19594. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19595. const File getFile() const { return documentFile; }
  19596. void setFile (const File& newFile);
  19597. protected:
  19598. virtual const String getDocumentTitle() = 0;
  19599. virtual const String loadDocument (const File& file) = 0;
  19600. virtual const String saveDocument (const File& file) = 0;
  19601. virtual const File getLastDocumentOpened() = 0;
  19602. virtual void setLastDocumentOpened (const File& file) = 0;
  19603. public:
  19604. juce_UseDebuggingNewOperator
  19605. private:
  19606. File documentFile;
  19607. bool changedSinceSave;
  19608. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19609. FileBasedDocument (const FileBasedDocument&);
  19610. FileBasedDocument& operator= (const FileBasedDocument&);
  19611. };
  19612. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19613. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19614. #endif
  19615. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19616. #endif
  19617. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19618. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19619. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19620. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19621. class JUCE_API RecentlyOpenedFilesList
  19622. {
  19623. public:
  19624. RecentlyOpenedFilesList();
  19625. ~RecentlyOpenedFilesList();
  19626. void setMaxNumberOfItems (const int newMaxNumber);
  19627. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19628. int getNumFiles() const;
  19629. const File getFile (const int index) const;
  19630. const StringArray& getAllFilenames() const throw() { return files; }
  19631. void clear();
  19632. void addFile (const File& file);
  19633. void removeNonExistentFiles();
  19634. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19635. const int baseItemId,
  19636. const bool showFullPaths,
  19637. const bool dontAddNonExistentFiles,
  19638. const File** filesToAvoid = 0);
  19639. const String toString() const;
  19640. void restoreFromString (const String& stringifiedVersion);
  19641. juce_UseDebuggingNewOperator
  19642. private:
  19643. StringArray files;
  19644. int maxNumberOfItems;
  19645. };
  19646. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19647. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19648. #endif
  19649. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19650. #endif
  19651. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19652. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19653. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19654. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19655. class JUCE_API SystemClipboard
  19656. {
  19657. public:
  19658. static void copyTextToClipboard (const String& text) throw();
  19659. static const String getTextFromClipboard() throw();
  19660. };
  19661. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19662. /*** End of inlined file: juce_SystemClipboard.h ***/
  19663. #endif
  19664. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19665. #endif
  19666. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19667. #endif
  19668. #endif
  19669. /*** End of inlined file: juce_app_includes.h ***/
  19670. #endif
  19671. #if JUCE_MSVC
  19672. #pragma warning (pop)
  19673. #pragma pack (pop)
  19674. #endif
  19675. END_JUCE_NAMESPACE
  19676. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19677. #ifdef JUCE_NAMESPACE
  19678. // this will obviously save a lot of typing, but can be disabled by
  19679. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19680. using namespace JUCE_NAMESPACE;
  19681. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19682. #define Component JUCE_NAMESPACE::Component
  19683. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19684. #define Point JUCE_NAMESPACE::Point
  19685. #define Button JUCE_NAMESPACE::Button
  19686. #endif
  19687. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19688. #define Rectangle JUCE_NAMESPACE::Rectangle
  19689. #endif
  19690. #endif
  19691. #endif
  19692. #if JUCE_MSVC
  19693. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19694. #ifdef JUCE_DLL
  19695. #ifdef JUCE_DEBUG
  19696. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19697. #else
  19698. #define AUTOLINKEDLIB "JUCE.lib"
  19699. #endif
  19700. #else
  19701. #ifdef JUCE_DEBUG
  19702. #ifdef _WIN64
  19703. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19704. #else
  19705. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19706. #endif
  19707. #else
  19708. #ifdef _WIN64
  19709. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19710. #else
  19711. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19712. #endif
  19713. #endif
  19714. #endif
  19715. #pragma comment(lib, AUTOLINKEDLIB)
  19716. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19717. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19718. #endif
  19719. // Auto-link the other win32 libs that are needed by library calls..
  19720. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19721. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19722. // Auto-links to various win32 libs that are needed by library calls..
  19723. #pragma comment(lib, "kernel32.lib")
  19724. #pragma comment(lib, "user32.lib")
  19725. #pragma comment(lib, "shell32.lib")
  19726. #pragma comment(lib, "gdi32.lib")
  19727. #pragma comment(lib, "vfw32.lib")
  19728. #pragma comment(lib, "comdlg32.lib")
  19729. #pragma comment(lib, "winmm.lib")
  19730. #pragma comment(lib, "wininet.lib")
  19731. #pragma comment(lib, "ole32.lib")
  19732. #pragma comment(lib, "oleaut32.lib")
  19733. #pragma comment(lib, "advapi32.lib")
  19734. #pragma comment(lib, "ws2_32.lib")
  19735. #pragma comment(lib, "comsupp.lib")
  19736. #pragma comment(lib, "version.lib")
  19737. #if JUCE_OPENGL
  19738. #pragma comment(lib, "OpenGL32.Lib")
  19739. #pragma comment(lib, "GlU32.Lib")
  19740. #endif
  19741. #if JUCE_QUICKTIME
  19742. #pragma comment (lib, "QTMLClient.lib")
  19743. #endif
  19744. #if JUCE_USE_CAMERA
  19745. #pragma comment (lib, "Strmiids.lib")
  19746. #pragma comment (lib, "wmvcore.lib")
  19747. #endif
  19748. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19749. #endif
  19750. #endif
  19751. #endif
  19752. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19753. #define START_JUCE_APPLICATION(AppClass) \
  19754. int main (int argc, char* argv[]) \
  19755. { \
  19756. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19757. }
  19758. #elif JUCE_WINDOWS
  19759. #ifdef _CONSOLE
  19760. #define START_JUCE_APPLICATION(AppClass) \
  19761. int main (int, char* argv[]) \
  19762. { \
  19763. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19764. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19765. }
  19766. #elif ! defined (_AFXDLL)
  19767. #ifdef _WINDOWS_
  19768. #define START_JUCE_APPLICATION(AppClass) \
  19769. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19770. { \
  19771. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19772. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19773. }
  19774. #else
  19775. #define START_JUCE_APPLICATION(AppClass) \
  19776. int __stdcall WinMain (int, int, const char*, int) \
  19777. { \
  19778. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19779. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19780. }
  19781. #endif
  19782. #endif
  19783. #endif
  19784. #endif // __JUCE_JUCEHEADER__
  19785. /*** End of inlined file: juce.h ***/
  19786. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__