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.

28738 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 11
  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 0
  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 0
  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 0
  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_USE_XRENDER
  193. //#define JUCE_USE_XRENDER 1
  194. #endif
  195. #ifndef JUCE_PLUGINHOST_VST
  196. // #define JUCE_PLUGINHOST_VST 1
  197. #endif
  198. #ifndef JUCE_PLUGINHOST_AU
  199. // #define JUCE_PLUGINHOST_AU 1
  200. #endif
  201. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  202. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  203. #endif
  204. #ifndef JUCE_WEB_BROWSER
  205. #define JUCE_WEB_BROWSER 0
  206. #endif
  207. #ifndef JUCE_SUPPORT_CARBON
  208. #define JUCE_SUPPORT_CARBON 1
  209. #endif
  210. #ifndef JUCE_INCLUDE_ZLIB_CODE
  211. #define JUCE_INCLUDE_ZLIB_CODE 1
  212. #endif
  213. #ifndef JUCE_INCLUDE_FLAC_CODE
  214. #define JUCE_INCLUDE_FLAC_CODE 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  217. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  218. #endif
  219. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  220. #define JUCE_INCLUDE_PNGLIB_CODE 1
  221. #endif
  222. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  223. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  224. #endif
  225. #ifndef JUCE_CHECK_MEMORY_LEAKS
  226. #define JUCE_CHECK_MEMORY_LEAKS 1
  227. #endif
  228. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  229. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  230. #endif
  231. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  232. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  233. #undef JUCE_QUICKTIME
  234. #define JUCE_QUICKTIME 0
  235. #undef JUCE_OPENGL
  236. #define JUCE_OPENGL 0
  237. #undef JUCE_USE_CDBURNER
  238. #define JUCE_USE_CDBURNER 0
  239. #undef JUCE_USE_CDREADER
  240. #define JUCE_USE_CDREADER 0
  241. #undef JUCE_WEB_BROWSER
  242. #define JUCE_WEB_BROWSER 0
  243. #undef JUCE_PLUGINHOST_AU
  244. #define JUCE_PLUGINHOST_AU 0
  245. #undef JUCE_PLUGINHOST_VST
  246. #define JUCE_PLUGINHOST_VST 0
  247. #endif
  248. #endif
  249. /*** End of inlined file: juce_Config.h ***/
  250. #ifdef JUCE_NAMESPACE
  251. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  252. #define END_JUCE_NAMESPACE }
  253. #else
  254. #define BEGIN_JUCE_NAMESPACE
  255. #define END_JUCE_NAMESPACE
  256. #endif
  257. /*** Start of inlined file: juce_PlatformDefs.h ***/
  258. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  259. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  260. #ifdef JUCE_FORCE_DEBUG
  261. #undef JUCE_DEBUG
  262. #if JUCE_FORCE_DEBUG
  263. #define JUCE_DEBUG 1
  264. #endif
  265. #endif
  266. #if JUCE_MSVC
  267. #define JUCE_CALLTYPE __stdcall
  268. #else
  269. #define JUCE_CALLTYPE
  270. #endif
  271. // Debugging and assertion macros
  272. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  273. #if JUCE_LOG_ASSERTIONS
  274. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  275. #elif defined (JUCE_DEBUG)
  276. #define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
  277. #else
  278. #define juce_LogCurrentAssertion
  279. #endif
  280. #ifdef JUCE_DEBUG
  281. // If debugging is enabled..
  282. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  283. // Assertions..
  284. #if JUCE_WINDOWS || DOXYGEN
  285. #if JUCE_USE_INTRINSICS
  286. #pragma intrinsic (__debugbreak)
  287. #define juce_breakDebugger __debugbreak();
  288. #elif JUCE_GCC
  289. #define juce_breakDebugger asm("int $3");
  290. #else
  291. #define juce_breakDebugger { __asm int 3 }
  292. #endif
  293. #elif JUCE_MAC
  294. #define juce_breakDebugger Debugger();
  295. #elif JUCE_IPHONE
  296. #define juce_breakDebugger kill (0, SIGTRAP);
  297. #elif JUCE_LINUX
  298. #define juce_breakDebugger kill (0, SIGTRAP);
  299. #endif
  300. /** This will always cause an assertion failure.
  301. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  302. in juce_Config.h).
  303. @see jassert()
  304. */
  305. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  306. /** Platform-independent assertion macro.
  307. This gets optimised out when not being built with debugging turned on.
  308. Be careful not to call any functions within its arguments that are vital to
  309. the behaviour of the program, because these won't get called in the release
  310. build.
  311. @see jassertfalse
  312. */
  313. #define jassert(expression) { if (! (expression)) jassertfalse }
  314. #else
  315. // If debugging is disabled, these dummy debug and assertion macros are used..
  316. #define DBG(dbgtext)
  317. #define jassertfalse { juce_LogCurrentAssertion }
  318. #if JUCE_LOG_ASSERTIONS
  319. #define jassert(expression) { if (! (expression)) jassertfalse }
  320. #else
  321. #define jassert(a) { }
  322. #endif
  323. #endif
  324. #ifndef DOXYGEN
  325. template <bool b> struct JuceStaticAssert;
  326. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  327. #endif
  328. /** A compile-time assertion macro.
  329. If the expression parameter is false, the macro will cause a compile error.
  330. */
  331. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  332. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  333. #define JUCE_TRY try
  334. #define JUCE_CATCH_EXCEPTION \
  335. catch (const std::exception& e) \
  336. { \
  337. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  338. } \
  339. catch (...) \
  340. { \
  341. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  342. }
  343. #define JUCE_CATCH_ALL catch (...) {}
  344. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  345. #else
  346. #define JUCE_TRY
  347. #define JUCE_CATCH_EXCEPTION
  348. #define JUCE_CATCH_ALL
  349. #define JUCE_CATCH_ALL_ASSERT
  350. #endif
  351. // Macros for inlining.
  352. #if JUCE_MSVC
  353. #ifndef JUCE_DEBUG
  354. #define forcedinline __forceinline
  355. #else
  356. #define forcedinline inline
  357. #endif
  358. #else
  359. #ifndef JUCE_DEBUG
  360. #define forcedinline inline __attribute__((always_inline))
  361. #else
  362. #define forcedinline inline
  363. #endif
  364. #endif
  365. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  366. /*** End of inlined file: juce_PlatformDefs.h ***/
  367. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  368. #if JUCE_MSVC
  369. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  370. #pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
  371. #endif
  372. #pragma warning (push)
  373. #pragma warning (disable: 4514 4245 4100)
  374. #endif
  375. #include <cstdlib>
  376. #include <cstdarg>
  377. #include <climits>
  378. #include <limits>
  379. #include <cmath>
  380. #include <cwchar>
  381. #include <stdexcept>
  382. #include <typeinfo>
  383. #include <cstring>
  384. #include <cstdio>
  385. #include <iostream>
  386. #if JUCE_USE_INTRINSICS
  387. #include <intrin.h>
  388. #endif
  389. #if JUCE_MAC || JUCE_IPHONE
  390. #include <libkern/OSAtomic.h>
  391. #endif
  392. #if JUCE_LINUX
  393. #include <signal.h>
  394. #endif
  395. #if JUCE_MSVC && JUCE_DEBUG
  396. #include <crtdbg.h>
  397. #endif
  398. #if JUCE_MSVC
  399. #include <malloc.h>
  400. #pragma warning (pop)
  401. #if ! JUCE_PUBLIC_INCLUDES
  402. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  403. #endif
  404. #endif
  405. // DLL building settings on Win32
  406. #if JUCE_MSVC
  407. #ifdef JUCE_DLL_BUILD
  408. #define JUCE_API __declspec (dllexport)
  409. #pragma warning (disable: 4251)
  410. #elif defined (JUCE_DLL)
  411. #define JUCE_API __declspec (dllimport)
  412. #pragma warning (disable: 4251)
  413. #endif
  414. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  415. #ifdef JUCE_DLL_BUILD
  416. #define JUCE_API __attribute__ ((visibility("default")))
  417. #endif
  418. #endif
  419. #ifndef JUCE_API
  420. #define JUCE_API
  421. #endif
  422. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  423. // Now include some basics that are needed by most of the Juce classes...
  424. BEGIN_JUCE_NAMESPACE
  425. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  426. #if JUCE_LOG_ASSERTIONS
  427. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  428. #endif
  429. /*** Start of inlined file: juce_Memory.h ***/
  430. #ifndef __JUCE_MEMORY_JUCEHEADER__
  431. #define __JUCE_MEMORY_JUCEHEADER__
  432. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  433. #ifndef JUCE_DLL
  434. // Win32 debug non-DLL versions..
  435. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  436. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  437. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  438. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  439. #else
  440. // Win32 debug DLL versions..
  441. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  442. // way all juce calls in the DLL and in the host API will all use the same allocator.
  443. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  444. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  445. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  446. extern JUCE_API void juce_DebugFree (void* const block);
  447. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  448. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  449. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  450. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  451. #endif
  452. #if ! defined (_AFXDLL)
  453. #define juce_UseDebuggingNewOperator \
  454. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  455. static void* operator new (size_t, void* p) { return p; } \
  456. static void operator delete (void* p) { juce_free (p); } \
  457. static void operator delete (void*, void*) { }
  458. #endif
  459. #elif defined (JUCE_DLL)
  460. // Win32 DLL (release) versions..
  461. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  462. // way all juce calls in the DLL and in the host API will all use the same allocator.
  463. extern JUCE_API void* juce_Malloc (const int size);
  464. extern JUCE_API void* juce_Calloc (const int size);
  465. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  466. extern JUCE_API void juce_Free (void* const block);
  467. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  468. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  469. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  470. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  471. #define juce_UseDebuggingNewOperator \
  472. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  473. static void* operator new (size_t, void* p) { return p; } \
  474. static void operator delete (void* p) { juce_free (p); } \
  475. static void operator delete (void*, void*) { }
  476. #else
  477. // Mac, Linux and Win32 (release) versions..
  478. #define juce_malloc(numBytes) malloc (numBytes)
  479. #define juce_calloc(numBytes) calloc (1, numBytes)
  480. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  481. #define juce_free(location) free (location)
  482. #endif
  483. #ifndef juce_UseDebuggingNewOperator
  484. #define juce_UseDebuggingNewOperator
  485. #endif
  486. #if JUCE_MSVC
  487. #define juce_ThreadLocal __declspec(thread)
  488. #else
  489. #define juce_ThreadLocal __thread
  490. #endif
  491. #if JUCE_MINGW
  492. #define alloca __builtin_alloca
  493. #endif
  494. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  495. template <typename Type>
  496. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  497. template <typename Type>
  498. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  499. #endif // __JUCE_MEMORY_JUCEHEADER__
  500. /*** End of inlined file: juce_Memory.h ***/
  501. /*** Start of inlined file: juce_MathsFunctions.h ***/
  502. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  503. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  504. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  505. typedef signed char int8;
  506. typedef unsigned char uint8;
  507. typedef signed short int16;
  508. typedef unsigned short uint16;
  509. typedef signed int int32;
  510. typedef unsigned int uint32;
  511. #if JUCE_MSVC
  512. typedef __int64 int64;
  513. typedef unsigned __int64 uint64;
  514. #define literal64bit(longLiteral) ((__int64) longLiteral)
  515. #else
  516. typedef long long int64;
  517. typedef unsigned long long uint64;
  518. #define literal64bit(longLiteral) (longLiteral##LL)
  519. #endif
  520. #if JUCE_64BIT
  521. typedef int64 pointer_sized_int;
  522. typedef uint64 pointer_sized_uint;
  523. #elif _MSC_VER >= 1300
  524. typedef _W64 int pointer_sized_int;
  525. typedef _W64 unsigned int pointer_sized_uint;
  526. #else
  527. typedef int pointer_sized_int;
  528. typedef unsigned int pointer_sized_uint;
  529. #endif
  530. typedef wchar_t juce_wchar;
  531. // Some indispensible min/max functions
  532. template <typename Type>
  533. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  534. template <typename Type>
  535. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  536. template <typename Type>
  537. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  538. template <typename Type>
  539. inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
  540. template <typename Type>
  541. inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
  542. template <typename Type>
  543. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  544. template <typename Type>
  545. inline Type jlimit (const Type lowerLimit,
  546. const Type upperLimit,
  547. const Type valueToConstrain) throw()
  548. {
  549. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  550. return (valueToConstrain < lowerLimit) ? lowerLimit
  551. : ((upperLimit < valueToConstrain) ? upperLimit
  552. : valueToConstrain);
  553. }
  554. template <typename Type>
  555. inline void swapVariables (Type& variable1, Type& variable2)
  556. {
  557. const Type tempVal = variable1;
  558. variable1 = variable2;
  559. variable2 = tempVal;
  560. }
  561. template <typename Type>
  562. inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
  563. // Some useful maths functions that aren't always present with all compilers and build settings.
  564. inline double juce_hypot (double a, double b)
  565. {
  566. #if JUCE_WINDOWS
  567. return _hypot (a, b);
  568. #else
  569. return hypot (a, b);
  570. #endif
  571. }
  572. inline float juce_hypotf (float a, float b)
  573. {
  574. #if JUCE_WINDOWS
  575. return (float) _hypot (a, b);
  576. #else
  577. return hypotf (a, b);
  578. #endif
  579. }
  580. inline int64 abs64 (const int64 n)
  581. {
  582. return (n >= 0) ? n : -n;
  583. }
  584. const double double_Pi = 3.1415926535897932384626433832795;
  585. const float float_Pi = 3.14159265358979323846f;
  586. template <typename FloatingPointType>
  587. inline bool juce_isfinite (FloatingPointType value)
  588. {
  589. #if JUCE_WINDOWS
  590. return _finite (value);
  591. #else
  592. return std::isfinite (value);
  593. #endif
  594. }
  595. template <typename FloatType>
  596. inline int roundToInt (const FloatType value) throw()
  597. {
  598. union { int asInt[2]; double asDouble; } n;
  599. n.asDouble = ((double) value) + 6755399441055744.0;
  600. #if JUCE_BIG_ENDIAN
  601. return n.asInt [1];
  602. #else
  603. return n.asInt [0];
  604. #endif
  605. }
  606. inline int roundToIntAccurate (const double value) throw()
  607. {
  608. return roundToInt (value + 1.5e-8);
  609. }
  610. inline int roundDoubleToInt (const double value) throw()
  611. {
  612. return roundToInt (value);
  613. }
  614. inline int roundFloatToInt (const float value) throw()
  615. {
  616. return roundToInt (value);
  617. }
  618. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  619. /*** End of inlined file: juce_MathsFunctions.h ***/
  620. /*** Start of inlined file: juce_ByteOrder.h ***/
  621. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  622. #define __JUCE_BYTEORDER_JUCEHEADER__
  623. class JUCE_API ByteOrder
  624. {
  625. public:
  626. static uint16 swap (uint16 value);
  627. static uint32 swap (uint32 value);
  628. static uint64 swap (uint64 value);
  629. static uint16 swapIfBigEndian (uint16 value);
  630. static uint32 swapIfBigEndian (uint32 value);
  631. static uint64 swapIfBigEndian (uint64 value);
  632. static uint16 swapIfLittleEndian (uint16 value);
  633. static uint32 swapIfLittleEndian (uint32 value);
  634. static uint64 swapIfLittleEndian (uint64 value);
  635. static uint32 littleEndianInt (const char* bytes);
  636. static uint16 littleEndianShort (const char* bytes);
  637. static uint32 bigEndianInt (const char* bytes);
  638. static uint16 bigEndianShort (const char* bytes);
  639. static int littleEndian24Bit (const char* bytes);
  640. static int bigEndian24Bit (const char* bytes);
  641. static void littleEndian24BitToChars (int value, char* destBytes);
  642. static void bigEndian24BitToChars (int value, char* destBytes);
  643. static bool isBigEndian();
  644. };
  645. #if JUCE_USE_INTRINSICS
  646. #pragma intrinsic (_byteswap_ulong)
  647. #endif
  648. inline uint16 ByteOrder::swap (uint16 n)
  649. {
  650. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  651. return static_cast <uint16> (_byteswap_ushort (n));
  652. #else
  653. return static_cast <uint16> ((n << 8) | (n >> 8));
  654. #endif
  655. }
  656. inline uint32 ByteOrder::swap (uint32 n)
  657. {
  658. #if JUCE_MAC || JUCE_IPHONE
  659. return OSSwapInt32 (n);
  660. #elif JUCE_GCC
  661. asm("bswap %%eax" : "=a"(n) : "a"(n));
  662. return n;
  663. #elif JUCE_USE_INTRINSICS
  664. return _byteswap_ulong (n);
  665. #else
  666. __asm {
  667. mov eax, n
  668. bswap eax
  669. mov n, eax
  670. }
  671. return n;
  672. #endif
  673. }
  674. inline uint64 ByteOrder::swap (uint64 value)
  675. {
  676. #if JUCE_MAC || JUCE_IPHONE
  677. return OSSwapInt64 (value);
  678. #elif JUCE_USE_INTRINSICS
  679. return _byteswap_uint64 (value);
  680. #else
  681. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  682. #endif
  683. }
  684. #if JUCE_LITTLE_ENDIAN
  685. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  686. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  687. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  688. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  689. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  690. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  691. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  692. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  693. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  694. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  695. inline bool ByteOrder::isBigEndian() { return false; }
  696. #else
  697. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  698. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  699. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  700. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  701. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  702. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  703. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  704. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  705. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  706. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  707. inline bool ByteOrder::isBigEndian() { return true; }
  708. #endif
  709. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  710. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  711. 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); }
  712. 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); }
  713. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  714. /*** End of inlined file: juce_ByteOrder.h ***/
  715. /*** Start of inlined file: juce_Logger.h ***/
  716. #ifndef __JUCE_LOGGER_JUCEHEADER__
  717. #define __JUCE_LOGGER_JUCEHEADER__
  718. /*** Start of inlined file: juce_String.h ***/
  719. #ifndef __JUCE_STRING_JUCEHEADER__
  720. #define __JUCE_STRING_JUCEHEADER__
  721. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  722. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  723. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  724. #define JUCE_T(stringLiteral) (L##stringLiteral)
  725. typedef juce_wchar tchar;
  726. #if ! JUCE_DONT_DEFINE_MACROS
  727. #define T(stringLiteral) JUCE_T(stringLiteral)
  728. #endif
  729. class JUCE_API CharacterFunctions
  730. {
  731. public:
  732. static int length (const char* const s) throw();
  733. static int length (const juce_wchar* const s) throw();
  734. static void copy (char* dest, const char* src, const int maxBytes) throw();
  735. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  736. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  737. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  738. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  739. static void append (char* dest, const char* src) throw();
  740. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  741. static int compare (const char* const s1, const char* const s2) throw();
  742. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  743. static int compare (const juce_wchar* s1, const char* s2) throw();
  744. static int compare (const char* s1, const juce_wchar* s2) throw();
  745. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  746. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  747. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  748. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  749. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  750. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  751. static const char* find (const char* const haystack, const char* const needle) throw();
  752. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  753. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  754. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  755. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  756. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  757. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  758. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  759. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  760. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  761. static int getIntValue (const char* const s) throw();
  762. static int getIntValue (const juce_wchar* s) throw();
  763. static int64 getInt64Value (const char* s) throw();
  764. static int64 getInt64Value (const juce_wchar* s) throw();
  765. static double getDoubleValue (const char* const s) throw();
  766. static double getDoubleValue (const juce_wchar* const s) throw();
  767. static char toUpperCase (const char character) throw();
  768. static juce_wchar toUpperCase (const juce_wchar character) throw();
  769. static void toUpperCase (char* s) throw();
  770. static void toUpperCase (juce_wchar* s) throw();
  771. static bool isUpperCase (const char character) throw();
  772. static bool isUpperCase (const juce_wchar character) throw();
  773. static char toLowerCase (const char character) throw();
  774. static juce_wchar toLowerCase (const juce_wchar character) throw();
  775. static void toLowerCase (char* s) throw();
  776. static void toLowerCase (juce_wchar* s) throw();
  777. static bool isLowerCase (const char character) throw();
  778. static bool isLowerCase (const juce_wchar character) throw();
  779. static bool isWhitespace (const char character) throw();
  780. static bool isWhitespace (const juce_wchar character) throw();
  781. static bool isDigit (const char character) throw();
  782. static bool isDigit (const juce_wchar character) throw();
  783. static bool isLetter (const char character) throw();
  784. static bool isLetter (const juce_wchar character) throw();
  785. static bool isLetterOrDigit (const char character) throw();
  786. static bool isLetterOrDigit (const juce_wchar character) throw();
  787. static int getHexDigitValue (const juce_wchar digit) throw();
  788. };
  789. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  790. /*** End of inlined file: juce_CharacterFunctions.h ***/
  791. class OutputStream;
  792. class JUCE_API String
  793. {
  794. public:
  795. String() throw();
  796. String (const String& other) throw();
  797. String (const char* text);
  798. String (const char* text, size_t maxChars);
  799. String (const juce_wchar* unicodeText);
  800. String (const juce_wchar* unicodeText, size_t maxChars);
  801. static const String charToString (juce_wchar character);
  802. ~String() throw();
  803. //========================juce_wchar======================================================
  804. static const String empty;
  805. int hashCode() const throw();
  806. int64 hashCode64() const throw();
  807. int length() const throw();
  808. // Assignment and concatenation operators..
  809. String& operator= (const String& other) throw();
  810. String& operator+= (const juce_wchar* textToAppend);
  811. String& operator+= (const String& stringToAppend);
  812. String& operator+= (char characterToAppend);
  813. String& operator+= (juce_wchar characterToAppend);
  814. String& operator+= (int numberToAppend);
  815. String& operator+= (unsigned int numberToAppend);
  816. void append (const juce_wchar* textToAppend, int maxCharsToTake);
  817. // Comparison methods..
  818. inline bool isEmpty() const throw() { return text[0] == 0; }
  819. inline bool isNotEmpty() const throw() { return text[0] != 0; }
  820. bool equalsIgnoreCase (const String& other) const throw();
  821. bool equalsIgnoreCase (const juce_wchar* other) const throw();
  822. int compare (const String& other) const throw();
  823. int compare (const char* other) const throw();
  824. int compare (const juce_wchar* other) const throw();
  825. int compareIgnoreCase (const String& other) const throw();
  826. int compareLexicographically (const String& other) const throw();
  827. bool startsWith (const juce_wchar* text) const throw();
  828. bool startsWithChar (juce_wchar character) const throw();
  829. bool startsWithIgnoreCase (const juce_wchar* text) const throw();
  830. bool endsWith (const juce_wchar* text) const throw();
  831. bool endsWithChar (juce_wchar character) const throw();
  832. bool endsWithIgnoreCase (const juce_wchar* text) const throw();
  833. bool contains (const juce_wchar* text) const throw();
  834. bool containsChar (juce_wchar character) const throw();
  835. bool containsIgnoreCase (const juce_wchar* text) const throw();
  836. bool containsWholeWord (const juce_wchar* wordToLookFor) const throw();
  837. bool containsWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  838. int indexOfWholeWord (const juce_wchar* wordToLookFor) const throw();
  839. int indexOfWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  840. bool containsAnyOf (const juce_wchar* charactersItMightContain) const throw();
  841. bool containsOnly (const juce_wchar* charactersItMightContain) const throw();
  842. bool containsNonWhitespaceChars() const throw();
  843. bool matchesWildcard (const juce_wchar* wildcard, bool ignoreCase) const throw();
  844. // Substring location methods..
  845. int indexOfChar (juce_wchar characterToLookFor) const throw();
  846. int indexOfChar (int startIndex, juce_wchar characterToLookFor) const throw();
  847. int indexOfAnyOf (const juce_wchar* charactersToLookFor,
  848. int startIndex = 0,
  849. bool ignoreCase = false) const throw();
  850. int indexOf (const juce_wchar* text) const throw();
  851. int indexOf (int startIndex,
  852. const juce_wchar* textToLookFor) const throw();
  853. int indexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  854. int indexOfIgnoreCase (int startIndex,
  855. const juce_wchar* textToLookFor) const throw();
  856. int lastIndexOfChar (juce_wchar character) const throw();
  857. int lastIndexOf (const juce_wchar* textToLookFor) const throw();
  858. int lastIndexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  859. int lastIndexOfAnyOf (const juce_wchar* charactersToLookFor,
  860. bool ignoreCase = false) const throw();
  861. // Substring extraction and manipulation methods..
  862. /** Returns the character at this index in the string.
  863. No checks are made to see if the index is within a valid range, so be careful!
  864. */
  865. inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; }
  866. juce_wchar& operator[] (int index);
  867. juce_wchar getLastCharacter() const throw();
  868. const String substring (int startIndex, int endIndex) const;
  869. const String substring (int startIndex) const;
  870. const String dropLastCharacters (int numberToDrop) const;
  871. const String getLastCharacters (int numCharacters) const;
  872. const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom,
  873. bool includeSubStringInResult,
  874. bool ignoreCase) const;
  875. const String fromLastOccurrenceOf (const juce_wchar* substringToFind,
  876. bool includeSubStringInResult,
  877. bool ignoreCase) const;
  878. const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith,
  879. bool includeSubStringInResult,
  880. bool ignoreCase) const;
  881. const String upToLastOccurrenceOf (const juce_wchar* substringToFind,
  882. bool includeSubStringInResult,
  883. bool ignoreCase) const;
  884. const String trim() const;
  885. const String trimStart() const;
  886. const String trimEnd() const;
  887. const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const;
  888. const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const;
  889. const String toUpperCase() const;
  890. const String toLowerCase() const;
  891. const String replaceSection (int startIndex,
  892. int numCharactersToReplace,
  893. const juce_wchar* stringToInsert) const;
  894. const String replace (const juce_wchar* stringToReplace,
  895. const juce_wchar* stringToInsertInstead,
  896. bool ignoreCase = false) const;
  897. const String replaceCharacter (juce_wchar characterToReplace,
  898. juce_wchar characterToInsertInstead) const;
  899. const String replaceCharacters (const String& charactersToReplace,
  900. const juce_wchar* charactersToInsertInstead) const;
  901. const String retainCharacters (const juce_wchar* charactersToRetain) const;
  902. const String removeCharacters (const juce_wchar* charactersToRemove) const;
  903. const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const;
  904. const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const;
  905. bool isQuotedString() const;
  906. const String unquoted() const;
  907. const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const;
  908. static const String repeatedString (const juce_wchar* stringToRepeat,
  909. int numberOfTimesToRepeat);
  910. const String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
  911. const String paddedRight (juce_wchar padCharacter, int minimumLength) const;
  912. static const String createStringFromData (const void* data, int size);
  913. static const String formatted (const juce_wchar* formatString, ... );
  914. // Numeric conversions..
  915. explicit String (int decimalInteger);
  916. explicit String (unsigned int decimalInteger);
  917. explicit String (short decimalInteger);
  918. explicit String (unsigned short decimalInteger);
  919. explicit String (int64 largeIntegerValue);
  920. explicit String (uint64 largeIntegerValue);
  921. explicit String (float floatValue,
  922. int numberOfDecimalPlaces = 0);
  923. explicit String (double doubleValue,
  924. int numberOfDecimalPlaces = 0);
  925. int getIntValue() const throw();
  926. int64 getLargeIntValue() const throw();
  927. int getTrailingIntValue() const throw();
  928. float getFloatValue() const throw();
  929. double getDoubleValue() const throw();
  930. int getHexValue32() const throw();
  931. int64 getHexValue64() const throw();
  932. static const String toHexString (int number);
  933. static const String toHexString (int64 number);
  934. static const String toHexString (short number);
  935. static const String toHexString (const unsigned char* data,
  936. int size,
  937. int groupSize = 1);
  938. inline operator const juce_wchar*() const throw() { return text; }
  939. inline operator juce_wchar*() throw() { return text; }
  940. const char* toUTF8() const;
  941. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  942. int getNumBytesAsUTF8() const throw();
  943. int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw();
  944. const char* toCString() const;
  945. int getNumBytesAsCString() const throw();
  946. int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw();
  947. void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
  948. void preallocateStorage (size_t numCharsNeeded);
  949. void swapWith (String& other) throw();
  950. class JUCE_API Concatenator
  951. {
  952. public:
  953. Concatenator (String& stringToAppendTo);
  954. ~Concatenator();
  955. void append (const String& s);
  956. private:
  957. String& result;
  958. int nextIndex;
  959. Concatenator (const Concatenator&);
  960. Concatenator& operator= (const Concatenator&);
  961. };
  962. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  963. private:
  964. juce_wchar* text;
  965. // internal constructor that preallocates a certain amount of memory
  966. String (size_t numChars, int dummyVariable);
  967. String (const String& stringToCopy, size_t charsToAllocate);
  968. void createInternal (const juce_wchar* text, size_t numChars);
  969. void appendInternal (const juce_wchar* text, int numExtraChars);
  970. };
  971. const String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
  972. const String JUCE_CALLTYPE operator+ (const juce_wchar* string1, const String& string2);
  973. const String JUCE_CALLTYPE operator+ (char string1, const String& string2);
  974. const String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
  975. const String JUCE_CALLTYPE operator+ (String string1, const String& string2);
  976. const String JUCE_CALLTYPE operator+ (String string1, const char* string2);
  977. const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar* string2);
  978. const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
  979. const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
  980. String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
  981. String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
  982. String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
  983. String& JUCE_CALLTYPE operator<< (String& string1, const juce_wchar* string2);
  984. String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
  985. String& JUCE_CALLTYPE operator<< (String& string1, short number);
  986. String& JUCE_CALLTYPE operator<< (String& string1, int number);
  987. String& JUCE_CALLTYPE operator<< (String& string1, unsigned int number);
  988. String& JUCE_CALLTYPE operator<< (String& string1, long number);
  989. String& JUCE_CALLTYPE operator<< (String& string1, unsigned long number);
  990. String& JUCE_CALLTYPE operator<< (String& string1, float number);
  991. String& JUCE_CALLTYPE operator<< (String& string1, double number);
  992. bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw();
  993. bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw();
  994. bool JUCE_CALLTYPE operator== (const String& string1, const juce_wchar* string2) throw();
  995. bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw();
  996. bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw();
  997. bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* string2) throw();
  998. bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw();
  999. bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw();
  1000. bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw();
  1001. bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
  1002. template <class charT, class traits>
  1003. std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1004. {
  1005. return stream << stringToWrite.toUTF8();
  1006. }
  1007. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);
  1008. #endif // __JUCE_STRING_JUCEHEADER__
  1009. /*** End of inlined file: juce_String.h ***/
  1010. class JUCE_API Logger
  1011. {
  1012. public:
  1013. virtual ~Logger();
  1014. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1015. const bool deleteOldLogger = false);
  1016. static void JUCE_CALLTYPE writeToLog (const String& message);
  1017. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1018. protected:
  1019. Logger();
  1020. virtual void logMessage (const String& message) = 0;
  1021. };
  1022. #endif // __JUCE_LOGGER_JUCEHEADER__
  1023. /*** End of inlined file: juce_Logger.h ***/
  1024. END_JUCE_NAMESPACE
  1025. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1026. /*** End of inlined file: juce_StandardHeader.h ***/
  1027. BEGIN_JUCE_NAMESPACE
  1028. #if JUCE_MSVC
  1029. // this is set explicitly in case the app is using a different packing size.
  1030. #pragma pack (push, 8)
  1031. #pragma warning (push)
  1032. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1033. #endif
  1034. // this is where all the class header files get brought in..
  1035. /*** Start of inlined file: juce_core_includes.h ***/
  1036. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1037. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1038. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1039. /*** Start of inlined file: juce_Array.h ***/
  1040. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1041. #define __JUCE_ARRAY_JUCEHEADER__
  1042. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1043. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1044. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1045. /*** Start of inlined file: juce_HeapBlock.h ***/
  1046. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1047. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1048. template <class ElementType>
  1049. class HeapBlock
  1050. {
  1051. public:
  1052. HeapBlock() throw() : data (0)
  1053. {
  1054. }
  1055. HeapBlock (const size_t numElements)
  1056. : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1057. {
  1058. }
  1059. ~HeapBlock()
  1060. {
  1061. ::juce_free (data);
  1062. }
  1063. inline operator ElementType*() const throw() { return data; }
  1064. inline ElementType* getData() const throw() { return data; }
  1065. inline operator void*() const throw() { return static_cast <void*> (data); }
  1066. inline ElementType* operator->() const throw() { return data; }
  1067. template <typename IndexType>
  1068. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1069. template <typename IndexType>
  1070. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1071. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1072. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1073. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1074. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1075. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1076. {
  1077. ::juce_free (data);
  1078. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1079. }
  1080. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1081. {
  1082. ::juce_free (data);
  1083. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1084. }
  1085. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1086. {
  1087. ::juce_free (data);
  1088. if (initialiseToZero)
  1089. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1090. else
  1091. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1092. }
  1093. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1094. {
  1095. if (data == 0)
  1096. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1097. else
  1098. data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1099. }
  1100. void free()
  1101. {
  1102. ::juce_free (data);
  1103. data = 0;
  1104. }
  1105. void swapWith (HeapBlock <ElementType>& other) throw()
  1106. {
  1107. swapVariables (data, other.data);
  1108. }
  1109. private:
  1110. ElementType* data;
  1111. HeapBlock (const HeapBlock&);
  1112. HeapBlock& operator= (const HeapBlock&);
  1113. };
  1114. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1115. /*** End of inlined file: juce_HeapBlock.h ***/
  1116. template <class ElementType, class TypeOfCriticalSectionToUse>
  1117. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1118. {
  1119. public:
  1120. ArrayAllocationBase() throw()
  1121. : numAllocated (0)
  1122. {
  1123. }
  1124. ~ArrayAllocationBase()
  1125. {
  1126. }
  1127. void setAllocatedSize (const int numElements)
  1128. {
  1129. if (numAllocated != numElements)
  1130. {
  1131. if (numElements > 0)
  1132. elements.realloc (numElements);
  1133. else
  1134. elements.free();
  1135. numAllocated = numElements;
  1136. }
  1137. }
  1138. void ensureAllocatedSize (const int minNumElements)
  1139. {
  1140. if (minNumElements > numAllocated)
  1141. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1142. }
  1143. void shrinkToNoMoreThan (const int maxNumElements)
  1144. {
  1145. if (maxNumElements < numAllocated)
  1146. setAllocatedSize (maxNumElements);
  1147. }
  1148. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1149. {
  1150. elements.swapWith (other.elements);
  1151. swapVariables (numAllocated, other.numAllocated);
  1152. }
  1153. HeapBlock <ElementType> elements;
  1154. int numAllocated;
  1155. private:
  1156. ArrayAllocationBase (const ArrayAllocationBase&);
  1157. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1158. };
  1159. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1160. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1161. /*** Start of inlined file: juce_ElementComparator.h ***/
  1162. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1163. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1164. template <class ElementType, class ElementComparator>
  1165. static void sortArray (ElementComparator& comparator,
  1166. ElementType* const array,
  1167. int firstElement,
  1168. int lastElement,
  1169. const bool retainOrderOfEquivalentItems)
  1170. {
  1171. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1172. // avoids getting warning messages about the parameter being unused
  1173. if (lastElement > firstElement)
  1174. {
  1175. if (retainOrderOfEquivalentItems)
  1176. {
  1177. for (int i = firstElement; i < lastElement; ++i)
  1178. {
  1179. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1180. {
  1181. const ElementType temp = array [i];
  1182. array [i] = array[i + 1];
  1183. array [i + 1] = temp;
  1184. if (i > firstElement)
  1185. i -= 2;
  1186. }
  1187. }
  1188. }
  1189. else
  1190. {
  1191. int fromStack[30], toStack[30];
  1192. int stackIndex = 0;
  1193. for (;;)
  1194. {
  1195. const int size = (lastElement - firstElement) + 1;
  1196. if (size <= 8)
  1197. {
  1198. int j = lastElement;
  1199. int maxIndex;
  1200. while (j > firstElement)
  1201. {
  1202. maxIndex = firstElement;
  1203. for (int k = firstElement + 1; k <= j; ++k)
  1204. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1205. maxIndex = k;
  1206. const ElementType temp = array [maxIndex];
  1207. array [maxIndex] = array[j];
  1208. array [j] = temp;
  1209. --j;
  1210. }
  1211. }
  1212. else
  1213. {
  1214. const int mid = firstElement + (size >> 1);
  1215. ElementType temp = array [mid];
  1216. array [mid] = array [firstElement];
  1217. array [firstElement] = temp;
  1218. int i = firstElement;
  1219. int j = lastElement + 1;
  1220. for (;;)
  1221. {
  1222. while (++i <= lastElement
  1223. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1224. {}
  1225. while (--j > firstElement
  1226. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1227. {}
  1228. if (j < i)
  1229. break;
  1230. temp = array[i];
  1231. array[i] = array[j];
  1232. array[j] = temp;
  1233. }
  1234. temp = array [firstElement];
  1235. array [firstElement] = array[j];
  1236. array [j] = temp;
  1237. if (j - 1 - firstElement >= lastElement - i)
  1238. {
  1239. if (firstElement + 1 < j)
  1240. {
  1241. fromStack [stackIndex] = firstElement;
  1242. toStack [stackIndex] = j - 1;
  1243. ++stackIndex;
  1244. }
  1245. if (i < lastElement)
  1246. {
  1247. firstElement = i;
  1248. continue;
  1249. }
  1250. }
  1251. else
  1252. {
  1253. if (i < lastElement)
  1254. {
  1255. fromStack [stackIndex] = i;
  1256. toStack [stackIndex] = lastElement;
  1257. ++stackIndex;
  1258. }
  1259. if (firstElement + 1 < j)
  1260. {
  1261. lastElement = j - 1;
  1262. continue;
  1263. }
  1264. }
  1265. }
  1266. if (--stackIndex < 0)
  1267. break;
  1268. jassert (stackIndex < numElementsInArray (fromStack));
  1269. firstElement = fromStack [stackIndex];
  1270. lastElement = toStack [stackIndex];
  1271. }
  1272. }
  1273. }
  1274. }
  1275. template <class ElementType, class ElementComparator>
  1276. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1277. ElementType* const array,
  1278. const ElementType newElement,
  1279. int firstElement,
  1280. int lastElement)
  1281. {
  1282. jassert (firstElement <= lastElement);
  1283. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1284. // avoids getting warning messages about the parameter being unused
  1285. while (firstElement < lastElement)
  1286. {
  1287. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1288. {
  1289. ++firstElement;
  1290. break;
  1291. }
  1292. else
  1293. {
  1294. const int halfway = (firstElement + lastElement) >> 1;
  1295. if (halfway == firstElement)
  1296. {
  1297. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1298. ++firstElement;
  1299. break;
  1300. }
  1301. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1302. {
  1303. firstElement = halfway;
  1304. }
  1305. else
  1306. {
  1307. lastElement = halfway;
  1308. }
  1309. }
  1310. }
  1311. return firstElement;
  1312. }
  1313. template <class ElementType>
  1314. class IntegerElementComparator
  1315. {
  1316. public:
  1317. static int compareElements (const ElementType first,
  1318. const ElementType second) throw()
  1319. {
  1320. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1321. }
  1322. };
  1323. template <class ElementType>
  1324. class FloatElementComparator
  1325. {
  1326. public:
  1327. static int compareElements (const ElementType first,
  1328. const ElementType second) throw()
  1329. {
  1330. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1331. }
  1332. };
  1333. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1334. /*** End of inlined file: juce_ElementComparator.h ***/
  1335. /*** Start of inlined file: juce_CriticalSection.h ***/
  1336. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1337. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1338. class JUCE_API ScopedLock;
  1339. class JUCE_API ScopedUnlock;
  1340. class JUCE_API CriticalSection
  1341. {
  1342. public:
  1343. CriticalSection() throw();
  1344. ~CriticalSection() throw();
  1345. void enter() const throw();
  1346. bool tryEnter() const throw();
  1347. void exit() const throw();
  1348. typedef ScopedLock ScopedLockType;
  1349. typedef ScopedUnlock ScopedUnlockType;
  1350. juce_UseDebuggingNewOperator
  1351. private:
  1352. #if JUCE_WIN32
  1353. #if JUCE_64BIT
  1354. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1355. // block of memory here that's big enough to be used internally as a windows critical
  1356. // section object.
  1357. uint8 internal [44];
  1358. #else
  1359. uint8 internal [24];
  1360. #endif
  1361. #else
  1362. mutable pthread_mutex_t internal;
  1363. #endif
  1364. CriticalSection (const CriticalSection&);
  1365. CriticalSection& operator= (const CriticalSection&);
  1366. };
  1367. class JUCE_API DummyCriticalSection
  1368. {
  1369. public:
  1370. inline DummyCriticalSection() throw() {}
  1371. inline ~DummyCriticalSection() throw() {}
  1372. inline void enter() const throw() {}
  1373. inline void exit() const throw() {}
  1374. struct ScopedLockType
  1375. {
  1376. ScopedLockType (const DummyCriticalSection&) throw() {}
  1377. };
  1378. typedef ScopedLockType ScopedUnlockType;
  1379. private:
  1380. DummyCriticalSection (const DummyCriticalSection&);
  1381. DummyCriticalSection& operator= (const DummyCriticalSection&);
  1382. };
  1383. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1384. /*** End of inlined file: juce_CriticalSection.h ***/
  1385. template <typename ElementType,
  1386. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1387. class Array
  1388. {
  1389. public:
  1390. Array() throw()
  1391. : numUsed (0)
  1392. {
  1393. }
  1394. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1395. {
  1396. const ScopedLockType lock (other.getLock());
  1397. numUsed = other.numUsed;
  1398. data.setAllocatedSize (other.numUsed);
  1399. for (int i = 0; i < numUsed; ++i)
  1400. new (data.elements + i) ElementType (other.data.elements[i]);
  1401. }
  1402. explicit Array (const ElementType* values)
  1403. : numUsed (0)
  1404. {
  1405. while (*values != 0)
  1406. add (*values++);
  1407. }
  1408. Array (const ElementType* values, int numValues)
  1409. : numUsed (numValues)
  1410. {
  1411. data.setAllocatedSize (numValues);
  1412. for (int i = 0; i < numValues; ++i)
  1413. new (data.elements + i) ElementType (values[i]);
  1414. }
  1415. ~Array()
  1416. {
  1417. for (int i = 0; i < numUsed; ++i)
  1418. data.elements[i].~ElementType();
  1419. }
  1420. Array& operator= (const Array& other)
  1421. {
  1422. if (this != &other)
  1423. {
  1424. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1425. swapWithArray (otherCopy);
  1426. }
  1427. return *this;
  1428. }
  1429. template <class OtherArrayType>
  1430. bool operator== (const OtherArrayType& other) const
  1431. {
  1432. const ScopedLockType lock (getLock());
  1433. if (numUsed != other.numUsed)
  1434. return false;
  1435. for (int i = numUsed; --i >= 0;)
  1436. if (data.elements [i] != other.data.elements [i])
  1437. return false;
  1438. return true;
  1439. }
  1440. template <class OtherArrayType>
  1441. bool operator!= (const OtherArrayType& other) const
  1442. {
  1443. return ! operator== (other);
  1444. }
  1445. void clear()
  1446. {
  1447. const ScopedLockType lock (getLock());
  1448. for (int i = 0; i < numUsed; ++i)
  1449. data.elements[i].~ElementType();
  1450. data.setAllocatedSize (0);
  1451. numUsed = 0;
  1452. }
  1453. void clearQuick()
  1454. {
  1455. const ScopedLockType lock (getLock());
  1456. for (int i = 0; i < numUsed; ++i)
  1457. data.elements[i].~ElementType();
  1458. numUsed = 0;
  1459. }
  1460. inline int size() const throw()
  1461. {
  1462. return numUsed;
  1463. }
  1464. inline ElementType operator[] (const int index) const
  1465. {
  1466. const ScopedLockType lock (getLock());
  1467. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1468. : ElementType();
  1469. }
  1470. inline const ElementType getUnchecked (const int index) const
  1471. {
  1472. const ScopedLockType lock (getLock());
  1473. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1474. return data.elements [index];
  1475. }
  1476. inline ElementType& getReference (const int index) const throw()
  1477. {
  1478. const ScopedLockType lock (getLock());
  1479. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1480. return data.elements [index];
  1481. }
  1482. inline ElementType getFirst() const
  1483. {
  1484. const ScopedLockType lock (getLock());
  1485. return (numUsed > 0) ? data.elements [0]
  1486. : ElementType();
  1487. }
  1488. inline ElementType getLast() const
  1489. {
  1490. const ScopedLockType lock (getLock());
  1491. return (numUsed > 0) ? data.elements [numUsed - 1]
  1492. : ElementType();
  1493. }
  1494. int indexOf (const ElementType& elementToLookFor) const
  1495. {
  1496. const ScopedLockType lock (getLock());
  1497. const ElementType* e = data.elements.getData();
  1498. const ElementType* const end = e + numUsed;
  1499. while (e != end)
  1500. {
  1501. if (elementToLookFor == *e)
  1502. return static_cast <int> (e - data.elements.getData());
  1503. ++e;
  1504. }
  1505. return -1;
  1506. }
  1507. bool contains (const ElementType& elementToLookFor) const
  1508. {
  1509. const ScopedLockType lock (getLock());
  1510. const ElementType* e = data.elements.getData();
  1511. const ElementType* const end = e + numUsed;
  1512. while (e != end)
  1513. {
  1514. if (elementToLookFor == *e)
  1515. return true;
  1516. ++e;
  1517. }
  1518. return false;
  1519. }
  1520. void add (const ElementType& newElement)
  1521. {
  1522. const ScopedLockType lock (getLock());
  1523. data.ensureAllocatedSize (numUsed + 1);
  1524. new (data.elements + numUsed++) ElementType (newElement);
  1525. }
  1526. void insert (int indexToInsertAt, const ElementType& newElement)
  1527. {
  1528. const ScopedLockType lock (getLock());
  1529. data.ensureAllocatedSize (numUsed + 1);
  1530. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1531. {
  1532. ElementType* const insertPos = data.elements + indexToInsertAt;
  1533. const int numberToMove = numUsed - indexToInsertAt;
  1534. if (numberToMove > 0)
  1535. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1536. new (insertPos) ElementType (newElement);
  1537. ++numUsed;
  1538. }
  1539. else
  1540. {
  1541. new (data.elements + numUsed++) ElementType (newElement);
  1542. }
  1543. }
  1544. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1545. int numberOfTimesToInsertIt)
  1546. {
  1547. if (numberOfTimesToInsertIt > 0)
  1548. {
  1549. const ScopedLockType lock (getLock());
  1550. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1551. ElementType* insertPos;
  1552. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1553. {
  1554. insertPos = data.elements + indexToInsertAt;
  1555. const int numberToMove = numUsed - indexToInsertAt;
  1556. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1557. }
  1558. else
  1559. {
  1560. insertPos = data.elements + numUsed;
  1561. }
  1562. numUsed += numberOfTimesToInsertIt;
  1563. while (--numberOfTimesToInsertIt >= 0)
  1564. new (insertPos++) ElementType (newElement);
  1565. }
  1566. }
  1567. void insertArray (int indexToInsertAt,
  1568. const ElementType* newElements,
  1569. int numberOfElements)
  1570. {
  1571. if (numberOfElements > 0)
  1572. {
  1573. const ScopedLockType lock (getLock());
  1574. data.ensureAllocatedSize (numUsed + numberOfElements);
  1575. ElementType* insertPos;
  1576. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1577. {
  1578. insertPos = data.elements + indexToInsertAt;
  1579. const int numberToMove = numUsed - indexToInsertAt;
  1580. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1581. }
  1582. else
  1583. {
  1584. insertPos = data.elements + numUsed;
  1585. }
  1586. numUsed += numberOfElements;
  1587. while (--numberOfElements >= 0)
  1588. new (insertPos++) ElementType (*newElements++);
  1589. }
  1590. }
  1591. void addIfNotAlreadyThere (const ElementType& newElement)
  1592. {
  1593. const ScopedLockType lock (getLock());
  1594. if (! contains (newElement))
  1595. add (newElement);
  1596. }
  1597. void set (const int indexToChange, const ElementType& newValue)
  1598. {
  1599. jassert (indexToChange >= 0);
  1600. const ScopedLockType lock (getLock());
  1601. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1602. {
  1603. data.elements [indexToChange] = newValue;
  1604. }
  1605. else if (indexToChange >= 0)
  1606. {
  1607. data.ensureAllocatedSize (numUsed + 1);
  1608. new (data.elements + numUsed++) ElementType (newValue);
  1609. }
  1610. }
  1611. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1612. {
  1613. const ScopedLockType lock (getLock());
  1614. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1615. data.elements [indexToChange] = newValue;
  1616. }
  1617. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1618. {
  1619. const ScopedLockType lock (getLock());
  1620. if (numElementsToAdd > 0)
  1621. {
  1622. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1623. while (--numElementsToAdd >= 0)
  1624. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1625. }
  1626. }
  1627. void swapWithArray (Array& otherArray) throw()
  1628. {
  1629. const ScopedLockType lock1 (getLock());
  1630. const ScopedLockType lock2 (otherArray.getLock());
  1631. data.swapWith (otherArray.data);
  1632. swapVariables (numUsed, otherArray.numUsed);
  1633. }
  1634. template <class OtherArrayType>
  1635. void addArray (const OtherArrayType& arrayToAddFrom,
  1636. int startIndex = 0,
  1637. int numElementsToAdd = -1)
  1638. {
  1639. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1640. const ScopedLockType lock2 (getLock());
  1641. if (startIndex < 0)
  1642. {
  1643. jassertfalse
  1644. startIndex = 0;
  1645. }
  1646. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1647. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1648. while (--numElementsToAdd >= 0)
  1649. add (arrayToAddFrom.getUnchecked (startIndex++));
  1650. }
  1651. template <class ElementComparator>
  1652. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1653. {
  1654. const ScopedLockType lock (getLock());
  1655. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1656. }
  1657. template <class ElementComparator>
  1658. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1659. {
  1660. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1661. // avoids getting warning messages about the parameter being unused
  1662. const ScopedLockType lock (getLock());
  1663. int start = 0;
  1664. int end = numUsed;
  1665. for (;;)
  1666. {
  1667. if (start >= end)
  1668. {
  1669. return -1;
  1670. }
  1671. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1672. {
  1673. return start;
  1674. }
  1675. else
  1676. {
  1677. const int halfway = (start + end) >> 1;
  1678. if (halfway == start)
  1679. return -1;
  1680. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1681. start = halfway;
  1682. else
  1683. end = halfway;
  1684. }
  1685. }
  1686. }
  1687. ElementType remove (const int indexToRemove)
  1688. {
  1689. const ScopedLockType lock (getLock());
  1690. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1691. {
  1692. --numUsed;
  1693. ElementType* const e = data.elements + indexToRemove;
  1694. ElementType removed (*e);
  1695. e->~ElementType();
  1696. const int numberToShift = numUsed - indexToRemove;
  1697. if (numberToShift > 0)
  1698. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1699. if ((numUsed << 1) < data.numAllocated)
  1700. minimiseStorageOverheads();
  1701. return removed;
  1702. }
  1703. else
  1704. {
  1705. return ElementType();
  1706. }
  1707. }
  1708. void removeValue (const ElementType& valueToRemove)
  1709. {
  1710. const ScopedLockType lock (getLock());
  1711. ElementType* e = data.elements;
  1712. for (int i = numUsed; --i >= 0;)
  1713. {
  1714. if (valueToRemove == *e)
  1715. {
  1716. remove (static_cast <int> (e - data.elements.getData()));
  1717. break;
  1718. }
  1719. ++e;
  1720. }
  1721. }
  1722. void removeRange (int startIndex, int numberToRemove)
  1723. {
  1724. const ScopedLockType lock (getLock());
  1725. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1726. startIndex = jlimit (0, numUsed, startIndex);
  1727. if (endIndex > startIndex)
  1728. {
  1729. ElementType* const e = data.elements + startIndex;
  1730. numberToRemove = endIndex - startIndex;
  1731. for (int i = 0; i < numberToRemove; ++i)
  1732. e[i].~ElementType();
  1733. const int numToShift = numUsed - endIndex;
  1734. if (numToShift > 0)
  1735. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1736. numUsed -= numberToRemove;
  1737. if ((numUsed << 1) < data.numAllocated)
  1738. minimiseStorageOverheads();
  1739. }
  1740. }
  1741. void removeLast (int howManyToRemove = 1)
  1742. {
  1743. const ScopedLockType lock (getLock());
  1744. if (howManyToRemove > numUsed)
  1745. howManyToRemove = numUsed;
  1746. for (int i = 0; i < howManyToRemove; ++i)
  1747. data.elements [numUsed - i].~ElementType();
  1748. numUsed -= howManyToRemove;
  1749. if ((numUsed << 1) < data.numAllocated)
  1750. minimiseStorageOverheads();
  1751. }
  1752. template <class OtherArrayType>
  1753. void removeValuesIn (const OtherArrayType& otherArray)
  1754. {
  1755. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1756. const ScopedLockType lock2 (getLock());
  1757. if (this == &otherArray)
  1758. {
  1759. clear();
  1760. }
  1761. else
  1762. {
  1763. if (otherArray.size() > 0)
  1764. {
  1765. for (int i = numUsed; --i >= 0;)
  1766. if (otherArray.contains (data.elements [i]))
  1767. remove (i);
  1768. }
  1769. }
  1770. }
  1771. template <class OtherArrayType>
  1772. void removeValuesNotIn (const OtherArrayType& otherArray)
  1773. {
  1774. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1775. const ScopedLockType lock2 (getLock());
  1776. if (this != &otherArray)
  1777. {
  1778. if (otherArray.size() <= 0)
  1779. {
  1780. clear();
  1781. }
  1782. else
  1783. {
  1784. for (int i = numUsed; --i >= 0;)
  1785. if (! otherArray.contains (data.elements [i]))
  1786. remove (i);
  1787. }
  1788. }
  1789. }
  1790. void swap (const int index1,
  1791. const int index2)
  1792. {
  1793. const ScopedLockType lock (getLock());
  1794. if (((unsigned int) index1) < (unsigned int) numUsed
  1795. && ((unsigned int) index2) < (unsigned int) numUsed)
  1796. {
  1797. swapVariables (data.elements [index1],
  1798. data.elements [index2]);
  1799. }
  1800. }
  1801. void move (const int currentIndex, int newIndex) throw()
  1802. {
  1803. if (currentIndex != newIndex)
  1804. {
  1805. const ScopedLockType lock (getLock());
  1806. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1807. {
  1808. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1809. newIndex = numUsed - 1;
  1810. char tempCopy [sizeof (ElementType)];
  1811. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1812. if (newIndex > currentIndex)
  1813. {
  1814. memmove (data.elements + currentIndex,
  1815. data.elements + currentIndex + 1,
  1816. (newIndex - currentIndex) * sizeof (ElementType));
  1817. }
  1818. else
  1819. {
  1820. memmove (data.elements + newIndex + 1,
  1821. data.elements + newIndex,
  1822. (currentIndex - newIndex) * sizeof (ElementType));
  1823. }
  1824. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1825. }
  1826. }
  1827. }
  1828. void minimiseStorageOverheads()
  1829. {
  1830. const ScopedLockType lock (getLock());
  1831. data.shrinkToNoMoreThan (numUsed);
  1832. }
  1833. void ensureStorageAllocated (const int minNumElements)
  1834. {
  1835. const ScopedLockType lock (getLock());
  1836. data.ensureAllocatedSize (minNumElements);
  1837. }
  1838. template <class ElementComparator>
  1839. void sort (ElementComparator& comparator,
  1840. const bool retainOrderOfEquivalentItems = false) const
  1841. {
  1842. const ScopedLockType lock (getLock());
  1843. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1844. // avoids getting warning messages about the parameter being unused
  1845. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1846. }
  1847. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1848. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1849. juce_UseDebuggingNewOperator
  1850. private:
  1851. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1852. int numUsed;
  1853. };
  1854. #endif // __JUCE_ARRAY_JUCEHEADER__
  1855. /*** End of inlined file: juce_Array.h ***/
  1856. #endif
  1857. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1858. #endif
  1859. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1860. /*** Start of inlined file: juce_BitArray.h ***/
  1861. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1862. #define __JUCE_BITARRAY_JUCEHEADER__
  1863. class MemoryBlock;
  1864. class JUCE_API BigInteger
  1865. {
  1866. public:
  1867. BigInteger();
  1868. BigInteger (unsigned int value);
  1869. BigInteger (int value);
  1870. BigInteger (int64 value);
  1871. BigInteger (const BigInteger& other);
  1872. ~BigInteger();
  1873. BigInteger& operator= (const BigInteger& other);
  1874. void swapWith (BigInteger& other) throw();
  1875. bool operator[] (int bit) const throw();
  1876. bool isZero() const throw();
  1877. bool isOne() const throw();
  1878. int toInteger() const throw();
  1879. void clear();
  1880. void clearBit (int bitNumber) throw();
  1881. void setBit (int bitNumber);
  1882. void setBit (int bitNumber, bool shouldBeSet);
  1883. void setRange (int startBit, int numBits, bool shouldBeSet);
  1884. void insertBit (int bitNumber, bool shouldBeSet);
  1885. const BigInteger getBitRange (int startBit, int numBits) const;
  1886. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1887. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1888. void shiftBits (int howManyBitsLeft, int startBit);
  1889. int countNumberOfSetBits() const throw();
  1890. int findNextSetBit (int startIndex = 0) const throw();
  1891. int findNextClearBit (int startIndex = 0) const throw();
  1892. int getHighestBit() const throw();
  1893. // All the standard arithmetic ops...
  1894. BigInteger& operator+= (const BigInteger& other);
  1895. BigInteger& operator-= (const BigInteger& other);
  1896. BigInteger& operator*= (const BigInteger& other);
  1897. BigInteger& operator/= (const BigInteger& other);
  1898. BigInteger& operator|= (const BigInteger& other);
  1899. BigInteger& operator&= (const BigInteger& other);
  1900. BigInteger& operator^= (const BigInteger& other);
  1901. BigInteger& operator%= (const BigInteger& other);
  1902. BigInteger& operator<<= (int numBitsToShift);
  1903. BigInteger& operator>>= (int numBitsToShift);
  1904. BigInteger& operator++();
  1905. BigInteger& operator--();
  1906. const BigInteger operator++ (int);
  1907. const BigInteger operator-- (int);
  1908. const BigInteger operator-() const;
  1909. const BigInteger operator+ (const BigInteger& other) const;
  1910. const BigInteger operator- (const BigInteger& other) const;
  1911. const BigInteger operator* (const BigInteger& other) const;
  1912. const BigInteger operator/ (const BigInteger& other) const;
  1913. const BigInteger operator| (const BigInteger& other) const;
  1914. const BigInteger operator& (const BigInteger& other) const;
  1915. const BigInteger operator^ (const BigInteger& other) const;
  1916. const BigInteger operator% (const BigInteger& other) const;
  1917. const BigInteger operator<< (int numBitsToShift) const;
  1918. const BigInteger operator>> (int numBitsToShift) const;
  1919. bool operator== (const BigInteger& other) const throw();
  1920. bool operator!= (const BigInteger& other) const throw();
  1921. bool operator< (const BigInteger& other) const throw();
  1922. bool operator<= (const BigInteger& other) const throw();
  1923. bool operator> (const BigInteger& other) const throw();
  1924. bool operator>= (const BigInteger& other) const throw();
  1925. int compare (const BigInteger& other) const throw();
  1926. int compareAbsolute (const BigInteger& other) const throw();
  1927. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1928. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1929. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1930. void inverseModulo (const BigInteger& modulus);
  1931. bool isNegative() const throw();
  1932. void setNegative (const bool shouldBeNegative) throw();
  1933. void negate() throw();
  1934. const String toString (int base, int minimumNumCharacters = 1) const;
  1935. void parseString (const String& text, int base);
  1936. const MemoryBlock toMemoryBlock() const;
  1937. void loadFromMemoryBlock (const MemoryBlock& data);
  1938. juce_UseDebuggingNewOperator
  1939. private:
  1940. HeapBlock <unsigned int> values;
  1941. int numValues, highestBit;
  1942. bool negative;
  1943. void ensureSize (int numVals);
  1944. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1945. };
  1946. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1947. typedef BigInteger BitArray;
  1948. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1949. /*** End of inlined file: juce_BitArray.h ***/
  1950. #endif
  1951. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1952. /*** Start of inlined file: juce_DynamicObject.h ***/
  1953. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1954. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1955. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1956. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1957. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1958. /*** Start of inlined file: juce_Variant.h ***/
  1959. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1960. #define __JUCE_VARIANT_JUCEHEADER__
  1961. /*** Start of inlined file: juce_OutputStream.h ***/
  1962. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1963. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1964. /*** Start of inlined file: juce_InputStream.h ***/
  1965. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  1966. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  1967. /*** Start of inlined file: juce_MemoryBlock.h ***/
  1968. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1969. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1970. class JUCE_API MemoryBlock
  1971. {
  1972. public:
  1973. MemoryBlock() throw();
  1974. MemoryBlock (const size_t initialSize,
  1975. const bool initialiseToZero = false) throw();
  1976. MemoryBlock (const MemoryBlock& other) throw();
  1977. MemoryBlock (const void* const dataToInitialiseFrom,
  1978. const size_t sizeInBytes) throw();
  1979. ~MemoryBlock() throw();
  1980. MemoryBlock& operator= (const MemoryBlock& other) throw();
  1981. bool operator== (const MemoryBlock& other) const throw();
  1982. bool operator!= (const MemoryBlock& other) const throw();
  1983. bool matches (const void* data, size_t dataSize) const throw();
  1984. void* getData() const throw() { return data; }
  1985. template <typename Type>
  1986. char& operator[] (const Type offset) const throw() { return data [offset]; }
  1987. size_t getSize() const throw() { return size; }
  1988. void setSize (const size_t newSize,
  1989. const bool initialiseNewSpaceToZero = false) throw();
  1990. void ensureSize (const size_t minimumSize,
  1991. const bool initialiseNewSpaceToZero = false) throw();
  1992. void fillWith (const uint8 valueToUse) throw();
  1993. void append (const void* const data,
  1994. const size_t numBytes) throw();
  1995. void swapWith (MemoryBlock& other) throw();
  1996. void copyFrom (const void* srcData,
  1997. int destinationOffset,
  1998. size_t numBytes) throw();
  1999. void copyTo (void* destData,
  2000. int sourceOffset,
  2001. size_t numBytes) const throw();
  2002. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2003. const String toString() const throw();
  2004. void loadFromHexString (const String& sourceHexString) throw();
  2005. void setBitRange (size_t bitRangeStart,
  2006. size_t numBits,
  2007. int binaryNumberToApply) throw();
  2008. int getBitRange (size_t bitRangeStart,
  2009. size_t numBitsToRead) const throw();
  2010. const String toBase64Encoding() const throw();
  2011. bool fromBase64Encoding (const String& encodedString) throw();
  2012. juce_UseDebuggingNewOperator
  2013. private:
  2014. HeapBlock <char> data;
  2015. size_t size;
  2016. };
  2017. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2018. /*** End of inlined file: juce_MemoryBlock.h ***/
  2019. class JUCE_API InputStream
  2020. {
  2021. public:
  2022. virtual ~InputStream() {}
  2023. virtual int64 getTotalLength() = 0;
  2024. virtual bool isExhausted() = 0;
  2025. virtual int read (void* destBuffer,
  2026. int maxBytesToRead) = 0;
  2027. virtual char readByte();
  2028. virtual bool readBool();
  2029. virtual short readShort();
  2030. virtual short readShortBigEndian();
  2031. virtual int readInt();
  2032. virtual int readIntBigEndian();
  2033. virtual int64 readInt64();
  2034. virtual int64 readInt64BigEndian();
  2035. virtual float readFloat();
  2036. virtual float readFloatBigEndian();
  2037. virtual double readDouble();
  2038. virtual double readDoubleBigEndian();
  2039. virtual int readCompressedInt();
  2040. virtual const String readNextLine();
  2041. virtual const String readString();
  2042. virtual const String readEntireStreamAsString();
  2043. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2044. int maxNumBytesToRead = -1);
  2045. virtual int64 getPosition() = 0;
  2046. virtual bool setPosition (int64 newPosition) = 0;
  2047. virtual void skipNextBytes (int64 numBytesToSkip);
  2048. juce_UseDebuggingNewOperator
  2049. protected:
  2050. InputStream() throw() {}
  2051. };
  2052. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2053. /*** End of inlined file: juce_InputStream.h ***/
  2054. class JUCE_API OutputStream
  2055. {
  2056. protected:
  2057. OutputStream();
  2058. public:
  2059. virtual ~OutputStream();
  2060. virtual void flush() = 0;
  2061. virtual bool setPosition (int64 newPosition) = 0;
  2062. virtual int64 getPosition() = 0;
  2063. virtual bool write (const void* dataToWrite,
  2064. int howManyBytes) = 0;
  2065. virtual void writeByte (char byte);
  2066. virtual void writeBool (bool boolValue);
  2067. virtual void writeShort (short value);
  2068. virtual void writeShortBigEndian (short value);
  2069. virtual void writeInt (int value);
  2070. virtual void writeIntBigEndian (int value);
  2071. virtual void writeInt64 (int64 value);
  2072. virtual void writeInt64BigEndian (int64 value);
  2073. virtual void writeFloat (float value);
  2074. virtual void writeFloatBigEndian (float value);
  2075. virtual void writeDouble (double value);
  2076. virtual void writeDoubleBigEndian (double value);
  2077. virtual void writeCompressedInt (int value);
  2078. virtual void writeString (const String& text);
  2079. virtual void writeText (const String& text,
  2080. const bool asUnicode,
  2081. const bool writeUnicodeHeaderBytes);
  2082. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2083. juce_UseDebuggingNewOperator
  2084. };
  2085. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const int number);
  2086. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const double number);
  2087. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char character);
  2088. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* const text);
  2089. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2090. /*** End of inlined file: juce_OutputStream.h ***/
  2091. class JUCE_API DynamicObject;
  2092. class JUCE_API var
  2093. {
  2094. public:
  2095. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2096. var() throw();
  2097. ~var() throw();
  2098. static const var null;
  2099. var (const var& valueToCopy);
  2100. var (const int value) throw();
  2101. var (const bool value) throw();
  2102. var (const double value) throw();
  2103. var (const char* const value);
  2104. var (const juce_wchar* const value);
  2105. var (const String& value);
  2106. var (DynamicObject* const object);
  2107. var (MethodFunction method) throw();
  2108. var& operator= (const var& valueToCopy);
  2109. var& operator= (int value);
  2110. var& operator= (bool value);
  2111. var& operator= (double value);
  2112. var& operator= (const char* value);
  2113. var& operator= (const juce_wchar* value);
  2114. var& operator= (const String& value);
  2115. var& operator= (DynamicObject* object);
  2116. var& operator= (MethodFunction method);
  2117. void swapWith (var& other) throw();
  2118. operator int() const;
  2119. operator bool() const;
  2120. operator float() const;
  2121. operator double() const;
  2122. operator const String() const;
  2123. const String toString() const;
  2124. DynamicObject* getObject() const;
  2125. bool isVoid() const throw() { return type == voidType; }
  2126. bool isInt() const throw() { return type == intType; }
  2127. bool isBool() const throw() { return type == boolType; }
  2128. bool isDouble() const throw() { return type == doubleType; }
  2129. bool isString() const throw() { return type == stringType; }
  2130. bool isObject() const throw() { return type == objectType; }
  2131. bool isMethod() const throw() { return type == methodType; }
  2132. void writeToStream (OutputStream& output) const;
  2133. static const var readFromStream (InputStream& input);
  2134. class JUCE_API identifier
  2135. {
  2136. public:
  2137. identifier() throw();
  2138. identifier (const char* const name);
  2139. identifier (const String& name);
  2140. ~identifier();
  2141. bool operator== (const identifier& other) const throw()
  2142. {
  2143. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2144. return hashCode == other.hashCode;
  2145. }
  2146. String name;
  2147. int hashCode;
  2148. };
  2149. const var operator[] (const identifier& propertyName) const;
  2150. const var call (const identifier& method) const;
  2151. const var call (const identifier& method, const var& arg1) const;
  2152. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2153. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2154. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2155. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2156. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2157. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2158. juce_UseDebuggingNewOperator
  2159. bool equals (const var& other) const throw();
  2160. private:
  2161. enum Type
  2162. {
  2163. voidType = 0,
  2164. intType,
  2165. boolType,
  2166. doubleType,
  2167. stringType,
  2168. objectType,
  2169. methodType
  2170. };
  2171. union ValueUnion
  2172. {
  2173. int intValue;
  2174. bool boolValue;
  2175. double doubleValue;
  2176. String* stringValue;
  2177. DynamicObject* objectValue;
  2178. MethodFunction methodValue;
  2179. };
  2180. Type type;
  2181. ValueUnion value;
  2182. };
  2183. bool operator== (const var& v1, const var& v2) throw();
  2184. bool operator!= (const var& v1, const var& v2) throw();
  2185. bool operator== (const var& v1, const String& v2) throw();
  2186. bool operator!= (const var& v1, const String& v2) throw();
  2187. #endif // __JUCE_VARIANT_JUCEHEADER__
  2188. /*** End of inlined file: juce_Variant.h ***/
  2189. class JUCE_API NamedValueSet
  2190. {
  2191. public:
  2192. NamedValueSet() throw();
  2193. NamedValueSet (const NamedValueSet& other);
  2194. NamedValueSet& operator= (const NamedValueSet& other);
  2195. ~NamedValueSet();
  2196. int size() const throw();
  2197. const var& operator[] (const var::identifier& name) const;
  2198. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2199. var* getItem (const var::identifier& name) const;
  2200. bool set (const var::identifier& name, const var& newValue);
  2201. bool contains (const var::identifier& name) const;
  2202. bool remove (const var::identifier& name);
  2203. const var::identifier getName (int index) const;
  2204. void clear();
  2205. juce_UseDebuggingNewOperator
  2206. private:
  2207. struct NamedValue
  2208. {
  2209. NamedValue() throw();
  2210. NamedValue (const var::identifier& name, const var& value);
  2211. var::identifier name;
  2212. var value;
  2213. };
  2214. Array <NamedValue> values;
  2215. };
  2216. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2217. /*** End of inlined file: juce_NamedValueSet.h ***/
  2218. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2219. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2220. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2221. /*** Start of inlined file: juce_Atomic.h ***/
  2222. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2223. #define __JUCE_ATOMIC_JUCEHEADER__
  2224. class JUCE_API Atomic
  2225. {
  2226. public:
  2227. static void increment (int32& variable);
  2228. static int32 incrementAndReturn (int32& variable);
  2229. static void decrement (int32& variable);
  2230. static int32 decrementAndReturn (int32& variable);
  2231. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2232. static void* swapPointers (void* volatile* value1, void* value2);
  2233. };
  2234. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2235. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2236. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2237. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2238. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2239. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2240. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2241. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2242. {
  2243. void* currentVal = *value1;
  2244. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2245. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2246. #else
  2247. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2248. #endif
  2249. return currentVal;
  2250. }
  2251. #elif JUCE_LINUX // Linux...
  2252. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2253. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2254. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2255. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2256. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2257. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2258. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2259. {
  2260. void* currentVal = *value1;
  2261. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2262. return currentVal;
  2263. }
  2264. #elif JUCE_USE_INTRINSICS // Windows...
  2265. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2266. // declared in juce_win32_Threads.cpp)
  2267. #pragma intrinsic (_InterlockedIncrement)
  2268. #pragma intrinsic (_InterlockedDecrement)
  2269. #pragma intrinsic (_InterlockedCompareExchange)
  2270. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2271. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2272. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2273. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2274. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2275. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2276. #endif
  2277. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2278. /*** End of inlined file: juce_Atomic.h ***/
  2279. class JUCE_API ReferenceCountedObject
  2280. {
  2281. public:
  2282. inline void incReferenceCount() throw()
  2283. {
  2284. Atomic::increment (refCounts);
  2285. jassert (refCounts > 0);
  2286. }
  2287. inline void decReferenceCount() throw()
  2288. {
  2289. jassert (refCounts > 0);
  2290. if (Atomic::decrementAndReturn (refCounts) == 0)
  2291. delete this;
  2292. }
  2293. inline int getReferenceCount() const throw()
  2294. {
  2295. return refCounts;
  2296. }
  2297. protected:
  2298. ReferenceCountedObject()
  2299. : refCounts (0)
  2300. {
  2301. }
  2302. virtual ~ReferenceCountedObject()
  2303. {
  2304. // it's dangerous to delete an object that's still referenced by something else!
  2305. jassert (refCounts == 0);
  2306. }
  2307. private:
  2308. int refCounts;
  2309. };
  2310. template <class ReferenceCountedObjectClass>
  2311. class ReferenceCountedObjectPtr
  2312. {
  2313. public:
  2314. inline ReferenceCountedObjectPtr() throw()
  2315. : referencedObject (0)
  2316. {
  2317. }
  2318. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2319. : referencedObject (refCountedObject)
  2320. {
  2321. if (refCountedObject != 0)
  2322. refCountedObject->incReferenceCount();
  2323. }
  2324. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2325. : referencedObject (other.referencedObject)
  2326. {
  2327. if (referencedObject != 0)
  2328. referencedObject->incReferenceCount();
  2329. }
  2330. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2331. {
  2332. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2333. if (newObject != referencedObject)
  2334. {
  2335. if (newObject != 0)
  2336. newObject->incReferenceCount();
  2337. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2338. referencedObject = newObject;
  2339. if (oldObject != 0)
  2340. oldObject->decReferenceCount();
  2341. }
  2342. return *this;
  2343. }
  2344. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2345. {
  2346. if (referencedObject != newObject)
  2347. {
  2348. if (newObject != 0)
  2349. newObject->incReferenceCount();
  2350. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2351. referencedObject = newObject;
  2352. if (oldObject != 0)
  2353. oldObject->decReferenceCount();
  2354. }
  2355. return *this;
  2356. }
  2357. inline ~ReferenceCountedObjectPtr()
  2358. {
  2359. if (referencedObject != 0)
  2360. referencedObject->decReferenceCount();
  2361. }
  2362. inline operator ReferenceCountedObjectClass*() const throw()
  2363. {
  2364. return referencedObject;
  2365. }
  2366. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2367. {
  2368. return referencedObject == object;
  2369. }
  2370. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2371. {
  2372. return referencedObject != object;
  2373. }
  2374. // the -> operator is called on the referenced object
  2375. inline ReferenceCountedObjectClass* operator->() const throw()
  2376. {
  2377. return referencedObject;
  2378. }
  2379. private:
  2380. ReferenceCountedObjectClass* referencedObject;
  2381. };
  2382. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2383. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2384. class JUCE_API DynamicObject : public ReferenceCountedObject
  2385. {
  2386. public:
  2387. DynamicObject();
  2388. virtual ~DynamicObject();
  2389. virtual bool hasProperty (const var::identifier& propertyName) const;
  2390. virtual const var getProperty (const var::identifier& propertyName) const;
  2391. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2392. virtual void removeProperty (const var::identifier& propertyName);
  2393. virtual bool hasMethod (const var::identifier& methodName) const;
  2394. virtual const var invokeMethod (const var::identifier& methodName,
  2395. const var* parameters,
  2396. int numParameters);
  2397. void setMethod (const var::identifier& methodName,
  2398. var::MethodFunction methodFunction);
  2399. void clear();
  2400. juce_UseDebuggingNewOperator
  2401. private:
  2402. NamedValueSet properties;
  2403. };
  2404. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2405. /*** End of inlined file: juce_DynamicObject.h ***/
  2406. #endif
  2407. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2408. #endif
  2409. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2410. #endif
  2411. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2412. #endif
  2413. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2414. #endif
  2415. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2416. /*** Start of inlined file: juce_OwnedArray.h ***/
  2417. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2418. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2419. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2420. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2421. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2422. template <class ObjectType>
  2423. class JUCE_API ScopedPointer
  2424. {
  2425. public:
  2426. inline ScopedPointer() throw() : object (0)
  2427. {
  2428. }
  2429. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2430. : object (objectToTakePossessionOf)
  2431. {
  2432. }
  2433. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2434. : object (objectToTransferFrom.object)
  2435. {
  2436. objectToTransferFrom.object = 0;
  2437. }
  2438. inline ~ScopedPointer() { delete object; }
  2439. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2440. {
  2441. if (this != objectToTransferFrom.getAddress())
  2442. {
  2443. // Two ScopedPointers should never be able to refer to the same object - if
  2444. // this happens, you must have done something dodgy!
  2445. jassert (object == 0 || object != objectToTransferFrom.object);
  2446. ObjectType* const oldObject = object;
  2447. object = objectToTransferFrom.object;
  2448. objectToTransferFrom.object = 0;
  2449. delete oldObject;
  2450. }
  2451. return *this;
  2452. }
  2453. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2454. {
  2455. if (object != newObjectToTakePossessionOf)
  2456. {
  2457. ObjectType* const oldObject = object;
  2458. object = newObjectToTakePossessionOf;
  2459. delete oldObject;
  2460. }
  2461. return *this;
  2462. }
  2463. inline operator ObjectType*() const throw() { return object; }
  2464. inline ObjectType& operator*() const throw() { return *object; }
  2465. inline ObjectType* operator->() const throw() { return object; }
  2466. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2467. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2468. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2469. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2470. {
  2471. // Two ScopedPointers should never be able to refer to the same object - if
  2472. // this happens, you must have done something dodgy!
  2473. jassert (object != other.object);
  2474. swapVariables (object, other.object);
  2475. }
  2476. private:
  2477. ObjectType* object;
  2478. // (Required as an alternative to the overloaded & operator).
  2479. const ScopedPointer* getAddress() const throw() { return this; }
  2480. };
  2481. template <class ObjectType>
  2482. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2483. {
  2484. return static_cast <ObjectType*> (pointer1) == pointer2;
  2485. }
  2486. template <class ObjectType>
  2487. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2488. {
  2489. return static_cast <ObjectType*> (pointer1) != pointer2;
  2490. }
  2491. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2492. /*** End of inlined file: juce_ScopedPointer.h ***/
  2493. template <class ObjectClass,
  2494. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2495. class OwnedArray
  2496. {
  2497. public:
  2498. OwnedArray() throw()
  2499. : numUsed (0)
  2500. {
  2501. }
  2502. ~OwnedArray()
  2503. {
  2504. clear (true);
  2505. }
  2506. void clear (const bool deleteObjects = true)
  2507. {
  2508. const ScopedLockType lock (getLock());
  2509. if (deleteObjects)
  2510. {
  2511. while (numUsed > 0)
  2512. delete data.elements [--numUsed];
  2513. }
  2514. data.setAllocatedSize (0);
  2515. numUsed = 0;
  2516. }
  2517. inline int size() const throw()
  2518. {
  2519. return numUsed;
  2520. }
  2521. inline ObjectClass* operator[] (const int index) const throw()
  2522. {
  2523. const ScopedLockType lock (getLock());
  2524. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2525. : static_cast <ObjectClass*> (0);
  2526. }
  2527. inline ObjectClass* getUnchecked (const int index) const throw()
  2528. {
  2529. const ScopedLockType lock (getLock());
  2530. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2531. return data.elements [index];
  2532. }
  2533. inline ObjectClass* getFirst() const throw()
  2534. {
  2535. const ScopedLockType lock (getLock());
  2536. return numUsed > 0 ? data.elements [0]
  2537. : static_cast <ObjectClass*> (0);
  2538. }
  2539. inline ObjectClass* getLast() const throw()
  2540. {
  2541. const ScopedLockType lock (getLock());
  2542. return numUsed > 0 ? data.elements [numUsed - 1]
  2543. : static_cast <ObjectClass*> (0);
  2544. }
  2545. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2546. {
  2547. const ScopedLockType lock (getLock());
  2548. ObjectClass* const* e = data.elements.getData();
  2549. ObjectClass* const* const end = e + numUsed;
  2550. while (e != end)
  2551. {
  2552. if (objectToLookFor == *e)
  2553. return static_cast <int> (e - data.elements.getData());
  2554. ++e;
  2555. }
  2556. return -1;
  2557. }
  2558. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2559. {
  2560. const ScopedLockType lock (getLock());
  2561. ObjectClass* const* e = data.elements.getData();
  2562. ObjectClass* const* const end = e + numUsed;
  2563. while (e != end)
  2564. {
  2565. if (objectToLookFor == *e)
  2566. return true;
  2567. ++e;
  2568. }
  2569. return false;
  2570. }
  2571. void add (const ObjectClass* const newObject) throw()
  2572. {
  2573. const ScopedLockType lock (getLock());
  2574. data.ensureAllocatedSize (numUsed + 1);
  2575. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2576. }
  2577. void insert (int indexToInsertAt,
  2578. const ObjectClass* const newObject) throw()
  2579. {
  2580. if (indexToInsertAt >= 0)
  2581. {
  2582. const ScopedLockType lock (getLock());
  2583. if (indexToInsertAt > numUsed)
  2584. indexToInsertAt = numUsed;
  2585. data.ensureAllocatedSize (numUsed + 1);
  2586. ObjectClass** const e = data.elements + indexToInsertAt;
  2587. const int numToMove = numUsed - indexToInsertAt;
  2588. if (numToMove > 0)
  2589. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2590. *e = const_cast <ObjectClass*> (newObject);
  2591. ++numUsed;
  2592. }
  2593. else
  2594. {
  2595. add (newObject);
  2596. }
  2597. }
  2598. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2599. {
  2600. const ScopedLockType lock (getLock());
  2601. if (! contains (newObject))
  2602. add (newObject);
  2603. }
  2604. void set (const int indexToChange,
  2605. const ObjectClass* const newObject,
  2606. const bool deleteOldElement = true)
  2607. {
  2608. if (indexToChange >= 0)
  2609. {
  2610. ScopedPointer <ObjectClass> toDelete;
  2611. const ScopedLockType lock (getLock());
  2612. if (indexToChange < numUsed)
  2613. {
  2614. if (deleteOldElement)
  2615. {
  2616. toDelete = data.elements [indexToChange];
  2617. if (toDelete == newObject)
  2618. toDelete = 0;
  2619. }
  2620. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2621. }
  2622. else
  2623. {
  2624. data.ensureAllocatedSize (numUsed + 1);
  2625. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2626. }
  2627. }
  2628. }
  2629. template <class OtherArrayType>
  2630. void addArray (const OtherArrayType& arrayToAddFrom,
  2631. int startIndex = 0,
  2632. int numElementsToAdd = -1)
  2633. {
  2634. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2635. const ScopedLockType lock2 (getLock());
  2636. if (startIndex < 0)
  2637. {
  2638. jassertfalse
  2639. startIndex = 0;
  2640. }
  2641. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2642. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2643. while (--numElementsToAdd >= 0)
  2644. add (arrayToAddFrom.getUnchecked (startIndex++));
  2645. }
  2646. template <class ElementComparator>
  2647. void addSorted (ElementComparator& comparator,
  2648. ObjectClass* const newObject) throw()
  2649. {
  2650. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2651. // avoids getting warning messages about the parameter being unused
  2652. const ScopedLockType lock (getLock());
  2653. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2654. }
  2655. template <class ElementComparator>
  2656. int indexOfSorted (ElementComparator& comparator,
  2657. const ObjectClass* const objectToLookFor) const throw()
  2658. {
  2659. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2660. // avoids getting warning messages about the parameter being unused
  2661. const ScopedLockType lock (getLock());
  2662. int start = 0;
  2663. int end = numUsed;
  2664. for (;;)
  2665. {
  2666. if (start >= end)
  2667. {
  2668. return -1;
  2669. }
  2670. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2671. {
  2672. return start;
  2673. }
  2674. else
  2675. {
  2676. const int halfway = (start + end) >> 1;
  2677. if (halfway == start)
  2678. return -1;
  2679. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2680. start = halfway;
  2681. else
  2682. end = halfway;
  2683. }
  2684. }
  2685. }
  2686. void remove (const int indexToRemove,
  2687. const bool deleteObject = true)
  2688. {
  2689. ScopedPointer <ObjectClass> toDelete;
  2690. const ScopedLockType lock (getLock());
  2691. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2692. {
  2693. ObjectClass** const e = data.elements + indexToRemove;
  2694. if (deleteObject)
  2695. toDelete = *e;
  2696. --numUsed;
  2697. const int numToShift = numUsed - indexToRemove;
  2698. if (numToShift > 0)
  2699. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2700. if ((numUsed << 1) < data.numAllocated)
  2701. minimiseStorageOverheads();
  2702. }
  2703. }
  2704. void removeObject (const ObjectClass* const objectToRemove,
  2705. const bool deleteObject = true)
  2706. {
  2707. const ScopedLockType lock (getLock());
  2708. ObjectClass** e = data.elements.getData();
  2709. for (int i = numUsed; --i >= 0;)
  2710. {
  2711. if (objectToRemove == *e)
  2712. {
  2713. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2714. break;
  2715. }
  2716. ++e;
  2717. }
  2718. }
  2719. void removeRange (int startIndex,
  2720. const int numberToRemove,
  2721. const bool deleteObjects = true)
  2722. {
  2723. const ScopedLockType lock (getLock());
  2724. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2725. startIndex = jlimit (0, numUsed, startIndex);
  2726. if (endIndex > startIndex)
  2727. {
  2728. if (deleteObjects)
  2729. {
  2730. for (int i = startIndex; i < endIndex; ++i)
  2731. {
  2732. delete data.elements [i];
  2733. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2734. }
  2735. }
  2736. const int rangeSize = endIndex - startIndex;
  2737. ObjectClass** e = data.elements + startIndex;
  2738. int numToShift = numUsed - endIndex;
  2739. numUsed -= rangeSize;
  2740. while (--numToShift >= 0)
  2741. {
  2742. *e = e [rangeSize];
  2743. ++e;
  2744. }
  2745. if ((numUsed << 1) < data.numAllocated)
  2746. minimiseStorageOverheads();
  2747. }
  2748. }
  2749. void removeLast (int howManyToRemove = 1,
  2750. const bool deleteObjects = true)
  2751. {
  2752. const ScopedLockType lock (getLock());
  2753. if (howManyToRemove >= numUsed)
  2754. {
  2755. clear (deleteObjects);
  2756. }
  2757. else
  2758. {
  2759. while (--howManyToRemove >= 0)
  2760. remove (numUsed - 1, deleteObjects);
  2761. }
  2762. }
  2763. void swap (const int index1,
  2764. const int index2) throw()
  2765. {
  2766. const ScopedLockType lock (getLock());
  2767. if (((unsigned int) index1) < (unsigned int) numUsed
  2768. && ((unsigned int) index2) < (unsigned int) numUsed)
  2769. {
  2770. swapVariables (data.elements [index1],
  2771. data.elements [index2]);
  2772. }
  2773. }
  2774. void move (const int currentIndex,
  2775. int newIndex) throw()
  2776. {
  2777. if (currentIndex != newIndex)
  2778. {
  2779. const ScopedLockType lock (getLock());
  2780. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2781. {
  2782. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2783. newIndex = numUsed - 1;
  2784. ObjectClass* const value = data.elements [currentIndex];
  2785. if (newIndex > currentIndex)
  2786. {
  2787. memmove (data.elements + currentIndex,
  2788. data.elements + currentIndex + 1,
  2789. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2790. }
  2791. else
  2792. {
  2793. memmove (data.elements + newIndex + 1,
  2794. data.elements + newIndex,
  2795. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2796. }
  2797. data.elements [newIndex] = value;
  2798. }
  2799. }
  2800. }
  2801. void swapWithArray (OwnedArray& otherArray) throw()
  2802. {
  2803. const ScopedLockType lock1 (getLock());
  2804. const ScopedLockType lock2 (otherArray.getLock());
  2805. data.swapWith (otherArray.data);
  2806. swapVariables (numUsed, otherArray.numUsed);
  2807. }
  2808. void minimiseStorageOverheads() throw()
  2809. {
  2810. const ScopedLockType lock (getLock());
  2811. data.shrinkToNoMoreThan (numUsed);
  2812. }
  2813. void ensureStorageAllocated (const int minNumElements) throw()
  2814. {
  2815. const ScopedLockType lock (getLock());
  2816. data.ensureAllocatedSize (minNumElements);
  2817. }
  2818. template <class ElementComparator>
  2819. void sort (ElementComparator& comparator,
  2820. const bool retainOrderOfEquivalentItems = false) const throw()
  2821. {
  2822. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2823. // avoids getting warning messages about the parameter being unused
  2824. const ScopedLockType lock (getLock());
  2825. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2826. }
  2827. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2828. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2829. juce_UseDebuggingNewOperator
  2830. private:
  2831. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2832. int numUsed;
  2833. // disallow copy constructor and assignment
  2834. OwnedArray (const OwnedArray&);
  2835. OwnedArray& operator= (const OwnedArray&);
  2836. };
  2837. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2838. /*** End of inlined file: juce_OwnedArray.h ***/
  2839. #endif
  2840. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2841. /*** Start of inlined file: juce_PropertySet.h ***/
  2842. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2843. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2844. /*** Start of inlined file: juce_StringPairArray.h ***/
  2845. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2846. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2847. /*** Start of inlined file: juce_StringArray.h ***/
  2848. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2849. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2850. #ifndef DOXYGEN
  2851. // (used in StringArray::appendNumbersToDuplicates)
  2852. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2853. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2854. #endif
  2855. class JUCE_API StringArray
  2856. {
  2857. public:
  2858. StringArray() throw();
  2859. StringArray (const StringArray& other);
  2860. StringArray (const juce_wchar** const strings,
  2861. const int numberOfStrings);
  2862. StringArray (const char** const strings,
  2863. const int numberOfStrings);
  2864. explicit StringArray (const juce_wchar** const strings);
  2865. explicit StringArray (const char** const strings);
  2866. ~StringArray();
  2867. StringArray& operator= (const StringArray& other);
  2868. bool operator== (const StringArray& other) const;
  2869. bool operator!= (const StringArray& other) const;
  2870. inline int size() const throw() { return strings.size(); };
  2871. const String& operator[] (const int index) const throw();
  2872. bool contains (const String& stringToLookFor,
  2873. const bool ignoreCase = false) const;
  2874. int indexOf (const String& stringToLookFor,
  2875. const bool ignoreCase = false,
  2876. int startIndex = 0) const;
  2877. void add (const String& stringToAdd);
  2878. void insert (const int index, const String& stringToAdd);
  2879. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2880. void set (const int index, const String& newString);
  2881. void addArray (const StringArray& other,
  2882. int startIndex = 0,
  2883. int numElementsToAdd = -1);
  2884. int addTokens (const String& stringToTokenise,
  2885. const bool preserveQuotedStrings);
  2886. int addTokens (const String& stringToTokenise,
  2887. const String& breakCharacters,
  2888. const String& quoteCharacters);
  2889. int addLines (const String& stringToBreakUp);
  2890. void clear();
  2891. void remove (const int index);
  2892. void removeString (const String& stringToRemove,
  2893. const bool ignoreCase = false);
  2894. void removeDuplicates (const bool ignoreCase);
  2895. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2896. void move (const int currentIndex, int newIndex) throw();
  2897. void trim();
  2898. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2899. const bool appendNumberToFirstInstance,
  2900. const tchar* const preNumberString = defaultPreNumberString,
  2901. const tchar* const postNumberString = defaultPostNumberString);
  2902. const String joinIntoString (const String& separatorString,
  2903. int startIndex = 0,
  2904. int numberOfElements = -1) const;
  2905. void sort (const bool ignoreCase);
  2906. void minimiseStorageOverheads();
  2907. juce_UseDebuggingNewOperator
  2908. private:
  2909. Array <String> strings;
  2910. };
  2911. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2912. /*** End of inlined file: juce_StringArray.h ***/
  2913. class JUCE_API StringPairArray
  2914. {
  2915. public:
  2916. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2917. StringPairArray (const StringPairArray& other) throw();
  2918. ~StringPairArray() throw();
  2919. StringPairArray& operator= (const StringPairArray& other) throw();
  2920. bool operator== (const StringPairArray& other) const throw();
  2921. bool operator!= (const StringPairArray& other) const throw();
  2922. const String& operator[] (const String& key) const throw();
  2923. const String getValue (const String& key, const String& defaultReturnValue) const;
  2924. const StringArray& getAllKeys() const throw() { return keys; }
  2925. const StringArray& getAllValues() const throw() { return values; }
  2926. inline int size() const throw() { return keys.size(); };
  2927. void set (const String& key,
  2928. const String& value) throw();
  2929. void addArray (const StringPairArray& other);
  2930. void clear() throw();
  2931. void remove (const String& key) throw();
  2932. void remove (const int index) throw();
  2933. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2934. const String getDescription() const;
  2935. void minimiseStorageOverheads() throw();
  2936. juce_UseDebuggingNewOperator
  2937. private:
  2938. StringArray keys, values;
  2939. bool ignoreCase;
  2940. };
  2941. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2942. /*** End of inlined file: juce_StringPairArray.h ***/
  2943. /*** Start of inlined file: juce_XmlElement.h ***/
  2944. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  2945. #define __JUCE_XMLELEMENT_JUCEHEADER__
  2946. /*** Start of inlined file: juce_File.h ***/
  2947. #ifndef __JUCE_FILE_JUCEHEADER__
  2948. #define __JUCE_FILE_JUCEHEADER__
  2949. /*** Start of inlined file: juce_Time.h ***/
  2950. #ifndef __JUCE_TIME_JUCEHEADER__
  2951. #define __JUCE_TIME_JUCEHEADER__
  2952. /*** Start of inlined file: juce_RelativeTime.h ***/
  2953. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  2954. #define __JUCE_RELATIVETIME_JUCEHEADER__
  2955. class JUCE_API RelativeTime
  2956. {
  2957. public:
  2958. explicit RelativeTime (const double seconds = 0.0) throw();
  2959. RelativeTime (const RelativeTime& other) throw();
  2960. RelativeTime& operator= (const RelativeTime& other) throw();
  2961. ~RelativeTime() throw();
  2962. static const RelativeTime milliseconds (const int milliseconds) throw();
  2963. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  2964. static const RelativeTime minutes (const double numberOfMinutes) throw();
  2965. static const RelativeTime hours (const double numberOfHours) throw();
  2966. static const RelativeTime days (const double numberOfDays) throw();
  2967. static const RelativeTime weeks (const double numberOfWeeks) throw();
  2968. int64 inMilliseconds() const throw();
  2969. double inSeconds() const throw() { return seconds; }
  2970. double inMinutes() const throw();
  2971. double inHours() const throw();
  2972. double inDays() const throw();
  2973. double inWeeks() const throw();
  2974. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  2975. bool operator== (const RelativeTime& other) const throw();
  2976. bool operator!= (const RelativeTime& other) const throw();
  2977. bool operator> (const RelativeTime& other) const throw();
  2978. bool operator< (const RelativeTime& other) const throw();
  2979. bool operator>= (const RelativeTime& other) const throw();
  2980. bool operator<= (const RelativeTime& other) const throw();
  2981. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  2982. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  2983. const RelativeTime operator+ (const double secondsToAdd) const throw();
  2984. const RelativeTime operator- (const double secondsToSubtract) const throw();
  2985. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  2986. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  2987. const RelativeTime& operator+= (const double secondsToAdd) throw();
  2988. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  2989. juce_UseDebuggingNewOperator
  2990. private:
  2991. double seconds;
  2992. };
  2993. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  2994. /*** End of inlined file: juce_RelativeTime.h ***/
  2995. class JUCE_API Time
  2996. {
  2997. public:
  2998. Time() throw();
  2999. Time (const Time& other) throw();
  3000. Time (int64 millisecondsSinceEpoch) throw();
  3001. Time (int year,
  3002. int month,
  3003. int day,
  3004. int hours,
  3005. int minutes,
  3006. int seconds = 0,
  3007. int milliseconds = 0,
  3008. bool useLocalTime = true) throw();
  3009. ~Time() throw();
  3010. Time& operator= (const Time& other) throw();
  3011. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3012. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3013. int getYear() const throw();
  3014. int getMonth() const throw();
  3015. const String getMonthName (bool threeLetterVersion) const throw();
  3016. int getDayOfMonth() const throw();
  3017. int getDayOfWeek() const throw();
  3018. const String getWeekdayName (bool threeLetterVersion) const throw();
  3019. int getHours() const throw();
  3020. bool isAfternoon() const throw();
  3021. int getHoursInAmPmFormat() const throw();
  3022. int getMinutes() const throw();
  3023. int getSeconds() const throw();
  3024. int getMilliseconds() const throw();
  3025. bool isDaylightSavingTime() const throw();
  3026. const String getTimeZone() const throw();
  3027. const String toString (bool includeDate,
  3028. bool includeTime,
  3029. bool includeSeconds = true,
  3030. bool use24HourClock = false) const throw();
  3031. const String formatted (const juce_wchar* format) const throw();
  3032. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3033. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3034. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3035. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3036. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3037. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3038. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3039. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3040. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3041. bool setSystemTimeToThisTime() const throw();
  3042. static const String getWeekdayName (int dayNumber,
  3043. bool threeLetterVersion) throw();
  3044. static const String getMonthName (int monthNumber,
  3045. bool threeLetterVersion) throw();
  3046. // Static methods for getting system timers directly..
  3047. static int64 currentTimeMillis() throw();
  3048. static uint32 getMillisecondCounter() throw();
  3049. static double getMillisecondCounterHiRes() throw();
  3050. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3051. static uint32 getApproximateMillisecondCounter() throw();
  3052. // High-resolution timers..
  3053. static int64 getHighResolutionTicks() throw();
  3054. static int64 getHighResolutionTicksPerSecond() throw();
  3055. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3056. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3057. private:
  3058. int64 millisSinceEpoch;
  3059. };
  3060. #endif // __JUCE_TIME_JUCEHEADER__
  3061. /*** End of inlined file: juce_Time.h ***/
  3062. class FileInputStream;
  3063. class FileOutputStream;
  3064. class JUCE_API File
  3065. {
  3066. public:
  3067. File() {}
  3068. File (const String& path);
  3069. File (const File& other);
  3070. ~File() {}
  3071. File& operator= (const String& newFilePath);
  3072. File& operator= (const File& otherFile);
  3073. static const File nonexistent;
  3074. bool exists() const;
  3075. bool existsAsFile() const;
  3076. bool isDirectory() const;
  3077. int64 getSize() const;
  3078. static const String descriptionOfSizeInBytes (const int64 bytes);
  3079. const String& getFullPathName() const throw() { return fullPath; }
  3080. const String getFileName() const;
  3081. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3082. const String getFileExtension() const;
  3083. bool hasFileExtension (const String& extensionToTest) const;
  3084. const File withFileExtension (const String& newExtension) const;
  3085. const String getFileNameWithoutExtension() const;
  3086. int hashCode() const;
  3087. int64 hashCode64() const;
  3088. const File getChildFile (String relativePath) const;
  3089. const File getSiblingFile (const String& siblingFileName) const;
  3090. const File getParentDirectory() const;
  3091. bool isAChildOf (const File& potentialParentDirectory) const;
  3092. const File getNonexistentChildFile (const String& prefix,
  3093. const String& suffix,
  3094. bool putNumbersInBrackets = true) const;
  3095. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3096. bool operator== (const File& otherFile) const;
  3097. bool operator!= (const File& otherFile) const;
  3098. bool hasWriteAccess() const;
  3099. bool setReadOnly (const bool shouldBeReadOnly,
  3100. const bool applyRecursively = false) const;
  3101. bool isHidden() const;
  3102. const File getLinkedTarget() const;
  3103. const Time getLastModificationTime() const;
  3104. const Time getLastAccessTime() const;
  3105. const Time getCreationTime() const;
  3106. bool setLastModificationTime (const Time& newTime) const;
  3107. bool setLastAccessTime (const Time& newTime) const;
  3108. bool setCreationTime (const Time& newTime) const;
  3109. const String getVersion() const;
  3110. bool create() const;
  3111. bool createDirectory() const;
  3112. bool deleteFile() const;
  3113. bool deleteRecursively() const;
  3114. bool moveToTrash() const;
  3115. bool moveFileTo (const File& targetLocation) const;
  3116. bool copyFileTo (const File& targetLocation) const;
  3117. bool copyDirectoryTo (const File& newDirectory) const;
  3118. enum TypesOfFileToFind
  3119. {
  3120. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3121. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3122. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3123. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3124. };
  3125. int findChildFiles (Array<File>& results,
  3126. const int whatToLookFor,
  3127. const bool searchRecursively,
  3128. const String& wildCardPattern = JUCE_T("*")) const;
  3129. int getNumberOfChildFiles (const int whatToLookFor,
  3130. const String& wildCardPattern = JUCE_T("*")) const;
  3131. bool containsSubDirectories() const;
  3132. FileInputStream* createInputStream() const;
  3133. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3134. bool loadFileAsData (MemoryBlock& result) const;
  3135. const String loadFileAsString() const;
  3136. bool appendData (const void* const dataToAppend,
  3137. const int numberOfBytes) const;
  3138. bool replaceWithData (const void* const dataToWrite,
  3139. const int numberOfBytes) const;
  3140. bool appendText (const String& textToAppend,
  3141. const bool asUnicode = false,
  3142. const bool writeUnicodeHeaderBytes = false) const;
  3143. bool replaceWithText (const String& textToWrite,
  3144. const bool asUnicode = false,
  3145. const bool writeUnicodeHeaderBytes = false) const;
  3146. static void findFileSystemRoots (Array<File>& results);
  3147. const String getVolumeLabel() const;
  3148. int getVolumeSerialNumber() const;
  3149. int64 getBytesFreeOnVolume() const;
  3150. int64 getVolumeTotalSize() const;
  3151. bool isOnCDRomDrive() const;
  3152. bool isOnHardDisk() const;
  3153. bool isOnRemovableDrive() const;
  3154. bool startAsProcess (const String& parameters = String::empty) const;
  3155. void revealToUser() const;
  3156. enum SpecialLocationType
  3157. {
  3158. userHomeDirectory,
  3159. userDocumentsDirectory,
  3160. userDesktopDirectory,
  3161. userApplicationDataDirectory,
  3162. commonApplicationDataDirectory,
  3163. tempDirectory,
  3164. currentExecutableFile,
  3165. currentApplicationFile,
  3166. invokedExecutableFile,
  3167. globalApplicationsDirectory,
  3168. userMusicDirectory,
  3169. userMoviesDirectory,
  3170. };
  3171. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3172. static const File createTempFile (const String& fileNameEnding);
  3173. static const File getCurrentWorkingDirectory();
  3174. bool setAsCurrentWorkingDirectory() const;
  3175. static const tchar separator;
  3176. static const tchar* separatorString;
  3177. static const String createLegalFileName (const String& fileNameToFix);
  3178. static const String createLegalPathName (const String& pathNameToFix);
  3179. static bool areFileNamesCaseSensitive();
  3180. static bool isAbsolutePath (const String& path);
  3181. static const File createFileWithoutCheckingPath (const String& path);
  3182. juce_UseDebuggingNewOperator
  3183. private:
  3184. String fullPath;
  3185. // internal way of contructing a file without checking the path
  3186. friend class DirectoryIterator;
  3187. File (const String&, int);
  3188. const String getPathUpToLastSlash() const;
  3189. };
  3190. #endif // __JUCE_FILE_JUCEHEADER__
  3191. /*** End of inlined file: juce_File.h ***/
  3192. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3193. \
  3194. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3195. childElementVariableName != 0; \
  3196. childElementVariableName = childElementVariableName->getNextElement())
  3197. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3198. \
  3199. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3200. childElementVariableName != 0; \
  3201. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3202. class JUCE_API XmlElement
  3203. {
  3204. public:
  3205. XmlElement (const String& tagName) throw();
  3206. XmlElement (const XmlElement& other) throw();
  3207. XmlElement& operator= (const XmlElement& other) throw();
  3208. ~XmlElement() throw();
  3209. bool isEquivalentTo (const XmlElement* const other,
  3210. const bool ignoreOrderOfAttributes) const throw();
  3211. const String createDocument (const String& dtdToUse,
  3212. const bool allOnOneLine = false,
  3213. const bool includeXmlHeader = true,
  3214. const String& encodingType = JUCE_T("UTF-8"),
  3215. const int lineWrapLength = 60) const;
  3216. void writeToStream (OutputStream& output,
  3217. const String& dtdToUse,
  3218. const bool allOnOneLine = false,
  3219. const bool includeXmlHeader = true,
  3220. const String& encodingType = JUCE_T("UTF-8"),
  3221. const int lineWrapLength = 60) const;
  3222. bool writeToFile (const File& destinationFile,
  3223. const String& dtdToUse,
  3224. const String& encodingType = JUCE_T("UTF-8"),
  3225. const int lineWrapLength = 60) const;
  3226. inline const String& getTagName() const throw() { return tagName; }
  3227. bool hasTagName (const String& possibleTagName) const throw();
  3228. int getNumAttributes() const throw();
  3229. const String& getAttributeName (const int attributeIndex) const throw();
  3230. const String& getAttributeValue (const int attributeIndex) const throw();
  3231. // Attribute-handling methods..
  3232. bool hasAttribute (const String& attributeName) const throw();
  3233. const String& getStringAttribute (const String& attributeName) const throw();
  3234. const String getStringAttribute (const String& attributeName,
  3235. const String& defaultReturnValue) const;
  3236. bool compareAttribute (const String& attributeName,
  3237. const String& stringToCompareAgainst,
  3238. const bool ignoreCase = false) const throw();
  3239. int getIntAttribute (const String& attributeName,
  3240. const int defaultReturnValue = 0) const;
  3241. double getDoubleAttribute (const String& attributeName,
  3242. const double defaultReturnValue = 0.0) const;
  3243. bool getBoolAttribute (const String& attributeName,
  3244. const bool defaultReturnValue = false) const;
  3245. void setAttribute (const String& attributeName,
  3246. const String& newValue);
  3247. void setAttribute (const String& attributeName,
  3248. const int newValue);
  3249. void setAttribute (const String& attributeName,
  3250. const double newValue);
  3251. void removeAttribute (const String& attributeName) throw();
  3252. void removeAllAttributes() throw();
  3253. // Child element methods..
  3254. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3255. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3256. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3257. int getNumChildElements() const throw();
  3258. XmlElement* getChildElement (const int index) const throw();
  3259. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3260. void addChildElement (XmlElement* const newChildElement) throw();
  3261. void insertChildElement (XmlElement* const newChildNode,
  3262. int indexToInsertAt) throw();
  3263. XmlElement* createNewChildElement (const String& tagName);
  3264. bool replaceChildElement (XmlElement* const currentChildElement,
  3265. XmlElement* const newChildNode) throw();
  3266. void removeChildElement (XmlElement* const childToRemove,
  3267. const bool shouldDeleteTheChild) throw();
  3268. void deleteAllChildElements() throw();
  3269. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3270. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3271. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3272. template <class ElementComparator>
  3273. void sortChildElements (ElementComparator& comparator,
  3274. const bool retainOrderOfEquivalentItems = false) throw()
  3275. {
  3276. const int num = getNumChildElements();
  3277. if (num > 1)
  3278. {
  3279. HeapBlock <XmlElement*> elems (num);
  3280. getChildElementsAsArray (elems);
  3281. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3282. reorderChildElements (elems, num);
  3283. }
  3284. }
  3285. bool isTextElement() const throw();
  3286. const String getText() const throw();
  3287. void setText (const String& newText) throw();
  3288. const String getAllSubText() const throw();
  3289. const String getChildElementAllSubText (const String& childTagName,
  3290. const String& defaultReturnValue) const throw();
  3291. void addTextElement (const String& text) throw();
  3292. void deleteAllTextElements() throw();
  3293. static XmlElement* createTextElement (const String& text) throw();
  3294. juce_UseDebuggingNewOperator
  3295. private:
  3296. friend class XmlDocument;
  3297. String tagName;
  3298. XmlElement* firstChildElement;
  3299. XmlElement* nextElement;
  3300. struct XmlAttributeNode
  3301. {
  3302. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3303. XmlAttributeNode (const String& name, const String& value) throw();
  3304. String name, value;
  3305. XmlAttributeNode* next;
  3306. private:
  3307. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3308. };
  3309. XmlAttributeNode* attributes;
  3310. XmlElement (int) throw(); // for internal use
  3311. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3312. void writeElementAsText (OutputStream& out,
  3313. const int indentationLevel,
  3314. const int lineWrapLength) const;
  3315. void getChildElementsAsArray (XmlElement**) const throw();
  3316. void reorderChildElements (XmlElement** const, const int) throw();
  3317. };
  3318. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3319. /*** End of inlined file: juce_XmlElement.h ***/
  3320. class JUCE_API PropertySet
  3321. {
  3322. public:
  3323. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3324. PropertySet (const PropertySet& other) throw();
  3325. PropertySet& operator= (const PropertySet& other) throw();
  3326. virtual ~PropertySet();
  3327. const String getValue (const String& keyName,
  3328. const String& defaultReturnValue = String::empty) const throw();
  3329. int getIntValue (const String& keyName,
  3330. const int defaultReturnValue = 0) const throw();
  3331. double getDoubleValue (const String& keyName,
  3332. const double defaultReturnValue = 0.0) const throw();
  3333. bool getBoolValue (const String& keyName,
  3334. const bool defaultReturnValue = false) const throw();
  3335. XmlElement* getXmlValue (const String& keyName) const;
  3336. void setValue (const String& keyName, const String& value) throw();
  3337. void setValue (const String& keyName, const tchar* const value) throw();
  3338. void setValue (const String& keyName, const int value) throw();
  3339. void setValue (const String& keyName, const double value) throw();
  3340. void setValue (const String& keyName, const bool value) throw();
  3341. void setValue (const String& keyName, const XmlElement* const xml);
  3342. void removeValue (const String& keyName) throw();
  3343. bool containsKey (const String& keyName) const throw();
  3344. void clear();
  3345. StringPairArray& getAllProperties() throw() { return properties; }
  3346. const CriticalSection& getLock() const throw() { return lock; }
  3347. XmlElement* createXml (const String& nodeName) const throw();
  3348. void restoreFromXml (const XmlElement& xml) throw();
  3349. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3350. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3351. juce_UseDebuggingNewOperator
  3352. protected:
  3353. virtual void propertyChanged();
  3354. private:
  3355. StringPairArray properties;
  3356. PropertySet* fallbackProperties;
  3357. CriticalSection lock;
  3358. bool ignoreCaseOfKeys;
  3359. };
  3360. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3361. /*** End of inlined file: juce_PropertySet.h ***/
  3362. #endif
  3363. #ifndef __JUCE_RANGE_JUCEHEADER__
  3364. /*** Start of inlined file: juce_Range.h ***/
  3365. #ifndef __JUCE_RANGE_JUCEHEADER__
  3366. #define __JUCE_RANGE_JUCEHEADER__
  3367. template <typename ValueType>
  3368. class Range
  3369. {
  3370. public:
  3371. Range() throw()
  3372. : start (ValueType()), end (ValueType())
  3373. {
  3374. }
  3375. Range (const ValueType start_, const ValueType end_) throw()
  3376. : start (start_), end (jmax (start_, end_))
  3377. {
  3378. }
  3379. Range (const Range& other) throw()
  3380. : start (other.start), end (other.end)
  3381. {
  3382. }
  3383. Range& operator= (const Range& other) throw()
  3384. {
  3385. start = other.start;
  3386. end = other.end;
  3387. return *this;
  3388. }
  3389. ~Range() throw()
  3390. {
  3391. }
  3392. static const Range between (const ValueType position1, const ValueType position2) throw()
  3393. {
  3394. return (position1 < position2) ? Range (position1, position2)
  3395. : Range (position2, position1);
  3396. }
  3397. static const Range emptyRange (const ValueType start) throw()
  3398. {
  3399. return Range (start, start);
  3400. }
  3401. inline ValueType getStart() const throw() { return start; }
  3402. inline ValueType getLength() const throw() { return end - start; }
  3403. inline ValueType getEnd() const throw() { return end; }
  3404. inline bool isEmpty() const throw() { return start == end; }
  3405. void setStart (const ValueType newStart) throw()
  3406. {
  3407. start = newStart;
  3408. if (newStart > end)
  3409. end = newStart;
  3410. }
  3411. const Range withStart (const ValueType newStart) const throw()
  3412. {
  3413. return Range (newStart, jmax (newStart, end));
  3414. }
  3415. void setEnd (const ValueType newEnd) throw()
  3416. {
  3417. end = newEnd;
  3418. if (newEnd < start)
  3419. start = newEnd;
  3420. }
  3421. const Range withEnd (const ValueType newEnd) const throw()
  3422. {
  3423. return Range (jmin (start, newEnd), newEnd);
  3424. }
  3425. void setLength (const ValueType newLength) throw()
  3426. {
  3427. end = start + jmax (ValueType(), newLength);
  3428. }
  3429. const Range withLength (const ValueType newLength) const throw()
  3430. {
  3431. return Range (start, start + newLength);
  3432. }
  3433. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3434. {
  3435. start += amountToAdd;
  3436. end += amountToAdd;
  3437. return *this;
  3438. }
  3439. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3440. {
  3441. start -= amountToSubtract;
  3442. end -= amountToSubtract;
  3443. return *this;
  3444. }
  3445. const Range operator+ (const ValueType amountToAdd) const throw()
  3446. {
  3447. return Range (start + amountToAdd, end + amountToAdd);
  3448. }
  3449. const Range operator- (const ValueType amountToSubtract) const throw()
  3450. {
  3451. return Range (start - amountToSubtract, end - amountToSubtract);
  3452. }
  3453. bool contains (const ValueType position) const throw()
  3454. {
  3455. return position >= start && position < end;
  3456. }
  3457. ValueType clipValue (const ValueType value) const throw()
  3458. {
  3459. return jlimit (start, end, value);
  3460. }
  3461. bool intersects (const Range& other) const throw()
  3462. {
  3463. return other.start < end && other.end > start;
  3464. }
  3465. const Range getIntersectionWith (const Range& other) const throw()
  3466. {
  3467. return Range (jmax (start, other.start),
  3468. jmin (end, other.end));
  3469. }
  3470. const Range getUnionWith (const Range& other) const throw()
  3471. {
  3472. return Range (jmin (start, other.start),
  3473. jmax (end, other.end));
  3474. }
  3475. juce_UseDebuggingNewOperator
  3476. private:
  3477. ValueType start, end;
  3478. };
  3479. #endif // __JUCE_RANGE_JUCEHEADER__
  3480. /*** End of inlined file: juce_Range.h ***/
  3481. #endif
  3482. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3483. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3484. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3485. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3486. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3487. class ReferenceCountedArray
  3488. {
  3489. public:
  3490. ReferenceCountedArray() throw()
  3491. : numUsed (0)
  3492. {
  3493. }
  3494. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3495. {
  3496. const ScopedLockType lock (other.getLock());
  3497. numUsed = other.numUsed;
  3498. data.setAllocatedSize (numUsed);
  3499. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3500. for (int i = numUsed; --i >= 0;)
  3501. if (data.elements[i] != 0)
  3502. data.elements[i]->incReferenceCount();
  3503. }
  3504. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3505. {
  3506. if (this != &other)
  3507. {
  3508. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3509. swapWithArray (other);
  3510. }
  3511. return *this;
  3512. }
  3513. ~ReferenceCountedArray()
  3514. {
  3515. clear();
  3516. }
  3517. void clear()
  3518. {
  3519. const ScopedLockType lock (getLock());
  3520. while (numUsed > 0)
  3521. if (data.elements [--numUsed] != 0)
  3522. data.elements [numUsed]->decReferenceCount();
  3523. jassert (numUsed == 0);
  3524. data.setAllocatedSize (0);
  3525. }
  3526. inline int size() const throw()
  3527. {
  3528. return numUsed;
  3529. }
  3530. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3531. {
  3532. const ScopedLockType lock (getLock());
  3533. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3534. : static_cast <ObjectClass*> (0);
  3535. }
  3536. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3537. {
  3538. const ScopedLockType lock (getLock());
  3539. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3540. return data.elements [index];
  3541. }
  3542. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3543. {
  3544. const ScopedLockType lock (getLock());
  3545. return numUsed > 0 ? data.elements [0]
  3546. : static_cast <ObjectClass*> (0);
  3547. }
  3548. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3549. {
  3550. const ScopedLockType lock (getLock());
  3551. return numUsed > 0 ? data.elements [numUsed - 1]
  3552. : static_cast <ObjectClass*> (0);
  3553. }
  3554. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3555. {
  3556. const ScopedLockType lock (getLock());
  3557. ObjectClass** e = data.elements.getData();
  3558. ObjectClass** const end = e + numUsed;
  3559. while (e != end)
  3560. {
  3561. if (objectToLookFor == *e)
  3562. return static_cast <int> (e - data.elements.getData());
  3563. ++e;
  3564. }
  3565. return -1;
  3566. }
  3567. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3568. {
  3569. const ScopedLockType lock (getLock());
  3570. ObjectClass** e = data.elements.getData();
  3571. ObjectClass** const end = e + numUsed;
  3572. while (e != end)
  3573. {
  3574. if (objectToLookFor == *e)
  3575. return true;
  3576. ++e;
  3577. }
  3578. return false;
  3579. }
  3580. void add (ObjectClass* const newObject) throw()
  3581. {
  3582. const ScopedLockType lock (getLock());
  3583. data.ensureAllocatedSize (numUsed + 1);
  3584. data.elements [numUsed++] = newObject;
  3585. if (newObject != 0)
  3586. newObject->incReferenceCount();
  3587. }
  3588. void insert (int indexToInsertAt,
  3589. ObjectClass* const newObject) throw()
  3590. {
  3591. if (indexToInsertAt >= 0)
  3592. {
  3593. const ScopedLockType lock (getLock());
  3594. if (indexToInsertAt > numUsed)
  3595. indexToInsertAt = numUsed;
  3596. data.ensureAllocatedSize (numUsed + 1);
  3597. ObjectClass** const e = data.elements + indexToInsertAt;
  3598. const int numToMove = numUsed - indexToInsertAt;
  3599. if (numToMove > 0)
  3600. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3601. *e = newObject;
  3602. if (newObject != 0)
  3603. newObject->incReferenceCount();
  3604. ++numUsed;
  3605. }
  3606. else
  3607. {
  3608. add (newObject);
  3609. }
  3610. }
  3611. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3612. {
  3613. const ScopedLockType lock (getLock());
  3614. if (! contains (newObject))
  3615. add (newObject);
  3616. }
  3617. void set (const int indexToChange,
  3618. ObjectClass* const newObject)
  3619. {
  3620. if (indexToChange >= 0)
  3621. {
  3622. const ScopedLockType lock (getLock());
  3623. if (newObject != 0)
  3624. newObject->incReferenceCount();
  3625. if (indexToChange < numUsed)
  3626. {
  3627. if (data.elements [indexToChange] != 0)
  3628. data.elements [indexToChange]->decReferenceCount();
  3629. data.elements [indexToChange] = newObject;
  3630. }
  3631. else
  3632. {
  3633. data.ensureAllocatedSize (numUsed + 1);
  3634. data.elements [numUsed++] = newObject;
  3635. }
  3636. }
  3637. }
  3638. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3639. int startIndex = 0,
  3640. int numElementsToAdd = -1) throw()
  3641. {
  3642. arrayToAddFrom.lockArray();
  3643. const ScopedLockType lock (getLock());
  3644. if (startIndex < 0)
  3645. {
  3646. jassertfalse
  3647. startIndex = 0;
  3648. }
  3649. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3650. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3651. if (numElementsToAdd > 0)
  3652. {
  3653. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3654. while (--numElementsToAdd >= 0)
  3655. add (arrayToAddFrom.getUnchecked (startIndex++));
  3656. }
  3657. arrayToAddFrom.unlockArray();
  3658. }
  3659. template <class ElementComparator>
  3660. void addSorted (ElementComparator& comparator,
  3661. ObjectClass* newObject) throw()
  3662. {
  3663. const ScopedLockType lock (getLock());
  3664. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3665. }
  3666. template <class ElementComparator>
  3667. void addOrReplaceSorted (ElementComparator& comparator,
  3668. ObjectClass* newObject) throw()
  3669. {
  3670. const ScopedLockType lock (getLock());
  3671. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3672. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3673. set (index - 1, newObject); // replace an existing object that matches
  3674. else
  3675. insert (index, newObject); // no match, so insert the new one
  3676. }
  3677. void remove (const int indexToRemove)
  3678. {
  3679. const ScopedLockType lock (getLock());
  3680. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3681. {
  3682. ObjectClass** const e = data.elements + indexToRemove;
  3683. if (*e != 0)
  3684. (*e)->decReferenceCount();
  3685. --numUsed;
  3686. const int numberToShift = numUsed - indexToRemove;
  3687. if (numberToShift > 0)
  3688. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3689. if ((numUsed << 1) < data.numAllocated)
  3690. minimiseStorageOverheads();
  3691. }
  3692. }
  3693. void removeObject (ObjectClass* const objectToRemove)
  3694. {
  3695. const ScopedLockType lock (getLock());
  3696. remove (indexOf (objectToRemove));
  3697. }
  3698. void removeRange (const int startIndex,
  3699. const int numberToRemove)
  3700. {
  3701. const ScopedLockType lock (getLock());
  3702. const int start = jlimit (0, numUsed, startIndex);
  3703. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3704. if (end > start)
  3705. {
  3706. int i;
  3707. for (i = start; i < end; ++i)
  3708. {
  3709. if (data.elements[i] != 0)
  3710. {
  3711. data.elements[i]->decReferenceCount();
  3712. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3713. }
  3714. }
  3715. const int rangeSize = end - start;
  3716. ObjectClass** e = data.elements + start;
  3717. i = numUsed - end;
  3718. numUsed -= rangeSize;
  3719. while (--i >= 0)
  3720. {
  3721. *e = e [rangeSize];
  3722. ++e;
  3723. }
  3724. if ((numUsed << 1) < data.numAllocated)
  3725. minimiseStorageOverheads();
  3726. }
  3727. }
  3728. void removeLast (int howManyToRemove = 1)
  3729. {
  3730. const ScopedLockType lock (getLock());
  3731. if (howManyToRemove > numUsed)
  3732. howManyToRemove = numUsed;
  3733. while (--howManyToRemove >= 0)
  3734. remove (numUsed - 1);
  3735. }
  3736. void swap (const int index1,
  3737. const int index2) throw()
  3738. {
  3739. const ScopedLockType lock (getLock());
  3740. if (((unsigned int) index1) < (unsigned int) numUsed
  3741. && ((unsigned int) index2) < (unsigned int) numUsed)
  3742. {
  3743. swapVariables (data.elements [index1],
  3744. data.elements [index2]);
  3745. }
  3746. }
  3747. void move (const int currentIndex,
  3748. int newIndex) throw()
  3749. {
  3750. if (currentIndex != newIndex)
  3751. {
  3752. const ScopedLockType lock (getLock());
  3753. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3754. {
  3755. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3756. newIndex = numUsed - 1;
  3757. ObjectClass* const value = data.elements [currentIndex];
  3758. if (newIndex > currentIndex)
  3759. {
  3760. memmove (data.elements + currentIndex,
  3761. data.elements + currentIndex + 1,
  3762. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3763. }
  3764. else
  3765. {
  3766. memmove (data.elements + newIndex + 1,
  3767. data.elements + newIndex,
  3768. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3769. }
  3770. data.elements [newIndex] = value;
  3771. }
  3772. }
  3773. }
  3774. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3775. {
  3776. const ScopedLockType lock1 (getLock());
  3777. const ScopedLockType lock2 (otherArray.getLock());
  3778. data.swapWith (otherArray.data);
  3779. swapVariables (numUsed, otherArray.numUsed);
  3780. }
  3781. bool operator== (const ReferenceCountedArray& other) const throw()
  3782. {
  3783. const ScopedLockType lock2 (other.getLock());
  3784. const ScopedLockType lock1 (getLock());
  3785. if (numUsed != other.numUsed)
  3786. return false;
  3787. for (int i = numUsed; --i >= 0;)
  3788. if (data.elements [i] != other.data.elements [i])
  3789. return false;
  3790. return true;
  3791. }
  3792. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3793. {
  3794. return ! operator== (other);
  3795. }
  3796. template <class ElementComparator>
  3797. void sort (ElementComparator& comparator,
  3798. const bool retainOrderOfEquivalentItems = false) const throw()
  3799. {
  3800. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3801. // avoids getting warning messages about the parameter being unused
  3802. const ScopedLockType lock (getLock());
  3803. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3804. }
  3805. void minimiseStorageOverheads() throw()
  3806. {
  3807. const ScopedLockType lock (getLock());
  3808. data.shrinkToNoMoreThan (numUsed);
  3809. }
  3810. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3811. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3812. juce_UseDebuggingNewOperator
  3813. private:
  3814. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3815. int numUsed;
  3816. };
  3817. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3818. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3819. #endif
  3820. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3821. #endif
  3822. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3823. #endif
  3824. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3825. /*** Start of inlined file: juce_SortedSet.h ***/
  3826. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3827. #define __JUCE_SORTEDSET_JUCEHEADER__
  3828. #if JUCE_MSVC
  3829. #pragma warning (push)
  3830. #pragma warning (disable: 4512)
  3831. #endif
  3832. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3833. class SortedSet
  3834. {
  3835. public:
  3836. SortedSet() throw()
  3837. : numUsed (0)
  3838. {
  3839. }
  3840. SortedSet (const SortedSet& other) throw()
  3841. {
  3842. const ScopedLockType lock (other.getLock());
  3843. numUsed = other.numUsed;
  3844. data.setAllocatedSize (other.numUsed);
  3845. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3846. }
  3847. ~SortedSet() throw()
  3848. {
  3849. }
  3850. SortedSet& operator= (const SortedSet& other) throw()
  3851. {
  3852. if (this != &other)
  3853. {
  3854. const ScopedLockType lock1 (other.getLock());
  3855. const ScopedLockType lock2 (getLock());
  3856. data.ensureAllocatedSize (other.size());
  3857. numUsed = other.numUsed;
  3858. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3859. minimiseStorageOverheads();
  3860. }
  3861. return *this;
  3862. }
  3863. bool operator== (const SortedSet<ElementType>& other) const throw()
  3864. {
  3865. const ScopedLockType lock (getLock());
  3866. if (numUsed != other.numUsed)
  3867. return false;
  3868. for (int i = numUsed; --i >= 0;)
  3869. if (data.elements[i] != other.data.elements[i])
  3870. return false;
  3871. return true;
  3872. }
  3873. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3874. {
  3875. return ! operator== (other);
  3876. }
  3877. void clear() throw()
  3878. {
  3879. const ScopedLockType lock (getLock());
  3880. data.setAllocatedSize (0);
  3881. numUsed = 0;
  3882. }
  3883. void clearQuick() throw()
  3884. {
  3885. const ScopedLockType lock (getLock());
  3886. numUsed = 0;
  3887. }
  3888. inline int size() const throw()
  3889. {
  3890. return numUsed;
  3891. }
  3892. inline ElementType operator[] (const int index) const throw()
  3893. {
  3894. const ScopedLockType lock (getLock());
  3895. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3896. : ElementType();
  3897. }
  3898. inline ElementType getUnchecked (const int index) const throw()
  3899. {
  3900. const ScopedLockType lock (getLock());
  3901. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3902. return data.elements [index];
  3903. }
  3904. inline ElementType getFirst() const throw()
  3905. {
  3906. const ScopedLockType lock (getLock());
  3907. return numUsed > 0 ? data.elements [0] : ElementType();
  3908. }
  3909. inline ElementType getLast() const throw()
  3910. {
  3911. const ScopedLockType lock (getLock());
  3912. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3913. }
  3914. int indexOf (const ElementType elementToLookFor) const throw()
  3915. {
  3916. const ScopedLockType lock (getLock());
  3917. int start = 0;
  3918. int end = numUsed;
  3919. for (;;)
  3920. {
  3921. if (start >= end)
  3922. {
  3923. return -1;
  3924. }
  3925. else if (elementToLookFor == data.elements [start])
  3926. {
  3927. return start;
  3928. }
  3929. else
  3930. {
  3931. const int halfway = (start + end) >> 1;
  3932. if (halfway == start)
  3933. return -1;
  3934. else if (elementToLookFor >= data.elements [halfway])
  3935. start = halfway;
  3936. else
  3937. end = halfway;
  3938. }
  3939. }
  3940. }
  3941. bool contains (const ElementType elementToLookFor) const throw()
  3942. {
  3943. const ScopedLockType lock (getLock());
  3944. int start = 0;
  3945. int end = numUsed;
  3946. for (;;)
  3947. {
  3948. if (start >= end)
  3949. {
  3950. return false;
  3951. }
  3952. else if (elementToLookFor == data.elements [start])
  3953. {
  3954. return true;
  3955. }
  3956. else
  3957. {
  3958. const int halfway = (start + end) >> 1;
  3959. if (halfway == start)
  3960. return false;
  3961. else if (elementToLookFor >= data.elements [halfway])
  3962. start = halfway;
  3963. else
  3964. end = halfway;
  3965. }
  3966. }
  3967. }
  3968. void add (const ElementType newElement) throw()
  3969. {
  3970. const ScopedLockType lock (getLock());
  3971. int start = 0;
  3972. int end = numUsed;
  3973. for (;;)
  3974. {
  3975. if (start >= end)
  3976. {
  3977. jassert (start <= end);
  3978. insertInternal (start, newElement);
  3979. break;
  3980. }
  3981. else if (newElement == data.elements [start])
  3982. {
  3983. break;
  3984. }
  3985. else
  3986. {
  3987. const int halfway = (start + end) >> 1;
  3988. if (halfway == start)
  3989. {
  3990. if (newElement >= data.elements [halfway])
  3991. insertInternal (start + 1, newElement);
  3992. else
  3993. insertInternal (start, newElement);
  3994. break;
  3995. }
  3996. else if (newElement >= data.elements [halfway])
  3997. start = halfway;
  3998. else
  3999. end = halfway;
  4000. }
  4001. }
  4002. }
  4003. void addArray (const ElementType* elementsToAdd,
  4004. int numElementsToAdd) throw()
  4005. {
  4006. const ScopedLockType lock (getLock());
  4007. while (--numElementsToAdd >= 0)
  4008. add (*elementsToAdd++);
  4009. }
  4010. template <class OtherSetType>
  4011. void addSet (const OtherSetType& setToAddFrom,
  4012. int startIndex = 0,
  4013. int numElementsToAdd = -1) throw()
  4014. {
  4015. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4016. const ScopedLockType lock2 (getLock());
  4017. jassert (this != &setToAddFrom);
  4018. if (this != &setToAddFrom)
  4019. {
  4020. if (startIndex < 0)
  4021. {
  4022. jassertfalse
  4023. startIndex = 0;
  4024. }
  4025. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4026. numElementsToAdd = setToAddFrom.size() - startIndex;
  4027. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4028. }
  4029. }
  4030. ElementType remove (const int indexToRemove) throw()
  4031. {
  4032. const ScopedLockType lock (getLock());
  4033. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4034. {
  4035. --numUsed;
  4036. ElementType* const e = data.elements + indexToRemove;
  4037. ElementType const removed = *e;
  4038. const int numberToShift = numUsed - indexToRemove;
  4039. if (numberToShift > 0)
  4040. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4041. if ((numUsed << 1) < data.numAllocated)
  4042. minimiseStorageOverheads();
  4043. return removed;
  4044. }
  4045. return 0;
  4046. }
  4047. void removeValue (const ElementType valueToRemove) throw()
  4048. {
  4049. const ScopedLockType lock (getLock());
  4050. remove (indexOf (valueToRemove));
  4051. }
  4052. template <class OtherSetType>
  4053. void removeValuesIn (const OtherSetType& otherSet) throw()
  4054. {
  4055. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4056. const ScopedLockType lock2 (getLock());
  4057. if (this == &otherSet)
  4058. {
  4059. clear();
  4060. }
  4061. else
  4062. {
  4063. if (otherSet.size() > 0)
  4064. {
  4065. for (int i = numUsed; --i >= 0;)
  4066. if (otherSet.contains (data.elements [i]))
  4067. remove (i);
  4068. }
  4069. }
  4070. }
  4071. template <class OtherSetType>
  4072. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4073. {
  4074. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4075. const ScopedLockType lock2 (getLock());
  4076. if (this != &otherSet)
  4077. {
  4078. if (otherSet.size() <= 0)
  4079. {
  4080. clear();
  4081. }
  4082. else
  4083. {
  4084. for (int i = numUsed; --i >= 0;)
  4085. if (! otherSet.contains (data.elements [i]))
  4086. remove (i);
  4087. }
  4088. }
  4089. }
  4090. void minimiseStorageOverheads() throw()
  4091. {
  4092. const ScopedLockType lock (getLock());
  4093. data.shrinkToNoMoreThan (numUsed);
  4094. }
  4095. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4096. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4097. juce_UseDebuggingNewOperator
  4098. private:
  4099. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4100. int numUsed;
  4101. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4102. {
  4103. data.ensureAllocatedSize (numUsed + 1);
  4104. ElementType* const insertPos = data.elements + indexToInsertAt;
  4105. const int numberToMove = numUsed - indexToInsertAt;
  4106. if (numberToMove > 0)
  4107. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4108. *insertPos = newElement;
  4109. ++numUsed;
  4110. }
  4111. };
  4112. #if JUCE_MSVC
  4113. #pragma warning (pop)
  4114. #endif
  4115. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4116. /*** End of inlined file: juce_SortedSet.h ***/
  4117. #endif
  4118. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4119. /*** Start of inlined file: juce_SparseSet.h ***/
  4120. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4121. #define __JUCE_SPARSESET_JUCEHEADER__
  4122. template <class Type>
  4123. class SparseSet
  4124. {
  4125. public:
  4126. SparseSet() throw()
  4127. {
  4128. }
  4129. SparseSet (const SparseSet<Type>& other) throw()
  4130. : values (other.values)
  4131. {
  4132. }
  4133. ~SparseSet() throw()
  4134. {
  4135. }
  4136. void clear() throw()
  4137. {
  4138. values.clear();
  4139. }
  4140. bool isEmpty() const throw()
  4141. {
  4142. return values.size() == 0;
  4143. }
  4144. Type size() const throw()
  4145. {
  4146. Type num = 0;
  4147. for (int i = 0; i < values.size(); i += 2)
  4148. num += values[i + 1] - values[i];
  4149. return num;
  4150. }
  4151. Type operator[] (int index) const throw()
  4152. {
  4153. for (int i = 0; i < values.size(); i += 2)
  4154. {
  4155. const Type s = values.getUnchecked(i);
  4156. const Type e = values.getUnchecked(i + 1);
  4157. if (index < e - s)
  4158. return s + index;
  4159. index -= e - s;
  4160. }
  4161. return (Type) 0;
  4162. }
  4163. bool contains (const Type valueToLookFor) const throw()
  4164. {
  4165. bool on = false;
  4166. for (int i = 0; i < values.size(); ++i)
  4167. {
  4168. if (values.getUnchecked(i) > valueToLookFor)
  4169. return on;
  4170. on = ! on;
  4171. }
  4172. return false;
  4173. }
  4174. int getNumRanges() const throw()
  4175. {
  4176. return values.size() >> 1;
  4177. }
  4178. bool getRange (const int rangeIndex,
  4179. Type& startValue,
  4180. Type& numValues) const throw()
  4181. {
  4182. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4183. {
  4184. startValue = values [rangeIndex << 1];
  4185. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4186. return true;
  4187. }
  4188. return false;
  4189. }
  4190. bool getTotalRange (Type& lowestValue,
  4191. Type& highestValue) const throw()
  4192. {
  4193. if (values.size() > 0)
  4194. {
  4195. lowestValue = values.getUnchecked (0);
  4196. highestValue = values.getUnchecked (values.size() - 1);
  4197. return true;
  4198. }
  4199. return false;
  4200. }
  4201. void addRange (const Type firstValue,
  4202. const Type numValuesToAdd) throw()
  4203. {
  4204. jassert (numValuesToAdd >= 0);
  4205. if (numValuesToAdd > 0)
  4206. {
  4207. removeRange (firstValue, numValuesToAdd);
  4208. IntegerElementComparator<Type> sorter;
  4209. values.addSorted (sorter, firstValue);
  4210. values.addSorted (sorter, firstValue + numValuesToAdd);
  4211. simplify();
  4212. }
  4213. }
  4214. void removeRange (const Type firstValue,
  4215. const Type numValuesToRemove) throw()
  4216. {
  4217. jassert (numValuesToRemove >= 0);
  4218. if (numValuesToRemove >= 0
  4219. && firstValue < values.getLast())
  4220. {
  4221. const bool onAtStart = contains (firstValue - 1);
  4222. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4223. const bool onAtEnd = contains (lastValue);
  4224. for (int i = values.size(); --i >= 0;)
  4225. {
  4226. if (values.getUnchecked(i) <= lastValue)
  4227. {
  4228. while (values.getUnchecked(i) >= firstValue)
  4229. {
  4230. values.remove (i);
  4231. if (--i < 0)
  4232. break;
  4233. }
  4234. break;
  4235. }
  4236. }
  4237. IntegerElementComparator<Type> sorter;
  4238. if (onAtStart)
  4239. values.addSorted (sorter, firstValue);
  4240. if (onAtEnd)
  4241. values.addSorted (sorter, lastValue);
  4242. simplify();
  4243. }
  4244. }
  4245. void invertRange (const Type firstValue,
  4246. const Type numValues)
  4247. {
  4248. SparseSet newItems;
  4249. newItems.addRange (firstValue, numValues);
  4250. int i;
  4251. for (i = getNumRanges(); --i >= 0;)
  4252. {
  4253. const int start = values [i << 1];
  4254. const int end = values [(i << 1) + 1];
  4255. newItems.removeRange (start, end);
  4256. }
  4257. removeRange (firstValue, numValues);
  4258. for (i = newItems.getNumRanges(); --i >= 0;)
  4259. {
  4260. const int start = newItems.values [i << 1];
  4261. const int end = newItems.values [(i << 1) + 1];
  4262. addRange (start, end);
  4263. }
  4264. }
  4265. bool overlapsRange (const Type firstValue,
  4266. const Type numValues) throw()
  4267. {
  4268. jassert (numValues >= 0);
  4269. if (numValues > 0)
  4270. {
  4271. for (int i = getNumRanges(); --i >= 0;)
  4272. {
  4273. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4274. return false;
  4275. if (firstValue + numValues > values.getUnchecked (i << 1))
  4276. return true;
  4277. }
  4278. }
  4279. return false;
  4280. }
  4281. bool containsRange (const Type firstValue,
  4282. const Type numValues) throw()
  4283. {
  4284. jassert (numValues >= 0);
  4285. if (numValues > 0)
  4286. {
  4287. for (int i = getNumRanges(); --i >= 0;)
  4288. {
  4289. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4290. return false;
  4291. if (firstValue >= values.getUnchecked (i << 1)
  4292. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4293. return true;
  4294. }
  4295. }
  4296. return false;
  4297. }
  4298. bool operator== (const SparseSet<Type>& other) throw()
  4299. {
  4300. return values == other.values;
  4301. }
  4302. bool operator!= (const SparseSet<Type>& other) throw()
  4303. {
  4304. return values != other.values;
  4305. }
  4306. juce_UseDebuggingNewOperator
  4307. private:
  4308. // alternating start/end values of ranges of values that are present.
  4309. Array<Type, DummyCriticalSection> values;
  4310. void simplify() throw()
  4311. {
  4312. jassert ((values.size() & 1) == 0);
  4313. for (int i = values.size(); --i > 0;)
  4314. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4315. values.removeRange (i - 1, 2);
  4316. }
  4317. };
  4318. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4319. /*** End of inlined file: juce_SparseSet.h ***/
  4320. #endif
  4321. #ifndef __JUCE_VALUE_JUCEHEADER__
  4322. /*** Start of inlined file: juce_Value.h ***/
  4323. #ifndef __JUCE_VALUE_JUCEHEADER__
  4324. #define __JUCE_VALUE_JUCEHEADER__
  4325. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4326. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4327. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4328. /*** Start of inlined file: juce_MessageListener.h ***/
  4329. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4330. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4331. /*** Start of inlined file: juce_Message.h ***/
  4332. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4333. #define __JUCE_MESSAGE_JUCEHEADER__
  4334. class MessageListener;
  4335. class MessageManager;
  4336. class JUCE_API Message
  4337. {
  4338. public:
  4339. Message() throw();
  4340. Message (const int intParameter1,
  4341. const int intParameter2,
  4342. const int intParameter3,
  4343. void* const pointerParameter) throw();
  4344. virtual ~Message() throw();
  4345. // These values can be used for carrying simple data that the application needs to
  4346. // pass around. For more complex messages, just create a subclass.
  4347. int intParameter1; /**< user-defined integer value. */
  4348. int intParameter2; /**< user-defined integer value. */
  4349. int intParameter3; /**< user-defined integer value. */
  4350. void* pointerParameter; /**< user-defined pointer value. */
  4351. juce_UseDebuggingNewOperator
  4352. private:
  4353. friend class MessageListener;
  4354. friend class MessageManager;
  4355. MessageListener* messageRecipient;
  4356. Message (const Message&);
  4357. Message& operator= (const Message&);
  4358. };
  4359. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4360. /*** End of inlined file: juce_Message.h ***/
  4361. class JUCE_API MessageListener
  4362. {
  4363. protected:
  4364. MessageListener() throw();
  4365. public:
  4366. virtual ~MessageListener();
  4367. virtual void handleMessage (const Message& message) = 0;
  4368. void postMessage (Message* const message) const throw();
  4369. bool isValidMessageListener() const throw();
  4370. };
  4371. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4372. /*** End of inlined file: juce_MessageListener.h ***/
  4373. class JUCE_API AsyncUpdater
  4374. {
  4375. public:
  4376. AsyncUpdater() throw();
  4377. virtual ~AsyncUpdater();
  4378. void triggerAsyncUpdate() throw();
  4379. void cancelPendingUpdate() throw();
  4380. void handleUpdateNowIfNeeded();
  4381. virtual void handleAsyncUpdate() = 0;
  4382. private:
  4383. class AsyncUpdaterInternal : public MessageListener
  4384. {
  4385. public:
  4386. AsyncUpdaterInternal() throw() {}
  4387. ~AsyncUpdaterInternal() {}
  4388. void handleMessage (const Message&);
  4389. AsyncUpdater* owner;
  4390. private:
  4391. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4392. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4393. };
  4394. AsyncUpdaterInternal internalAsyncHandler;
  4395. bool asyncMessagePending;
  4396. };
  4397. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4398. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4399. /*** Start of inlined file: juce_ListenerList.h ***/
  4400. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4401. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4402. template <class ListenerClass,
  4403. class ArrayType = Array <ListenerClass*> >
  4404. class ListenerList
  4405. {
  4406. public:
  4407. ListenerList()
  4408. {
  4409. }
  4410. ~ListenerList()
  4411. {
  4412. }
  4413. void add (ListenerClass* const listenerToAdd)
  4414. {
  4415. // Listeners can't be null pointers!
  4416. jassert (listenerToAdd != 0);
  4417. if (listenerToAdd != 0)
  4418. listeners.add (listenerToAdd);
  4419. }
  4420. void remove (ListenerClass* const listenerToRemove)
  4421. {
  4422. // Listeners can't be null pointers!
  4423. jassert (listenerToRemove != 0);
  4424. listeners.removeValue (listenerToRemove);
  4425. }
  4426. int size() const throw()
  4427. {
  4428. return listeners.size();
  4429. }
  4430. bool isEmpty() const throw()
  4431. {
  4432. return listeners.size() == 0;
  4433. }
  4434. bool contains (ListenerClass* const listener) const throw()
  4435. {
  4436. return listeners.contains (listener);
  4437. }
  4438. void call (void (ListenerClass::*callbackFunction) ())
  4439. {
  4440. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4441. }
  4442. template <class BailOutCheckerType>
  4443. void callChecked (const BailOutCheckerType& bailOutChecker,
  4444. void (ListenerClass::*callbackFunction) ())
  4445. {
  4446. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4447. (iter.getListener()->*callbackFunction) ();
  4448. }
  4449. template <typename P1, typename P2>
  4450. void call (void (ListenerClass::*callbackFunction) (P1),
  4451. P2& param1)
  4452. {
  4453. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4454. (iter.getListener()->*callbackFunction) (param1);
  4455. }
  4456. template <class BailOutCheckerType, typename P1, typename P2>
  4457. void callChecked (const BailOutCheckerType& bailOutChecker,
  4458. void (ListenerClass::*callbackFunction) (P1),
  4459. P2& param1)
  4460. {
  4461. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4462. (iter.getListener()->*callbackFunction) (param1);
  4463. }
  4464. template <typename P1, typename P2, typename P3, typename P4>
  4465. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4466. P3& param1, P4& param2)
  4467. {
  4468. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4469. (iter.getListener()->*callbackFunction) (param1, param2);
  4470. }
  4471. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4>
  4472. void callChecked (const BailOutCheckerType& bailOutChecker,
  4473. void (ListenerClass::*callbackFunction) (P1, P2),
  4474. P3& param1, P4& param2)
  4475. {
  4476. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4477. (iter.getListener()->*callbackFunction) (param1, param2);
  4478. }
  4479. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4480. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4481. P4& param1, P5& param2, P6& param3)
  4482. {
  4483. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4484. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4485. }
  4486. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4487. void callChecked (const BailOutCheckerType& bailOutChecker,
  4488. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4489. P4& param1, P5& param2, P6& param3)
  4490. {
  4491. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4492. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4493. }
  4494. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4495. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4496. P5& param1, P6& param2, P7& param3, P8& param4)
  4497. {
  4498. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4499. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4500. }
  4501. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4502. void callChecked (const BailOutCheckerType& bailOutChecker,
  4503. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4504. P5& param1, P6& param2, P7& param3, P8& param4)
  4505. {
  4506. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4507. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4508. }
  4509. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4510. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4511. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4512. {
  4513. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4514. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4515. }
  4516. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4517. void callChecked (const BailOutCheckerType& bailOutChecker,
  4518. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4519. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4520. {
  4521. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4522. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4523. }
  4524. class DummyBailOutChecker
  4525. {
  4526. public:
  4527. inline bool shouldBailOut() const throw() { return false; }
  4528. };
  4529. template <class BailOutCheckerType, class ListType>
  4530. class Iterator
  4531. {
  4532. public:
  4533. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4534. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4535. {}
  4536. ~Iterator() {}
  4537. bool next()
  4538. {
  4539. if (index <= 0 || bailOutChecker.shouldBailOut())
  4540. return false;
  4541. const int listSize = list.size();
  4542. if (--index < listSize)
  4543. return true;
  4544. index = listSize - 1;
  4545. return index >= 0;
  4546. }
  4547. typename ListType::ListenerType* getListener() const throw()
  4548. {
  4549. return list.getListeners().getUnchecked (index);
  4550. }
  4551. private:
  4552. const ListType& list;
  4553. const BailOutCheckerType& bailOutChecker;
  4554. int index;
  4555. Iterator (const Iterator&);
  4556. Iterator& operator= (const Iterator&);
  4557. };
  4558. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4559. typedef ListenerClass ListenerType;
  4560. const ArrayType& getListeners() const throw() { return listeners; }
  4561. private:
  4562. ArrayType listeners;
  4563. ListenerList (const ListenerList&);
  4564. ListenerList& operator= (const ListenerList&);
  4565. };
  4566. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4567. /*** End of inlined file: juce_ListenerList.h ***/
  4568. class JUCE_API Value
  4569. {
  4570. public:
  4571. Value();
  4572. Value (const Value& other);
  4573. Value (const var& initialValue);
  4574. ~Value();
  4575. const var getValue() const;
  4576. operator const var() const;
  4577. const String toString() const;
  4578. void setValue (const var& newValue);
  4579. Value& operator= (const var& newValue);
  4580. void referTo (const Value& valueToReferTo);
  4581. bool refersToSameSourceAs (const Value& other) const;
  4582. bool operator== (const Value& other) const;
  4583. bool operator!= (const Value& other) const;
  4584. class JUCE_API Listener
  4585. {
  4586. public:
  4587. Listener() {}
  4588. virtual ~Listener() {}
  4589. virtual void valueChanged (Value& value) = 0;
  4590. };
  4591. void addListener (Listener* const listener);
  4592. void removeListener (Listener* const listener);
  4593. class JUCE_API ValueSource : public ReferenceCountedObject,
  4594. public AsyncUpdater
  4595. {
  4596. public:
  4597. ValueSource();
  4598. virtual ~ValueSource();
  4599. virtual const var getValue() const = 0;
  4600. virtual void setValue (const var& newValue) = 0;
  4601. void sendChangeMessage (const bool dispatchSynchronously);
  4602. juce_UseDebuggingNewOperator
  4603. protected:
  4604. friend class Value;
  4605. SortedSet <Value*> valuesWithListeners;
  4606. void handleAsyncUpdate();
  4607. ValueSource (const ValueSource&);
  4608. ValueSource& operator= (const ValueSource&);
  4609. };
  4610. explicit Value (ValueSource* const valueSource);
  4611. ValueSource& getValueSource() { return *value; }
  4612. juce_UseDebuggingNewOperator
  4613. private:
  4614. friend class ValueSource;
  4615. ReferenceCountedObjectPtr <ValueSource> value;
  4616. ListenerList <Listener> listeners;
  4617. void callListeners();
  4618. // This is disallowed to avoid confusion about whether it should
  4619. // do a by-value or by-reference copy.
  4620. Value& operator= (const Value& other);
  4621. };
  4622. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4623. #endif // __JUCE_VALUE_JUCEHEADER__
  4624. /*** End of inlined file: juce_Value.h ***/
  4625. #endif
  4626. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4627. /*** Start of inlined file: juce_ValueTree.h ***/
  4628. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4629. #define __JUCE_VALUETREE_JUCEHEADER__
  4630. /*** Start of inlined file: juce_UndoManager.h ***/
  4631. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4632. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4633. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4634. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4635. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4636. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4637. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4638. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4639. /*** Start of inlined file: juce_ChangeListener.h ***/
  4640. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4641. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4642. class JUCE_API ChangeListener
  4643. {
  4644. public:
  4645. virtual ~ChangeListener() {}
  4646. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4647. };
  4648. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4649. /*** End of inlined file: juce_ChangeListener.h ***/
  4650. /*** Start of inlined file: juce_ScopedLock.h ***/
  4651. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4652. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4653. class JUCE_API ScopedLock
  4654. {
  4655. public:
  4656. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4657. inline ~ScopedLock() throw() { lock_.exit(); }
  4658. private:
  4659. const CriticalSection& lock_;
  4660. ScopedLock (const ScopedLock&);
  4661. ScopedLock& operator= (const ScopedLock&);
  4662. };
  4663. class ScopedUnlock
  4664. {
  4665. public:
  4666. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4667. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4668. private:
  4669. const CriticalSection& lock_;
  4670. ScopedUnlock (const ScopedLock&);
  4671. ScopedUnlock& operator= (const ScopedUnlock&);
  4672. };
  4673. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4674. /*** End of inlined file: juce_ScopedLock.h ***/
  4675. class JUCE_API ChangeListenerList : public MessageListener
  4676. {
  4677. public:
  4678. ChangeListenerList() throw();
  4679. ~ChangeListenerList() throw();
  4680. void addChangeListener (ChangeListener* const listener) throw();
  4681. void removeChangeListener (ChangeListener* const listener) throw();
  4682. void removeAllChangeListeners() throw();
  4683. void sendChangeMessage (void* objectThatHasChanged) throw();
  4684. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4685. void dispatchPendingMessages();
  4686. void handleMessage (const Message&);
  4687. juce_UseDebuggingNewOperator
  4688. private:
  4689. SortedSet <void*> listeners;
  4690. CriticalSection lock;
  4691. void* lastChangedObject;
  4692. bool messagePending;
  4693. ChangeListenerList (const ChangeListenerList&);
  4694. ChangeListenerList& operator= (const ChangeListenerList&);
  4695. };
  4696. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4697. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4698. class JUCE_API ChangeBroadcaster
  4699. {
  4700. public:
  4701. ChangeBroadcaster() throw();
  4702. virtual ~ChangeBroadcaster();
  4703. void addChangeListener (ChangeListener* const listener) throw();
  4704. void removeChangeListener (ChangeListener* const listener) throw();
  4705. void removeAllChangeListeners() throw();
  4706. void sendChangeMessage (void* objectThatHasChanged) throw();
  4707. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4708. void dispatchPendingMessages();
  4709. private:
  4710. ChangeListenerList changeListenerList;
  4711. ChangeBroadcaster (const ChangeBroadcaster&);
  4712. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4713. };
  4714. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4715. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4716. /*** Start of inlined file: juce_UndoableAction.h ***/
  4717. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4718. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4719. class JUCE_API UndoableAction
  4720. {
  4721. protected:
  4722. UndoableAction() throw() {}
  4723. public:
  4724. virtual ~UndoableAction() {}
  4725. virtual bool perform() = 0;
  4726. virtual bool undo() = 0;
  4727. virtual int getSizeInUnits() { return 10; }
  4728. };
  4729. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4730. /*** End of inlined file: juce_UndoableAction.h ***/
  4731. class JUCE_API UndoManager : public ChangeBroadcaster
  4732. {
  4733. public:
  4734. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4735. const int minimumTransactionsToKeep = 30);
  4736. ~UndoManager();
  4737. void clearUndoHistory();
  4738. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4739. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4740. const int minimumTransactionsToKeep);
  4741. bool perform (UndoableAction* const action,
  4742. const String& actionName = String::empty);
  4743. void beginNewTransaction (const String& actionName = String::empty);
  4744. void setCurrentTransactionName (const String& newName);
  4745. bool canUndo() const;
  4746. const String getUndoDescription() const;
  4747. bool undo();
  4748. bool undoCurrentTransactionOnly();
  4749. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4750. int getNumActionsInCurrentTransaction() const;
  4751. bool canRedo() const;
  4752. const String getRedoDescription() const;
  4753. bool redo();
  4754. juce_UseDebuggingNewOperator
  4755. private:
  4756. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4757. StringArray transactionNames;
  4758. String currentTransactionName;
  4759. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4760. bool newTransaction, reentrancyCheck;
  4761. // disallow copy constructor
  4762. UndoManager (const UndoManager&);
  4763. UndoManager& operator= (const UndoManager&);
  4764. };
  4765. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4766. /*** End of inlined file: juce_UndoManager.h ***/
  4767. class JUCE_API ValueTree
  4768. {
  4769. public:
  4770. ValueTree (const String& type);
  4771. ValueTree (const ValueTree& other);
  4772. ValueTree& operator= (const ValueTree& other);
  4773. ~ValueTree();
  4774. bool operator== (const ValueTree& other) const;
  4775. bool operator!= (const ValueTree& other) const;
  4776. bool isValid() const { return object != 0; }
  4777. ValueTree createCopy() const;
  4778. const String getType() const;
  4779. bool hasType (const String& typeName) const;
  4780. const var& getProperty (const var::identifier& name) const;
  4781. const var& operator[] (const var::identifier& name) const;
  4782. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4783. bool hasProperty (const var::identifier& name) const;
  4784. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4785. void removeAllProperties (UndoManager* const undoManager);
  4786. int getNumProperties() const;
  4787. const var::identifier getPropertyName (int index) const;
  4788. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4789. int getNumChildren() const;
  4790. ValueTree getChild (int index) const;
  4791. ValueTree getChildWithName (const String& type) const;
  4792. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4793. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4794. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4795. void removeChild (const int childIndex, UndoManager* const undoManager);
  4796. void removeAllChildren (UndoManager* const undoManager);
  4797. bool isAChildOf (const ValueTree& possibleParent) const;
  4798. ValueTree getParent() const;
  4799. XmlElement* createXml() const;
  4800. static ValueTree fromXml (const XmlElement& xml);
  4801. void writeToStream (OutputStream& output);
  4802. static ValueTree readFromStream (InputStream& input);
  4803. class JUCE_API Listener
  4804. {
  4805. public:
  4806. virtual ~Listener() {}
  4807. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4808. const var::identifier& property) = 0;
  4809. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4810. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4811. };
  4812. void addListener (Listener* listener);
  4813. void removeListener (Listener* listener);
  4814. template <typename ElementComparator>
  4815. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4816. {
  4817. if (object != 0)
  4818. {
  4819. ComparatorAdapter <ElementComparator> adapter (comparator);
  4820. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4821. object->sendChildChangeMessage();
  4822. }
  4823. }
  4824. juce_UseDebuggingNewOperator
  4825. private:
  4826. friend class ValueTreeSetPropertyAction;
  4827. friend class ValueTreeChildChangeAction;
  4828. class JUCE_API SharedObject : public ReferenceCountedObject
  4829. {
  4830. public:
  4831. SharedObject (const String& type);
  4832. SharedObject (const SharedObject& other);
  4833. ~SharedObject();
  4834. const String type;
  4835. NamedValueSet properties;
  4836. ReferenceCountedArray <SharedObject> children;
  4837. SortedSet <ValueTree*> valueTreesWithListeners;
  4838. SharedObject* parent;
  4839. void sendPropertyChangeMessage (const var::identifier& property);
  4840. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4841. void sendChildChangeMessage();
  4842. void sendChildChangeMessage (ValueTree& tree);
  4843. void sendParentChangeMessage();
  4844. const var& getProperty (const var::identifier& name) const;
  4845. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4846. bool hasProperty (const var::identifier& name) const;
  4847. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4848. void removeAllProperties (UndoManager* const undoManager);
  4849. bool isAChildOf (const SharedObject* const possibleParent) const;
  4850. ValueTree getChildWithName (const String& type) const;
  4851. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4852. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4853. void removeChild (const int childIndex, UndoManager* const undoManager);
  4854. void removeAllChildren (UndoManager* const undoManager);
  4855. XmlElement* createXml() const;
  4856. juce_UseDebuggingNewOperator
  4857. private:
  4858. SharedObject& operator= (const SharedObject&);
  4859. };
  4860. template <typename ElementComparator>
  4861. class ComparatorAdapter
  4862. {
  4863. public:
  4864. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4865. int compareElements (SharedObject* const first, SharedObject* const second)
  4866. {
  4867. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4868. }
  4869. private:
  4870. ElementComparator& comparator;
  4871. };
  4872. friend class SharedObject;
  4873. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4874. ReferenceCountedObjectPtr <SharedObject> object;
  4875. ListenerList <Listener> listeners;
  4876. public:
  4877. ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
  4878. };
  4879. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4880. /*** End of inlined file: juce_ValueTree.h ***/
  4881. #endif
  4882. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4883. #endif
  4884. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4885. /*** Start of inlined file: juce_VoidArray.h ***/
  4886. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4887. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4888. typedef Array <void*> VoidArray;
  4889. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4890. /*** End of inlined file: juce_VoidArray.h ***/
  4891. #endif
  4892. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4893. #endif
  4894. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4895. #endif
  4896. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4897. /*** Start of inlined file: juce_FileLogger.h ***/
  4898. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4899. #define __JUCE_FILELOGGER_JUCEHEADER__
  4900. class JUCE_API FileLogger : public Logger
  4901. {
  4902. public:
  4903. FileLogger (const File& fileToWriteTo,
  4904. const String& welcomeMessage,
  4905. const int maxInitialFileSizeBytes = 128 * 1024);
  4906. ~FileLogger();
  4907. void logMessage (const String& message);
  4908. const File getLogFile() const { return logFile; }
  4909. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4910. const String& logFileName,
  4911. const String& welcomeMessage,
  4912. const int maxInitialFileSizeBytes = 128 * 1024);
  4913. juce_UseDebuggingNewOperator
  4914. private:
  4915. File logFile;
  4916. CriticalSection logLock;
  4917. ScopedPointer <FileOutputStream> logStream;
  4918. void trimFileSize (int maxFileSizeBytes) const;
  4919. FileLogger (const FileLogger&);
  4920. FileLogger& operator= (const FileLogger&);
  4921. };
  4922. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4923. /*** End of inlined file: juce_FileLogger.h ***/
  4924. #endif
  4925. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4926. /*** Start of inlined file: juce_Initialisation.h ***/
  4927. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4928. #define __JUCE_INITIALISATION_JUCEHEADER__
  4929. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4930. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4931. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4932. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4933. class ScopedJuceInitialiser_NonGUI
  4934. {
  4935. public:
  4936. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4937. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4938. };
  4939. class ScopedJuceInitialiser_GUI
  4940. {
  4941. public:
  4942. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4943. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4944. };
  4945. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4946. /*** End of inlined file: juce_Initialisation.h ***/
  4947. #endif
  4948. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4949. #endif
  4950. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4951. #endif
  4952. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4953. #endif
  4954. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4955. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4956. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4957. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4958. class JUCE_API PerformanceCounter
  4959. {
  4960. public:
  4961. PerformanceCounter (const String& counterName,
  4962. int runsPerPrintout = 100,
  4963. const File& loggingFile = File::nonexistent);
  4964. ~PerformanceCounter();
  4965. void start();
  4966. void stop();
  4967. void printStatistics();
  4968. juce_UseDebuggingNewOperator
  4969. private:
  4970. String name;
  4971. int numRuns, runsPerPrint;
  4972. double totalTime;
  4973. int64 started;
  4974. File outputFile;
  4975. };
  4976. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4977. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4978. #endif
  4979. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4980. #endif
  4981. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4982. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4983. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4984. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4985. class JUCE_API PlatformUtilities
  4986. {
  4987. public:
  4988. static void beep();
  4989. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4990. const String& emailSubject,
  4991. const String& bodyText,
  4992. const StringArray& filesToAttach);
  4993. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4994. static const String cfStringToJuceString (CFStringRef cfString);
  4995. static CFStringRef juceStringToCFString (const String& s);
  4996. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4997. static const String makePathFromFSRef (FSRef* file);
  4998. static const String convertToPrecomposedUnicode (const String& s);
  4999. static OSType getTypeOfFile (const String& filename);
  5000. static bool isBundle (const String& filename);
  5001. static void addItemToDock (const File& file);
  5002. static int getOSXMinorVersionNumber();
  5003. #endif
  5004. #if JUCE_WINDOWS || DOXYGEN
  5005. // Some registry helper functions:
  5006. static const String getRegistryValue (const String& regValuePath,
  5007. const String& defaultValue = String::empty);
  5008. static void setRegistryValue (const String& regValuePath,
  5009. const String& value);
  5010. static bool registryValueExists (const String& regValuePath);
  5011. static void deleteRegistryValue (const String& regValuePath);
  5012. static void deleteRegistryKey (const String& regKeyPath);
  5013. static void registerFileAssociation (const String& fileExtension,
  5014. const String& symbolicDescription,
  5015. const String& fullDescription,
  5016. const File& targetExecutable,
  5017. int iconResourceNumber);
  5018. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5019. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5020. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5021. #endif
  5022. static void fpuReset();
  5023. #if JUCE_LINUX || JUCE_WINDOWS
  5024. static void* loadDynamicLibrary (const String& pathOrFilename);
  5025. static void freeDynamicLibrary (void* libraryHandle);
  5026. static void* getProcedureEntryPoint (void* libraryHandle,
  5027. const String& procedureName);
  5028. #endif
  5029. #if JUCE_LINUX || DOXYGEN
  5030. #endif
  5031. };
  5032. #if JUCE_MAC || JUCE_IPHONE
  5033. class ScopedAutoReleasePool
  5034. {
  5035. public:
  5036. ScopedAutoReleasePool();
  5037. ~ScopedAutoReleasePool();
  5038. private:
  5039. void* pool;
  5040. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5041. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5042. };
  5043. #endif
  5044. #if JUCE_LINUX
  5045. class ScopedXLock
  5046. {
  5047. public:
  5048. ScopedXLock();
  5049. ~ScopedXLock();
  5050. };
  5051. #endif
  5052. #if JUCE_MAC
  5053. class JUCE_API AppleRemoteDevice
  5054. {
  5055. public:
  5056. AppleRemoteDevice();
  5057. virtual ~AppleRemoteDevice();
  5058. enum ButtonType
  5059. {
  5060. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5061. playButton, /**< The play button. */
  5062. plusButton, /**< The plus or volume-up button. */
  5063. minusButton, /**< The minus or volume-down button. */
  5064. rightButton, /**< The right button (if it's held for a short time). */
  5065. leftButton, /**< The left button (if it's held for a short time). */
  5066. rightButton_Long, /**< The right button (if it's held for a long time). */
  5067. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5068. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5069. playButtonSleepMode,
  5070. switched
  5071. };
  5072. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5073. bool start (const bool inExclusiveMode);
  5074. void stop();
  5075. bool isActive() const;
  5076. int getRemoteId() const { return remoteId; }
  5077. juce_UseDebuggingNewOperator
  5078. void handleCallbackInternal();
  5079. private:
  5080. void* device;
  5081. void* queue;
  5082. int remoteId;
  5083. bool open (const bool openInExclusiveMode);
  5084. AppleRemoteDevice (const AppleRemoteDevice&);
  5085. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5086. };
  5087. #endif
  5088. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5089. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5090. #endif
  5091. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5092. /*** Start of inlined file: juce_Random.h ***/
  5093. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5094. #define __JUCE_RANDOM_JUCEHEADER__
  5095. class JUCE_API Random
  5096. {
  5097. public:
  5098. Random (int64 seedValue) throw();
  5099. ~Random() throw();
  5100. int nextInt() throw();
  5101. int nextInt (int maxValue) throw();
  5102. int64 nextInt64() throw();
  5103. float nextFloat() throw();
  5104. double nextDouble() throw();
  5105. bool nextBool() throw();
  5106. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5107. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5108. static Random& getSystemRandom() throw();
  5109. void setSeed (int64 newSeed) throw();
  5110. void combineSeed (int64 seedValue) throw();
  5111. void setSeedRandomly();
  5112. juce_UseDebuggingNewOperator
  5113. private:
  5114. int64 seed;
  5115. };
  5116. #endif // __JUCE_RANDOM_JUCEHEADER__
  5117. /*** End of inlined file: juce_Random.h ***/
  5118. #endif
  5119. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5120. #endif
  5121. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5122. /*** Start of inlined file: juce_Singleton.h ***/
  5123. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5124. #define __JUCE_SINGLETON_JUCEHEADER__
  5125. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5126. \
  5127. static classname* _singletonInstance; \
  5128. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5129. \
  5130. static classname* getInstance() \
  5131. { \
  5132. if (_singletonInstance == 0) \
  5133. {\
  5134. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5135. \
  5136. if (_singletonInstance == 0) \
  5137. { \
  5138. static bool alreadyInside = false; \
  5139. static bool createdOnceAlready = false; \
  5140. \
  5141. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5142. jassert (! problem); \
  5143. if (! problem) \
  5144. { \
  5145. createdOnceAlready = true; \
  5146. alreadyInside = true; \
  5147. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5148. alreadyInside = false; \
  5149. \
  5150. _singletonInstance = newObject; \
  5151. } \
  5152. } \
  5153. } \
  5154. \
  5155. return _singletonInstance; \
  5156. } \
  5157. \
  5158. static inline classname* getInstanceWithoutCreating() throw() \
  5159. { \
  5160. return _singletonInstance; \
  5161. } \
  5162. \
  5163. static void deleteInstance() \
  5164. { \
  5165. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5166. if (_singletonInstance != 0) \
  5167. { \
  5168. classname* const old = _singletonInstance; \
  5169. _singletonInstance = 0; \
  5170. delete old; \
  5171. } \
  5172. } \
  5173. \
  5174. void clearSingletonInstance() throw() \
  5175. { \
  5176. if (_singletonInstance == this) \
  5177. _singletonInstance = 0; \
  5178. }
  5179. #define juce_ImplementSingleton(classname) \
  5180. \
  5181. classname* classname::_singletonInstance = 0; \
  5182. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5183. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5184. \
  5185. static classname* _singletonInstance; \
  5186. \
  5187. static classname* getInstance() \
  5188. { \
  5189. if (_singletonInstance == 0) \
  5190. { \
  5191. static bool alreadyInside = false; \
  5192. static bool createdOnceAlready = false; \
  5193. \
  5194. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5195. jassert (! problem); \
  5196. if (! problem) \
  5197. { \
  5198. createdOnceAlready = true; \
  5199. alreadyInside = true; \
  5200. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5201. alreadyInside = false; \
  5202. \
  5203. _singletonInstance = newObject; \
  5204. } \
  5205. } \
  5206. \
  5207. return _singletonInstance; \
  5208. } \
  5209. \
  5210. static inline classname* getInstanceWithoutCreating() throw() \
  5211. { \
  5212. return _singletonInstance; \
  5213. } \
  5214. \
  5215. static void deleteInstance() \
  5216. { \
  5217. if (_singletonInstance != 0) \
  5218. { \
  5219. classname* const old = _singletonInstance; \
  5220. _singletonInstance = 0; \
  5221. delete old; \
  5222. } \
  5223. } \
  5224. \
  5225. void clearSingletonInstance() throw() \
  5226. { \
  5227. if (_singletonInstance == this) \
  5228. _singletonInstance = 0; \
  5229. }
  5230. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5231. \
  5232. static classname* _singletonInstance; \
  5233. \
  5234. static classname* getInstance() \
  5235. { \
  5236. if (_singletonInstance == 0) \
  5237. _singletonInstance = new classname(); \
  5238. \
  5239. return _singletonInstance; \
  5240. } \
  5241. \
  5242. static inline classname* getInstanceWithoutCreating() throw() \
  5243. { \
  5244. return _singletonInstance; \
  5245. } \
  5246. \
  5247. static void deleteInstance() \
  5248. { \
  5249. if (_singletonInstance != 0) \
  5250. { \
  5251. classname* const old = _singletonInstance; \
  5252. _singletonInstance = 0; \
  5253. delete old; \
  5254. } \
  5255. } \
  5256. \
  5257. void clearSingletonInstance() throw() \
  5258. { \
  5259. if (_singletonInstance == this) \
  5260. _singletonInstance = 0; \
  5261. }
  5262. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5263. \
  5264. classname* classname::_singletonInstance = 0;
  5265. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5266. /*** End of inlined file: juce_Singleton.h ***/
  5267. #endif
  5268. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5269. #endif
  5270. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5271. /*** Start of inlined file: juce_SystemStats.h ***/
  5272. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5273. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5274. class JUCE_API SystemStats
  5275. {
  5276. public:
  5277. static const String getJUCEVersion() throw();
  5278. enum OperatingSystemType
  5279. {
  5280. UnknownOS = 0,
  5281. MacOSX = 0x1000,
  5282. Linux = 0x2000,
  5283. Win95 = 0x4001,
  5284. Win98 = 0x4002,
  5285. WinNT351 = 0x4103,
  5286. WinNT40 = 0x4104,
  5287. Win2000 = 0x4105,
  5288. WinXP = 0x4106,
  5289. WinVista = 0x4107,
  5290. Windows7 = 0x4108,
  5291. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5292. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5293. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5294. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5295. };
  5296. static OperatingSystemType getOperatingSystemType() throw();
  5297. static const String getOperatingSystemName() throw();
  5298. static bool isOperatingSystem64Bit() throw();
  5299. static const String getLogonName();
  5300. static const String getFullUserName();
  5301. // CPU and memory information..
  5302. static int getCpuSpeedInMegaherz() throw();
  5303. static const String getCpuVendor() throw();
  5304. static bool hasMMX() throw();
  5305. static bool hasSSE() throw();
  5306. static bool hasSSE2() throw();
  5307. static bool has3DNow() throw();
  5308. static int getNumCpus() throw();
  5309. static int64 getClockCycleCounter() throw();
  5310. static int getMemorySizeInMegabytes() throw();
  5311. static int getPageSize() throw();
  5312. static int getMACAddresses (int64* addresses, int maxNum,
  5313. #if JUCE_MAC
  5314. const bool littleEndian = true);
  5315. #else
  5316. const bool littleEndian = false);
  5317. #endif
  5318. static const StringArray getMACAddressStrings();
  5319. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5320. static void initialiseStats() throw();
  5321. };
  5322. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5323. /*** End of inlined file: juce_SystemStats.h ***/
  5324. #endif
  5325. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5326. #endif
  5327. #ifndef __JUCE_TIME_JUCEHEADER__
  5328. #endif
  5329. #ifndef __JUCE_UUID_JUCEHEADER__
  5330. /*** Start of inlined file: juce_Uuid.h ***/
  5331. #ifndef __JUCE_UUID_JUCEHEADER__
  5332. #define __JUCE_UUID_JUCEHEADER__
  5333. class JUCE_API Uuid
  5334. {
  5335. public:
  5336. Uuid();
  5337. ~Uuid() throw();
  5338. Uuid (const Uuid& other);
  5339. Uuid& operator= (const Uuid& other);
  5340. bool isNull() const throw();
  5341. bool operator== (const Uuid& other) const;
  5342. bool operator!= (const Uuid& other) const;
  5343. const String toString() const;
  5344. Uuid (const String& uuidString);
  5345. Uuid& operator= (const String& uuidString);
  5346. const uint8* getRawData() const throw() { return value.asBytes; }
  5347. Uuid (const uint8* const rawData);
  5348. Uuid& operator= (const uint8* const rawData);
  5349. juce_UseDebuggingNewOperator
  5350. private:
  5351. union
  5352. {
  5353. uint8 asBytes [16];
  5354. int asInt[4];
  5355. int64 asInt64[2];
  5356. } value;
  5357. };
  5358. #endif // __JUCE_UUID_JUCEHEADER__
  5359. /*** End of inlined file: juce_Uuid.h ***/
  5360. #endif
  5361. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5362. /*** Start of inlined file: juce_BlowFish.h ***/
  5363. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5364. #define __JUCE_BLOWFISH_JUCEHEADER__
  5365. class JUCE_API BlowFish
  5366. {
  5367. public:
  5368. BlowFish (const void* keyData, int keyBytes);
  5369. BlowFish (const BlowFish& other);
  5370. BlowFish& operator= (const BlowFish& other);
  5371. ~BlowFish();
  5372. void encrypt (uint32& data1, uint32& data2) const throw();
  5373. void decrypt (uint32& data1, uint32& data2) const throw();
  5374. juce_UseDebuggingNewOperator
  5375. private:
  5376. uint32 p[18];
  5377. HeapBlock <uint32> s[4];
  5378. uint32 F (uint32 x) const throw();
  5379. };
  5380. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5381. /*** End of inlined file: juce_BlowFish.h ***/
  5382. #endif
  5383. #ifndef __JUCE_MD5_JUCEHEADER__
  5384. /*** Start of inlined file: juce_MD5.h ***/
  5385. #ifndef __JUCE_MD5_JUCEHEADER__
  5386. #define __JUCE_MD5_JUCEHEADER__
  5387. class JUCE_API MD5
  5388. {
  5389. public:
  5390. MD5();
  5391. MD5 (const MD5& other);
  5392. MD5& operator= (const MD5& other);
  5393. MD5 (const MemoryBlock& data);
  5394. MD5 (const char* data, const size_t numBytes);
  5395. MD5 (const String& text);
  5396. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5397. MD5 (const File& file);
  5398. ~MD5();
  5399. const MemoryBlock getRawChecksumData() const;
  5400. const String toHexString() const;
  5401. bool operator== (const MD5& other) const;
  5402. bool operator!= (const MD5& other) const;
  5403. juce_UseDebuggingNewOperator
  5404. private:
  5405. uint8 result [16];
  5406. struct ProcessContext
  5407. {
  5408. uint8 buffer [64];
  5409. uint32 state [4];
  5410. uint32 count [2];
  5411. ProcessContext();
  5412. void processBlock (const uint8* const data, size_t dataSize);
  5413. void transform (const uint8* const buffer);
  5414. void finish (uint8* const result);
  5415. };
  5416. void processStream (InputStream& input, int64 numBytesToRead);
  5417. };
  5418. #endif // __JUCE_MD5_JUCEHEADER__
  5419. /*** End of inlined file: juce_MD5.h ***/
  5420. #endif
  5421. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5422. /*** Start of inlined file: juce_Primes.h ***/
  5423. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5424. #define __JUCE_PRIMES_JUCEHEADER__
  5425. class JUCE_API Primes
  5426. {
  5427. public:
  5428. static const BigInteger createProbablePrime (int bitLength,
  5429. int certainty,
  5430. const int* randomSeeds = 0,
  5431. int numRandomSeeds = 0);
  5432. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5433. };
  5434. #endif // __JUCE_PRIMES_JUCEHEADER__
  5435. /*** End of inlined file: juce_Primes.h ***/
  5436. #endif
  5437. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5438. /*** Start of inlined file: juce_RSAKey.h ***/
  5439. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5440. #define __JUCE_RSAKEY_JUCEHEADER__
  5441. class JUCE_API RSAKey
  5442. {
  5443. public:
  5444. RSAKey();
  5445. RSAKey (const String& stringRepresentation);
  5446. ~RSAKey();
  5447. const String toString() const;
  5448. bool applyToValue (BigInteger& value) const;
  5449. static void createKeyPair (RSAKey& publicKey,
  5450. RSAKey& privateKey,
  5451. int numBits,
  5452. const int* randomSeeds = 0,
  5453. int numRandomSeeds = 0);
  5454. juce_UseDebuggingNewOperator
  5455. protected:
  5456. BigInteger part1, part2;
  5457. };
  5458. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5459. /*** End of inlined file: juce_RSAKey.h ***/
  5460. #endif
  5461. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5462. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5463. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5464. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5465. class JUCE_API DirectoryIterator
  5466. {
  5467. public:
  5468. DirectoryIterator (const File& directory,
  5469. bool isRecursive,
  5470. const String& wildCard = JUCE_T("*"),
  5471. const int whatToLookFor = File::findFiles);
  5472. ~DirectoryIterator();
  5473. bool next();
  5474. const File getFile() const;
  5475. float getEstimatedProgress() const;
  5476. juce_UseDebuggingNewOperator
  5477. private:
  5478. Array <File> filesFound;
  5479. Array <File> dirsFound;
  5480. String wildCard;
  5481. int index;
  5482. const int whatToLookFor;
  5483. ScopedPointer <DirectoryIterator> subIterator;
  5484. DirectoryIterator (const DirectoryIterator&);
  5485. DirectoryIterator& operator= (const DirectoryIterator&);
  5486. };
  5487. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5488. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5489. #endif
  5490. #ifndef __JUCE_FILE_JUCEHEADER__
  5491. #endif
  5492. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5493. /*** Start of inlined file: juce_FileInputStream.h ***/
  5494. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5495. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5496. class JUCE_API FileInputStream : public InputStream
  5497. {
  5498. public:
  5499. FileInputStream (const File& fileToRead);
  5500. ~FileInputStream();
  5501. const File& getFile() const throw() { return file; }
  5502. int64 getTotalLength();
  5503. int read (void* destBuffer, int maxBytesToRead);
  5504. bool isExhausted();
  5505. int64 getPosition();
  5506. bool setPosition (int64 pos);
  5507. juce_UseDebuggingNewOperator
  5508. private:
  5509. File file;
  5510. void* fileHandle;
  5511. int64 currentPosition, totalSize;
  5512. bool needToSeek;
  5513. FileInputStream (const FileInputStream&);
  5514. FileInputStream& operator= (const FileInputStream&);
  5515. };
  5516. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5517. /*** End of inlined file: juce_FileInputStream.h ***/
  5518. #endif
  5519. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5520. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5521. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5522. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5523. class JUCE_API FileOutputStream : public OutputStream
  5524. {
  5525. public:
  5526. FileOutputStream (const File& fileToWriteTo,
  5527. const int bufferSizeToUse = 16384);
  5528. ~FileOutputStream();
  5529. const File& getFile() const { return file; }
  5530. bool failedToOpen() const { return fileHandle == 0; }
  5531. void flush();
  5532. int64 getPosition();
  5533. bool setPosition (int64 pos);
  5534. bool write (const void* data, int numBytes);
  5535. juce_UseDebuggingNewOperator
  5536. private:
  5537. File file;
  5538. void* fileHandle;
  5539. int64 currentPosition;
  5540. int bufferSize, bytesInBuffer;
  5541. HeapBlock <char> buffer;
  5542. FileOutputStream (const FileOutputStream&);
  5543. FileOutputStream& operator= (const FileOutputStream&);
  5544. };
  5545. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5546. /*** End of inlined file: juce_FileOutputStream.h ***/
  5547. #endif
  5548. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5549. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5550. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5551. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5552. class JUCE_API FileSearchPath
  5553. {
  5554. public:
  5555. FileSearchPath();
  5556. FileSearchPath (const String& path);
  5557. FileSearchPath (const FileSearchPath& other);
  5558. ~FileSearchPath();
  5559. FileSearchPath& operator= (const String& path);
  5560. int getNumPaths() const;
  5561. const File operator[] (const int index) const;
  5562. const String toString() const;
  5563. void add (const File& directoryToAdd,
  5564. const int insertIndex = -1);
  5565. void addIfNotAlreadyThere (const File& directoryToAdd);
  5566. void remove (const int indexToRemove);
  5567. void addPath (const FileSearchPath& other);
  5568. void removeRedundantPaths();
  5569. void removeNonExistentPaths();
  5570. int findChildFiles (Array<File>& results,
  5571. const int whatToLookFor,
  5572. const bool searchRecursively,
  5573. const String& wildCardPattern = JUCE_T("*")) const;
  5574. bool isFileInPath (const File& fileToCheck,
  5575. const bool checkRecursively) const;
  5576. juce_UseDebuggingNewOperator
  5577. private:
  5578. StringArray directories;
  5579. void init (const String& path);
  5580. };
  5581. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5582. /*** End of inlined file: juce_FileSearchPath.h ***/
  5583. #endif
  5584. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5585. /*** Start of inlined file: juce_NamedPipe.h ***/
  5586. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5587. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5588. class JUCE_API NamedPipe
  5589. {
  5590. public:
  5591. NamedPipe();
  5592. ~NamedPipe();
  5593. bool openExisting (const String& pipeName);
  5594. bool createNewPipe (const String& pipeName);
  5595. void close();
  5596. bool isOpen() const;
  5597. const String getName() const;
  5598. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5599. int write (const void* sourceBuffer, int numBytesToWrite,
  5600. int timeOutMilliseconds = 2000);
  5601. void cancelPendingReads();
  5602. juce_UseDebuggingNewOperator
  5603. private:
  5604. void* internal;
  5605. String currentPipeName;
  5606. CriticalSection lock;
  5607. NamedPipe (const NamedPipe&);
  5608. NamedPipe& operator= (const NamedPipe&);
  5609. bool openInternal (const String& pipeName, const bool createPipe);
  5610. };
  5611. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5612. /*** End of inlined file: juce_NamedPipe.h ***/
  5613. #endif
  5614. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5615. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5616. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5617. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5618. class JUCE_API TemporaryFile
  5619. {
  5620. public:
  5621. enum OptionFlags
  5622. {
  5623. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5624. i.e. its name should start with a dot. */
  5625. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5626. the file is unique, they should go in brackets rather
  5627. than just being appended (see File::getNonexistentSibling() )*/
  5628. };
  5629. TemporaryFile (const String& suffix = String::empty,
  5630. const int optionFlags = 0);
  5631. TemporaryFile (const File& targetFile,
  5632. const int optionFlags = 0);
  5633. ~TemporaryFile();
  5634. const File getFile() const { return temporaryFile; }
  5635. const File getTargetFile() const { return targetFile; }
  5636. bool overwriteTargetFileWithTemporary() const;
  5637. juce_UseDebuggingNewOperator
  5638. private:
  5639. File temporaryFile, targetFile;
  5640. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5641. TemporaryFile (const TemporaryFile&);
  5642. TemporaryFile& operator= (const TemporaryFile&);
  5643. };
  5644. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5645. /*** End of inlined file: juce_TemporaryFile.h ***/
  5646. #endif
  5647. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5648. /*** Start of inlined file: juce_ZipFile.h ***/
  5649. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5650. #define __JUCE_ZIPFILE_JUCEHEADER__
  5651. /*** Start of inlined file: juce_InputSource.h ***/
  5652. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5653. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5654. class JUCE_API InputSource
  5655. {
  5656. public:
  5657. InputSource() throw() {}
  5658. virtual ~InputSource() {}
  5659. virtual InputStream* createInputStream() = 0;
  5660. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5661. virtual int64 hashCode() const = 0;
  5662. juce_UseDebuggingNewOperator
  5663. };
  5664. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5665. /*** End of inlined file: juce_InputSource.h ***/
  5666. class JUCE_API ZipFile
  5667. {
  5668. public:
  5669. ZipFile (InputStream* const inputStream,
  5670. const bool deleteStreamWhenDestroyed) throw();
  5671. ZipFile (const File& file);
  5672. ZipFile (InputSource* const inputSource);
  5673. ~ZipFile() throw();
  5674. struct ZipEntry
  5675. {
  5676. String filename;
  5677. unsigned int uncompressedSize;
  5678. Time fileTime;
  5679. };
  5680. int getNumEntries() const throw();
  5681. const ZipEntry* getEntry (const int index) const throw();
  5682. int getIndexOfFileName (const String& fileName) const throw();
  5683. const ZipEntry* getEntry (const String& fileName) const throw();
  5684. void sortEntriesByFilename();
  5685. InputStream* createStreamForEntry (const int index);
  5686. void uncompressTo (const File& targetDirectory,
  5687. const bool shouldOverwriteFiles = true);
  5688. juce_UseDebuggingNewOperator
  5689. private:
  5690. class ZipInputStream;
  5691. class ZipFilenameComparator;
  5692. class ZipEntryInfo;
  5693. friend class ZipInputStream;
  5694. friend class ZipFilenameComparator;
  5695. friend class ZipEntryInfo;
  5696. OwnedArray <ZipEntryInfo> entries;
  5697. CriticalSection lock;
  5698. InputStream* inputStream;
  5699. ScopedPointer <InputStream> streamToDelete;
  5700. ScopedPointer <InputSource> inputSource;
  5701. #ifdef JUCE_DEBUG
  5702. int numOpenStreams;
  5703. #endif
  5704. void init();
  5705. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5706. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5707. ZipFile (const ZipFile&);
  5708. ZipFile& operator= (const ZipFile&);
  5709. };
  5710. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5711. /*** End of inlined file: juce_ZipFile.h ***/
  5712. #endif
  5713. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5714. /*** Start of inlined file: juce_Socket.h ***/
  5715. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5716. #define __JUCE_SOCKET_JUCEHEADER__
  5717. class JUCE_API StreamingSocket
  5718. {
  5719. public:
  5720. StreamingSocket();
  5721. ~StreamingSocket();
  5722. bool bindToPort (const int localPortNumber);
  5723. bool connect (const String& remoteHostname,
  5724. const int remotePortNumber,
  5725. const int timeOutMillisecs = 3000);
  5726. bool isConnected() const throw() { return connected; }
  5727. void close();
  5728. const String& getHostName() const throw() { return hostName; }
  5729. int getPort() const throw() { return portNumber; }
  5730. bool isLocal() const throw();
  5731. int waitUntilReady (const bool readyForReading,
  5732. const int timeoutMsecs) const;
  5733. int read (void* destBuffer, const int maxBytesToRead,
  5734. const bool blockUntilSpecifiedAmountHasArrived);
  5735. int write (const void* sourceBuffer, const int numBytesToWrite);
  5736. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5737. StreamingSocket* waitForNextConnection() const;
  5738. juce_UseDebuggingNewOperator
  5739. private:
  5740. String hostName;
  5741. int volatile portNumber, handle;
  5742. bool connected, isListener;
  5743. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5744. StreamingSocket (const StreamingSocket&);
  5745. StreamingSocket& operator= (const StreamingSocket&);
  5746. };
  5747. class JUCE_API DatagramSocket
  5748. {
  5749. public:
  5750. DatagramSocket (const int localPortNumber,
  5751. const bool enableBroadcasting = false);
  5752. ~DatagramSocket();
  5753. bool bindToPort (const int localPortNumber);
  5754. bool connect (const String& remoteHostname,
  5755. const int remotePortNumber,
  5756. const int timeOutMillisecs = 3000);
  5757. bool isConnected() const throw() { return connected; }
  5758. void close();
  5759. const String& getHostName() const throw() { return hostName; }
  5760. int getPort() const throw() { return portNumber; }
  5761. bool isLocal() const throw();
  5762. int waitUntilReady (const bool readyForReading,
  5763. const int timeoutMsecs) const;
  5764. int read (void* destBuffer, const int maxBytesToRead,
  5765. const bool blockUntilSpecifiedAmountHasArrived);
  5766. int write (const void* sourceBuffer, const int numBytesToWrite);
  5767. DatagramSocket* waitForNextConnection() const;
  5768. juce_UseDebuggingNewOperator
  5769. private:
  5770. String hostName;
  5771. int volatile portNumber, handle;
  5772. bool connected, allowBroadcast;
  5773. void* serverAddress;
  5774. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5775. DatagramSocket (const DatagramSocket&);
  5776. DatagramSocket& operator= (const DatagramSocket&);
  5777. };
  5778. #endif // __JUCE_SOCKET_JUCEHEADER__
  5779. /*** End of inlined file: juce_Socket.h ***/
  5780. #endif
  5781. #ifndef __JUCE_URL_JUCEHEADER__
  5782. /*** Start of inlined file: juce_URL.h ***/
  5783. #ifndef __JUCE_URL_JUCEHEADER__
  5784. #define __JUCE_URL_JUCEHEADER__
  5785. class JUCE_API URL
  5786. {
  5787. public:
  5788. URL();
  5789. URL (const String& url);
  5790. URL (const URL& other);
  5791. ~URL();
  5792. URL& operator= (const URL& other);
  5793. const String toString (const bool includeGetParameters) const;
  5794. bool isWellFormed() const;
  5795. const String getDomain() const;
  5796. const String getSubPath() const;
  5797. const String getScheme() const;
  5798. const URL withNewSubPath (const String& newPath) const;
  5799. const URL withParameter (const String& parameterName,
  5800. const String& parameterValue) const;
  5801. const URL withFileToUpload (const String& parameterName,
  5802. const File& fileToUpload,
  5803. const String& mimeType) const;
  5804. const StringPairArray& getParameters() const;
  5805. const StringPairArray& getFilesToUpload() const;
  5806. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5807. const URL withPOSTData (const String& postData) const;
  5808. const String getPostData() const { return postData; }
  5809. bool launchInDefaultBrowser() const;
  5810. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5811. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5812. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5813. InputStream* createInputStream (const bool usePostCommand,
  5814. OpenStreamProgressCallback* const progressCallback = 0,
  5815. void* const progressCallbackContext = 0,
  5816. const String& extraHeaders = String::empty,
  5817. const int connectionTimeOutMs = 0) const;
  5818. bool readEntireBinaryStream (MemoryBlock& destData,
  5819. const bool usePostCommand = false) const;
  5820. const String readEntireTextStream (const bool usePostCommand = false) const;
  5821. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5822. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5823. const bool isParameter);
  5824. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5825. juce_UseDebuggingNewOperator
  5826. private:
  5827. String url, postData;
  5828. StringPairArray parameters, filesToUpload, mimeTypes;
  5829. };
  5830. #endif // __JUCE_URL_JUCEHEADER__
  5831. /*** End of inlined file: juce_URL.h ***/
  5832. #endif
  5833. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5834. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5835. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5836. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5837. class JUCE_API BufferedInputStream : public InputStream
  5838. {
  5839. public:
  5840. BufferedInputStream (InputStream* const sourceStream,
  5841. const int bufferSize,
  5842. const bool deleteSourceWhenDestroyed);
  5843. ~BufferedInputStream();
  5844. int64 getTotalLength();
  5845. int64 getPosition();
  5846. bool setPosition (int64 newPosition);
  5847. int read (void* destBuffer, int maxBytesToRead);
  5848. const String readString();
  5849. bool isExhausted();
  5850. juce_UseDebuggingNewOperator
  5851. private:
  5852. InputStream* const source;
  5853. ScopedPointer <InputStream> sourceToDelete;
  5854. int bufferSize;
  5855. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5856. HeapBlock <char> buffer;
  5857. void ensureBuffered();
  5858. BufferedInputStream (const BufferedInputStream&);
  5859. BufferedInputStream& operator= (const BufferedInputStream&);
  5860. };
  5861. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5862. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5863. #endif
  5864. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5865. /*** Start of inlined file: juce_FileInputSource.h ***/
  5866. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5867. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5868. class JUCE_API FileInputSource : public InputSource
  5869. {
  5870. public:
  5871. FileInputSource (const File& file);
  5872. ~FileInputSource();
  5873. InputStream* createInputStream();
  5874. InputStream* createInputStreamFor (const String& relatedItemPath);
  5875. int64 hashCode() const;
  5876. juce_UseDebuggingNewOperator
  5877. private:
  5878. const File file;
  5879. FileInputSource (const FileInputSource&);
  5880. FileInputSource& operator= (const FileInputSource&);
  5881. };
  5882. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5883. /*** End of inlined file: juce_FileInputSource.h ***/
  5884. #endif
  5885. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5886. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5887. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5888. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5889. class GZIPCompressorHelper;
  5890. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5891. {
  5892. public:
  5893. GZIPCompressorOutputStream (OutputStream* destStream,
  5894. int compressionLevel = 0,
  5895. bool deleteDestStreamWhenDestroyed = false,
  5896. bool noWrap = false);
  5897. ~GZIPCompressorOutputStream();
  5898. void flush();
  5899. int64 getPosition();
  5900. bool setPosition (int64 newPosition);
  5901. bool write (const void* destBuffer, int howMany);
  5902. juce_UseDebuggingNewOperator
  5903. private:
  5904. OutputStream* const destStream;
  5905. ScopedPointer <OutputStream> streamToDelete;
  5906. HeapBlock <uint8> buffer;
  5907. ScopedPointer <GZIPCompressorHelper> helper;
  5908. bool doNextBlock();
  5909. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5910. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5911. };
  5912. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5913. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5914. #endif
  5915. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5916. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5917. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5918. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5919. class GZIPDecompressHelper;
  5920. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5921. {
  5922. public:
  5923. GZIPDecompressorInputStream (InputStream* sourceStream,
  5924. bool deleteSourceWhenDestroyed,
  5925. bool noWrap = false,
  5926. int64 uncompressedStreamLength = -1);
  5927. ~GZIPDecompressorInputStream();
  5928. int64 getPosition();
  5929. bool setPosition (int64 pos);
  5930. int64 getTotalLength();
  5931. bool isExhausted();
  5932. int read (void* destBuffer, int maxBytesToRead);
  5933. juce_UseDebuggingNewOperator
  5934. private:
  5935. InputStream* const sourceStream;
  5936. ScopedPointer <InputStream> streamToDelete;
  5937. const int64 uncompressedStreamLength;
  5938. const bool noWrap;
  5939. bool isEof;
  5940. int activeBufferSize;
  5941. int64 originalSourcePos, currentPos;
  5942. HeapBlock <uint8> buffer;
  5943. ScopedPointer <GZIPDecompressHelper> helper;
  5944. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5945. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5946. };
  5947. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5948. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5949. #endif
  5950. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5951. #endif
  5952. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5953. #endif
  5954. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5955. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5956. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5957. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5958. class JUCE_API MemoryInputStream : public InputStream
  5959. {
  5960. public:
  5961. MemoryInputStream (const void* sourceData,
  5962. size_t sourceDataSize,
  5963. bool keepInternalCopyOfData);
  5964. MemoryInputStream (const MemoryBlock& data,
  5965. bool keepInternalCopyOfData);
  5966. ~MemoryInputStream();
  5967. int64 getPosition();
  5968. bool setPosition (int64 pos);
  5969. int64 getTotalLength();
  5970. bool isExhausted();
  5971. int read (void* destBuffer, int maxBytesToRead);
  5972. juce_UseDebuggingNewOperator
  5973. private:
  5974. const char* data;
  5975. size_t dataSize, position;
  5976. MemoryBlock internalCopy;
  5977. MemoryInputStream (const MemoryInputStream&);
  5978. MemoryInputStream& operator= (const MemoryInputStream&);
  5979. };
  5980. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5981. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5982. #endif
  5983. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5984. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5985. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5986. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5987. class JUCE_API MemoryOutputStream : public OutputStream
  5988. {
  5989. public:
  5990. MemoryOutputStream (size_t initialSize = 256,
  5991. size_t granularity = 256,
  5992. MemoryBlock* memoryBlockToWriteTo = 0);
  5993. ~MemoryOutputStream();
  5994. const char* getData() const throw();
  5995. size_t getDataSize() const throw();
  5996. void reset() throw();
  5997. void flush();
  5998. bool write (const void* buffer, int howMany);
  5999. int64 getPosition();
  6000. bool setPosition (int64 newPosition);
  6001. juce_UseDebuggingNewOperator
  6002. private:
  6003. MemoryBlock* data;
  6004. ScopedPointer <MemoryBlock> dataToDelete;
  6005. size_t position, size, blockSize;
  6006. MemoryOutputStream (const MemoryOutputStream&);
  6007. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6008. };
  6009. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6010. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6011. #endif
  6012. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6013. #endif
  6014. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6015. /*** Start of inlined file: juce_SubregionStream.h ***/
  6016. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6017. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6018. class JUCE_API SubregionStream : public InputStream
  6019. {
  6020. public:
  6021. SubregionStream (InputStream* const sourceStream,
  6022. const int64 startPositionInSourceStream,
  6023. const int64 lengthOfSourceStream,
  6024. const bool deleteSourceWhenDestroyed) throw();
  6025. ~SubregionStream() throw();
  6026. int64 getTotalLength();
  6027. int64 getPosition();
  6028. bool setPosition (int64 newPosition);
  6029. int read (void* destBuffer, int maxBytesToRead);
  6030. bool isExhausted();
  6031. juce_UseDebuggingNewOperator
  6032. private:
  6033. InputStream* const source;
  6034. ScopedPointer <InputStream> sourceToDelete;
  6035. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6036. SubregionStream (const SubregionStream&);
  6037. SubregionStream& operator= (const SubregionStream&);
  6038. };
  6039. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6040. /*** End of inlined file: juce_SubregionStream.h ***/
  6041. #endif
  6042. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6043. #endif
  6044. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6045. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6046. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6047. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6048. #define TRANS(stringLiteral) \
  6049. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6050. class JUCE_API LocalisedStrings
  6051. {
  6052. public:
  6053. LocalisedStrings (const String& fileContents);
  6054. LocalisedStrings (const File& fileToLoad);
  6055. ~LocalisedStrings();
  6056. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6057. static LocalisedStrings* getCurrentMappings();
  6058. static const String translateWithCurrentMappings (const String& text);
  6059. static const String translateWithCurrentMappings (const char* text);
  6060. const String translate (const String& text) const;
  6061. const String getLanguageName() const { return languageName; }
  6062. const StringArray getCountryCodes() const { return countryCodes; }
  6063. void setIgnoresCase (const bool shouldIgnoreCase);
  6064. juce_UseDebuggingNewOperator
  6065. private:
  6066. String languageName;
  6067. StringArray countryCodes;
  6068. StringPairArray translations;
  6069. void loadFromText (const String& fileContents);
  6070. };
  6071. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6072. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6073. #endif
  6074. #ifndef __JUCE_STRING_JUCEHEADER__
  6075. #endif
  6076. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6077. #endif
  6078. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6079. #endif
  6080. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6081. /*** Start of inlined file: juce_XmlDocument.h ***/
  6082. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6083. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6084. class JUCE_API XmlDocument
  6085. {
  6086. public:
  6087. XmlDocument (const String& documentText) throw();
  6088. XmlDocument (const File& file);
  6089. ~XmlDocument() throw();
  6090. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6091. const String& getLastParseError() const throw();
  6092. void setInputSource (InputSource* const newSource) throw();
  6093. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6094. juce_UseDebuggingNewOperator
  6095. private:
  6096. String originalText;
  6097. const juce_wchar* input;
  6098. bool outOfData, errorOccurred;
  6099. bool identifierLookupTable [128];
  6100. String lastError, dtdText;
  6101. StringArray tokenisedDTD;
  6102. bool needToLoadDTD, ignoreEmptyTextElements;
  6103. ScopedPointer <InputSource> inputSource;
  6104. void setLastError (const String& desc, const bool carryOn) throw();
  6105. void skipHeader() throw();
  6106. void skipNextWhiteSpace() throw();
  6107. juce_wchar readNextChar() throw();
  6108. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  6109. void readChildElements (XmlElement* parent) throw();
  6110. int findNextTokenLength() throw();
  6111. void readQuotedString (String& result) throw();
  6112. void readEntity (String& result) throw();
  6113. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6114. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6115. const String getFileContents (const String& filename) const;
  6116. const String expandEntity (const String& entity);
  6117. const String expandExternalEntity (const String& entity);
  6118. const String getParameterEntity (const String& entity);
  6119. XmlDocument (const XmlDocument&);
  6120. XmlDocument& operator= (const XmlDocument&);
  6121. };
  6122. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6123. /*** End of inlined file: juce_XmlDocument.h ***/
  6124. #endif
  6125. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6126. #endif
  6127. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6128. #endif
  6129. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6130. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6131. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6132. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6133. class JUCE_API InterProcessLock
  6134. {
  6135. public:
  6136. InterProcessLock (const String& name);
  6137. ~InterProcessLock();
  6138. bool enter (int timeOutMillisecs = -1);
  6139. void exit();
  6140. juce_UseDebuggingNewOperator
  6141. private:
  6142. #if JUCE_WINDOWS
  6143. void* internal;
  6144. // #elif JUCE_64BIT
  6145. // long long internal;
  6146. #else
  6147. int internal;
  6148. #endif
  6149. String name;
  6150. int reentrancyLevel;
  6151. InterProcessLock (const InterProcessLock&);
  6152. InterProcessLock& operator= (const InterProcessLock&);
  6153. };
  6154. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6155. /*** End of inlined file: juce_InterProcessLock.h ***/
  6156. #endif
  6157. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6158. /*** Start of inlined file: juce_Process.h ***/
  6159. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6160. #define __JUCE_PROCESS_JUCEHEADER__
  6161. class JUCE_API Process
  6162. {
  6163. public:
  6164. enum ProcessPriority
  6165. {
  6166. LowPriority = 0,
  6167. NormalPriority = 1,
  6168. HighPriority = 2,
  6169. RealtimePriority = 3
  6170. };
  6171. static void setPriority (const ProcessPriority priority);
  6172. static void terminate();
  6173. static bool isForegroundProcess();
  6174. static void raisePrivilege();
  6175. static void lowerPrivilege();
  6176. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6177. };
  6178. #endif // __JUCE_PROCESS_JUCEHEADER__
  6179. /*** End of inlined file: juce_Process.h ***/
  6180. #endif
  6181. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6182. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6183. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6184. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6185. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6186. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6187. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6188. class JUCE_API WaitableEvent
  6189. {
  6190. public:
  6191. WaitableEvent() throw();
  6192. ~WaitableEvent() throw();
  6193. bool wait (const int timeOutMilliseconds = -1) const throw();
  6194. void signal() const throw();
  6195. void reset() const throw();
  6196. juce_UseDebuggingNewOperator
  6197. private:
  6198. void* internal;
  6199. WaitableEvent (const WaitableEvent&);
  6200. WaitableEvent& operator= (const WaitableEvent&);
  6201. };
  6202. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6203. /*** End of inlined file: juce_WaitableEvent.h ***/
  6204. /*** Start of inlined file: juce_Thread.h ***/
  6205. #ifndef __JUCE_THREAD_JUCEHEADER__
  6206. #define __JUCE_THREAD_JUCEHEADER__
  6207. class JUCE_API Thread
  6208. {
  6209. public:
  6210. Thread (const String& threadName);
  6211. virtual ~Thread();
  6212. virtual void run() = 0;
  6213. // Thread control functions..
  6214. void startThread();
  6215. void startThread (const int priority);
  6216. void stopThread (const int timeOutMilliseconds);
  6217. bool isThreadRunning() const;
  6218. void signalThreadShouldExit();
  6219. inline bool threadShouldExit() const { return threadShouldExit_; }
  6220. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6221. bool setPriority (const int priority);
  6222. static bool setCurrentThreadPriority (const int priority);
  6223. void setAffinityMask (const uint32 affinityMask);
  6224. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6225. // this can be called from any thread that needs to pause..
  6226. static void JUCE_CALLTYPE sleep (int milliseconds);
  6227. static void JUCE_CALLTYPE yield();
  6228. bool wait (const int timeOutMilliseconds) const;
  6229. void notify() const;
  6230. typedef void* ThreadID;
  6231. static ThreadID getCurrentThreadId();
  6232. static Thread* getCurrentThread();
  6233. ThreadID getThreadId() const { return threadId_; }
  6234. const String getThreadName() const { return threadName_; }
  6235. static int getNumRunningThreads();
  6236. static void stopAllThreads (const int timeoutInMillisecs);
  6237. juce_UseDebuggingNewOperator
  6238. private:
  6239. const String threadName_;
  6240. void* volatile threadHandle_;
  6241. CriticalSection startStopLock;
  6242. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6243. int threadPriority_;
  6244. ThreadID threadId_;
  6245. uint32 affinityMask_;
  6246. bool volatile threadShouldExit_;
  6247. friend void JUCE_API juce_threadEntryPoint (void*);
  6248. static void threadEntryPoint (Thread* thread);
  6249. static Array<Thread*> runningThreads;
  6250. static CriticalSection runningThreadsLock;
  6251. Thread (const Thread&);
  6252. Thread& operator= (const Thread&);
  6253. };
  6254. #endif // __JUCE_THREAD_JUCEHEADER__
  6255. /*** End of inlined file: juce_Thread.h ***/
  6256. class JUCE_API ReadWriteLock
  6257. {
  6258. public:
  6259. ReadWriteLock() throw();
  6260. ~ReadWriteLock() throw();
  6261. void enterRead() const throw();
  6262. void exitRead() const throw();
  6263. void enterWrite() const throw();
  6264. bool tryEnterWrite() const throw();
  6265. void exitWrite() const throw();
  6266. juce_UseDebuggingNewOperator
  6267. private:
  6268. CriticalSection accessLock;
  6269. WaitableEvent waitEvent;
  6270. mutable int numWaitingWriters, numWriters;
  6271. mutable Thread::ThreadID writerThreadId;
  6272. mutable Array <Thread::ThreadID> readerThreads;
  6273. ReadWriteLock (const ReadWriteLock&);
  6274. ReadWriteLock& operator= (const ReadWriteLock&);
  6275. };
  6276. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6277. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6278. #endif
  6279. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6280. #endif
  6281. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6282. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6283. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6284. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6285. class JUCE_API ScopedReadLock
  6286. {
  6287. public:
  6288. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6289. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6290. private:
  6291. const ReadWriteLock& lock_;
  6292. ScopedReadLock (const ScopedReadLock&);
  6293. ScopedReadLock& operator= (const ScopedReadLock&);
  6294. };
  6295. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6296. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6297. #endif
  6298. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6299. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6300. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6301. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6302. class JUCE_API ScopedTryLock
  6303. {
  6304. public:
  6305. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6306. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6307. bool isLocked() const throw() { return lockWasSuccessful; }
  6308. private:
  6309. const CriticalSection& lock_;
  6310. const bool lockWasSuccessful;
  6311. ScopedTryLock (const ScopedTryLock&);
  6312. ScopedTryLock& operator= (const ScopedTryLock&);
  6313. };
  6314. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6315. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6316. #endif
  6317. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6318. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6319. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6320. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6321. class JUCE_API ScopedWriteLock
  6322. {
  6323. public:
  6324. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6325. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6326. private:
  6327. const ReadWriteLock& lock_;
  6328. ScopedWriteLock (const ScopedWriteLock&);
  6329. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6330. };
  6331. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6332. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6333. #endif
  6334. #ifndef __JUCE_THREAD_JUCEHEADER__
  6335. #endif
  6336. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6337. /*** Start of inlined file: juce_ThreadPool.h ***/
  6338. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6339. #define __JUCE_THREADPOOL_JUCEHEADER__
  6340. class ThreadPool;
  6341. class ThreadPoolThread;
  6342. class JUCE_API ThreadPoolJob
  6343. {
  6344. public:
  6345. ThreadPoolJob (const String& name);
  6346. virtual ~ThreadPoolJob();
  6347. const String getJobName() const;
  6348. void setJobName (const String& newName);
  6349. enum JobStatus
  6350. {
  6351. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6352. removed from the pool. */
  6353. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6354. should be automatically deleted by the pool. */
  6355. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6356. again when a thread is free. */
  6357. };
  6358. virtual JobStatus runJob() = 0;
  6359. bool isRunning() const { return isActive; }
  6360. bool shouldExit() const { return shouldStop; }
  6361. void signalJobShouldExit();
  6362. juce_UseDebuggingNewOperator
  6363. private:
  6364. friend class ThreadPool;
  6365. friend class ThreadPoolThread;
  6366. String jobName;
  6367. ThreadPool* pool;
  6368. bool shouldStop, isActive, shouldBeDeleted;
  6369. ThreadPoolJob (const ThreadPoolJob&);
  6370. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6371. };
  6372. class JUCE_API ThreadPool
  6373. {
  6374. public:
  6375. ThreadPool (const int numberOfThreads,
  6376. const bool startThreadsOnlyWhenNeeded = true,
  6377. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6378. ~ThreadPool();
  6379. class JUCE_API JobSelector
  6380. {
  6381. public:
  6382. virtual ~JobSelector() {}
  6383. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6384. };
  6385. void addJob (ThreadPoolJob* const job);
  6386. bool removeJob (ThreadPoolJob* const job,
  6387. const bool interruptIfRunning,
  6388. const int timeOutMilliseconds);
  6389. bool removeAllJobs (const bool interruptRunningJobs,
  6390. const int timeOutMilliseconds,
  6391. const bool deleteInactiveJobs = false,
  6392. JobSelector* selectedJobsToRemove = 0);
  6393. int getNumJobs() const;
  6394. ThreadPoolJob* getJob (const int index) const;
  6395. bool contains (const ThreadPoolJob* const job) const;
  6396. bool isJobRunning (const ThreadPoolJob* const job) const;
  6397. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6398. const int timeOutMilliseconds) const;
  6399. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6400. bool setThreadPriorities (const int newPriority);
  6401. juce_UseDebuggingNewOperator
  6402. private:
  6403. const int threadStopTimeout;
  6404. int priority;
  6405. class ThreadPoolThread;
  6406. OwnedArray <ThreadPoolThread> threads;
  6407. Array <ThreadPoolJob*> jobs;
  6408. CriticalSection lock;
  6409. uint32 lastJobEndTime;
  6410. WaitableEvent jobFinishedSignal;
  6411. friend class ThreadPoolThread;
  6412. bool runNextJob();
  6413. ThreadPool (const ThreadPool&);
  6414. ThreadPool& operator= (const ThreadPool&);
  6415. };
  6416. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6417. /*** End of inlined file: juce_ThreadPool.h ***/
  6418. #endif
  6419. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6420. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6421. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6422. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6423. class JUCE_API TimeSliceClient
  6424. {
  6425. public:
  6426. virtual ~TimeSliceClient() {}
  6427. virtual bool useTimeSlice() = 0;
  6428. };
  6429. class JUCE_API TimeSliceThread : public Thread
  6430. {
  6431. public:
  6432. TimeSliceThread (const String& threadName);
  6433. ~TimeSliceThread();
  6434. void addTimeSliceClient (TimeSliceClient* const client);
  6435. void removeTimeSliceClient (TimeSliceClient* const client);
  6436. int getNumClients() const;
  6437. TimeSliceClient* getClient (const int index) const;
  6438. void run();
  6439. juce_UseDebuggingNewOperator
  6440. private:
  6441. CriticalSection callbackLock, listLock;
  6442. Array <TimeSliceClient*> clients;
  6443. int index;
  6444. TimeSliceClient* clientBeingCalled;
  6445. bool clientsChanged;
  6446. TimeSliceThread (const TimeSliceThread&);
  6447. TimeSliceThread& operator= (const TimeSliceThread&);
  6448. };
  6449. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6450. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6451. #endif
  6452. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6453. #endif
  6454. #endif
  6455. /*** End of inlined file: juce_core_includes.h ***/
  6456. // if you're compiling a command-line app, you might want to just include the core headers,
  6457. // so you can set this macro before including juce.h
  6458. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6459. /*** Start of inlined file: juce_app_includes.h ***/
  6460. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6461. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6462. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6463. /*** Start of inlined file: juce_Application.h ***/
  6464. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6465. #define __JUCE_APPLICATION_JUCEHEADER__
  6466. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6467. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6468. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6469. /*** Start of inlined file: juce_Component.h ***/
  6470. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6471. #define __JUCE_COMPONENT_JUCEHEADER__
  6472. /*** Start of inlined file: juce_MouseCursor.h ***/
  6473. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6474. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6475. class Image;
  6476. class SharedMouseCursorInternal;
  6477. class ComponentPeer;
  6478. class Component;
  6479. class JUCE_API MouseCursor
  6480. {
  6481. public:
  6482. enum StandardCursorType
  6483. {
  6484. NoCursor = 0, /**< An invisible cursor. */
  6485. NormalCursor, /**< The stardard arrow cursor. */
  6486. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6487. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6488. CrosshairCursor, /**< A pair of crosshairs. */
  6489. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6490. that you're dragging a copy of something. */
  6491. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6492. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6493. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6494. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6495. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6496. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6497. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6498. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6499. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6500. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6501. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6502. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6503. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6504. };
  6505. MouseCursor() throw();
  6506. MouseCursor (const StandardCursorType type) throw();
  6507. MouseCursor (const Image& image,
  6508. const int hotSpotX,
  6509. const int hotSpotY) throw();
  6510. MouseCursor (const MouseCursor& other) throw();
  6511. MouseCursor& operator= (const MouseCursor& other) throw();
  6512. ~MouseCursor() throw();
  6513. bool operator== (const MouseCursor& other) const throw();
  6514. bool operator!= (const MouseCursor& other) const throw();
  6515. static void showWaitCursor() throw();
  6516. static void hideWaitCursor() throw();
  6517. juce_UseDebuggingNewOperator
  6518. private:
  6519. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6520. friend class MouseInputSourceInternal;
  6521. void showInWindow (ComponentPeer* window) const throw();
  6522. void showInAllWindows() const throw();
  6523. void* getHandle() const throw();
  6524. };
  6525. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6526. /*** End of inlined file: juce_MouseCursor.h ***/
  6527. /*** Start of inlined file: juce_MouseListener.h ***/
  6528. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6529. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6530. class MouseEvent;
  6531. class JUCE_API MouseListener
  6532. {
  6533. public:
  6534. virtual ~MouseListener() {}
  6535. virtual void mouseMove (const MouseEvent& e);
  6536. virtual void mouseEnter (const MouseEvent& e);
  6537. virtual void mouseExit (const MouseEvent& e);
  6538. virtual void mouseDown (const MouseEvent& e);
  6539. virtual void mouseDrag (const MouseEvent& e);
  6540. virtual void mouseUp (const MouseEvent& e);
  6541. virtual void mouseDoubleClick (const MouseEvent& e);
  6542. virtual void mouseWheelMove (const MouseEvent& e,
  6543. float wheelIncrementX,
  6544. float wheelIncrementY);
  6545. };
  6546. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6547. /*** End of inlined file: juce_MouseListener.h ***/
  6548. /*** Start of inlined file: juce_MouseEvent.h ***/
  6549. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6550. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6551. class Component;
  6552. class MouseInputSource;
  6553. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6554. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6555. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6556. class JUCE_API ModifierKeys
  6557. {
  6558. public:
  6559. ModifierKeys (const int flags = 0) throw();
  6560. ModifierKeys (const ModifierKeys& other) throw();
  6561. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6562. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6563. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6564. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6565. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6566. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6567. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6568. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6569. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6570. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6571. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6572. enum Flags
  6573. {
  6574. shiftModifier = 1,
  6575. ctrlModifier = 2,
  6576. altModifier = 4,
  6577. leftButtonModifier = 16,
  6578. rightButtonModifier = 32,
  6579. middleButtonModifier = 64,
  6580. #if JUCE_MAC
  6581. commandModifier = 8,
  6582. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6583. #else
  6584. commandModifier = ctrlModifier,
  6585. popupMenuClickModifier = rightButtonModifier,
  6586. #endif
  6587. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6588. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6589. };
  6590. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6591. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6592. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6593. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6594. inline int getRawFlags() const throw() { return flags; }
  6595. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6596. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6597. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6598. int getNumMouseButtonsDown() const throw();
  6599. static const ModifierKeys getCurrentModifiers() throw();
  6600. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6601. private:
  6602. int flags;
  6603. static ModifierKeys currentModifiers;
  6604. friend class ComponentPeer;
  6605. friend class MouseInputSource;
  6606. friend class MouseInputSourceInternal;
  6607. static void updateCurrentModifiers() throw();
  6608. };
  6609. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6610. /*** End of inlined file: juce_ModifierKeys.h ***/
  6611. /*** Start of inlined file: juce_Point.h ***/
  6612. #ifndef __JUCE_POINT_JUCEHEADER__
  6613. #define __JUCE_POINT_JUCEHEADER__
  6614. /*** Start of inlined file: juce_AffineTransform.h ***/
  6615. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6616. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6617. class JUCE_API AffineTransform
  6618. {
  6619. public:
  6620. AffineTransform() throw();
  6621. AffineTransform (const AffineTransform& other) throw();
  6622. AffineTransform (const float mat00, const float mat01, const float mat02,
  6623. const float mat10, const float mat11, const float mat12) throw();
  6624. AffineTransform& operator= (const AffineTransform& other) throw();
  6625. bool operator== (const AffineTransform& other) const throw();
  6626. bool operator!= (const AffineTransform& other) const throw();
  6627. static const AffineTransform identity;
  6628. void transformPoint (float& x,
  6629. float& y) const throw();
  6630. void transformPoint (double& x,
  6631. double& y) const throw();
  6632. const AffineTransform translated (const float deltaX,
  6633. const float deltaY) const throw();
  6634. static const AffineTransform translation (const float deltaX,
  6635. const float deltaY) throw();
  6636. const AffineTransform rotated (const float angleInRadians) const throw();
  6637. const AffineTransform rotated (const float angleInRadians,
  6638. const float pivotX,
  6639. const float pivotY) const throw();
  6640. static const AffineTransform rotation (const float angleInRadians) throw();
  6641. static const AffineTransform rotation (const float angleInRadians,
  6642. const float pivotX,
  6643. const float pivotY) throw();
  6644. const AffineTransform scaled (const float factorX,
  6645. const float factorY) const throw();
  6646. static const AffineTransform scale (const float factorX,
  6647. const float factorY) throw();
  6648. const AffineTransform sheared (const float shearX,
  6649. const float shearY) const throw();
  6650. const AffineTransform inverted() const throw();
  6651. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6652. bool isIdentity() const throw();
  6653. bool isSingularity() const throw();
  6654. bool isOnlyTranslation() const throw();
  6655. float getTranslationX() const throw() { return mat02; }
  6656. float getTranslationY() const throw() { return mat12; }
  6657. juce_UseDebuggingNewOperator
  6658. float mat00, mat01, mat02;
  6659. float mat10, mat11, mat12;
  6660. private:
  6661. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6662. const float mat10, const float mat11, const float mat12) const throw();
  6663. };
  6664. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6665. /*** End of inlined file: juce_AffineTransform.h ***/
  6666. template <typename ValueType>
  6667. class Point
  6668. {
  6669. public:
  6670. Point() throw() : x (0), y (0) {}
  6671. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6672. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6673. ~Point() throw() {}
  6674. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6675. inline ValueType getX() const throw() { return x; }
  6676. inline ValueType getY() const throw() { return y; }
  6677. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6678. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6679. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6680. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6681. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6682. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6683. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6684. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6685. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6686. const Point operator-() const throw() { return Point (-x, -y); }
  6687. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6688. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6689. const String toString() const { return String (x) + ", " + String (y); }
  6690. juce_UseDebuggingNewOperator
  6691. private:
  6692. ValueType x, y;
  6693. };
  6694. #endif // __JUCE_POINT_JUCEHEADER__
  6695. /*** End of inlined file: juce_Point.h ***/
  6696. class JUCE_API MouseEvent
  6697. {
  6698. public:
  6699. MouseEvent (MouseInputSource& source,
  6700. const Point<int>& position,
  6701. const ModifierKeys& modifiers,
  6702. Component* const originator,
  6703. const Time& eventTime,
  6704. const Point<int> mouseDownPos,
  6705. const Time& mouseDownTime,
  6706. const int numberOfClicks,
  6707. const bool mouseWasDragged) throw();
  6708. ~MouseEvent() throw();
  6709. const int x;
  6710. const int y;
  6711. const ModifierKeys mods;
  6712. Component* const eventComponent;
  6713. Component* const originalComponent;
  6714. const Time eventTime;
  6715. MouseInputSource& source;
  6716. int getMouseDownX() const throw();
  6717. int getMouseDownY() const throw();
  6718. const Point<int> getMouseDownPosition() const throw();
  6719. int getDistanceFromDragStart() const throw();
  6720. int getDistanceFromDragStartX() const throw();
  6721. int getDistanceFromDragStartY() const throw();
  6722. const Point<int> getOffsetFromDragStart() const throw();
  6723. bool mouseWasClicked() const throw();
  6724. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6725. int getLengthOfMousePress() const throw();
  6726. const Point<int> getPosition() const throw();
  6727. int getScreenX() const;
  6728. int getScreenY() const;
  6729. const Point<int> getScreenPosition() const;
  6730. int getMouseDownScreenX() const;
  6731. int getMouseDownScreenY() const;
  6732. const Point<int> getMouseDownScreenPosition() const;
  6733. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6734. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6735. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6736. static int getDoubleClickTimeout() throw();
  6737. juce_UseDebuggingNewOperator
  6738. private:
  6739. const Point<int> mouseDownPos;
  6740. const Time mouseDownTime;
  6741. const int numberOfClicks;
  6742. const bool wasMovedSinceMouseDown;
  6743. MouseEvent& operator= (const MouseEvent&);
  6744. };
  6745. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6746. /*** End of inlined file: juce_MouseEvent.h ***/
  6747. /*** Start of inlined file: juce_ComponentListener.h ***/
  6748. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6749. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6750. class Component;
  6751. class JUCE_API ComponentListener
  6752. {
  6753. public:
  6754. virtual ~ComponentListener() {}
  6755. virtual void componentMovedOrResized (Component& component,
  6756. bool wasMoved,
  6757. bool wasResized);
  6758. virtual void componentBroughtToFront (Component& component);
  6759. virtual void componentVisibilityChanged (Component& component);
  6760. virtual void componentChildrenChanged (Component& component);
  6761. virtual void componentParentHierarchyChanged (Component& component);
  6762. virtual void componentNameChanged (Component& component);
  6763. virtual void componentBeingDeleted (Component& component);
  6764. };
  6765. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6766. /*** End of inlined file: juce_ComponentListener.h ***/
  6767. /*** Start of inlined file: juce_KeyListener.h ***/
  6768. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6769. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6770. /*** Start of inlined file: juce_KeyPress.h ***/
  6771. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6772. #define __JUCE_KEYPRESS_JUCEHEADER__
  6773. class JUCE_API KeyPress
  6774. {
  6775. public:
  6776. KeyPress() throw();
  6777. KeyPress (const int keyCode,
  6778. const ModifierKeys& modifiers,
  6779. const juce_wchar textCharacter) throw();
  6780. KeyPress (const int keyCode) throw();
  6781. KeyPress (const KeyPress& other) throw();
  6782. KeyPress& operator= (const KeyPress& other) throw();
  6783. bool operator== (const KeyPress& other) const throw();
  6784. bool operator!= (const KeyPress& other) const throw();
  6785. bool isValid() const throw() { return keyCode != 0; }
  6786. int getKeyCode() const throw() { return keyCode; }
  6787. const ModifierKeys getModifiers() const throw() { return mods; }
  6788. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6789. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6790. static const KeyPress createFromDescription (const String& textVersion) throw();
  6791. const String getTextDescription() const throw();
  6792. bool isCurrentlyDown() const throw();
  6793. static bool isKeyCurrentlyDown (int keyCode) throw();
  6794. // Key codes
  6795. //
  6796. // Note that the actual values of these are platform-specific and may change
  6797. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6798. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6799. //
  6800. static const int spaceKey; /**< key-code for the space bar */
  6801. static const int escapeKey; /**< key-code for the escape key */
  6802. static const int returnKey; /**< key-code for the return key*/
  6803. static const int tabKey; /**< key-code for the tab key*/
  6804. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6805. static const int backspaceKey; /**< key-code for the backspace key */
  6806. static const int insertKey; /**< key-code for the insert key */
  6807. static const int upKey; /**< key-code for the cursor-up key */
  6808. static const int downKey; /**< key-code for the cursor-down key */
  6809. static const int leftKey; /**< key-code for the cursor-left key */
  6810. static const int rightKey; /**< key-code for the cursor-right key */
  6811. static const int pageUpKey; /**< key-code for the page-up key */
  6812. static const int pageDownKey; /**< key-code for the page-down key */
  6813. static const int homeKey; /**< key-code for the home key */
  6814. static const int endKey; /**< key-code for the end key */
  6815. static const int F1Key; /**< key-code for the F1 key */
  6816. static const int F2Key; /**< key-code for the F2 key */
  6817. static const int F3Key; /**< key-code for the F3 key */
  6818. static const int F4Key; /**< key-code for the F4 key */
  6819. static const int F5Key; /**< key-code for the F5 key */
  6820. static const int F6Key; /**< key-code for the F6 key */
  6821. static const int F7Key; /**< key-code for the F7 key */
  6822. static const int F8Key; /**< key-code for the F8 key */
  6823. static const int F9Key; /**< key-code for the F9 key */
  6824. static const int F10Key; /**< key-code for the F10 key */
  6825. static const int F11Key; /**< key-code for the F11 key */
  6826. static const int F12Key; /**< key-code for the F12 key */
  6827. static const int F13Key; /**< key-code for the F13 key */
  6828. static const int F14Key; /**< key-code for the F14 key */
  6829. static const int F15Key; /**< key-code for the F15 key */
  6830. static const int F16Key; /**< key-code for the F16 key */
  6831. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6832. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6833. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6834. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6835. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6836. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6837. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6838. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6839. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6840. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6841. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6842. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6843. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6844. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6845. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6846. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6847. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6848. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6849. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6850. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6851. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6852. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6853. juce_UseDebuggingNewOperator
  6854. private:
  6855. int keyCode;
  6856. ModifierKeys mods;
  6857. juce_wchar textCharacter;
  6858. };
  6859. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6860. /*** End of inlined file: juce_KeyPress.h ***/
  6861. class Component;
  6862. class JUCE_API KeyListener
  6863. {
  6864. public:
  6865. virtual ~KeyListener() {}
  6866. virtual bool keyPressed (const KeyPress& key,
  6867. Component* originatingComponent) = 0;
  6868. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6869. };
  6870. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6871. /*** End of inlined file: juce_KeyListener.h ***/
  6872. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6873. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6874. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6875. class Component;
  6876. class JUCE_API KeyboardFocusTraverser
  6877. {
  6878. public:
  6879. KeyboardFocusTraverser();
  6880. virtual ~KeyboardFocusTraverser();
  6881. virtual Component* getNextComponent (Component* current);
  6882. virtual Component* getPreviousComponent (Component* current);
  6883. virtual Component* getDefaultComponent (Component* parentComponent);
  6884. };
  6885. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6886. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6887. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6888. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6889. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6890. /*** Start of inlined file: juce_Graphics.h ***/
  6891. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6892. #define __JUCE_GRAPHICS_JUCEHEADER__
  6893. /*** Start of inlined file: juce_Font.h ***/
  6894. #ifndef __JUCE_FONT_JUCEHEADER__
  6895. #define __JUCE_FONT_JUCEHEADER__
  6896. /*** Start of inlined file: juce_Typeface.h ***/
  6897. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6898. #define __JUCE_TYPEFACE_JUCEHEADER__
  6899. /*** Start of inlined file: juce_Path.h ***/
  6900. #ifndef __JUCE_PATH_JUCEHEADER__
  6901. #define __JUCE_PATH_JUCEHEADER__
  6902. /*** Start of inlined file: juce_Rectangle.h ***/
  6903. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6904. #define __JUCE_RECTANGLE_JUCEHEADER__
  6905. class RectangleList;
  6906. template <typename ValueType>
  6907. class Rectangle
  6908. {
  6909. public:
  6910. Rectangle() throw()
  6911. : x (0), y (0), w (0), h (0)
  6912. {
  6913. }
  6914. Rectangle (const Rectangle& other) throw()
  6915. : x (other.x), y (other.y),
  6916. w (other.w), h (other.h)
  6917. {
  6918. }
  6919. Rectangle (const ValueType initialX, const ValueType initialY,
  6920. const ValueType width, const ValueType height) throw()
  6921. : x (initialX), y (initialY),
  6922. w (width), h (height)
  6923. {
  6924. }
  6925. Rectangle (const ValueType width, const ValueType height) throw()
  6926. : x (0), y (0), w (width), h (height)
  6927. {
  6928. }
  6929. Rectangle& operator= (const Rectangle& other) throw()
  6930. {
  6931. x = other.x; y = other.y;
  6932. w = other.w; h = other.h;
  6933. return *this;
  6934. }
  6935. ~Rectangle() throw() {}
  6936. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6937. inline ValueType getX() const throw() { return x; }
  6938. inline ValueType getY() const throw() { return y; }
  6939. inline ValueType getWidth() const throw() { return w; }
  6940. inline ValueType getHeight() const throw() { return h; }
  6941. inline ValueType getRight() const throw() { return x + w; }
  6942. inline ValueType getBottom() const throw() { return y + h; }
  6943. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6944. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6945. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6946. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  6947. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6948. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6949. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6950. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  6951. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6952. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  6953. void setBounds (const ValueType newX, const ValueType newY,
  6954. const ValueType newWidth, const ValueType newHeight) throw()
  6955. {
  6956. x = newX; y = newY; w = newWidth; h = newHeight;
  6957. }
  6958. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6959. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6960. void setLeft (const ValueType newLeft) throw()
  6961. {
  6962. w = jmax (ValueType(), x + w - newLeft);
  6963. x = newLeft;
  6964. }
  6965. void setTop (const ValueType newTop) throw()
  6966. {
  6967. h = jmax (ValueType(), y + h - newTop);
  6968. y = newTop;
  6969. }
  6970. void setRight (const ValueType newRight) throw()
  6971. {
  6972. x = jmin (x, newRight);
  6973. w = newRight - x;
  6974. }
  6975. void setBottom (const ValueType newBottom) throw()
  6976. {
  6977. y = jmin (y, newBottom);
  6978. h = newBottom - y;
  6979. }
  6980. void translate (const ValueType deltaX,
  6981. const ValueType deltaY) throw()
  6982. {
  6983. x += deltaX;
  6984. y += deltaY;
  6985. }
  6986. const Rectangle translated (const ValueType deltaX,
  6987. const ValueType deltaY) const throw()
  6988. {
  6989. return Rectangle (x + deltaX, y + deltaY, w, h);
  6990. }
  6991. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  6992. {
  6993. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  6994. }
  6995. void expand (const ValueType deltaX,
  6996. const ValueType deltaY) throw()
  6997. {
  6998. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6999. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7000. setBounds (x - deltaX, y - deltaY, nw, nh);
  7001. }
  7002. const Rectangle expanded (const ValueType deltaX,
  7003. const ValueType deltaY) const throw()
  7004. {
  7005. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7006. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7007. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7008. }
  7009. void reduce (const ValueType deltaX,
  7010. const ValueType deltaY) throw()
  7011. {
  7012. expand (-deltaX, -deltaY);
  7013. }
  7014. const Rectangle reduced (const ValueType deltaX,
  7015. const ValueType deltaY) const throw()
  7016. {
  7017. return expanded (-deltaX, -deltaY);
  7018. }
  7019. bool operator== (const Rectangle& other) const throw()
  7020. {
  7021. return x == other.x && y == other.y
  7022. && w == other.w && h == other.h;
  7023. }
  7024. bool operator!= (const Rectangle& other) const throw()
  7025. {
  7026. return x != other.x || y != other.y
  7027. || w != other.w || h != other.h;
  7028. }
  7029. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7030. {
  7031. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7032. }
  7033. bool contains (const Point<ValueType>& point) const throw()
  7034. {
  7035. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7036. }
  7037. bool contains (const Rectangle& other) const throw()
  7038. {
  7039. return x <= other.x && y <= other.y
  7040. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7041. }
  7042. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7043. {
  7044. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7045. jlimit (y, y + h, point.getY()));
  7046. }
  7047. bool intersects (const Rectangle& other) const throw()
  7048. {
  7049. return x + w > other.x
  7050. && y + h > other.y
  7051. && x < other.x + other.w
  7052. && y < other.y + other.h
  7053. && w > ValueType() && h > ValueType();
  7054. }
  7055. const Rectangle getIntersection (const Rectangle& other) const throw()
  7056. {
  7057. const ValueType nx = jmax (x, other.x);
  7058. const ValueType ny = jmax (y, other.y);
  7059. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7060. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7061. if (nw >= ValueType() && nh >= ValueType())
  7062. return Rectangle (nx, ny, nw, nh);
  7063. return Rectangle();
  7064. }
  7065. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7066. {
  7067. const int maxX = jmax (otherX, x);
  7068. otherW = jmin (otherX + otherW, x + w) - maxX;
  7069. if (otherW > 0)
  7070. {
  7071. const int maxY = jmax (otherY, y);
  7072. otherH = jmin (otherY + otherH, y + h) - maxY;
  7073. if (otherH > 0)
  7074. {
  7075. otherX = maxX; otherY = maxY;
  7076. return true;
  7077. }
  7078. }
  7079. return false;
  7080. }
  7081. const Rectangle getUnion (const Rectangle& other) const throw()
  7082. {
  7083. const ValueType newX = jmin (x, other.x);
  7084. const ValueType newY = jmin (y, other.y);
  7085. return Rectangle (newX, newY,
  7086. jmax (x + w, other.x + other.w) - newX,
  7087. jmax (y + h, other.y + other.h) - newY);
  7088. }
  7089. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7090. {
  7091. if (x == other.x && getRight() == other.getRight()
  7092. && (other.getBottom() >= y && other.y <= getBottom()))
  7093. {
  7094. const ValueType newY = jmin (y, other.y);
  7095. h = jmax (getBottom(), other.getBottom()) - newY;
  7096. y = newY;
  7097. return true;
  7098. }
  7099. else if (y == other.y && getBottom() == other.getBottom()
  7100. && (other.getRight() >= x && other.x <= getRight()))
  7101. {
  7102. const ValueType newX = jmin (x, other.x);
  7103. w = jmax (getRight(), other.getRight()) - newX;
  7104. x = newX;
  7105. return true;
  7106. }
  7107. return false;
  7108. }
  7109. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7110. {
  7111. int inside = 0;
  7112. const int otherR = other.getRight();
  7113. if (x >= other.x && x < otherR) inside = 1;
  7114. const int otherB = other.getBottom();
  7115. if (y >= other.y && y < otherB) inside |= 2;
  7116. const int r = x + w;
  7117. if (r >= other.x && r < otherR) inside |= 4;
  7118. const int b = y + h;
  7119. if (b >= other.y && b < otherB) inside |= 8;
  7120. switch (inside)
  7121. {
  7122. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7123. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7124. case 2 + 4 + 8: w = other.x - x; return true;
  7125. case 1 + 4 + 8: h = other.y - y; return true;
  7126. }
  7127. return false;
  7128. }
  7129. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7130. {
  7131. float x1 = x, y1 = y;
  7132. float x2 = x + w, y2 = y;
  7133. float x3 = x, y3 = y + h;
  7134. float x4 = x2, y4 = y3;
  7135. transform.transformPoint (x1, y1);
  7136. transform.transformPoint (x2, y2);
  7137. transform.transformPoint (x3, y3);
  7138. transform.transformPoint (x4, y4);
  7139. const float x = jmin (x1, x2, x3, x4);
  7140. const float y = jmin (y1, y2, y3, y4);
  7141. return Rectangle (x, y,
  7142. jmax (x1, x2, x3, x4) - x,
  7143. jmax (y1, y2, y3, y4) - y);
  7144. }
  7145. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7146. {
  7147. const int x1 = (int) floorf ((float) x);
  7148. const int y1 = (int) floorf ((float) y);
  7149. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7150. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7151. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7152. }
  7153. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7154. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7155. {
  7156. const ValueType x = jmax (x1, x2);
  7157. w1 = jmin (x1 + w1, x2 + w2) - x;
  7158. if (w1 > 0)
  7159. {
  7160. const ValueType y = jmax (y1, y2);
  7161. h1 = jmin (y1 + h1, y2 + h2) - y;
  7162. if (h1 > 0)
  7163. {
  7164. x1 = x; y1 = y;
  7165. return true;
  7166. }
  7167. }
  7168. return false;
  7169. }
  7170. const String toString() const
  7171. {
  7172. String s;
  7173. s.preallocateStorage (16);
  7174. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  7175. return s;
  7176. }
  7177. static const Rectangle fromString (const String& stringVersion)
  7178. {
  7179. StringArray toks;
  7180. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), String::empty);
  7181. return Rectangle (toks[0].trim().getIntValue(),
  7182. toks[1].trim().getIntValue(),
  7183. toks[2].trim().getIntValue(),
  7184. toks[3].trim().getIntValue());
  7185. }
  7186. juce_UseDebuggingNewOperator
  7187. private:
  7188. friend class RectangleList;
  7189. ValueType x, y, w, h;
  7190. };
  7191. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7192. /*** End of inlined file: juce_Rectangle.h ***/
  7193. /*** Start of inlined file: juce_Justification.h ***/
  7194. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7195. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7196. class JUCE_API Justification
  7197. {
  7198. public:
  7199. inline Justification (const int flags_) throw() : flags (flags_) {}
  7200. Justification (const Justification& other) throw();
  7201. Justification& operator= (const Justification& other) throw();
  7202. inline int getFlags() const throw() { return flags; }
  7203. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7204. int getOnlyVerticalFlags() const throw();
  7205. int getOnlyHorizontalFlags() const throw();
  7206. void applyToRectangle (int& x, int& y,
  7207. const int w, const int h,
  7208. const int spaceX, const int spaceY,
  7209. const int spaceW, const int spaceH) const throw();
  7210. enum
  7211. {
  7212. left = 1,
  7213. right = 2,
  7214. horizontallyCentred = 4,
  7215. top = 8,
  7216. bottom = 16,
  7217. verticallyCentred = 32,
  7218. horizontallyJustified = 64,
  7219. centred = 36,
  7220. centredLeft = 33,
  7221. centredRight = 34,
  7222. centredTop = 12,
  7223. centredBottom = 20,
  7224. topLeft = 9,
  7225. topRight = 10,
  7226. bottomLeft = 17,
  7227. bottomRight = 18
  7228. };
  7229. private:
  7230. int flags;
  7231. };
  7232. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7233. /*** End of inlined file: juce_Justification.h ***/
  7234. /*** Start of inlined file: juce_EdgeTable.h ***/
  7235. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7236. #define __JUCE_EDGETABLE_JUCEHEADER__
  7237. class Path;
  7238. class RectangleList;
  7239. class Image;
  7240. class JUCE_API EdgeTable
  7241. {
  7242. public:
  7243. EdgeTable (const Rectangle<int>& clipLimits,
  7244. const Path& pathToAdd,
  7245. const AffineTransform& transform);
  7246. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7247. EdgeTable (const RectangleList& rectanglesToAdd);
  7248. EdgeTable (const float x, const float y,
  7249. const float w, const float h);
  7250. EdgeTable (const EdgeTable& other);
  7251. EdgeTable& operator= (const EdgeTable& other);
  7252. ~EdgeTable();
  7253. void clipToRectangle (const Rectangle<int>& r) throw();
  7254. void excludeRectangle (const Rectangle<int>& r) throw();
  7255. void clipToEdgeTable (const EdgeTable& other);
  7256. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7257. bool isEmpty() throw();
  7258. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7259. void translate (float dx, int dy) throw();
  7260. void optimiseTable() throw();
  7261. template <class EdgeTableIterationCallback>
  7262. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7263. {
  7264. const int* lineStart = table;
  7265. for (int y = 0; y < bounds.getHeight(); ++y)
  7266. {
  7267. const int* line = lineStart;
  7268. lineStart += lineStrideElements;
  7269. int numPoints = line[0];
  7270. if (--numPoints > 0)
  7271. {
  7272. int x = *++line;
  7273. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7274. int levelAccumulator = 0;
  7275. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7276. while (--numPoints >= 0)
  7277. {
  7278. const int level = *++line;
  7279. jassert (((unsigned int) level) < (unsigned int) 256);
  7280. const int endX = *++line;
  7281. jassert (endX >= x);
  7282. const int endOfRun = (endX >> 8);
  7283. if (endOfRun == (x >> 8))
  7284. {
  7285. // small segment within the same pixel, so just save it for the next
  7286. // time round..
  7287. levelAccumulator += (endX - x) * level;
  7288. }
  7289. else
  7290. {
  7291. // plot the fist pixel of this segment, including any accumulated
  7292. // levels from smaller segments that haven't been drawn yet
  7293. levelAccumulator += (0xff - (x & 0xff)) * level;
  7294. levelAccumulator >>= 8;
  7295. x >>= 8;
  7296. if (levelAccumulator > 0)
  7297. {
  7298. if (levelAccumulator >> 8)
  7299. levelAccumulator = 0xff;
  7300. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7301. }
  7302. // if there's a run of similar pixels, do it all in one go..
  7303. if (level > 0)
  7304. {
  7305. jassert (endOfRun <= bounds.getRight());
  7306. const int numPix = endOfRun - ++x;
  7307. if (numPix > 0)
  7308. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7309. }
  7310. // save the bit at the end to be drawn next time round the loop.
  7311. levelAccumulator = (endX & 0xff) * level;
  7312. }
  7313. x = endX;
  7314. }
  7315. if (levelAccumulator > 0)
  7316. {
  7317. levelAccumulator >>= 8;
  7318. if (levelAccumulator >> 8)
  7319. levelAccumulator = 0xff;
  7320. x >>= 8;
  7321. jassert (x >= bounds.getX() && x < bounds.getRight());
  7322. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7323. }
  7324. }
  7325. }
  7326. }
  7327. juce_UseDebuggingNewOperator
  7328. private:
  7329. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7330. HeapBlock<int> table;
  7331. Rectangle<int> bounds;
  7332. int maxEdgesPerLine, lineStrideElements;
  7333. bool needToCheckEmptinesss;
  7334. void addEdgePoint (const int x, const int y, const int winding) throw();
  7335. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7336. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7337. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7338. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7339. static void copyEdgeTableData (int* dest, const int destLineStride, const int* src, const int srcLineStride, int numLines) throw();
  7340. };
  7341. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7342. /*** End of inlined file: juce_EdgeTable.h ***/
  7343. class Image;
  7344. class JUCE_API Path
  7345. {
  7346. public:
  7347. Path();
  7348. Path (const Path& other);
  7349. ~Path();
  7350. Path& operator= (const Path& other);
  7351. bool isEmpty() const throw();
  7352. const Rectangle<float> getBounds() const throw();
  7353. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7354. bool contains (float x, float y,
  7355. float tolerence = 10.0f) const;
  7356. bool intersectsLine (float x1, float y1,
  7357. float x2, float y2,
  7358. float tolerence = 10.0f);
  7359. void clear() throw();
  7360. void startNewSubPath (float startX, float startY);
  7361. void closeSubPath();
  7362. void lineTo (float endX, float endY);
  7363. void quadraticTo (float controlPointX,
  7364. float controlPointY,
  7365. float endPointX,
  7366. float endPointY);
  7367. void cubicTo (float controlPoint1X,
  7368. float controlPoint1Y,
  7369. float controlPoint2X,
  7370. float controlPoint2Y,
  7371. float endPointX,
  7372. float endPointY);
  7373. const Point<float> getCurrentPosition() const;
  7374. void addRectangle (float x, float y, float width, float height);
  7375. void addRectangle (const Rectangle<int>& rectangle);
  7376. void addRoundedRectangle (float x, float y, float width, float height,
  7377. float cornerSize);
  7378. void addRoundedRectangle (float x, float y, float width, float height,
  7379. float cornerSizeX,
  7380. float cornerSizeY);
  7381. void addTriangle (float x1, float y1,
  7382. float x2, float y2,
  7383. float x3, float y3);
  7384. void addQuadrilateral (float x1, float y1,
  7385. float x2, float y2,
  7386. float x3, float y3,
  7387. float x4, float y4);
  7388. void addEllipse (float x, float y, float width, float height);
  7389. void addArc (float x, float y, float width, float height,
  7390. float fromRadians,
  7391. float toRadians,
  7392. bool startAsNewSubPath = false);
  7393. void addCentredArc (float centreX, float centreY,
  7394. float radiusX, float radiusY,
  7395. float rotationOfEllipse,
  7396. float fromRadians,
  7397. float toRadians,
  7398. bool startAsNewSubPath = false);
  7399. void addPieSegment (float x, float y,
  7400. float width, float height,
  7401. float fromRadians,
  7402. float toRadians,
  7403. float innerCircleProportionalSize);
  7404. void addLineSegment (float startX, float startY,
  7405. float endX, float endY,
  7406. float lineThickness);
  7407. void addArrow (float startX, float startY,
  7408. float endX, float endY,
  7409. float lineThickness,
  7410. float arrowheadWidth,
  7411. float arrowheadLength);
  7412. void addStar (float centreX,
  7413. float centreY,
  7414. int numberOfPoints,
  7415. float innerRadius,
  7416. float outerRadius,
  7417. float startAngle = 0.0f);
  7418. void addBubble (float bodyX, float bodyY,
  7419. float bodyW, float bodyH,
  7420. float cornerSize,
  7421. float arrowTipX,
  7422. float arrowTipY,
  7423. int whichSide,
  7424. float arrowPositionAlongEdgeProportional,
  7425. float arrowWidth);
  7426. void addPath (const Path& pathToAppend);
  7427. void addPath (const Path& pathToAppend,
  7428. const AffineTransform& transformToApply);
  7429. void swapWithPath (Path& other);
  7430. void applyTransform (const AffineTransform& transform) throw();
  7431. void scaleToFit (float x, float y, float width, float height,
  7432. bool preserveProportions) throw();
  7433. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7434. bool preserveProportions,
  7435. const Justification& justificationType = Justification::centred) const;
  7436. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7437. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7438. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7439. class JUCE_API Iterator
  7440. {
  7441. public:
  7442. Iterator (const Path& path);
  7443. ~Iterator();
  7444. bool next();
  7445. enum PathElementType
  7446. {
  7447. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7448. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7449. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7450. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7451. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7452. };
  7453. PathElementType elementType;
  7454. float x1, y1, x2, y2, x3, y3;
  7455. private:
  7456. const Path& path;
  7457. size_t index;
  7458. Iterator (const Iterator&);
  7459. Iterator& operator= (const Iterator&);
  7460. };
  7461. void loadPathFromStream (InputStream& source);
  7462. void loadPathFromData (const void* data, int numberOfBytes);
  7463. void writePathToStream (OutputStream& destination) const;
  7464. const String toString() const;
  7465. void restoreFromString (const String& stringVersion);
  7466. juce_UseDebuggingNewOperator
  7467. private:
  7468. friend class PathFlatteningIterator;
  7469. friend class Path::Iterator;
  7470. ArrayAllocationBase <float, DummyCriticalSection> data;
  7471. size_t numElements;
  7472. float pathXMin, pathXMax, pathYMin, pathYMax;
  7473. bool useNonZeroWinding;
  7474. static const float lineMarker;
  7475. static const float moveMarker;
  7476. static const float quadMarker;
  7477. static const float cubicMarker;
  7478. static const float closeSubPathMarker;
  7479. };
  7480. #endif // __JUCE_PATH_JUCEHEADER__
  7481. /*** End of inlined file: juce_Path.h ***/
  7482. class Font;
  7483. class JUCE_API Typeface : public ReferenceCountedObject
  7484. {
  7485. public:
  7486. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7487. const String getName() const throw() { return name; }
  7488. static const Ptr createSystemTypefaceFor (const Font& font);
  7489. virtual ~Typeface();
  7490. virtual float getAscent() const = 0;
  7491. virtual float getDescent() const = 0;
  7492. virtual float getStringWidth (const String& text) = 0;
  7493. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7494. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7495. juce_UseDebuggingNewOperator
  7496. protected:
  7497. String name;
  7498. Typeface (const String& name) throw();
  7499. private:
  7500. Typeface (const Typeface&);
  7501. Typeface& operator= (const Typeface&);
  7502. };
  7503. class JUCE_API CustomTypeface : public Typeface
  7504. {
  7505. public:
  7506. CustomTypeface();
  7507. CustomTypeface (InputStream& serialisedTypefaceStream);
  7508. ~CustomTypeface();
  7509. void clear();
  7510. void setCharacteristics (const String& name, const float ascent,
  7511. const bool isBold, const bool isItalic,
  7512. const juce_wchar defaultCharacter) throw();
  7513. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7514. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7515. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7516. bool writeToStream (OutputStream& outputStream);
  7517. // The following methods implement the basic Typeface behaviour.
  7518. float getAscent() const;
  7519. float getDescent() const;
  7520. float getStringWidth (const String& text);
  7521. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7522. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7523. int getGlyphForCharacter (juce_wchar character);
  7524. juce_UseDebuggingNewOperator
  7525. protected:
  7526. juce_wchar defaultCharacter;
  7527. float ascent;
  7528. bool isBold, isItalic;
  7529. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7530. private:
  7531. class GlyphInfo;
  7532. friend class OwnedArray<GlyphInfo>;
  7533. OwnedArray <GlyphInfo> glyphs;
  7534. short lookupTable [128];
  7535. CustomTypeface (const CustomTypeface&);
  7536. CustomTypeface& operator= (const CustomTypeface&);
  7537. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7538. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7539. };
  7540. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7541. /*** End of inlined file: juce_Typeface.h ***/
  7542. class LowLevelGraphicsContext;
  7543. class JUCE_API Font
  7544. {
  7545. public:
  7546. enum FontStyleFlags
  7547. {
  7548. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7549. bold = 1, /**< boldens the font. @see setStyleFlags */
  7550. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7551. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7552. };
  7553. Font (const float fontHeight,
  7554. const int styleFlags = plain) throw();
  7555. Font (const String& typefaceName,
  7556. const float fontHeight,
  7557. const int styleFlags) throw();
  7558. Font (const Font& other) throw();
  7559. Font (const Typeface::Ptr& typeface) throw();
  7560. Font() throw();
  7561. Font& operator= (const Font& other) throw();
  7562. bool operator== (const Font& other) const throw();
  7563. bool operator!= (const Font& other) const throw();
  7564. ~Font() throw();
  7565. void setTypefaceName (const String& faceName) throw();
  7566. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7567. static const String getDefaultSansSerifFontName() throw();
  7568. static const String getDefaultSerifFontName() throw();
  7569. static const String getDefaultMonospacedFontName() throw();
  7570. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7571. float getHeight() const throw() { return font->height; }
  7572. void setHeight (float newHeight) throw();
  7573. void setHeightWithoutChangingWidth (float newHeight) throw();
  7574. float getAscent() const throw();
  7575. float getDescent() const throw();
  7576. int getStyleFlags() const throw() { return font->styleFlags; }
  7577. void setStyleFlags (const int newFlags) throw();
  7578. void setBold (const bool shouldBeBold) throw();
  7579. bool isBold() const throw();
  7580. void setItalic (const bool shouldBeItalic) throw();
  7581. bool isItalic() const throw();
  7582. void setUnderline (const bool shouldBeUnderlined) throw();
  7583. bool isUnderlined() const throw();
  7584. void setHorizontalScale (const float scaleFactor) throw();
  7585. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7586. void setExtraKerningFactor (const float extraKerning) throw();
  7587. float getExtraKerningFactor() const throw() { return font->kerning; }
  7588. void setSizeAndStyle (float newHeight,
  7589. const int newStyleFlags,
  7590. const float newHorizontalScale,
  7591. const float newKerningAmount) throw();
  7592. int getStringWidth (const String& text) const throw();
  7593. float getStringWidthFloat (const String& text) const throw();
  7594. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7595. Typeface* getTypeface() const throw();
  7596. static void findFonts (Array<Font>& results) throw();
  7597. static const StringArray findAllTypefaceNames() throw();
  7598. static const String getFallbackFontName() throw();
  7599. static void setFallbackFontName (const String& name) throw();
  7600. juce_UseDebuggingNewOperator
  7601. private:
  7602. friend class FontGlyphAlphaMap;
  7603. friend class TypefaceCache;
  7604. class SharedFontInternal : public ReferenceCountedObject
  7605. {
  7606. public:
  7607. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7608. const float kerning, const float ascent, const int styleFlags,
  7609. Typeface* const typeface) throw();
  7610. SharedFontInternal (const SharedFontInternal& other) throw();
  7611. String typefaceName;
  7612. float height, horizontalScale, kerning, ascent;
  7613. int styleFlags;
  7614. Typeface::Ptr typeface;
  7615. };
  7616. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7617. void dupeInternalIfShared() throw();
  7618. };
  7619. #endif // __JUCE_FONT_JUCEHEADER__
  7620. /*** End of inlined file: juce_Font.h ***/
  7621. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7622. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7623. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7624. class JUCE_API PathStrokeType
  7625. {
  7626. public:
  7627. enum JointStyle
  7628. {
  7629. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7630. Note that for angles that curve back on themselves, drawing a
  7631. mitre could require extending the point too far away from the
  7632. path, so a mitre limit is imposed and any corners that exceed it
  7633. are drawn as bevelled instead. */
  7634. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7635. beveled /**< Indicates that corners should be drawn with a line flattening their
  7636. outside edge. */
  7637. };
  7638. enum EndCapStyle
  7639. {
  7640. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7641. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7642. the thickness of the stroke. */
  7643. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7644. };
  7645. PathStrokeType (const float strokeThickness,
  7646. const JointStyle jointStyle = mitered,
  7647. const EndCapStyle endStyle = butt) throw();
  7648. PathStrokeType (const PathStrokeType& other) throw();
  7649. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7650. ~PathStrokeType() throw();
  7651. void createStrokedPath (Path& destPath,
  7652. const Path& sourcePath,
  7653. const AffineTransform& transform = AffineTransform::identity,
  7654. const float extraAccuracy = 1.0f) const;
  7655. void createDashedStroke (Path& destPath,
  7656. const Path& sourcePath,
  7657. const float* dashLengths,
  7658. int numDashLengths,
  7659. const AffineTransform& transform = AffineTransform::identity,
  7660. const float extraAccuracy = 1.0f) const;
  7661. float getStrokeThickness() const throw() { return thickness; }
  7662. JointStyle getJointStyle() const throw() { return jointStyle; }
  7663. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7664. juce_UseDebuggingNewOperator
  7665. bool operator== (const PathStrokeType& other) const throw();
  7666. bool operator!= (const PathStrokeType& other) const throw();
  7667. private:
  7668. float thickness;
  7669. JointStyle jointStyle;
  7670. EndCapStyle endStyle;
  7671. };
  7672. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7673. /*** End of inlined file: juce_PathStrokeType.h ***/
  7674. /*** Start of inlined file: juce_Line.h ***/
  7675. #ifndef __JUCE_LINE_JUCEHEADER__
  7676. #define __JUCE_LINE_JUCEHEADER__
  7677. class JUCE_API Line
  7678. {
  7679. public:
  7680. Line() throw();
  7681. Line (const Line& other) throw();
  7682. Line (const float startX,
  7683. const float startY,
  7684. const float endX,
  7685. const float endY) throw();
  7686. Line (const Point<float>& start,
  7687. const Point<float>& end) throw();
  7688. Line& operator= (const Line& other) throw();
  7689. ~Line() throw();
  7690. inline float getStartX() const throw() { return startX; }
  7691. inline float getStartY() const throw() { return startY; }
  7692. inline float getEndX() const throw() { return endX; }
  7693. inline float getEndY() const throw() { return endY; }
  7694. const Point<float> getStart() const throw();
  7695. const Point<float> getEnd() const throw();
  7696. void setStart (const float newStartX,
  7697. const float newStartY) throw();
  7698. void setEnd (const float newEndX,
  7699. const float newEndY) throw();
  7700. void setStart (const Point<float>& newStart) throw();
  7701. void setEnd (const Point<float>& newEnd) throw();
  7702. void applyTransform (const AffineTransform& transform) throw();
  7703. float getLength() const throw();
  7704. bool isVertical() const throw();
  7705. bool isHorizontal() const throw();
  7706. float getAngle() const throw();
  7707. bool operator== (const Line& other) const throw();
  7708. bool operator!= (const Line& other) const throw();
  7709. bool intersects (const Line& line,
  7710. float& intersectionX,
  7711. float& intersectionY) const throw();
  7712. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7713. const Point<float> getPointAlongLine (const float distanceFromStart,
  7714. const float perpendicularDistance) const throw();
  7715. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7716. float getDistanceFromLine (const float x,
  7717. const float y) const throw();
  7718. float findNearestPointTo (const float x,
  7719. const float y) const throw();
  7720. bool isPointAbove (const float x, const float y) const throw();
  7721. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7722. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7723. bool clipToPath (const Path& path,
  7724. const bool keepSectionOutsidePath) throw();
  7725. juce_UseDebuggingNewOperator
  7726. private:
  7727. float startX, startY, endX, endY;
  7728. };
  7729. #endif // __JUCE_LINE_JUCEHEADER__
  7730. /*** End of inlined file: juce_Line.h ***/
  7731. /*** Start of inlined file: juce_Colours.h ***/
  7732. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7733. #define __JUCE_COLOURS_JUCEHEADER__
  7734. /*** Start of inlined file: juce_Colour.h ***/
  7735. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7736. #define __JUCE_COLOUR_JUCEHEADER__
  7737. /*** Start of inlined file: juce_PixelFormats.h ***/
  7738. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7739. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7740. #if JUCE_MSVC
  7741. #pragma pack (push, 1)
  7742. #define PACKED
  7743. #elif JUCE_GCC
  7744. #define PACKED __attribute__((packed))
  7745. #else
  7746. #define PACKED
  7747. #endif
  7748. class PixelRGB;
  7749. class PixelAlpha;
  7750. class JUCE_API PixelARGB
  7751. {
  7752. public:
  7753. PixelARGB() throw() {}
  7754. ~PixelARGB() throw() {}
  7755. PixelARGB (const uint32 argb_) throw()
  7756. : argb (argb_)
  7757. {
  7758. }
  7759. forcedinline uint32 getARGB() const throw() { return argb; }
  7760. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7761. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7762. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7763. forcedinline uint8 getRed() const throw() { return components.r; }
  7764. forcedinline uint8 getGreen() const throw() { return components.g; }
  7765. forcedinline uint8 getBlue() const throw() { return components.b; }
  7766. forcedinline void blend (const PixelARGB& src) throw()
  7767. {
  7768. uint32 sargb = src.getARGB();
  7769. const uint32 alpha = 0x100 - (sargb >> 24);
  7770. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7771. sargb += 0xff00ff00 & (getAG() * alpha);
  7772. argb = sargb;
  7773. }
  7774. forcedinline void blend (const PixelAlpha& src) throw();
  7775. forcedinline void blend (const PixelRGB& src) throw();
  7776. template <class Pixel>
  7777. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7778. {
  7779. ++extraAlpha;
  7780. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7781. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7782. const uint32 alpha = 0x100 - (sargb >> 24);
  7783. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7784. sargb += 0xff00ff00 & (getAG() * alpha);
  7785. argb = sargb;
  7786. }
  7787. template <class Pixel>
  7788. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7789. {
  7790. uint32 drb = getRB();
  7791. drb += (((src.getRB() - drb) * amount) >> 8);
  7792. drb &= 0x00ff00ff;
  7793. uint32 dag = getAG();
  7794. dag += (((src.getAG() - dag) * amount) >> 8);
  7795. dag &= 0x00ff00ff;
  7796. dag <<= 8;
  7797. dag |= drb;
  7798. argb = dag;
  7799. }
  7800. template <class Pixel>
  7801. forcedinline void set (const Pixel& src) throw()
  7802. {
  7803. argb = src.getARGB();
  7804. }
  7805. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7806. {
  7807. components.a = newAlpha;
  7808. }
  7809. forcedinline void multiplyAlpha (int multiplier) throw()
  7810. {
  7811. ++multiplier;
  7812. argb = ((multiplier * getAG()) & 0xff00ff00)
  7813. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7814. }
  7815. forcedinline void multiplyAlpha (const float multiplier) throw()
  7816. {
  7817. multiplyAlpha ((int) (multiplier * 256.0f));
  7818. }
  7819. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7820. {
  7821. components.b = b;
  7822. components.g = g;
  7823. components.r = r;
  7824. components.a = a;
  7825. }
  7826. forcedinline void premultiply() throw()
  7827. {
  7828. const uint32 alpha = components.a;
  7829. if (alpha < 0xff)
  7830. {
  7831. if (alpha == 0)
  7832. {
  7833. components.b = 0;
  7834. components.g = 0;
  7835. components.r = 0;
  7836. }
  7837. else
  7838. {
  7839. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7840. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7841. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7842. }
  7843. }
  7844. }
  7845. forcedinline void unpremultiply() throw()
  7846. {
  7847. const uint32 alpha = components.a;
  7848. if (alpha < 0xff)
  7849. {
  7850. if (alpha == 0)
  7851. {
  7852. components.b = 0;
  7853. components.g = 0;
  7854. components.r = 0;
  7855. }
  7856. else
  7857. {
  7858. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7859. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7860. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7861. }
  7862. }
  7863. }
  7864. forcedinline void desaturate() throw()
  7865. {
  7866. if (components.a < 0xff && components.a > 0)
  7867. {
  7868. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7869. components.r = components.g = components.b
  7870. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7871. }
  7872. else
  7873. {
  7874. components.r = components.g = components.b
  7875. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7876. }
  7877. }
  7878. #if JUCE_BIG_ENDIAN
  7879. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7880. #else
  7881. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7882. #endif
  7883. private:
  7884. union
  7885. {
  7886. uint32 argb;
  7887. struct
  7888. {
  7889. #if JUCE_BIG_ENDIAN
  7890. uint8 a : 8, r : 8, g : 8, b : 8;
  7891. #else
  7892. uint8 b, g, r, a;
  7893. #endif
  7894. } PACKED components;
  7895. };
  7896. } PACKED;
  7897. class JUCE_API PixelRGB
  7898. {
  7899. public:
  7900. PixelRGB() throw() {}
  7901. ~PixelRGB() throw() {}
  7902. PixelRGB (const uint32 argb) throw()
  7903. {
  7904. r = (uint8) (argb >> 16);
  7905. g = (uint8) (argb >> 8);
  7906. b = (uint8) (argb);
  7907. }
  7908. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7909. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7910. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7911. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7912. forcedinline uint8 getRed() const throw() { return r; }
  7913. forcedinline uint8 getGreen() const throw() { return g; }
  7914. forcedinline uint8 getBlue() const throw() { return b; }
  7915. forcedinline void blend (const PixelARGB& src) throw()
  7916. {
  7917. uint32 sargb = src.getARGB();
  7918. const uint32 alpha = 0x100 - (sargb >> 24);
  7919. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7920. sargb += 0x0000ff00 & (g * alpha);
  7921. r = (uint8) (sargb >> 16);
  7922. g = (uint8) (sargb >> 8);
  7923. b = (uint8) sargb;
  7924. }
  7925. forcedinline void blend (const PixelRGB& src) throw()
  7926. {
  7927. set (src);
  7928. }
  7929. forcedinline void blend (const PixelAlpha& src) throw();
  7930. template <class Pixel>
  7931. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7932. {
  7933. ++extraAlpha;
  7934. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7935. const uint32 sag = extraAlpha * src.getAG();
  7936. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7937. const uint32 alpha = 0x100 - (sargb >> 24);
  7938. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7939. sargb += 0x0000ff00 & (g * alpha);
  7940. b = (uint8) sargb;
  7941. g = (uint8) (sargb >> 8);
  7942. r = (uint8) (sargb >> 16);
  7943. }
  7944. template <class Pixel>
  7945. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7946. {
  7947. uint32 drb = getRB();
  7948. drb += (((src.getRB() - drb) * amount) >> 8);
  7949. uint32 dag = getAG();
  7950. dag += (((src.getAG() - dag) * amount) >> 8);
  7951. b = (uint8) drb;
  7952. g = (uint8) dag;
  7953. r = (uint8) (drb >> 16);
  7954. }
  7955. template <class Pixel>
  7956. forcedinline void set (const Pixel& src) throw()
  7957. {
  7958. b = src.getBlue();
  7959. g = src.getGreen();
  7960. r = src.getRed();
  7961. }
  7962. forcedinline void setAlpha (const uint8) throw() {}
  7963. forcedinline void multiplyAlpha (int) throw() {}
  7964. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7965. {
  7966. r = r_;
  7967. g = g_;
  7968. b = b_;
  7969. }
  7970. forcedinline void premultiply() throw() {}
  7971. forcedinline void unpremultiply() throw() {}
  7972. forcedinline void desaturate() throw()
  7973. {
  7974. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7975. }
  7976. #if JUCE_MAC
  7977. enum { indexR = 0, indexG = 1, indexB = 2 };
  7978. #else
  7979. enum { indexR = 2, indexG = 1, indexB = 0 };
  7980. #endif
  7981. private:
  7982. #if JUCE_MAC
  7983. uint8 r, g, b;
  7984. #else
  7985. uint8 b, g, r;
  7986. #endif
  7987. } PACKED;
  7988. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7989. {
  7990. set (src);
  7991. }
  7992. class JUCE_API PixelAlpha
  7993. {
  7994. public:
  7995. PixelAlpha() throw() {}
  7996. ~PixelAlpha() throw() {}
  7997. PixelAlpha (const uint32 argb) throw()
  7998. {
  7999. a = (uint8) (argb >> 24);
  8000. }
  8001. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8002. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8003. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8004. forcedinline uint8 getAlpha() const throw() { return a; }
  8005. forcedinline uint8 getRed() const throw() { return 0; }
  8006. forcedinline uint8 getGreen() const throw() { return 0; }
  8007. forcedinline uint8 getBlue() const throw() { return 0; }
  8008. template <class Pixel>
  8009. forcedinline void blend (const Pixel& src) throw()
  8010. {
  8011. const int srcA = src.getAlpha();
  8012. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8013. }
  8014. template <class Pixel>
  8015. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8016. {
  8017. ++extraAlpha;
  8018. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8019. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8020. }
  8021. template <class Pixel>
  8022. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8023. {
  8024. a += ((src,getAlpha() - a) * amount) >> 8;
  8025. }
  8026. template <class Pixel>
  8027. forcedinline void set (const Pixel& src) throw()
  8028. {
  8029. a = src.getAlpha();
  8030. }
  8031. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8032. {
  8033. a = newAlpha;
  8034. }
  8035. forcedinline void multiplyAlpha (int multiplier) throw()
  8036. {
  8037. ++multiplier;
  8038. a = (uint8) ((a * multiplier) >> 8);
  8039. }
  8040. forcedinline void multiplyAlpha (const float multiplier) throw()
  8041. {
  8042. a = (uint8) (a * multiplier);
  8043. }
  8044. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8045. {
  8046. a = a_;
  8047. }
  8048. forcedinline void premultiply() throw()
  8049. {
  8050. }
  8051. forcedinline void unpremultiply() throw()
  8052. {
  8053. }
  8054. forcedinline void desaturate() throw()
  8055. {
  8056. }
  8057. private:
  8058. uint8 a : 8;
  8059. } PACKED;
  8060. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8061. {
  8062. blend (PixelARGB (src.getARGB()));
  8063. }
  8064. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8065. {
  8066. uint32 sargb = src.getARGB();
  8067. const uint32 alpha = 0x100 - (sargb >> 24);
  8068. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8069. sargb += 0xff00ff00 & (getAG() * alpha);
  8070. argb = sargb;
  8071. }
  8072. #if JUCE_MSVC
  8073. #pragma pack (pop)
  8074. #endif
  8075. #undef PACKED
  8076. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8077. /*** End of inlined file: juce_PixelFormats.h ***/
  8078. class JUCE_API Colour
  8079. {
  8080. public:
  8081. Colour() throw();
  8082. Colour (const Colour& other) throw();
  8083. explicit Colour (const uint32 argb) throw();
  8084. Colour (const uint8 red,
  8085. const uint8 green,
  8086. const uint8 blue) throw();
  8087. static const Colour fromRGB (const uint8 red,
  8088. const uint8 green,
  8089. const uint8 blue) throw();
  8090. Colour (const uint8 red,
  8091. const uint8 green,
  8092. const uint8 blue,
  8093. const uint8 alpha) throw();
  8094. static const Colour fromRGBA (const uint8 red,
  8095. const uint8 green,
  8096. const uint8 blue,
  8097. const uint8 alpha) throw();
  8098. Colour (const uint8 red,
  8099. const uint8 green,
  8100. const uint8 blue,
  8101. const float alpha) throw();
  8102. static const Colour fromRGBAFloat (const uint8 red,
  8103. const uint8 green,
  8104. const uint8 blue,
  8105. const float alpha) throw();
  8106. Colour (const float hue,
  8107. const float saturation,
  8108. const float brightness,
  8109. const uint8 alpha) throw();
  8110. Colour (const float hue,
  8111. const float saturation,
  8112. const float brightness,
  8113. const float alpha) throw();
  8114. static const Colour fromHSV (const float hue,
  8115. const float saturation,
  8116. const float brightness,
  8117. const float alpha) throw();
  8118. ~Colour() throw();
  8119. Colour& operator= (const Colour& other) throw();
  8120. bool operator== (const Colour& other) const throw();
  8121. bool operator!= (const Colour& other) const throw();
  8122. uint8 getRed() const throw() { return argb.getRed(); }
  8123. uint8 getGreen() const throw() { return argb.getGreen(); }
  8124. uint8 getBlue() const throw() { return argb.getBlue(); }
  8125. float getFloatRed() const throw();
  8126. float getFloatGreen() const throw();
  8127. float getFloatBlue() const throw();
  8128. const PixelARGB getPixelARGB() const throw();
  8129. uint32 getARGB() const throw();
  8130. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8131. float getFloatAlpha() const throw();
  8132. bool isOpaque() const throw();
  8133. bool isTransparent() const throw();
  8134. const Colour withAlpha (const uint8 newAlpha) const throw();
  8135. const Colour withAlpha (const float newAlpha) const throw();
  8136. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  8137. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8138. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8139. float getHue() const throw();
  8140. float getSaturation() const throw();
  8141. float getBrightness() const throw();
  8142. void getHSB (float& hue,
  8143. float& saturation,
  8144. float& brightness) const throw();
  8145. const Colour withHue (const float newHue) const throw();
  8146. const Colour withSaturation (const float newSaturation) const throw();
  8147. const Colour withBrightness (const float newBrightness) const throw();
  8148. const Colour withRotatedHue (const float amountToRotate) const throw();
  8149. const Colour withMultipliedSaturation (const float multiplier) const throw();
  8150. const Colour withMultipliedBrightness (const float amount) const throw();
  8151. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8152. const Colour darker (float amountDarker = 0.4f) const throw();
  8153. const Colour contrasting (const float amount = 1.0f) const throw();
  8154. static const Colour contrasting (const Colour& colour1,
  8155. const Colour& colour2) throw();
  8156. static const Colour greyLevel (const float brightness) throw();
  8157. const String toString() const;
  8158. static const Colour fromString (const String& encodedColourString);
  8159. const String toDisplayString (bool includeAlphaValue) const;
  8160. juce_UseDebuggingNewOperator
  8161. private:
  8162. PixelARGB argb;
  8163. };
  8164. #endif // __JUCE_COLOUR_JUCEHEADER__
  8165. /*** End of inlined file: juce_Colour.h ***/
  8166. class Colours
  8167. {
  8168. public:
  8169. static JUCE_API const Colour
  8170. transparentBlack, /**< ARGB = 0x00000000 */
  8171. transparentWhite, /**< ARGB = 0x00ffffff */
  8172. black, /**< ARGB = 0xff000000 */
  8173. white, /**< ARGB = 0xffffffff */
  8174. blue, /**< ARGB = 0xff0000ff */
  8175. grey, /**< ARGB = 0xff808080 */
  8176. green, /**< ARGB = 0xff008000 */
  8177. red, /**< ARGB = 0xffff0000 */
  8178. yellow, /**< ARGB = 0xffffff00 */
  8179. aliceblue, antiquewhite, aqua, aquamarine,
  8180. azure, beige, bisque, blanchedalmond,
  8181. blueviolet, brown, burlywood, cadetblue,
  8182. chartreuse, chocolate, coral, cornflowerblue,
  8183. cornsilk, crimson, cyan, darkblue,
  8184. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8185. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8186. darkorchid, darkred, darksalmon, darkseagreen,
  8187. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8188. deeppink, deepskyblue, dimgrey, dodgerblue,
  8189. firebrick, floralwhite, forestgreen, fuchsia,
  8190. gainsboro, gold, goldenrod, greenyellow,
  8191. honeydew, hotpink, indianred, indigo,
  8192. ivory, khaki, lavender, lavenderblush,
  8193. lemonchiffon, lightblue, lightcoral, lightcyan,
  8194. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8195. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8196. lightsteelblue, lightyellow, lime, limegreen,
  8197. linen, magenta, maroon, mediumaquamarine,
  8198. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8199. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8200. midnightblue, mintcream, mistyrose, navajowhite,
  8201. navy, oldlace, olive, olivedrab,
  8202. orange, orangered, orchid, palegoldenrod,
  8203. palegreen, paleturquoise, palevioletred, papayawhip,
  8204. peachpuff, peru, pink, plum,
  8205. powderblue, purple, rosybrown, royalblue,
  8206. saddlebrown, salmon, sandybrown, seagreen,
  8207. seashell, sienna, silver, skyblue,
  8208. slateblue, slategrey, snow, springgreen,
  8209. steelblue, tan, teal, thistle,
  8210. tomato, turquoise, violet, wheat,
  8211. whitesmoke, yellowgreen;
  8212. static JUCE_API const Colour findColourForName (const String& colourName,
  8213. const Colour& defaultColour);
  8214. private:
  8215. // this isn't a class you should ever instantiate - it's just here for the
  8216. // static values in it.
  8217. Colours();
  8218. };
  8219. #endif // __JUCE_COLOURS_JUCEHEADER__
  8220. /*** End of inlined file: juce_Colours.h ***/
  8221. /*** Start of inlined file: juce_FillType.h ***/
  8222. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8223. #define __JUCE_FILLTYPE_JUCEHEADER__
  8224. /*** Start of inlined file: juce_ColourGradient.h ***/
  8225. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8226. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8227. class JUCE_API ColourGradient
  8228. {
  8229. public:
  8230. ColourGradient (const Colour& colour1,
  8231. const float x1,
  8232. const float y1,
  8233. const Colour& colour2,
  8234. const float x2,
  8235. const float y2,
  8236. const bool isRadial) throw();
  8237. ColourGradient() throw();
  8238. ~ColourGradient() throw();
  8239. void clearColours() throw();
  8240. void addColour (const double proportionAlongGradient,
  8241. const Colour& colour) throw();
  8242. void multiplyOpacity (const float multiplier) throw();
  8243. int getNumColours() const throw();
  8244. double getColourPosition (const int index) const throw();
  8245. const Colour getColour (const int index) const throw();
  8246. const Colour getColourAtPosition (const float position) const throw();
  8247. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8248. bool isOpaque() const throw();
  8249. bool isInvisible() const throw();
  8250. float x1;
  8251. float y1;
  8252. float x2;
  8253. float y2;
  8254. bool isRadial;
  8255. juce_UseDebuggingNewOperator
  8256. private:
  8257. Array <uint32> colours;
  8258. };
  8259. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8260. /*** End of inlined file: juce_ColourGradient.h ***/
  8261. class Image;
  8262. class JUCE_API FillType
  8263. {
  8264. public:
  8265. FillType() throw();
  8266. FillType (const Colour& colour) throw();
  8267. FillType (const ColourGradient& gradient) throw();
  8268. FillType (const Image& image, const AffineTransform& transform) throw();
  8269. FillType (const FillType& other) throw();
  8270. FillType& operator= (const FillType& other) throw();
  8271. ~FillType() throw();
  8272. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8273. bool isGradient() const throw() { return gradient != 0; }
  8274. bool isTiledImage() const throw() { return image != 0; }
  8275. void setColour (const Colour& newColour) throw();
  8276. void setGradient (const ColourGradient& newGradient) throw();
  8277. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8278. void setOpacity (const float newOpacity) throw();
  8279. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8280. Colour colour;
  8281. ScopedPointer <ColourGradient> gradient;
  8282. const Image* image;
  8283. AffineTransform transform;
  8284. juce_UseDebuggingNewOperator
  8285. };
  8286. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8287. /*** End of inlined file: juce_FillType.h ***/
  8288. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8289. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8290. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8291. class JUCE_API RectanglePlacement
  8292. {
  8293. public:
  8294. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8295. RectanglePlacement (const RectanglePlacement& other) throw();
  8296. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8297. enum
  8298. {
  8299. xLeft = 1,
  8300. xRight = 2,
  8301. xMid = 4,
  8302. yTop = 8,
  8303. yBottom = 16,
  8304. yMid = 32,
  8305. stretchToFit = 64,
  8306. fillDestination = 128,
  8307. onlyReduceInSize = 256,
  8308. onlyIncreaseInSize = 512,
  8309. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8310. centred = 4 + 32
  8311. };
  8312. inline int getFlags() const throw() { return flags; }
  8313. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8314. void applyTo (double& sourceX,
  8315. double& sourceY,
  8316. double& sourceW,
  8317. double& sourceH,
  8318. double destinationX,
  8319. double destinationY,
  8320. double destinationW,
  8321. double destinationH) const throw();
  8322. const AffineTransform getTransformToFit (float sourceX,
  8323. float sourceY,
  8324. float sourceW,
  8325. float sourceH,
  8326. float destinationX,
  8327. float destinationY,
  8328. float destinationW,
  8329. float destinationH) const throw();
  8330. private:
  8331. int flags;
  8332. };
  8333. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8334. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8335. class LowLevelGraphicsContext;
  8336. class Image;
  8337. class RectangleList;
  8338. class JUCE_API Graphics
  8339. {
  8340. public:
  8341. Graphics (Image& imageToDrawOnto) throw();
  8342. ~Graphics() throw();
  8343. void setColour (const Colour& newColour) throw();
  8344. void setOpacity (const float newOpacity) throw();
  8345. void setGradientFill (const ColourGradient& gradient) throw();
  8346. void setTiledImageFill (const Image& imageToUse,
  8347. const int anchorX,
  8348. const int anchorY,
  8349. const float opacity) throw();
  8350. void setFillType (const FillType& newFill) throw();
  8351. void setFont (const Font& newFont) throw();
  8352. void setFont (const float newFontHeight,
  8353. const int fontStyleFlags = Font::plain) throw();
  8354. void drawSingleLineText (const String& text,
  8355. const int startX,
  8356. const int baselineY) const throw();
  8357. void drawMultiLineText (const String& text,
  8358. const int startX,
  8359. const int baselineY,
  8360. const int maximumLineWidth) const throw();
  8361. void drawTextAsPath (const String& text,
  8362. const AffineTransform& transform) const throw();
  8363. void drawText (const String& text,
  8364. const int x,
  8365. const int y,
  8366. const int width,
  8367. const int height,
  8368. const Justification& justificationType,
  8369. const bool useEllipsesIfTooBig) const throw();
  8370. void drawFittedText (const String& text,
  8371. const int x,
  8372. const int y,
  8373. const int width,
  8374. const int height,
  8375. const Justification& justificationFlags,
  8376. const int maximumNumberOfLines,
  8377. const float minimumHorizontalScale = 0.7f) const throw();
  8378. void fillAll() const throw();
  8379. void fillAll (const Colour& colourToUse) const throw();
  8380. void fillRect (int x,
  8381. int y,
  8382. int width,
  8383. int height) const throw();
  8384. void fillRect (const Rectangle<int>& rectangle) const throw();
  8385. void fillRect (const float x,
  8386. const float y,
  8387. const float width,
  8388. const float height) const throw();
  8389. void fillRoundedRectangle (const float x,
  8390. const float y,
  8391. const float width,
  8392. const float height,
  8393. const float cornerSize) const throw();
  8394. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8395. const float cornerSize) const throw();
  8396. void fillCheckerBoard (int x, int y,
  8397. int width, int height,
  8398. const int checkWidth,
  8399. const int checkHeight,
  8400. const Colour& colour1,
  8401. const Colour& colour2) const throw();
  8402. void drawRect (const int x,
  8403. const int y,
  8404. const int width,
  8405. const int height,
  8406. const int lineThickness = 1) const throw();
  8407. void drawRect (const float x,
  8408. const float y,
  8409. const float width,
  8410. const float height,
  8411. const float lineThickness = 1.0f) const throw();
  8412. void drawRect (const Rectangle<int>& rectangle,
  8413. const int lineThickness = 1) const throw();
  8414. void drawRoundedRectangle (const float x,
  8415. const float y,
  8416. const float width,
  8417. const float height,
  8418. const float cornerSize,
  8419. const float lineThickness) const throw();
  8420. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8421. const float cornerSize,
  8422. const float lineThickness) const throw();
  8423. void drawBevel (const int x,
  8424. const int y,
  8425. const int width,
  8426. const int height,
  8427. const int bevelThickness,
  8428. const Colour& topLeftColour = Colours::white,
  8429. const Colour& bottomRightColour = Colours::black,
  8430. const bool useGradient = true,
  8431. const bool sharpEdgeOnOutside = true) const throw();
  8432. void setPixel (int x, int y) const throw();
  8433. void fillEllipse (const float x,
  8434. const float y,
  8435. const float width,
  8436. const float height) const throw();
  8437. void drawEllipse (const float x,
  8438. const float y,
  8439. const float width,
  8440. const float height,
  8441. const float lineThickness) const throw();
  8442. void drawLine (float startX,
  8443. float startY,
  8444. float endX,
  8445. float endY) const throw();
  8446. void drawLine (const float startX,
  8447. const float startY,
  8448. const float endX,
  8449. const float endY,
  8450. const float lineThickness) const throw();
  8451. void drawLine (const Line& line) const throw();
  8452. void drawLine (const Line& line,
  8453. const float lineThickness) const throw();
  8454. void drawDashedLine (const float startX,
  8455. const float startY,
  8456. const float endX,
  8457. const float endY,
  8458. const float* const dashLengths,
  8459. const int numDashLengths,
  8460. const float lineThickness = 1.0f) const throw();
  8461. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8462. void drawHorizontalLine (const int y, float left, float right) const throw();
  8463. void fillPath (const Path& path,
  8464. const AffineTransform& transform = AffineTransform::identity) const throw();
  8465. void strokePath (const Path& path,
  8466. const PathStrokeType& strokeType,
  8467. const AffineTransform& transform = AffineTransform::identity) const throw();
  8468. void drawArrow (const float startX,
  8469. const float startY,
  8470. const float endX,
  8471. const float endY,
  8472. const float lineThickness,
  8473. const float arrowheadWidth,
  8474. const float arrowheadLength) const throw();
  8475. enum ResamplingQuality
  8476. {
  8477. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8478. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8479. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8480. };
  8481. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8482. void drawImageAt (const Image* const imageToDraw,
  8483. const int topLeftX,
  8484. const int topLeftY,
  8485. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8486. void drawImage (const Image* const imageToDraw,
  8487. int destX,
  8488. int destY,
  8489. int destWidth,
  8490. int destHeight,
  8491. int sourceX,
  8492. int sourceY,
  8493. int sourceWidth,
  8494. int sourceHeight,
  8495. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8496. void drawImageTransformed (const Image* const imageToDraw,
  8497. const Rectangle<int>& imageSubRegion,
  8498. const AffineTransform& transform,
  8499. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8500. void drawImageWithin (const Image* const imageToDraw,
  8501. const int destX,
  8502. const int destY,
  8503. const int destWidth,
  8504. const int destHeight,
  8505. const RectanglePlacement& placementWithinTarget,
  8506. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8507. const Rectangle<int> getClipBounds() const throw();
  8508. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8509. bool reduceClipRegion (const int x, const int y,
  8510. const int width, const int height) throw();
  8511. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8512. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8513. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8514. const AffineTransform& transform) throw();
  8515. void excludeClipRegion (const Rectangle<int>& rectangleToExclude) throw();
  8516. bool isClipEmpty() const throw();
  8517. void saveState() throw();
  8518. void restoreState() throw();
  8519. void setOrigin (const int newOriginX,
  8520. const int newOriginY) throw();
  8521. void resetToDefaultState() throw();
  8522. bool isVectorDevice() const throw();
  8523. juce_UseDebuggingNewOperator
  8524. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8525. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8526. private:
  8527. LowLevelGraphicsContext* const context;
  8528. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8529. bool saveStatePending;
  8530. void saveStateIfPending() throw();
  8531. Graphics (const Graphics&);
  8532. Graphics& operator= (const Graphics& other);
  8533. };
  8534. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8535. /*** End of inlined file: juce_Graphics.h ***/
  8536. class JUCE_API ImageEffectFilter
  8537. {
  8538. public:
  8539. virtual void applyEffect (Image& sourceImage,
  8540. Graphics& destContext) = 0;
  8541. virtual ~ImageEffectFilter() {}
  8542. };
  8543. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8544. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8545. /*** Start of inlined file: juce_RectangleList.h ***/
  8546. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8547. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8548. class JUCE_API RectangleList
  8549. {
  8550. public:
  8551. RectangleList() throw();
  8552. RectangleList (const RectangleList& other) throw();
  8553. RectangleList (const Rectangle<int>& rect) throw();
  8554. RectangleList& operator= (const RectangleList& other) throw();
  8555. ~RectangleList() throw();
  8556. bool isEmpty() const throw();
  8557. int getNumRectangles() const throw() { return rects.size(); }
  8558. const Rectangle<int> getRectangle (const int index) const throw();
  8559. void clear() throw();
  8560. void add (const int x, const int y,
  8561. const int w, const int h) throw();
  8562. void add (const Rectangle<int>& rect) throw();
  8563. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8564. void add (const RectangleList& other) throw();
  8565. void subtract (const Rectangle<int>& rect) throw();
  8566. void subtract (const RectangleList& otherList) throw();
  8567. bool clipTo (const Rectangle<int>& rect) throw();
  8568. bool clipTo (const RectangleList& other) throw();
  8569. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8570. void swapWith (RectangleList& otherList) throw();
  8571. bool containsPoint (const int x, const int y) const throw();
  8572. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8573. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8574. bool intersects (const RectangleList& other) const throw();
  8575. const Rectangle<int> getBounds() const throw();
  8576. void consolidate() throw();
  8577. void offsetAll (const int dx, const int dy) throw();
  8578. const Path toPath() const throw();
  8579. class Iterator
  8580. {
  8581. public:
  8582. Iterator (const RectangleList& list) throw();
  8583. ~Iterator() throw();
  8584. bool next() throw();
  8585. const Rectangle<int>* getRectangle() const throw() { return current; }
  8586. juce_UseDebuggingNewOperator
  8587. private:
  8588. const Rectangle<int>* current;
  8589. const RectangleList& owner;
  8590. int index;
  8591. Iterator (const Iterator&);
  8592. Iterator& operator= (const Iterator&);
  8593. };
  8594. juce_UseDebuggingNewOperator
  8595. private:
  8596. friend class Iterator;
  8597. Array <Rectangle<int> > rects;
  8598. };
  8599. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8600. /*** End of inlined file: juce_RectangleList.h ***/
  8601. /*** Start of inlined file: juce_BorderSize.h ***/
  8602. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8603. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8604. class JUCE_API BorderSize
  8605. {
  8606. public:
  8607. BorderSize() throw();
  8608. BorderSize (const BorderSize& other) throw();
  8609. BorderSize (const int topGap,
  8610. const int leftGap,
  8611. const int bottomGap,
  8612. const int rightGap) throw();
  8613. BorderSize (const int allGaps) throw();
  8614. ~BorderSize() throw();
  8615. int getTop() const throw() { return top; }
  8616. int getLeft() const throw() { return left; }
  8617. int getBottom() const throw() { return bottom; }
  8618. int getRight() const throw() { return right; }
  8619. int getTopAndBottom() const throw() { return top + bottom; }
  8620. int getLeftAndRight() const throw() { return left + right; }
  8621. void setTop (const int newTopGap) throw();
  8622. void setLeft (const int newLeftGap) throw();
  8623. void setBottom (const int newBottomGap) throw();
  8624. void setRight (const int newRightGap) throw();
  8625. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8626. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8627. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8628. void addTo (Rectangle<int>& original) const throw();
  8629. bool operator== (const BorderSize& other) const throw();
  8630. bool operator!= (const BorderSize& other) const throw();
  8631. juce_UseDebuggingNewOperator
  8632. private:
  8633. int top, left, bottom, right;
  8634. };
  8635. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8636. /*** End of inlined file: juce_BorderSize.h ***/
  8637. class LookAndFeel;
  8638. class MouseInputSource;
  8639. class MouseInputSourceInternal;
  8640. class ComponentPeer;
  8641. class JUCE_API Component : public MouseListener,
  8642. protected MessageListener
  8643. {
  8644. public:
  8645. Component();
  8646. virtual ~Component();
  8647. Component (const String& componentName);
  8648. const String& getName() const throw() { return componentName_; }
  8649. virtual void setName (const String& newName);
  8650. bool isValidComponent() const;
  8651. virtual void setVisible (bool shouldBeVisible);
  8652. bool isVisible() const throw() { return flags.visibleFlag; }
  8653. virtual void visibilityChanged();
  8654. bool isShowing() const;
  8655. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8656. const int deltaXToMove = 0,
  8657. const int deltaYToMove = 0,
  8658. const float scaleFactorAtEnd = 1.0f);
  8659. virtual void addToDesktop (int windowStyleFlags,
  8660. void* nativeWindowToAttachTo = 0);
  8661. void removeFromDesktop();
  8662. bool isOnDesktop() const throw();
  8663. ComponentPeer* getPeer() const;
  8664. virtual void userTriedToCloseWindow();
  8665. virtual void minimisationStateChanged (bool isNowMinimised);
  8666. void toFront (const bool shouldAlsoGainFocus);
  8667. void toBack();
  8668. void toBehind (Component* const other);
  8669. void setAlwaysOnTop (const bool shouldStayOnTop);
  8670. bool isAlwaysOnTop() const throw();
  8671. inline int getX() const throw() { return bounds_.getX(); }
  8672. inline int getY() const throw() { return bounds_.getY(); }
  8673. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8674. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8675. int getRight() const throw() { return bounds_.getRight(); }
  8676. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8677. int getBottom() const throw() { return bounds_.getBottom(); }
  8678. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8679. void getVisibleArea (RectangleList& result,
  8680. const bool includeSiblings) const;
  8681. int getScreenX() const;
  8682. int getScreenY() const;
  8683. const Point<int> getScreenPosition() const;
  8684. const Rectangle<int> getScreenBounds() const;
  8685. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8686. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8687. const Point<int> relativePositionToOtherComponent (const Component* const targetComponent,
  8688. const Point<int>& positionRelativeToThis) const;
  8689. void setTopLeftPosition (const int x, const int y);
  8690. void setTopRightPosition (const int x, const int y);
  8691. void setSize (const int newWidth, const int newHeight);
  8692. void setBounds (int x, int y, int width, int height);
  8693. void setBounds (const Rectangle<int>& newBounds);
  8694. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8695. const float proportionalWidth, const float proportionalHeight);
  8696. void setBoundsInset (const BorderSize& borders);
  8697. void setBoundsToFit (int x, int y, int width, int height,
  8698. const Justification& justification,
  8699. const bool onlyReduceInSize);
  8700. void setCentrePosition (const int x, const int y);
  8701. void setCentreRelative (const float x, const float y);
  8702. void centreWithSize (const int width, const int height);
  8703. int proportionOfWidth (const float proportion) const throw();
  8704. int proportionOfHeight (const float proportion) const throw();
  8705. int getParentWidth() const throw();
  8706. int getParentHeight() const throw();
  8707. const Rectangle<int> getParentMonitorArea() const;
  8708. int getNumChildComponents() const throw();
  8709. Component* getChildComponent (const int index) const throw();
  8710. int getIndexOfChildComponent (const Component* const child) const throw();
  8711. void addChildComponent (Component* const child,
  8712. int zOrder = -1);
  8713. void addAndMakeVisible (Component* const child,
  8714. int zOrder = -1);
  8715. void removeChildComponent (Component* const childToRemove);
  8716. Component* removeChildComponent (const int childIndexToRemove);
  8717. void removeAllChildren();
  8718. void deleteAllChildren();
  8719. Component* getParentComponent() const throw() { return parentComponent_; }
  8720. template <class TargetClass>
  8721. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8722. {
  8723. (void) dummyParameter;
  8724. Component* p = parentComponent_;
  8725. while (p != 0)
  8726. {
  8727. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8728. if (target != 0)
  8729. return target;
  8730. p = p->parentComponent_;
  8731. }
  8732. return 0;
  8733. }
  8734. Component* getTopLevelComponent() const throw();
  8735. bool isParentOf (const Component* possibleChild) const throw();
  8736. virtual void parentHierarchyChanged();
  8737. virtual void childrenChanged();
  8738. virtual bool hitTest (int x, int y);
  8739. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8740. const bool allowClicksOnChildComponents) throw();
  8741. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8742. bool& allowsClicksOnChildComponents) const throw();
  8743. virtual bool contains (int x, int y);
  8744. bool reallyContains (int x, int y,
  8745. const bool returnTrueIfWithinAChild);
  8746. Component* getComponentAt (const int x, const int y);
  8747. Component* getComponentAt (const Point<int>& position);
  8748. void repaint();
  8749. void repaint (const int x, const int y,
  8750. const int width, const int height);
  8751. void setBufferedToImage (const bool shouldBeBuffered);
  8752. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8753. const bool clipImageToComponentBounds = true);
  8754. void paintEntireComponent (Graphics& context);
  8755. void setComponentEffect (ImageEffectFilter* const newEffect);
  8756. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8757. LookAndFeel& getLookAndFeel() const throw();
  8758. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8759. virtual void lookAndFeelChanged();
  8760. void sendLookAndFeelChange();
  8761. void setOpaque (const bool shouldBeOpaque);
  8762. bool isOpaque() const throw();
  8763. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8764. bool isBroughtToFrontOnMouseClick() const throw();
  8765. // Keyboard focus methods
  8766. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8767. bool getWantsKeyboardFocus() const throw();
  8768. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8769. bool getMouseClickGrabsKeyboardFocus() const throw();
  8770. void grabKeyboardFocus();
  8771. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const;
  8772. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8773. void moveKeyboardFocusToSibling (const bool moveToNext);
  8774. virtual KeyboardFocusTraverser* createFocusTraverser();
  8775. int getExplicitFocusOrder() const;
  8776. void setExplicitFocusOrder (const int newFocusOrderIndex);
  8777. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8778. bool isFocusContainer() const throw();
  8779. bool isEnabled() const throw();
  8780. void setEnabled (const bool shouldBeEnabled);
  8781. virtual void enablementChanged();
  8782. void setMouseCursor (const MouseCursor& cursorType);
  8783. virtual const MouseCursor getMouseCursor();
  8784. void updateMouseCursor() const;
  8785. virtual void paint (Graphics& g);
  8786. virtual void paintOverChildren (Graphics& g);
  8787. virtual void mouseMove (const MouseEvent& e);
  8788. virtual void mouseEnter (const MouseEvent& e);
  8789. virtual void mouseExit (const MouseEvent& e);
  8790. virtual void mouseDown (const MouseEvent& e);
  8791. virtual void mouseDrag (const MouseEvent& e);
  8792. virtual void mouseUp (const MouseEvent& e);
  8793. virtual void mouseDoubleClick (const MouseEvent& e);
  8794. virtual void mouseWheelMove (const MouseEvent& e,
  8795. float wheelIncrementX,
  8796. float wheelIncrementY);
  8797. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8798. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8799. void addMouseListener (MouseListener* const newListener,
  8800. const bool wantsEventsForAllNestedChildComponents);
  8801. void removeMouseListener (MouseListener* const listenerToRemove);
  8802. void addKeyListener (KeyListener* const newListener);
  8803. void removeKeyListener (KeyListener* const listenerToRemove);
  8804. virtual bool keyPressed (const KeyPress& key);
  8805. virtual bool keyStateChanged (const bool isKeyDown);
  8806. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8807. enum FocusChangeType
  8808. {
  8809. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8810. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8811. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8812. };
  8813. virtual void focusGained (FocusChangeType cause);
  8814. virtual void focusLost (FocusChangeType cause);
  8815. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8816. bool isMouseOver() const throw();
  8817. bool isMouseButtonDown() const throw();
  8818. bool isMouseOverOrDragging() const throw();
  8819. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8820. const Point<int> getMouseXYRelative() const;
  8821. virtual void resized();
  8822. virtual void moved();
  8823. virtual void childBoundsChanged (Component* child);
  8824. virtual void parentSizeChanged();
  8825. virtual void broughtToFront();
  8826. void addComponentListener (ComponentListener* const newListener);
  8827. void removeComponentListener (ComponentListener* const listenerToRemove);
  8828. void postCommandMessage (const int commandId);
  8829. virtual void handleCommandMessage (int commandId);
  8830. int runModalLoop();
  8831. void enterModalState (const bool takeKeyboardFocus = true);
  8832. void exitModalState (const int returnValue);
  8833. bool isCurrentlyModal() const throw();
  8834. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8835. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8836. bool isCurrentlyBlockedByAnotherModalComponent() const;
  8837. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8838. virtual void inputAttemptWhenModal();
  8839. NamedValueSet& getProperties() throw() { return properties; }
  8840. const NamedValueSet& getProperties() const throw() { return properties; }
  8841. const Colour findColour (const int colourId, const bool inheritFromParent = false) const;
  8842. void setColour (const int colourId, const Colour& colour);
  8843. void removeColour (const int colourId);
  8844. bool isColourSpecified (const int colourId) const;
  8845. void copyAllExplicitColoursTo (Component& target) const;
  8846. virtual void colourChanged();
  8847. void* getWindowHandle() const;
  8848. uint32 getComponentUID() const throw() { return componentUID; }
  8849. template <class ComponentType>
  8850. class SafePointer : private ComponentListener
  8851. {
  8852. public:
  8853. SafePointer() : comp (0) {}
  8854. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8855. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8856. ~SafePointer() { detach(); }
  8857. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8858. SafePointer& operator= (ComponentType* const newComponent)
  8859. {
  8860. detach();
  8861. comp = newComponent;
  8862. attach();
  8863. return *this;
  8864. }
  8865. operator ComponentType*() const throw() { return comp; }
  8866. ComponentType* getComponent() const throw() { return comp; }
  8867. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8868. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8869. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8870. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8871. juce_UseDebuggingNewOperator
  8872. private:
  8873. ComponentType* comp;
  8874. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8875. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8876. void componentBeingDeleted (Component&) { comp = 0; }
  8877. };
  8878. class BailOutChecker
  8879. {
  8880. public:
  8881. BailOutChecker (Component* const component1,
  8882. Component* const component2 = 0);
  8883. bool shouldBailOut() const throw();
  8884. private:
  8885. typedef SafePointer<Component> SafeComponentPtr;
  8886. SafeComponentPtr safePointer1, safePointer2;
  8887. Component* const component2;
  8888. BailOutChecker (const BailOutChecker&);
  8889. BailOutChecker& operator= (const BailOutChecker&);
  8890. };
  8891. juce_UseDebuggingNewOperator
  8892. private:
  8893. friend class ComponentPeer;
  8894. friend class InternalDragRepeater;
  8895. friend class MouseInputSource;
  8896. friend class MouseInputSourceInternal;
  8897. static Component* currentlyFocusedComponent;
  8898. String componentName_;
  8899. Component* parentComponent_;
  8900. uint32 componentUID;
  8901. Rectangle<int> bounds_;
  8902. int numDeepMouseListeners;
  8903. Array <Component*> childComponentList_;
  8904. LookAndFeel* lookAndFeel_;
  8905. MouseCursor cursor_;
  8906. ImageEffectFilter* effect_;
  8907. Image* bufferedImage_;
  8908. VoidArray* mouseListeners_;
  8909. VoidArray* keyListeners_;
  8910. ListenerList <ComponentListener> componentListeners;
  8911. NamedValueSet properties;
  8912. struct ComponentFlags
  8913. {
  8914. bool hasHeavyweightPeerFlag : 1;
  8915. bool visibleFlag : 1;
  8916. bool opaqueFlag : 1;
  8917. bool ignoresMouseClicksFlag : 1;
  8918. bool allowChildMouseClicksFlag : 1;
  8919. bool wantsFocusFlag : 1;
  8920. bool isFocusContainerFlag : 1;
  8921. bool dontFocusOnMouseClickFlag : 1;
  8922. bool alwaysOnTopFlag : 1;
  8923. bool bufferToImageFlag : 1;
  8924. bool bringToFrontOnClickFlag : 1;
  8925. bool repaintOnMouseActivityFlag : 1;
  8926. bool draggingFlag : 1;
  8927. bool mouseOverFlag : 1;
  8928. bool mouseInsideFlag : 1;
  8929. bool currentlyModalFlag : 1;
  8930. bool isDisabledFlag : 1;
  8931. bool childCompFocusedFlag : 1;
  8932. #ifdef JUCE_DEBUG
  8933. bool isInsidePaintCall : 1;
  8934. #endif
  8935. };
  8936. union
  8937. {
  8938. uint32 componentFlags_;
  8939. ComponentFlags flags;
  8940. };
  8941. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8942. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8943. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8944. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8945. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8946. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8947. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const float amountX, const float amountY);
  8948. void internalBroughtToFront();
  8949. void internalFocusGain (const FocusChangeType cause);
  8950. void internalFocusLoss (const FocusChangeType cause);
  8951. void internalChildFocusChange (FocusChangeType cause);
  8952. void internalModalInputAttempt();
  8953. void internalModifierKeysChanged();
  8954. void internalChildrenChanged();
  8955. void internalHierarchyChanged();
  8956. void renderComponent (Graphics& context);
  8957. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8958. void repaintParent();
  8959. void sendFakeMouseMove() const;
  8960. void takeKeyboardFocus (const FocusChangeType cause);
  8961. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8962. static void giveAwayFocus();
  8963. void sendEnablementChangeMessage();
  8964. static void* runModalLoopCallback (void*);
  8965. static void bringModalComponentToFront();
  8966. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  8967. const Rectangle<int>& clipRect,
  8968. const Component* const compToAvoid) const;
  8969. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8970. const int deltaX, const int deltaY) const;
  8971. // how much of the component is not off the edges of its parents
  8972. const Rectangle<int> getUnclippedArea() const;
  8973. void sendVisibilityChangeMessage();
  8974. // This is included here just to cause a compile error if your code is still handling
  8975. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8976. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8977. // implement its methods instead of this Component method).
  8978. virtual void filesDropped (const StringArray&, int, int) {}
  8979. // components aren't allowed to have copy constructors, as this would mess up parent
  8980. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8981. // this one to avoid compiler warnings.
  8982. Component (const Component&);
  8983. Component& operator= (const Component&);
  8984. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8985. // subclass to use the new parameters to keyStateChanged)
  8986. virtual void keyStateChanged() {};
  8987. protected:
  8988. virtual void internalRepaint (int x, int y, int w, int h);
  8989. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8990. void handleMessage (const Message&);
  8991. };
  8992. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8993. /*** End of inlined file: juce_Component.h ***/
  8994. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8995. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8996. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8997. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  8998. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8999. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9000. typedef int CommandID;
  9001. namespace StandardApplicationCommandIDs
  9002. {
  9003. static const CommandID quit = 0x1001;
  9004. static const CommandID del = 0x1002;
  9005. static const CommandID cut = 0x1003;
  9006. static const CommandID copy = 0x1004;
  9007. static const CommandID paste = 0x1005;
  9008. static const CommandID selectAll = 0x1006;
  9009. static const CommandID deselectAll = 0x1007;
  9010. }
  9011. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9012. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9013. struct JUCE_API ApplicationCommandInfo
  9014. {
  9015. ApplicationCommandInfo (const CommandID commandID) throw();
  9016. void setInfo (const String& shortName,
  9017. const String& description,
  9018. const String& categoryName,
  9019. const int flags) throw();
  9020. void setActive (const bool isActive) throw();
  9021. void setTicked (const bool isTicked) throw();
  9022. void addDefaultKeypress (const int keyCode,
  9023. const ModifierKeys& modifiers) throw();
  9024. CommandID commandID;
  9025. String shortName;
  9026. String description;
  9027. String categoryName;
  9028. Array <KeyPress> defaultKeypresses;
  9029. enum CommandFlags
  9030. {
  9031. isDisabled = 1 << 0,
  9032. isTicked = 1 << 1,
  9033. wantsKeyUpDownCallbacks = 1 << 2,
  9034. hiddenFromKeyEditor = 1 << 3,
  9035. readOnlyInKeyEditor = 1 << 4,
  9036. dontTriggerVisualFeedback = 1 << 5
  9037. };
  9038. int flags;
  9039. };
  9040. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9041. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9042. class JUCE_API ApplicationCommandTarget
  9043. {
  9044. public:
  9045. ApplicationCommandTarget();
  9046. virtual ~ApplicationCommandTarget();
  9047. struct JUCE_API InvocationInfo
  9048. {
  9049. InvocationInfo (const CommandID commandID) throw();
  9050. CommandID commandID;
  9051. int commandFlags;
  9052. enum InvocationMethod
  9053. {
  9054. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9055. fromKeyPress, /**< The command is being invoked by a key-press. */
  9056. fromMenu, /**< The command is being invoked by a menu selection. */
  9057. fromButton /**< The command is being invoked by a button click. */
  9058. };
  9059. InvocationMethod invocationMethod;
  9060. Component* originatingComponent;
  9061. KeyPress keyPress;
  9062. bool isKeyDown;
  9063. int millisecsSinceKeyPressed;
  9064. };
  9065. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9066. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9067. virtual void getCommandInfo (const CommandID commandID,
  9068. ApplicationCommandInfo& result) = 0;
  9069. virtual bool perform (const InvocationInfo& info) = 0;
  9070. bool invoke (const InvocationInfo& invocationInfo,
  9071. const bool asynchronously);
  9072. bool invokeDirectly (const CommandID commandID,
  9073. const bool asynchronously);
  9074. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9075. bool isCommandActive (const CommandID commandID);
  9076. ApplicationCommandTarget* findFirstTargetParentComponent();
  9077. juce_UseDebuggingNewOperator
  9078. private:
  9079. // (for async invocation of commands)
  9080. class CommandTargetMessageInvoker : public MessageListener
  9081. {
  9082. public:
  9083. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9084. ~CommandTargetMessageInvoker();
  9085. void handleMessage (const Message& message);
  9086. private:
  9087. ApplicationCommandTarget* const owner;
  9088. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9089. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9090. };
  9091. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9092. friend class CommandTargetMessageInvoker;
  9093. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9094. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9095. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9096. };
  9097. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9098. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9099. /*** Start of inlined file: juce_ActionListener.h ***/
  9100. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9101. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9102. class JUCE_API ActionListener
  9103. {
  9104. public:
  9105. virtual ~ActionListener() {}
  9106. virtual void actionListenerCallback (const String& message) = 0;
  9107. };
  9108. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9109. /*** End of inlined file: juce_ActionListener.h ***/
  9110. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9111. private ActionListener
  9112. {
  9113. protected:
  9114. JUCEApplication();
  9115. public:
  9116. virtual ~JUCEApplication();
  9117. static JUCEApplication* getInstance() throw();
  9118. virtual void initialise (const String& commandLineParameters) = 0;
  9119. bool isInitialising() const throw();
  9120. virtual void shutdown() = 0;
  9121. virtual const String getApplicationName() = 0;
  9122. virtual const String getApplicationVersion();
  9123. virtual bool moreThanOneInstanceAllowed();
  9124. virtual void anotherInstanceStarted (const String& commandLine);
  9125. virtual void systemRequestedQuit();
  9126. virtual void unhandledException (const std::exception* e,
  9127. const String& sourceFilename,
  9128. const int lineNumber);
  9129. static void quit();
  9130. void setApplicationReturnValue (const int newReturnValue) throw();
  9131. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9132. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9133. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9134. static int main (String& commandLine, JUCEApplication* const newApp);
  9135. static int main (int argc, const char* argv[], JUCEApplication* const newApp);
  9136. static void sendUnhandledException (const std::exception* const e,
  9137. const char* const sourceFile,
  9138. const int lineNumber);
  9139. ApplicationCommandTarget* getNextCommandTarget();
  9140. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  9141. void getAllCommands (Array <CommandID>& commands);
  9142. bool perform (const InvocationInfo& info);
  9143. void actionListenerCallback (const String& message);
  9144. private:
  9145. String commandLineParameters;
  9146. int appReturnValue;
  9147. bool stillInitialising;
  9148. ScopedPointer<InterProcessLock> appLock;
  9149. JUCEApplication (const JUCEApplication&);
  9150. JUCEApplication& operator= (const JUCEApplication&);
  9151. public:
  9152. bool initialiseApp (String& commandLine);
  9153. static int shutdownAppAndClearUp();
  9154. };
  9155. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9156. /*** End of inlined file: juce_Application.h ***/
  9157. #endif
  9158. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9159. #endif
  9160. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9161. #endif
  9162. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9163. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9164. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9165. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9166. /*** Start of inlined file: juce_Desktop.h ***/
  9167. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9168. #define __JUCE_DESKTOP_JUCEHEADER__
  9169. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9170. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9171. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9172. class JUCE_API DeletedAtShutdown
  9173. {
  9174. protected:
  9175. DeletedAtShutdown();
  9176. virtual ~DeletedAtShutdown();
  9177. public:
  9178. static void deleteAll();
  9179. private:
  9180. DeletedAtShutdown (const DeletedAtShutdown&);
  9181. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9182. };
  9183. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9184. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9185. /*** Start of inlined file: juce_Timer.h ***/
  9186. #ifndef __JUCE_TIMER_JUCEHEADER__
  9187. #define __JUCE_TIMER_JUCEHEADER__
  9188. class InternalTimerThread;
  9189. class JUCE_API Timer
  9190. {
  9191. protected:
  9192. Timer() throw();
  9193. Timer (const Timer& other) throw();
  9194. public:
  9195. virtual ~Timer();
  9196. virtual void timerCallback() = 0;
  9197. void startTimer (const int intervalInMilliseconds) throw();
  9198. void stopTimer() throw();
  9199. bool isTimerRunning() const throw() { return periodMs > 0; }
  9200. int getTimerInterval() const throw() { return periodMs; }
  9201. private:
  9202. friend class InternalTimerThread;
  9203. int countdownMs, periodMs;
  9204. Timer* previous;
  9205. Timer* next;
  9206. Timer& operator= (const Timer&);
  9207. };
  9208. #endif // __JUCE_TIMER_JUCEHEADER__
  9209. /*** End of inlined file: juce_Timer.h ***/
  9210. class MouseInputSource;
  9211. class MouseInputSourceInternal;
  9212. class MouseListener;
  9213. class JUCE_API FocusChangeListener
  9214. {
  9215. public:
  9216. virtual ~FocusChangeListener() {}
  9217. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9218. };
  9219. class JUCE_API Desktop : private DeletedAtShutdown,
  9220. private Timer,
  9221. private AsyncUpdater
  9222. {
  9223. public:
  9224. static Desktop& JUCE_CALLTYPE getInstance();
  9225. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9226. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9227. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, const bool clippedToWorkArea = true) const;
  9228. static const Point<int> getMousePosition();
  9229. static void setMousePosition (const Point<int>& newPosition);
  9230. static const Point<int> getLastMouseDownPosition() throw();
  9231. static int getMouseButtonClickCounter() throw();
  9232. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9233. static bool isScreenSaverEnabled() throw();
  9234. void addGlobalMouseListener (MouseListener* const listener);
  9235. void removeGlobalMouseListener (MouseListener* const listener);
  9236. void addFocusChangeListener (FocusChangeListener* const listener);
  9237. void removeFocusChangeListener (FocusChangeListener* const listener);
  9238. void setKioskModeComponent (Component* componentToUse,
  9239. const bool allowMenusAndBars = true);
  9240. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9241. int getNumComponents() const throw();
  9242. Component* getComponent (const int index) const throw();
  9243. Component* findComponentAt (const Point<int>& screenPosition) const;
  9244. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9245. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9246. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9247. int getNumDraggingMouseSources() const throw();
  9248. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9249. juce_UseDebuggingNewOperator
  9250. void refreshMonitorSizes();
  9251. static bool canUseSemiTransparentWindows() throw();
  9252. private:
  9253. static Desktop* instance;
  9254. friend class Component;
  9255. friend class ComponentPeer;
  9256. friend class MouseInputSource;
  9257. friend class MouseInputSourceInternal;
  9258. friend class DeletedAtShutdown;
  9259. friend class TopLevelWindowManager;
  9260. OwnedArray <MouseInputSource> mouseSources;
  9261. void createMouseInputSources();
  9262. ListenerList <MouseListener> mouseListeners;
  9263. ListenerList <FocusChangeListener> focusListeners;
  9264. Array <Component*> desktopComponents;
  9265. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9266. Point<int> lastFakeMouseMove;
  9267. void sendMouseMove();
  9268. int mouseClickCounter;
  9269. void incrementMouseClickCounter() throw();
  9270. Component* kioskModeComponent;
  9271. Rectangle<int> kioskComponentOriginalBounds;
  9272. void timerCallback();
  9273. void resetTimer();
  9274. int getNumDisplayMonitors() const throw();
  9275. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9276. void addDesktopComponent (Component* const c);
  9277. void removeDesktopComponent (Component* const c);
  9278. void componentBroughtToFront (Component* const c);
  9279. void triggerFocusCallback();
  9280. void handleAsyncUpdate();
  9281. Desktop();
  9282. ~Desktop();
  9283. Desktop (const Desktop&);
  9284. Desktop& operator= (const Desktop&);
  9285. };
  9286. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9287. /*** End of inlined file: juce_Desktop.h ***/
  9288. class KeyPressMappingSet;
  9289. class ApplicationCommandManagerListener;
  9290. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9291. private FocusChangeListener
  9292. {
  9293. public:
  9294. ApplicationCommandManager();
  9295. virtual ~ApplicationCommandManager();
  9296. void clearCommands();
  9297. void registerCommand (const ApplicationCommandInfo& newCommand);
  9298. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9299. void removeCommand (const CommandID commandID);
  9300. void commandStatusChanged();
  9301. int getNumCommands() const throw() { return commands.size(); }
  9302. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9303. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9304. const String getNameOfCommand (const CommandID commandID) const throw();
  9305. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9306. const StringArray getCommandCategories() const throw();
  9307. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9308. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9309. bool invokeDirectly (const CommandID commandID,
  9310. const bool asynchronously);
  9311. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9312. const bool asynchronously);
  9313. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9314. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9315. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9316. ApplicationCommandInfo& upToDateInfo);
  9317. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9318. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9319. static ApplicationCommandTarget* findDefaultComponentTarget();
  9320. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9321. juce_UseDebuggingNewOperator
  9322. private:
  9323. OwnedArray <ApplicationCommandInfo> commands;
  9324. ListenerList <ApplicationCommandManagerListener> listeners;
  9325. ScopedPointer <KeyPressMappingSet> keyMappings;
  9326. ApplicationCommandTarget* firstTarget;
  9327. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9328. void handleAsyncUpdate();
  9329. void globalFocusChanged (Component*);
  9330. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9331. // version of this method.
  9332. virtual short getFirstCommandTarget() { return 0; }
  9333. ApplicationCommandManager (const ApplicationCommandManager&);
  9334. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9335. };
  9336. class JUCE_API ApplicationCommandManagerListener
  9337. {
  9338. public:
  9339. virtual ~ApplicationCommandManagerListener() {}
  9340. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9341. virtual void applicationCommandListChanged() = 0;
  9342. };
  9343. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9344. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9345. #endif
  9346. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9347. #endif
  9348. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9349. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9350. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9351. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9352. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9353. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9354. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9355. class JUCE_API PropertiesFile : public PropertySet,
  9356. public ChangeBroadcaster,
  9357. private Timer
  9358. {
  9359. public:
  9360. enum FileFormatOptions
  9361. {
  9362. ignoreCaseOfKeyNames = 1,
  9363. storeAsBinary = 2,
  9364. storeAsCompressedBinary = 4,
  9365. storeAsXML = 8
  9366. };
  9367. PropertiesFile (const File& file,
  9368. int millisecondsBeforeSaving,
  9369. int optionFlags);
  9370. ~PropertiesFile();
  9371. bool isValidFile() const throw() { return loadedOk; }
  9372. bool saveIfNeeded();
  9373. bool save();
  9374. bool needsToBeSaved() const;
  9375. void setNeedsToBeSaved (bool needsToBeSaved);
  9376. const File getFile() const { return file; }
  9377. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9378. const String& fileNameSuffix,
  9379. const String& folderName,
  9380. bool commonToAllUsers,
  9381. int millisecondsBeforeSaving,
  9382. int propertiesFileOptions);
  9383. static const File getDefaultAppSettingsFile (const String& applicationName,
  9384. const String& fileNameSuffix,
  9385. const String& folderName,
  9386. bool commonToAllUsers);
  9387. juce_UseDebuggingNewOperator
  9388. protected:
  9389. virtual void propertyChanged();
  9390. private:
  9391. File file;
  9392. int timerInterval;
  9393. const int options;
  9394. bool loadedOk, needsWriting;
  9395. void timerCallback();
  9396. PropertiesFile (const PropertiesFile&);
  9397. PropertiesFile& operator= (const PropertiesFile&);
  9398. };
  9399. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9400. /*** End of inlined file: juce_PropertiesFile.h ***/
  9401. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9402. {
  9403. public:
  9404. ApplicationProperties() throw();
  9405. ~ApplicationProperties();
  9406. juce_DeclareSingleton (ApplicationProperties, false)
  9407. void setStorageParameters (const String& applicationName,
  9408. const String& fileNameSuffix,
  9409. const String& folderName,
  9410. const int millisecondsBeforeSaving,
  9411. const int propertiesFileOptions) throw();
  9412. bool testWriteAccess (const bool testUserSettings,
  9413. const bool testCommonSettings,
  9414. const bool showWarningDialogOnFailure);
  9415. PropertiesFile* getUserSettings() throw();
  9416. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9417. bool saveIfNeeded();
  9418. void closeFiles();
  9419. juce_UseDebuggingNewOperator
  9420. private:
  9421. ScopedPointer <PropertiesFile> userProps, commonProps;
  9422. String appName, fileSuffix, folderName;
  9423. int msBeforeSaving, options;
  9424. int commonSettingsAreReadOnly;
  9425. ApplicationProperties (const ApplicationProperties&);
  9426. ApplicationProperties& operator= (const ApplicationProperties&);
  9427. void openFiles() throw();
  9428. };
  9429. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9430. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9431. #endif
  9432. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9433. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9434. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9435. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9436. /*** Start of inlined file: juce_AudioFormat.h ***/
  9437. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9438. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9439. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9440. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9441. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9442. class AudioFormat;
  9443. class JUCE_API AudioFormatReader
  9444. {
  9445. protected:
  9446. AudioFormatReader (InputStream* const sourceStream,
  9447. const String& formatName);
  9448. public:
  9449. virtual ~AudioFormatReader();
  9450. const String getFormatName() const throw() { return formatName; }
  9451. bool read (int** destSamples,
  9452. int numDestChannels,
  9453. int64 startSampleInSource,
  9454. int numSamplesToRead,
  9455. const bool fillLeftoverChannelsWithCopies);
  9456. virtual void readMaxLevels (int64 startSample,
  9457. int64 numSamples,
  9458. float& lowestLeft,
  9459. float& highestLeft,
  9460. float& lowestRight,
  9461. float& highestRight);
  9462. int64 searchForLevel (int64 startSample,
  9463. int64 numSamplesToSearch,
  9464. const double magnitudeRangeMinimum,
  9465. const double magnitudeRangeMaximum,
  9466. const int minimumConsecutiveSamples);
  9467. double sampleRate;
  9468. unsigned int bitsPerSample;
  9469. int64 lengthInSamples;
  9470. unsigned int numChannels;
  9471. bool usesFloatingPointData;
  9472. StringPairArray metadataValues;
  9473. InputStream* input;
  9474. virtual bool readSamples (int** destSamples,
  9475. int numDestChannels,
  9476. int startOffsetInDestBuffer,
  9477. int64 startSampleInFile,
  9478. int numSamples) = 0;
  9479. juce_UseDebuggingNewOperator
  9480. private:
  9481. String formatName;
  9482. AudioFormatReader (const AudioFormatReader&);
  9483. AudioFormatReader& operator= (const AudioFormatReader&);
  9484. };
  9485. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9486. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9487. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9488. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9489. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9490. /*** Start of inlined file: juce_AudioSource.h ***/
  9491. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9492. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9493. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9494. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9495. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9496. class AudioFormatReader;
  9497. class AudioFormatWriter;
  9498. class JUCE_API AudioSampleBuffer
  9499. {
  9500. public:
  9501. AudioSampleBuffer (const int numChannels,
  9502. const int numSamples) throw();
  9503. AudioSampleBuffer (float** dataToReferTo,
  9504. const int numChannels,
  9505. const int numSamples) throw();
  9506. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9507. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9508. virtual ~AudioSampleBuffer() throw();
  9509. int getNumChannels() const throw() { return numChannels; }
  9510. int getNumSamples() const throw() { return size; }
  9511. float* getSampleData (const int channelNumber) const throw()
  9512. {
  9513. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9514. return channels [channelNumber];
  9515. }
  9516. float* getSampleData (const int channelNumber,
  9517. const int sampleOffset) const throw()
  9518. {
  9519. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9520. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9521. return channels [channelNumber] + sampleOffset;
  9522. }
  9523. float** getArrayOfChannels() const throw() { return channels; }
  9524. void setSize (const int newNumChannels,
  9525. const int newNumSamples,
  9526. const bool keepExistingContent = false,
  9527. const bool clearExtraSpace = false,
  9528. const bool avoidReallocating = false) throw();
  9529. void setDataToReferTo (float** dataToReferTo,
  9530. const int numChannels,
  9531. const int numSamples) throw();
  9532. void clear() throw();
  9533. void clear (const int startSample,
  9534. const int numSamples) throw();
  9535. void clear (const int channel,
  9536. const int startSample,
  9537. const int numSamples) throw();
  9538. void applyGain (const int channel,
  9539. const int startSample,
  9540. int numSamples,
  9541. const float gain) throw();
  9542. void applyGain (const int startSample,
  9543. const int numSamples,
  9544. const float gain) throw();
  9545. void applyGainRamp (const int channel,
  9546. const int startSample,
  9547. int numSamples,
  9548. float startGain,
  9549. float endGain) throw();
  9550. void addFrom (const int destChannel,
  9551. const int destStartSample,
  9552. const AudioSampleBuffer& source,
  9553. const int sourceChannel,
  9554. const int sourceStartSample,
  9555. int numSamples,
  9556. const float gainToApplyToSource = 1.0f) throw();
  9557. void addFrom (const int destChannel,
  9558. const int destStartSample,
  9559. const float* source,
  9560. int numSamples,
  9561. const float gainToApplyToSource = 1.0f) throw();
  9562. void addFromWithRamp (const int destChannel,
  9563. const int destStartSample,
  9564. const float* source,
  9565. int numSamples,
  9566. float startGain,
  9567. float endGain) throw();
  9568. void copyFrom (const int destChannel,
  9569. const int destStartSample,
  9570. const AudioSampleBuffer& source,
  9571. const int sourceChannel,
  9572. const int sourceStartSample,
  9573. int numSamples) throw();
  9574. void copyFrom (const int destChannel,
  9575. const int destStartSample,
  9576. const float* source,
  9577. int numSamples) throw();
  9578. void copyFrom (const int destChannel,
  9579. const int destStartSample,
  9580. const float* source,
  9581. int numSamples,
  9582. const float gain) throw();
  9583. void copyFromWithRamp (const int destChannel,
  9584. const int destStartSample,
  9585. const float* source,
  9586. int numSamples,
  9587. float startGain,
  9588. float endGain) throw();
  9589. void findMinMax (const int channel,
  9590. const int startSample,
  9591. int numSamples,
  9592. float& minVal,
  9593. float& maxVal) const throw();
  9594. float getMagnitude (const int channel,
  9595. const int startSample,
  9596. const int numSamples) const throw();
  9597. float getMagnitude (const int startSample,
  9598. const int numSamples) const throw();
  9599. float getRMSLevel (const int channel,
  9600. const int startSample,
  9601. const int numSamples) const throw();
  9602. void readFromAudioReader (AudioFormatReader* reader,
  9603. const int startSample,
  9604. const int numSamples,
  9605. const int readerStartSample,
  9606. const bool useReaderLeftChan,
  9607. const bool useReaderRightChan) throw();
  9608. void writeToAudioWriter (AudioFormatWriter* writer,
  9609. const int startSample,
  9610. const int numSamples) const throw();
  9611. juce_UseDebuggingNewOperator
  9612. private:
  9613. int numChannels, size;
  9614. size_t allocatedBytes;
  9615. float** channels;
  9616. HeapBlock <char> allocatedData;
  9617. float* preallocatedChannelSpace [32];
  9618. void allocateData();
  9619. void allocateChannels (float** const dataToReferTo);
  9620. };
  9621. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9622. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9623. struct JUCE_API AudioSourceChannelInfo
  9624. {
  9625. AudioSampleBuffer* buffer;
  9626. int startSample;
  9627. int numSamples;
  9628. void clearActiveBufferRegion() const
  9629. {
  9630. if (buffer != 0)
  9631. buffer->clear (startSample, numSamples);
  9632. }
  9633. };
  9634. class JUCE_API AudioSource
  9635. {
  9636. protected:
  9637. AudioSource() throw() {}
  9638. public:
  9639. virtual ~AudioSource() {}
  9640. virtual void prepareToPlay (int samplesPerBlockExpected,
  9641. double sampleRate) = 0;
  9642. virtual void releaseResources() = 0;
  9643. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9644. };
  9645. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9646. /*** End of inlined file: juce_AudioSource.h ***/
  9647. class JUCE_API AudioFormatWriter
  9648. {
  9649. protected:
  9650. AudioFormatWriter (OutputStream* const destStream,
  9651. const String& formatName,
  9652. const double sampleRate,
  9653. const unsigned int numberOfChannels,
  9654. const unsigned int bitsPerSample);
  9655. public:
  9656. virtual ~AudioFormatWriter();
  9657. const String getFormatName() const throw() { return formatName; }
  9658. virtual bool write (const int** samplesToWrite,
  9659. int numSamples) = 0;
  9660. bool writeFromAudioReader (AudioFormatReader& reader,
  9661. int64 startSample,
  9662. int64 numSamplesToRead);
  9663. bool writeFromAudioSource (AudioSource& source,
  9664. int numSamplesToRead,
  9665. const int samplesPerBlock = 2048);
  9666. double getSampleRate() const throw() { return sampleRate; }
  9667. int getNumChannels() const throw() { return numChannels; }
  9668. int getBitsPerSample() const throw() { return bitsPerSample; }
  9669. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9670. juce_UseDebuggingNewOperator
  9671. protected:
  9672. double sampleRate;
  9673. unsigned int numChannels;
  9674. unsigned int bitsPerSample;
  9675. bool usesFloatingPointData;
  9676. OutputStream* output;
  9677. private:
  9678. String formatName;
  9679. AudioFormatWriter (const AudioFormatWriter&);
  9680. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9681. };
  9682. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9683. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9684. class JUCE_API AudioFormat
  9685. {
  9686. public:
  9687. virtual ~AudioFormat();
  9688. const String& getFormatName() const;
  9689. const StringArray& getFileExtensions() const;
  9690. virtual bool canHandleFile (const File& fileToTest);
  9691. virtual const Array <int> getPossibleSampleRates() = 0;
  9692. virtual const Array <int> getPossibleBitDepths() = 0;
  9693. virtual bool canDoStereo() = 0;
  9694. virtual bool canDoMono() = 0;
  9695. virtual bool isCompressed();
  9696. virtual const StringArray getQualityOptions();
  9697. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9698. const bool deleteStreamIfOpeningFails) = 0;
  9699. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9700. double sampleRateToUse,
  9701. unsigned int numberOfChannels,
  9702. int bitsPerSample,
  9703. const StringPairArray& metadataValues,
  9704. int qualityOptionIndex) = 0;
  9705. protected:
  9706. AudioFormat (const String& formatName,
  9707. const tchar** const fileExtensions);
  9708. private:
  9709. String formatName;
  9710. StringArray fileExtensions;
  9711. };
  9712. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9713. /*** End of inlined file: juce_AudioFormat.h ***/
  9714. class JUCE_API AiffAudioFormat : public AudioFormat
  9715. {
  9716. public:
  9717. AiffAudioFormat();
  9718. ~AiffAudioFormat();
  9719. const Array <int> getPossibleSampleRates();
  9720. const Array <int> getPossibleBitDepths();
  9721. bool canDoStereo();
  9722. bool canDoMono();
  9723. #if JUCE_MAC
  9724. bool canHandleFile (const File& fileToTest);
  9725. #endif
  9726. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9727. const bool deleteStreamIfOpeningFails);
  9728. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9729. double sampleRateToUse,
  9730. unsigned int numberOfChannels,
  9731. int bitsPerSample,
  9732. const StringPairArray& metadataValues,
  9733. int qualityOptionIndex);
  9734. juce_UseDebuggingNewOperator
  9735. };
  9736. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9737. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9738. #endif
  9739. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9740. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9741. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9742. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9743. #if JUCE_USE_CDBURNER
  9744. class AudioCDBurner : public ChangeBroadcaster
  9745. {
  9746. public:
  9747. static const StringArray findAvailableDevices();
  9748. static AudioCDBurner* openDevice (const int deviceIndex);
  9749. ~AudioCDBurner();
  9750. enum DiskState
  9751. {
  9752. unknown, /**< An error condition, if the device isn't responding. */
  9753. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9754. may seem to be permanently open. */
  9755. noDisc, /**< The drive has no disk in it. */
  9756. writableDiskPresent, /**< The drive contains a writeable disk. */
  9757. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9758. };
  9759. DiskState getDiskState() const;
  9760. bool isDiskPresent() const;
  9761. bool openTray();
  9762. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9763. const Array<int> getAvailableWriteSpeeds() const;
  9764. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9765. int getNumAvailableAudioBlocks() const;
  9766. bool addAudioTrack (AudioSource* source, int numSamples);
  9767. class BurnProgressListener
  9768. {
  9769. public:
  9770. BurnProgressListener() throw() {}
  9771. virtual ~BurnProgressListener() {}
  9772. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9773. };
  9774. const String burn (BurnProgressListener* listener,
  9775. bool ejectDiscAfterwards,
  9776. bool performFakeBurnForTesting,
  9777. int writeSpeed);
  9778. void abortBurn();
  9779. juce_UseDebuggingNewOperator
  9780. private:
  9781. AudioCDBurner (const int deviceIndex);
  9782. class Pimpl;
  9783. friend class ScopedPointer<Pimpl>;
  9784. ScopedPointer<Pimpl> pimpl;
  9785. };
  9786. #endif
  9787. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9788. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9789. #endif
  9790. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9791. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9792. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9793. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9794. #if JUCE_USE_CDREADER
  9795. #if JUCE_MAC
  9796. #endif
  9797. class JUCE_API AudioCDReader : public AudioFormatReader
  9798. {
  9799. public:
  9800. static const StringArray getAvailableCDNames();
  9801. static AudioCDReader* createReaderForCD (const int index);
  9802. ~AudioCDReader();
  9803. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9804. int64 startSampleInFile, int numSamples);
  9805. bool isCDStillPresent() const;
  9806. int getNumTracks() const;
  9807. int getPositionOfTrackStart (int trackNum) const;
  9808. bool isTrackAudio (int trackNum) const;
  9809. void refreshTrackLengths();
  9810. void enableIndexScanning (bool enabled);
  9811. int getLastIndex() const;
  9812. const Array <int> findIndexesInTrack (const int trackNumber);
  9813. int getCDDBId();
  9814. void ejectDisk();
  9815. juce_UseDebuggingNewOperator
  9816. private:
  9817. #if JUCE_MAC
  9818. File volumeDir;
  9819. Array<File> tracks;
  9820. Array<int> trackStartSamples;
  9821. int currentReaderTrack;
  9822. ScopedPointer <AudioFormatReader> reader;
  9823. AudioCDReader (const File& volume);
  9824. public:
  9825. static int compareElements (const File&, const File&);
  9826. private:
  9827. #elif JUCE_WINDOWS
  9828. int numTracks;
  9829. int trackStarts[100];
  9830. bool audioTracks [100];
  9831. void* handle;
  9832. bool indexingEnabled;
  9833. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9834. MemoryBlock buffer;
  9835. AudioCDReader (void* handle);
  9836. int getIndexAt (int samplePos);
  9837. #elif JUCE_LINUX
  9838. AudioCDReader();
  9839. #endif
  9840. AudioCDReader (const AudioCDReader&);
  9841. AudioCDReader& operator= (const AudioCDReader&);
  9842. };
  9843. #endif
  9844. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9845. /*** End of inlined file: juce_AudioCDReader.h ***/
  9846. #endif
  9847. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9848. #endif
  9849. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9850. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9851. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9852. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9853. class JUCE_API AudioFormatManager
  9854. {
  9855. public:
  9856. AudioFormatManager();
  9857. ~AudioFormatManager();
  9858. juce_DeclareSingleton (AudioFormatManager, false);
  9859. void registerFormat (AudioFormat* newFormat,
  9860. const bool makeThisTheDefaultFormat);
  9861. void registerBasicFormats();
  9862. void clearFormats();
  9863. int getNumKnownFormats() const;
  9864. AudioFormat* getKnownFormat (const int index) const;
  9865. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9866. AudioFormat* getDefaultFormat() const;
  9867. const String getWildcardForAllFormats() const;
  9868. AudioFormatReader* createReaderFor (const File& audioFile);
  9869. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9870. juce_UseDebuggingNewOperator
  9871. private:
  9872. VoidArray knownFormats;
  9873. int defaultFormatIndex;
  9874. };
  9875. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9876. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9877. #endif
  9878. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9879. #endif
  9880. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9881. #endif
  9882. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9883. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9884. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9885. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9886. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9887. {
  9888. public:
  9889. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9890. const int64 subsectionStartSample,
  9891. const int64 subsectionLength,
  9892. const bool deleteSourceWhenDeleted);
  9893. ~AudioSubsectionReader();
  9894. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9895. int64 startSampleInFile, int numSamples);
  9896. void readMaxLevels (int64 startSample,
  9897. int64 numSamples,
  9898. float& lowestLeft,
  9899. float& highestLeft,
  9900. float& lowestRight,
  9901. float& highestRight);
  9902. juce_UseDebuggingNewOperator
  9903. private:
  9904. AudioFormatReader* const source;
  9905. int64 startSample, length;
  9906. const bool deleteSourceWhenDeleted;
  9907. AudioSubsectionReader (const AudioSubsectionReader&);
  9908. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9909. };
  9910. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9911. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9912. #endif
  9913. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9914. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9915. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9916. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9917. class AudioThumbnailCache;
  9918. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9919. public TimeSliceClient,
  9920. private Timer
  9921. {
  9922. public:
  9923. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9924. AudioFormatManager& formatManagerToUse,
  9925. AudioThumbnailCache& cacheToUse);
  9926. ~AudioThumbnail();
  9927. void setSource (InputSource* const newSource);
  9928. void loadFrom (InputStream& input);
  9929. void saveTo (OutputStream& output) const;
  9930. int getNumChannels() const throw();
  9931. double getTotalLength() const throw();
  9932. void drawChannel (Graphics& g,
  9933. int x, int y, int w, int h,
  9934. double startTimeSeconds,
  9935. double endTimeSeconds,
  9936. int channelNum,
  9937. const float verticalZoomFactor);
  9938. bool isFullyLoaded() const throw();
  9939. bool useTimeSlice();
  9940. void timerCallback();
  9941. juce_UseDebuggingNewOperator
  9942. private:
  9943. AudioFormatManager& formatManagerToUse;
  9944. AudioThumbnailCache& cache;
  9945. ScopedPointer <InputSource> source;
  9946. CriticalSection readerLock;
  9947. ScopedPointer <AudioFormatReader> reader;
  9948. MemoryBlock data, cachedLevels;
  9949. int orginalSamplesPerThumbnailSample;
  9950. int numChannelsCached, numSamplesCached;
  9951. double cachedStart, cachedTimePerPixel;
  9952. bool cacheNeedsRefilling;
  9953. void clear();
  9954. AudioFormatReader* createReader() const;
  9955. void generateSection (AudioFormatReader& reader,
  9956. int64 startSample,
  9957. int numSamples);
  9958. char* getChannelData (int channel) const;
  9959. void refillCache (const int numSamples,
  9960. double startTime,
  9961. const double timePerPixel);
  9962. friend class AudioThumbnailCache;
  9963. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9964. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9965. // returns true if more needs to be read
  9966. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9967. };
  9968. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9969. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9970. #endif
  9971. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9972. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9973. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9974. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9975. struct ThumbnailCacheEntry;
  9976. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9977. {
  9978. public:
  9979. AudioThumbnailCache (const int maxNumThumbsToStore);
  9980. ~AudioThumbnailCache();
  9981. void clear();
  9982. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9983. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9984. juce_UseDebuggingNewOperator
  9985. private:
  9986. OwnedArray <ThumbnailCacheEntry> thumbs;
  9987. int maxNumThumbsToStore;
  9988. friend class AudioThumbnail;
  9989. void addThumbnail (AudioThumbnail* const thumb);
  9990. void removeThumbnail (AudioThumbnail* const thumb);
  9991. };
  9992. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9993. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9994. #endif
  9995. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9996. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  9997. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9998. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9999. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10000. class JUCE_API FlacAudioFormat : public AudioFormat
  10001. {
  10002. public:
  10003. FlacAudioFormat();
  10004. ~FlacAudioFormat();
  10005. const Array <int> getPossibleSampleRates();
  10006. const Array <int> getPossibleBitDepths();
  10007. bool canDoStereo();
  10008. bool canDoMono();
  10009. bool isCompressed();
  10010. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10011. const bool deleteStreamIfOpeningFails);
  10012. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10013. double sampleRateToUse,
  10014. unsigned int numberOfChannels,
  10015. int bitsPerSample,
  10016. const StringPairArray& metadataValues,
  10017. int qualityOptionIndex);
  10018. juce_UseDebuggingNewOperator
  10019. };
  10020. #endif
  10021. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10022. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10023. #endif
  10024. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10025. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10026. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10027. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10028. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10029. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10030. {
  10031. public:
  10032. OggVorbisAudioFormat();
  10033. ~OggVorbisAudioFormat();
  10034. const Array <int> getPossibleSampleRates();
  10035. const Array <int> getPossibleBitDepths();
  10036. bool canDoStereo();
  10037. bool canDoMono();
  10038. bool isCompressed();
  10039. const StringArray getQualityOptions();
  10040. int estimateOggFileQuality (const File& source);
  10041. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10042. const bool deleteStreamIfOpeningFails);
  10043. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10044. double sampleRateToUse,
  10045. unsigned int numberOfChannels,
  10046. int bitsPerSample,
  10047. const StringPairArray& metadataValues,
  10048. int qualityOptionIndex);
  10049. juce_UseDebuggingNewOperator
  10050. };
  10051. #endif
  10052. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10053. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10054. #endif
  10055. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10056. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10057. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10058. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10059. #if JUCE_QUICKTIME
  10060. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10061. {
  10062. public:
  10063. QuickTimeAudioFormat();
  10064. ~QuickTimeAudioFormat();
  10065. const Array <int> getPossibleSampleRates();
  10066. const Array <int> getPossibleBitDepths();
  10067. bool canDoStereo();
  10068. bool canDoMono();
  10069. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10070. const bool deleteStreamIfOpeningFails);
  10071. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10072. double sampleRateToUse,
  10073. unsigned int numberOfChannels,
  10074. int bitsPerSample,
  10075. const StringPairArray& metadataValues,
  10076. int qualityOptionIndex);
  10077. juce_UseDebuggingNewOperator
  10078. };
  10079. #endif
  10080. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10081. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10082. #endif
  10083. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10084. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10085. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10086. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10087. class JUCE_API WavAudioFormat : public AudioFormat
  10088. {
  10089. public:
  10090. WavAudioFormat();
  10091. ~WavAudioFormat();
  10092. static const tchar* const bwavDescription;
  10093. static const tchar* const bwavOriginator;
  10094. static const tchar* const bwavOriginatorRef;
  10095. static const tchar* const bwavOriginationDate;
  10096. static const tchar* const bwavOriginationTime;
  10097. static const tchar* const bwavTimeReference;
  10098. static const tchar* const bwavCodingHistory;
  10099. static const StringPairArray createBWAVMetadata (const String& description,
  10100. const String& originator,
  10101. const String& originatorRef,
  10102. const Time& dateAndTime,
  10103. const int64 timeReferenceSamples,
  10104. const String& codingHistory);
  10105. const Array <int> getPossibleSampleRates();
  10106. const Array <int> getPossibleBitDepths();
  10107. bool canDoStereo();
  10108. bool canDoMono();
  10109. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10110. const bool deleteStreamIfOpeningFails);
  10111. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10112. double sampleRateToUse,
  10113. unsigned int numberOfChannels,
  10114. int bitsPerSample,
  10115. const StringPairArray& metadataValues,
  10116. int qualityOptionIndex);
  10117. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10118. juce_UseDebuggingNewOperator
  10119. };
  10120. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10121. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10122. #endif
  10123. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10124. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10125. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10126. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10127. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10128. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10129. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10130. class JUCE_API PositionableAudioSource : public AudioSource
  10131. {
  10132. protected:
  10133. PositionableAudioSource() throw() {}
  10134. public:
  10135. ~PositionableAudioSource() {}
  10136. virtual void setNextReadPosition (int newPosition) = 0;
  10137. virtual int getNextReadPosition() const = 0;
  10138. virtual int getTotalLength() const = 0;
  10139. virtual bool isLooping() const = 0;
  10140. };
  10141. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10142. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10143. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10144. {
  10145. public:
  10146. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10147. const bool deleteReaderWhenThisIsDeleted);
  10148. ~AudioFormatReaderSource();
  10149. void setLooping (const bool shouldLoop) throw();
  10150. bool isLooping() const { return looping; }
  10151. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10152. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10153. void releaseResources();
  10154. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10155. void setNextReadPosition (int newPosition);
  10156. int getNextReadPosition() const;
  10157. int getTotalLength() const;
  10158. juce_UseDebuggingNewOperator
  10159. private:
  10160. AudioFormatReader* reader;
  10161. bool deleteReader;
  10162. int volatile nextPlayPos;
  10163. bool volatile looping;
  10164. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10165. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10166. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10167. };
  10168. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10169. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10170. #endif
  10171. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10172. #endif
  10173. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10174. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10175. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10176. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10177. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10178. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10179. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10180. class AudioIODevice;
  10181. class JUCE_API AudioIODeviceCallback
  10182. {
  10183. public:
  10184. virtual ~AudioIODeviceCallback() {}
  10185. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10186. int numInputChannels,
  10187. float** outputChannelData,
  10188. int numOutputChannels,
  10189. int numSamples) = 0;
  10190. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10191. virtual void audioDeviceStopped() = 0;
  10192. };
  10193. class JUCE_API AudioIODevice
  10194. {
  10195. public:
  10196. virtual ~AudioIODevice();
  10197. const String& getName() const throw() { return name; }
  10198. const String& getTypeName() const throw() { return typeName; }
  10199. virtual const StringArray getOutputChannelNames() = 0;
  10200. virtual const StringArray getInputChannelNames() = 0;
  10201. virtual int getNumSampleRates() = 0;
  10202. virtual double getSampleRate (int index) = 0;
  10203. virtual int getNumBufferSizesAvailable() = 0;
  10204. virtual int getBufferSizeSamples (int index) = 0;
  10205. virtual int getDefaultBufferSize() = 0;
  10206. virtual const String open (const BigInteger& inputChannels,
  10207. const BigInteger& outputChannels,
  10208. double sampleRate,
  10209. int bufferSizeSamples) = 0;
  10210. virtual void close() = 0;
  10211. virtual bool isOpen() = 0;
  10212. virtual void start (AudioIODeviceCallback* callback) = 0;
  10213. virtual void stop() = 0;
  10214. virtual bool isPlaying() = 0;
  10215. virtual const String getLastError() = 0;
  10216. virtual int getCurrentBufferSizeSamples() = 0;
  10217. virtual double getCurrentSampleRate() = 0;
  10218. virtual int getCurrentBitDepth() = 0;
  10219. virtual const BigInteger getActiveOutputChannels() const = 0;
  10220. virtual const BigInteger getActiveInputChannels() const = 0;
  10221. virtual int getOutputLatencyInSamples() = 0;
  10222. virtual int getInputLatencyInSamples() = 0;
  10223. virtual bool hasControlPanel() const;
  10224. virtual bool showControlPanel();
  10225. protected:
  10226. AudioIODevice (const String& deviceName,
  10227. const String& typeName);
  10228. String name, typeName;
  10229. };
  10230. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10231. /*** End of inlined file: juce_AudioIODevice.h ***/
  10232. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10233. {
  10234. public:
  10235. AudioSourcePlayer();
  10236. virtual ~AudioSourcePlayer();
  10237. void setSource (AudioSource* newSource);
  10238. AudioSource* getCurrentSource() const throw() { return source; }
  10239. void setGain (const float newGain) throw();
  10240. void audioDeviceIOCallback (const float** inputChannelData,
  10241. int totalNumInputChannels,
  10242. float** outputChannelData,
  10243. int totalNumOutputChannels,
  10244. int numSamples);
  10245. void audioDeviceAboutToStart (AudioIODevice* device);
  10246. void audioDeviceStopped();
  10247. juce_UseDebuggingNewOperator
  10248. private:
  10249. CriticalSection readLock;
  10250. AudioSource* source;
  10251. double sampleRate;
  10252. int bufferSize;
  10253. float* channels [128];
  10254. float* outputChans [128];
  10255. const float* inputChans [128];
  10256. AudioSampleBuffer tempBuffer;
  10257. float lastGain, gain;
  10258. AudioSourcePlayer (const AudioSourcePlayer&);
  10259. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10260. };
  10261. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10262. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10263. #endif
  10264. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10265. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10266. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10267. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10268. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10269. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10270. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10271. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10272. {
  10273. public:
  10274. BufferingAudioSource (PositionableAudioSource* source,
  10275. const bool deleteSourceWhenDeleted,
  10276. int numberOfSamplesToBuffer);
  10277. ~BufferingAudioSource();
  10278. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10279. void releaseResources();
  10280. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10281. void setNextReadPosition (int newPosition);
  10282. int getNextReadPosition() const;
  10283. int getTotalLength() const { return source->getTotalLength(); }
  10284. bool isLooping() const { return source->isLooping(); }
  10285. juce_UseDebuggingNewOperator
  10286. private:
  10287. PositionableAudioSource* source;
  10288. bool deleteSourceWhenDeleted;
  10289. int numberOfSamplesToBuffer;
  10290. AudioSampleBuffer buffer;
  10291. CriticalSection bufferStartPosLock;
  10292. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10293. bool wasSourceLooping;
  10294. double volatile sampleRate;
  10295. friend class SharedBufferingAudioSourceThread;
  10296. bool readNextBufferChunk();
  10297. void readBufferSection (int start, int length, int bufferOffset);
  10298. BufferingAudioSource (const BufferingAudioSource&);
  10299. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10300. };
  10301. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10302. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10303. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10304. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10305. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10306. class JUCE_API ResamplingAudioSource : public AudioSource
  10307. {
  10308. public:
  10309. ResamplingAudioSource (AudioSource* const inputSource,
  10310. const bool deleteInputWhenDeleted);
  10311. ~ResamplingAudioSource();
  10312. void setResamplingRatio (const double samplesInPerOutputSample);
  10313. double getResamplingRatio() const throw() { return ratio; }
  10314. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10315. void releaseResources();
  10316. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10317. juce_UseDebuggingNewOperator
  10318. private:
  10319. AudioSource* const input;
  10320. const bool deleteInputWhenDeleted;
  10321. double ratio, lastRatio;
  10322. AudioSampleBuffer buffer;
  10323. int bufferPos, sampsInBuffer;
  10324. double subSampleOffset;
  10325. double coefficients[6];
  10326. CriticalSection ratioLock;
  10327. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10328. void createLowPass (const double proportionalRate);
  10329. struct FilterState
  10330. {
  10331. double x1, x2, y1, y2;
  10332. };
  10333. FilterState filterStates[2];
  10334. void resetFilters();
  10335. void applyFilter (float* samples, int num, FilterState& fs);
  10336. ResamplingAudioSource (const ResamplingAudioSource&);
  10337. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10338. };
  10339. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10340. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10341. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10342. public ChangeBroadcaster
  10343. {
  10344. public:
  10345. AudioTransportSource();
  10346. ~AudioTransportSource();
  10347. void setSource (PositionableAudioSource* const newSource,
  10348. int readAheadBufferSize = 0,
  10349. double sourceSampleRateToCorrectFor = 0.0);
  10350. void setPosition (double newPosition);
  10351. double getCurrentPosition() const;
  10352. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10353. void start();
  10354. void stop();
  10355. bool isPlaying() const throw() { return playing; }
  10356. void setGain (const float newGain) throw();
  10357. float getGain() const throw() { return gain; }
  10358. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10359. void releaseResources();
  10360. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10361. void setNextReadPosition (int newPosition);
  10362. int getNextReadPosition() const;
  10363. int getTotalLength() const;
  10364. bool isLooping() const;
  10365. juce_UseDebuggingNewOperator
  10366. private:
  10367. PositionableAudioSource* source;
  10368. ResamplingAudioSource* resamplerSource;
  10369. BufferingAudioSource* bufferingSource;
  10370. PositionableAudioSource* positionableSource;
  10371. AudioSource* masterSource;
  10372. CriticalSection callbackLock;
  10373. float volatile gain, lastGain;
  10374. bool volatile playing, stopped;
  10375. double sampleRate, sourceSampleRate;
  10376. int blockSize, readAheadBufferSize;
  10377. bool isPrepared, inputStreamEOF;
  10378. AudioTransportSource (const AudioTransportSource&);
  10379. AudioTransportSource& operator= (const AudioTransportSource&);
  10380. };
  10381. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10382. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10383. #endif
  10384. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10385. #endif
  10386. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10387. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10388. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10389. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10390. class ChannelRemappingAudioSource : public AudioSource
  10391. {
  10392. public:
  10393. ChannelRemappingAudioSource (AudioSource* const source,
  10394. const bool deleteSourceWhenDeleted);
  10395. ~ChannelRemappingAudioSource();
  10396. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10397. void clearAllMappings() throw();
  10398. void setInputChannelMapping (const int destChannelIndex,
  10399. const int sourceChannelIndex) throw();
  10400. void setOutputChannelMapping (const int sourceChannelIndex,
  10401. const int destChannelIndex) throw();
  10402. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10403. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10404. XmlElement* createXml() const throw();
  10405. void restoreFromXml (const XmlElement& e) throw();
  10406. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10407. void releaseResources();
  10408. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10409. juce_UseDebuggingNewOperator
  10410. private:
  10411. int requiredNumberOfChannels;
  10412. Array <int> remappedInputs, remappedOutputs;
  10413. AudioSource* const source;
  10414. const bool deleteSourceWhenDeleted;
  10415. AudioSampleBuffer buffer;
  10416. AudioSourceChannelInfo remappedInfo;
  10417. CriticalSection lock;
  10418. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10419. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10420. };
  10421. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10422. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10423. #endif
  10424. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10425. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10426. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10427. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10428. /*** Start of inlined file: juce_IIRFilter.h ***/
  10429. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10430. #define __JUCE_IIRFILTER_JUCEHEADER__
  10431. class JUCE_API IIRFilter
  10432. {
  10433. public:
  10434. IIRFilter() throw();
  10435. IIRFilter (const IIRFilter& other) throw();
  10436. ~IIRFilter() throw();
  10437. void reset() throw();
  10438. void processSamples (float* const samples,
  10439. const int numSamples) throw();
  10440. float processSingleSampleRaw (const float sample) throw();
  10441. void makeLowPass (const double sampleRate,
  10442. const double frequency) throw();
  10443. void makeHighPass (const double sampleRate,
  10444. const double frequency) throw();
  10445. void makeLowShelf (const double sampleRate,
  10446. const double cutOffFrequency,
  10447. const double Q,
  10448. const float gainFactor) throw();
  10449. void makeHighShelf (const double sampleRate,
  10450. const double cutOffFrequency,
  10451. const double Q,
  10452. const float gainFactor) throw();
  10453. void makeBandPass (const double sampleRate,
  10454. const double centreFrequency,
  10455. const double Q,
  10456. const float gainFactor) throw();
  10457. void makeInactive() throw();
  10458. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10459. juce_UseDebuggingNewOperator
  10460. protected:
  10461. CriticalSection processLock;
  10462. void setCoefficients (double c1, double c2, double c3,
  10463. double c4, double c5, double c6) throw();
  10464. bool active;
  10465. float coefficients[6];
  10466. float x1, x2, y1, y2;
  10467. // (use the copyCoefficientsFrom() method instead of this operator)
  10468. IIRFilter& operator= (const IIRFilter&);
  10469. };
  10470. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10471. /*** End of inlined file: juce_IIRFilter.h ***/
  10472. class JUCE_API IIRFilterAudioSource : public AudioSource
  10473. {
  10474. public:
  10475. IIRFilterAudioSource (AudioSource* const inputSource,
  10476. const bool deleteInputWhenDeleted);
  10477. ~IIRFilterAudioSource();
  10478. void setFilterParameters (const IIRFilter& newSettings);
  10479. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10480. void releaseResources();
  10481. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10482. juce_UseDebuggingNewOperator
  10483. private:
  10484. AudioSource* const input;
  10485. const bool deleteInputWhenDeleted;
  10486. OwnedArray <IIRFilter> iirFilters;
  10487. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10488. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10489. };
  10490. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10491. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10492. #endif
  10493. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10494. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10495. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10496. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10497. class JUCE_API MixerAudioSource : public AudioSource
  10498. {
  10499. public:
  10500. MixerAudioSource();
  10501. ~MixerAudioSource();
  10502. void addInputSource (AudioSource* newInput,
  10503. const bool deleteWhenRemoved);
  10504. void removeInputSource (AudioSource* input,
  10505. const bool deleteSource);
  10506. void removeAllInputs();
  10507. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10508. void releaseResources();
  10509. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10510. juce_UseDebuggingNewOperator
  10511. private:
  10512. VoidArray inputs;
  10513. BigInteger inputsToDelete;
  10514. CriticalSection lock;
  10515. AudioSampleBuffer tempBuffer;
  10516. double currentSampleRate;
  10517. int bufferSizeExpected;
  10518. MixerAudioSource (const MixerAudioSource&);
  10519. MixerAudioSource& operator= (const MixerAudioSource&);
  10520. };
  10521. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10522. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10523. #endif
  10524. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10525. #endif
  10526. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10527. #endif
  10528. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10529. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10530. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10531. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10532. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10533. {
  10534. public:
  10535. ToneGeneratorAudioSource();
  10536. ~ToneGeneratorAudioSource();
  10537. void setAmplitude (const float newAmplitude);
  10538. void setFrequency (const double newFrequencyHz);
  10539. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10540. void releaseResources();
  10541. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10542. juce_UseDebuggingNewOperator
  10543. private:
  10544. double frequency, sampleRate;
  10545. double currentPhase, phasePerSample;
  10546. float amplitude;
  10547. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10548. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10549. };
  10550. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10551. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10552. #endif
  10553. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10554. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10555. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10556. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10557. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10558. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10559. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10560. class AudioDeviceManager;
  10561. class Component;
  10562. class JUCE_API AudioIODeviceType
  10563. {
  10564. public:
  10565. const String& getTypeName() const throw() { return typeName; }
  10566. virtual void scanForDevices() = 0;
  10567. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10568. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10569. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10570. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10571. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10572. const String& inputDeviceName) = 0;
  10573. struct DeviceSetupDetails
  10574. {
  10575. AudioDeviceManager* manager;
  10576. int minNumInputChannels, maxNumInputChannels;
  10577. int minNumOutputChannels, maxNumOutputChannels;
  10578. bool useStereoPairs;
  10579. };
  10580. virtual ~AudioIODeviceType();
  10581. protected:
  10582. AudioIODeviceType (const tchar* const typeName);
  10583. private:
  10584. String typeName;
  10585. AudioIODeviceType (const AudioIODeviceType&);
  10586. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10587. };
  10588. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10589. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10590. /*** Start of inlined file: juce_MidiInput.h ***/
  10591. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10592. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10593. /*** Start of inlined file: juce_MidiMessage.h ***/
  10594. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10595. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10596. class JUCE_API MidiMessage
  10597. {
  10598. public:
  10599. MidiMessage (const int byte1,
  10600. const int byte2,
  10601. const int byte3,
  10602. const double timeStamp = 0) throw();
  10603. MidiMessage (const int byte1,
  10604. const int byte2,
  10605. const double timeStamp = 0) throw();
  10606. MidiMessage (const int byte1,
  10607. const double timeStamp = 0) throw();
  10608. MidiMessage (const uint8* const data,
  10609. const int dataSize,
  10610. const double timeStamp = 0) throw();
  10611. MidiMessage (const uint8* data,
  10612. int size,
  10613. int& numBytesUsed,
  10614. uint8 lastStatusByte,
  10615. double timeStamp = 0) throw();
  10616. MidiMessage (const MidiMessage& other) throw();
  10617. MidiMessage (const MidiMessage& other,
  10618. const double newTimeStamp) throw();
  10619. ~MidiMessage() throw();
  10620. MidiMessage& operator= (const MidiMessage& other) throw();
  10621. uint8* getRawData() const throw() { return data; }
  10622. int getRawDataSize() const throw() { return size; }
  10623. double getTimeStamp() const throw() { return timeStamp; }
  10624. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10625. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10626. int getChannel() const throw();
  10627. bool isForChannel (const int channelNumber) const throw();
  10628. void setChannel (const int newChannelNumber) throw();
  10629. bool isSysEx() const throw();
  10630. const uint8* getSysExData() const throw();
  10631. int getSysExDataSize() const throw();
  10632. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10633. static const MidiMessage noteOn (const int channel,
  10634. const int noteNumber,
  10635. const float velocity) throw();
  10636. static const MidiMessage noteOn (const int channel,
  10637. const int noteNumber,
  10638. const uint8 velocity) throw();
  10639. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10640. static const MidiMessage noteOff (const int channel,
  10641. const int noteNumber) throw();
  10642. bool isNoteOnOrOff() const throw();
  10643. int getNoteNumber() const throw();
  10644. void setNoteNumber (const int newNoteNumber) throw();
  10645. uint8 getVelocity() const throw();
  10646. float getFloatVelocity() const throw();
  10647. void setVelocity (const float newVelocity) throw();
  10648. void multiplyVelocity (const float scaleFactor) throw();
  10649. bool isProgramChange() const throw();
  10650. int getProgramChangeNumber() const throw();
  10651. static const MidiMessage programChange (const int channel,
  10652. const int programNumber) throw();
  10653. bool isPitchWheel() const throw();
  10654. int getPitchWheelValue() const throw();
  10655. static const MidiMessage pitchWheel (const int channel,
  10656. const int position) throw();
  10657. bool isAftertouch() const throw();
  10658. int getAfterTouchValue() const throw();
  10659. static const MidiMessage aftertouchChange (const int channel,
  10660. const int noteNumber,
  10661. const int aftertouchAmount) throw();
  10662. bool isChannelPressure() const throw();
  10663. int getChannelPressureValue() const throw();
  10664. static const MidiMessage channelPressureChange (const int channel,
  10665. const int pressure) throw();
  10666. bool isController() const throw();
  10667. int getControllerNumber() const throw();
  10668. int getControllerValue() const throw();
  10669. static const MidiMessage controllerEvent (const int channel,
  10670. const int controllerType,
  10671. const int value) throw();
  10672. bool isAllNotesOff() const throw();
  10673. bool isAllSoundOff() const throw();
  10674. static const MidiMessage allNotesOff (const int channel) throw();
  10675. static const MidiMessage allSoundOff (const int channel) throw();
  10676. static const MidiMessage allControllersOff (const int channel) throw();
  10677. bool isMetaEvent() const throw();
  10678. int getMetaEventType() const throw();
  10679. const uint8* getMetaEventData() const throw();
  10680. int getMetaEventLength() const throw();
  10681. bool isTrackMetaEvent() const throw();
  10682. bool isEndOfTrackMetaEvent() const throw();
  10683. static const MidiMessage endOfTrack() throw();
  10684. bool isTrackNameEvent() const throw();
  10685. bool isTextMetaEvent() const throw();
  10686. const String getTextFromTextMetaEvent() const throw();
  10687. bool isTempoMetaEvent() const throw();
  10688. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10689. double getTempoSecondsPerQuarterNote() const throw();
  10690. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10691. bool isTimeSignatureMetaEvent() const throw();
  10692. void getTimeSignatureInfo (int& numerator,
  10693. int& denominator) const throw();
  10694. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10695. const int denominator) throw();
  10696. bool isKeySignatureMetaEvent() const throw();
  10697. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10698. bool isMidiChannelMetaEvent() const throw();
  10699. int getMidiChannelMetaEventChannel() const throw();
  10700. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10701. bool isActiveSense() const throw();
  10702. bool isMidiStart() const throw();
  10703. static const MidiMessage midiStart() throw();
  10704. bool isMidiContinue() const throw();
  10705. static const MidiMessage midiContinue() throw();
  10706. bool isMidiStop() const throw();
  10707. static const MidiMessage midiStop() throw();
  10708. bool isMidiClock() const throw();
  10709. static const MidiMessage midiClock() throw();
  10710. bool isSongPositionPointer() const throw();
  10711. int getSongPositionPointerMidiBeat() const throw();
  10712. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10713. bool isQuarterFrame() const throw();
  10714. int getQuarterFrameSequenceNumber() const throw();
  10715. int getQuarterFrameValue() const throw();
  10716. static const MidiMessage quarterFrame (const int sequenceNumber,
  10717. const int value) throw();
  10718. enum SmpteTimecodeType
  10719. {
  10720. fps24 = 0,
  10721. fps25 = 1,
  10722. fps30drop = 2,
  10723. fps30 = 3
  10724. };
  10725. bool isFullFrame() const throw();
  10726. void getFullFrameParameters (int& hours,
  10727. int& minutes,
  10728. int& seconds,
  10729. int& frames,
  10730. SmpteTimecodeType& timecodeType) const throw();
  10731. static const MidiMessage fullFrame (const int hours,
  10732. const int minutes,
  10733. const int seconds,
  10734. const int frames,
  10735. SmpteTimecodeType timecodeType);
  10736. enum MidiMachineControlCommand
  10737. {
  10738. mmc_stop = 1,
  10739. mmc_play = 2,
  10740. mmc_deferredplay = 3,
  10741. mmc_fastforward = 4,
  10742. mmc_rewind = 5,
  10743. mmc_recordStart = 6,
  10744. mmc_recordStop = 7,
  10745. mmc_pause = 9
  10746. };
  10747. bool isMidiMachineControlMessage() const throw();
  10748. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10749. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10750. bool isMidiMachineControlGoto (int& hours,
  10751. int& minutes,
  10752. int& seconds,
  10753. int& frames) const throw();
  10754. static const MidiMessage midiMachineControlGoto (int hours,
  10755. int minutes,
  10756. int seconds,
  10757. int frames);
  10758. static const MidiMessage masterVolume (const float volume) throw();
  10759. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10760. const int dataSize) throw();
  10761. static int readVariableLengthVal (const uint8* data,
  10762. int& numBytesUsed) throw();
  10763. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10764. static const String getMidiNoteName (int noteNumber,
  10765. bool useSharps,
  10766. bool includeOctaveNumber,
  10767. int octaveNumForMiddleC) throw();
  10768. static const double getMidiNoteInHertz (int noteNumber) throw();
  10769. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10770. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10771. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10772. static const String getControllerName (int controllerNumber) throw();
  10773. juce_UseDebuggingNewOperator
  10774. private:
  10775. double timeStamp;
  10776. uint8* data;
  10777. int message, size;
  10778. };
  10779. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10780. /*** End of inlined file: juce_MidiMessage.h ***/
  10781. class MidiInput;
  10782. class JUCE_API MidiInputCallback
  10783. {
  10784. public:
  10785. virtual ~MidiInputCallback() {}
  10786. virtual void handleIncomingMidiMessage (MidiInput* source,
  10787. const MidiMessage& message) = 0;
  10788. virtual void handlePartialSysexMessage (MidiInput* source,
  10789. const uint8* messageData,
  10790. const int numBytesSoFar,
  10791. const double timestamp)
  10792. {
  10793. // (this bit is just to avoid compiler warnings about unused variables)
  10794. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10795. }
  10796. };
  10797. class JUCE_API MidiInput
  10798. {
  10799. public:
  10800. static const StringArray getDevices();
  10801. static int getDefaultDeviceIndex();
  10802. static MidiInput* openDevice (int deviceIndex,
  10803. MidiInputCallback* callback);
  10804. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10805. static MidiInput* createNewDevice (const String& deviceName,
  10806. MidiInputCallback* callback);
  10807. #endif
  10808. virtual ~MidiInput();
  10809. virtual const String getName() const throw() { return name; }
  10810. virtual void setName (const String& newName) throw() { name = newName; }
  10811. virtual void start();
  10812. virtual void stop();
  10813. juce_UseDebuggingNewOperator
  10814. protected:
  10815. String name;
  10816. void* internal;
  10817. MidiInput (const String& name);
  10818. private:
  10819. MidiInput (const MidiInput&);
  10820. MidiInput& operator= (const MidiInput&);
  10821. };
  10822. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10823. /*** End of inlined file: juce_MidiInput.h ***/
  10824. /*** Start of inlined file: juce_MidiOutput.h ***/
  10825. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10826. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10827. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10828. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10829. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10830. class JUCE_API MidiBuffer
  10831. {
  10832. public:
  10833. MidiBuffer() throw();
  10834. MidiBuffer (const MidiMessage& message) throw();
  10835. MidiBuffer (const MidiBuffer& other) throw();
  10836. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10837. ~MidiBuffer() throw();
  10838. void clear() throw();
  10839. void clear (const int start,
  10840. const int numSamples) throw();
  10841. bool isEmpty() const throw();
  10842. int getNumEvents() const throw();
  10843. void addEvent (const MidiMessage& midiMessage,
  10844. const int sampleNumber) throw();
  10845. void addEvent (const uint8* const rawMidiData,
  10846. const int maxBytesOfMidiData,
  10847. const int sampleNumber) throw();
  10848. void addEvents (const MidiBuffer& otherBuffer,
  10849. const int startSample,
  10850. const int numSamples,
  10851. const int sampleDeltaToAdd) throw();
  10852. int getFirstEventTime() const throw();
  10853. int getLastEventTime() const throw();
  10854. void swap (MidiBuffer& other);
  10855. class Iterator
  10856. {
  10857. public:
  10858. Iterator (const MidiBuffer& buffer) throw();
  10859. ~Iterator() throw();
  10860. void setNextSamplePosition (const int samplePosition) throw();
  10861. bool getNextEvent (MidiMessage& result,
  10862. int& samplePosition) throw();
  10863. bool getNextEvent (const uint8* &midiData,
  10864. int& numBytesOfMidiData,
  10865. int& samplePosition) throw();
  10866. juce_UseDebuggingNewOperator
  10867. private:
  10868. const MidiBuffer& buffer;
  10869. const uint8* data;
  10870. Iterator (const Iterator&);
  10871. Iterator& operator= (const Iterator&);
  10872. };
  10873. juce_UseDebuggingNewOperator
  10874. private:
  10875. friend class MidiBuffer::Iterator;
  10876. MemoryBlock data;
  10877. int bytesUsed;
  10878. uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
  10879. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10880. };
  10881. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10882. /*** End of inlined file: juce_MidiBuffer.h ***/
  10883. class JUCE_API MidiOutput : private Thread
  10884. {
  10885. public:
  10886. static const StringArray getDevices();
  10887. static int getDefaultDeviceIndex();
  10888. static MidiOutput* openDevice (int deviceIndex);
  10889. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10890. static MidiOutput* createNewDevice (const String& deviceName);
  10891. #endif
  10892. virtual ~MidiOutput();
  10893. virtual void sendMessageNow (const MidiMessage& message);
  10894. virtual void reset();
  10895. virtual bool getVolume (float& leftVol,
  10896. float& rightVol);
  10897. virtual void setVolume (float leftVol,
  10898. float rightVol);
  10899. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10900. const double millisecondCounterToStartAt,
  10901. double samplesPerSecondForBuffer);
  10902. virtual void clearAllPendingMessages();
  10903. virtual void startBackgroundThread();
  10904. virtual void stopBackgroundThread();
  10905. juce_UseDebuggingNewOperator
  10906. protected:
  10907. void* internal;
  10908. struct PendingMessage
  10909. {
  10910. PendingMessage (const uint8* data, int len, double sampleNumber);
  10911. MidiMessage message;
  10912. PendingMessage* next;
  10913. juce_UseDebuggingNewOperator
  10914. };
  10915. CriticalSection lock;
  10916. PendingMessage* firstMessage;
  10917. MidiOutput();
  10918. void run();
  10919. private:
  10920. MidiOutput (const MidiOutput&);
  10921. MidiOutput& operator= (const MidiOutput&);
  10922. };
  10923. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10924. /*** End of inlined file: juce_MidiOutput.h ***/
  10925. /*** Start of inlined file: juce_ComboBox.h ***/
  10926. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10927. #define __JUCE_COMBOBOX_JUCEHEADER__
  10928. /*** Start of inlined file: juce_Label.h ***/
  10929. #ifndef __JUCE_LABEL_JUCEHEADER__
  10930. #define __JUCE_LABEL_JUCEHEADER__
  10931. /*** Start of inlined file: juce_TextEditor.h ***/
  10932. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10933. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10934. /*** Start of inlined file: juce_Viewport.h ***/
  10935. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10936. #define __JUCE_VIEWPORT_JUCEHEADER__
  10937. /*** Start of inlined file: juce_ScrollBar.h ***/
  10938. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10939. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10940. /*** Start of inlined file: juce_Button.h ***/
  10941. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10942. #define __JUCE_BUTTON_JUCEHEADER__
  10943. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10944. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10945. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10946. /*** Start of inlined file: juce_TooltipClient.h ***/
  10947. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10948. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10949. class JUCE_API TooltipClient
  10950. {
  10951. public:
  10952. virtual ~TooltipClient() {}
  10953. virtual const String getTooltip() = 0;
  10954. };
  10955. class JUCE_API SettableTooltipClient : public TooltipClient
  10956. {
  10957. public:
  10958. virtual ~SettableTooltipClient() {}
  10959. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10960. virtual const String getTooltip() { return tooltipString; }
  10961. juce_UseDebuggingNewOperator
  10962. protected:
  10963. String tooltipString;
  10964. };
  10965. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10966. /*** End of inlined file: juce_TooltipClient.h ***/
  10967. class JUCE_API TooltipWindow : public Component,
  10968. private Timer
  10969. {
  10970. public:
  10971. TooltipWindow (Component* parentComponent = 0,
  10972. const int millisecondsBeforeTipAppears = 700);
  10973. ~TooltipWindow();
  10974. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10975. enum ColourIds
  10976. {
  10977. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10978. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10979. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10980. };
  10981. juce_UseDebuggingNewOperator
  10982. private:
  10983. int millisecondsBeforeTipAppears;
  10984. Point<int> lastMousePos;
  10985. int mouseClicks;
  10986. unsigned int lastCompChangeTime, lastHideTime;
  10987. Component* lastComponentUnderMouse;
  10988. bool changedCompsSinceShown;
  10989. String tipShowing, lastTipUnderMouse;
  10990. void paint (Graphics& g);
  10991. void mouseEnter (const MouseEvent& e);
  10992. void timerCallback();
  10993. static const String getTipFor (Component* const c);
  10994. void showFor (const String& tip);
  10995. void hide();
  10996. TooltipWindow (const TooltipWindow&);
  10997. TooltipWindow& operator= (const TooltipWindow&);
  10998. };
  10999. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11000. /*** End of inlined file: juce_TooltipWindow.h ***/
  11001. class Button;
  11002. class JUCE_API ButtonListener
  11003. {
  11004. public:
  11005. virtual ~ButtonListener() {}
  11006. virtual void buttonClicked (Button* button) = 0;
  11007. virtual void buttonStateChanged (Button*) {}
  11008. };
  11009. class JUCE_API Button : public Component,
  11010. public SettableTooltipClient,
  11011. public ApplicationCommandManagerListener,
  11012. public Value::Listener,
  11013. private KeyListener
  11014. {
  11015. protected:
  11016. Button (const String& buttonName);
  11017. public:
  11018. virtual ~Button();
  11019. void setButtonText (const String& newText);
  11020. const String getButtonText() const { return text; }
  11021. bool isDown() const throw();
  11022. bool isOver() const throw();
  11023. void setToggleState (const bool shouldBeOn,
  11024. const bool sendChangeNotification);
  11025. bool getToggleState() const throw() { return isOn.getValue(); }
  11026. Value& getToggleStateValue() { return isOn; }
  11027. void setClickingTogglesState (const bool shouldToggle) throw();
  11028. bool getClickingTogglesState() const throw();
  11029. void setRadioGroupId (const int newGroupId);
  11030. int getRadioGroupId() const throw() { return radioGroupId; }
  11031. void addButtonListener (ButtonListener* const newListener);
  11032. void removeButtonListener (ButtonListener* const listener);
  11033. virtual void triggerClick();
  11034. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11035. const int commandID,
  11036. const bool generateTooltip);
  11037. int getCommandID() const throw() { return commandID; }
  11038. void addShortcut (const KeyPress& key);
  11039. void clearShortcuts();
  11040. bool isRegisteredForShortcut (const KeyPress& key) const;
  11041. void setRepeatSpeed (const int initialDelayInMillisecs,
  11042. const int repeatDelayInMillisecs,
  11043. const int minimumDelayInMillisecs = -1) throw();
  11044. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  11045. uint32 getMillisecondsSinceButtonDown() const throw();
  11046. void setVisible (bool shouldBeVisible);
  11047. void setTooltip (const String& newTooltip);
  11048. // (implementation of the TooltipClient method)
  11049. const String getTooltip();
  11050. enum ConnectedEdgeFlags
  11051. {
  11052. ConnectedOnLeft = 1,
  11053. ConnectedOnRight = 2,
  11054. ConnectedOnTop = 4,
  11055. ConnectedOnBottom = 8
  11056. };
  11057. void setConnectedEdges (const int connectedEdgeFlags);
  11058. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11059. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11060. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11061. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11062. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11063. enum ButtonState
  11064. {
  11065. buttonNormal,
  11066. buttonOver,
  11067. buttonDown
  11068. };
  11069. void setState (const ButtonState newState);
  11070. juce_UseDebuggingNewOperator
  11071. protected:
  11072. virtual void clicked();
  11073. virtual void clicked (const ModifierKeys& modifiers);
  11074. virtual void paintButton (Graphics& g,
  11075. bool isMouseOverButton,
  11076. bool isButtonDown) = 0;
  11077. virtual void buttonStateChanged();
  11078. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11079. void handleCommandMessage (int commandId);
  11080. void mouseEnter (const MouseEvent& e);
  11081. void mouseExit (const MouseEvent& e);
  11082. void mouseDown (const MouseEvent& e);
  11083. void mouseDrag (const MouseEvent& e);
  11084. void mouseUp (const MouseEvent& e);
  11085. bool keyPressed (const KeyPress& key);
  11086. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11087. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  11088. void paint (Graphics& g);
  11089. void parentHierarchyChanged();
  11090. void focusGained (FocusChangeType cause);
  11091. void focusLost (FocusChangeType cause);
  11092. void enablementChanged();
  11093. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11094. void applicationCommandListChanged();
  11095. void valueChanged (Value& value);
  11096. private:
  11097. Array <KeyPress> shortcuts;
  11098. Component::SafePointer<Component> keySource;
  11099. String text;
  11100. ListenerList <ButtonListener> buttonListeners;
  11101. class RepeatTimer;
  11102. friend class RepeatTimer;
  11103. friend class ScopedPointer <RepeatTimer>;
  11104. ScopedPointer <RepeatTimer> repeatTimer;
  11105. uint32 buttonPressTime, lastTimeCallbackTime;
  11106. ApplicationCommandManager* commandManagerToUse;
  11107. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11108. int radioGroupId, commandID, connectedEdgeFlags;
  11109. ButtonState buttonState;
  11110. Value isOn;
  11111. bool lastToggleState : 1;
  11112. bool clickTogglesState : 1;
  11113. bool needsToRelease : 1;
  11114. bool needsRepainting : 1;
  11115. bool isKeyDown : 1;
  11116. bool triggerOnMouseDown : 1;
  11117. bool generateTooltip : 1;
  11118. void repeatTimerCallback();
  11119. RepeatTimer& getRepeatTimer();
  11120. ButtonState updateState (const MouseEvent* const e);
  11121. bool isShortcutPressed() const;
  11122. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11123. void flashButtonState();
  11124. void sendClickMessage (const ModifierKeys& modifiers);
  11125. void sendStateMessage();
  11126. Button (const Button&);
  11127. Button& operator= (const Button&);
  11128. };
  11129. #endif // __JUCE_BUTTON_JUCEHEADER__
  11130. /*** End of inlined file: juce_Button.h ***/
  11131. class ScrollBar;
  11132. class JUCE_API ScrollBarListener
  11133. {
  11134. public:
  11135. virtual ~ScrollBarListener() {}
  11136. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11137. double newRangeStart) = 0;
  11138. };
  11139. class JUCE_API ScrollBar : public Component,
  11140. public AsyncUpdater,
  11141. private Timer
  11142. {
  11143. public:
  11144. ScrollBar (const bool isVertical,
  11145. const bool buttonsAreVisible = true);
  11146. ~ScrollBar();
  11147. bool isVertical() const throw() { return vertical; }
  11148. void setOrientation (const bool shouldBeVertical) throw();
  11149. void setButtonVisibility (const bool buttonsAreVisible);
  11150. void setAutoHide (const bool shouldHideWhenFullRange);
  11151. void setRangeLimits (const double minimum,
  11152. const double maximum) throw();
  11153. double getMinimumRangeLimit() const throw() { return minimum; }
  11154. double getMaximumRangeLimit() const throw() { return maximum; }
  11155. void setCurrentRange (double newStart,
  11156. double newSize) throw();
  11157. void setCurrentRangeStart (double newStart) throw();
  11158. double getCurrentRangeStart() const throw() { return rangeStart; }
  11159. double getCurrentRangeSize() const throw() { return rangeSize; }
  11160. void setSingleStepSize (const double newSingleStepSize) throw();
  11161. void moveScrollbarInSteps (const int howManySteps) throw();
  11162. void moveScrollbarInPages (const int howManyPages) throw();
  11163. void scrollToTop() throw();
  11164. void scrollToBottom() throw();
  11165. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  11166. const int repeatDelayInMillisecs,
  11167. const int minimumDelayInMillisecs = -1) throw();
  11168. enum ColourIds
  11169. {
  11170. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11171. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11172. 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. */
  11173. };
  11174. void addListener (ScrollBarListener* const listener) throw();
  11175. void removeListener (ScrollBarListener* const listener) throw();
  11176. bool keyPressed (const KeyPress& key);
  11177. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11178. void lookAndFeelChanged();
  11179. void handleAsyncUpdate();
  11180. void mouseDown (const MouseEvent& e);
  11181. void mouseDrag (const MouseEvent& e);
  11182. void mouseUp (const MouseEvent& e);
  11183. void paint (Graphics& g);
  11184. void resized();
  11185. juce_UseDebuggingNewOperator
  11186. private:
  11187. double minimum, maximum;
  11188. double rangeStart, rangeSize;
  11189. double singleStepSize, dragStartRange;
  11190. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11191. int dragStartMousePos, lastMousePos;
  11192. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11193. bool vertical, isDraggingThumb, alwaysVisible;
  11194. Button* upButton;
  11195. Button* downButton;
  11196. ListenerList <ScrollBarListener> listeners;
  11197. void updateThumbPosition() throw();
  11198. void timerCallback();
  11199. ScrollBar (const ScrollBar&);
  11200. ScrollBar& operator= (const ScrollBar&);
  11201. };
  11202. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11203. /*** End of inlined file: juce_ScrollBar.h ***/
  11204. class JUCE_API Viewport : public Component,
  11205. private ComponentListener,
  11206. private ScrollBarListener
  11207. {
  11208. public:
  11209. Viewport (const String& componentName = String::empty);
  11210. ~Viewport();
  11211. void setViewedComponent (Component* const newViewedComponent);
  11212. Component* getViewedComponent() const throw() { return contentComp; }
  11213. void setViewPosition (const int xPixelsOffset,
  11214. const int yPixelsOffset);
  11215. void setViewPositionProportionately (const double proportionX,
  11216. const double proportionY);
  11217. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11218. int getViewPositionX() const throw() { return lastVX; }
  11219. int getViewPositionY() const throw() { return lastVY; }
  11220. int getViewWidth() const throw() { return lastVW; }
  11221. int getViewHeight() const throw() { return lastVH; }
  11222. int getMaximumVisibleWidth() const throw();
  11223. int getMaximumVisibleHeight() const throw();
  11224. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11225. int visibleW, int visibleH);
  11226. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11227. const bool showHorizontalScrollbarIfNeeded);
  11228. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11229. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11230. void setScrollBarThickness (const int thickness);
  11231. int getScrollBarThickness() const throw();
  11232. void setSingleStepSizes (const int stepX, const int stepY);
  11233. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11234. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11235. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11236. juce_UseDebuggingNewOperator
  11237. void resized();
  11238. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11239. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11240. bool keyPressed (const KeyPress& key);
  11241. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11242. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11243. private:
  11244. Component::SafePointer<Component> contentComp;
  11245. int lastVX, lastVY, lastVW, lastVH;
  11246. int scrollBarThickness;
  11247. int singleStepX, singleStepY;
  11248. bool showHScrollbar, showVScrollbar;
  11249. Component* contentHolder;
  11250. ScrollBar* verticalScrollBar;
  11251. ScrollBar* horizontalScrollBar;
  11252. void updateVisibleRegion();
  11253. Viewport (const Viewport&);
  11254. Viewport& operator= (const Viewport&);
  11255. };
  11256. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11257. /*** End of inlined file: juce_Viewport.h ***/
  11258. /*** Start of inlined file: juce_PopupMenu.h ***/
  11259. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11260. #define __JUCE_POPUPMENU_JUCEHEADER__
  11261. class PopupMenuCustomComponent;
  11262. class JUCE_API PopupMenu
  11263. {
  11264. public:
  11265. PopupMenu();
  11266. PopupMenu (const PopupMenu& other);
  11267. ~PopupMenu();
  11268. PopupMenu& operator= (const PopupMenu& other);
  11269. void clear();
  11270. void addItem (const int itemResultId,
  11271. const String& itemText,
  11272. const bool isActive = true,
  11273. const bool isTicked = false,
  11274. const Image* const iconToUse = 0);
  11275. void addCommandItem (ApplicationCommandManager* commandManager,
  11276. const int commandID,
  11277. const String& displayName = String::empty);
  11278. void addColouredItem (const int itemResultId,
  11279. const String& itemText,
  11280. const Colour& itemTextColour,
  11281. const bool isActive = true,
  11282. const bool isTicked = false,
  11283. const Image* const iconToUse = 0);
  11284. void addCustomItem (const int itemResultId,
  11285. PopupMenuCustomComponent* const customComponent);
  11286. void addCustomItem (const int itemResultId,
  11287. Component* customComponent,
  11288. int idealWidth, int idealHeight,
  11289. const bool triggerMenuItemAutomaticallyWhenClicked);
  11290. void addSubMenu (const String& subMenuName,
  11291. const PopupMenu& subMenu,
  11292. const bool isActive = true,
  11293. Image* const iconToUse = 0,
  11294. const bool isTicked = false);
  11295. void addSeparator();
  11296. void addSectionHeader (const String& title);
  11297. int getNumItems() const throw();
  11298. bool containsCommandItem (const int commandID) const;
  11299. bool containsAnyActiveItems() const throw();
  11300. int show (const int itemIdThatMustBeVisible = 0,
  11301. const int minimumWidth = 0,
  11302. const int maximumNumColumns = 0,
  11303. const int standardItemHeight = 0);
  11304. int showAt (const int screenX,
  11305. const int screenY,
  11306. const int itemIdThatMustBeVisible = 0,
  11307. const int minimumWidth = 0,
  11308. const int maximumNumColumns = 0,
  11309. const int standardItemHeight = 0);
  11310. int showAt (Component* componentToAttachTo,
  11311. const int itemIdThatMustBeVisible = 0,
  11312. const int minimumWidth = 0,
  11313. const int maximumNumColumns = 0,
  11314. const int standardItemHeight = 0);
  11315. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11316. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11317. enum ColourIds
  11318. {
  11319. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11320. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11321. colour is specified when the item is added). */
  11322. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11323. addSectionHeader() method). */
  11324. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11325. highlighted menu item. */
  11326. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11327. highlighted item. */
  11328. };
  11329. class JUCE_API MenuItemIterator
  11330. {
  11331. public:
  11332. MenuItemIterator (const PopupMenu& menu);
  11333. ~MenuItemIterator();
  11334. bool next();
  11335. String itemName;
  11336. const PopupMenu* subMenu;
  11337. int itemId;
  11338. bool isSeparator;
  11339. bool isTicked;
  11340. bool isEnabled;
  11341. bool isCustomComponent;
  11342. bool isSectionHeader;
  11343. const Colour* customColour;
  11344. const Image* customImage;
  11345. ApplicationCommandManager* commandManager;
  11346. juce_UseDebuggingNewOperator
  11347. private:
  11348. const PopupMenu& menu;
  11349. int index;
  11350. MenuItemIterator (const MenuItemIterator&);
  11351. MenuItemIterator& operator= (const MenuItemIterator&);
  11352. };
  11353. juce_UseDebuggingNewOperator
  11354. private:
  11355. class Item;
  11356. class ItemComponent;
  11357. class Window;
  11358. friend class MenuItemIterator;
  11359. friend class ItemComponent;
  11360. friend class Window;
  11361. friend class PopupMenuCustomComponent;
  11362. friend class OwnedArray <Item>;
  11363. friend class ScopedPointer <Window>;
  11364. OwnedArray <Item> items;
  11365. LookAndFeel* lookAndFeel;
  11366. bool separatorPending;
  11367. void addSeparatorIfPending();
  11368. int showMenu (const int x, const int y, const int w, const int h,
  11369. const int itemIdThatMustBeVisible,
  11370. const int minimumWidth,
  11371. const int maximumNumColumns,
  11372. const int standardItemHeight,
  11373. const bool alignToRectangle,
  11374. Component* const componentAttachedTo);
  11375. friend class MenuBarComponent;
  11376. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11377. const int itemIdThatMustBeVisible,
  11378. const int minimumWidth,
  11379. const int maximumNumColumns,
  11380. const int standardItemHeight,
  11381. const bool alignToRectangle,
  11382. Component* menuBarComponent,
  11383. ApplicationCommandManager** managerOfChosenCommand,
  11384. Component* const componentAttachedTo);
  11385. };
  11386. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11387. /*** End of inlined file: juce_PopupMenu.h ***/
  11388. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11389. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11390. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11391. class JUCE_API TextInputTarget
  11392. {
  11393. public:
  11394. TextInputTarget() {}
  11395. virtual ~TextInputTarget() {}
  11396. virtual const Range<int> getHighlightedRegion() const = 0;
  11397. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11398. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11399. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11400. };
  11401. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11402. /*** End of inlined file: juce_TextInputTarget.h ***/
  11403. class TextEditor;
  11404. class TextHolderComponent;
  11405. class JUCE_API TextEditorListener
  11406. {
  11407. public:
  11408. virtual ~TextEditorListener() {}
  11409. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11410. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11411. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11412. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11413. };
  11414. class JUCE_API TextEditor : public Component,
  11415. public TextInputTarget,
  11416. public SettableTooltipClient
  11417. {
  11418. public:
  11419. TextEditor (const String& componentName = String::empty,
  11420. const tchar passwordCharacter = 0);
  11421. virtual ~TextEditor();
  11422. void setMultiLine (const bool shouldBeMultiLine,
  11423. const bool shouldWordWrap = true);
  11424. bool isMultiLine() const;
  11425. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11426. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11427. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11428. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11429. void setReadOnly (const bool shouldBeReadOnly);
  11430. bool isReadOnly() const;
  11431. void setCaretVisible (const bool shouldBeVisible);
  11432. bool isCaretVisible() const { return caretVisible; }
  11433. void setScrollbarsShown (bool shouldBeEnabled);
  11434. bool areScrollbarsShown() const { return scrollbarVisible; }
  11435. void setPasswordCharacter (const tchar passwordCharacter);
  11436. tchar getPasswordCharacter() const { return passwordCharacter; }
  11437. void setPopupMenuEnabled (const bool menuEnabled);
  11438. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11439. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11440. enum ColourIds
  11441. {
  11442. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11443. transparent if necessary. */
  11444. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11445. that because the editor can contain multiple colours, calling this
  11446. method won't change the colour of existing text - to do that, call
  11447. applyFontToAllText() after calling this method.*/
  11448. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11449. the text - this can be transparent if you don't want to show any
  11450. highlighting.*/
  11451. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11452. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11453. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11454. the edge of the component. */
  11455. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11456. the edge of the component when it has focus. */
  11457. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11458. around the edge of the editor. */
  11459. };
  11460. void setFont (const Font& newFont);
  11461. void applyFontToAllText (const Font& newFont);
  11462. const Font getFont() const;
  11463. void setSelectAllWhenFocused (const bool b);
  11464. void setInputRestrictions (const int maxTextLength,
  11465. const String& allowedCharacters = String::empty);
  11466. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11467. void setScrollBarThickness (const int newThicknessPixels);
  11468. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11469. void addListener (TextEditorListener* const newListener);
  11470. void removeListener (TextEditorListener* const listenerToRemove);
  11471. const String getText() const;
  11472. const String getTextInRange (const Range<int>& textRange) const;
  11473. bool isEmpty() const;
  11474. void setText (const String& newText,
  11475. const bool sendTextChangeMessage = true);
  11476. Value& getTextValue();
  11477. void insertTextAtCaret (const String& textToInsert);
  11478. void clear();
  11479. void cut();
  11480. void copy();
  11481. void paste();
  11482. void setCaretPosition (const int newIndex);
  11483. int getCaretPosition() const;
  11484. void scrollEditorToPositionCaret (const int desiredCaretX,
  11485. const int desiredCaretY);
  11486. const Rectangle<int> getCaretRectangle();
  11487. void setHighlightedRegion (const Range<int>& newSelection);
  11488. const Range<int> getHighlightedRegion() const { return selection; }
  11489. const String getHighlightedText() const;
  11490. int getTextIndexAt (const int x, const int y);
  11491. int getTotalNumChars() const;
  11492. int getTextWidth() const;
  11493. int getTextHeight() const;
  11494. void setIndents (const int newLeftIndent, const int newTopIndent);
  11495. void setBorder (const BorderSize& border);
  11496. const BorderSize getBorder() const;
  11497. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11498. void paint (Graphics& g);
  11499. void paintOverChildren (Graphics& g);
  11500. void mouseDown (const MouseEvent& e);
  11501. void mouseUp (const MouseEvent& e);
  11502. void mouseDrag (const MouseEvent& e);
  11503. void mouseDoubleClick (const MouseEvent& e);
  11504. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11505. bool keyPressed (const KeyPress& key);
  11506. bool keyStateChanged (const bool isKeyDown);
  11507. void focusGained (FocusChangeType cause);
  11508. void focusLost (FocusChangeType cause);
  11509. void resized();
  11510. void enablementChanged();
  11511. void colourChanged();
  11512. juce_UseDebuggingNewOperator
  11513. protected:
  11514. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11515. const MouseEvent* mouseClickEvent);
  11516. virtual void performPopupMenuAction (const int menuItemID);
  11517. void scrollToMakeSureCursorIsVisible();
  11518. void moveCaret (int newCaretPos);
  11519. void moveCursorTo (const int newPosition, const bool isSelecting);
  11520. void textChanged();
  11521. void newTransaction();
  11522. void doUndoRedo (const bool isRedo);
  11523. virtual void returnPressed();
  11524. virtual void escapePressed();
  11525. void handleCommandMessage (int commandId);
  11526. private:
  11527. ScopedPointer <Viewport> viewport;
  11528. TextHolderComponent* textHolder;
  11529. BorderSize borderSize;
  11530. bool readOnly : 1;
  11531. bool multiline : 1;
  11532. bool wordWrap : 1;
  11533. bool returnKeyStartsNewLine : 1;
  11534. bool caretVisible : 1;
  11535. bool popupMenuEnabled : 1;
  11536. bool selectAllTextWhenFocused : 1;
  11537. bool scrollbarVisible : 1;
  11538. bool wasFocused : 1;
  11539. bool caretFlashState : 1;
  11540. bool keepCursorOnScreen : 1;
  11541. bool tabKeyUsed : 1;
  11542. bool menuActive : 1;
  11543. bool valueTextNeedsUpdating : 1;
  11544. UndoManager undoManager;
  11545. float cursorX, cursorY, cursorHeight;
  11546. int maxTextLength;
  11547. Range<int> selection;
  11548. int leftIndent, topIndent;
  11549. unsigned int lastTransactionTime;
  11550. Font currentFont;
  11551. mutable int totalNumChars;
  11552. int caretPosition;
  11553. VoidArray sections;
  11554. String textToShowWhenEmpty;
  11555. Colour colourForTextWhenEmpty;
  11556. tchar passwordCharacter;
  11557. Value textValue;
  11558. enum
  11559. {
  11560. notDragging,
  11561. draggingSelectionStart,
  11562. draggingSelectionEnd
  11563. } dragType;
  11564. String allowedCharacters;
  11565. ListenerList <TextEditorListener> listeners;
  11566. friend class TextEditorInsertAction;
  11567. friend class TextEditorRemoveAction;
  11568. void coalesceSimilarSections();
  11569. void splitSection (const int sectionIndex, const int charToSplitAt);
  11570. void clearInternal (UndoManager* const um);
  11571. void insert (const String& text,
  11572. const int insertIndex,
  11573. const Font& font,
  11574. const Colour& colour,
  11575. UndoManager* const um,
  11576. const int caretPositionToMoveTo);
  11577. void reinsert (const int insertIndex,
  11578. const VoidArray& sections);
  11579. void remove (const Range<int>& range,
  11580. UndoManager* const um,
  11581. const int caretPositionToMoveTo);
  11582. void getCharPosition (const int index,
  11583. float& x, float& y,
  11584. float& lineHeight) const;
  11585. void updateCaretPosition();
  11586. void textWasChangedByValue();
  11587. int indexAtPosition (const float x,
  11588. const float y);
  11589. int findWordBreakAfter (const int position) const;
  11590. int findWordBreakBefore (const int position) const;
  11591. friend class TextHolderComponent;
  11592. friend class TextEditorViewport;
  11593. void drawContent (Graphics& g);
  11594. void updateTextHolderSize();
  11595. float getWordWrapWidth() const;
  11596. void timerCallbackInt();
  11597. void repaintCaret();
  11598. void repaintText (const Range<int>& range);
  11599. UndoManager* getUndoManager() throw();
  11600. TextEditor (const TextEditor&);
  11601. TextEditor& operator= (const TextEditor&);
  11602. };
  11603. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11604. /*** End of inlined file: juce_TextEditor.h ***/
  11605. class Label;
  11606. class JUCE_API LabelListener
  11607. {
  11608. public:
  11609. virtual ~LabelListener() {}
  11610. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11611. };
  11612. class JUCE_API Label : public Component,
  11613. public SettableTooltipClient,
  11614. protected TextEditorListener,
  11615. private ComponentListener,
  11616. private Value::Listener
  11617. {
  11618. public:
  11619. Label (const String& componentName,
  11620. const String& labelText);
  11621. ~Label();
  11622. void setText (const String& newText,
  11623. const bool broadcastChangeMessage);
  11624. const String getText (const bool returnActiveEditorContents = false) const throw();
  11625. Value& getTextValue() { return textValue; }
  11626. void setFont (const Font& newFont) throw();
  11627. const Font& getFont() const throw();
  11628. enum ColourIds
  11629. {
  11630. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11631. textColourId = 0x1000281, /**< The colour for the text. */
  11632. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11633. Leave this transparent to not have an outline. */
  11634. };
  11635. void setJustificationType (const Justification& justification) throw();
  11636. const Justification getJustificationType() const throw() { return justification; }
  11637. void setBorderSize (int horizontalBorder, int verticalBorder);
  11638. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11639. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11640. void attachToComponent (Component* owner,
  11641. const bool onLeft);
  11642. Component* getAttachedComponent() const;
  11643. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11644. void setMinimumHorizontalScale (const float newScale);
  11645. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11646. void addListener (LabelListener* const listener) throw();
  11647. void removeListener (LabelListener* const listener) throw();
  11648. void setEditable (const bool editOnSingleClick,
  11649. const bool editOnDoubleClick = false,
  11650. const bool lossOfFocusDiscardsChanges = false) throw();
  11651. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11652. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11653. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11654. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11655. void showEditor();
  11656. void hideEditor (const bool discardCurrentEditorContents);
  11657. bool isBeingEdited() const throw();
  11658. juce_UseDebuggingNewOperator
  11659. protected:
  11660. virtual TextEditor* createEditorComponent();
  11661. virtual void textWasEdited();
  11662. virtual void textWasChanged();
  11663. virtual void editorShown (TextEditor* editorComponent);
  11664. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11665. void paint (Graphics& g);
  11666. void resized();
  11667. void mouseUp (const MouseEvent& e);
  11668. void mouseDoubleClick (const MouseEvent& e);
  11669. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11670. void componentParentHierarchyChanged (Component& component);
  11671. void componentVisibilityChanged (Component& component);
  11672. void inputAttemptWhenModal();
  11673. void focusGained (FocusChangeType);
  11674. void enablementChanged();
  11675. KeyboardFocusTraverser* createFocusTraverser();
  11676. void textEditorTextChanged (TextEditor& editor);
  11677. void textEditorReturnKeyPressed (TextEditor& editor);
  11678. void textEditorEscapeKeyPressed (TextEditor& editor);
  11679. void textEditorFocusLost (TextEditor& editor);
  11680. void colourChanged();
  11681. void valueChanged (Value&);
  11682. private:
  11683. Value textValue;
  11684. String lastTextValue;
  11685. Font font;
  11686. Justification justification;
  11687. ScopedPointer <TextEditor> editor;
  11688. ListenerList <LabelListener> listeners;
  11689. Component::SafePointer<Component> ownerComponent;
  11690. int horizontalBorderSize, verticalBorderSize;
  11691. float minimumHorizontalScale;
  11692. bool editSingleClick : 1;
  11693. bool editDoubleClick : 1;
  11694. bool lossOfFocusDiscardsChanges : 1;
  11695. bool leftOfOwnerComp : 1;
  11696. bool updateFromTextEditorContents();
  11697. void callChangeListeners();
  11698. Label (const Label&);
  11699. Label& operator= (const Label&);
  11700. };
  11701. #endif // __JUCE_LABEL_JUCEHEADER__
  11702. /*** End of inlined file: juce_Label.h ***/
  11703. class ComboBox;
  11704. class JUCE_API ComboBoxListener
  11705. {
  11706. public:
  11707. virtual ~ComboBoxListener() {}
  11708. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11709. };
  11710. class JUCE_API ComboBox : public Component,
  11711. public SettableTooltipClient,
  11712. private LabelListener,
  11713. private AsyncUpdater,
  11714. private Value::Listener
  11715. {
  11716. public:
  11717. ComboBox (const String& componentName);
  11718. ~ComboBox();
  11719. void setEditableText (const bool isEditable);
  11720. bool isTextEditable() const throw();
  11721. void setJustificationType (const Justification& justification) throw();
  11722. const Justification getJustificationType() const throw();
  11723. void addItem (const String& newItemText,
  11724. const int newItemId) throw();
  11725. void addSeparator() throw();
  11726. void addSectionHeading (const String& headingName) throw();
  11727. void setItemEnabled (const int itemId,
  11728. const bool shouldBeEnabled) throw();
  11729. void changeItemText (const int itemId,
  11730. const String& newText) throw();
  11731. void clear (const bool dontSendChangeMessage = false);
  11732. int getNumItems() const throw();
  11733. const String getItemText (const int index) const throw();
  11734. int getItemId (const int index) const throw();
  11735. int indexOfItemId (const int itemId) const throw();
  11736. int getSelectedId() const throw();
  11737. Value& getSelectedIdAsValue() throw() { return currentId; }
  11738. void setSelectedId (const int newItemId,
  11739. const bool dontSendChangeMessage = false) throw();
  11740. int getSelectedItemIndex() const throw();
  11741. void setSelectedItemIndex (const int newItemIndex,
  11742. const bool dontSendChangeMessage = false) throw();
  11743. const String getText() const throw();
  11744. void setText (const String& newText,
  11745. const bool dontSendChangeMessage = false) throw();
  11746. void showEditor();
  11747. void addListener (ComboBoxListener* const listener) throw();
  11748. void removeListener (ComboBoxListener* const listener) throw();
  11749. void setTextWhenNothingSelected (const String& newMessage) throw();
  11750. const String getTextWhenNothingSelected() const throw();
  11751. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11752. const String getTextWhenNoChoicesAvailable() const throw();
  11753. void setTooltip (const String& newTooltip);
  11754. enum ColourIds
  11755. {
  11756. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11757. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11758. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11759. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11760. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11761. };
  11762. void labelTextChanged (Label*);
  11763. void enablementChanged();
  11764. void colourChanged();
  11765. void focusGained (Component::FocusChangeType cause);
  11766. void focusLost (Component::FocusChangeType cause);
  11767. void handleAsyncUpdate();
  11768. const String getTooltip() { return label->getTooltip(); }
  11769. void mouseDown (const MouseEvent&);
  11770. void mouseDrag (const MouseEvent&);
  11771. void mouseUp (const MouseEvent&);
  11772. void lookAndFeelChanged();
  11773. void paint (Graphics&);
  11774. void resized();
  11775. bool keyStateChanged (const bool isKeyDown);
  11776. bool keyPressed (const KeyPress&);
  11777. void valueChanged (Value&);
  11778. juce_UseDebuggingNewOperator
  11779. private:
  11780. struct ItemInfo
  11781. {
  11782. String name;
  11783. int itemId;
  11784. bool isEnabled : 1, isHeading : 1;
  11785. bool isSeparator() const throw();
  11786. bool isRealItem() const throw();
  11787. };
  11788. OwnedArray <ItemInfo> items;
  11789. Value currentId;
  11790. int lastCurrentId;
  11791. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11792. ListenerList <ComboBoxListener> listeners;
  11793. ScopedPointer<Label> label;
  11794. String textWhenNothingSelected, noChoicesMessage;
  11795. void showPopup();
  11796. ItemInfo* getItemForId (const int itemId) const throw();
  11797. ItemInfo* getItemForIndex (const int index) const throw();
  11798. ComboBox (const ComboBox&);
  11799. ComboBox& operator= (const ComboBox&);
  11800. };
  11801. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11802. /*** End of inlined file: juce_ComboBox.h ***/
  11803. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11804. {
  11805. public:
  11806. AudioDeviceManager();
  11807. ~AudioDeviceManager();
  11808. struct JUCE_API AudioDeviceSetup
  11809. {
  11810. AudioDeviceSetup();
  11811. bool operator== (const AudioDeviceSetup& other) const;
  11812. String outputDeviceName;
  11813. String inputDeviceName;
  11814. double sampleRate;
  11815. int bufferSize;
  11816. BigInteger inputChannels;
  11817. bool useDefaultInputChannels;
  11818. BigInteger outputChannels;
  11819. bool useDefaultOutputChannels;
  11820. };
  11821. const String initialise (const int numInputChannelsNeeded,
  11822. const int numOutputChannelsNeeded,
  11823. const XmlElement* const savedState,
  11824. const bool selectDefaultDeviceOnFailure,
  11825. const String& preferredDefaultDeviceName = String::empty,
  11826. const AudioDeviceSetup* preferredSetupOptions = 0);
  11827. XmlElement* createStateXml() const;
  11828. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11829. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11830. const bool treatAsChosenDevice);
  11831. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11832. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11833. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11834. void setCurrentAudioDeviceType (const String& type,
  11835. const bool treatAsChosenDevice);
  11836. void closeAudioDevice();
  11837. void restartLastAudioDevice();
  11838. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11839. void removeAudioCallback (AudioIODeviceCallback* callback);
  11840. double getCpuUsage() const;
  11841. void setMidiInputEnabled (const String& midiInputDeviceName,
  11842. const bool enabled);
  11843. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11844. void addMidiInputCallback (const String& midiInputDeviceName,
  11845. MidiInputCallback* callback);
  11846. void removeMidiInputCallback (const String& midiInputDeviceName,
  11847. MidiInputCallback* callback);
  11848. void setDefaultMidiOutput (const String& deviceName);
  11849. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11850. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11851. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11852. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11853. void playTestSound();
  11854. void enableInputLevelMeasurement (const bool enableMeasurement);
  11855. double getCurrentInputLevel() const;
  11856. juce_UseDebuggingNewOperator
  11857. private:
  11858. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11859. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11860. AudioDeviceSetup currentSetup;
  11861. ScopedPointer <AudioIODevice> currentAudioDevice;
  11862. SortedSet <AudioIODeviceCallback*> callbacks;
  11863. int numInputChansNeeded, numOutputChansNeeded;
  11864. String currentDeviceType;
  11865. BigInteger inputChannels, outputChannels;
  11866. ScopedPointer <XmlElement> lastExplicitSettings;
  11867. mutable bool listNeedsScanning;
  11868. bool useInputNames;
  11869. int inputLevelMeasurementEnabledCount;
  11870. double inputLevel;
  11871. ScopedPointer <AudioSampleBuffer> testSound;
  11872. int testSoundPosition;
  11873. AudioSampleBuffer tempBuffer;
  11874. StringArray midiInsFromXml;
  11875. OwnedArray <MidiInput> enabledMidiInputs;
  11876. Array <MidiInputCallback*> midiCallbacks;
  11877. Array <MidiInput*> midiCallbackDevices;
  11878. String defaultMidiOutputName;
  11879. ScopedPointer <MidiOutput> defaultMidiOutput;
  11880. CriticalSection audioCallbackLock, midiCallbackLock;
  11881. double cpuUsageMs, timeToCpuScale;
  11882. class CallbackHandler : public AudioIODeviceCallback,
  11883. public MidiInputCallback
  11884. {
  11885. public:
  11886. AudioDeviceManager* owner;
  11887. void audioDeviceIOCallback (const float** inputChannelData,
  11888. int totalNumInputChannels,
  11889. float** outputChannelData,
  11890. int totalNumOutputChannels,
  11891. int numSamples);
  11892. void audioDeviceAboutToStart (AudioIODevice*);
  11893. void audioDeviceStopped();
  11894. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11895. };
  11896. CallbackHandler callbackHandler;
  11897. friend class CallbackHandler;
  11898. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11899. int totalNumInputChannels,
  11900. float** outputChannelData,
  11901. int totalNumOutputChannels,
  11902. int numSamples);
  11903. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11904. void audioDeviceStoppedInt();
  11905. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11906. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11907. const BigInteger& ins, const BigInteger& outs);
  11908. void stopDevice();
  11909. void updateXml();
  11910. void createDeviceTypesIfNeeded();
  11911. void scanDevicesIfNeeded();
  11912. void deleteCurrentDevice();
  11913. double chooseBestSampleRate (double preferred) const;
  11914. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11915. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11916. AudioDeviceManager (const AudioDeviceManager&);
  11917. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11918. };
  11919. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11920. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11921. #endif
  11922. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11923. #endif
  11924. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11925. #endif
  11926. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11927. #endif
  11928. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11929. #endif
  11930. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11931. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11932. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11933. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11934. class JUCE_API AudioDataConverters
  11935. {
  11936. public:
  11937. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11938. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11939. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11940. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11941. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11942. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11943. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11944. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11945. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11946. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11947. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11948. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11949. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11950. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11951. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11952. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11953. enum DataFormat
  11954. {
  11955. int16LE,
  11956. int16BE,
  11957. int24LE,
  11958. int24BE,
  11959. int32LE,
  11960. int32BE,
  11961. float32LE,
  11962. float32BE,
  11963. };
  11964. static void convertFloatToFormat (const DataFormat destFormat,
  11965. const float* source, void* dest, int numSamples);
  11966. static void convertFormatToFloat (const DataFormat sourceFormat,
  11967. const void* source, float* dest, int numSamples);
  11968. static void interleaveSamples (const float** source, float* dest,
  11969. const int numSamples, const int numChannels);
  11970. static void deinterleaveSamples (const float* source, float** dest,
  11971. const int numSamples, const int numChannels);
  11972. };
  11973. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11974. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11975. #endif
  11976. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11977. #endif
  11978. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11979. #endif
  11980. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11981. #endif
  11982. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11983. /*** Start of inlined file: juce_MidiFile.h ***/
  11984. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11985. #define __JUCE_MIDIFILE_JUCEHEADER__
  11986. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11987. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11988. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11989. class JUCE_API MidiMessageSequence
  11990. {
  11991. public:
  11992. MidiMessageSequence();
  11993. MidiMessageSequence (const MidiMessageSequence& other);
  11994. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11995. ~MidiMessageSequence();
  11996. class MidiEventHolder
  11997. {
  11998. public:
  11999. ~MidiEventHolder();
  12000. MidiMessage message;
  12001. MidiEventHolder* noteOffObject;
  12002. juce_UseDebuggingNewOperator
  12003. private:
  12004. friend class MidiMessageSequence;
  12005. MidiEventHolder (const MidiMessage& message);
  12006. };
  12007. void clear();
  12008. int getNumEvents() const;
  12009. MidiEventHolder* getEventPointer (const int index) const;
  12010. double getTimeOfMatchingKeyUp (const int index) const;
  12011. int getIndexOfMatchingKeyUp (const int index) const;
  12012. int getIndexOf (MidiEventHolder* const event) const;
  12013. int getNextIndexAtTime (const double timeStamp) const;
  12014. double getStartTime() const;
  12015. double getEndTime() const;
  12016. double getEventTime (const int index) const;
  12017. void addEvent (const MidiMessage& newMessage,
  12018. double timeAdjustment = 0);
  12019. void deleteEvent (const int index,
  12020. const bool deleteMatchingNoteUp);
  12021. void addSequence (const MidiMessageSequence& other,
  12022. double timeAdjustmentDelta,
  12023. double firstAllowableDestTime,
  12024. double endOfAllowableDestTimes);
  12025. void updateMatchedPairs();
  12026. void extractMidiChannelMessages (const int channelNumberToExtract,
  12027. MidiMessageSequence& destSequence,
  12028. const bool alsoIncludeMetaEvents) const;
  12029. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12030. void deleteMidiChannelMessages (const int channelNumberToRemove);
  12031. void deleteSysExMessages();
  12032. void addTimeToMessages (const double deltaTime);
  12033. void createControllerUpdatesForTime (const int channelNumber,
  12034. const double time,
  12035. OwnedArray<MidiMessage>& resultMessages);
  12036. void swapWith (MidiMessageSequence& other) throw();
  12037. juce_UseDebuggingNewOperator
  12038. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12039. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12040. private:
  12041. friend class MidiFile;
  12042. OwnedArray <MidiEventHolder> list;
  12043. void sort();
  12044. };
  12045. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12046. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12047. class JUCE_API MidiFile
  12048. {
  12049. public:
  12050. MidiFile() throw();
  12051. ~MidiFile() throw();
  12052. int getNumTracks() const throw();
  12053. const MidiMessageSequence* getTrack (const int index) const throw();
  12054. void addTrack (const MidiMessageSequence& trackSequence) throw();
  12055. void clear() throw();
  12056. short getTimeFormat() const throw();
  12057. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12058. void setSmpteTimeFormat (const int framesPerSecond,
  12059. const int subframeResolution) throw();
  12060. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12061. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12062. double getLastTimestamp() const;
  12063. bool readFrom (InputStream& sourceStream);
  12064. bool writeTo (OutputStream& destStream);
  12065. void convertTimestampTicksToSeconds();
  12066. juce_UseDebuggingNewOperator
  12067. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12068. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12069. private:
  12070. OwnedArray <MidiMessageSequence> tracks;
  12071. short timeFormat;
  12072. MidiFile (const MidiFile&);
  12073. MidiFile& operator= (const MidiFile&);
  12074. void readNextTrack (const char* data, int size);
  12075. void writeTrack (OutputStream& mainOut, const int trackNum);
  12076. };
  12077. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12078. /*** End of inlined file: juce_MidiFile.h ***/
  12079. #endif
  12080. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12081. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12082. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12083. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12084. class MidiKeyboardState;
  12085. class JUCE_API MidiKeyboardStateListener
  12086. {
  12087. public:
  12088. MidiKeyboardStateListener() throw() {}
  12089. virtual ~MidiKeyboardStateListener() {}
  12090. virtual void handleNoteOn (MidiKeyboardState* source,
  12091. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12092. virtual void handleNoteOff (MidiKeyboardState* source,
  12093. int midiChannel, int midiNoteNumber) = 0;
  12094. };
  12095. class JUCE_API MidiKeyboardState
  12096. {
  12097. public:
  12098. MidiKeyboardState();
  12099. ~MidiKeyboardState();
  12100. void reset();
  12101. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12102. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12103. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12104. void noteOff (const int midiChannel, const int midiNoteNumber);
  12105. void allNotesOff (const int midiChannel);
  12106. void processNextMidiEvent (const MidiMessage& message);
  12107. void processNextMidiBuffer (MidiBuffer& buffer,
  12108. const int startSample,
  12109. const int numSamples,
  12110. const bool injectIndirectEvents);
  12111. void addListener (MidiKeyboardStateListener* const listener) throw();
  12112. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12113. juce_UseDebuggingNewOperator
  12114. private:
  12115. CriticalSection lock;
  12116. uint16 noteStates [128];
  12117. MidiBuffer eventsToAdd;
  12118. VoidArray listeners;
  12119. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12120. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12121. MidiKeyboardState (const MidiKeyboardState&);
  12122. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12123. };
  12124. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12125. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12126. #endif
  12127. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12128. #endif
  12129. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12130. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12131. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12132. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12133. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12134. public MidiInputCallback
  12135. {
  12136. public:
  12137. MidiMessageCollector();
  12138. ~MidiMessageCollector();
  12139. void reset (const double sampleRate);
  12140. void addMessageToQueue (const MidiMessage& message);
  12141. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12142. const int numSamples);
  12143. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12144. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12145. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12146. juce_UseDebuggingNewOperator
  12147. private:
  12148. double lastCallbackTime;
  12149. CriticalSection midiCallbackLock;
  12150. MidiBuffer incomingMessages;
  12151. double sampleRate;
  12152. MidiMessageCollector (const MidiMessageCollector&);
  12153. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12154. };
  12155. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12156. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12157. #endif
  12158. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12159. #endif
  12160. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12161. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12162. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12163. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12164. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12165. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12166. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12167. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12168. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12169. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12170. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12171. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12172. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12173. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12174. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12175. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12176. class AudioProcessor;
  12177. class JUCE_API AudioProcessorEditor : public Component
  12178. {
  12179. protected:
  12180. AudioProcessorEditor (AudioProcessor* const owner);
  12181. public:
  12182. ~AudioProcessorEditor();
  12183. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12184. private:
  12185. AudioProcessor* const owner;
  12186. AudioProcessorEditor (const AudioProcessorEditor&);
  12187. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12188. };
  12189. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12190. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12191. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12192. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12193. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12194. class AudioProcessor;
  12195. class JUCE_API AudioProcessorListener
  12196. {
  12197. public:
  12198. virtual ~AudioProcessorListener() {}
  12199. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12200. int parameterIndex,
  12201. float newValue) = 0;
  12202. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12203. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12204. int parameterIndex);
  12205. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12206. int parameterIndex);
  12207. };
  12208. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12209. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12210. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12211. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12212. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12213. class JUCE_API AudioPlayHead
  12214. {
  12215. protected:
  12216. AudioPlayHead() {}
  12217. public:
  12218. virtual ~AudioPlayHead() {}
  12219. enum FrameRateType
  12220. {
  12221. fps24 = 0,
  12222. fps25 = 1,
  12223. fps2997 = 2,
  12224. fps30 = 3,
  12225. fps2997drop = 4,
  12226. fps30drop = 5,
  12227. fpsUnknown = 99
  12228. };
  12229. struct CurrentPositionInfo
  12230. {
  12231. double bpm;
  12232. int timeSigNumerator;
  12233. int timeSigDenominator;
  12234. double timeInSeconds;
  12235. double editOriginTime;
  12236. double ppqPosition;
  12237. double ppqPositionOfLastBarStart;
  12238. FrameRateType frameRate;
  12239. bool isPlaying;
  12240. bool isRecording;
  12241. };
  12242. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12243. };
  12244. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12245. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12246. class JUCE_API AudioProcessor
  12247. {
  12248. protected:
  12249. AudioProcessor();
  12250. public:
  12251. virtual ~AudioProcessor();
  12252. virtual const String getName() const = 0;
  12253. virtual void prepareToPlay (double sampleRate,
  12254. int estimatedSamplesPerBlock) = 0;
  12255. virtual void releaseResources() = 0;
  12256. virtual void processBlock (AudioSampleBuffer& buffer,
  12257. MidiBuffer& midiMessages) = 0;
  12258. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12259. double getSampleRate() const throw() { return sampleRate; }
  12260. int getBlockSize() const throw() { return blockSize; }
  12261. int getNumInputChannels() const throw() { return numInputChannels; }
  12262. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12263. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12264. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12265. virtual bool isInputChannelStereoPair (int index) const = 0;
  12266. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12267. int getLatencySamples() const throw() { return latencySamples; }
  12268. void setLatencySamples (const int newLatency);
  12269. virtual bool acceptsMidi() const = 0;
  12270. virtual bool producesMidi() const = 0;
  12271. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12272. void suspendProcessing (const bool shouldBeSuspended);
  12273. bool isSuspended() const throw() { return suspended; }
  12274. virtual void reset();
  12275. bool isNonRealtime() const throw() { return nonRealtime; }
  12276. void setNonRealtime (const bool isNonRealtime) throw();
  12277. virtual AudioProcessorEditor* createEditor() = 0;
  12278. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12279. AudioProcessorEditor* createEditorIfNeeded();
  12280. virtual int getNumParameters() = 0;
  12281. virtual const String getParameterName (int parameterIndex) = 0;
  12282. virtual float getParameter (int parameterIndex) = 0;
  12283. virtual const String getParameterText (int parameterIndex) = 0;
  12284. virtual void setParameter (int parameterIndex,
  12285. float newValue) = 0;
  12286. void setParameterNotifyingHost (int parameterIndex,
  12287. float newValue);
  12288. virtual bool isParameterAutomatable (int parameterIndex) const;
  12289. virtual bool isMetaParameter (int parameterIndex) const;
  12290. void beginParameterChangeGesture (int parameterIndex);
  12291. void endParameterChangeGesture (int parameterIndex);
  12292. void updateHostDisplay();
  12293. virtual int getNumPrograms() = 0;
  12294. virtual int getCurrentProgram() = 0;
  12295. virtual void setCurrentProgram (int index) = 0;
  12296. virtual const String getProgramName (int index) = 0;
  12297. virtual void changeProgramName (int index, const String& newName) = 0;
  12298. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12299. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12300. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12301. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12302. void addListener (AudioProcessorListener* const newListener) throw();
  12303. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12304. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12305. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12306. void setPlayConfigDetails (const int numIns, const int numOuts,
  12307. const double sampleRate,
  12308. const int blockSize) throw();
  12309. juce_UseDebuggingNewOperator
  12310. protected:
  12311. static void copyXmlToBinary (const XmlElement& xml,
  12312. JUCE_NAMESPACE::MemoryBlock& destData);
  12313. static XmlElement* getXmlFromBinary (const void* data,
  12314. const int sizeInBytes);
  12315. AudioPlayHead* playHead;
  12316. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12317. private:
  12318. VoidArray listeners;
  12319. AudioProcessorEditor* activeEditor;
  12320. double sampleRate;
  12321. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12322. bool suspended, nonRealtime;
  12323. CriticalSection callbackLock, listenerLock;
  12324. #ifdef JUCE_DEBUG
  12325. BigInteger changingParams;
  12326. #endif
  12327. AudioProcessor (const AudioProcessor&);
  12328. AudioProcessor& operator= (const AudioProcessor&);
  12329. };
  12330. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12331. /*** End of inlined file: juce_AudioProcessor.h ***/
  12332. /*** Start of inlined file: juce_PluginDescription.h ***/
  12333. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12334. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12335. class JUCE_API PluginDescription
  12336. {
  12337. public:
  12338. PluginDescription() throw();
  12339. PluginDescription (const PluginDescription& other) throw();
  12340. PluginDescription& operator= (const PluginDescription& other) throw();
  12341. ~PluginDescription() throw();
  12342. String name;
  12343. String pluginFormatName;
  12344. String category;
  12345. String manufacturerName;
  12346. String version;
  12347. String fileOrIdentifier;
  12348. Time lastFileModTime;
  12349. int uid;
  12350. bool isInstrument;
  12351. int numInputChannels;
  12352. int numOutputChannels;
  12353. bool isDuplicateOf (const PluginDescription& other) const;
  12354. const String createIdentifierString() const throw();
  12355. XmlElement* createXml() const;
  12356. bool loadFromXml (const XmlElement& xml);
  12357. juce_UseDebuggingNewOperator
  12358. };
  12359. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12360. /*** End of inlined file: juce_PluginDescription.h ***/
  12361. class JUCE_API AudioPluginInstance : public AudioProcessor
  12362. {
  12363. public:
  12364. virtual ~AudioPluginInstance();
  12365. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12366. juce_UseDebuggingNewOperator
  12367. protected:
  12368. AudioPluginInstance();
  12369. AudioPluginInstance (const AudioPluginInstance&);
  12370. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12371. };
  12372. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12373. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12374. class PluginDescription;
  12375. class JUCE_API AudioPluginFormat
  12376. {
  12377. public:
  12378. virtual ~AudioPluginFormat();
  12379. virtual const String getName() const = 0;
  12380. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12381. const String& fileOrIdentifier) = 0;
  12382. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12383. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12384. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12385. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12386. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12387. const bool recursive) = 0;
  12388. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12389. juce_UseDebuggingNewOperator
  12390. protected:
  12391. AudioPluginFormat() throw();
  12392. AudioPluginFormat (const AudioPluginFormat&);
  12393. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12394. };
  12395. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12396. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12397. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12398. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12399. {
  12400. public:
  12401. AudioUnitPluginFormat();
  12402. ~AudioUnitPluginFormat();
  12403. const String getName() const { return "AudioUnit"; }
  12404. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12405. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12406. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12407. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12408. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12409. bool doesPluginStillExist (const PluginDescription& desc);
  12410. const FileSearchPath getDefaultLocationsToSearch();
  12411. juce_UseDebuggingNewOperator
  12412. private:
  12413. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12414. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12415. };
  12416. #endif
  12417. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12418. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12419. #endif
  12420. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12421. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12422. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12423. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12424. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12425. // Sorry, this file is just a placeholder at the moment!...
  12426. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12427. {
  12428. public:
  12429. DirectXPluginFormat();
  12430. ~DirectXPluginFormat();
  12431. const String getName() const { return "DirectX"; }
  12432. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12433. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12434. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12435. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12436. const FileSearchPath getDefaultLocationsToSearch();
  12437. juce_UseDebuggingNewOperator
  12438. private:
  12439. DirectXPluginFormat (const DirectXPluginFormat&);
  12440. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12441. };
  12442. #endif
  12443. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12444. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12445. #endif
  12446. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12447. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12448. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12449. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12450. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12451. // Sorry, this file is just a placeholder at the moment!...
  12452. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12453. {
  12454. public:
  12455. LADSPAPluginFormat();
  12456. ~LADSPAPluginFormat();
  12457. const String getName() const { return "LADSPA"; }
  12458. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12459. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12460. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12461. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12462. const FileSearchPath getDefaultLocationsToSearch();
  12463. juce_UseDebuggingNewOperator
  12464. private:
  12465. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12466. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12467. };
  12468. #endif
  12469. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12470. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12471. #endif
  12472. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12473. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12474. #ifdef __aeffect__
  12475. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12476. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12477. class VSTMidiEventList
  12478. {
  12479. public:
  12480. VSTMidiEventList()
  12481. : numEventsUsed (0), numEventsAllocated (0)
  12482. {
  12483. }
  12484. ~VSTMidiEventList()
  12485. {
  12486. freeEvents();
  12487. }
  12488. void clear()
  12489. {
  12490. numEventsUsed = 0;
  12491. if (events != 0)
  12492. events->numEvents = 0;
  12493. }
  12494. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12495. {
  12496. ensureSize (numEventsUsed + 1);
  12497. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12498. events->numEvents = ++numEventsUsed;
  12499. if (numBytes <= 4)
  12500. {
  12501. if (e->type == kVstSysExType)
  12502. {
  12503. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12504. e->type = kVstMidiType;
  12505. e->byteSize = sizeof (VstMidiEvent);
  12506. e->noteLength = 0;
  12507. e->noteOffset = 0;
  12508. e->detune = 0;
  12509. e->noteOffVelocity = 0;
  12510. }
  12511. e->deltaFrames = frameOffset;
  12512. memcpy (e->midiData, midiData, numBytes);
  12513. }
  12514. else
  12515. {
  12516. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12517. if (se->type == kVstSysExType)
  12518. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12519. else
  12520. se->sysexDump = (char*) juce_malloc (numBytes);
  12521. memcpy (se->sysexDump, midiData, numBytes);
  12522. se->type = kVstSysExType;
  12523. se->byteSize = sizeof (VstMidiSysexEvent);
  12524. se->deltaFrames = frameOffset;
  12525. se->flags = 0;
  12526. se->dumpBytes = numBytes;
  12527. se->resvd1 = 0;
  12528. se->resvd2 = 0;
  12529. }
  12530. }
  12531. // Handy method to pull the events out of an event buffer supplied by the host
  12532. // or plugin.
  12533. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12534. {
  12535. for (int i = 0; i < events->numEvents; ++i)
  12536. {
  12537. const VstEvent* const e = events->events[i];
  12538. if (e != 0)
  12539. {
  12540. if (e->type == kVstMidiType)
  12541. {
  12542. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12543. 4, e->deltaFrames);
  12544. }
  12545. else if (e->type == kVstSysExType)
  12546. {
  12547. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12548. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12549. e->deltaFrames);
  12550. }
  12551. }
  12552. }
  12553. }
  12554. void ensureSize (int numEventsNeeded)
  12555. {
  12556. if (numEventsNeeded > numEventsAllocated)
  12557. {
  12558. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12559. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12560. if (events == 0)
  12561. events.calloc (size, 1);
  12562. else
  12563. events.realloc (size, 1);
  12564. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12565. {
  12566. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12567. (int) sizeof (VstMidiSysexEvent)));
  12568. e->type = kVstMidiType;
  12569. e->byteSize = sizeof (VstMidiEvent);
  12570. events->events[i] = (VstEvent*) e;
  12571. }
  12572. numEventsAllocated = numEventsNeeded;
  12573. }
  12574. }
  12575. void freeEvents()
  12576. {
  12577. if (events != 0)
  12578. {
  12579. for (int i = numEventsAllocated; --i >= 0;)
  12580. {
  12581. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12582. if (e->type == kVstSysExType)
  12583. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12584. juce_free (e);
  12585. }
  12586. events.free();
  12587. numEventsUsed = 0;
  12588. numEventsAllocated = 0;
  12589. }
  12590. }
  12591. HeapBlock <VstEvents> events;
  12592. private:
  12593. int numEventsUsed, numEventsAllocated;
  12594. };
  12595. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12596. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12597. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12598. #endif
  12599. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12600. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12601. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12602. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12603. #if JUCE_PLUGINHOST_VST
  12604. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12605. {
  12606. public:
  12607. VSTPluginFormat();
  12608. ~VSTPluginFormat();
  12609. const String getName() const { return "VST"; }
  12610. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12611. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12612. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12613. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12614. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12615. bool doesPluginStillExist (const PluginDescription& desc);
  12616. const FileSearchPath getDefaultLocationsToSearch();
  12617. juce_UseDebuggingNewOperator
  12618. private:
  12619. VSTPluginFormat (const VSTPluginFormat&);
  12620. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12621. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12622. };
  12623. #endif
  12624. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12625. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12626. #endif
  12627. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12628. #endif
  12629. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12630. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12631. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12632. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12633. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12634. {
  12635. public:
  12636. AudioPluginFormatManager() throw();
  12637. ~AudioPluginFormatManager() throw();
  12638. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12639. void addDefaultFormats();
  12640. int getNumFormats() throw();
  12641. AudioPluginFormat* getFormat (const int index) throw();
  12642. void addFormat (AudioPluginFormat* const format) throw();
  12643. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12644. String& errorMessage) const;
  12645. bool doesPluginStillExist (const PluginDescription& description) const;
  12646. juce_UseDebuggingNewOperator
  12647. private:
  12648. OwnedArray <AudioPluginFormat> formats;
  12649. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12650. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12651. };
  12652. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12653. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12654. #endif
  12655. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12656. #endif
  12657. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12658. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12659. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12660. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12661. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12662. {
  12663. public:
  12664. KnownPluginList();
  12665. ~KnownPluginList();
  12666. void clear();
  12667. int getNumTypes() const throw() { return types.size(); }
  12668. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12669. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12670. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12671. bool addType (const PluginDescription& type);
  12672. void removeType (const int index) throw();
  12673. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12674. const bool dontRescanIfAlreadyInList,
  12675. OwnedArray <PluginDescription>& typesFound,
  12676. AudioPluginFormat& formatToUse);
  12677. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12678. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12679. OwnedArray <PluginDescription>& typesFound);
  12680. enum SortMethod
  12681. {
  12682. defaultOrder = 0,
  12683. sortAlphabetically,
  12684. sortByCategory,
  12685. sortByManufacturer,
  12686. sortByFileSystemLocation
  12687. };
  12688. void addToMenu (PopupMenu& menu,
  12689. const SortMethod sortMethod) const;
  12690. int getIndexChosenByMenu (const int menuResultCode) const;
  12691. void sort (const SortMethod method);
  12692. XmlElement* createXml() const;
  12693. void recreateFromXml (const XmlElement& xml);
  12694. juce_UseDebuggingNewOperator
  12695. private:
  12696. OwnedArray <PluginDescription> types;
  12697. KnownPluginList (const KnownPluginList&);
  12698. KnownPluginList& operator= (const KnownPluginList&);
  12699. };
  12700. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12701. /*** End of inlined file: juce_KnownPluginList.h ***/
  12702. #endif
  12703. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12704. #endif
  12705. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12706. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12707. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12708. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12709. class JUCE_API PluginDirectoryScanner
  12710. {
  12711. public:
  12712. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12713. AudioPluginFormat& formatToLookFor,
  12714. FileSearchPath directoriesToSearch,
  12715. const bool searchRecursively,
  12716. const File& deadMansPedalFile);
  12717. ~PluginDirectoryScanner();
  12718. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12719. const String getNextPluginFileThatWillBeScanned() const throw();
  12720. float getProgress() const { return progress; }
  12721. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12722. juce_UseDebuggingNewOperator
  12723. private:
  12724. KnownPluginList& list;
  12725. AudioPluginFormat& format;
  12726. StringArray filesOrIdentifiersToScan;
  12727. File deadMansPedalFile;
  12728. StringArray failedFiles;
  12729. int nextIndex;
  12730. float progress;
  12731. const StringArray getDeadMansPedalFile() throw();
  12732. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12733. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12734. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12735. };
  12736. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12737. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12738. #endif
  12739. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12740. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12741. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12742. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12743. /*** Start of inlined file: juce_ListBox.h ***/
  12744. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12745. #define __JUCE_LISTBOX_JUCEHEADER__
  12746. class ListViewport;
  12747. class JUCE_API ListBoxModel
  12748. {
  12749. public:
  12750. virtual ~ListBoxModel() {}
  12751. virtual int getNumRows() = 0;
  12752. virtual void paintListBoxItem (int rowNumber,
  12753. Graphics& g,
  12754. int width, int height,
  12755. bool rowIsSelected) = 0;
  12756. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12757. Component* existingComponentToUpdate);
  12758. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12759. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12760. virtual void backgroundClicked();
  12761. virtual void selectedRowsChanged (int lastRowSelected);
  12762. virtual void deleteKeyPressed (int lastRowSelected);
  12763. virtual void returnKeyPressed (int lastRowSelected);
  12764. virtual void listWasScrolled();
  12765. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12766. virtual const String getTooltipForRow (int row);
  12767. };
  12768. class JUCE_API ListBox : public Component,
  12769. public SettableTooltipClient
  12770. {
  12771. public:
  12772. ListBox (const String& componentName,
  12773. ListBoxModel* const model);
  12774. ~ListBox();
  12775. void setModel (ListBoxModel* const newModel);
  12776. ListBoxModel* getModel() const throw() { return model; }
  12777. void updateContent();
  12778. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12779. void setMouseMoveSelectsRows (bool shouldSelect);
  12780. void selectRow (const int rowNumber,
  12781. bool dontScrollToShowThisRow = false,
  12782. bool deselectOthersFirst = true);
  12783. void selectRangeOfRows (int firstRow,
  12784. int lastRow);
  12785. void deselectRow (const int rowNumber);
  12786. void deselectAllRows();
  12787. void flipRowSelection (const int rowNumber);
  12788. const SparseSet<int> getSelectedRows() const;
  12789. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12790. const bool sendNotificationEventToModel = true);
  12791. bool isRowSelected (const int rowNumber) const;
  12792. int getNumSelectedRows() const;
  12793. int getSelectedRow (const int index = 0) const;
  12794. int getLastRowSelected() const;
  12795. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12796. const ModifierKeys& modifiers);
  12797. void setVerticalPosition (const double newProportion);
  12798. double getVerticalPosition() const;
  12799. void scrollToEnsureRowIsOnscreen (const int row);
  12800. ScrollBar* getVerticalScrollBar() const throw();
  12801. ScrollBar* getHorizontalScrollBar() const throw();
  12802. int getRowContainingPosition (const int x, const int y) const throw();
  12803. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12804. const Rectangle<int> getRowPosition (const int rowNumber,
  12805. const bool relativeToComponentTopLeft) const throw();
  12806. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12807. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12808. int getVisibleRowWidth() const throw();
  12809. void setRowHeight (const int newHeight);
  12810. int getRowHeight() const throw() { return rowHeight; }
  12811. int getNumRowsOnScreen() const throw();
  12812. enum ColourIds
  12813. {
  12814. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12815. Make this transparent if you don't want the background to be filled. */
  12816. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12817. Make this transparent to not have an outline. */
  12818. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12819. };
  12820. void setOutlineThickness (const int outlineThickness);
  12821. int getOutlineThickness() const throw() { return outlineThickness; }
  12822. void setHeaderComponent (Component* const newHeaderComponent);
  12823. void setMinimumContentWidth (const int newMinimumWidth);
  12824. int getVisibleContentWidth() const throw();
  12825. void repaintRow (const int rowNumber) throw();
  12826. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12827. Viewport* getViewport() const throw();
  12828. bool keyPressed (const KeyPress& key);
  12829. bool keyStateChanged (const bool isKeyDown);
  12830. void paint (Graphics& g);
  12831. void paintOverChildren (Graphics& g);
  12832. void resized();
  12833. void visibilityChanged();
  12834. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12835. void mouseMove (const MouseEvent&);
  12836. void mouseExit (const MouseEvent&);
  12837. void mouseUp (const MouseEvent&);
  12838. void colourChanged();
  12839. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12840. juce_UseDebuggingNewOperator
  12841. private:
  12842. friend class ListViewport;
  12843. friend class TableListBox;
  12844. ListBoxModel* model;
  12845. ListViewport* viewport;
  12846. Component* headerComponent;
  12847. int totalItems, rowHeight, minimumRowWidth;
  12848. int outlineThickness;
  12849. int lastRowSelected;
  12850. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12851. SparseSet <int> selected;
  12852. void selectRowInternal (const int rowNumber,
  12853. bool dontScrollToShowThisRow,
  12854. bool deselectOthersFirst,
  12855. bool isMouseClick);
  12856. ListBox (const ListBox&);
  12857. ListBox& operator= (const ListBox&);
  12858. };
  12859. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12860. /*** End of inlined file: juce_ListBox.h ***/
  12861. /*** Start of inlined file: juce_TextButton.h ***/
  12862. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12863. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12864. class JUCE_API TextButton : public Button
  12865. {
  12866. public:
  12867. TextButton (const String& buttonName,
  12868. const String& toolTip = String::empty);
  12869. ~TextButton();
  12870. enum ColourIds
  12871. {
  12872. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12873. 'off'). The look-and-feel class might re-interpret this to add
  12874. effects, etc. */
  12875. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12876. 'on'). The look-and-feel class might re-interpret this to add
  12877. effects, etc. */
  12878. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12879. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12880. };
  12881. void changeWidthToFitText (const int newHeight = -1);
  12882. virtual const Font getFont();
  12883. juce_UseDebuggingNewOperator
  12884. protected:
  12885. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12886. void colourChanged();
  12887. private:
  12888. TextButton (const TextButton&);
  12889. TextButton& operator= (const TextButton&);
  12890. };
  12891. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12892. /*** End of inlined file: juce_TextButton.h ***/
  12893. class JUCE_API PluginListComponent : public Component,
  12894. public ListBoxModel,
  12895. public ChangeListener,
  12896. public ButtonListener,
  12897. public Timer
  12898. {
  12899. public:
  12900. PluginListComponent (KnownPluginList& listToRepresent,
  12901. const File& deadMansPedalFile,
  12902. PropertiesFile* const propertiesToUse);
  12903. ~PluginListComponent();
  12904. void resized();
  12905. bool isInterestedInFileDrag (const StringArray& files);
  12906. void filesDropped (const StringArray& files, int, int);
  12907. int getNumRows();
  12908. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12909. void deleteKeyPressed (int lastRowSelected);
  12910. void buttonClicked (Button* b);
  12911. void changeListenerCallback (void*);
  12912. void timerCallback();
  12913. juce_UseDebuggingNewOperator
  12914. private:
  12915. KnownPluginList& list;
  12916. File deadMansPedalFile;
  12917. ListBox* listBox;
  12918. TextButton* optionsButton;
  12919. PropertiesFile* propertiesToUse;
  12920. int typeToScan;
  12921. void scanFor (AudioPluginFormat* format);
  12922. PluginListComponent (const PluginListComponent&);
  12923. PluginListComponent& operator= (const PluginListComponent&);
  12924. };
  12925. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12926. /*** End of inlined file: juce_PluginListComponent.h ***/
  12927. #endif
  12928. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12929. #endif
  12930. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12931. #endif
  12932. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12933. #endif
  12934. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12935. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12936. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12937. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12938. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12939. public AsyncUpdater
  12940. {
  12941. public:
  12942. AudioProcessorGraph();
  12943. ~AudioProcessorGraph();
  12944. class JUCE_API Node : public ReferenceCountedObject
  12945. {
  12946. public:
  12947. ~Node();
  12948. const uint32 id;
  12949. AudioProcessor* const processor;
  12950. NamedValueSet properties;
  12951. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12952. juce_UseDebuggingNewOperator
  12953. private:
  12954. friend class AudioProcessorGraph;
  12955. bool isPrepared;
  12956. Node (const uint32 id, AudioProcessor* const processor);
  12957. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12958. void unprepare();
  12959. Node (const Node&);
  12960. Node& operator= (const Node&);
  12961. };
  12962. struct JUCE_API Connection
  12963. {
  12964. public:
  12965. uint32 sourceNodeId;
  12966. int sourceChannelIndex;
  12967. uint32 destNodeId;
  12968. int destChannelIndex;
  12969. juce_UseDebuggingNewOperator
  12970. private:
  12971. };
  12972. void clear();
  12973. int getNumNodes() const { return nodes.size(); }
  12974. Node* getNode (const int index) const { return nodes [index]; }
  12975. Node* getNodeForId (const uint32 nodeId) const;
  12976. Node* addNode (AudioProcessor* const newProcessor,
  12977. uint32 nodeId = 0);
  12978. bool removeNode (const uint32 nodeId);
  12979. int getNumConnections() const { return connections.size(); }
  12980. const Connection* getConnection (const int index) const { return connections [index]; }
  12981. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12982. const int sourceChannelIndex,
  12983. const uint32 destNodeId,
  12984. const int destChannelIndex) const;
  12985. bool isConnected (const uint32 possibleSourceNodeId,
  12986. const uint32 possibleDestNodeId) const;
  12987. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12988. const uint32 destNodeId, const int destChannelIndex) const;
  12989. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12990. const uint32 destNodeId, const int destChannelIndex);
  12991. void removeConnection (const int index);
  12992. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12993. const uint32 destNodeId, const int destChannelIndex);
  12994. bool disconnectNode (const uint32 nodeId);
  12995. bool removeIllegalConnections();
  12996. static const int midiChannelIndex;
  12997. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12998. {
  12999. public:
  13000. enum IODeviceType
  13001. {
  13002. audioInputNode, /**< In this mode, the processor has output channels
  13003. representing all the audio input channels that are
  13004. coming into its parent audio graph. */
  13005. audioOutputNode, /**< In this mode, the processor has input channels
  13006. representing all the audio output channels that are
  13007. going out of its parent audio graph. */
  13008. midiInputNode, /**< In this mode, the processor has a midi output which
  13009. delivers the same midi data that is arriving at its
  13010. parent graph. */
  13011. midiOutputNode /**< In this mode, the processor has a midi input and
  13012. any data sent to it will be passed out of the parent
  13013. graph. */
  13014. };
  13015. IODeviceType getType() const { return type; }
  13016. AudioProcessorGraph* getParentGraph() const { return graph; }
  13017. bool isInput() const;
  13018. bool isOutput() const;
  13019. AudioGraphIOProcessor (const IODeviceType type);
  13020. ~AudioGraphIOProcessor();
  13021. const String getName() const;
  13022. void fillInPluginDescription (PluginDescription& d) const;
  13023. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13024. void releaseResources();
  13025. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13026. const String getInputChannelName (const int channelIndex) const;
  13027. const String getOutputChannelName (const int channelIndex) const;
  13028. bool isInputChannelStereoPair (int index) const;
  13029. bool isOutputChannelStereoPair (int index) const;
  13030. bool acceptsMidi() const;
  13031. bool producesMidi() const;
  13032. AudioProcessorEditor* createEditor();
  13033. int getNumParameters();
  13034. const String getParameterName (int);
  13035. float getParameter (int);
  13036. const String getParameterText (int);
  13037. void setParameter (int, float);
  13038. int getNumPrograms();
  13039. int getCurrentProgram();
  13040. void setCurrentProgram (int);
  13041. const String getProgramName (int);
  13042. void changeProgramName (int, const String&);
  13043. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13044. void setStateInformation (const void* data, int sizeInBytes);
  13045. void setParentGraph (AudioProcessorGraph* const graph);
  13046. juce_UseDebuggingNewOperator
  13047. private:
  13048. const IODeviceType type;
  13049. AudioProcessorGraph* graph;
  13050. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13051. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13052. };
  13053. // AudioProcessor methods:
  13054. const String getName() const;
  13055. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13056. void releaseResources();
  13057. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13058. const String getInputChannelName (const int channelIndex) const;
  13059. const String getOutputChannelName (const int channelIndex) const;
  13060. bool isInputChannelStereoPair (int index) const;
  13061. bool isOutputChannelStereoPair (int index) const;
  13062. bool acceptsMidi() const;
  13063. bool producesMidi() const;
  13064. AudioProcessorEditor* createEditor() { return 0; }
  13065. int getNumParameters() { return 0; }
  13066. const String getParameterName (int) { return String::empty; }
  13067. float getParameter (int) { return 0; }
  13068. const String getParameterText (int) { return String::empty; }
  13069. void setParameter (int, float) { }
  13070. int getNumPrograms() { return 0; }
  13071. int getCurrentProgram() { return 0; }
  13072. void setCurrentProgram (int) { }
  13073. const String getProgramName (int) { return String::empty; }
  13074. void changeProgramName (int, const String&) { }
  13075. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13076. void setStateInformation (const void* data, int sizeInBytes);
  13077. void handleAsyncUpdate();
  13078. juce_UseDebuggingNewOperator
  13079. private:
  13080. ReferenceCountedArray <Node> nodes;
  13081. OwnedArray <Connection> connections;
  13082. int lastNodeId;
  13083. AudioSampleBuffer renderingBuffers;
  13084. OwnedArray <MidiBuffer> midiBuffers;
  13085. CriticalSection renderLock;
  13086. VoidArray renderingOps;
  13087. friend class AudioGraphIOProcessor;
  13088. AudioSampleBuffer* currentAudioInputBuffer;
  13089. AudioSampleBuffer currentAudioOutputBuffer;
  13090. MidiBuffer* currentMidiInputBuffer;
  13091. MidiBuffer currentMidiOutputBuffer;
  13092. void clearRenderingSequence();
  13093. void buildRenderingSequence();
  13094. bool isAnInputTo (const uint32 possibleInputId,
  13095. const uint32 possibleDestinationId,
  13096. const int recursionCheck) const;
  13097. AudioProcessorGraph (const AudioProcessorGraph&);
  13098. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13099. };
  13100. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13101. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13102. #endif
  13103. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13104. #endif
  13105. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13106. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13107. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13108. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13109. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13110. public MidiInputCallback
  13111. {
  13112. public:
  13113. AudioProcessorPlayer();
  13114. virtual ~AudioProcessorPlayer();
  13115. void setProcessor (AudioProcessor* const processorToPlay);
  13116. AudioProcessor* getCurrentProcessor() const { return processor; }
  13117. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13118. void audioDeviceIOCallback (const float** inputChannelData,
  13119. int totalNumInputChannels,
  13120. float** outputChannelData,
  13121. int totalNumOutputChannels,
  13122. int numSamples);
  13123. void audioDeviceAboutToStart (AudioIODevice* device);
  13124. void audioDeviceStopped();
  13125. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13126. juce_UseDebuggingNewOperator
  13127. private:
  13128. AudioProcessor* processor;
  13129. CriticalSection lock;
  13130. double sampleRate;
  13131. int blockSize;
  13132. bool isPrepared;
  13133. int numInputChans, numOutputChans;
  13134. float* channels [128];
  13135. AudioSampleBuffer tempBuffer;
  13136. MidiBuffer incomingMidi;
  13137. MidiMessageCollector messageCollector;
  13138. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13139. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13140. };
  13141. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13142. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13143. #endif
  13144. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13145. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13146. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13147. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13148. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13149. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13150. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13151. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13152. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13153. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13154. class EditableProperty;
  13155. class JUCE_API PropertyComponent : public Component,
  13156. public SettableTooltipClient
  13157. {
  13158. public:
  13159. PropertyComponent (const String& propertyName,
  13160. const int preferredHeight = 25);
  13161. ~PropertyComponent();
  13162. int getPreferredHeight() const throw() { return preferredHeight; }
  13163. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13164. virtual void refresh() = 0;
  13165. void paint (Graphics& g);
  13166. void resized();
  13167. void enablementChanged();
  13168. juce_UseDebuggingNewOperator
  13169. protected:
  13170. int preferredHeight;
  13171. };
  13172. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13173. /*** End of inlined file: juce_PropertyComponent.h ***/
  13174. class JUCE_API PropertyPanel : public Component
  13175. {
  13176. public:
  13177. PropertyPanel();
  13178. ~PropertyPanel();
  13179. void clear();
  13180. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13181. void addSection (const String& sectionTitle,
  13182. const Array <PropertyComponent*>& newPropertyComponents,
  13183. const bool shouldSectionInitiallyBeOpen = true);
  13184. void refreshAll() const;
  13185. const StringArray getSectionNames() const;
  13186. bool isSectionOpen (const int sectionIndex) const;
  13187. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  13188. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  13189. XmlElement* getOpennessState() const;
  13190. void restoreOpennessState (const XmlElement& newState);
  13191. void setMessageWhenEmpty (const String& newMessage);
  13192. const String& getMessageWhenEmpty() const;
  13193. void paint (Graphics& g);
  13194. void resized();
  13195. juce_UseDebuggingNewOperator
  13196. private:
  13197. Viewport* viewport;
  13198. Component* propertyHolderComponent;
  13199. String messageWhenEmpty;
  13200. void updatePropHolderLayout() const;
  13201. void updatePropHolderLayout (const int width) const;
  13202. };
  13203. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13204. /*** End of inlined file: juce_PropertyPanel.h ***/
  13205. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13206. {
  13207. public:
  13208. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13209. ~GenericAudioProcessorEditor();
  13210. void paint (Graphics& g);
  13211. void resized();
  13212. juce_UseDebuggingNewOperator
  13213. private:
  13214. PropertyPanel* panel;
  13215. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13216. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13217. };
  13218. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13219. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13220. #endif
  13221. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13222. /*** Start of inlined file: juce_Sampler.h ***/
  13223. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13224. #define __JUCE_SAMPLER_JUCEHEADER__
  13225. /*** Start of inlined file: juce_Synthesiser.h ***/
  13226. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13227. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13228. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13229. {
  13230. protected:
  13231. SynthesiserSound();
  13232. public:
  13233. virtual ~SynthesiserSound();
  13234. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13235. virtual bool appliesToChannel (const int midiChannel) = 0;
  13236. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13237. juce_UseDebuggingNewOperator
  13238. };
  13239. class JUCE_API SynthesiserVoice
  13240. {
  13241. public:
  13242. SynthesiserVoice();
  13243. virtual ~SynthesiserVoice();
  13244. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13245. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13246. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13247. virtual void startNote (const int midiNoteNumber,
  13248. const float velocity,
  13249. SynthesiserSound* sound,
  13250. const int currentPitchWheelPosition) = 0;
  13251. virtual void stopNote (const bool allowTailOff) = 0;
  13252. virtual void pitchWheelMoved (const int newValue) = 0;
  13253. virtual void controllerMoved (const int controllerNumber,
  13254. const int newValue) = 0;
  13255. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13256. int startSample,
  13257. int numSamples) = 0;
  13258. bool isPlayingChannel (const int midiChannel) const;
  13259. void setCurrentPlaybackSampleRate (const double newRate);
  13260. juce_UseDebuggingNewOperator
  13261. protected:
  13262. double getSampleRate() const { return currentSampleRate; }
  13263. void clearCurrentNote();
  13264. private:
  13265. friend class Synthesiser;
  13266. double currentSampleRate;
  13267. int currentlyPlayingNote;
  13268. uint32 noteOnTime;
  13269. SynthesiserSound::Ptr currentlyPlayingSound;
  13270. };
  13271. class JUCE_API Synthesiser
  13272. {
  13273. public:
  13274. Synthesiser();
  13275. virtual ~Synthesiser();
  13276. void clearVoices();
  13277. int getNumVoices() const { return voices.size(); }
  13278. SynthesiserVoice* getVoice (const int index) const;
  13279. void addVoice (SynthesiserVoice* const newVoice);
  13280. void removeVoice (const int index);
  13281. void clearSounds();
  13282. int getNumSounds() const { return sounds.size(); }
  13283. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13284. void addSound (const SynthesiserSound::Ptr& newSound);
  13285. void removeSound (const int index);
  13286. void setNoteStealingEnabled (const bool shouldStealNotes);
  13287. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13288. virtual void noteOn (const int midiChannel,
  13289. const int midiNoteNumber,
  13290. const float velocity);
  13291. virtual void noteOff (const int midiChannel,
  13292. const int midiNoteNumber,
  13293. const bool allowTailOff);
  13294. virtual void allNotesOff (const int midiChannel,
  13295. const bool allowTailOff);
  13296. virtual void handlePitchWheel (const int midiChannel,
  13297. const int wheelValue);
  13298. virtual void handleController (const int midiChannel,
  13299. const int controllerNumber,
  13300. const int controllerValue);
  13301. void setCurrentPlaybackSampleRate (const double sampleRate);
  13302. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13303. const MidiBuffer& inputMidi,
  13304. int startSample,
  13305. int numSamples);
  13306. juce_UseDebuggingNewOperator
  13307. protected:
  13308. CriticalSection lock;
  13309. OwnedArray <SynthesiserVoice> voices;
  13310. ReferenceCountedArray <SynthesiserSound> sounds;
  13311. int lastPitchWheelValues [16];
  13312. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13313. const bool stealIfNoneAvailable) const;
  13314. void startVoice (SynthesiserVoice* const voice,
  13315. SynthesiserSound* const sound,
  13316. const int midiChannel,
  13317. const int midiNoteNumber,
  13318. const float velocity);
  13319. int findFreeVoice (const bool) const { return 0; }
  13320. private:
  13321. double sampleRate;
  13322. uint32 lastNoteOnCounter;
  13323. bool shouldStealNotes;
  13324. Synthesiser (const Synthesiser&);
  13325. Synthesiser& operator= (const Synthesiser&);
  13326. };
  13327. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13328. /*** End of inlined file: juce_Synthesiser.h ***/
  13329. class JUCE_API SamplerSound : public SynthesiserSound
  13330. {
  13331. public:
  13332. SamplerSound (const String& name,
  13333. AudioFormatReader& source,
  13334. const BigInteger& midiNotes,
  13335. const int midiNoteForNormalPitch,
  13336. const double attackTimeSecs,
  13337. const double releaseTimeSecs,
  13338. const double maxSampleLengthSeconds);
  13339. ~SamplerSound();
  13340. const String& getName() const { return name; }
  13341. AudioSampleBuffer* getAudioData() const { return data; }
  13342. bool appliesToNote (const int midiNoteNumber);
  13343. bool appliesToChannel (const int midiChannel);
  13344. juce_UseDebuggingNewOperator
  13345. private:
  13346. friend class SamplerVoice;
  13347. String name;
  13348. ScopedPointer <AudioSampleBuffer> data;
  13349. double sourceSampleRate;
  13350. BigInteger midiNotes;
  13351. int length, attackSamples, releaseSamples;
  13352. int midiRootNote;
  13353. };
  13354. class JUCE_API SamplerVoice : public SynthesiserVoice
  13355. {
  13356. public:
  13357. SamplerVoice();
  13358. ~SamplerVoice();
  13359. bool canPlaySound (SynthesiserSound* sound);
  13360. void startNote (const int midiNoteNumber,
  13361. const float velocity,
  13362. SynthesiserSound* sound,
  13363. const int currentPitchWheelPosition);
  13364. void stopNote (const bool allowTailOff);
  13365. void pitchWheelMoved (const int newValue);
  13366. void controllerMoved (const int controllerNumber,
  13367. const int newValue);
  13368. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13369. juce_UseDebuggingNewOperator
  13370. private:
  13371. double pitchRatio;
  13372. double sourceSamplePosition;
  13373. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13374. bool isInAttack, isInRelease;
  13375. };
  13376. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13377. /*** End of inlined file: juce_Sampler.h ***/
  13378. #endif
  13379. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13380. #endif
  13381. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13382. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13383. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13384. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13385. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13386. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13387. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13388. class JUCE_API ActionListenerList : public MessageListener
  13389. {
  13390. public:
  13391. ActionListenerList() throw();
  13392. ~ActionListenerList() throw();
  13393. void addActionListener (ActionListener* const listener) throw();
  13394. void removeActionListener (ActionListener* const listener) throw();
  13395. void removeAllActionListeners() throw();
  13396. void sendActionMessage (const String& message) const;
  13397. void handleMessage (const Message&);
  13398. juce_UseDebuggingNewOperator
  13399. private:
  13400. SortedSet <void*> actionListeners_;
  13401. CriticalSection actionListenerLock_;
  13402. ActionListenerList (const ActionListenerList&);
  13403. ActionListenerList& operator= (const ActionListenerList&);
  13404. };
  13405. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13406. /*** End of inlined file: juce_ActionListenerList.h ***/
  13407. class JUCE_API ActionBroadcaster
  13408. {
  13409. public:
  13410. ActionBroadcaster() throw();
  13411. virtual ~ActionBroadcaster();
  13412. void addActionListener (ActionListener* const listener);
  13413. void removeActionListener (ActionListener* const listener);
  13414. void removeAllActionListeners();
  13415. void sendActionMessage (const String& message) const;
  13416. private:
  13417. ActionListenerList actionListenerList;
  13418. ActionBroadcaster (const ActionBroadcaster&);
  13419. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13420. };
  13421. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13422. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13423. #endif
  13424. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13425. #endif
  13426. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13427. #endif
  13428. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13429. #endif
  13430. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13431. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13432. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13433. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13434. class JUCE_API CallbackMessage : public Message
  13435. {
  13436. public:
  13437. CallbackMessage() throw();
  13438. ~CallbackMessage() throw();
  13439. virtual void messageCallback() = 0;
  13440. void post();
  13441. juce_UseDebuggingNewOperator
  13442. private:
  13443. CallbackMessage (const CallbackMessage&);
  13444. CallbackMessage& operator= (const CallbackMessage&);
  13445. };
  13446. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13447. /*** End of inlined file: juce_CallbackMessage.h ***/
  13448. #endif
  13449. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13450. #endif
  13451. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13452. #endif
  13453. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13454. #endif
  13455. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13456. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13457. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13458. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13459. class InterprocessConnectionServer;
  13460. class JUCE_API InterprocessConnection : public Thread,
  13461. private MessageListener
  13462. {
  13463. public:
  13464. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13465. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13466. ~InterprocessConnection();
  13467. bool connectToSocket (const String& hostName,
  13468. const int portNumber,
  13469. const int timeOutMillisecs);
  13470. bool connectToPipe (const String& pipeName,
  13471. const int pipeReceiveMessageTimeoutMs = -1);
  13472. bool createPipe (const String& pipeName,
  13473. const int pipeReceiveMessageTimeoutMs = -1);
  13474. void disconnect();
  13475. bool isConnected() const;
  13476. StreamingSocket* getSocket() const throw() { return socket; }
  13477. NamedPipe* getPipe() const throw() { return pipe; }
  13478. const String getConnectedHostName() const;
  13479. bool sendMessage (const MemoryBlock& message);
  13480. virtual void connectionMade() = 0;
  13481. virtual void connectionLost() = 0;
  13482. virtual void messageReceived (const MemoryBlock& message) = 0;
  13483. juce_UseDebuggingNewOperator
  13484. private:
  13485. CriticalSection pipeAndSocketLock;
  13486. ScopedPointer <StreamingSocket> socket;
  13487. ScopedPointer <NamedPipe> pipe;
  13488. bool callbackConnectionState;
  13489. const bool useMessageThread;
  13490. const uint32 magicMessageHeader;
  13491. int pipeReceiveMessageTimeout;
  13492. friend class InterprocessConnectionServer;
  13493. void initialiseWithSocket (StreamingSocket* const socket_);
  13494. void initialiseWithPipe (NamedPipe* const pipe_);
  13495. void handleMessage (const Message& message);
  13496. void connectionMadeInt();
  13497. void connectionLostInt();
  13498. void deliverDataInt (const MemoryBlock& data);
  13499. bool readNextMessageInt();
  13500. void run();
  13501. InterprocessConnection (const InterprocessConnection&);
  13502. InterprocessConnection& operator= (const InterprocessConnection&);
  13503. };
  13504. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13505. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13506. #endif
  13507. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13508. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13509. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13510. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13511. class JUCE_API InterprocessConnectionServer : private Thread
  13512. {
  13513. public:
  13514. InterprocessConnectionServer();
  13515. ~InterprocessConnectionServer();
  13516. bool beginWaitingForSocket (const int portNumber);
  13517. void stop();
  13518. protected:
  13519. virtual InterprocessConnection* createConnectionObject() = 0;
  13520. public:
  13521. juce_UseDebuggingNewOperator
  13522. private:
  13523. ScopedPointer <StreamingSocket> socket;
  13524. void run();
  13525. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13526. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13527. };
  13528. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13529. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13530. #endif
  13531. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13532. #endif
  13533. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13534. #endif
  13535. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13536. #endif
  13537. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13538. /*** Start of inlined file: juce_MessageManager.h ***/
  13539. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13540. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13541. class Component;
  13542. class MessageManagerLock;
  13543. typedef void* (MessageCallbackFunction) (void* userData);
  13544. class JUCE_API MessageManager
  13545. {
  13546. public:
  13547. static MessageManager* getInstance() throw();
  13548. void runDispatchLoop();
  13549. void stopDispatchLoop();
  13550. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13551. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13552. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13553. void* userData);
  13554. bool isThisTheMessageThread() const throw();
  13555. void setCurrentThreadAsMessageThread();
  13556. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13557. bool currentThreadHasLockedMessageManager() const throw();
  13558. static void broadcastMessage (const String& messageText) throw();
  13559. void registerBroadcastListener (ActionListener* listener) throw();
  13560. void deregisterBroadcastListener (ActionListener* listener) throw();
  13561. void deliverMessage (void*);
  13562. void deliverBroadcastMessage (const String&);
  13563. ~MessageManager() throw();
  13564. juce_UseDebuggingNewOperator
  13565. private:
  13566. MessageManager() throw();
  13567. friend class MessageListener;
  13568. friend class ChangeBroadcaster;
  13569. friend class ActionBroadcaster;
  13570. friend class CallbackMessage;
  13571. static MessageManager* instance;
  13572. SortedSet <const MessageListener*> messageListeners;
  13573. ScopedPointer <ActionListenerList> broadcastListeners;
  13574. friend class JUCEApplication;
  13575. bool quitMessagePosted, quitMessageReceived;
  13576. Thread::ThreadID messageThreadId;
  13577. VoidArray modalComponents;
  13578. static void* exitModalLoopCallback (void*);
  13579. void postMessageToQueue (Message* const message);
  13580. void postCallbackMessage (Message* const message);
  13581. static void doPlatformSpecificInitialisation();
  13582. static void doPlatformSpecificShutdown();
  13583. friend class MessageManagerLock;
  13584. Thread::ThreadID volatile threadWithLock;
  13585. CriticalSection lockingLock;
  13586. MessageManager (const MessageManager&);
  13587. MessageManager& operator= (const MessageManager&);
  13588. };
  13589. class JUCE_API MessageManagerLock
  13590. {
  13591. public:
  13592. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13593. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13594. ~MessageManagerLock() throw();
  13595. bool lockWasGained() const throw() { return locked; }
  13596. private:
  13597. class SharedEvents;
  13598. class BlockingMessage;
  13599. friend class SharedEvents;
  13600. friend class BlockingMessage;
  13601. SharedEvents* sharedEvents;
  13602. bool locked;
  13603. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13604. MessageManagerLock (const MessageManagerLock&);
  13605. MessageManagerLock& operator= (const MessageManagerLock&);
  13606. };
  13607. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13608. /*** End of inlined file: juce_MessageManager.h ***/
  13609. #endif
  13610. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13611. /*** Start of inlined file: juce_MultiTimer.h ***/
  13612. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13613. #define __JUCE_MULTITIMER_JUCEHEADER__
  13614. class JUCE_API MultiTimer
  13615. {
  13616. protected:
  13617. MultiTimer() throw();
  13618. MultiTimer (const MultiTimer& other) throw();
  13619. public:
  13620. virtual ~MultiTimer();
  13621. virtual void timerCallback (const int timerId) = 0;
  13622. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13623. void stopTimer (const int timerId) throw();
  13624. bool isTimerRunning (const int timerId) const throw();
  13625. int getTimerInterval (const int timerId) const throw();
  13626. private:
  13627. class MultiTimerCallback;
  13628. CriticalSection timerListLock;
  13629. OwnedArray <MultiTimerCallback> timers;
  13630. MultiTimer& operator= (const MultiTimer&);
  13631. };
  13632. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13633. /*** End of inlined file: juce_MultiTimer.h ***/
  13634. #endif
  13635. #ifndef __JUCE_TIMER_JUCEHEADER__
  13636. #endif
  13637. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13638. /*** Start of inlined file: juce_ArrowButton.h ***/
  13639. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13640. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13641. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13642. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13643. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13644. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13645. {
  13646. public:
  13647. DropShadowEffect();
  13648. ~DropShadowEffect();
  13649. void setShadowProperties (const float newRadius,
  13650. const float newOpacity,
  13651. const int newShadowOffsetX,
  13652. const int newShadowOffsetY);
  13653. void applyEffect (Image& sourceImage, Graphics& destContext);
  13654. juce_UseDebuggingNewOperator
  13655. private:
  13656. int offsetX, offsetY;
  13657. float radius, opacity;
  13658. };
  13659. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13660. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13661. class JUCE_API ArrowButton : public Button
  13662. {
  13663. public:
  13664. ArrowButton (const String& buttonName,
  13665. float arrowDirection,
  13666. const Colour& arrowColour);
  13667. ~ArrowButton();
  13668. juce_UseDebuggingNewOperator
  13669. protected:
  13670. void paintButton (Graphics& g,
  13671. bool isMouseOverButton,
  13672. bool isButtonDown);
  13673. void buttonStateChanged();
  13674. private:
  13675. Colour colour;
  13676. DropShadowEffect shadow;
  13677. Path path;
  13678. int offset;
  13679. ArrowButton (const ArrowButton&);
  13680. ArrowButton& operator= (const ArrowButton&);
  13681. };
  13682. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13683. /*** End of inlined file: juce_ArrowButton.h ***/
  13684. #endif
  13685. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13686. #endif
  13687. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13688. /*** Start of inlined file: juce_DrawableButton.h ***/
  13689. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13690. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13691. /*** Start of inlined file: juce_Drawable.h ***/
  13692. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13693. #define __JUCE_DRAWABLE_JUCEHEADER__
  13694. class JUCE_API Drawable
  13695. {
  13696. protected:
  13697. Drawable();
  13698. public:
  13699. virtual ~Drawable();
  13700. virtual Drawable* createCopy() const = 0;
  13701. void draw (Graphics& g, const float opacity,
  13702. const AffineTransform& transform = AffineTransform::identity) const;
  13703. void drawAt (Graphics& g,
  13704. const float x,
  13705. const float y,
  13706. const float opacity) const;
  13707. void drawWithin (Graphics& g,
  13708. const int destX,
  13709. const int destY,
  13710. const int destWidth,
  13711. const int destHeight,
  13712. const RectanglePlacement& placement,
  13713. const float opacity) const;
  13714. class RenderingContext
  13715. {
  13716. public:
  13717. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13718. Graphics& g;
  13719. AffineTransform transform;
  13720. float opacity;
  13721. private:
  13722. RenderingContext& operator= (const RenderingContext&);
  13723. };
  13724. virtual void render (const RenderingContext& context) const = 0;
  13725. virtual const Rectangle<float> getBounds() const = 0;
  13726. virtual bool hitTest (float x, float y) const = 0;
  13727. const String& getName() const throw() { return name; }
  13728. void setName (const String& newName) throw() { name = newName; }
  13729. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13730. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13731. static Drawable* createFromImageFile (const File& file);
  13732. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13733. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13734. virtual ValueTree createValueTree() const throw() = 0;
  13735. juce_UseDebuggingNewOperator
  13736. private:
  13737. Drawable (const Drawable&);
  13738. Drawable& operator= (const Drawable&);
  13739. String name;
  13740. };
  13741. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13742. /*** End of inlined file: juce_Drawable.h ***/
  13743. class JUCE_API DrawableButton : public Button
  13744. {
  13745. public:
  13746. enum ButtonStyle
  13747. {
  13748. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13749. ImageRaw, /**< The button will just display the images in their normal size and position.
  13750. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13751. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13752. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13753. };
  13754. DrawableButton (const String& buttonName,
  13755. const ButtonStyle buttonStyle);
  13756. ~DrawableButton();
  13757. void setImages (const Drawable* normalImage,
  13758. const Drawable* overImage = 0,
  13759. const Drawable* downImage = 0,
  13760. const Drawable* disabledImage = 0,
  13761. const Drawable* normalImageOn = 0,
  13762. const Drawable* overImageOn = 0,
  13763. const Drawable* downImageOn = 0,
  13764. const Drawable* disabledImageOn = 0);
  13765. void setButtonStyle (const ButtonStyle newStyle);
  13766. void setBackgroundColours (const Colour& toggledOffColour,
  13767. const Colour& toggledOnColour);
  13768. const Colour& getBackgroundColour() const throw();
  13769. void setEdgeIndent (const int numPixelsIndent);
  13770. const Drawable* getCurrentImage() const throw();
  13771. const Drawable* getNormalImage() const throw();
  13772. const Drawable* getOverImage() const throw();
  13773. const Drawable* getDownImage() const throw();
  13774. juce_UseDebuggingNewOperator
  13775. protected:
  13776. void paintButton (Graphics& g,
  13777. bool isMouseOverButton,
  13778. bool isButtonDown);
  13779. private:
  13780. ButtonStyle style;
  13781. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13782. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13783. Colour backgroundOff, backgroundOn;
  13784. int edgeIndent;
  13785. void deleteImages();
  13786. DrawableButton (const DrawableButton&);
  13787. DrawableButton& operator= (const DrawableButton&);
  13788. };
  13789. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13790. /*** End of inlined file: juce_DrawableButton.h ***/
  13791. #endif
  13792. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13793. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13794. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13795. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13796. class JUCE_API HyperlinkButton : public Button
  13797. {
  13798. public:
  13799. HyperlinkButton (const String& linkText,
  13800. const URL& linkURL);
  13801. ~HyperlinkButton();
  13802. void setFont (const Font& newFont,
  13803. const bool resizeToMatchComponentHeight,
  13804. const Justification& justificationType = Justification::horizontallyCentred);
  13805. enum ColourIds
  13806. {
  13807. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13808. };
  13809. void setURL (const URL& newURL) throw();
  13810. const URL& getURL() const throw() { return url; }
  13811. void changeWidthToFitText();
  13812. juce_UseDebuggingNewOperator
  13813. protected:
  13814. void clicked();
  13815. void colourChanged();
  13816. void paintButton (Graphics& g,
  13817. bool isMouseOverButton,
  13818. bool isButtonDown);
  13819. private:
  13820. URL url;
  13821. Font font;
  13822. bool resizeFont;
  13823. Justification justification;
  13824. const Font getFontToUse() const;
  13825. HyperlinkButton (const HyperlinkButton&);
  13826. HyperlinkButton& operator= (const HyperlinkButton&);
  13827. };
  13828. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13829. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13830. #endif
  13831. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13832. /*** Start of inlined file: juce_ImageButton.h ***/
  13833. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13834. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13835. class JUCE_API ImageButton : public Button
  13836. {
  13837. public:
  13838. ImageButton (const String& name);
  13839. ~ImageButton();
  13840. void setImages (const bool resizeButtonNowToFitThisImage,
  13841. const bool rescaleImagesWhenButtonSizeChanges,
  13842. const bool preserveImageProportions,
  13843. Image* const normalImage,
  13844. const float imageOpacityWhenNormal,
  13845. const Colour& overlayColourWhenNormal,
  13846. Image* const overImage,
  13847. const float imageOpacityWhenOver,
  13848. const Colour& overlayColourWhenOver,
  13849. Image* const downImage,
  13850. const float imageOpacityWhenDown,
  13851. const Colour& overlayColourWhenDown,
  13852. const float hitTestAlphaThreshold = 0.0f);
  13853. Image* getNormalImage() const throw();
  13854. Image* getOverImage() const throw();
  13855. Image* getDownImage() const throw();
  13856. juce_UseDebuggingNewOperator
  13857. protected:
  13858. bool hitTest (int x, int y);
  13859. void paintButton (Graphics& g,
  13860. bool isMouseOverButton,
  13861. bool isButtonDown);
  13862. private:
  13863. bool scaleImageToFit, preserveProportions;
  13864. unsigned char alphaThreshold;
  13865. int imageX, imageY, imageW, imageH;
  13866. Image* normalImage;
  13867. Image* overImage;
  13868. Image* downImage;
  13869. float normalOpacity, overOpacity, downOpacity;
  13870. Colour normalOverlay, overOverlay, downOverlay;
  13871. Image* getCurrentImage() const;
  13872. void deleteImages();
  13873. ImageButton (const ImageButton&);
  13874. ImageButton& operator= (const ImageButton&);
  13875. };
  13876. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13877. /*** End of inlined file: juce_ImageButton.h ***/
  13878. #endif
  13879. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13880. /*** Start of inlined file: juce_ShapeButton.h ***/
  13881. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13882. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13883. class JUCE_API ShapeButton : public Button
  13884. {
  13885. public:
  13886. ShapeButton (const String& name,
  13887. const Colour& normalColour,
  13888. const Colour& overColour,
  13889. const Colour& downColour);
  13890. ~ShapeButton();
  13891. void setShape (const Path& newShape,
  13892. const bool resizeNowToFitThisShape,
  13893. const bool maintainShapeProportions,
  13894. const bool hasDropShadow);
  13895. void setColours (const Colour& normalColour,
  13896. const Colour& overColour,
  13897. const Colour& downColour);
  13898. void setOutline (const Colour& outlineColour,
  13899. const float outlineStrokeWidth);
  13900. juce_UseDebuggingNewOperator
  13901. protected:
  13902. void paintButton (Graphics& g,
  13903. bool isMouseOverButton,
  13904. bool isButtonDown);
  13905. private:
  13906. Colour normalColour, overColour, downColour, outlineColour;
  13907. DropShadowEffect shadow;
  13908. Path shape;
  13909. bool maintainShapeProportions;
  13910. float outlineWidth;
  13911. ShapeButton (const ShapeButton&);
  13912. ShapeButton& operator= (const ShapeButton&);
  13913. };
  13914. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13915. /*** End of inlined file: juce_ShapeButton.h ***/
  13916. #endif
  13917. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13918. #endif
  13919. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13920. /*** Start of inlined file: juce_ToggleButton.h ***/
  13921. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13922. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13923. class JUCE_API ToggleButton : public Button
  13924. {
  13925. public:
  13926. ToggleButton (const String& buttonText);
  13927. ~ToggleButton();
  13928. void changeWidthToFitText();
  13929. enum ColourIds
  13930. {
  13931. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13932. };
  13933. juce_UseDebuggingNewOperator
  13934. protected:
  13935. void paintButton (Graphics& g,
  13936. bool isMouseOverButton,
  13937. bool isButtonDown);
  13938. void colourChanged();
  13939. private:
  13940. ToggleButton (const ToggleButton&);
  13941. ToggleButton& operator= (const ToggleButton&);
  13942. };
  13943. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13944. /*** End of inlined file: juce_ToggleButton.h ***/
  13945. #endif
  13946. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13947. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13948. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13949. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13950. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13951. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13952. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13953. /*** Start of inlined file: juce_Toolbar.h ***/
  13954. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13955. #define __JUCE_TOOLBAR_JUCEHEADER__
  13956. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13957. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13958. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13959. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13960. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13961. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13962. class JUCE_API DragAndDropTarget
  13963. {
  13964. public:
  13965. virtual ~DragAndDropTarget() {}
  13966. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13967. Component* sourceComponent) = 0;
  13968. virtual void itemDragEnter (const String& sourceDescription,
  13969. Component* sourceComponent,
  13970. int x,
  13971. int y);
  13972. virtual void itemDragMove (const String& sourceDescription,
  13973. Component* sourceComponent,
  13974. int x,
  13975. int y);
  13976. virtual void itemDragExit (const String& sourceDescription,
  13977. Component* sourceComponent);
  13978. virtual void itemDropped (const String& sourceDescription,
  13979. Component* sourceComponent,
  13980. int x,
  13981. int y) = 0;
  13982. virtual bool shouldDrawDragImageWhenOver();
  13983. };
  13984. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13985. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13986. class JUCE_API DragAndDropContainer
  13987. {
  13988. public:
  13989. DragAndDropContainer();
  13990. virtual ~DragAndDropContainer();
  13991. void startDragging (const String& sourceDescription,
  13992. Component* sourceComponent,
  13993. Image* dragImage = 0,
  13994. const bool allowDraggingToOtherJuceWindows = false,
  13995. const Point<int>* imageOffsetFromMouse = 0);
  13996. bool isDragAndDropActive() const;
  13997. const String getCurrentDragDescription() const;
  13998. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13999. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  14000. static bool performExternalDragDropOfText (const String& text);
  14001. juce_UseDebuggingNewOperator
  14002. protected:
  14003. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14004. Component* dragSourceComponent,
  14005. StringArray& files,
  14006. bool& canMoveFiles);
  14007. private:
  14008. friend class DragImageComponent;
  14009. ScopedPointer <Component> dragImageComponent;
  14010. String currentDragDesc;
  14011. };
  14012. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14013. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14014. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14015. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14016. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14017. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14018. private Timer
  14019. {
  14020. public:
  14021. ComponentAnimator();
  14022. ~ComponentAnimator();
  14023. void animateComponent (Component* const component,
  14024. const Rectangle<int>& finalPosition,
  14025. const int millisecondsToSpendMoving,
  14026. const double startSpeed = 1.0,
  14027. const double endSpeed = 1.0);
  14028. void cancelAnimation (Component* const component,
  14029. const bool moveComponentToItsFinalPosition);
  14030. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  14031. const Rectangle<int> getComponentDestination (Component* const component);
  14032. bool isAnimating (Component* component) const;
  14033. juce_UseDebuggingNewOperator
  14034. private:
  14035. VoidArray tasks;
  14036. uint32 lastTime;
  14037. void* findTaskFor (Component* const component) const;
  14038. void timerCallback();
  14039. };
  14040. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14041. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14042. class ToolbarItemComponent;
  14043. class ToolbarItemFactory;
  14044. class MissingItemsComponent;
  14045. class JUCE_API Toolbar : public Component,
  14046. public DragAndDropContainer,
  14047. public DragAndDropTarget,
  14048. private ButtonListener
  14049. {
  14050. public:
  14051. Toolbar();
  14052. ~Toolbar();
  14053. void setVertical (const bool shouldBeVertical);
  14054. bool isVertical() const throw() { return vertical; }
  14055. int getThickness() const throw();
  14056. int getLength() const throw();
  14057. void clear();
  14058. void addItem (ToolbarItemFactory& factory,
  14059. const int itemId,
  14060. const int insertIndex = -1);
  14061. void removeToolbarItem (const int itemIndex);
  14062. int getNumItems() const throw();
  14063. int getItemId (const int itemIndex) const throw();
  14064. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  14065. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14066. enum ToolbarItemStyle
  14067. {
  14068. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14069. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14070. textOnly /**< Means that the toolbar only display text labels for each item. */
  14071. };
  14072. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14073. void setStyle (const ToolbarItemStyle& newStyle);
  14074. enum CustomisationFlags
  14075. {
  14076. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14077. show the "icons only" option on its choice of toolbar styles. */
  14078. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14079. show the "icons with text" option on its choice of toolbar styles. */
  14080. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14081. show the "text only" option on its choice of toolbar styles. */
  14082. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14083. show a button to reset the toolbar to its default set of items. */
  14084. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14085. };
  14086. void showCustomisationDialog (ToolbarItemFactory& factory,
  14087. const int optionFlags = allCustomisationOptionsEnabled);
  14088. void setEditingActive (const bool editingEnabled);
  14089. enum ColourIds
  14090. {
  14091. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14092. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14093. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14094. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14095. over them. */
  14096. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14097. held down on them. */
  14098. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14099. when the style is set to iconsWithText or textOnly. */
  14100. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14101. the customisation dialog is active and the mouse moves over them. */
  14102. };
  14103. const String toString() const;
  14104. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14105. const String& savedVersion);
  14106. void paint (Graphics& g);
  14107. void resized();
  14108. void buttonClicked (Button*);
  14109. void mouseDown (const MouseEvent&);
  14110. bool isInterestedInDragSource (const String&, Component*);
  14111. void itemDragMove (const String&, Component*, int, int);
  14112. void itemDragExit (const String&, Component*);
  14113. void itemDropped (const String&, Component*, int, int);
  14114. void updateAllItemPositions (const bool animate);
  14115. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14116. juce_UseDebuggingNewOperator
  14117. private:
  14118. Button* missingItemsButton;
  14119. bool vertical, isEditingActive;
  14120. ToolbarItemStyle toolbarStyle;
  14121. ComponentAnimator animator;
  14122. friend class MissingItemsComponent;
  14123. Array <ToolbarItemComponent*> items;
  14124. friend class ItemDragAndDropOverlayComponent;
  14125. static const tchar* const toolbarDragDescriptor;
  14126. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14127. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14128. Toolbar (const Toolbar&);
  14129. Toolbar& operator= (const Toolbar&);
  14130. };
  14131. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14132. /*** End of inlined file: juce_Toolbar.h ***/
  14133. class ItemDragAndDropOverlayComponent;
  14134. class JUCE_API ToolbarItemComponent : public Button
  14135. {
  14136. public:
  14137. ToolbarItemComponent (const int itemId,
  14138. const String& labelText,
  14139. const bool isBeingUsedAsAButton);
  14140. ~ToolbarItemComponent();
  14141. int getItemId() const throw() { return itemId; }
  14142. Toolbar* getToolbar() const;
  14143. bool isToolbarVertical() const;
  14144. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14145. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14146. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14147. virtual bool getToolbarItemSizes (int toolbarThickness,
  14148. bool isToolbarVertical,
  14149. int& preferredSize,
  14150. int& minSize,
  14151. int& maxSize) = 0;
  14152. virtual void paintButtonArea (Graphics& g,
  14153. int width, int height,
  14154. bool isMouseOver, bool isMouseDown) = 0;
  14155. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14156. enum ToolbarEditingMode
  14157. {
  14158. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14159. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14160. customisation mode, and the items can be dragged around. */
  14161. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14162. dragged onto a toolbar to add it to that bar.*/
  14163. };
  14164. void setEditingMode (const ToolbarEditingMode newMode);
  14165. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14166. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14167. void resized();
  14168. juce_UseDebuggingNewOperator
  14169. private:
  14170. friend class Toolbar;
  14171. friend class ItemDragAndDropOverlayComponent;
  14172. const int itemId;
  14173. ToolbarEditingMode mode;
  14174. Toolbar::ToolbarItemStyle toolbarStyle;
  14175. ScopedPointer <Component> overlayComp;
  14176. int dragOffsetX, dragOffsetY;
  14177. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14178. Rectangle<int> contentArea;
  14179. ToolbarItemComponent (const ToolbarItemComponent&);
  14180. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14181. };
  14182. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14183. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14184. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14185. {
  14186. public:
  14187. ToolbarButton (const int itemId,
  14188. const String& labelText,
  14189. Drawable* const normalImage,
  14190. Drawable* const toggledOnImage);
  14191. ~ToolbarButton();
  14192. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14193. int& minSize, int& maxSize);
  14194. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14195. void contentAreaChanged (const Rectangle<int>& newBounds);
  14196. juce_UseDebuggingNewOperator
  14197. private:
  14198. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14199. ToolbarButton (const ToolbarButton&);
  14200. ToolbarButton& operator= (const ToolbarButton&);
  14201. };
  14202. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14203. /*** End of inlined file: juce_ToolbarButton.h ***/
  14204. #endif
  14205. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14206. /*** Start of inlined file: juce_CodeDocument.h ***/
  14207. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14208. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14209. class CodeDocumentLine;
  14210. class JUCE_API CodeDocument
  14211. {
  14212. public:
  14213. CodeDocument();
  14214. ~CodeDocument();
  14215. class JUCE_API Position
  14216. {
  14217. public:
  14218. Position() throw();
  14219. Position (const CodeDocument* const ownerDocument,
  14220. const int line, const int indexInLine) throw();
  14221. Position (const CodeDocument* const ownerDocument,
  14222. const int charactersFromStartOfDocument) throw();
  14223. Position (const Position& other) throw();
  14224. ~Position() throw();
  14225. Position& operator= (const Position& other) throw();
  14226. bool operator== (const Position& other) const throw();
  14227. bool operator!= (const Position& other) const throw();
  14228. void setPosition (const int charactersFromStartOfDocument) throw();
  14229. int getPosition() const throw() { return characterPos; }
  14230. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14231. int getLineNumber() const throw() { return line; }
  14232. int getIndexInLine() const throw() { return indexInLine; }
  14233. void setPositionMaintained (const bool isMaintained) throw();
  14234. void moveBy (int characterDelta) throw();
  14235. const Position movedBy (const int characterDelta) const throw();
  14236. const Position movedByLines (const int deltaLines) const throw();
  14237. const tchar getCharacter() const throw();
  14238. const String getLineText() const throw();
  14239. private:
  14240. CodeDocument* owner;
  14241. int characterPos, line, indexInLine;
  14242. bool positionMaintained;
  14243. };
  14244. const String getAllContent() const throw();
  14245. const String getTextBetween (const Position& start, const Position& end) const throw();
  14246. const String getLine (const int lineIndex) const throw();
  14247. int getNumCharacters() const throw();
  14248. int getNumLines() const throw() { return lines.size(); }
  14249. int getMaximumLineLength() throw();
  14250. void deleteSection (const Position& startPosition, const Position& endPosition);
  14251. void insertText (const Position& position, const String& text);
  14252. void replaceAllContent (const String& newContent);
  14253. bool loadFromStream (InputStream& stream);
  14254. bool writeToStream (OutputStream& stream);
  14255. const String getNewLineCharacters() const throw() { return newLineChars; }
  14256. void setNewLineCharacters (const String& newLine) throw();
  14257. void newTransaction();
  14258. void undo();
  14259. void redo();
  14260. void clearUndoHistory();
  14261. UndoManager& getUndoManager() throw() { return undoManager; }
  14262. void setSavePoint() throw();
  14263. bool hasChangedSinceSavePoint() const throw();
  14264. const Position findWordBreakAfter (const Position& position) const throw();
  14265. const Position findWordBreakBefore (const Position& position) const throw();
  14266. class JUCE_API Listener
  14267. {
  14268. public:
  14269. Listener() {}
  14270. virtual ~Listener() {}
  14271. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14272. const Position& affectedTextEnd) = 0;
  14273. };
  14274. void addListener (Listener* const listener) throw();
  14275. void removeListener (Listener* const listener) throw();
  14276. class Iterator
  14277. {
  14278. public:
  14279. Iterator (CodeDocument* const document);
  14280. Iterator (const Iterator& other);
  14281. Iterator& operator= (const Iterator& other) throw();
  14282. ~Iterator() throw();
  14283. juce_wchar nextChar();
  14284. juce_wchar peekNextChar() const;
  14285. void skip();
  14286. int getPosition() const throw() { return position; }
  14287. void skipWhitespace();
  14288. void skipToEndOfLine();
  14289. int getLine() const throw() { return line; }
  14290. bool isEOF() const throw();
  14291. private:
  14292. CodeDocument* document;
  14293. CodeDocumentLine* currentLine;
  14294. int line, position;
  14295. };
  14296. juce_UseDebuggingNewOperator
  14297. private:
  14298. friend class CodeDocumentInsertAction;
  14299. friend class CodeDocumentDeleteAction;
  14300. friend class Iterator;
  14301. friend class Position;
  14302. OwnedArray <CodeDocumentLine> lines;
  14303. Array <Position*> positionsToMaintain;
  14304. UndoManager undoManager;
  14305. int currentActionIndex, indexOfSavedState;
  14306. int maximumLineLength;
  14307. VoidArray listeners;
  14308. String newLineChars;
  14309. void sendListenerChangeMessage (const int startLine, const int endLine);
  14310. void insert (const String& text, const int insertPos, const bool undoable);
  14311. void remove (const int startPos, const int endPos, const bool undoable);
  14312. void checkLastLineStatus();
  14313. CodeDocument (const CodeDocument&);
  14314. CodeDocument& operator= (const CodeDocument&);
  14315. };
  14316. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14317. /*** End of inlined file: juce_CodeDocument.h ***/
  14318. #endif
  14319. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14320. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14321. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14322. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14323. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14324. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14325. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14326. class JUCE_API CodeTokeniser
  14327. {
  14328. public:
  14329. CodeTokeniser() {}
  14330. virtual ~CodeTokeniser() {}
  14331. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14332. virtual const StringArray getTokenTypes() = 0;
  14333. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14334. juce_UseDebuggingNewOperator
  14335. };
  14336. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14337. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14338. class JUCE_API CodeEditorComponent : public Component,
  14339. public TextInputTarget,
  14340. public Timer,
  14341. public ScrollBarListener,
  14342. public CodeDocument::Listener,
  14343. public AsyncUpdater
  14344. {
  14345. public:
  14346. CodeEditorComponent (CodeDocument& document,
  14347. CodeTokeniser* const codeTokeniser);
  14348. ~CodeEditorComponent();
  14349. CodeDocument& getDocument() const throw() { return document; }
  14350. void loadContent (const String& newContent);
  14351. float getCharWidth() const throw() { return charWidth; }
  14352. int getLineHeight() const throw() { return lineHeight; }
  14353. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14354. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14355. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14356. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14357. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14358. const CodeDocument::Position getPositionAt (int x, int y);
  14359. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14360. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14361. void cursorDown (const bool selecting);
  14362. void cursorUp (const bool selecting);
  14363. void pageDown (const bool selecting);
  14364. void pageUp (const bool selecting);
  14365. void scrollDown();
  14366. void scrollUp();
  14367. void scrollToLine (int newFirstLineOnScreen);
  14368. void scrollBy (int deltaLines);
  14369. void scrollToColumn (int newFirstColumnOnScreen);
  14370. void scrollToKeepCaretOnScreen();
  14371. void goToStartOfDocument (const bool selecting);
  14372. void goToStartOfLine (const bool selecting);
  14373. void goToEndOfDocument (const bool selecting);
  14374. void goToEndOfLine (const bool selecting);
  14375. void deselectAll();
  14376. void selectAll();
  14377. void insertTextAtCaret (const String& textToInsert);
  14378. void insertTabAtCaret();
  14379. void cut();
  14380. void copy();
  14381. void copyThenCut();
  14382. void paste();
  14383. void backspace (const bool moveInWholeWordSteps);
  14384. void deleteForward (const bool moveInWholeWordSteps);
  14385. void undo();
  14386. void redo();
  14387. const Range<int> getHighlightedRegion() const;
  14388. void setHighlightedRegion (const Range<int>& newRange);
  14389. const String getTextInRange (const Range<int>& range) const;
  14390. void setTabSize (const int numSpacesPerTab,
  14391. const bool insertSpacesInsteadOfTabCharacters) throw();
  14392. int getTabSize() const throw() { return spacesPerTab; }
  14393. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14394. void setFont (const Font& newFont);
  14395. void resetToDefaultColours();
  14396. void setColourForTokenType (const int tokenType, const Colour& colour);
  14397. const Colour getColourForTokenType (const int tokenType) const throw();
  14398. enum ColourIds
  14399. {
  14400. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14401. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14402. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14403. selected text. */
  14404. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14405. enabled. */
  14406. };
  14407. void setScrollbarThickness (const int thickness) throw();
  14408. void resized();
  14409. void paint (Graphics& g);
  14410. bool keyPressed (const KeyPress& key);
  14411. void mouseDown (const MouseEvent& e);
  14412. void mouseDrag (const MouseEvent& e);
  14413. void mouseUp (const MouseEvent& e);
  14414. void mouseDoubleClick (const MouseEvent& e);
  14415. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14416. void timerCallback();
  14417. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14418. void handleAsyncUpdate();
  14419. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14420. const CodeDocument::Position& affectedTextEnd);
  14421. juce_UseDebuggingNewOperator
  14422. private:
  14423. CodeDocument& document;
  14424. Font font;
  14425. int firstLineOnScreen, gutter, spacesPerTab;
  14426. float charWidth;
  14427. int lineHeight, linesOnScreen, columnsOnScreen;
  14428. int scrollbarThickness, columnToTryToMaintain;
  14429. bool useSpacesForTabs;
  14430. double xOffset;
  14431. CodeDocument::Position caretPos;
  14432. CodeDocument::Position selectionStart, selectionEnd;
  14433. Component* caret;
  14434. ScrollBar* verticalScrollBar;
  14435. ScrollBar* horizontalScrollBar;
  14436. enum DragType
  14437. {
  14438. notDragging,
  14439. draggingSelectionStart,
  14440. draggingSelectionEnd
  14441. };
  14442. DragType dragType;
  14443. CodeTokeniser* codeTokeniser;
  14444. Array <Colour> coloursForTokenCategories;
  14445. class CodeEditorLine;
  14446. OwnedArray <CodeEditorLine> lines;
  14447. void rebuildLineTokens();
  14448. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14449. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14450. void updateCachedIterators (int maxLineNum);
  14451. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14452. void moveLineDelta (const int delta, const bool selecting);
  14453. void updateScrollBars();
  14454. void scrollToLineInternal (int line);
  14455. void scrollToColumnInternal (double column);
  14456. void newTransaction();
  14457. int indexToColumn (int line, int index) const throw();
  14458. int columnToIndex (int line, int column) const throw();
  14459. CodeEditorComponent (const CodeEditorComponent&);
  14460. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14461. };
  14462. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14463. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14464. #endif
  14465. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14466. #endif
  14467. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14468. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14469. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14470. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14471. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14472. {
  14473. public:
  14474. CPlusPlusCodeTokeniser();
  14475. ~CPlusPlusCodeTokeniser();
  14476. enum TokenType
  14477. {
  14478. tokenType_error = 0,
  14479. tokenType_comment,
  14480. tokenType_builtInKeyword,
  14481. tokenType_identifier,
  14482. tokenType_integerLiteral,
  14483. tokenType_floatLiteral,
  14484. tokenType_stringLiteral,
  14485. tokenType_operator,
  14486. tokenType_bracket,
  14487. tokenType_punctuation,
  14488. tokenType_preprocessor
  14489. };
  14490. int readNextToken (CodeDocument::Iterator& source);
  14491. const StringArray getTokenTypes();
  14492. const Colour getDefaultColour (const int tokenType);
  14493. juce_UseDebuggingNewOperator
  14494. };
  14495. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14496. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14497. #endif
  14498. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14499. #endif
  14500. #ifndef __JUCE_LABEL_JUCEHEADER__
  14501. #endif
  14502. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14503. #endif
  14504. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14505. /*** Start of inlined file: juce_ProgressBar.h ***/
  14506. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14507. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14508. class JUCE_API ProgressBar : public Component,
  14509. public SettableTooltipClient,
  14510. private Timer
  14511. {
  14512. public:
  14513. ProgressBar (double& progress);
  14514. ~ProgressBar();
  14515. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14516. void setTextToDisplay (const String& text);
  14517. enum ColourIds
  14518. {
  14519. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14520. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14521. classes will probably use variations on this colour. */
  14522. };
  14523. juce_UseDebuggingNewOperator
  14524. protected:
  14525. void paint (Graphics& g);
  14526. void lookAndFeelChanged();
  14527. void visibilityChanged();
  14528. void colourChanged();
  14529. private:
  14530. double& progress;
  14531. double currentValue;
  14532. bool displayPercentage;
  14533. String displayedMessage, currentMessage;
  14534. uint32 lastCallbackTime;
  14535. void timerCallback();
  14536. ProgressBar (const ProgressBar&);
  14537. ProgressBar& operator= (const ProgressBar&);
  14538. };
  14539. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14540. /*** End of inlined file: juce_ProgressBar.h ***/
  14541. #endif
  14542. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14543. /*** Start of inlined file: juce_Slider.h ***/
  14544. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14545. #define __JUCE_SLIDER_JUCEHEADER__
  14546. /*** Start of inlined file: juce_SliderListener.h ***/
  14547. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14548. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14549. class Slider;
  14550. class JUCE_API SliderListener
  14551. {
  14552. public:
  14553. virtual ~SliderListener() {}
  14554. virtual void sliderValueChanged (Slider* slider) = 0;
  14555. virtual void sliderDragStarted (Slider* slider);
  14556. virtual void sliderDragEnded (Slider* slider);
  14557. };
  14558. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14559. /*** End of inlined file: juce_SliderListener.h ***/
  14560. class JUCE_API Slider : public Component,
  14561. public SettableTooltipClient,
  14562. private AsyncUpdater,
  14563. private ButtonListener,
  14564. private LabelListener,
  14565. private Value::Listener
  14566. {
  14567. public:
  14568. Slider (const String& componentName);
  14569. ~Slider();
  14570. enum SliderStyle
  14571. {
  14572. LinearHorizontal, /**< A traditional horizontal slider. */
  14573. LinearVertical, /**< A traditional vertical slider. */
  14574. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14575. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14576. @see setRotaryParameters */
  14577. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14578. @see setRotaryParameters */
  14579. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14580. @see setRotaryParameters */
  14581. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14582. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14583. @see setMinValue, setMaxValue */
  14584. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14585. @see setMinValue, setMaxValue */
  14586. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14587. value, with the current value being somewhere between them.
  14588. @see setMinValue, setMaxValue */
  14589. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14590. value, with the current value being somewhere between them.
  14591. @see setMinValue, setMaxValue */
  14592. };
  14593. void setSliderStyle (const SliderStyle newStyle);
  14594. SliderStyle getSliderStyle() const { return style; }
  14595. void setRotaryParameters (const float startAngleRadians,
  14596. const float endAngleRadians,
  14597. const bool stopAtEnd);
  14598. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14599. void setVelocityBasedMode (const bool isVelocityBased);
  14600. bool getVelocityBasedMode() const { return isVelocityBased; }
  14601. void setVelocityModeParameters (const double sensitivity = 1.0,
  14602. const int threshold = 1,
  14603. const double offset = 0.0,
  14604. const bool userCanPressKeyToSwapMode = true);
  14605. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14606. int getVelocityThreshold() const { return velocityModeThreshold; }
  14607. double getVelocityOffset() const { return velocityModeOffset; }
  14608. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14609. void setSkewFactor (const double factor);
  14610. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14611. double getSkewFactor() const { return skewFactor; }
  14612. enum IncDecButtonMode
  14613. {
  14614. incDecButtonsNotDraggable,
  14615. incDecButtonsDraggable_AutoDirection,
  14616. incDecButtonsDraggable_Horizontal,
  14617. incDecButtonsDraggable_Vertical
  14618. };
  14619. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14620. enum TextEntryBoxPosition
  14621. {
  14622. NoTextBox, /**< Doesn't display a text box. */
  14623. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14624. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14625. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14626. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14627. };
  14628. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14629. const bool isReadOnly,
  14630. const int textEntryBoxWidth,
  14631. const int textEntryBoxHeight);
  14632. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14633. int getTextBoxWidth() const { return textBoxWidth; }
  14634. int getTextBoxHeight() const { return textBoxHeight; }
  14635. void setTextBoxIsEditable (const bool shouldBeEditable);
  14636. bool isTextBoxEditable() const { return editableText; }
  14637. void showTextBox();
  14638. void hideTextBox (const bool discardCurrentEditorContents);
  14639. void setValue (double newValue,
  14640. const bool sendUpdateMessage = true,
  14641. const bool sendMessageSynchronously = false);
  14642. double getValue() const;
  14643. Value& getValueObject() { return currentValue; }
  14644. void setRange (const double newMinimum,
  14645. const double newMaximum,
  14646. const double newInterval = 0);
  14647. double getMaximum() const { return maximum; }
  14648. double getMinimum() const { return minimum; }
  14649. double getInterval() const { return interval; }
  14650. double getMinValue() const;
  14651. Value& getMinValueObject() { return valueMin; }
  14652. void setMinValue (double newValue,
  14653. const bool sendUpdateMessage = true,
  14654. const bool sendMessageSynchronously = false,
  14655. const bool allowNudgingOfOtherValues = false);
  14656. double getMaxValue() const;
  14657. Value& getMaxValueObject() { return valueMax; }
  14658. void setMaxValue (double newValue,
  14659. const bool sendUpdateMessage = true,
  14660. const bool sendMessageSynchronously = false,
  14661. const bool allowNudgingOfOtherValues = false);
  14662. void addListener (SliderListener* const listener);
  14663. void removeListener (SliderListener* const listener);
  14664. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14665. const double valueToSetOnDoubleClick);
  14666. double getDoubleClickReturnValue (bool& isEnabled) const;
  14667. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14668. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14669. void setPopupDisplayEnabled (const bool isEnabled,
  14670. Component* const parentComponentToUse);
  14671. void setPopupMenuEnabled (const bool menuEnabled);
  14672. void setScrollWheelEnabled (const bool enabled);
  14673. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14674. virtual void startedDragging();
  14675. virtual void stoppedDragging();
  14676. virtual void valueChanged();
  14677. /** Callback to indicate that the user has just moved the slider.
  14678. Note - the valueChanged() method has changed its format and now no longer has
  14679. any parameters. Update your code to use the new version.
  14680. This version has been left here with an int as its return value to cause
  14681. a syntax error if you've got existing code that uses the old version.
  14682. */
  14683. virtual int valueChanged (double) { jassertfalse; return 0; }
  14684. virtual double getValueFromText (const String& text);
  14685. virtual const String getTextFromValue (double value);
  14686. void setTextValueSuffix (const String& suffix);
  14687. virtual double proportionOfLengthToValue (double proportion);
  14688. virtual double valueToProportionOfLength (double value);
  14689. float getPositionOfValue (const double value);
  14690. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14691. void updateText();
  14692. bool isHorizontal() const;
  14693. bool isVertical() const;
  14694. enum ColourIds
  14695. {
  14696. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14697. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14698. and feel class how this is used. */
  14699. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14700. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14701. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14702. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14703. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14704. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14705. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14706. };
  14707. juce_UseDebuggingNewOperator
  14708. protected:
  14709. void labelTextChanged (Label*);
  14710. void paint (Graphics& g);
  14711. void resized();
  14712. void mouseDown (const MouseEvent& e);
  14713. void mouseUp (const MouseEvent& e);
  14714. void mouseDrag (const MouseEvent& e);
  14715. void mouseDoubleClick (const MouseEvent& e);
  14716. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14717. void modifierKeysChanged (const ModifierKeys& modifiers);
  14718. void buttonClicked (Button* button);
  14719. void lookAndFeelChanged();
  14720. void enablementChanged();
  14721. void focusOfChildComponentChanged (FocusChangeType cause);
  14722. void handleAsyncUpdate();
  14723. void colourChanged();
  14724. void valueChanged (Value& value);
  14725. private:
  14726. ListenerList <SliderListener> listeners;
  14727. Value currentValue, valueMin, valueMax;
  14728. double lastCurrentValue, lastValueMin, lastValueMax;
  14729. double minimum, maximum, interval, doubleClickReturnValue;
  14730. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14731. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14732. int velocityModeThreshold;
  14733. float rotaryStart, rotaryEnd;
  14734. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14735. int mouseDragStartX, mouseDragStartY;
  14736. int sliderRegionStart, sliderRegionSize;
  14737. int sliderBeingDragged;
  14738. int pixelsForFullDragExtent;
  14739. Rectangle<int> sliderRect;
  14740. String textSuffix;
  14741. SliderStyle style;
  14742. TextEntryBoxPosition textBoxPos;
  14743. int textBoxWidth, textBoxHeight;
  14744. IncDecButtonMode incDecButtonMode;
  14745. bool editableText : 1, doubleClickToValue : 1;
  14746. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14747. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14748. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14749. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14750. Font font;
  14751. Label* valueBox;
  14752. Button* incButton;
  14753. Button* decButton;
  14754. ScopedPointer <Component> popupDisplay;
  14755. Component* parentForPopupDisplay;
  14756. float getLinearSliderPos (const double value);
  14757. void restoreMouseIfHidden();
  14758. void sendDragStart();
  14759. void sendDragEnd();
  14760. double constrainedValue (double value) const;
  14761. void triggerChangeMessage (const bool synchronous);
  14762. bool incDecDragDirectionIsHorizontal() const;
  14763. Slider (const Slider&);
  14764. Slider& operator= (const Slider&);
  14765. };
  14766. #endif // __JUCE_SLIDER_JUCEHEADER__
  14767. /*** End of inlined file: juce_Slider.h ***/
  14768. #endif
  14769. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14770. #endif
  14771. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14772. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14773. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14774. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14775. class TableHeaderComponent;
  14776. class JUCE_API TableHeaderListener
  14777. {
  14778. public:
  14779. TableHeaderListener() {}
  14780. virtual ~TableHeaderListener() {}
  14781. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14782. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14783. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14784. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14785. int columnIdNowBeingDragged);
  14786. };
  14787. class JUCE_API TableHeaderComponent : public Component,
  14788. private AsyncUpdater
  14789. {
  14790. public:
  14791. TableHeaderComponent();
  14792. ~TableHeaderComponent();
  14793. enum ColumnPropertyFlags
  14794. {
  14795. 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. */
  14796. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14797. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14798. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14799. 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. */
  14800. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14801. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14802. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14803. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14804. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14805. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14806. };
  14807. void addColumn (const String& columnName,
  14808. const int columnId,
  14809. const int width,
  14810. const int minimumWidth = 30,
  14811. const int maximumWidth = -1,
  14812. const int propertyFlags = defaultFlags,
  14813. const int insertIndex = -1);
  14814. void removeColumn (const int columnIdToRemove);
  14815. void removeAllColumns();
  14816. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14817. const String getColumnName (const int columnId) const;
  14818. void setColumnName (const int columnId, const String& newName);
  14819. void moveColumn (const int columnId, int newVisibleIndex);
  14820. int getColumnWidth (const int columnId) const;
  14821. void setColumnWidth (const int columnId, const int newWidth);
  14822. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14823. bool isColumnVisible (const int columnId) const;
  14824. void setSortColumnId (const int columnId, const bool sortForwards);
  14825. int getSortColumnId() const;
  14826. bool isSortedForwards() const;
  14827. void reSortTable();
  14828. int getTotalWidth() const;
  14829. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14830. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14831. const Rectangle<int> getColumnPosition (const int index) const;
  14832. int getColumnIdAtX (const int xToFind) const;
  14833. void setStretchToFitActive (const bool shouldStretchToFit);
  14834. bool isStretchToFitActive() const;
  14835. void resizeAllColumnsToFit (int targetTotalWidth);
  14836. void setPopupMenuActive (const bool hasMenu);
  14837. bool isPopupMenuActive() const;
  14838. const String toString() const;
  14839. void restoreFromString (const String& storedVersion);
  14840. void addListener (TableHeaderListener* const newListener);
  14841. void removeListener (TableHeaderListener* const listenerToRemove);
  14842. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14843. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14844. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14845. void paint (Graphics& g);
  14846. void resized();
  14847. void mouseMove (const MouseEvent&);
  14848. void mouseEnter (const MouseEvent&);
  14849. void mouseExit (const MouseEvent&);
  14850. void mouseDown (const MouseEvent&);
  14851. void mouseDrag (const MouseEvent&);
  14852. void mouseUp (const MouseEvent&);
  14853. const MouseCursor getMouseCursor();
  14854. virtual void showColumnChooserMenu (const int columnIdClicked);
  14855. juce_UseDebuggingNewOperator
  14856. private:
  14857. struct ColumnInfo
  14858. {
  14859. String name;
  14860. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14861. double lastDeliberateWidth;
  14862. bool isVisible() const;
  14863. };
  14864. OwnedArray <ColumnInfo> columns;
  14865. Array <TableHeaderListener*> listeners;
  14866. ScopedPointer <Component> dragOverlayComp;
  14867. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14868. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14869. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14870. ColumnInfo* getInfoForId (const int columnId) const;
  14871. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14872. void sendColumnsChanged();
  14873. void handleAsyncUpdate();
  14874. void beginDrag (const MouseEvent&);
  14875. void endDrag (const int finalIndex);
  14876. int getResizeDraggerAt (const int mouseX) const;
  14877. void updateColumnUnderMouse (int x, int y);
  14878. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14879. TableHeaderComponent (const TableHeaderComponent&);
  14880. TableHeaderComponent operator= (const TableHeaderComponent&);
  14881. };
  14882. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14883. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14884. #endif
  14885. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14886. /*** Start of inlined file: juce_TableListBox.h ***/
  14887. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14888. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14889. class JUCE_API TableListBoxModel
  14890. {
  14891. public:
  14892. TableListBoxModel() {}
  14893. virtual ~TableListBoxModel() {}
  14894. virtual int getNumRows() = 0;
  14895. virtual void paintRowBackground (Graphics& g,
  14896. int rowNumber,
  14897. int width, int height,
  14898. bool rowIsSelected) = 0;
  14899. virtual void paintCell (Graphics& g,
  14900. int rowNumber,
  14901. int columnId,
  14902. int width, int height,
  14903. bool rowIsSelected) = 0;
  14904. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14905. Component* existingComponentToUpdate);
  14906. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14907. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14908. virtual void backgroundClicked();
  14909. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14910. virtual int getColumnAutoSizeWidth (int columnId);
  14911. virtual const String getCellTooltip (int rowNumber, int columnId);
  14912. virtual void selectedRowsChanged (int lastRowSelected);
  14913. virtual void deleteKeyPressed (int lastRowSelected);
  14914. virtual void returnKeyPressed (int lastRowSelected);
  14915. virtual void listWasScrolled();
  14916. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14917. };
  14918. class JUCE_API TableListBox : public ListBox,
  14919. private ListBoxModel,
  14920. private TableHeaderListener
  14921. {
  14922. public:
  14923. TableListBox (const String& componentName,
  14924. TableListBoxModel* const model);
  14925. ~TableListBox();
  14926. void setModel (TableListBoxModel* const newModel);
  14927. TableListBoxModel* getModel() const { return model; }
  14928. TableHeaderComponent* getHeader() const { return header; }
  14929. void setHeaderHeight (const int newHeight);
  14930. int getHeaderHeight() const;
  14931. void autoSizeColumn (const int columnId);
  14932. void autoSizeAllColumns();
  14933. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14934. bool isAutoSizeMenuOptionShown() const;
  14935. const Rectangle<int> getCellPosition (const int columnId,
  14936. const int rowNumber,
  14937. const bool relativeToComponentTopLeft) const;
  14938. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14939. int getNumRows();
  14940. void paintListBoxItem (int, Graphics&, int, int, bool);
  14941. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14942. void selectedRowsChanged (int lastRowSelected);
  14943. void deleteKeyPressed (int currentSelectedRow);
  14944. void returnKeyPressed (int currentSelectedRow);
  14945. void backgroundClicked();
  14946. void listWasScrolled();
  14947. void tableColumnsChanged (TableHeaderComponent*);
  14948. void tableColumnsResized (TableHeaderComponent*);
  14949. void tableSortOrderChanged (TableHeaderComponent*);
  14950. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14951. void resized();
  14952. juce_UseDebuggingNewOperator
  14953. private:
  14954. TableHeaderComponent* header;
  14955. TableListBoxModel* model;
  14956. int columnIdNowBeingDragged;
  14957. bool autoSizeOptionsShown;
  14958. void updateColumnComponents() const;
  14959. TableListBox (const TableListBox&);
  14960. TableListBox& operator= (const TableListBox&);
  14961. };
  14962. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14963. /*** End of inlined file: juce_TableListBox.h ***/
  14964. #endif
  14965. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14966. #endif
  14967. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14968. #endif
  14969. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14970. #endif
  14971. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14972. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14973. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14974. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14975. class JUCE_API ToolbarItemFactory
  14976. {
  14977. public:
  14978. ToolbarItemFactory();
  14979. virtual ~ToolbarItemFactory();
  14980. enum SpecialItemIds
  14981. {
  14982. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14983. can be placed between sets of items to break them into groups. */
  14984. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14985. items.*/
  14986. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14987. either side of it, filling any available space. */
  14988. };
  14989. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14990. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14991. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14992. };
  14993. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14994. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14995. #endif
  14996. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14997. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  14998. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14999. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15000. class JUCE_API ToolbarItemPalette : public Component,
  15001. public DragAndDropContainer
  15002. {
  15003. public:
  15004. ToolbarItemPalette (ToolbarItemFactory& factory,
  15005. Toolbar* const toolbar);
  15006. ~ToolbarItemPalette();
  15007. void resized();
  15008. juce_UseDebuggingNewOperator
  15009. private:
  15010. ToolbarItemFactory& factory;
  15011. Toolbar* toolbar;
  15012. Viewport* viewport;
  15013. friend class Toolbar;
  15014. void replaceComponent (ToolbarItemComponent* const comp);
  15015. ToolbarItemPalette (const ToolbarItemPalette&);
  15016. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15017. };
  15018. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15019. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15020. #endif
  15021. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15022. /*** Start of inlined file: juce_TreeView.h ***/
  15023. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15024. #define __JUCE_TREEVIEW_JUCEHEADER__
  15025. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15026. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15027. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15028. class JUCE_API FileDragAndDropTarget
  15029. {
  15030. public:
  15031. virtual ~FileDragAndDropTarget() {}
  15032. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15033. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15034. virtual void fileDragMove (const StringArray& files, int x, int y);
  15035. virtual void fileDragExit (const StringArray& files);
  15036. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15037. };
  15038. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15039. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15040. class TreeView;
  15041. class JUCE_API TreeViewItem
  15042. {
  15043. public:
  15044. TreeViewItem();
  15045. virtual ~TreeViewItem();
  15046. int getNumSubItems() const throw();
  15047. TreeViewItem* getSubItem (const int index) const throw();
  15048. void clearSubItems();
  15049. void addSubItem (TreeViewItem* const newItem,
  15050. const int insertPosition = -1);
  15051. void removeSubItem (const int index,
  15052. const bool deleteItem = true);
  15053. TreeView* getOwnerView() const throw() { return ownerView; }
  15054. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15055. bool isOpen() const throw();
  15056. void setOpen (const bool shouldBeOpen);
  15057. bool isSelected() const throw();
  15058. void setSelected (const bool shouldBeSelected,
  15059. const bool deselectOtherItemsFirst);
  15060. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  15061. void treeHasChanged() const throw();
  15062. void repaintItem() const;
  15063. int getRowNumberInTree() const throw();
  15064. bool areAllParentsOpen() const throw();
  15065. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  15066. virtual bool mightContainSubItems() = 0;
  15067. virtual const String getUniqueName() const;
  15068. virtual void itemOpennessChanged (bool isNowOpen);
  15069. virtual int getItemWidth() const { return -1; }
  15070. virtual int getItemHeight() const { return 20; }
  15071. virtual bool canBeSelected() const { return true; }
  15072. virtual Component* createItemComponent() { return 0; }
  15073. virtual void paintItem (Graphics& g, int width, int height);
  15074. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15075. virtual void itemClicked (const MouseEvent& e);
  15076. virtual void itemDoubleClicked (const MouseEvent& e);
  15077. virtual void itemSelectionChanged (bool isNowSelected);
  15078. virtual const String getTooltip();
  15079. virtual const String getDragSourceDescription();
  15080. virtual bool isInterestedInFileDrag (const StringArray& files);
  15081. virtual void filesDropped (const StringArray& files, int insertIndex);
  15082. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15083. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15084. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15085. XmlElement* getOpennessState() const throw();
  15086. void restoreOpennessState (const XmlElement& xml) throw();
  15087. int getIndexInParent() const throw();
  15088. bool isLastOfSiblings() const throw();
  15089. const String getItemIdentifierString() const;
  15090. juce_UseDebuggingNewOperator
  15091. private:
  15092. TreeView* ownerView;
  15093. TreeViewItem* parentItem;
  15094. OwnedArray <TreeViewItem> subItems;
  15095. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15096. int uid;
  15097. bool selected : 1;
  15098. bool redrawNeeded : 1;
  15099. bool drawLinesInside : 1;
  15100. bool drawsInLeftMargin : 1;
  15101. unsigned int openness : 2;
  15102. friend class TreeView;
  15103. friend class TreeViewContentComponent;
  15104. void updatePositions (int newY);
  15105. int getIndentX() const throw();
  15106. void setOwnerView (TreeView* const newOwner) throw();
  15107. void paintRecursively (Graphics& g, int width);
  15108. TreeViewItem* getTopLevelItem() throw();
  15109. TreeViewItem* findItemRecursively (int y) throw();
  15110. TreeViewItem* getDeepestOpenParentItem() throw();
  15111. int getNumRows() const throw();
  15112. TreeViewItem* getItemOnRow (int index) throw();
  15113. void deselectAllRecursively();
  15114. int countSelectedItemsRecursively() const throw();
  15115. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15116. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  15117. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15118. TreeViewItem (const TreeViewItem&);
  15119. TreeViewItem& operator= (const TreeViewItem&);
  15120. };
  15121. class JUCE_API TreeView : public Component,
  15122. public SettableTooltipClient,
  15123. public FileDragAndDropTarget,
  15124. public DragAndDropTarget,
  15125. private AsyncUpdater
  15126. {
  15127. public:
  15128. TreeView (const String& componentName = String::empty);
  15129. ~TreeView();
  15130. void setRootItem (TreeViewItem* const newRootItem);
  15131. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15132. void deleteRootItem();
  15133. void setRootItemVisible (const bool shouldBeVisible);
  15134. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15135. void setDefaultOpenness (const bool isOpenByDefault);
  15136. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15137. void setMultiSelectEnabled (const bool canMultiSelect);
  15138. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15139. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  15140. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15141. void clearSelectedItems();
  15142. int getNumSelectedItems() const throw();
  15143. TreeViewItem* getSelectedItem (const int index) const throw();
  15144. int getNumRowsInTree() const;
  15145. TreeViewItem* getItemOnRow (int index) const;
  15146. TreeViewItem* getItemAt (int yPosition) const throw();
  15147. void scrollToKeepItemVisible (TreeViewItem* item);
  15148. Viewport* getViewport() const throw() { return viewport; }
  15149. int getIndentSize() const throw() { return indentSize; }
  15150. void setIndentSize (const int newIndentSize);
  15151. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15152. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  15153. void restoreOpennessState (const XmlElement& newState);
  15154. enum ColourIds
  15155. {
  15156. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15157. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15158. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15159. };
  15160. void paint (Graphics& g);
  15161. void resized();
  15162. bool keyPressed (const KeyPress& key);
  15163. void colourChanged();
  15164. void enablementChanged();
  15165. bool isInterestedInFileDrag (const StringArray& files);
  15166. void fileDragEnter (const StringArray& files, int x, int y);
  15167. void fileDragMove (const StringArray& files, int x, int y);
  15168. void fileDragExit (const StringArray& files);
  15169. void filesDropped (const StringArray& files, int x, int y);
  15170. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15171. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15172. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15173. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15174. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15175. juce_UseDebuggingNewOperator
  15176. private:
  15177. friend class TreeViewItem;
  15178. friend class TreeViewContentComponent;
  15179. Viewport* viewport;
  15180. CriticalSection nodeAlterationLock;
  15181. TreeViewItem* rootItem;
  15182. Component* dragInsertPointHighlight;
  15183. Component* dragTargetGroupHighlight;
  15184. int indentSize;
  15185. bool defaultOpenness : 1;
  15186. bool needsRecalculating : 1;
  15187. bool rootItemVisible : 1;
  15188. bool multiSelectEnabled : 1;
  15189. bool openCloseButtonsVisible : 1;
  15190. void itemsChanged() throw();
  15191. void handleAsyncUpdate();
  15192. void moveSelectedRow (int delta);
  15193. void updateButtonUnderMouse (const MouseEvent& e);
  15194. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15195. void hideDragHighlight() throw();
  15196. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15197. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15198. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15199. const StringArray& files, const String& sourceDescription,
  15200. Component* sourceComponent) const throw();
  15201. TreeView (const TreeView&);
  15202. TreeView& operator= (const TreeView&);
  15203. };
  15204. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15205. /*** End of inlined file: juce_TreeView.h ***/
  15206. #endif
  15207. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15208. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15209. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15210. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15211. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15212. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15213. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15214. /*** Start of inlined file: juce_FileFilter.h ***/
  15215. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15216. #define __JUCE_FILEFILTER_JUCEHEADER__
  15217. class JUCE_API FileFilter
  15218. {
  15219. public:
  15220. FileFilter (const String& filterDescription);
  15221. virtual ~FileFilter();
  15222. const String& getDescription() const throw();
  15223. virtual bool isFileSuitable (const File& file) const = 0;
  15224. virtual bool isDirectorySuitable (const File& file) const = 0;
  15225. protected:
  15226. String description;
  15227. };
  15228. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15229. /*** End of inlined file: juce_FileFilter.h ***/
  15230. /*** Start of inlined file: juce_Image.h ***/
  15231. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15232. #define __JUCE_IMAGE_JUCEHEADER__
  15233. class JUCE_API Image
  15234. {
  15235. public:
  15236. enum PixelFormat
  15237. {
  15238. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15239. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15240. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15241. };
  15242. Image (PixelFormat format,
  15243. int imageWidth,
  15244. int imageHeight,
  15245. bool clearImage);
  15246. Image (const Image& other);
  15247. virtual ~Image();
  15248. static Image* createNativeImage (PixelFormat format,
  15249. int imageWidth,
  15250. int imageHeight,
  15251. bool clearImage);
  15252. int getWidth() const throw() { return imageWidth; }
  15253. int getHeight() const throw() { return imageHeight; }
  15254. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15255. PixelFormat getFormat() const throw() { return format; }
  15256. bool isARGB() const throw() { return format == ARGB; }
  15257. bool isRGB() const throw() { return format == RGB; }
  15258. bool hasAlphaChannel() const throw() { return format != RGB; }
  15259. virtual void clear (int x, int y, int w, int h,
  15260. const Colour& colourToClearTo = Colour (0x00000000));
  15261. virtual Image* createCopy (int newWidth = -1,
  15262. int newHeight = -1,
  15263. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15264. virtual Image* createCopyOfAlphaChannel() const;
  15265. virtual const Colour getPixelAt (int x, int y) const;
  15266. virtual void setPixelAt (int x, int y, const Colour& colour);
  15267. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15268. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15269. virtual void desaturate();
  15270. class BitmapData
  15271. {
  15272. public:
  15273. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15274. BitmapData (const Image& image, int x, int y, int w, int h);
  15275. ~BitmapData();
  15276. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15277. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15278. uint8* data;
  15279. int lineStride, pixelStride, width, height;
  15280. private:
  15281. BitmapData (const BitmapData&);
  15282. BitmapData& operator= (const BitmapData&);
  15283. };
  15284. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15285. const uint8* sourcePixelData, int sourceLineStride);
  15286. virtual void moveImageSection (int destX, int destY,
  15287. int sourceX, int sourceY,
  15288. int width, int height);
  15289. void createSolidAreaMask (RectangleList& result,
  15290. float alphaThreshold = 0.5f) const;
  15291. juce_UseDebuggingNewOperator
  15292. virtual LowLevelGraphicsContext* createLowLevelContext();
  15293. protected:
  15294. friend class BitmapData;
  15295. const PixelFormat format;
  15296. const int imageWidth, imageHeight;
  15297. Image (PixelFormat format,
  15298. int imageWidth,
  15299. int imageHeight);
  15300. int pixelStride, lineStride;
  15301. HeapBlock <uint8> imageDataAllocated;
  15302. uint8* imageData;
  15303. private:
  15304. Image& operator= (const Image&);
  15305. };
  15306. #endif // __JUCE_IMAGE_JUCEHEADER__
  15307. /*** End of inlined file: juce_Image.h ***/
  15308. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15309. public TimeSliceClient
  15310. {
  15311. public:
  15312. DirectoryContentsList (const FileFilter* const fileFilter,
  15313. TimeSliceThread& threadToUse);
  15314. ~DirectoryContentsList();
  15315. void setDirectory (const File& directory,
  15316. const bool includeDirectories,
  15317. const bool includeFiles);
  15318. const File& getDirectory() const;
  15319. void clear();
  15320. void refresh();
  15321. bool isStillLoading() const;
  15322. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15323. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15324. struct FileInfo
  15325. {
  15326. String filename;
  15327. int64 fileSize;
  15328. Time modificationTime;
  15329. Time creationTime;
  15330. bool isDirectory;
  15331. bool isReadOnly;
  15332. };
  15333. int getNumFiles() const;
  15334. bool getFileInfo (const int index,
  15335. FileInfo& resultInfo) const;
  15336. const File getFile (const int index) const;
  15337. const FileFilter* getFilter() const { return fileFilter; }
  15338. bool useTimeSlice();
  15339. TimeSliceThread& getTimeSliceThread() { return thread; }
  15340. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15341. const DirectoryContentsList::FileInfo* const second);
  15342. juce_UseDebuggingNewOperator
  15343. private:
  15344. File root;
  15345. const FileFilter* fileFilter;
  15346. TimeSliceThread& thread;
  15347. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15348. CriticalSection fileListLock;
  15349. OwnedArray <FileInfo> files;
  15350. void* volatile fileFindHandle;
  15351. bool volatile shouldStop;
  15352. void changed();
  15353. bool checkNextFile (bool& hasChanged);
  15354. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15355. const int64 fileSize, const Time& modTime,
  15356. const Time& creationTime, const bool isReadOnly);
  15357. DirectoryContentsList (const DirectoryContentsList&);
  15358. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15359. };
  15360. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15361. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15362. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15363. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15364. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15365. class JUCE_API FileBrowserListener
  15366. {
  15367. public:
  15368. virtual ~FileBrowserListener();
  15369. virtual void selectionChanged() = 0;
  15370. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15371. virtual void fileDoubleClicked (const File& file) = 0;
  15372. };
  15373. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15374. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15375. class JUCE_API DirectoryContentsDisplayComponent
  15376. {
  15377. public:
  15378. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15379. virtual ~DirectoryContentsDisplayComponent();
  15380. virtual int getNumSelectedFiles() const = 0;
  15381. virtual const File getSelectedFile (int index) const = 0;
  15382. virtual void scrollToTop() = 0;
  15383. void addListener (FileBrowserListener* const listener) throw();
  15384. void removeListener (FileBrowserListener* const listener) throw();
  15385. enum ColourIds
  15386. {
  15387. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15388. textColourId = 0x1000541, /**< The colour for the text. */
  15389. };
  15390. void sendSelectionChangeMessage();
  15391. void sendDoubleClickMessage (const File& file);
  15392. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15393. juce_UseDebuggingNewOperator
  15394. protected:
  15395. DirectoryContentsList& fileList;
  15396. ListenerList <FileBrowserListener> listeners;
  15397. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15398. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15399. };
  15400. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15401. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15402. #endif
  15403. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15404. #endif
  15405. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15406. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15407. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15408. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15409. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15410. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15411. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15412. class JUCE_API FilePreviewComponent : public Component
  15413. {
  15414. public:
  15415. FilePreviewComponent();
  15416. ~FilePreviewComponent();
  15417. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15418. juce_UseDebuggingNewOperator
  15419. private:
  15420. FilePreviewComponent (const FilePreviewComponent&);
  15421. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15422. };
  15423. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15424. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15425. class JUCE_API FileBrowserComponent : public Component,
  15426. public ChangeBroadcaster,
  15427. private FileBrowserListener,
  15428. private TextEditorListener,
  15429. private ButtonListener,
  15430. private ComboBoxListener,
  15431. private FileFilter
  15432. {
  15433. public:
  15434. enum FileChooserFlags
  15435. {
  15436. openMode = 1, /**< specifies that the component should allow the user to
  15437. choose an existing file with the intention of opening it. */
  15438. saveMode = 2, /**< specifies that the component should allow the user to specify
  15439. the name of a file that will be used to save something. */
  15440. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15441. conjunction with canSelectDirectories). */
  15442. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15443. conjuction with canSelectFiles). */
  15444. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15445. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15446. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15447. };
  15448. FileBrowserComponent (int flags,
  15449. const File& initialFileOrDirectory,
  15450. const FileFilter* fileFilter,
  15451. FilePreviewComponent* previewComp);
  15452. ~FileBrowserComponent();
  15453. int getNumSelectedFiles() const throw();
  15454. const File getSelectedFile (int index) const throw();
  15455. bool currentFileIsValid() const;
  15456. const File getHighlightedFile() const throw();
  15457. const File getRoot() const;
  15458. void setRoot (const File& newRootDirectory);
  15459. void goUp();
  15460. void refresh();
  15461. virtual const String getActionVerb() const;
  15462. bool isSaveMode() const throw();
  15463. void addListener (FileBrowserListener* const listener) throw();
  15464. void removeListener (FileBrowserListener* const listener) throw();
  15465. void resized();
  15466. void buttonClicked (Button* b);
  15467. void comboBoxChanged (ComboBox*);
  15468. void textEditorTextChanged (TextEditor& editor);
  15469. void textEditorReturnKeyPressed (TextEditor& editor);
  15470. void textEditorEscapeKeyPressed (TextEditor& editor);
  15471. void textEditorFocusLost (TextEditor& editor);
  15472. bool keyPressed (const KeyPress& key);
  15473. void selectionChanged();
  15474. void fileClicked (const File& f, const MouseEvent& e);
  15475. void fileDoubleClicked (const File& f);
  15476. bool isFileSuitable (const File& file) const;
  15477. bool isDirectorySuitable (const File&) const;
  15478. FilePreviewComponent* getPreviewComponent() const throw();
  15479. juce_UseDebuggingNewOperator
  15480. protected:
  15481. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15482. private:
  15483. ScopedPointer <DirectoryContentsList> fileList;
  15484. const FileFilter* fileFilter;
  15485. int flags;
  15486. File currentRoot;
  15487. Array<File> chosenFiles;
  15488. ListenerList <FileBrowserListener> listeners;
  15489. DirectoryContentsDisplayComponent* fileListComponent;
  15490. FilePreviewComponent* previewComp;
  15491. ComboBox* currentPathBox;
  15492. TextEditor* filenameBox;
  15493. Button* goUpButton;
  15494. TimeSliceThread thread;
  15495. void sendListenerChangeMessage();
  15496. bool isFileOrDirSuitable (const File& f) const;
  15497. FileBrowserComponent (const FileBrowserComponent&);
  15498. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15499. };
  15500. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15501. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15502. #endif
  15503. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15504. #endif
  15505. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15506. /*** Start of inlined file: juce_FileChooser.h ***/
  15507. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15508. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15509. class JUCE_API FileChooser
  15510. {
  15511. public:
  15512. FileChooser (const String& dialogBoxTitle,
  15513. const File& initialFileOrDirectory = File::nonexistent,
  15514. const String& filePatternsAllowed = String::empty,
  15515. const bool useOSNativeDialogBox = true);
  15516. ~FileChooser();
  15517. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15518. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15519. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15520. bool browseForDirectory();
  15521. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15522. const File getResult() const;
  15523. const Array<File>& getResults() const;
  15524. juce_UseDebuggingNewOperator
  15525. private:
  15526. String title, filters;
  15527. File startingFile;
  15528. Array<File> results;
  15529. bool useNativeDialogBox;
  15530. bool showDialog (const bool selectsDirectories,
  15531. const bool selectsFiles,
  15532. const bool isSave,
  15533. const bool warnAboutOverwritingExistingFiles,
  15534. const bool selectMultipleFiles,
  15535. FilePreviewComponent* const previewComponent);
  15536. static void showPlatformDialog (Array<File>& results,
  15537. const String& title,
  15538. const File& file,
  15539. const String& filters,
  15540. bool selectsDirectories,
  15541. bool selectsFiles,
  15542. bool isSave,
  15543. bool warnAboutOverwritingExistingFiles,
  15544. bool selectMultipleFiles,
  15545. FilePreviewComponent* previewComponent);
  15546. };
  15547. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15548. /*** End of inlined file: juce_FileChooser.h ***/
  15549. #endif
  15550. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15551. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15552. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15553. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15554. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15555. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15556. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15557. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15558. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15559. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15560. /*** Start of inlined file: juce_DropShadower.h ***/
  15561. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15562. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15563. class JUCE_API DropShadower : public ComponentListener
  15564. {
  15565. public:
  15566. DropShadower (const float alpha = 0.5f,
  15567. const int xOffset = 1,
  15568. const int yOffset = 5,
  15569. const float blurRadius = 10.0f);
  15570. virtual ~DropShadower();
  15571. void setOwner (Component* componentToFollow);
  15572. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15573. void componentBroughtToFront (Component& component);
  15574. void componentChildrenChanged (Component& component);
  15575. void componentParentHierarchyChanged (Component& component);
  15576. void componentVisibilityChanged (Component& component);
  15577. juce_UseDebuggingNewOperator
  15578. private:
  15579. Component* owner;
  15580. int numShadows;
  15581. Component* shadowWindows[4];
  15582. Image* shadowImageSections[12];
  15583. const int shadowEdge, xOffset, yOffset;
  15584. const float alpha, blurRadius;
  15585. bool inDestructor, reentrant;
  15586. void updateShadows();
  15587. void setShadowImage (Image* const src,
  15588. const int num,
  15589. const int w, const int h,
  15590. const int sx, const int sy);
  15591. void bringShadowWindowsToFront();
  15592. void deleteShadowWindows();
  15593. DropShadower (const DropShadower&);
  15594. DropShadower& operator= (const DropShadower&);
  15595. };
  15596. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15597. /*** End of inlined file: juce_DropShadower.h ***/
  15598. class JUCE_API TopLevelWindow : public Component
  15599. {
  15600. public:
  15601. TopLevelWindow (const String& name,
  15602. const bool addToDesktop);
  15603. ~TopLevelWindow();
  15604. bool isActiveWindow() const throw() { return windowIsActive_; }
  15605. void centreAroundComponent (Component* componentToCentreAround,
  15606. const int width, const int height);
  15607. void setDropShadowEnabled (const bool useShadow);
  15608. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15609. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15610. static int getNumTopLevelWindows() throw();
  15611. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15612. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15613. juce_UseDebuggingNewOperator
  15614. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15615. protected:
  15616. virtual void activeWindowStatusChanged();
  15617. void focusOfChildComponentChanged (FocusChangeType cause);
  15618. void parentHierarchyChanged();
  15619. void visibilityChanged();
  15620. virtual int getDesktopWindowStyleFlags() const;
  15621. void recreateDesktopWindow();
  15622. private:
  15623. friend class TopLevelWindowManager;
  15624. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15625. ScopedPointer <DropShadower> shadower;
  15626. void setWindowActive (const bool isNowActive) throw();
  15627. TopLevelWindow (const TopLevelWindow&);
  15628. TopLevelWindow& operator= (const TopLevelWindow&);
  15629. };
  15630. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15631. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15632. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15633. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15634. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15635. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15636. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15637. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15638. class JUCE_API ComponentBoundsConstrainer
  15639. {
  15640. public:
  15641. ComponentBoundsConstrainer() throw();
  15642. virtual ~ComponentBoundsConstrainer();
  15643. void setMinimumWidth (const int minimumWidth) throw();
  15644. int getMinimumWidth() const throw() { return minW; }
  15645. void setMaximumWidth (const int maximumWidth) throw();
  15646. int getMaximumWidth() const throw() { return maxW; }
  15647. void setMinimumHeight (const int minimumHeight) throw();
  15648. int getMinimumHeight() const throw() { return minH; }
  15649. void setMaximumHeight (const int maximumHeight) throw();
  15650. int getMaximumHeight() const throw() { return maxH; }
  15651. void setMinimumSize (const int minimumWidth,
  15652. const int minimumHeight) throw();
  15653. void setMaximumSize (const int maximumWidth,
  15654. const int maximumHeight) throw();
  15655. void setSizeLimits (const int minimumWidth,
  15656. const int minimumHeight,
  15657. const int maximumWidth,
  15658. const int maximumHeight) throw();
  15659. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15660. const int minimumWhenOffTheLeft,
  15661. const int minimumWhenOffTheBottom,
  15662. const int minimumWhenOffTheRight) throw();
  15663. void setFixedAspectRatio (const double widthOverHeight) throw();
  15664. double getFixedAspectRatio() const throw();
  15665. virtual void checkBounds (Rectangle<int>& bounds,
  15666. const Rectangle<int>& previousBounds,
  15667. const Rectangle<int>& limits,
  15668. const bool isStretchingTop,
  15669. const bool isStretchingLeft,
  15670. const bool isStretchingBottom,
  15671. const bool isStretchingRight);
  15672. virtual void resizeStart();
  15673. virtual void resizeEnd();
  15674. void setBoundsForComponent (Component* const component,
  15675. const Rectangle<int>& bounds,
  15676. const bool isStretchingTop,
  15677. const bool isStretchingLeft,
  15678. const bool isStretchingBottom,
  15679. const bool isStretchingRight);
  15680. void checkComponentBounds (Component* component);
  15681. virtual void applyBoundsToComponent (Component* component,
  15682. const Rectangle<int>& bounds);
  15683. juce_UseDebuggingNewOperator
  15684. private:
  15685. int minW, maxW, minH, maxH;
  15686. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15687. double aspectRatio;
  15688. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15689. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15690. };
  15691. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15692. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15693. class JUCE_API ComponentDragger
  15694. {
  15695. public:
  15696. ComponentDragger();
  15697. virtual ~ComponentDragger();
  15698. void startDraggingComponent (Component* const componentToDrag,
  15699. ComponentBoundsConstrainer* constrainer);
  15700. void dragComponent (Component* const componentToDrag,
  15701. const MouseEvent& e);
  15702. juce_UseDebuggingNewOperator
  15703. private:
  15704. ComponentBoundsConstrainer* constrainer;
  15705. Point<int> originalPos;
  15706. ComponentDragger (const ComponentDragger&);
  15707. ComponentDragger& operator= (const ComponentDragger&);
  15708. };
  15709. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15710. /*** End of inlined file: juce_ComponentDragger.h ***/
  15711. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15712. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15713. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15714. class JUCE_API ResizableBorderComponent : public Component
  15715. {
  15716. public:
  15717. ResizableBorderComponent (Component* const componentToResize,
  15718. ComponentBoundsConstrainer* const constrainer);
  15719. ~ResizableBorderComponent();
  15720. void setBorderThickness (const BorderSize& newBorderSize);
  15721. const BorderSize getBorderThickness() const;
  15722. juce_UseDebuggingNewOperator
  15723. protected:
  15724. void paint (Graphics& g);
  15725. void mouseEnter (const MouseEvent& e);
  15726. void mouseMove (const MouseEvent& e);
  15727. void mouseDown (const MouseEvent& e);
  15728. void mouseDrag (const MouseEvent& e);
  15729. void mouseUp (const MouseEvent& e);
  15730. bool hitTest (int x, int y);
  15731. private:
  15732. Component::SafePointer<Component> component;
  15733. ComponentBoundsConstrainer* constrainer;
  15734. BorderSize borderSize;
  15735. Rectangle<int> originalBounds;
  15736. int mouseZone;
  15737. void updateMouseZone (const MouseEvent& e);
  15738. ResizableBorderComponent (const ResizableBorderComponent&);
  15739. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15740. };
  15741. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15742. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15743. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15744. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15745. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15746. class JUCE_API ResizableCornerComponent : public Component
  15747. {
  15748. public:
  15749. ResizableCornerComponent (Component* const componentToResize,
  15750. ComponentBoundsConstrainer* const constrainer);
  15751. ~ResizableCornerComponent();
  15752. juce_UseDebuggingNewOperator
  15753. protected:
  15754. void paint (Graphics& g);
  15755. void mouseDown (const MouseEvent& e);
  15756. void mouseDrag (const MouseEvent& e);
  15757. void mouseUp (const MouseEvent& e);
  15758. bool hitTest (int x, int y);
  15759. private:
  15760. Component::SafePointer<Component> component;
  15761. ComponentBoundsConstrainer* constrainer;
  15762. Rectangle<int> originalBounds;
  15763. ResizableCornerComponent (const ResizableCornerComponent&);
  15764. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15765. };
  15766. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15767. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15768. class JUCE_API ResizableWindow : public TopLevelWindow
  15769. {
  15770. public:
  15771. ResizableWindow (const String& name,
  15772. const bool addToDesktop);
  15773. ResizableWindow (const String& name,
  15774. const Colour& backgroundColour,
  15775. const bool addToDesktop);
  15776. ~ResizableWindow();
  15777. const Colour getBackgroundColour() const throw();
  15778. void setBackgroundColour (const Colour& newColour);
  15779. void setResizable (const bool shouldBeResizable,
  15780. const bool useBottomRightCornerResizer);
  15781. bool isResizable() const throw();
  15782. void setResizeLimits (const int newMinimumWidth,
  15783. const int newMinimumHeight,
  15784. const int newMaximumWidth,
  15785. const int newMaximumHeight) throw();
  15786. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15787. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15788. void setBoundsConstrained (const Rectangle<int>& bounds);
  15789. bool isFullScreen() const;
  15790. void setFullScreen (const bool shouldBeFullScreen);
  15791. bool isMinimised() const;
  15792. void setMinimised (const bool shouldMinimise);
  15793. const String getWindowStateAsString();
  15794. bool restoreWindowStateFromString (const String& previousState);
  15795. Component* getContentComponent() const throw() { return contentComponent; }
  15796. void setContentComponent (Component* const newContentComponent,
  15797. const bool deleteOldOne = true,
  15798. const bool resizeToFit = false);
  15799. void setContentComponentSize (int width, int height);
  15800. enum ColourIds
  15801. {
  15802. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15803. };
  15804. juce_UseDebuggingNewOperator
  15805. protected:
  15806. void paint (Graphics& g);
  15807. void moved();
  15808. void resized();
  15809. void mouseDown (const MouseEvent& e);
  15810. void mouseDrag (const MouseEvent& e);
  15811. void lookAndFeelChanged();
  15812. void childBoundsChanged (Component* child);
  15813. void parentSizeChanged();
  15814. void visibilityChanged();
  15815. void activeWindowStatusChanged();
  15816. int getDesktopWindowStyleFlags() const;
  15817. virtual const BorderSize getBorderThickness();
  15818. virtual const BorderSize getContentComponentBorder();
  15819. #ifdef JUCE_DEBUG
  15820. void addChildComponent (Component* const child, int zOrder = -1);
  15821. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15822. #endif
  15823. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15824. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15825. private:
  15826. ScopedPointer <Component> contentComponent;
  15827. bool resizeToFitContent, fullscreen;
  15828. ComponentDragger dragger;
  15829. Rectangle<int> lastNonFullScreenPos;
  15830. ComponentBoundsConstrainer defaultConstrainer;
  15831. ComponentBoundsConstrainer* constrainer;
  15832. #ifdef JUCE_DEBUG
  15833. bool hasBeenResized;
  15834. #endif
  15835. void updateLastPos();
  15836. ResizableWindow (const ResizableWindow&);
  15837. ResizableWindow& operator= (const ResizableWindow&);
  15838. // (xxx remove these eventually)
  15839. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15840. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15841. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15842. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15843. };
  15844. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15845. /*** End of inlined file: juce_ResizableWindow.h ***/
  15846. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15847. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15848. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15849. class JUCE_API PositionedGlyph
  15850. {
  15851. public:
  15852. juce_wchar getCharacter() const { return character; }
  15853. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15854. float getLeft() const { return x; }
  15855. float getRight() const { return x + w; }
  15856. float getBaselineY() const { return y; }
  15857. float getTop() const { return y - font.getAscent(); }
  15858. float getBottom() const { return y + font.getDescent(); }
  15859. void moveBy (const float deltaX,
  15860. const float deltaY);
  15861. void draw (const Graphics& g) const;
  15862. void draw (const Graphics& g, const AffineTransform& transform) const;
  15863. void createPath (Path& path) const;
  15864. bool hitTest (float x, float y) const;
  15865. juce_UseDebuggingNewOperator
  15866. private:
  15867. friend class GlyphArrangement;
  15868. float x, y, w;
  15869. Font font;
  15870. juce_wchar character;
  15871. int glyph;
  15872. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  15873. PositionedGlyph (const PositionedGlyph& other);
  15874. };
  15875. class JUCE_API GlyphArrangement
  15876. {
  15877. public:
  15878. GlyphArrangement();
  15879. GlyphArrangement (const GlyphArrangement& other);
  15880. GlyphArrangement& operator= (const GlyphArrangement& other);
  15881. ~GlyphArrangement();
  15882. int getNumGlyphs() const { return glyphs.size(); }
  15883. PositionedGlyph& getGlyph (const int index) const;
  15884. void clear();
  15885. void addLineOfText (const Font& font,
  15886. const String& text,
  15887. const float x,
  15888. const float y);
  15889. void addCurtailedLineOfText (const Font& font,
  15890. const String& text,
  15891. float x,
  15892. const float y,
  15893. const float maxWidthPixels,
  15894. const bool useEllipsis);
  15895. void addJustifiedText (const Font& font,
  15896. const String& text,
  15897. float x, float y,
  15898. const float maxLineWidth,
  15899. const Justification& horizontalLayout);
  15900. void addFittedText (const Font& font,
  15901. const String& text,
  15902. const float x, const float y,
  15903. const float width, const float height,
  15904. const Justification& layout,
  15905. int maximumLinesToUse,
  15906. const float minimumHorizontalScale = 0.7f);
  15907. void addGlyphArrangement (const GlyphArrangement& other);
  15908. void draw (const Graphics& g) const;
  15909. void draw (const Graphics& g, const AffineTransform& transform) const;
  15910. void createPath (Path& path) const;
  15911. int findGlyphIndexAt (float x, float y) const;
  15912. void getBoundingBox (int startIndex,
  15913. int numGlyphs,
  15914. float& left,
  15915. float& top,
  15916. float& right,
  15917. float& bottom,
  15918. const bool includeWhitespace) const;
  15919. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15920. const float deltaX,
  15921. const float deltaY);
  15922. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15923. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15924. const float horizontalScaleFactor);
  15925. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15926. const float x,
  15927. const float y,
  15928. const float width,
  15929. const float height,
  15930. const Justification& justification);
  15931. juce_UseDebuggingNewOperator
  15932. private:
  15933. OwnedArray <PositionedGlyph> glyphs;
  15934. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15935. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15936. const Justification& justification, float minimumHorizontalScale);
  15937. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15938. };
  15939. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15940. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15941. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15942. public ButtonListener,
  15943. public FileBrowserListener
  15944. {
  15945. public:
  15946. FileChooserDialogBox (const String& title,
  15947. const String& instructions,
  15948. FileBrowserComponent& browserComponent,
  15949. const bool warnAboutOverwritingExistingFiles,
  15950. const Colour& backgroundColour);
  15951. ~FileChooserDialogBox();
  15952. bool show (int width = 0,int height = 0);
  15953. enum ColourIds
  15954. {
  15955. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15956. };
  15957. void buttonClicked (Button* button);
  15958. void closeButtonPressed();
  15959. void selectionChanged();
  15960. void fileClicked (const File& file, const MouseEvent& e);
  15961. void fileDoubleClicked (const File& file);
  15962. juce_UseDebuggingNewOperator
  15963. private:
  15964. class ContentComponent : public Component
  15965. {
  15966. public:
  15967. ContentComponent();
  15968. ~ContentComponent();
  15969. void paint (Graphics& g);
  15970. void resized();
  15971. String instructions;
  15972. GlyphArrangement text;
  15973. FileBrowserComponent* chooserComponent;
  15974. FilePreviewComponent* previewComponent;
  15975. TextButton* okButton;
  15976. TextButton* cancelButton;
  15977. };
  15978. ContentComponent* content;
  15979. const bool warnAboutOverwritingExistingFiles;
  15980. FileChooserDialogBox (const FileChooserDialogBox&);
  15981. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15982. };
  15983. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15984. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15985. #endif
  15986. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15987. #endif
  15988. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15989. /*** Start of inlined file: juce_FileListComponent.h ***/
  15990. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15991. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15992. class JUCE_API FileListComponent : public ListBox,
  15993. public DirectoryContentsDisplayComponent,
  15994. private ListBoxModel,
  15995. private ChangeListener
  15996. {
  15997. public:
  15998. FileListComponent (DirectoryContentsList& listToShow);
  15999. ~FileListComponent();
  16000. int getNumSelectedFiles() const;
  16001. const File getSelectedFile (int index = 0) const;
  16002. void scrollToTop();
  16003. void changeListenerCallback (void*);
  16004. int getNumRows();
  16005. void paintListBoxItem (int, Graphics&, int, int, bool);
  16006. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16007. void selectedRowsChanged (int lastRowSelected);
  16008. void deleteKeyPressed (int currentSelectedRow);
  16009. void returnKeyPressed (int currentSelectedRow);
  16010. juce_UseDebuggingNewOperator
  16011. private:
  16012. FileListComponent (const FileListComponent&);
  16013. FileListComponent& operator= (const FileListComponent&);
  16014. File lastDirectory;
  16015. };
  16016. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16017. /*** End of inlined file: juce_FileListComponent.h ***/
  16018. #endif
  16019. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16020. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16021. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16022. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16023. class FilenameComponent;
  16024. class JUCE_API FilenameComponentListener
  16025. {
  16026. public:
  16027. virtual ~FilenameComponentListener() {}
  16028. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16029. };
  16030. class JUCE_API FilenameComponent : public Component,
  16031. public SettableTooltipClient,
  16032. public FileDragAndDropTarget,
  16033. private AsyncUpdater,
  16034. private ButtonListener,
  16035. private ComboBoxListener
  16036. {
  16037. public:
  16038. FilenameComponent (const String& name,
  16039. const File& currentFile,
  16040. const bool canEditFilename,
  16041. const bool isDirectory,
  16042. const bool isForSaving,
  16043. const String& fileBrowserWildcard,
  16044. const String& enforcedSuffix,
  16045. const String& textWhenNothingSelected);
  16046. ~FilenameComponent();
  16047. const File getCurrentFile() const;
  16048. void setCurrentFile (File newFile,
  16049. const bool addToRecentlyUsedList,
  16050. const bool sendChangeNotification = true);
  16051. void setFilenameIsEditable (const bool shouldBeEditable);
  16052. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16053. const StringArray getRecentlyUsedFilenames() const;
  16054. void setRecentlyUsedFilenames (const StringArray& filenames);
  16055. void addRecentlyUsedFile (const File& file);
  16056. void setMaxNumberOfRecentFiles (const int newMaximum);
  16057. void setBrowseButtonText (const String& browseButtonText);
  16058. void addListener (FilenameComponentListener* const listener) throw();
  16059. void removeListener (FilenameComponentListener* const listener) throw();
  16060. void setTooltip (const String& newTooltip);
  16061. void paintOverChildren (Graphics& g);
  16062. void resized();
  16063. void lookAndFeelChanged();
  16064. bool isInterestedInFileDrag (const StringArray& files);
  16065. void filesDropped (const StringArray& files, int, int);
  16066. void fileDragEnter (const StringArray& files, int, int);
  16067. void fileDragExit (const StringArray& files);
  16068. juce_UseDebuggingNewOperator
  16069. private:
  16070. ComboBox* filenameBox;
  16071. String lastFilename;
  16072. Button* browseButton;
  16073. int maxRecentFiles;
  16074. bool isDir, isSaving, isFileDragOver;
  16075. String wildcard, enforcedSuffix, browseButtonText;
  16076. ListenerList <FilenameComponentListener> listeners;
  16077. File defaultBrowseFile;
  16078. void comboBoxChanged (ComboBox*);
  16079. void buttonClicked (Button* button);
  16080. void handleAsyncUpdate();
  16081. FilenameComponent (const FilenameComponent&);
  16082. FilenameComponent& operator= (const FilenameComponent&);
  16083. };
  16084. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16085. /*** End of inlined file: juce_FilenameComponent.h ***/
  16086. #endif
  16087. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16088. #endif
  16089. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16090. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16091. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16092. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16093. class JUCE_API FileSearchPathListComponent : public Component,
  16094. public SettableTooltipClient,
  16095. public FileDragAndDropTarget,
  16096. private ButtonListener,
  16097. private ListBoxModel
  16098. {
  16099. public:
  16100. FileSearchPathListComponent();
  16101. ~FileSearchPathListComponent();
  16102. const FileSearchPath& getPath() const throw() { return path; }
  16103. void setPath (const FileSearchPath& newPath);
  16104. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16105. enum ColourIds
  16106. {
  16107. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16108. Make this transparent if you don't want the background to be filled. */
  16109. };
  16110. int getNumRows();
  16111. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16112. void deleteKeyPressed (int lastRowSelected);
  16113. void returnKeyPressed (int lastRowSelected);
  16114. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16115. void selectedRowsChanged (int lastRowSelected);
  16116. void resized();
  16117. void paint (Graphics& g);
  16118. bool isInterestedInFileDrag (const StringArray& files);
  16119. void filesDropped (const StringArray& files, int, int);
  16120. void buttonClicked (Button* button);
  16121. juce_UseDebuggingNewOperator
  16122. private:
  16123. FileSearchPath path;
  16124. File defaultBrowseTarget;
  16125. ListBox* listBox;
  16126. Button* addButton;
  16127. Button* removeButton;
  16128. Button* changeButton;
  16129. Button* upButton;
  16130. Button* downButton;
  16131. void changed() throw();
  16132. void updateButtons() throw();
  16133. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16134. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16135. };
  16136. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16137. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16138. #endif
  16139. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16140. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16141. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16142. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16143. class JUCE_API FileTreeComponent : public TreeView,
  16144. public DirectoryContentsDisplayComponent
  16145. {
  16146. public:
  16147. FileTreeComponent (DirectoryContentsList& listToShow);
  16148. ~FileTreeComponent();
  16149. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16150. const File getSelectedFile (int index = 0) const;
  16151. void scrollToTop();
  16152. void setDragAndDropDescription (const String& description) throw();
  16153. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16154. juce_UseDebuggingNewOperator
  16155. private:
  16156. String dragAndDropDescription;
  16157. FileTreeComponent (const FileTreeComponent&);
  16158. FileTreeComponent& operator= (const FileTreeComponent&);
  16159. };
  16160. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16161. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16162. #endif
  16163. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16164. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16165. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16166. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16167. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16168. private Timer
  16169. {
  16170. public:
  16171. ImagePreviewComponent();
  16172. ~ImagePreviewComponent();
  16173. void selectedFileChanged (const File& newSelectedFile);
  16174. void paint (Graphics& g);
  16175. void timerCallback();
  16176. juce_UseDebuggingNewOperator
  16177. private:
  16178. File fileToLoad;
  16179. ScopedPointer <Image> currentThumbnail;
  16180. String currentDetails;
  16181. void getThumbSize (int& w, int& h) const;
  16182. ImagePreviewComponent (const ImagePreviewComponent&);
  16183. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16184. };
  16185. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16186. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16187. #endif
  16188. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16189. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16190. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16191. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16192. class JUCE_API WildcardFileFilter : public FileFilter
  16193. {
  16194. public:
  16195. WildcardFileFilter (const String& fileWildcardPatterns,
  16196. const String& directoryWildcardPatterns,
  16197. const String& description);
  16198. ~WildcardFileFilter();
  16199. bool isFileSuitable (const File& file) const;
  16200. bool isDirectorySuitable (const File& file) const;
  16201. juce_UseDebuggingNewOperator
  16202. private:
  16203. StringArray fileWildcards, directoryWildcards;
  16204. static void parse (const String& pattern, StringArray& result) throw();
  16205. static bool match (const File& file, const StringArray& wildcards) throw();
  16206. };
  16207. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16208. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16209. #endif
  16210. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16211. #endif
  16212. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16213. #endif
  16214. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16215. #endif
  16216. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16217. #endif
  16218. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16219. #endif
  16220. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16221. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16222. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16223. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16224. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16225. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16226. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16227. class JUCE_API KeyPressMappingSet : public KeyListener,
  16228. public ChangeBroadcaster,
  16229. public FocusChangeListener
  16230. {
  16231. public:
  16232. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16233. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16234. ~KeyPressMappingSet();
  16235. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16236. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16237. void addKeyPress (const CommandID commandID,
  16238. const KeyPress& newKeyPress,
  16239. int insertIndex = -1) throw();
  16240. void resetToDefaultMappings() throw();
  16241. void resetToDefaultMapping (const CommandID commandID) throw();
  16242. void clearAllKeyPresses() throw();
  16243. void clearAllKeyPresses (const CommandID commandID) throw();
  16244. void removeKeyPress (const CommandID commandID,
  16245. const int keyPressIndex) throw();
  16246. void removeKeyPress (const KeyPress& keypress) throw();
  16247. bool containsMapping (const CommandID commandID,
  16248. const KeyPress& keyPress) const throw();
  16249. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16250. bool restoreFromXml (const XmlElement& xmlVersion);
  16251. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16252. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16253. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16254. void globalFocusChanged (Component* focusedComponent);
  16255. juce_UseDebuggingNewOperator
  16256. private:
  16257. ApplicationCommandManager* commandManager;
  16258. struct CommandMapping
  16259. {
  16260. CommandID commandID;
  16261. Array <KeyPress> keypresses;
  16262. bool wantsKeyUpDownCallbacks;
  16263. };
  16264. OwnedArray <CommandMapping> mappings;
  16265. struct KeyPressTime
  16266. {
  16267. KeyPress key;
  16268. uint32 timeWhenPressed;
  16269. };
  16270. OwnedArray <KeyPressTime> keysDown;
  16271. void handleMessage (const Message& message);
  16272. void invokeCommand (const CommandID commandID,
  16273. const KeyPress& keyPress,
  16274. const bool isKeyDown,
  16275. const int millisecsSinceKeyPressed,
  16276. Component* const originatingComponent) const;
  16277. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16278. };
  16279. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16280. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16281. class JUCE_API KeyMappingEditorComponent : public Component,
  16282. public TreeViewItem,
  16283. public ChangeListener,
  16284. private ButtonListener
  16285. {
  16286. public:
  16287. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16288. const bool showResetToDefaultButton);
  16289. virtual ~KeyMappingEditorComponent();
  16290. void setColours (const Colour& mainBackground,
  16291. const Colour& textColour);
  16292. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16293. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16294. virtual bool isCommandReadOnly (const CommandID commandID);
  16295. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16296. enum ColourIds
  16297. {
  16298. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16299. textColourId = 0x100ad01, /**< The colour for the text. */
  16300. };
  16301. void parentHierarchyChanged();
  16302. void resized();
  16303. void changeListenerCallback (void*);
  16304. bool mightContainSubItems();
  16305. const String getUniqueName() const;
  16306. void buttonClicked (Button* button);
  16307. juce_UseDebuggingNewOperator
  16308. private:
  16309. KeyPressMappingSet* mappings;
  16310. TreeView* tree;
  16311. friend class KeyMappingTreeViewItem;
  16312. friend class KeyCategoryTreeViewItem;
  16313. friend class KeyMappingItemComponent;
  16314. friend class KeyMappingChangeButton;
  16315. TextButton* resetButton;
  16316. void assignNewKey (const CommandID commandID, int index);
  16317. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16318. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16319. };
  16320. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16321. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16322. #endif
  16323. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16324. #endif
  16325. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16326. #endif
  16327. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16328. #endif
  16329. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16330. #endif
  16331. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16332. #endif
  16333. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16334. #endif
  16335. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16336. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16337. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16338. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16339. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16340. {
  16341. public:
  16342. ComponentMovementWatcher (Component* const component);
  16343. ~ComponentMovementWatcher();
  16344. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16345. virtual void componentPeerChanged() = 0;
  16346. juce_UseDebuggingNewOperator
  16347. void componentParentHierarchyChanged (Component& component);
  16348. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16349. private:
  16350. Component::SafePointer<Component> component;
  16351. ComponentPeer* lastPeer;
  16352. VoidArray registeredParentComps;
  16353. bool reentrant;
  16354. Rectangle<int> lastBounds;
  16355. void unregister() throw();
  16356. void registerWithParentComps() throw();
  16357. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16358. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16359. };
  16360. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16361. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16362. #endif
  16363. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16364. /*** Start of inlined file: juce_GroupComponent.h ***/
  16365. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16366. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16367. class JUCE_API GroupComponent : public Component
  16368. {
  16369. public:
  16370. GroupComponent (const String& componentName,
  16371. const String& labelText);
  16372. ~GroupComponent();
  16373. void setText (const String& newText) throw();
  16374. const String getText() const throw();
  16375. void setTextLabelPosition (const Justification& justification);
  16376. const Justification getTextLabelPosition() const throw() { return justification; }
  16377. enum ColourIds
  16378. {
  16379. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16380. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16381. };
  16382. void paint (Graphics& g);
  16383. void enablementChanged();
  16384. void colourChanged();
  16385. private:
  16386. String text;
  16387. Justification justification;
  16388. GroupComponent (const GroupComponent&);
  16389. GroupComponent& operator= (const GroupComponent&);
  16390. };
  16391. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16392. /*** End of inlined file: juce_GroupComponent.h ***/
  16393. #endif
  16394. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16395. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16396. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16397. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16398. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16399. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16400. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16401. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16402. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16403. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16404. class TabbedButtonBar;
  16405. class JUCE_API TabBarButton : public Button
  16406. {
  16407. public:
  16408. TabBarButton (const String& name,
  16409. TabbedButtonBar* const ownerBar,
  16410. const int tabIndex);
  16411. ~TabBarButton();
  16412. virtual int getBestTabLength (const int depth);
  16413. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16414. void clicked (const ModifierKeys& mods);
  16415. bool hitTest (int x, int y);
  16416. juce_UseDebuggingNewOperator
  16417. protected:
  16418. friend class TabbedButtonBar;
  16419. TabbedButtonBar* const owner;
  16420. int tabIndex, overlapPixels;
  16421. DropShadowEffect shadow;
  16422. void getActiveArea (int& x, int& y, int& w, int& h);
  16423. private:
  16424. TabBarButton (const TabBarButton&);
  16425. TabBarButton& operator= (const TabBarButton&);
  16426. };
  16427. class JUCE_API TabbedButtonBar : public Component,
  16428. public ChangeBroadcaster,
  16429. public ButtonListener
  16430. {
  16431. public:
  16432. enum Orientation
  16433. {
  16434. TabsAtTop,
  16435. TabsAtBottom,
  16436. TabsAtLeft,
  16437. TabsAtRight
  16438. };
  16439. TabbedButtonBar (const Orientation orientation);
  16440. ~TabbedButtonBar();
  16441. void setOrientation (const Orientation orientation);
  16442. Orientation getOrientation() const throw() { return orientation; }
  16443. void clearTabs();
  16444. void addTab (const String& tabName,
  16445. const Colour& tabBackgroundColour,
  16446. int insertIndex = -1);
  16447. void setTabName (const int tabIndex,
  16448. const String& newName);
  16449. void removeTab (const int tabIndex);
  16450. void moveTab (const int currentIndex,
  16451. const int newIndex);
  16452. int getNumTabs() const;
  16453. const StringArray getTabNames() const;
  16454. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16455. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16456. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16457. TabBarButton* getTabButton (const int index) const;
  16458. virtual void currentTabChanged (const int newCurrentTabIndex,
  16459. const String& newCurrentTabName);
  16460. virtual void popupMenuClickOnTab (const int tabIndex,
  16461. const String& tabName);
  16462. const Colour getTabBackgroundColour (const int tabIndex);
  16463. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16464. enum ColourIds
  16465. {
  16466. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16467. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16468. the look and feel will choose an appropriate colour. */
  16469. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16470. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16471. this isn't specified, the look and feel will choose an appropriate
  16472. colour. */
  16473. };
  16474. void resized();
  16475. void buttonClicked (Button* button);
  16476. void lookAndFeelChanged();
  16477. juce_UseDebuggingNewOperator
  16478. protected:
  16479. virtual TabBarButton* createTabButton (const String& tabName,
  16480. const int tabIndex);
  16481. private:
  16482. Orientation orientation;
  16483. StringArray tabs;
  16484. Array <Colour> tabColours;
  16485. int currentTabIndex;
  16486. Component* behindFrontTab;
  16487. Button* extraTabsButton;
  16488. TabbedButtonBar (const TabbedButtonBar&);
  16489. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16490. };
  16491. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16492. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16493. class JUCE_API TabbedComponent : public Component
  16494. {
  16495. public:
  16496. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16497. ~TabbedComponent();
  16498. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16499. TabbedButtonBar::Orientation getOrientation() const throw();
  16500. void setTabBarDepth (const int newDepth);
  16501. int getTabBarDepth() const throw() { return tabDepth; }
  16502. void setOutline (const int newThickness);
  16503. void setIndent (const int indentThickness);
  16504. void clearTabs();
  16505. void addTab (const String& tabName,
  16506. const Colour& tabBackgroundColour,
  16507. Component* const contentComponent,
  16508. const bool deleteComponentWhenNotNeeded,
  16509. const int insertIndex = -1);
  16510. void setTabName (const int tabIndex,
  16511. const String& newName);
  16512. void removeTab (const int tabIndex);
  16513. int getNumTabs() const;
  16514. const StringArray getTabNames() const;
  16515. Component* getTabContentComponent (const int tabIndex) const throw();
  16516. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16517. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16518. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16519. int getCurrentTabIndex() const;
  16520. const String& getCurrentTabName() const;
  16521. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16522. virtual void currentTabChanged (const int newCurrentTabIndex,
  16523. const String& newCurrentTabName);
  16524. virtual void popupMenuClickOnTab (const int tabIndex,
  16525. const String& tabName);
  16526. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16527. enum ColourIds
  16528. {
  16529. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16530. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16531. (See setOutline) */
  16532. };
  16533. void paint (Graphics& g);
  16534. void resized();
  16535. void lookAndFeelChanged();
  16536. juce_UseDebuggingNewOperator
  16537. protected:
  16538. TabbedButtonBar* tabs;
  16539. virtual TabBarButton* createTabButton (const String& tabName,
  16540. const int tabIndex);
  16541. private:
  16542. Array <Component*> contentComponents;
  16543. Component* panelComponent;
  16544. int tabDepth;
  16545. int outlineThickness, edgeIndent;
  16546. friend class TabCompButtonBar;
  16547. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16548. TabbedComponent (const TabbedComponent&);
  16549. TabbedComponent& operator= (const TabbedComponent&);
  16550. };
  16551. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16552. /*** End of inlined file: juce_TabbedComponent.h ***/
  16553. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16554. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16555. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16556. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16557. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16558. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16559. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16560. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16561. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16562. class MenuBarModel;
  16563. class JUCE_API MenuBarModelListener
  16564. {
  16565. public:
  16566. virtual ~MenuBarModelListener() {}
  16567. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16568. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16569. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16570. };
  16571. class JUCE_API MenuBarModel : private AsyncUpdater,
  16572. private ApplicationCommandManagerListener
  16573. {
  16574. public:
  16575. MenuBarModel() throw();
  16576. virtual ~MenuBarModel();
  16577. void menuItemsChanged();
  16578. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16579. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16580. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16581. virtual const StringArray getMenuBarNames() = 0;
  16582. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16583. const String& menuName) = 0;
  16584. virtual void menuItemSelected (int menuItemID,
  16585. int topLevelMenuIndex) = 0;
  16586. #if JUCE_MAC || DOXYGEN
  16587. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16588. const PopupMenu* extraAppleMenuItems = 0);
  16589. static MenuBarModel* getMacMainMenu();
  16590. #endif
  16591. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16592. void applicationCommandListChanged();
  16593. void handleAsyncUpdate();
  16594. juce_UseDebuggingNewOperator
  16595. private:
  16596. ApplicationCommandManager* manager;
  16597. ListenerList <MenuBarModelListener> listeners;
  16598. MenuBarModel (const MenuBarModel&);
  16599. MenuBarModel& operator= (const MenuBarModel&);
  16600. };
  16601. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16602. /*** End of inlined file: juce_MenuBarModel.h ***/
  16603. class JUCE_API MenuBarComponent : public Component,
  16604. private MenuBarModelListener,
  16605. private Timer
  16606. {
  16607. public:
  16608. MenuBarComponent (MenuBarModel* const model);
  16609. ~MenuBarComponent();
  16610. void setModel (MenuBarModel* const newModel);
  16611. void showMenu (const int menuIndex);
  16612. void paint (Graphics& g);
  16613. void resized();
  16614. void mouseEnter (const MouseEvent& e);
  16615. void mouseExit (const MouseEvent& e);
  16616. void mouseDown (const MouseEvent& e);
  16617. void mouseDrag (const MouseEvent& e);
  16618. void mouseUp (const MouseEvent& e);
  16619. void mouseMove (const MouseEvent& e);
  16620. void inputAttemptWhenModal();
  16621. void handleCommandMessage (int commandId);
  16622. bool keyPressed (const KeyPress& key);
  16623. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16624. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16625. const ApplicationCommandTarget::InvocationInfo& info);
  16626. juce_UseDebuggingNewOperator
  16627. private:
  16628. MenuBarModel* model;
  16629. StringArray menuNames;
  16630. Array <int> xPositions;
  16631. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16632. int lastMouseX, lastMouseY;
  16633. bool inModalState;
  16634. ScopedPointer <Component> currentPopup;
  16635. int getItemAt (int x, int y);
  16636. void updateItemUnderMouse (const int x, const int y);
  16637. void hideCurrentMenu();
  16638. void timerCallback();
  16639. void repaintMenuItem (int index);
  16640. MenuBarComponent (const MenuBarComponent&);
  16641. MenuBarComponent& operator= (const MenuBarComponent&);
  16642. };
  16643. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16644. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16645. class JUCE_API DocumentWindow : public ResizableWindow
  16646. {
  16647. public:
  16648. enum TitleBarButtons
  16649. {
  16650. minimiseButton = 1,
  16651. maximiseButton = 2,
  16652. closeButton = 4,
  16653. allButtons = 7
  16654. };
  16655. DocumentWindow (const String& name,
  16656. const Colour& backgroundColour,
  16657. const int requiredButtons,
  16658. const bool addToDesktop = true);
  16659. ~DocumentWindow();
  16660. void setName (const String& newName);
  16661. void setIcon (const Image* imageToUse);
  16662. void setTitleBarHeight (const int newHeight);
  16663. int getTitleBarHeight() const;
  16664. void setTitleBarButtonsRequired (const int requiredButtons,
  16665. const bool positionTitleBarButtonsOnLeft);
  16666. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16667. void setMenuBar (MenuBarModel* menuBarModel,
  16668. const int menuBarHeight = 0);
  16669. virtual void closeButtonPressed();
  16670. virtual void minimiseButtonPressed();
  16671. virtual void maximiseButtonPressed();
  16672. Button* getCloseButton() const throw();
  16673. Button* getMinimiseButton() const throw();
  16674. Button* getMaximiseButton() const throw();
  16675. enum ColourIds
  16676. {
  16677. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16678. and feel class how this is used. */
  16679. };
  16680. void paint (Graphics& g);
  16681. void resized();
  16682. void lookAndFeelChanged();
  16683. const BorderSize getBorderThickness();
  16684. const BorderSize getContentComponentBorder();
  16685. void mouseDoubleClick (const MouseEvent& e);
  16686. void userTriedToCloseWindow();
  16687. void activeWindowStatusChanged();
  16688. int getDesktopWindowStyleFlags() const;
  16689. void parentHierarchyChanged();
  16690. const Rectangle<int> getTitleBarArea();
  16691. juce_UseDebuggingNewOperator
  16692. private:
  16693. int titleBarHeight, menuBarHeight, requiredButtons;
  16694. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16695. ScopedPointer <Button> titleBarButtons [3];
  16696. ScopedPointer <Image> titleBarIcon;
  16697. ScopedPointer <MenuBarComponent> menuBar;
  16698. MenuBarModel* menuBarModel;
  16699. class ButtonListenerProxy;
  16700. friend class ScopedPointer <ButtonListenerProxy>;
  16701. ScopedPointer <ButtonListenerProxy> buttonListener;
  16702. void repaintTitleBar();
  16703. DocumentWindow (const DocumentWindow&);
  16704. DocumentWindow& operator= (const DocumentWindow&);
  16705. };
  16706. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16707. /*** End of inlined file: juce_DocumentWindow.h ***/
  16708. class MultiDocumentPanel;
  16709. class MDITabbedComponentInternal;
  16710. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16711. {
  16712. public:
  16713. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16714. ~MultiDocumentPanelWindow();
  16715. void maximiseButtonPressed();
  16716. void closeButtonPressed();
  16717. void activeWindowStatusChanged();
  16718. void broughtToFront();
  16719. juce_UseDebuggingNewOperator
  16720. private:
  16721. void updateOrder();
  16722. MultiDocumentPanel* getOwner() const throw();
  16723. };
  16724. class JUCE_API MultiDocumentPanel : public Component,
  16725. private ComponentListener
  16726. {
  16727. public:
  16728. MultiDocumentPanel();
  16729. ~MultiDocumentPanel();
  16730. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16731. bool addDocument (Component* const component,
  16732. const Colour& backgroundColour,
  16733. const bool deleteWhenRemoved);
  16734. bool closeDocument (Component* component,
  16735. const bool checkItsOkToCloseFirst);
  16736. int getNumDocuments() const throw();
  16737. Component* getDocument (const int index) const throw();
  16738. Component* getActiveDocument() const throw();
  16739. void setActiveDocument (Component* component);
  16740. virtual void activeDocumentChanged();
  16741. void setMaximumNumDocuments (const int maximumNumDocuments);
  16742. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16743. bool isFullscreenWhenOneDocument() const throw();
  16744. enum LayoutMode
  16745. {
  16746. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16747. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16748. };
  16749. void setLayoutMode (const LayoutMode newLayoutMode);
  16750. LayoutMode getLayoutMode() const throw() { return mode; }
  16751. void setBackgroundColour (const Colour& newBackgroundColour);
  16752. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16753. virtual bool tryToCloseDocument (Component* component) = 0;
  16754. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16755. void paint (Graphics& g);
  16756. void resized();
  16757. void componentNameChanged (Component&);
  16758. juce_UseDebuggingNewOperator
  16759. private:
  16760. LayoutMode mode;
  16761. Array <Component*> components;
  16762. TabbedComponent* tabComponent;
  16763. Colour backgroundColour;
  16764. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16765. friend class MultiDocumentPanelWindow;
  16766. friend class MDITabbedComponentInternal;
  16767. Component* getContainerComp (Component* c) const;
  16768. void updateOrder();
  16769. void addWindow (Component* component);
  16770. };
  16771. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16772. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16773. #endif
  16774. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16775. #endif
  16776. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16777. #endif
  16778. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16779. #endif
  16780. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16781. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16782. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16783. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16784. class JUCE_API StretchableLayoutManager
  16785. {
  16786. public:
  16787. StretchableLayoutManager();
  16788. ~StretchableLayoutManager();
  16789. void setItemLayout (const int itemIndex,
  16790. const double minimumSize,
  16791. const double maximumSize,
  16792. const double preferredSize);
  16793. bool getItemLayout (const int itemIndex,
  16794. double& minimumSize,
  16795. double& maximumSize,
  16796. double& preferredSize) const;
  16797. void clearAllItems();
  16798. void layOutComponents (Component** const components,
  16799. int numComponents,
  16800. int x, int y, int width, int height,
  16801. const bool vertically,
  16802. const bool resizeOtherDimension);
  16803. int getItemCurrentPosition (const int itemIndex) const;
  16804. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16805. double getItemCurrentRelativeSize (const int itemIndex) const;
  16806. void setItemPosition (const int itemIndex,
  16807. int newPosition);
  16808. juce_UseDebuggingNewOperator
  16809. private:
  16810. struct ItemLayoutProperties
  16811. {
  16812. int itemIndex;
  16813. int currentSize;
  16814. double minSize, maxSize, preferredSize;
  16815. };
  16816. OwnedArray <ItemLayoutProperties> items;
  16817. int totalSize;
  16818. static int sizeToRealSize (double size, int totalSpace);
  16819. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16820. void setTotalSize (const int newTotalSize);
  16821. int fitComponentsIntoSpace (const int startIndex,
  16822. const int endIndex,
  16823. const int availableSpace,
  16824. int startPos);
  16825. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16826. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16827. void updatePrefSizesToMatchCurrentPositions();
  16828. StretchableLayoutManager (const StretchableLayoutManager&);
  16829. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16830. };
  16831. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16832. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16833. #endif
  16834. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16835. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16836. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16837. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16838. class JUCE_API StretchableLayoutResizerBar : public Component
  16839. {
  16840. public:
  16841. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16842. const int itemIndexInLayout,
  16843. const bool isBarVertical);
  16844. ~StretchableLayoutResizerBar();
  16845. virtual void hasBeenMoved();
  16846. void paint (Graphics& g);
  16847. void mouseDown (const MouseEvent& e);
  16848. void mouseDrag (const MouseEvent& e);
  16849. juce_UseDebuggingNewOperator
  16850. private:
  16851. StretchableLayoutManager* layout;
  16852. int itemIndex, mouseDownPos;
  16853. bool isVertical;
  16854. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16855. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16856. };
  16857. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16858. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16859. #endif
  16860. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16861. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16862. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16863. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16864. class StretchableObjectResizer
  16865. {
  16866. public:
  16867. StretchableObjectResizer();
  16868. ~StretchableObjectResizer();
  16869. void addItem (const double currentSize,
  16870. const double minSize,
  16871. const double maxSize,
  16872. const int order = 0);
  16873. void resizeToFit (const double targetSize);
  16874. int getNumItems() const throw() { return items.size(); }
  16875. double getItemSize (const int index) const throw();
  16876. juce_UseDebuggingNewOperator
  16877. private:
  16878. struct Item
  16879. {
  16880. double size;
  16881. double minSize;
  16882. double maxSize;
  16883. int order;
  16884. };
  16885. OwnedArray <Item> items;
  16886. StretchableObjectResizer (const StretchableObjectResizer&);
  16887. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16888. };
  16889. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16890. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16891. #endif
  16892. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16893. #endif
  16894. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16895. #endif
  16896. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16897. #endif
  16898. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16899. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16900. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16901. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16902. /*** Start of inlined file: juce_AlertWindow.h ***/
  16903. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16904. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16905. /*** Start of inlined file: juce_TextLayout.h ***/
  16906. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16907. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16908. class Graphics;
  16909. class JUCE_API TextLayout
  16910. {
  16911. public:
  16912. TextLayout() throw();
  16913. TextLayout (const TextLayout& other) throw();
  16914. TextLayout (const String& text, const Font& font) throw();
  16915. ~TextLayout() throw();
  16916. TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16917. void clear() throw();
  16918. void appendText (const String& textToAppend,
  16919. const Font& fontToUse) throw();
  16920. void setText (const String& newText,
  16921. const Font& fontToUse) throw();
  16922. void layout (int maximumWidth,
  16923. const Justification& justification,
  16924. const bool attemptToBalanceLineLengths) throw();
  16925. int getWidth() const throw();
  16926. int getHeight() const throw();
  16927. int getNumLines() const throw() { return totalLines; }
  16928. int getLineWidth (const int lineNumber) const throw();
  16929. void draw (Graphics& g,
  16930. const int topLeftX,
  16931. const int topLeftY) const throw();
  16932. void drawWithin (Graphics& g,
  16933. int x, int y, int w, int h,
  16934. const Justification& layoutFlags) const throw();
  16935. juce_UseDebuggingNewOperator
  16936. private:
  16937. class Token;
  16938. friend class OwnedArray <Token>;
  16939. OwnedArray <Token> tokens;
  16940. int totalLines;
  16941. };
  16942. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16943. /*** End of inlined file: juce_TextLayout.h ***/
  16944. class JUCE_API AlertWindow : public TopLevelWindow,
  16945. private ButtonListener
  16946. {
  16947. public:
  16948. enum AlertIconType
  16949. {
  16950. NoIcon, /**< No icon will be shown on the dialog box. */
  16951. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16952. user to answer a question. */
  16953. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16954. warning about something and shouldn't be ignored. */
  16955. InfoIcon /**< An icon that indicates that the dialog box is just
  16956. giving the user some information, which doesn't require
  16957. a response from them. */
  16958. };
  16959. AlertWindow (const String& title,
  16960. const String& message,
  16961. AlertIconType iconType,
  16962. Component* associatedComponent = 0);
  16963. ~AlertWindow();
  16964. AlertIconType getAlertType() const throw() { return alertIconType; }
  16965. void setMessage (const String& message);
  16966. void addButton (const String& name,
  16967. const int returnValue,
  16968. const KeyPress& shortcutKey1 = KeyPress(),
  16969. const KeyPress& shortcutKey2 = KeyPress());
  16970. int getNumButtons() const;
  16971. void addTextEditor (const String& name,
  16972. const String& initialContents,
  16973. const String& onScreenLabel = String::empty,
  16974. const bool isPasswordBox = false);
  16975. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16976. void addComboBox (const String& name,
  16977. const StringArray& items,
  16978. const String& onScreenLabel = String::empty);
  16979. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16980. void addTextBlock (const String& text);
  16981. void addProgressBarComponent (double& progressValue);
  16982. void addCustomComponent (Component* const component);
  16983. int getNumCustomComponents() const;
  16984. Component* getCustomComponent (const int index) const;
  16985. Component* removeCustomComponent (const int index);
  16986. bool containsAnyExtraComponents() const;
  16987. // easy-to-use message box functions:
  16988. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16989. const String& title,
  16990. const String& message,
  16991. const String& buttonText = String::empty,
  16992. Component* associatedComponent = 0);
  16993. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16994. const String& title,
  16995. const String& message,
  16996. const String& button1Text = String::empty,
  16997. const String& button2Text = String::empty,
  16998. Component* associatedComponent = 0);
  16999. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17000. const String& title,
  17001. const String& message,
  17002. const String& button1Text = String::empty,
  17003. const String& button2Text = String::empty,
  17004. const String& button3Text = String::empty,
  17005. Component* associatedComponent = 0);
  17006. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17007. const String& bodyText,
  17008. bool isOkCancel);
  17009. enum ColourIds
  17010. {
  17011. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17012. textColourId = 0x1001810, /**< The colour for the text. */
  17013. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17014. };
  17015. juce_UseDebuggingNewOperator
  17016. protected:
  17017. void paint (Graphics& g);
  17018. void mouseDown (const MouseEvent& e);
  17019. void mouseDrag (const MouseEvent& e);
  17020. bool keyPressed (const KeyPress& key);
  17021. void buttonClicked (Button* button);
  17022. void lookAndFeelChanged();
  17023. void userTriedToCloseWindow();
  17024. int getDesktopWindowStyleFlags() const;
  17025. private:
  17026. String text;
  17027. TextLayout textLayout;
  17028. AlertIconType alertIconType;
  17029. ComponentBoundsConstrainer constrainer;
  17030. ComponentDragger dragger;
  17031. Rectangle<int> textArea;
  17032. VoidArray buttons, textBoxes, comboBoxes;
  17033. VoidArray progressBars, customComps, textBlocks, allComps;
  17034. StringArray textboxNames, comboBoxNames;
  17035. Font font;
  17036. Component* associatedComponent;
  17037. void updateLayout (const bool onlyIncreaseSize);
  17038. // disable copy constructor
  17039. AlertWindow (const AlertWindow&);
  17040. AlertWindow& operator= (const AlertWindow&);
  17041. };
  17042. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17043. /*** End of inlined file: juce_AlertWindow.h ***/
  17044. class ToggleButton;
  17045. class TextButton;
  17046. class AlertWindow;
  17047. class TextLayout;
  17048. class ScrollBar;
  17049. class BubbleComponent;
  17050. class ComboBox;
  17051. class Button;
  17052. class FilenameComponent;
  17053. class DocumentWindow;
  17054. class ResizableWindow;
  17055. class GroupComponent;
  17056. class MenuBarComponent;
  17057. class DropShadower;
  17058. class GlyphArrangement;
  17059. class PropertyComponent;
  17060. class TableHeaderComponent;
  17061. class Toolbar;
  17062. class ToolbarItemComponent;
  17063. class PopupMenu;
  17064. class ProgressBar;
  17065. class FileBrowserComponent;
  17066. class DirectoryContentsDisplayComponent;
  17067. class FilePreviewComponent;
  17068. class ImageButton;
  17069. class JUCE_API LookAndFeel
  17070. {
  17071. public:
  17072. LookAndFeel();
  17073. virtual ~LookAndFeel();
  17074. static LookAndFeel& getDefaultLookAndFeel() throw();
  17075. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17076. const Colour findColour (const int colourId) const throw();
  17077. void setColour (const int colourId, const Colour& colour) throw();
  17078. bool isColourSpecified (const int colourId) const throw();
  17079. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17080. void setDefaultSansSerifTypefaceName (const String& newName);
  17081. virtual const MouseCursor getMouseCursorFor (Component& component);
  17082. virtual void drawButtonBackground (Graphics& g,
  17083. Button& button,
  17084. const Colour& backgroundColour,
  17085. bool isMouseOverButton,
  17086. bool isButtonDown);
  17087. virtual const Font getFontForTextButton (TextButton& button);
  17088. virtual void drawButtonText (Graphics& g,
  17089. TextButton& button,
  17090. bool isMouseOverButton,
  17091. bool isButtonDown);
  17092. virtual void drawToggleButton (Graphics& g,
  17093. ToggleButton& button,
  17094. bool isMouseOverButton,
  17095. bool isButtonDown);
  17096. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17097. virtual void drawTickBox (Graphics& g,
  17098. Component& component,
  17099. float x, float y, float w, float h,
  17100. const bool ticked,
  17101. const bool isEnabled,
  17102. const bool isMouseOverButton,
  17103. const bool isButtonDown);
  17104. virtual AlertWindow* createAlertWindow (const String& title,
  17105. const String& message,
  17106. const String& button1,
  17107. const String& button2,
  17108. const String& button3,
  17109. AlertWindow::AlertIconType iconType,
  17110. int numButtons,
  17111. Component* associatedComponent);
  17112. virtual void drawAlertBox (Graphics& g,
  17113. AlertWindow& alert,
  17114. const Rectangle<int>& textArea,
  17115. TextLayout& textLayout);
  17116. virtual int getAlertBoxWindowFlags();
  17117. virtual int getAlertWindowButtonHeight();
  17118. virtual const Font getAlertWindowFont();
  17119. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17120. int width, int height,
  17121. double progress, const String& textToShow);
  17122. // Draws a small image that spins to indicate that something's happening..
  17123. // This method should use the current time to animate itself, so just keep
  17124. // repainting it every so often.
  17125. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17126. int x, int y, int w, int h);
  17127. virtual void drawScrollbarButton (Graphics& g,
  17128. ScrollBar& scrollbar,
  17129. int width, int height,
  17130. int buttonDirection,
  17131. bool isScrollbarVertical,
  17132. bool isMouseOverButton,
  17133. bool isButtonDown);
  17134. virtual void drawScrollbar (Graphics& g,
  17135. ScrollBar& scrollbar,
  17136. int x, int y,
  17137. int width, int height,
  17138. bool isScrollbarVertical,
  17139. int thumbStartPosition,
  17140. int thumbSize,
  17141. bool isMouseOver,
  17142. bool isMouseDown);
  17143. virtual ImageEffectFilter* getScrollbarEffect();
  17144. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17145. virtual int getDefaultScrollbarWidth();
  17146. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17147. virtual const Path getTickShape (const float height);
  17148. virtual const Path getCrossShape (const float height);
  17149. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17150. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17151. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17152. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17153. virtual Image* getDefaultFolderImage();
  17154. virtual Image* getDefaultDocumentFileImage();
  17155. virtual void createFileChooserHeaderText (const String& title,
  17156. const String& instructions,
  17157. GlyphArrangement& destArrangement,
  17158. int width);
  17159. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17160. const String& filename, Image* icon,
  17161. const String& fileSizeDescription,
  17162. const String& fileTimeDescription,
  17163. const bool isDirectory,
  17164. const bool isItemSelected,
  17165. const int itemIndex);
  17166. virtual Button* createFileBrowserGoUpButton();
  17167. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17168. DirectoryContentsDisplayComponent* fileListComponent,
  17169. FilePreviewComponent* previewComp,
  17170. ComboBox* currentPathBox,
  17171. TextEditor* filenameBox,
  17172. Button* goUpButton);
  17173. virtual void drawBubble (Graphics& g,
  17174. float tipX, float tipY,
  17175. float boxX, float boxY, float boxW, float boxH);
  17176. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17177. virtual void drawPopupMenuItem (Graphics& g,
  17178. int width, int height,
  17179. const bool isSeparator,
  17180. const bool isActive,
  17181. const bool isHighlighted,
  17182. const bool isTicked,
  17183. const bool hasSubMenu,
  17184. const String& text,
  17185. const String& shortcutKeyText,
  17186. Image* image,
  17187. const Colour* const textColour);
  17188. virtual const Font getPopupMenuFont();
  17189. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17190. int width, int height,
  17191. bool isScrollUpArrow);
  17192. virtual void getIdealPopupMenuItemSize (const String& text,
  17193. const bool isSeparator,
  17194. int standardMenuItemHeight,
  17195. int& idealWidth,
  17196. int& idealHeight);
  17197. virtual int getMenuWindowFlags();
  17198. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17199. bool isMouseOverBar,
  17200. MenuBarComponent& menuBar);
  17201. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17202. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17203. virtual void drawMenuBarItem (Graphics& g,
  17204. int width, int height,
  17205. int itemIndex,
  17206. const String& itemText,
  17207. bool isMouseOverItem,
  17208. bool isMenuOpen,
  17209. bool isMouseOverBar,
  17210. MenuBarComponent& menuBar);
  17211. virtual void drawComboBox (Graphics& g, int width, int height,
  17212. const bool isButtonDown,
  17213. int buttonX, int buttonY,
  17214. int buttonW, int buttonH,
  17215. ComboBox& box);
  17216. virtual const Font getComboBoxFont (ComboBox& box);
  17217. virtual Label* createComboBoxTextBox (ComboBox& box);
  17218. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17219. virtual void drawLabel (Graphics& g, Label& label);
  17220. virtual void drawLinearSlider (Graphics& g,
  17221. int x, int y,
  17222. int width, int height,
  17223. float sliderPos,
  17224. float minSliderPos,
  17225. float maxSliderPos,
  17226. const Slider::SliderStyle style,
  17227. Slider& slider);
  17228. virtual void drawLinearSliderBackground (Graphics& g,
  17229. int x, int y,
  17230. int width, int height,
  17231. float sliderPos,
  17232. float minSliderPos,
  17233. float maxSliderPos,
  17234. const Slider::SliderStyle style,
  17235. Slider& slider);
  17236. virtual void drawLinearSliderThumb (Graphics& g,
  17237. int x, int y,
  17238. int width, int height,
  17239. float sliderPos,
  17240. float minSliderPos,
  17241. float maxSliderPos,
  17242. const Slider::SliderStyle style,
  17243. Slider& slider);
  17244. virtual int getSliderThumbRadius (Slider& slider);
  17245. virtual void drawRotarySlider (Graphics& g,
  17246. int x, int y,
  17247. int width, int height,
  17248. float sliderPosProportional,
  17249. const float rotaryStartAngle,
  17250. const float rotaryEndAngle,
  17251. Slider& slider);
  17252. virtual Button* createSliderButton (const bool isIncrement);
  17253. virtual Label* createSliderTextBox (Slider& slider);
  17254. virtual ImageEffectFilter* getSliderEffect();
  17255. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17256. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17257. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17258. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17259. ComboBox* filenameBox, Button* browseButton);
  17260. virtual void drawCornerResizer (Graphics& g,
  17261. int w, int h,
  17262. bool isMouseOver,
  17263. bool isMouseDragging);
  17264. virtual void drawResizableFrame (Graphics& g,
  17265. int w, int h,
  17266. const BorderSize& borders);
  17267. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17268. const BorderSize& border,
  17269. ResizableWindow& window);
  17270. virtual void drawResizableWindowBorder (Graphics& g,
  17271. int w, int h,
  17272. const BorderSize& border,
  17273. ResizableWindow& window);
  17274. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17275. Graphics& g, int w, int h,
  17276. int titleSpaceX, int titleSpaceW,
  17277. const Image* icon,
  17278. bool drawTitleTextOnLeft);
  17279. virtual Button* createDocumentWindowButton (int buttonType);
  17280. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17281. int titleBarX, int titleBarY,
  17282. int titleBarW, int titleBarH,
  17283. Button* minimiseButton,
  17284. Button* maximiseButton,
  17285. Button* closeButton,
  17286. bool positionTitleBarButtonsOnLeft);
  17287. virtual int getDefaultMenuBarHeight();
  17288. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17289. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17290. int w, int h,
  17291. bool isVerticalBar,
  17292. bool isMouseOver,
  17293. bool isMouseDragging);
  17294. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17295. const String& text,
  17296. const Justification& position,
  17297. GroupComponent& group);
  17298. virtual void createTabButtonShape (Path& p,
  17299. int width, int height,
  17300. int tabIndex,
  17301. const String& text,
  17302. Button& button,
  17303. TabbedButtonBar::Orientation orientation,
  17304. const bool isMouseOver,
  17305. const bool isMouseDown,
  17306. const bool isFrontTab);
  17307. virtual void fillTabButtonShape (Graphics& g,
  17308. const Path& path,
  17309. const Colour& preferredBackgroundColour,
  17310. int tabIndex,
  17311. const String& text,
  17312. Button& button,
  17313. TabbedButtonBar::Orientation orientation,
  17314. const bool isMouseOver,
  17315. const bool isMouseDown,
  17316. const bool isFrontTab);
  17317. virtual void drawTabButtonText (Graphics& g,
  17318. int x, int y, int w, int h,
  17319. const Colour& preferredBackgroundColour,
  17320. int tabIndex,
  17321. const String& text,
  17322. Button& button,
  17323. TabbedButtonBar::Orientation orientation,
  17324. const bool isMouseOver,
  17325. const bool isMouseDown,
  17326. const bool isFrontTab);
  17327. virtual int getTabButtonOverlap (int tabDepth);
  17328. virtual int getTabButtonSpaceAroundImage();
  17329. virtual int getTabButtonBestWidth (int tabIndex,
  17330. const String& text,
  17331. int tabDepth,
  17332. Button& button);
  17333. virtual void drawTabButton (Graphics& g,
  17334. int w, int h,
  17335. const Colour& preferredColour,
  17336. int tabIndex,
  17337. const String& text,
  17338. Button& button,
  17339. TabbedButtonBar::Orientation orientation,
  17340. const bool isMouseOver,
  17341. const bool isMouseDown,
  17342. const bool isFrontTab);
  17343. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17344. int w, int h,
  17345. TabbedButtonBar& tabBar,
  17346. TabbedButtonBar::Orientation orientation);
  17347. virtual Button* createTabBarExtrasButton();
  17348. virtual void drawImageButton (Graphics& g, Image* image,
  17349. int imageX, int imageY, int imageW, int imageH,
  17350. const Colour& overlayColour,
  17351. float imageOpacity,
  17352. ImageButton& button);
  17353. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17354. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17355. int width, int height,
  17356. bool isMouseOver, bool isMouseDown,
  17357. int columnFlags);
  17358. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17359. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17360. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17361. bool isMouseOver, bool isMouseDown,
  17362. ToolbarItemComponent& component);
  17363. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17364. const String& text, ToolbarItemComponent& component);
  17365. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17366. bool isOpen, int width, int height);
  17367. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17368. PropertyComponent& component);
  17369. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17370. PropertyComponent& component);
  17371. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17372. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17373. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17374. virtual void playAlertSound();
  17375. static void drawGlassSphere (Graphics& g,
  17376. const float x, const float y,
  17377. const float diameter,
  17378. const Colour& colour,
  17379. const float outlineThickness) throw();
  17380. static void drawGlassPointer (Graphics& g,
  17381. const float x, const float y,
  17382. const float diameter,
  17383. const Colour& colour, const float outlineThickness,
  17384. const int direction) throw();
  17385. static void drawGlassLozenge (Graphics& g,
  17386. const float x, const float y,
  17387. const float width, const float height,
  17388. const Colour& colour,
  17389. const float outlineThickness,
  17390. const float cornerSize,
  17391. const bool flatOnLeft, const bool flatOnRight,
  17392. const bool flatOnTop, const bool flatOnBottom) throw();
  17393. juce_UseDebuggingNewOperator
  17394. private:
  17395. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17396. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17397. Array <int> colourIds;
  17398. Array <Colour> colours;
  17399. // default typeface names
  17400. String defaultSans, defaultSerif, defaultFixed;
  17401. void drawShinyButtonShape (Graphics& g,
  17402. float x, float y, float w, float h, float maxCornerSize,
  17403. const Colour& baseColour,
  17404. const float strokeWidth,
  17405. const bool flatOnLeft,
  17406. const bool flatOnRight,
  17407. const bool flatOnTop,
  17408. const bool flatOnBottom) throw();
  17409. LookAndFeel (const LookAndFeel&);
  17410. LookAndFeel& operator= (const LookAndFeel&);
  17411. };
  17412. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17413. /*** End of inlined file: juce_LookAndFeel.h ***/
  17414. #endif
  17415. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17416. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17417. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17418. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17419. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17420. {
  17421. public:
  17422. OldSchoolLookAndFeel();
  17423. virtual ~OldSchoolLookAndFeel();
  17424. virtual void drawButtonBackground (Graphics& g,
  17425. Button& button,
  17426. const Colour& backgroundColour,
  17427. bool isMouseOverButton,
  17428. bool isButtonDown);
  17429. virtual void drawToggleButton (Graphics& g,
  17430. ToggleButton& button,
  17431. bool isMouseOverButton,
  17432. bool isButtonDown);
  17433. virtual void drawTickBox (Graphics& g,
  17434. Component& component,
  17435. float x, float y, float w, float h,
  17436. const bool ticked,
  17437. const bool isEnabled,
  17438. const bool isMouseOverButton,
  17439. const bool isButtonDown);
  17440. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17441. int width, int height,
  17442. double progress, const String& textToShow);
  17443. virtual void drawScrollbarButton (Graphics& g,
  17444. ScrollBar& scrollbar,
  17445. int width, int height,
  17446. int buttonDirection,
  17447. bool isScrollbarVertical,
  17448. bool isMouseOverButton,
  17449. bool isButtonDown);
  17450. virtual void drawScrollbar (Graphics& g,
  17451. ScrollBar& scrollbar,
  17452. int x, int y,
  17453. int width, int height,
  17454. bool isScrollbarVertical,
  17455. int thumbStartPosition,
  17456. int thumbSize,
  17457. bool isMouseOver,
  17458. bool isMouseDown);
  17459. virtual ImageEffectFilter* getScrollbarEffect();
  17460. virtual void drawTextEditorOutline (Graphics& g,
  17461. int width, int height,
  17462. TextEditor& textEditor);
  17463. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17464. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17465. bool isMouseOverBar,
  17466. MenuBarComponent& menuBar);
  17467. virtual void drawComboBox (Graphics& g, int width, int height,
  17468. const bool isButtonDown,
  17469. int buttonX, int buttonY,
  17470. int buttonW, int buttonH,
  17471. ComboBox& box);
  17472. virtual const Font getComboBoxFont (ComboBox& box);
  17473. virtual void drawLinearSlider (Graphics& g,
  17474. int x, int y,
  17475. int width, int height,
  17476. float sliderPos,
  17477. float minSliderPos,
  17478. float maxSliderPos,
  17479. const Slider::SliderStyle style,
  17480. Slider& slider);
  17481. virtual int getSliderThumbRadius (Slider& slider);
  17482. virtual Button* createSliderButton (const bool isIncrement);
  17483. virtual ImageEffectFilter* getSliderEffect();
  17484. virtual void drawCornerResizer (Graphics& g,
  17485. int w, int h,
  17486. bool isMouseOver,
  17487. bool isMouseDragging);
  17488. virtual Button* createDocumentWindowButton (int buttonType);
  17489. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17490. int titleBarX, int titleBarY,
  17491. int titleBarW, int titleBarH,
  17492. Button* minimiseButton,
  17493. Button* maximiseButton,
  17494. Button* closeButton,
  17495. bool positionTitleBarButtonsOnLeft);
  17496. juce_UseDebuggingNewOperator
  17497. private:
  17498. DropShadowEffect scrollbarShadow;
  17499. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17500. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17501. };
  17502. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17503. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17504. #endif
  17505. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17506. #endif
  17507. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17508. #endif
  17509. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17510. #endif
  17511. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17512. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17513. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17514. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17515. class JUCE_API PopupMenuCustomComponent : public Component,
  17516. public ReferenceCountedObject
  17517. {
  17518. public:
  17519. ~PopupMenuCustomComponent();
  17520. virtual void getIdealSize (int& idealWidth,
  17521. int& idealHeight) = 0;
  17522. void triggerMenuItem();
  17523. bool isItemHighlighted() const throw() { return isHighlighted; }
  17524. protected:
  17525. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17526. private:
  17527. friend class PopupMenu;
  17528. friend class PopupMenu::ItemComponent;
  17529. friend class PopupMenu::Window;
  17530. bool isHighlighted, isTriggeredAutomatically;
  17531. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17532. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17533. };
  17534. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17535. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17536. #endif
  17537. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17538. #endif
  17539. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17540. #endif
  17541. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17542. #endif
  17543. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17544. #endif
  17545. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17546. /*** Start of inlined file: juce_LassoComponent.h ***/
  17547. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17548. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17549. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17550. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17551. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17552. template <class SelectableItemType>
  17553. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17554. {
  17555. public:
  17556. SelectedItemSet()
  17557. {
  17558. }
  17559. SelectedItemSet (const Array <SelectableItemType>& items)
  17560. : selectedItems (items)
  17561. {
  17562. }
  17563. SelectedItemSet (const SelectedItemSet& other)
  17564. : selectedItems (other.selectedItems)
  17565. {
  17566. }
  17567. SelectedItemSet& operator= (const SelectedItemSet& other)
  17568. {
  17569. if (selectedItems != other.selectedItems)
  17570. {
  17571. selectedItems = other.selectedItems;
  17572. changed();
  17573. }
  17574. return *this;
  17575. }
  17576. ~SelectedItemSet()
  17577. {
  17578. }
  17579. void selectOnly (SelectableItemType item)
  17580. {
  17581. if (isSelected (item))
  17582. {
  17583. for (int i = selectedItems.size(); --i >= 0;)
  17584. {
  17585. if (selectedItems.getUnchecked(i) != item)
  17586. {
  17587. deselect (selectedItems.getUnchecked(i));
  17588. i = jmin (i, selectedItems.size());
  17589. }
  17590. }
  17591. }
  17592. else
  17593. {
  17594. deselectAll();
  17595. changed();
  17596. selectedItems.add (item);
  17597. itemSelected (item);
  17598. }
  17599. }
  17600. void addToSelection (SelectableItemType item)
  17601. {
  17602. if (! isSelected (item))
  17603. {
  17604. changed();
  17605. selectedItems.add (item);
  17606. itemSelected (item);
  17607. }
  17608. }
  17609. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17610. const ModifierKeys& modifiers)
  17611. {
  17612. if (modifiers.isShiftDown())
  17613. {
  17614. addToSelection (item);
  17615. }
  17616. else if (modifiers.isCommandDown())
  17617. {
  17618. if (isSelected (item))
  17619. deselect (item);
  17620. else
  17621. addToSelection (item);
  17622. }
  17623. else
  17624. {
  17625. selectOnly (item);
  17626. }
  17627. }
  17628. bool addToSelectionOnMouseDown (SelectableItemType item,
  17629. const ModifierKeys& modifiers)
  17630. {
  17631. if (isSelected (item))
  17632. {
  17633. return ! modifiers.isPopupMenu();
  17634. }
  17635. else
  17636. {
  17637. addToSelectionBasedOnModifiers (item, modifiers);
  17638. return false;
  17639. }
  17640. }
  17641. void addToSelectionOnMouseUp (SelectableItemType item,
  17642. const ModifierKeys& modifiers,
  17643. const bool wasItemDragged,
  17644. const bool resultOfMouseDownSelectMethod)
  17645. {
  17646. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17647. addToSelectionBasedOnModifiers (item, modifiers);
  17648. }
  17649. void deselect (SelectableItemType item)
  17650. {
  17651. const int i = selectedItems.indexOf (item);
  17652. if (i >= 0)
  17653. {
  17654. changed();
  17655. itemDeselected (selectedItems.remove (i));
  17656. }
  17657. }
  17658. void deselectAll()
  17659. {
  17660. if (selectedItems.size() > 0)
  17661. {
  17662. changed();
  17663. for (int i = selectedItems.size(); --i >= 0;)
  17664. {
  17665. itemDeselected (selectedItems.remove (i));
  17666. i = jmin (i, selectedItems.size());
  17667. }
  17668. }
  17669. }
  17670. int getNumSelected() const throw()
  17671. {
  17672. return selectedItems.size();
  17673. }
  17674. SelectableItemType getSelectedItem (const int index) const throw()
  17675. {
  17676. return selectedItems [index];
  17677. }
  17678. bool isSelected (const SelectableItemType item) const throw()
  17679. {
  17680. return selectedItems.contains (item);
  17681. }
  17682. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17683. virtual void itemSelected (SelectableItemType item) {}
  17684. virtual void itemDeselected (SelectableItemType item) {}
  17685. void changed (const bool synchronous = false)
  17686. {
  17687. if (synchronous)
  17688. sendSynchronousChangeMessage (this);
  17689. else
  17690. sendChangeMessage (this);
  17691. }
  17692. juce_UseDebuggingNewOperator
  17693. private:
  17694. Array <SelectableItemType> selectedItems;
  17695. };
  17696. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17697. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17698. template <class SelectableItemType>
  17699. class LassoSource
  17700. {
  17701. public:
  17702. virtual ~LassoSource() {}
  17703. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17704. int x, int y, int width, int height) = 0;
  17705. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17706. };
  17707. template <class SelectableItemType>
  17708. class LassoComponent : public Component
  17709. {
  17710. public:
  17711. LassoComponent (const int outlineThickness_ = 1)
  17712. : source (0),
  17713. outlineThickness (outlineThickness_)
  17714. {
  17715. }
  17716. ~LassoComponent()
  17717. {
  17718. }
  17719. void beginLasso (const MouseEvent& e,
  17720. LassoSource <SelectableItemType>* const lassoSource)
  17721. {
  17722. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17723. jassert (lassoSource != 0); // the source can't be null!
  17724. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17725. source = lassoSource;
  17726. if (lassoSource != 0)
  17727. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17728. setSize (0, 0);
  17729. }
  17730. void dragLasso (const MouseEvent& e)
  17731. {
  17732. if (source != 0)
  17733. {
  17734. const int x1 = e.getMouseDownX();
  17735. const int y1 = e.getMouseDownY();
  17736. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17737. setVisible (true);
  17738. Array <SelectableItemType> itemsInLasso;
  17739. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17740. if (e.mods.isShiftDown())
  17741. {
  17742. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17743. itemsInLasso.addArray (originalSelection);
  17744. }
  17745. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17746. {
  17747. Array <SelectableItemType> originalMinusNew (originalSelection);
  17748. originalMinusNew.removeValuesIn (itemsInLasso);
  17749. itemsInLasso.removeValuesIn (originalSelection);
  17750. itemsInLasso.addArray (originalMinusNew);
  17751. }
  17752. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17753. }
  17754. }
  17755. void endLasso()
  17756. {
  17757. source = 0;
  17758. originalSelection.clear();
  17759. setVisible (false);
  17760. }
  17761. enum ColourIds
  17762. {
  17763. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17764. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17765. };
  17766. void paint (Graphics& g)
  17767. {
  17768. g.fillAll (findColour (lassoFillColourId));
  17769. g.setColour (findColour (lassoOutlineColourId));
  17770. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17771. // this suggests that you've left a lasso comp lying around after the
  17772. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17773. // mouse-up event.
  17774. jassert (isMouseButtonDownAnywhere());
  17775. }
  17776. bool hitTest (int x, int y) { return false; }
  17777. juce_UseDebuggingNewOperator
  17778. private:
  17779. Array <SelectableItemType> originalSelection;
  17780. LassoSource <SelectableItemType>* source;
  17781. int outlineThickness;
  17782. };
  17783. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17784. /*** End of inlined file: juce_LassoComponent.h ***/
  17785. #endif
  17786. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17787. #endif
  17788. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17789. #endif
  17790. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17791. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17792. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17793. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17794. class JUCE_API MouseHoverDetector
  17795. {
  17796. public:
  17797. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17798. virtual ~MouseHoverDetector();
  17799. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17800. void setHoverComponent (Component* const newSourceComponent);
  17801. protected:
  17802. virtual void mouseHovered (int mouseX,
  17803. int mouseY) = 0;
  17804. virtual void mouseMovedAfterHover() = 0;
  17805. private:
  17806. class JUCE_API HoverDetectorInternal : public MouseListener,
  17807. public Timer
  17808. {
  17809. public:
  17810. MouseHoverDetector* owner;
  17811. int lastX, lastY;
  17812. void timerCallback();
  17813. void mouseEnter (const MouseEvent&);
  17814. void mouseExit (const MouseEvent&);
  17815. void mouseDown (const MouseEvent&);
  17816. void mouseUp (const MouseEvent&);
  17817. void mouseMove (const MouseEvent&);
  17818. void mouseWheelMove (const MouseEvent&, float, float);
  17819. } internalTimer;
  17820. friend class HoverDetectorInternal;
  17821. Component* source;
  17822. int hoverTimeMillisecs;
  17823. bool hasJustHovered;
  17824. void hoverTimerCallback();
  17825. void checkJustHoveredCallback();
  17826. MouseHoverDetector (const MouseHoverDetector&);
  17827. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17828. };
  17829. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17830. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17831. #endif
  17832. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17833. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17834. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17835. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17836. class Component;
  17837. class ComponentPeer;
  17838. class MouseInputSourceInternal;
  17839. class JUCE_API MouseInputSource
  17840. {
  17841. public:
  17842. MouseInputSource (int index, bool isMouseDevice);
  17843. ~MouseInputSource();
  17844. bool isMouse() const;
  17845. bool isTouch() const;
  17846. bool canHover() const;
  17847. bool hasMouseWheel() const;
  17848. int getIndex() const;
  17849. bool isDragging() const;
  17850. const Point<int> getScreenPosition() const;
  17851. const ModifierKeys getCurrentModifiers() const;
  17852. Component* getComponentUnderMouse() const;
  17853. void triggerFakeMove() const;
  17854. int getNumberOfMultipleClicks() const throw();
  17855. const Time getLastMouseDownTime() const throw();
  17856. const Point<int> getLastMouseDownPosition() const throw();
  17857. bool hasMouseMovedSignificantlySincePressed() const throw();
  17858. bool hasMouseCursor() const throw();
  17859. void showMouseCursor (const MouseCursor& cursor);
  17860. void hideCursor();
  17861. void revealCursor();
  17862. void forceMouseCursorUpdate();
  17863. bool canDoUnboundedMovement() const throw();
  17864. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17865. juce_UseDebuggingNewOperator
  17866. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17867. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17868. private:
  17869. friend class Desktop;
  17870. friend class ComponentPeer;
  17871. friend class MouseInputSourceInternal;
  17872. ScopedPointer<MouseInputSourceInternal> pimpl;
  17873. MouseInputSource (const MouseInputSource&);
  17874. MouseInputSource& operator= (const MouseInputSource&);
  17875. };
  17876. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17877. /*** End of inlined file: juce_MouseInputSource.h ***/
  17878. #endif
  17879. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17880. #endif
  17881. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17882. #endif
  17883. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17884. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17885. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17886. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17887. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17888. private ButtonListener
  17889. {
  17890. protected:
  17891. BooleanPropertyComponent (const String& propertyName,
  17892. const String& buttonTextWhenTrue,
  17893. const String& buttonTextWhenFalse);
  17894. public:
  17895. BooleanPropertyComponent (const Value& valueToControl,
  17896. const String& propertyName,
  17897. const String& buttonText);
  17898. ~BooleanPropertyComponent();
  17899. virtual void setState (const bool newState);
  17900. virtual bool getState() const;
  17901. void paint (Graphics& g);
  17902. void refresh();
  17903. void buttonClicked (Button*);
  17904. juce_UseDebuggingNewOperator
  17905. private:
  17906. ToggleButton* button;
  17907. String onText, offText;
  17908. void createButton();
  17909. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17910. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17911. };
  17912. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17913. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17914. #endif
  17915. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17916. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17917. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17918. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17919. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17920. private ButtonListener
  17921. {
  17922. public:
  17923. ButtonPropertyComponent (const String& propertyName,
  17924. const bool triggerOnMouseDown);
  17925. ~ButtonPropertyComponent();
  17926. virtual void buttonClicked() = 0;
  17927. virtual const String getButtonText() const = 0;
  17928. void refresh();
  17929. void buttonClicked (Button*);
  17930. juce_UseDebuggingNewOperator
  17931. private:
  17932. TextButton* button;
  17933. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17934. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17935. };
  17936. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17937. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17938. #endif
  17939. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17940. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17941. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17942. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17943. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17944. private ComboBoxListener
  17945. {
  17946. protected:
  17947. ChoicePropertyComponent (const String& propertyName);
  17948. public:
  17949. ChoicePropertyComponent (const Value& valueToControl,
  17950. const String& propertyName,
  17951. const StringArray& choices,
  17952. const Array <int>* choiceIDs = 0);
  17953. ~ChoicePropertyComponent();
  17954. virtual void setIndex (const int newIndex);
  17955. virtual int getIndex() const;
  17956. const StringArray& getChoices() const;
  17957. void refresh();
  17958. void comboBoxChanged (ComboBox*);
  17959. juce_UseDebuggingNewOperator
  17960. protected:
  17961. StringArray choices;
  17962. private:
  17963. ComboBox* comboBox;
  17964. void createComboBox (const Array <int>* choiceIDs);
  17965. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17966. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17967. };
  17968. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17969. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17970. #endif
  17971. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17972. #endif
  17973. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17974. #endif
  17975. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17976. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17977. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17978. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17979. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17980. private SliderListener
  17981. {
  17982. protected:
  17983. SliderPropertyComponent (const String& propertyName,
  17984. const double rangeMin,
  17985. const double rangeMax,
  17986. const double interval,
  17987. const double skewFactor = 1.0);
  17988. public:
  17989. SliderPropertyComponent (Value& valueToControl,
  17990. const String& propertyName,
  17991. const double rangeMin,
  17992. const double rangeMax,
  17993. const double interval,
  17994. const double skewFactor = 1.0);
  17995. ~SliderPropertyComponent();
  17996. virtual void setValue (const double newValue);
  17997. virtual const double getValue() const;
  17998. void refresh();
  17999. void changeListenerCallback (void*);
  18000. void sliderValueChanged (Slider*);
  18001. juce_UseDebuggingNewOperator
  18002. protected:
  18003. Slider* slider;
  18004. SliderPropertyComponent (const SliderPropertyComponent&);
  18005. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18006. };
  18007. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18008. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18009. #endif
  18010. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18011. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18012. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18013. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18014. class JUCE_API TextPropertyComponent : public PropertyComponent
  18015. {
  18016. protected:
  18017. TextPropertyComponent (const String& propertyName,
  18018. const int maxNumChars,
  18019. const bool isMultiLine);
  18020. public:
  18021. TextPropertyComponent (const Value& valueToControl,
  18022. const String& propertyName,
  18023. const int maxNumChars,
  18024. const bool isMultiLine);
  18025. ~TextPropertyComponent();
  18026. virtual void setText (const String& newText);
  18027. virtual const String getText() const;
  18028. void refresh();
  18029. void textWasEdited();
  18030. juce_UseDebuggingNewOperator
  18031. private:
  18032. Label* textEditor;
  18033. void createEditor (const int maxNumChars, const bool isMultiLine);
  18034. TextPropertyComponent (const TextPropertyComponent&);
  18035. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18036. };
  18037. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18038. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18039. #endif
  18040. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18041. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18042. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18043. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18044. #if JUCE_WINDOWS || DOXYGEN
  18045. class JUCE_API ActiveXControlComponent : public Component
  18046. {
  18047. public:
  18048. ActiveXControlComponent();
  18049. ~ActiveXControlComponent();
  18050. bool createControl (const void* controlIID);
  18051. void deleteControl();
  18052. bool isControlOpen() const throw() { return control != 0; }
  18053. void* queryInterface (const void* iid) const;
  18054. void setMouseEventsAllowed (const bool eventsCanReachControl);
  18055. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18056. void paint (Graphics& g);
  18057. void* originalWndProc;
  18058. juce_UseDebuggingNewOperator
  18059. private:
  18060. class ActiveXControlData;
  18061. friend class ActiveXControlData;
  18062. void* control;
  18063. bool mouseEventsAllowed;
  18064. ActiveXControlComponent (const ActiveXControlComponent&);
  18065. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18066. void setControlBounds (const Rectangle<int>& bounds) const;
  18067. void setControlVisible (const bool b) const;
  18068. };
  18069. #endif
  18070. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18071. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18072. #endif
  18073. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18074. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18075. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18076. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18077. class MidiInputSelectorComponentListBox;
  18078. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18079. public ComboBoxListener,
  18080. public ButtonListener,
  18081. public ChangeListener
  18082. {
  18083. public:
  18084. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18085. const int minAudioInputChannels,
  18086. const int maxAudioInputChannels,
  18087. const int minAudioOutputChannels,
  18088. const int maxAudioOutputChannels,
  18089. const bool showMidiInputOptions,
  18090. const bool showMidiOutputSelector,
  18091. const bool showChannelsAsStereoPairs,
  18092. const bool hideAdvancedOptionsWithButton);
  18093. ~AudioDeviceSelectorComponent();
  18094. void resized();
  18095. void comboBoxChanged (ComboBox*);
  18096. void buttonClicked (Button*);
  18097. void changeListenerCallback (void*);
  18098. void childBoundsChanged (Component*);
  18099. juce_UseDebuggingNewOperator
  18100. private:
  18101. AudioDeviceManager& deviceManager;
  18102. ComboBox* deviceTypeDropDown;
  18103. Label* deviceTypeDropDownLabel;
  18104. Component* audioDeviceSettingsComp;
  18105. String audioDeviceSettingsCompType;
  18106. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18107. const bool showChannelsAsStereoPairs;
  18108. const bool hideAdvancedOptionsWithButton;
  18109. MidiInputSelectorComponentListBox* midiInputsList;
  18110. Label* midiInputsLabel;
  18111. ComboBox* midiOutputSelector;
  18112. Label* midiOutputLabel;
  18113. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18114. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18115. };
  18116. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18117. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18118. #endif
  18119. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18120. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18121. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18122. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18123. class JUCE_API BubbleComponent : public Component
  18124. {
  18125. protected:
  18126. BubbleComponent();
  18127. public:
  18128. ~BubbleComponent();
  18129. enum BubblePlacement
  18130. {
  18131. above = 1,
  18132. below = 2,
  18133. left = 4,
  18134. right = 8
  18135. };
  18136. void setAllowedPlacement (const int newPlacement);
  18137. void setPosition (Component* componentToPointTo);
  18138. void setPosition (const int arrowTipX,
  18139. const int arrowTipY);
  18140. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18141. protected:
  18142. virtual void getContentSize (int& width, int& height) = 0;
  18143. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18144. public:
  18145. void paint (Graphics& g);
  18146. juce_UseDebuggingNewOperator
  18147. private:
  18148. Rectangle<int> content;
  18149. int side, allowablePlacements;
  18150. float arrowTipX, arrowTipY;
  18151. DropShadowEffect shadow;
  18152. BubbleComponent (const BubbleComponent&);
  18153. BubbleComponent& operator= (const BubbleComponent&);
  18154. };
  18155. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18156. /*** End of inlined file: juce_BubbleComponent.h ***/
  18157. #endif
  18158. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18159. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18160. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18161. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18162. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18163. private Timer
  18164. {
  18165. public:
  18166. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  18167. ~BubbleMessageComponent();
  18168. void showAt (int x, int y,
  18169. const String& message,
  18170. const int numMillisecondsBeforeRemoving,
  18171. const bool removeWhenMouseClicked = true,
  18172. const bool deleteSelfAfterUse = false);
  18173. void showAt (Component* const component,
  18174. const String& message,
  18175. const int numMillisecondsBeforeRemoving,
  18176. const bool removeWhenMouseClicked = true,
  18177. const bool deleteSelfAfterUse = false);
  18178. void getContentSize (int& w, int& h);
  18179. void paintContent (Graphics& g, int w, int h);
  18180. void timerCallback();
  18181. juce_UseDebuggingNewOperator
  18182. private:
  18183. int fadeOutLength, mouseClickCounter;
  18184. TextLayout textLayout;
  18185. int64 expiryTime;
  18186. bool deleteAfterUse;
  18187. void init (const int numMillisecondsBeforeRemoving,
  18188. const bool removeWhenMouseClicked,
  18189. const bool deleteSelfAfterUse);
  18190. BubbleMessageComponent (const BubbleMessageComponent&);
  18191. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18192. };
  18193. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18194. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18195. #endif
  18196. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18197. /*** Start of inlined file: juce_ColourSelector.h ***/
  18198. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18199. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18200. class JUCE_API ColourSelector : public Component,
  18201. public ChangeBroadcaster,
  18202. protected SliderListener
  18203. {
  18204. public:
  18205. enum ColourSelectorOptions
  18206. {
  18207. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18208. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18209. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18210. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18211. };
  18212. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18213. const int edgeGap = 4,
  18214. const int gapAroundColourSpaceComponent = 7);
  18215. ~ColourSelector();
  18216. const Colour getCurrentColour() const;
  18217. void setCurrentColour (const Colour& newColour);
  18218. virtual int getNumSwatches() const;
  18219. virtual const Colour getSwatchColour (const int index) const;
  18220. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  18221. enum ColourIds
  18222. {
  18223. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18224. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18225. };
  18226. juce_UseDebuggingNewOperator
  18227. private:
  18228. friend class ColourSpaceView;
  18229. friend class HueSelectorComp;
  18230. Colour colour;
  18231. float h, s, v;
  18232. Slider* sliders[4];
  18233. Component* colourSpace;
  18234. Component* hueSelector;
  18235. class SwatchComponent;
  18236. OwnedArray <SwatchComponent> swatchComponents;
  18237. const int flags;
  18238. int topSpace, edgeGap;
  18239. void setHue (float newH);
  18240. void setSV (float newS, float newV);
  18241. void updateHSV();
  18242. void update();
  18243. void sliderValueChanged (Slider*);
  18244. void paint (Graphics& g);
  18245. void resized();
  18246. ColourSelector (const ColourSelector&);
  18247. ColourSelector& operator= (const ColourSelector&);
  18248. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18249. // have changed - if you get an error here, update your code to use the new constructor instead..
  18250. // (xxx - note to self: remember to remove this at some point in the future)
  18251. ColourSelector (const bool);
  18252. };
  18253. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18254. /*** End of inlined file: juce_ColourSelector.h ***/
  18255. #endif
  18256. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18257. #endif
  18258. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18259. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18260. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18261. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18262. class JUCE_API MagnifierComponent : public Component
  18263. {
  18264. public:
  18265. MagnifierComponent (Component* const contentComponent,
  18266. const bool deleteContentCompWhenNoLongerNeeded);
  18267. ~MagnifierComponent();
  18268. Component* getContentComponent() const { return content; }
  18269. void setScaleFactor (double newScaleFactor);
  18270. double getScaleFactor() const { return scaleFactor; }
  18271. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18272. juce_UseDebuggingNewOperator
  18273. void childBoundsChanged (Component*);
  18274. private:
  18275. Component* content;
  18276. Component* holderComp;
  18277. double scaleFactor;
  18278. ComponentPeer* peer;
  18279. bool deleteContent;
  18280. Graphics::ResamplingQuality quality;
  18281. MouseInputSource mouseSource;
  18282. void paint (Graphics& g);
  18283. void mouseDown (const MouseEvent& e);
  18284. void mouseUp (const MouseEvent& e);
  18285. void mouseDrag (const MouseEvent& e);
  18286. void mouseMove (const MouseEvent& e);
  18287. void mouseEnter (const MouseEvent& e);
  18288. void mouseExit (const MouseEvent& e);
  18289. void mouseWheelMove (const MouseEvent& e, float, float);
  18290. void passOnMouseEventToPeer (const MouseEvent& e);
  18291. int scaleInt (const int n) const;
  18292. MagnifierComponent (const MagnifierComponent&);
  18293. MagnifierComponent& operator= (const MagnifierComponent&);
  18294. };
  18295. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18296. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18297. #endif
  18298. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18299. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18300. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18301. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18302. class JUCE_API MidiKeyboardComponent : public Component,
  18303. public MidiKeyboardStateListener,
  18304. public ChangeBroadcaster,
  18305. private Timer,
  18306. private AsyncUpdater
  18307. {
  18308. public:
  18309. enum Orientation
  18310. {
  18311. horizontalKeyboard,
  18312. verticalKeyboardFacingLeft,
  18313. verticalKeyboardFacingRight,
  18314. };
  18315. MidiKeyboardComponent (MidiKeyboardState& state,
  18316. const Orientation orientation);
  18317. ~MidiKeyboardComponent();
  18318. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18319. void setMidiChannel (const int midiChannelNumber);
  18320. int getMidiChannel() const throw() { return midiChannel; }
  18321. void setMidiChannelsToDisplay (const int midiChannelMask);
  18322. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18323. void setKeyWidth (const float widthInPixels);
  18324. float getKeyWidth() const throw() { return keyWidth; }
  18325. void setOrientation (const Orientation newOrientation);
  18326. const Orientation getOrientation() const throw() { return orientation; }
  18327. void setAvailableRange (const int lowestNote,
  18328. const int highestNote);
  18329. int getRangeStart() const throw() { return rangeStart; }
  18330. int getRangeEnd() const throw() { return rangeEnd; }
  18331. void setLowestVisibleKey (int noteNumber);
  18332. int getLowestVisibleKey() const throw() { return firstKey; }
  18333. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18334. void setScrollButtonsVisible (const bool canScroll);
  18335. enum ColourIds
  18336. {
  18337. whiteNoteColourId = 0x1005000,
  18338. blackNoteColourId = 0x1005001,
  18339. keySeparatorLineColourId = 0x1005002,
  18340. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18341. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18342. textLabelColourId = 0x1005005,
  18343. upDownButtonBackgroundColourId = 0x1005006,
  18344. upDownButtonArrowColourId = 0x1005007
  18345. };
  18346. int getKeyStartPosition (const int midiNoteNumber) const;
  18347. void clearKeyMappings();
  18348. void setKeyPressForNote (const KeyPress& key,
  18349. const int midiNoteOffsetFromC);
  18350. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18351. void setKeyPressBaseOctave (const int newOctaveNumber);
  18352. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18353. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18354. void paint (Graphics& g);
  18355. void resized();
  18356. void mouseMove (const MouseEvent& e);
  18357. void mouseDrag (const MouseEvent& e);
  18358. void mouseDown (const MouseEvent& e);
  18359. void mouseUp (const MouseEvent& e);
  18360. void mouseEnter (const MouseEvent& e);
  18361. void mouseExit (const MouseEvent& e);
  18362. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18363. void timerCallback();
  18364. bool keyStateChanged (const bool isKeyDown);
  18365. void focusLost (FocusChangeType cause);
  18366. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18367. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18368. void handleAsyncUpdate();
  18369. void colourChanged();
  18370. juce_UseDebuggingNewOperator
  18371. protected:
  18372. friend class MidiKeyboardUpDownButton;
  18373. virtual void drawWhiteNote (int midiNoteNumber,
  18374. Graphics& g,
  18375. int x, int y, int w, int h,
  18376. bool isDown, bool isOver,
  18377. const Colour& lineColour,
  18378. const Colour& textColour);
  18379. virtual void drawBlackNote (int midiNoteNumber,
  18380. Graphics& g,
  18381. int x, int y, int w, int h,
  18382. bool isDown, bool isOver,
  18383. const Colour& noteFillColour);
  18384. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18385. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18386. const bool isMouseOver,
  18387. const bool isButtonPressed,
  18388. const bool movesOctavesUp);
  18389. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18390. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18391. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18392. int& x, int& w) const;
  18393. private:
  18394. MidiKeyboardState& state;
  18395. int xOffset, blackNoteLength;
  18396. float keyWidth;
  18397. Orientation orientation;
  18398. int midiChannel, midiInChannelMask;
  18399. float velocity;
  18400. int noteUnderMouse, mouseDownNote;
  18401. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18402. int rangeStart, rangeEnd, firstKey;
  18403. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18404. Button* scrollDown;
  18405. Button* scrollUp;
  18406. Array <KeyPress> keyPresses;
  18407. Array <int> keyPressNotes;
  18408. int keyMappingOctave;
  18409. int octaveNumForMiddleC;
  18410. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18411. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18412. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18413. void resetAnyKeysInUse();
  18414. void updateNoteUnderMouse (const Point<int>& pos);
  18415. void repaintNote (const int midiNoteNumber);
  18416. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18417. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18418. };
  18419. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18420. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18421. #endif
  18422. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18423. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18424. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18425. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18426. #if ! DOXYGEN
  18427. class NSViewComponentInternal;
  18428. #endif
  18429. #if JUCE_MAC || DOXYGEN
  18430. class JUCE_API NSViewComponent : public Component
  18431. {
  18432. public:
  18433. NSViewComponent();
  18434. ~NSViewComponent();
  18435. void setView (void* nsView);
  18436. void* getView() const;
  18437. void paint (Graphics& g);
  18438. juce_UseDebuggingNewOperator
  18439. private:
  18440. friend class NSViewComponentInternal;
  18441. ScopedPointer <NSViewComponentInternal> info;
  18442. NSViewComponent (const NSViewComponent&);
  18443. NSViewComponent& operator= (const NSViewComponent&);
  18444. };
  18445. #endif
  18446. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18447. /*** End of inlined file: juce_NSViewComponent.h ***/
  18448. #endif
  18449. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18450. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18451. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18452. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18453. // this is used to disable OpenGL, and is defined in juce_Config.h
  18454. #if JUCE_OPENGL || DOXYGEN
  18455. class JUCE_API OpenGLPixelFormat
  18456. {
  18457. public:
  18458. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18459. const int alphaBits = 8,
  18460. const int depthBufferBits = 16,
  18461. const int stencilBufferBits = 0);
  18462. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18463. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18464. bool operator== (const OpenGLPixelFormat&) const;
  18465. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18466. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18467. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18468. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18469. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18470. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18471. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18472. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18473. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18474. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18475. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18476. static void getAvailablePixelFormats (Component* component,
  18477. OwnedArray <OpenGLPixelFormat>& results);
  18478. juce_UseDebuggingNewOperator
  18479. };
  18480. class JUCE_API OpenGLContext
  18481. {
  18482. public:
  18483. virtual ~OpenGLContext();
  18484. virtual bool makeActive() const throw() = 0;
  18485. virtual bool makeInactive() const throw() = 0;
  18486. virtual bool isActive() const throw() = 0;
  18487. virtual void swapBuffers() = 0;
  18488. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18489. virtual int getSwapInterval() const = 0;
  18490. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18491. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18492. virtual void repaint() = 0;
  18493. virtual void* getRawContext() const throw() = 0;
  18494. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18495. const OpenGLPixelFormat& pixelFormat,
  18496. const OpenGLContext* const contextToShareWith);
  18497. static OpenGLContext* getCurrentContext();
  18498. juce_UseDebuggingNewOperator
  18499. protected:
  18500. OpenGLContext() throw();
  18501. };
  18502. class JUCE_API OpenGLComponent : public Component
  18503. {
  18504. public:
  18505. OpenGLComponent();
  18506. ~OpenGLComponent();
  18507. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18508. const OpenGLPixelFormat getPixelFormat() const;
  18509. void shareWith (OpenGLContext* contextToShareListsWith);
  18510. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18511. void swapBuffers();
  18512. virtual void renderOpenGL() = 0;
  18513. virtual void newOpenGLContextCreated() = 0;
  18514. OpenGLContext* getCurrentContext() const throw() { return context; }
  18515. bool makeCurrentContextActive();
  18516. void makeCurrentContextInactive();
  18517. bool isActiveContext() const throw();
  18518. virtual bool renderAndSwapBuffers();
  18519. CriticalSection& getContextLock() throw() { return contextLock; }
  18520. void paint (Graphics& g);
  18521. void* getNativeWindowHandle() const;
  18522. juce_UseDebuggingNewOperator
  18523. private:
  18524. class OpenGLComponentWatcher;
  18525. friend class OpenGLComponentWatcher;
  18526. friend class ScopedPointer <OpenGLComponentWatcher>;
  18527. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18528. OpenGLContext* context;
  18529. OpenGLContext* contextToShareListsWith;
  18530. CriticalSection contextLock;
  18531. OpenGLPixelFormat preferredPixelFormat;
  18532. bool needToUpdateViewport;
  18533. void deleteContext();
  18534. void updateContextPosition();
  18535. void internalRepaint (int x, int y, int w, int h);
  18536. OpenGLComponent (const OpenGLComponent&);
  18537. OpenGLComponent& operator= (const OpenGLComponent&);
  18538. };
  18539. #endif
  18540. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18541. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18542. #endif
  18543. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18544. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18545. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18546. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18547. class JUCE_API PreferencesPanel : public Component,
  18548. private ButtonListener
  18549. {
  18550. public:
  18551. PreferencesPanel();
  18552. ~PreferencesPanel();
  18553. void addSettingsPage (const String& pageTitle,
  18554. const Drawable* normalIcon,
  18555. const Drawable* overIcon,
  18556. const Drawable* downIcon);
  18557. void addSettingsPage (const String& pageTitle,
  18558. const char* imageData,
  18559. const int imageDataSize);
  18560. void showInDialogBox (const String& dialogtitle,
  18561. int dialogWidth,
  18562. int dialogHeight,
  18563. const Colour& backgroundColour = Colours::white);
  18564. virtual Component* createComponentForPage (const String& pageName) = 0;
  18565. void setCurrentPage (const String& pageName);
  18566. void resized();
  18567. void paint (Graphics& g);
  18568. void buttonClicked (Button* button);
  18569. juce_UseDebuggingNewOperator
  18570. private:
  18571. String currentPageName;
  18572. ScopedPointer <Component> currentPage;
  18573. int buttonSize;
  18574. PreferencesPanel (const PreferencesPanel&);
  18575. PreferencesPanel& operator= (const PreferencesPanel&);
  18576. };
  18577. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18578. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18579. #endif
  18580. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18581. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18582. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18583. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18584. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18585. // amalgamated build)
  18586. #if JUCE_WINDOWS
  18587. typedef ActiveXControlComponent QTCompBaseClass;
  18588. #elif JUCE_MAC
  18589. typedef NSViewComponent QTCompBaseClass;
  18590. #endif
  18591. // this is used to disable QuickTime, and is defined in juce_Config.h
  18592. #if JUCE_QUICKTIME || DOXYGEN
  18593. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18594. {
  18595. public:
  18596. QuickTimeMovieComponent();
  18597. ~QuickTimeMovieComponent();
  18598. static bool isQuickTimeAvailable() throw();
  18599. bool loadMovie (const File& movieFile,
  18600. const bool isControllerVisible);
  18601. bool loadMovie (const URL& movieURL,
  18602. const bool isControllerVisible);
  18603. bool loadMovie (InputStream* movieStream,
  18604. const bool isControllerVisible);
  18605. void closeMovie();
  18606. const File getCurrentMovieFile() const;
  18607. bool isMovieOpen() const;
  18608. double getMovieDuration() const;
  18609. void getMovieNormalSize (int& width, int& height) const;
  18610. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18611. const RectanglePlacement& placement);
  18612. void play();
  18613. void stop();
  18614. bool isPlaying() const;
  18615. void goToStart();
  18616. void setPosition (const double seconds);
  18617. double getPosition() const;
  18618. void setSpeed (const float newSpeed);
  18619. void setMovieVolume (const float newVolume);
  18620. float getMovieVolume() const;
  18621. void setLooping (const bool shouldLoop);
  18622. bool isLooping() const;
  18623. bool isControllerVisible() const;
  18624. void paint (Graphics& g);
  18625. juce_UseDebuggingNewOperator
  18626. private:
  18627. File movieFile;
  18628. bool movieLoaded, controllerVisible, looping;
  18629. #if JUCE_WINDOWS
  18630. void parentHierarchyChanged();
  18631. void visibilityChanged();
  18632. void createControlIfNeeded();
  18633. bool isControlCreated() const;
  18634. class Pimpl;
  18635. friend class ScopedPointer <Pimpl>;
  18636. ScopedPointer <Pimpl> pimpl;
  18637. #else
  18638. void* movie;
  18639. #endif
  18640. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18641. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18642. };
  18643. #endif
  18644. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18645. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18646. #endif
  18647. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18648. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18649. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18650. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18651. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18652. class JUCE_API SystemTrayIconComponent : public Component
  18653. {
  18654. public:
  18655. SystemTrayIconComponent();
  18656. ~SystemTrayIconComponent();
  18657. void setIconImage (const Image& newImage);
  18658. void setIconTooltip (const String& tooltip);
  18659. #if JUCE_LINUX
  18660. void paint (Graphics& g);
  18661. #endif
  18662. juce_UseDebuggingNewOperator
  18663. private:
  18664. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18665. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18666. };
  18667. #endif
  18668. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18669. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18670. #endif
  18671. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18672. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18673. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18674. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18675. #if JUCE_WEB_BROWSER || DOXYGEN
  18676. #if ! DOXYGEN
  18677. class WebBrowserComponentInternal;
  18678. #endif
  18679. class JUCE_API WebBrowserComponent : public Component
  18680. {
  18681. public:
  18682. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18683. ~WebBrowserComponent();
  18684. void goToURL (const String& url,
  18685. const StringArray* headers = 0,
  18686. const MemoryBlock* postData = 0);
  18687. void stop();
  18688. void goBack();
  18689. void goForward();
  18690. void refresh();
  18691. virtual bool pageAboutToLoad (const String& newURL);
  18692. void paint (Graphics& g);
  18693. void resized();
  18694. void parentHierarchyChanged();
  18695. void visibilityChanged();
  18696. juce_UseDebuggingNewOperator
  18697. private:
  18698. WebBrowserComponentInternal* browser;
  18699. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18700. String lastURL;
  18701. StringArray lastHeaders;
  18702. MemoryBlock lastPostData;
  18703. void reloadLastURL();
  18704. void checkWindowAssociation();
  18705. WebBrowserComponent (const WebBrowserComponent&);
  18706. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18707. };
  18708. #endif
  18709. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18710. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18711. #endif
  18712. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18713. #endif
  18714. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18715. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18716. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18717. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18718. class ComponentBoundsConstrainer;
  18719. class JUCE_API ComponentPeer
  18720. {
  18721. public:
  18722. enum StyleFlags
  18723. {
  18724. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18725. entry on the taskbar (ignored on MacOSX) */
  18726. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18727. tooltip, etc. */
  18728. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18729. through it (may not be possible on some platforms). */
  18730. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18731. title bar and frame\. if not specified, the window will be
  18732. borderless. */
  18733. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18734. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18735. minimise button on it. */
  18736. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18737. maximise button on it. */
  18738. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18739. close button on it. */
  18740. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18741. not be possible on all platforms). */
  18742. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18743. do its own repainting, but only to repaint when the
  18744. performAnyPendingRepaintsNow() method is called. */
  18745. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18746. be used for things like plugin windows, to stop them interfering
  18747. with the host's shortcut keys */
  18748. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18749. };
  18750. ComponentPeer (Component* const component,
  18751. const int styleFlags) throw();
  18752. virtual ~ComponentPeer();
  18753. Component* getComponent() const throw() { return component; }
  18754. int getStyleFlags() const throw() { return styleFlags; }
  18755. virtual void* getNativeHandle() const = 0;
  18756. virtual void setVisible (bool shouldBeVisible) = 0;
  18757. virtual void setTitle (const String& title) = 0;
  18758. virtual void setPosition (int x, int y) = 0;
  18759. virtual void setSize (int w, int h) = 0;
  18760. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  18761. virtual const Rectangle<int> getBounds() const = 0;
  18762. virtual const Point<int> getScreenPosition() const = 0;
  18763. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18764. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18765. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18766. virtual bool isMinimised() const = 0;
  18767. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18768. virtual bool isFullScreen() const = 0;
  18769. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18770. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18771. virtual void setIcon (const Image& newIcon) = 0;
  18772. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  18773. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18774. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18775. virtual const BorderSize getFrameSize() const = 0;
  18776. void handleMovedOrResized();
  18777. void handleScreenSizeChange();
  18778. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18779. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18780. virtual void toFront (bool makeActive) = 0;
  18781. virtual void toBehind (ComponentPeer* other) = 0;
  18782. void handleBroughtToFront();
  18783. virtual bool isFocused() const = 0;
  18784. virtual void grabFocus() = 0;
  18785. virtual void textInputRequired (const Point<int>& position) = 0;
  18786. void handleFocusGain();
  18787. void handleFocusLoss();
  18788. Component* getLastFocusedSubcomponent() const throw();
  18789. bool handleKeyPress (const int keyCode,
  18790. const juce_wchar textCharacter);
  18791. bool handleKeyUpOrDown (const bool isKeyDown);
  18792. void handleModifierKeysChange();
  18793. TextInputTarget* findCurrentTextInputTarget();
  18794. virtual void repaint (int x, int y, int w, int h) = 0;
  18795. virtual void performAnyPendingRepaintsNow() = 0;
  18796. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, const int64 time);
  18797. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, const int64 time, float x, float y);
  18798. void handleUserClosingWindow();
  18799. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18800. void handleFileDragExit (const StringArray& files);
  18801. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18802. void clearMaskedRegion() throw();
  18803. void addMaskedRegion (int x, int y, int w, int h) throw();
  18804. static int getNumPeers() throw();
  18805. static ComponentPeer* getPeer (const int index) throw();
  18806. static bool isValidPeer (const ComponentPeer* const peer) throw();
  18807. static void bringModalComponentToFront();
  18808. virtual const StringArray getAvailableRenderingEngines() throw();
  18809. virtual int getCurrentRenderingEngine() throw();
  18810. virtual void setCurrentRenderingEngine (int index) throw();
  18811. juce_UseDebuggingNewOperator
  18812. protected:
  18813. Component* const component;
  18814. const int styleFlags;
  18815. RectangleList maskedRegion;
  18816. Rectangle<int> lastNonFullscreenBounds;
  18817. uint32 lastPaintTime;
  18818. ComponentBoundsConstrainer* constrainer;
  18819. static void updateCurrentModifiers() throw();
  18820. private:
  18821. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  18822. Component* lastDragAndDropCompUnderMouse;
  18823. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18824. friend class Component;
  18825. static ComponentPeer* getPeerFor (const Component* const component) throw();
  18826. void setLastDragDropTarget (Component* comp);
  18827. ComponentPeer (const ComponentPeer&);
  18828. ComponentPeer& operator= (const ComponentPeer&);
  18829. };
  18830. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18831. /*** End of inlined file: juce_ComponentPeer.h ***/
  18832. #endif
  18833. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18834. /*** Start of inlined file: juce_DialogWindow.h ***/
  18835. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18836. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18837. class JUCE_API DialogWindow : public DocumentWindow
  18838. {
  18839. public:
  18840. DialogWindow (const String& name,
  18841. const Colour& backgroundColour,
  18842. const bool escapeKeyTriggersCloseButton,
  18843. const bool addToDesktop = true);
  18844. ~DialogWindow();
  18845. static int showModalDialog (const String& dialogTitle,
  18846. Component* contentComponent,
  18847. Component* componentToCentreAround,
  18848. const Colour& backgroundColour,
  18849. const bool escapeKeyTriggersCloseButton,
  18850. const bool shouldBeResizable = false,
  18851. const bool useBottomRightCornerResizer = false);
  18852. juce_UseDebuggingNewOperator
  18853. protected:
  18854. void resized();
  18855. private:
  18856. bool escapeKeyTriggersCloseButton;
  18857. DialogWindow (const DialogWindow&);
  18858. DialogWindow& operator= (const DialogWindow&);
  18859. };
  18860. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18861. /*** End of inlined file: juce_DialogWindow.h ***/
  18862. #endif
  18863. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18864. #endif
  18865. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18866. #endif
  18867. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18868. /*** Start of inlined file: juce_SplashScreen.h ***/
  18869. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18870. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18871. class JUCE_API SplashScreen : public Component,
  18872. public Timer,
  18873. private DeletedAtShutdown
  18874. {
  18875. public:
  18876. SplashScreen();
  18877. ~SplashScreen();
  18878. void show (const String& title,
  18879. Image* const backgroundImage,
  18880. const int minimumTimeToDisplayFor,
  18881. const bool useDropShadow,
  18882. const bool removeOnMouseClick = true);
  18883. void show (const String& title,
  18884. const int width,
  18885. const int height,
  18886. const int minimumTimeToDisplayFor,
  18887. const bool useDropShadow,
  18888. const bool removeOnMouseClick = true);
  18889. void paint (Graphics& g);
  18890. void timerCallback();
  18891. juce_UseDebuggingNewOperator
  18892. private:
  18893. Image* backgroundImage;
  18894. Time earliestTimeToDelete;
  18895. int originalClickCounter;
  18896. SplashScreen (const SplashScreen&);
  18897. SplashScreen& operator= (const SplashScreen&);
  18898. };
  18899. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18900. /*** End of inlined file: juce_SplashScreen.h ***/
  18901. #endif
  18902. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18903. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18904. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18905. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18906. class JUCE_API ThreadWithProgressWindow : public Thread,
  18907. private Timer
  18908. {
  18909. public:
  18910. ThreadWithProgressWindow (const String& windowTitle,
  18911. const bool hasProgressBar,
  18912. const bool hasCancelButton,
  18913. const int timeOutMsWhenCancelling = 10000,
  18914. const String& cancelButtonText = JUCE_T("Cancel"));
  18915. ~ThreadWithProgressWindow();
  18916. bool runThread (const int threadPriority = 5);
  18917. void setProgress (const double newProgress);
  18918. void setStatusMessage (const String& newStatusMessage);
  18919. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18920. juce_UseDebuggingNewOperator
  18921. private:
  18922. void timerCallback();
  18923. double progress;
  18924. ScopedPointer <AlertWindow> alertWindow;
  18925. String message;
  18926. CriticalSection messageLock;
  18927. const int timeOutMsWhenCancelling;
  18928. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18929. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18930. };
  18931. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18932. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18933. #endif
  18934. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18935. #endif
  18936. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18937. #endif
  18938. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18939. #endif
  18940. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18941. #endif
  18942. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18943. #endif
  18944. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18945. #endif
  18946. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18947. #endif
  18948. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18949. #endif
  18950. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18951. #endif
  18952. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18953. #endif
  18954. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18955. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18956. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18957. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18958. class JUCE_API LowLevelGraphicsContext
  18959. {
  18960. protected:
  18961. LowLevelGraphicsContext();
  18962. public:
  18963. virtual ~LowLevelGraphicsContext();
  18964. virtual bool isVectorDevice() const = 0;
  18965. virtual void setOrigin (int x, int y) = 0;
  18966. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18967. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18968. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18969. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18970. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18971. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18972. virtual const Rectangle<int> getClipBounds() const = 0;
  18973. virtual bool isClipEmpty() const = 0;
  18974. virtual void saveState() = 0;
  18975. virtual void restoreState() = 0;
  18976. virtual void setFill (const FillType& fillType) = 0;
  18977. virtual void setOpacity (float newOpacity) = 0;
  18978. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18979. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18980. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18981. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18982. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18983. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18984. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18985. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18986. virtual void setFont (const Font& newFont) = 0;
  18987. virtual const Font getFont() = 0;
  18988. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18989. };
  18990. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18991. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18992. #endif
  18993. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18994. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18995. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18996. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18997. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18998. {
  18999. public:
  19000. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19001. const String& documentTitle,
  19002. const int totalWidth,
  19003. const int totalHeight);
  19004. ~LowLevelGraphicsPostScriptRenderer();
  19005. bool isVectorDevice() const;
  19006. void setOrigin (int x, int y);
  19007. bool clipToRectangle (const Rectangle<int>& r);
  19008. bool clipToRectangleList (const RectangleList& clipRegion);
  19009. void excludeClipRectangle (const Rectangle<int>& r);
  19010. void clipToPath (const Path& path, const AffineTransform& transform);
  19011. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19012. void saveState();
  19013. void restoreState();
  19014. bool clipRegionIntersects (const Rectangle<int>& r);
  19015. const Rectangle<int> getClipBounds() const;
  19016. bool isClipEmpty() const;
  19017. void setFill (const FillType& fillType);
  19018. void setOpacity (float opacity);
  19019. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19020. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  19021. void fillPath (const Path& path, const AffineTransform& transform);
  19022. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19023. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  19024. void drawLine (double x1, double y1, double x2, double y2);
  19025. void drawVerticalLine (const int x, double top, double bottom);
  19026. void drawHorizontalLine (const int x, double top, double bottom);
  19027. const Font getFont();
  19028. void setFont (const Font& newFont);
  19029. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19030. juce_UseDebuggingNewOperator
  19031. protected:
  19032. OutputStream& out;
  19033. int totalWidth, totalHeight;
  19034. bool needToClip;
  19035. Colour lastColour;
  19036. struct SavedState
  19037. {
  19038. SavedState();
  19039. ~SavedState();
  19040. RectangleList clip;
  19041. int xOffset, yOffset;
  19042. FillType fillType;
  19043. Font font;
  19044. private:
  19045. SavedState& operator= (const SavedState&);
  19046. };
  19047. OwnedArray <SavedState> stateStack;
  19048. void writeClip();
  19049. void writeColour (const Colour& colour);
  19050. void writePath (const Path& path) const;
  19051. void writeXY (const float x, const float y) const;
  19052. void writeTransform (const AffineTransform& trans) const;
  19053. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  19054. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19055. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19056. };
  19057. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19058. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19059. #endif
  19060. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19061. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19062. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19063. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19064. class LLGCSavedState;
  19065. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19066. {
  19067. public:
  19068. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19069. ~LowLevelGraphicsSoftwareRenderer();
  19070. bool isVectorDevice() const;
  19071. void setOrigin (int x, int y);
  19072. bool clipToRectangle (const Rectangle<int>& r);
  19073. bool clipToRectangleList (const RectangleList& clipRegion);
  19074. void excludeClipRectangle (const Rectangle<int>& r);
  19075. void clipToPath (const Path& path, const AffineTransform& transform);
  19076. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19077. bool clipRegionIntersects (const Rectangle<int>& r);
  19078. const Rectangle<int> getClipBounds() const;
  19079. bool isClipEmpty() const;
  19080. void saveState();
  19081. void restoreState();
  19082. void setFill (const FillType& fillType);
  19083. void setOpacity (float opacity);
  19084. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19085. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  19086. void fillPath (const Path& path, const AffineTransform& transform);
  19087. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19088. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  19089. void drawLine (double x1, double y1, double x2, double y2);
  19090. void drawVerticalLine (const int x, double top, double bottom);
  19091. void drawHorizontalLine (const int x, double top, double bottom);
  19092. void setFont (const Font& newFont);
  19093. const Font getFont();
  19094. void drawGlyph (int glyphNumber, float x, float y);
  19095. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19096. juce_UseDebuggingNewOperator
  19097. protected:
  19098. Image& image;
  19099. ScopedPointer <LLGCSavedState> currentState;
  19100. OwnedArray <LLGCSavedState> stateStack;
  19101. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19102. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19103. };
  19104. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19105. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19106. #endif
  19107. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19108. #endif
  19109. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19110. #endif
  19111. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19112. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19113. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19114. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19115. class JUCE_API DrawableComposite : public Drawable
  19116. {
  19117. public:
  19118. DrawableComposite();
  19119. virtual ~DrawableComposite();
  19120. void insertDrawable (Drawable* drawable,
  19121. const AffineTransform& transform = AffineTransform::identity,
  19122. const int index = -1);
  19123. void insertDrawable (const Drawable& drawable,
  19124. const AffineTransform& transform = AffineTransform::identity,
  19125. const int index = -1);
  19126. void removeDrawable (const int index, const bool deleteDrawable = true);
  19127. int getNumDrawables() const throw() { return drawables.size(); }
  19128. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  19129. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  19130. void bringToFront (const int index);
  19131. void render (const Drawable::RenderingContext& context) const;
  19132. const Rectangle<float> getBounds() const;
  19133. bool hitTest (float x, float y) const;
  19134. Drawable* createCopy() const;
  19135. ValueTree createValueTree() const throw();
  19136. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19137. juce_UseDebuggingNewOperator
  19138. private:
  19139. OwnedArray <Drawable> drawables;
  19140. OwnedArray <AffineTransform> transforms;
  19141. DrawableComposite (const DrawableComposite&);
  19142. DrawableComposite& operator= (const DrawableComposite&);
  19143. };
  19144. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19145. /*** End of inlined file: juce_DrawableComposite.h ***/
  19146. #endif
  19147. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19148. /*** Start of inlined file: juce_DrawableImage.h ***/
  19149. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19150. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19151. class JUCE_API DrawableImage : public Drawable
  19152. {
  19153. public:
  19154. DrawableImage();
  19155. virtual ~DrawableImage();
  19156. void setImage (const Image& imageToCopy);
  19157. void setImage (Image* imageToUse,
  19158. const bool releaseWhenNotNeeded);
  19159. Image* getImage() const throw() { return image; }
  19160. void clearImage();
  19161. void setOpacity (const float newOpacity);
  19162. float getOpacity() const throw() { return opacity; }
  19163. void setOverlayColour (const Colour& newOverlayColour);
  19164. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19165. void render (const Drawable::RenderingContext& context) const;
  19166. const Rectangle<float> getBounds() const;
  19167. bool hitTest (float x, float y) const;
  19168. Drawable* createCopy() const;
  19169. ValueTree createValueTree() const throw();
  19170. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19171. juce_UseDebuggingNewOperator
  19172. private:
  19173. Image* image;
  19174. bool canDeleteImage;
  19175. float opacity;
  19176. Colour overlayColour;
  19177. DrawableImage (const DrawableImage&);
  19178. DrawableImage& operator= (const DrawableImage&);
  19179. };
  19180. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19181. /*** End of inlined file: juce_DrawableImage.h ***/
  19182. #endif
  19183. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19184. /*** Start of inlined file: juce_DrawablePath.h ***/
  19185. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19186. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19187. class JUCE_API DrawablePath : public Drawable
  19188. {
  19189. public:
  19190. DrawablePath();
  19191. virtual ~DrawablePath();
  19192. void setPath (const Path& newPath) throw();
  19193. const Path& getPath() const throw() { return path; }
  19194. void setFill (const FillType& newFill) throw();
  19195. const FillType& getFill() const throw() { return mainFill; }
  19196. void setStrokeFill (const FillType& newStrokeFill) throw();
  19197. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19198. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19199. void setStrokeThickness (const float newThickness) throw();
  19200. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19201. void render (const Drawable::RenderingContext& context) const;
  19202. const Rectangle<float> getBounds() const;
  19203. bool hitTest (float x, float y) const;
  19204. Drawable* createCopy() const;
  19205. ValueTree createValueTree() const throw();
  19206. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19207. juce_UseDebuggingNewOperator
  19208. private:
  19209. Path path, stroke;
  19210. FillType mainFill, strokeFill;
  19211. PathStrokeType strokeType;
  19212. void updateOutline();
  19213. DrawablePath (const DrawablePath&);
  19214. DrawablePath& operator= (const DrawablePath&);
  19215. };
  19216. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19217. /*** End of inlined file: juce_DrawablePath.h ***/
  19218. #endif
  19219. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19220. /*** Start of inlined file: juce_DrawableText.h ***/
  19221. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19222. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19223. class JUCE_API DrawableText : public Drawable
  19224. {
  19225. public:
  19226. DrawableText();
  19227. virtual ~DrawableText();
  19228. void setText (const GlyphArrangement& newText);
  19229. void setText (const String& newText, const Font& fontToUse);
  19230. const GlyphArrangement& getText() const throw() { return text; }
  19231. void setColour (const Colour& newColour);
  19232. const Colour& getColour() const throw() { return colour; }
  19233. void render (const Drawable::RenderingContext& context) const;
  19234. const Rectangle<float> getBounds() const;
  19235. bool hitTest (float x, float y) const;
  19236. Drawable* createCopy() const;
  19237. ValueTree createValueTree() const throw();
  19238. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19239. juce_UseDebuggingNewOperator
  19240. private:
  19241. GlyphArrangement text;
  19242. Colour colour;
  19243. DrawableText (const DrawableText&);
  19244. DrawableText& operator= (const DrawableText&);
  19245. };
  19246. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19247. /*** End of inlined file: juce_DrawableText.h ***/
  19248. #endif
  19249. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19250. #endif
  19251. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19252. /*** Start of inlined file: juce_GlowEffect.h ***/
  19253. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19254. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19255. class JUCE_API GlowEffect : public ImageEffectFilter
  19256. {
  19257. public:
  19258. GlowEffect();
  19259. ~GlowEffect();
  19260. void setGlowProperties (const float newRadius,
  19261. const Colour& newColour);
  19262. void applyEffect (Image& sourceImage, Graphics& destContext);
  19263. juce_UseDebuggingNewOperator
  19264. private:
  19265. float radius;
  19266. Colour colour;
  19267. };
  19268. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19269. /*** End of inlined file: juce_GlowEffect.h ***/
  19270. #endif
  19271. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19272. #endif
  19273. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19274. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19275. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19276. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19277. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19278. {
  19279. public:
  19280. ReduceOpacityEffect (const float opacity = 1.0f);
  19281. ~ReduceOpacityEffect();
  19282. void setOpacity (const float newOpacity);
  19283. void applyEffect (Image& sourceImage, Graphics& destContext);
  19284. juce_UseDebuggingNewOperator
  19285. private:
  19286. float opacity;
  19287. };
  19288. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19289. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19290. #endif
  19291. #ifndef __JUCE_FONT_JUCEHEADER__
  19292. #endif
  19293. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19294. #endif
  19295. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19296. #endif
  19297. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19298. #endif
  19299. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19300. #endif
  19301. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19302. #endif
  19303. #ifndef __JUCE_LINE_JUCEHEADER__
  19304. #endif
  19305. #ifndef __JUCE_PATH_JUCEHEADER__
  19306. #endif
  19307. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19308. /*** Start of inlined file: juce_PathIterator.h ***/
  19309. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19310. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19311. class JUCE_API PathFlatteningIterator
  19312. {
  19313. public:
  19314. PathFlatteningIterator (const Path& path,
  19315. const AffineTransform& transform = AffineTransform::identity,
  19316. float tolerence = 6.0f);
  19317. ~PathFlatteningIterator();
  19318. bool next();
  19319. float x1;
  19320. float y1;
  19321. float x2;
  19322. float y2;
  19323. bool closesSubPath;
  19324. int subPathIndex;
  19325. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19326. && (index >= path.numElements
  19327. || points [index] == Path::moveMarker); }
  19328. juce_UseDebuggingNewOperator
  19329. private:
  19330. const Path& path;
  19331. const AffineTransform transform;
  19332. float* points;
  19333. float tolerence, subPathCloseX, subPathCloseY;
  19334. const bool isIdentityTransform;
  19335. HeapBlock <float> stackBase;
  19336. float* stackPos;
  19337. size_t index, stackSize;
  19338. PathFlatteningIterator (const PathFlatteningIterator&);
  19339. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19340. };
  19341. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19342. /*** End of inlined file: juce_PathIterator.h ***/
  19343. #endif
  19344. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19345. #endif
  19346. #ifndef __JUCE_POINT_JUCEHEADER__
  19347. #endif
  19348. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19349. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19350. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19351. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19352. class JUCE_API PositionedRectangle
  19353. {
  19354. public:
  19355. PositionedRectangle() throw();
  19356. PositionedRectangle (const String& stringVersion) throw();
  19357. PositionedRectangle (const PositionedRectangle& other) throw();
  19358. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19359. ~PositionedRectangle() throw();
  19360. const String toString() const throw();
  19361. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19362. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19363. double& x,
  19364. double& y,
  19365. double& width,
  19366. double& height) const throw();
  19367. void applyToComponent (Component& comp) const throw();
  19368. void updateFrom (const Rectangle<int>& newPosition,
  19369. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19370. void updateFromDouble (const double x, const double y,
  19371. const double width, const double height,
  19372. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19373. void updateFromComponent (const Component& comp) throw();
  19374. enum AnchorPoint
  19375. {
  19376. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19377. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19378. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19379. };
  19380. enum PositionMode
  19381. {
  19382. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19383. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19384. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19385. 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. */
  19386. };
  19387. enum SizeMode
  19388. {
  19389. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19390. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19391. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19392. };
  19393. void setModes (const AnchorPoint xAnchorMode,
  19394. const PositionMode xPositionMode,
  19395. const AnchorPoint yAnchorMode,
  19396. const PositionMode yPositionMode,
  19397. const SizeMode widthMode,
  19398. const SizeMode heightMode,
  19399. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19400. AnchorPoint getAnchorPointX() const throw();
  19401. PositionMode getPositionModeX() const throw();
  19402. double getX() const throw() { return x; }
  19403. void setX (const double newX) throw() { x = newX; }
  19404. AnchorPoint getAnchorPointY() const throw();
  19405. PositionMode getPositionModeY() const throw();
  19406. double getY() const throw() { return y; }
  19407. void setY (const double newY) throw() { y = newY; }
  19408. SizeMode getWidthMode() const throw();
  19409. double getWidth() const throw() { return w; }
  19410. void setWidth (const double newWidth) throw() { w = newWidth; }
  19411. SizeMode getHeightMode() const throw();
  19412. double getHeight() const throw() { return h; }
  19413. void setHeight (const double newHeight) throw() { h = newHeight; }
  19414. bool isPositionAbsolute() const throw();
  19415. bool operator== (const PositionedRectangle& other) const throw();
  19416. bool operator!= (const PositionedRectangle& other) const throw();
  19417. juce_UseDebuggingNewOperator
  19418. private:
  19419. double x, y, w, h;
  19420. uint8 xMode, yMode, wMode, hMode;
  19421. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19422. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19423. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19424. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19425. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19426. const uint8 xMode, const uint8 wMode,
  19427. const int parentPos, const int parentSize) const throw();
  19428. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19429. const uint8 xMode, const uint8 wMode,
  19430. const int parentPos, const int parentSize) const throw();
  19431. };
  19432. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19433. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19434. #endif
  19435. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19436. #endif
  19437. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19438. #endif
  19439. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19440. /*** Start of inlined file: juce_CameraDevice.h ***/
  19441. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19442. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19443. #if JUCE_USE_CAMERA
  19444. class CameraImageListener
  19445. {
  19446. public:
  19447. CameraImageListener() {}
  19448. virtual ~CameraImageListener() {}
  19449. virtual void imageReceived (Image& image) = 0;
  19450. };
  19451. class JUCE_API CameraDevice
  19452. {
  19453. public:
  19454. virtual ~CameraDevice();
  19455. static const StringArray getAvailableDevices();
  19456. static CameraDevice* openDevice (int deviceIndex,
  19457. int minWidth = 128, int minHeight = 64,
  19458. int maxWidth = 1024, int maxHeight = 768);
  19459. const String getName() const { return name; }
  19460. Component* createViewerComponent();
  19461. void startRecordingToFile (const File& file, int quality = 2);
  19462. void stopRecording();
  19463. static const String getFileExtension();
  19464. const Time getTimeOfFirstRecordedFrame() const;
  19465. void addListener (CameraImageListener* listenerToAdd);
  19466. void removeListener (CameraImageListener* listenerToRemove);
  19467. juce_UseDebuggingNewOperator
  19468. protected:
  19469. CameraDevice (const String& name, int index);
  19470. private:
  19471. void* internal;
  19472. bool isRecording;
  19473. String name;
  19474. CameraDevice (const CameraDevice&);
  19475. CameraDevice& operator= (const CameraDevice&);
  19476. };
  19477. #endif
  19478. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19479. /*** End of inlined file: juce_CameraDevice.h ***/
  19480. #endif
  19481. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19482. #endif
  19483. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19484. /*** Start of inlined file: juce_ImageCache.h ***/
  19485. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19486. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19487. class JUCE_API ImageCache : private DeletedAtShutdown,
  19488. private Timer
  19489. {
  19490. public:
  19491. static Image* getFromFile (const File& file);
  19492. static Image* getFromMemory (const void* imageData, int dataSize);
  19493. static void release (Image* imageToRelease);
  19494. static void releaseOrDelete (Image* imageToRelease);
  19495. static bool isImageInCache (Image* imageToLookFor);
  19496. static void incReferenceCount (Image* image);
  19497. static Image* getFromHashCode (int64 hashCode);
  19498. static void addImageToCache (Image* image, int64 hashCode);
  19499. static void setCacheTimeout (int millisecs);
  19500. juce_UseDebuggingNewOperator
  19501. private:
  19502. CriticalSection lock;
  19503. struct Item;
  19504. friend class ScopedPointer<Item>;
  19505. friend class OwnedArray<Item>;
  19506. OwnedArray<Item> images;
  19507. static ImageCache* instance;
  19508. static int cacheTimeout;
  19509. ImageCache();
  19510. ImageCache (const ImageCache&);
  19511. ImageCache& operator= (const ImageCache&);
  19512. ~ImageCache();
  19513. void timerCallback();
  19514. };
  19515. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19516. /*** End of inlined file: juce_ImageCache.h ***/
  19517. #endif
  19518. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19519. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19520. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19521. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19522. class JUCE_API ImageConvolutionKernel
  19523. {
  19524. public:
  19525. ImageConvolutionKernel (const int size);
  19526. ~ImageConvolutionKernel();
  19527. void clear();
  19528. float getKernelValue (int x, int y) const throw();
  19529. void setKernelValue (int x, int y, float value) throw();
  19530. void setOverallSum (const float desiredTotalSum);
  19531. void rescaleAllValues (const float multiplier);
  19532. void createGaussianBlur (const float blurRadius);
  19533. int getKernelSize() const { return size; }
  19534. void applyToImage (Image& destImage,
  19535. const Image* sourceImage,
  19536. int x,
  19537. int y,
  19538. int width,
  19539. int height) const;
  19540. juce_UseDebuggingNewOperator
  19541. private:
  19542. HeapBlock <float> values;
  19543. const int size;
  19544. // no reason not to implement these one day..
  19545. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19546. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19547. };
  19548. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19549. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19550. #endif
  19551. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19552. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19553. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19554. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19555. class JUCE_API ImageFileFormat
  19556. {
  19557. protected:
  19558. ImageFileFormat() {}
  19559. public:
  19560. virtual ~ImageFileFormat() {}
  19561. virtual const String getFormatName() = 0;
  19562. virtual bool canUnderstand (InputStream& input) = 0;
  19563. virtual Image* decodeImage (InputStream& input) = 0;
  19564. virtual bool writeImageToStream (const Image& sourceImage,
  19565. OutputStream& destStream) = 0;
  19566. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19567. static Image* loadFrom (InputStream& input);
  19568. static Image* loadFrom (const File& file);
  19569. static Image* loadFrom (const void* rawData,
  19570. const int numBytesOfData);
  19571. };
  19572. class JUCE_API PNGImageFormat : public ImageFileFormat
  19573. {
  19574. public:
  19575. PNGImageFormat();
  19576. ~PNGImageFormat();
  19577. const String getFormatName();
  19578. bool canUnderstand (InputStream& input);
  19579. Image* decodeImage (InputStream& input);
  19580. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19581. };
  19582. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19583. {
  19584. public:
  19585. JPEGImageFormat();
  19586. ~JPEGImageFormat();
  19587. void setQuality (const float newQuality);
  19588. const String getFormatName();
  19589. bool canUnderstand (InputStream& input);
  19590. Image* decodeImage (InputStream& input);
  19591. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19592. private:
  19593. float quality;
  19594. };
  19595. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19596. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19597. #endif
  19598. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19599. #endif
  19600. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19601. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19602. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19603. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19604. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19605. {
  19606. public:
  19607. FileBasedDocument (const String& fileExtension,
  19608. const String& fileWildCard,
  19609. const String& openFileDialogTitle,
  19610. const String& saveFileDialogTitle);
  19611. virtual ~FileBasedDocument();
  19612. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19613. virtual void changed();
  19614. void setChangedFlag (const bool hasChanged);
  19615. bool loadFrom (const File& fileToLoadFrom,
  19616. const bool showMessageOnFailure);
  19617. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19618. enum SaveResult
  19619. {
  19620. savedOk = 0, /**< indicates that a file was saved successfully. */
  19621. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19622. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19623. };
  19624. SaveResult save (const bool askUserForFileIfNotSpecified,
  19625. const bool showMessageOnFailure);
  19626. SaveResult saveIfNeededAndUserAgrees();
  19627. SaveResult saveAs (const File& newFile,
  19628. const bool warnAboutOverwritingExistingFiles,
  19629. const bool askUserForFileIfNotSpecified,
  19630. const bool showMessageOnFailure);
  19631. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19632. const File getFile() const { return documentFile; }
  19633. void setFile (const File& newFile);
  19634. protected:
  19635. virtual const String getDocumentTitle() = 0;
  19636. virtual const String loadDocument (const File& file) = 0;
  19637. virtual const String saveDocument (const File& file) = 0;
  19638. virtual const File getLastDocumentOpened() = 0;
  19639. virtual void setLastDocumentOpened (const File& file) = 0;
  19640. public:
  19641. juce_UseDebuggingNewOperator
  19642. private:
  19643. File documentFile;
  19644. bool changedSinceSave;
  19645. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19646. FileBasedDocument (const FileBasedDocument&);
  19647. FileBasedDocument& operator= (const FileBasedDocument&);
  19648. };
  19649. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19650. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19651. #endif
  19652. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19653. #endif
  19654. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19655. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19656. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19657. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19658. class JUCE_API RecentlyOpenedFilesList
  19659. {
  19660. public:
  19661. RecentlyOpenedFilesList();
  19662. ~RecentlyOpenedFilesList();
  19663. void setMaxNumberOfItems (const int newMaxNumber);
  19664. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19665. int getNumFiles() const;
  19666. const File getFile (const int index) const;
  19667. const StringArray& getAllFilenames() const throw() { return files; }
  19668. void clear();
  19669. void addFile (const File& file);
  19670. void removeNonExistentFiles();
  19671. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19672. const int baseItemId,
  19673. const bool showFullPaths,
  19674. const bool dontAddNonExistentFiles,
  19675. const File** filesToAvoid = 0);
  19676. const String toString() const;
  19677. void restoreFromString (const String& stringifiedVersion);
  19678. juce_UseDebuggingNewOperator
  19679. private:
  19680. StringArray files;
  19681. int maxNumberOfItems;
  19682. };
  19683. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19684. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19685. #endif
  19686. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19687. #endif
  19688. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19689. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19690. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19691. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19692. class JUCE_API SystemClipboard
  19693. {
  19694. public:
  19695. static void copyTextToClipboard (const String& text) throw();
  19696. static const String getTextFromClipboard() throw();
  19697. };
  19698. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19699. /*** End of inlined file: juce_SystemClipboard.h ***/
  19700. #endif
  19701. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19702. #endif
  19703. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19704. #endif
  19705. #endif
  19706. /*** End of inlined file: juce_app_includes.h ***/
  19707. #endif
  19708. #if JUCE_MSVC
  19709. #pragma warning (pop)
  19710. #pragma pack (pop)
  19711. #endif
  19712. END_JUCE_NAMESPACE
  19713. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19714. #ifdef JUCE_NAMESPACE
  19715. // this will obviously save a lot of typing, but can be disabled by
  19716. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19717. using namespace JUCE_NAMESPACE;
  19718. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19719. #define Component JUCE_NAMESPACE::Component
  19720. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19721. #define Point JUCE_NAMESPACE::Point
  19722. #define Button JUCE_NAMESPACE::Button
  19723. #endif
  19724. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19725. #define Rectangle JUCE_NAMESPACE::Rectangle
  19726. #endif
  19727. #endif
  19728. #endif
  19729. #if JUCE_MSVC
  19730. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19731. #ifdef JUCE_DLL
  19732. #ifdef JUCE_DEBUG
  19733. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19734. #else
  19735. #define AUTOLINKEDLIB "JUCE.lib"
  19736. #endif
  19737. #else
  19738. #ifdef JUCE_DEBUG
  19739. #ifdef _WIN64
  19740. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19741. #else
  19742. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19743. #endif
  19744. #else
  19745. #ifdef _WIN64
  19746. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19747. #else
  19748. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19749. #endif
  19750. #endif
  19751. #endif
  19752. #pragma comment(lib, AUTOLINKEDLIB)
  19753. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19754. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19755. #endif
  19756. // Auto-link the other win32 libs that are needed by library calls..
  19757. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19758. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19759. // Auto-links to various win32 libs that are needed by library calls..
  19760. #pragma comment(lib, "kernel32.lib")
  19761. #pragma comment(lib, "user32.lib")
  19762. #pragma comment(lib, "shell32.lib")
  19763. #pragma comment(lib, "gdi32.lib")
  19764. #pragma comment(lib, "vfw32.lib")
  19765. #pragma comment(lib, "comdlg32.lib")
  19766. #pragma comment(lib, "winmm.lib")
  19767. #pragma comment(lib, "wininet.lib")
  19768. #pragma comment(lib, "ole32.lib")
  19769. #pragma comment(lib, "oleaut32.lib")
  19770. #pragma comment(lib, "advapi32.lib")
  19771. #pragma comment(lib, "ws2_32.lib")
  19772. #pragma comment(lib, "comsupp.lib")
  19773. #pragma comment(lib, "version.lib")
  19774. #if JUCE_OPENGL
  19775. #pragma comment(lib, "OpenGL32.Lib")
  19776. #pragma comment(lib, "GlU32.Lib")
  19777. #endif
  19778. #if JUCE_QUICKTIME
  19779. #pragma comment (lib, "QTMLClient.lib")
  19780. #endif
  19781. #if JUCE_USE_CAMERA
  19782. #pragma comment (lib, "Strmiids.lib")
  19783. #pragma comment (lib, "wmvcore.lib")
  19784. #endif
  19785. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19786. #endif
  19787. #endif
  19788. #endif
  19789. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19790. #define START_JUCE_APPLICATION(AppClass) \
  19791. int main (int argc, char* argv[]) \
  19792. { \
  19793. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19794. }
  19795. #elif JUCE_WINDOWS
  19796. #ifdef _CONSOLE
  19797. #define START_JUCE_APPLICATION(AppClass) \
  19798. int main (int, char* argv[]) \
  19799. { \
  19800. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19801. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19802. }
  19803. #elif ! defined (_AFXDLL)
  19804. #ifdef _WINDOWS_
  19805. #define START_JUCE_APPLICATION(AppClass) \
  19806. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19807. { \
  19808. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19809. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19810. }
  19811. #else
  19812. #define START_JUCE_APPLICATION(AppClass) \
  19813. int __stdcall WinMain (int, int, const char*, int) \
  19814. { \
  19815. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19816. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19817. }
  19818. #endif
  19819. #endif
  19820. #endif
  19821. #endif // __JUCE_JUCEHEADER__
  19822. /*** End of inlined file: juce.h ***/
  19823. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__