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.

28751 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 12
  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. #if (JUCE_IPHONE || JUCE_LINUX) && JUCE_QUICKTIME
  166. #undef JUCE_QUICKTIME
  167. #endif
  168. #ifndef JUCE_OPENGL
  169. #define JUCE_OPENGL 1
  170. #endif
  171. #ifndef JUCE_USE_FLAC
  172. #define JUCE_USE_FLAC 1
  173. #endif
  174. #ifndef JUCE_USE_OGGVORBIS
  175. #define JUCE_USE_OGGVORBIS 1
  176. #endif
  177. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  178. #define JUCE_USE_CDBURNER 0
  179. #endif
  180. #ifndef JUCE_USE_CDREADER
  181. #define JUCE_USE_CDREADER 1
  182. #endif
  183. #if (JUCE_QUICKTIME || JUCE_WINDOWS) && ! defined (JUCE_USE_CAMERA)
  184. // #define JUCE_USE_CAMERA 1
  185. #endif
  186. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  187. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  188. #endif
  189. #ifndef JUCE_USE_XINERAMA
  190. #define JUCE_USE_XINERAMA 1
  191. #endif
  192. #ifndef JUCE_USE_XSHM
  193. #define JUCE_USE_XSHM 1
  194. #endif
  195. #ifndef JUCE_USE_XRENDER
  196. //#define JUCE_USE_XRENDER 1
  197. #endif
  198. #ifndef JUCE_PLUGINHOST_VST
  199. // #define JUCE_PLUGINHOST_VST 1
  200. #endif
  201. #ifndef JUCE_PLUGINHOST_AU
  202. // #define JUCE_PLUGINHOST_AU 1
  203. #endif
  204. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  205. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  206. #endif
  207. #ifndef JUCE_WEB_BROWSER
  208. #define JUCE_WEB_BROWSER 0
  209. #endif
  210. #ifndef JUCE_SUPPORT_CARBON
  211. #define JUCE_SUPPORT_CARBON 1
  212. #endif
  213. #ifndef JUCE_INCLUDE_ZLIB_CODE
  214. #define JUCE_INCLUDE_ZLIB_CODE 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_FLAC_CODE
  217. #define JUCE_INCLUDE_FLAC_CODE 1
  218. #endif
  219. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  220. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  221. #endif
  222. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  223. #define JUCE_INCLUDE_PNGLIB_CODE 1
  224. #endif
  225. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  226. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  227. #endif
  228. #ifndef JUCE_CHECK_MEMORY_LEAKS
  229. #define JUCE_CHECK_MEMORY_LEAKS 1
  230. #endif
  231. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  232. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  233. #endif
  234. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  235. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  236. #undef JUCE_QUICKTIME
  237. #define JUCE_QUICKTIME 0
  238. #undef JUCE_OPENGL
  239. #define JUCE_OPENGL 0
  240. #undef JUCE_USE_CDBURNER
  241. #define JUCE_USE_CDBURNER 0
  242. #undef JUCE_USE_CDREADER
  243. #define JUCE_USE_CDREADER 0
  244. #undef JUCE_WEB_BROWSER
  245. #define JUCE_WEB_BROWSER 0
  246. #undef JUCE_PLUGINHOST_AU
  247. #define JUCE_PLUGINHOST_AU 0
  248. #undef JUCE_PLUGINHOST_VST
  249. #define JUCE_PLUGINHOST_VST 0
  250. #endif
  251. #endif
  252. /*** End of inlined file: juce_Config.h ***/
  253. #ifdef JUCE_NAMESPACE
  254. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  255. #define END_JUCE_NAMESPACE }
  256. #else
  257. #define BEGIN_JUCE_NAMESPACE
  258. #define END_JUCE_NAMESPACE
  259. #endif
  260. /*** Start of inlined file: juce_PlatformDefs.h ***/
  261. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  262. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  263. #ifdef JUCE_FORCE_DEBUG
  264. #undef JUCE_DEBUG
  265. #if JUCE_FORCE_DEBUG
  266. #define JUCE_DEBUG 1
  267. #endif
  268. #endif
  269. #if JUCE_MSVC
  270. #define JUCE_CALLTYPE __stdcall
  271. #else
  272. #define JUCE_CALLTYPE
  273. #endif
  274. // Debugging and assertion macros
  275. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  276. #if JUCE_LOG_ASSERTIONS
  277. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  278. #elif defined (JUCE_DEBUG)
  279. #define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
  280. #else
  281. #define juce_LogCurrentAssertion
  282. #endif
  283. #ifdef JUCE_DEBUG
  284. // If debugging is enabled..
  285. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  286. // Assertions..
  287. #if JUCE_WINDOWS || DOXYGEN
  288. #if JUCE_USE_INTRINSICS
  289. #pragma intrinsic (__debugbreak)
  290. #define juce_breakDebugger __debugbreak();
  291. #elif JUCE_GCC
  292. #define juce_breakDebugger asm("int $3");
  293. #else
  294. #define juce_breakDebugger { __asm int 3 }
  295. #endif
  296. #elif JUCE_MAC
  297. #define juce_breakDebugger Debugger();
  298. #elif JUCE_IPHONE
  299. #define juce_breakDebugger kill (0, SIGTRAP);
  300. #elif JUCE_LINUX
  301. #define juce_breakDebugger kill (0, SIGTRAP);
  302. #endif
  303. /** This will always cause an assertion failure.
  304. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  305. in juce_Config.h).
  306. @see jassert()
  307. */
  308. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  309. /** Platform-independent assertion macro.
  310. This gets optimised out when not being built with debugging turned on.
  311. Be careful not to call any functions within its arguments that are vital to
  312. the behaviour of the program, because these won't get called in the release
  313. build.
  314. @see jassertfalse
  315. */
  316. #define jassert(expression) { if (! (expression)) jassertfalse }
  317. #else
  318. // If debugging is disabled, these dummy debug and assertion macros are used..
  319. #define DBG(dbgtext)
  320. #define jassertfalse { juce_LogCurrentAssertion }
  321. #if JUCE_LOG_ASSERTIONS
  322. #define jassert(expression) { if (! (expression)) jassertfalse }
  323. #else
  324. #define jassert(a) { }
  325. #endif
  326. #endif
  327. #ifndef DOXYGEN
  328. template <bool b> struct JuceStaticAssert;
  329. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  330. #endif
  331. /** A compile-time assertion macro.
  332. If the expression parameter is false, the macro will cause a compile error.
  333. */
  334. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  335. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  336. #define JUCE_TRY try
  337. #define JUCE_CATCH_EXCEPTION \
  338. catch (const std::exception& e) \
  339. { \
  340. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  341. } \
  342. catch (...) \
  343. { \
  344. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  345. }
  346. #define JUCE_CATCH_ALL catch (...) {}
  347. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  348. #else
  349. #define JUCE_TRY
  350. #define JUCE_CATCH_EXCEPTION
  351. #define JUCE_CATCH_ALL
  352. #define JUCE_CATCH_ALL_ASSERT
  353. #endif
  354. // Macros for inlining.
  355. #if JUCE_MSVC
  356. #ifndef JUCE_DEBUG
  357. #define forcedinline __forceinline
  358. #else
  359. #define forcedinline inline
  360. #endif
  361. #else
  362. #ifndef JUCE_DEBUG
  363. #define forcedinline inline __attribute__((always_inline))
  364. #else
  365. #define forcedinline inline
  366. #endif
  367. #endif
  368. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  369. /*** End of inlined file: juce_PlatformDefs.h ***/
  370. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  371. #if JUCE_MSVC
  372. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  373. #pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
  374. #endif
  375. #pragma warning (push)
  376. #pragma warning (disable: 4514 4245 4100)
  377. #endif
  378. #include <cstdlib>
  379. #include <cstdarg>
  380. #include <climits>
  381. #include <limits>
  382. #include <cmath>
  383. #include <cwchar>
  384. #include <stdexcept>
  385. #include <typeinfo>
  386. #include <cstring>
  387. #include <cstdio>
  388. #include <iostream>
  389. #if JUCE_USE_INTRINSICS
  390. #include <intrin.h>
  391. #endif
  392. #if JUCE_MAC || JUCE_IPHONE
  393. #include <libkern/OSAtomic.h>
  394. #endif
  395. #if JUCE_LINUX
  396. #include <signal.h>
  397. #endif
  398. #if JUCE_MSVC && JUCE_DEBUG
  399. #include <crtdbg.h>
  400. #endif
  401. #if JUCE_MSVC
  402. #include <malloc.h>
  403. #pragma warning (pop)
  404. #if ! JUCE_PUBLIC_INCLUDES
  405. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  406. #endif
  407. #endif
  408. // DLL building settings on Win32
  409. #if JUCE_MSVC
  410. #ifdef JUCE_DLL_BUILD
  411. #define JUCE_API __declspec (dllexport)
  412. #pragma warning (disable: 4251)
  413. #elif defined (JUCE_DLL)
  414. #define JUCE_API __declspec (dllimport)
  415. #pragma warning (disable: 4251)
  416. #endif
  417. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  418. #ifdef JUCE_DLL_BUILD
  419. #define JUCE_API __attribute__ ((visibility("default")))
  420. #endif
  421. #endif
  422. #ifndef JUCE_API
  423. #define JUCE_API
  424. #endif
  425. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  426. // Now include some basics that are needed by most of the Juce classes...
  427. BEGIN_JUCE_NAMESPACE
  428. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  429. #if JUCE_LOG_ASSERTIONS
  430. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  431. #endif
  432. /*** Start of inlined file: juce_Memory.h ***/
  433. #ifndef __JUCE_MEMORY_JUCEHEADER__
  434. #define __JUCE_MEMORY_JUCEHEADER__
  435. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  436. #ifndef JUCE_DLL
  437. // Win32 debug non-DLL versions..
  438. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  439. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  440. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  441. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  442. #else
  443. // Win32 debug DLL versions..
  444. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  445. // way all juce calls in the DLL and in the host API will all use the same allocator.
  446. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  447. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  448. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  449. extern JUCE_API void juce_DebugFree (void* const block);
  450. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  451. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  452. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  453. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  454. #endif
  455. #if ! defined (_AFXDLL)
  456. #define juce_UseDebuggingNewOperator \
  457. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  458. static void* operator new (size_t, void* p) { return p; } \
  459. static void operator delete (void* p) { juce_free (p); } \
  460. static void operator delete (void*, void*) { }
  461. #endif
  462. #elif defined (JUCE_DLL)
  463. // Win32 DLL (release) versions..
  464. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  465. // way all juce calls in the DLL and in the host API will all use the same allocator.
  466. extern JUCE_API void* juce_Malloc (const int size);
  467. extern JUCE_API void* juce_Calloc (const int size);
  468. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  469. extern JUCE_API void juce_Free (void* const block);
  470. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  471. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  472. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  473. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  474. #define juce_UseDebuggingNewOperator \
  475. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  476. static void* operator new (size_t, void* p) { return p; } \
  477. static void operator delete (void* p) { juce_free (p); } \
  478. static void operator delete (void*, void*) { }
  479. #else
  480. // Mac, Linux and Win32 (release) versions..
  481. #define juce_malloc(numBytes) malloc (numBytes)
  482. #define juce_calloc(numBytes) calloc (1, numBytes)
  483. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  484. #define juce_free(location) free (location)
  485. #endif
  486. #ifndef juce_UseDebuggingNewOperator
  487. #define juce_UseDebuggingNewOperator
  488. #endif
  489. #if JUCE_MSVC
  490. #define juce_ThreadLocal __declspec(thread)
  491. #else
  492. #define juce_ThreadLocal __thread
  493. #endif
  494. #if JUCE_MINGW
  495. #define alloca __builtin_alloca
  496. #endif
  497. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  498. template <typename Type>
  499. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  500. template <typename Type>
  501. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  502. #endif // __JUCE_MEMORY_JUCEHEADER__
  503. /*** End of inlined file: juce_Memory.h ***/
  504. /*** Start of inlined file: juce_MathsFunctions.h ***/
  505. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  506. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  507. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  508. typedef signed char int8;
  509. typedef unsigned char uint8;
  510. typedef signed short int16;
  511. typedef unsigned short uint16;
  512. typedef signed int int32;
  513. typedef unsigned int uint32;
  514. #if JUCE_MSVC
  515. typedef __int64 int64;
  516. typedef unsigned __int64 uint64;
  517. #define literal64bit(longLiteral) ((__int64) longLiteral)
  518. #else
  519. typedef long long int64;
  520. typedef unsigned long long uint64;
  521. #define literal64bit(longLiteral) (longLiteral##LL)
  522. #endif
  523. #if JUCE_64BIT
  524. typedef int64 pointer_sized_int;
  525. typedef uint64 pointer_sized_uint;
  526. #elif _MSC_VER >= 1300
  527. typedef _W64 int pointer_sized_int;
  528. typedef _W64 unsigned int pointer_sized_uint;
  529. #else
  530. typedef int pointer_sized_int;
  531. typedef unsigned int pointer_sized_uint;
  532. #endif
  533. typedef wchar_t juce_wchar;
  534. // Some indispensible min/max functions
  535. template <typename Type>
  536. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  537. template <typename Type>
  538. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  539. template <typename Type>
  540. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  541. template <typename Type>
  542. inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
  543. template <typename Type>
  544. inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
  545. template <typename Type>
  546. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  547. template <typename Type>
  548. inline Type jlimit (const Type lowerLimit,
  549. const Type upperLimit,
  550. const Type valueToConstrain) throw()
  551. {
  552. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  553. return (valueToConstrain < lowerLimit) ? lowerLimit
  554. : ((upperLimit < valueToConstrain) ? upperLimit
  555. : valueToConstrain);
  556. }
  557. template <typename Type>
  558. inline void swapVariables (Type& variable1, Type& variable2)
  559. {
  560. const Type tempVal = variable1;
  561. variable1 = variable2;
  562. variable2 = tempVal;
  563. }
  564. template <typename Type>
  565. inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
  566. // Some useful maths functions that aren't always present with all compilers and build settings.
  567. inline double juce_hypot (double a, double b)
  568. {
  569. #if JUCE_WINDOWS
  570. return _hypot (a, b);
  571. #else
  572. return hypot (a, b);
  573. #endif
  574. }
  575. inline float juce_hypotf (float a, float b)
  576. {
  577. #if JUCE_WINDOWS
  578. return (float) _hypot (a, b);
  579. #else
  580. return hypotf (a, b);
  581. #endif
  582. }
  583. inline int64 abs64 (const int64 n)
  584. {
  585. return (n >= 0) ? n : -n;
  586. }
  587. const double double_Pi = 3.1415926535897932384626433832795;
  588. const float float_Pi = 3.14159265358979323846f;
  589. template <typename FloatingPointType>
  590. inline bool juce_isfinite (FloatingPointType value)
  591. {
  592. #if JUCE_WINDOWS
  593. return _finite (value);
  594. #else
  595. return std::isfinite (value);
  596. #endif
  597. }
  598. template <typename FloatType>
  599. inline int roundToInt (const FloatType value) throw()
  600. {
  601. union { int asInt[2]; double asDouble; } n;
  602. n.asDouble = ((double) value) + 6755399441055744.0;
  603. #if JUCE_BIG_ENDIAN
  604. return n.asInt [1];
  605. #else
  606. return n.asInt [0];
  607. #endif
  608. }
  609. inline int roundToIntAccurate (const double value) throw()
  610. {
  611. return roundToInt (value + 1.5e-8);
  612. }
  613. inline int roundDoubleToInt (const double value) throw()
  614. {
  615. return roundToInt (value);
  616. }
  617. inline int roundFloatToInt (const float value) throw()
  618. {
  619. return roundToInt (value);
  620. }
  621. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  622. /*** End of inlined file: juce_MathsFunctions.h ***/
  623. /*** Start of inlined file: juce_ByteOrder.h ***/
  624. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  625. #define __JUCE_BYTEORDER_JUCEHEADER__
  626. class JUCE_API ByteOrder
  627. {
  628. public:
  629. static uint16 swap (uint16 value);
  630. static uint32 swap (uint32 value);
  631. static uint64 swap (uint64 value);
  632. static uint16 swapIfBigEndian (uint16 value);
  633. static uint32 swapIfBigEndian (uint32 value);
  634. static uint64 swapIfBigEndian (uint64 value);
  635. static uint16 swapIfLittleEndian (uint16 value);
  636. static uint32 swapIfLittleEndian (uint32 value);
  637. static uint64 swapIfLittleEndian (uint64 value);
  638. static uint32 littleEndianInt (const char* bytes);
  639. static uint16 littleEndianShort (const char* bytes);
  640. static uint32 bigEndianInt (const char* bytes);
  641. static uint16 bigEndianShort (const char* bytes);
  642. static int littleEndian24Bit (const char* bytes);
  643. static int bigEndian24Bit (const char* bytes);
  644. static void littleEndian24BitToChars (int value, char* destBytes);
  645. static void bigEndian24BitToChars (int value, char* destBytes);
  646. static bool isBigEndian();
  647. };
  648. #if JUCE_USE_INTRINSICS
  649. #pragma intrinsic (_byteswap_ulong)
  650. #endif
  651. inline uint16 ByteOrder::swap (uint16 n)
  652. {
  653. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  654. return static_cast <uint16> (_byteswap_ushort (n));
  655. #else
  656. return static_cast <uint16> ((n << 8) | (n >> 8));
  657. #endif
  658. }
  659. inline uint32 ByteOrder::swap (uint32 n)
  660. {
  661. #if JUCE_MAC || JUCE_IPHONE
  662. return OSSwapInt32 (n);
  663. #elif JUCE_GCC
  664. asm("bswap %%eax" : "=a"(n) : "a"(n));
  665. return n;
  666. #elif JUCE_USE_INTRINSICS
  667. return _byteswap_ulong (n);
  668. #else
  669. __asm {
  670. mov eax, n
  671. bswap eax
  672. mov n, eax
  673. }
  674. return n;
  675. #endif
  676. }
  677. inline uint64 ByteOrder::swap (uint64 value)
  678. {
  679. #if JUCE_MAC || JUCE_IPHONE
  680. return OSSwapInt64 (value);
  681. #elif JUCE_USE_INTRINSICS
  682. return _byteswap_uint64 (value);
  683. #else
  684. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  685. #endif
  686. }
  687. #if JUCE_LITTLE_ENDIAN
  688. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  689. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  690. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  691. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  692. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  693. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  694. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  695. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  696. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  697. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  698. inline bool ByteOrder::isBigEndian() { return false; }
  699. #else
  700. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  701. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  702. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  703. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  704. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  705. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  706. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  707. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  708. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  709. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  710. inline bool ByteOrder::isBigEndian() { return true; }
  711. #endif
  712. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  713. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  714. 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); }
  715. 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); }
  716. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  717. /*** End of inlined file: juce_ByteOrder.h ***/
  718. /*** Start of inlined file: juce_Logger.h ***/
  719. #ifndef __JUCE_LOGGER_JUCEHEADER__
  720. #define __JUCE_LOGGER_JUCEHEADER__
  721. /*** Start of inlined file: juce_String.h ***/
  722. #ifndef __JUCE_STRING_JUCEHEADER__
  723. #define __JUCE_STRING_JUCEHEADER__
  724. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  725. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  726. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  727. #define JUCE_T(stringLiteral) (L##stringLiteral)
  728. typedef juce_wchar tchar;
  729. #if ! JUCE_DONT_DEFINE_MACROS
  730. #define T(stringLiteral) JUCE_T(stringLiteral)
  731. #endif
  732. class JUCE_API CharacterFunctions
  733. {
  734. public:
  735. static int length (const char* const s) throw();
  736. static int length (const juce_wchar* const s) throw();
  737. static void copy (char* dest, const char* src, const int maxBytes) throw();
  738. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  739. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  740. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  741. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  742. static void append (char* dest, const char* src) throw();
  743. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  744. static int compare (const char* const s1, const char* const s2) throw();
  745. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  746. static int compare (const juce_wchar* s1, const char* s2) throw();
  747. static int compare (const char* s1, const juce_wchar* s2) throw();
  748. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  749. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  750. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  751. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  752. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  753. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  754. static const char* find (const char* const haystack, const char* const needle) throw();
  755. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  756. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  757. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  758. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  759. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  760. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  761. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  762. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  763. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  764. static int getIntValue (const char* const s) throw();
  765. static int getIntValue (const juce_wchar* s) throw();
  766. static int64 getInt64Value (const char* s) throw();
  767. static int64 getInt64Value (const juce_wchar* s) throw();
  768. static double getDoubleValue (const char* const s) throw();
  769. static double getDoubleValue (const juce_wchar* const s) throw();
  770. static char toUpperCase (const char character) throw();
  771. static juce_wchar toUpperCase (const juce_wchar character) throw();
  772. static void toUpperCase (char* s) throw();
  773. static void toUpperCase (juce_wchar* s) throw();
  774. static bool isUpperCase (const char character) throw();
  775. static bool isUpperCase (const juce_wchar character) throw();
  776. static char toLowerCase (const char character) throw();
  777. static juce_wchar toLowerCase (const juce_wchar character) throw();
  778. static void toLowerCase (char* s) throw();
  779. static void toLowerCase (juce_wchar* s) throw();
  780. static bool isLowerCase (const char character) throw();
  781. static bool isLowerCase (const juce_wchar character) throw();
  782. static bool isWhitespace (const char character) throw();
  783. static bool isWhitespace (const juce_wchar character) throw();
  784. static bool isDigit (const char character) throw();
  785. static bool isDigit (const juce_wchar character) throw();
  786. static bool isLetter (const char character) throw();
  787. static bool isLetter (const juce_wchar character) throw();
  788. static bool isLetterOrDigit (const char character) throw();
  789. static bool isLetterOrDigit (const juce_wchar character) throw();
  790. static int getHexDigitValue (const juce_wchar digit) throw();
  791. };
  792. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  793. /*** End of inlined file: juce_CharacterFunctions.h ***/
  794. class OutputStream;
  795. class JUCE_API String
  796. {
  797. public:
  798. String() throw();
  799. String (const String& other) throw();
  800. String (const char* text);
  801. String (const char* text, size_t maxChars);
  802. String (const juce_wchar* unicodeText);
  803. String (const juce_wchar* unicodeText, size_t maxChars);
  804. static const String charToString (juce_wchar character);
  805. ~String() throw();
  806. //========================juce_wchar======================================================
  807. static const String empty;
  808. int hashCode() const throw();
  809. int64 hashCode64() const throw();
  810. int length() const throw();
  811. // Assignment and concatenation operators..
  812. String& operator= (const String& other) throw();
  813. String& operator+= (const juce_wchar* textToAppend);
  814. String& operator+= (const String& stringToAppend);
  815. String& operator+= (char characterToAppend);
  816. String& operator+= (juce_wchar characterToAppend);
  817. String& operator+= (int numberToAppend);
  818. String& operator+= (unsigned int numberToAppend);
  819. void append (const juce_wchar* textToAppend, int maxCharsToTake);
  820. // Comparison methods..
  821. inline bool isEmpty() const throw() { return text[0] == 0; }
  822. inline bool isNotEmpty() const throw() { return text[0] != 0; }
  823. bool equalsIgnoreCase (const String& other) const throw();
  824. bool equalsIgnoreCase (const juce_wchar* other) const throw();
  825. int compare (const String& other) const throw();
  826. int compare (const char* other) const throw();
  827. int compare (const juce_wchar* other) const throw();
  828. int compareIgnoreCase (const String& other) const throw();
  829. int compareLexicographically (const String& other) const throw();
  830. bool startsWith (const juce_wchar* text) const throw();
  831. bool startsWithChar (juce_wchar character) const throw();
  832. bool startsWithIgnoreCase (const juce_wchar* text) const throw();
  833. bool endsWith (const juce_wchar* text) const throw();
  834. bool endsWithChar (juce_wchar character) const throw();
  835. bool endsWithIgnoreCase (const juce_wchar* text) const throw();
  836. bool contains (const juce_wchar* text) const throw();
  837. bool containsChar (juce_wchar character) const throw();
  838. bool containsIgnoreCase (const juce_wchar* text) const throw();
  839. bool containsWholeWord (const juce_wchar* wordToLookFor) const throw();
  840. bool containsWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  841. int indexOfWholeWord (const juce_wchar* wordToLookFor) const throw();
  842. int indexOfWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  843. bool containsAnyOf (const juce_wchar* charactersItMightContain) const throw();
  844. bool containsOnly (const juce_wchar* charactersItMightContain) const throw();
  845. bool containsNonWhitespaceChars() const throw();
  846. bool matchesWildcard (const juce_wchar* wildcard, bool ignoreCase) const throw();
  847. // Substring location methods..
  848. int indexOfChar (juce_wchar characterToLookFor) const throw();
  849. int indexOfChar (int startIndex, juce_wchar characterToLookFor) const throw();
  850. int indexOfAnyOf (const juce_wchar* charactersToLookFor,
  851. int startIndex = 0,
  852. bool ignoreCase = false) const throw();
  853. int indexOf (const juce_wchar* text) const throw();
  854. int indexOf (int startIndex,
  855. const juce_wchar* textToLookFor) const throw();
  856. int indexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  857. int indexOfIgnoreCase (int startIndex,
  858. const juce_wchar* textToLookFor) const throw();
  859. int lastIndexOfChar (juce_wchar character) const throw();
  860. int lastIndexOf (const juce_wchar* textToLookFor) const throw();
  861. int lastIndexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  862. int lastIndexOfAnyOf (const juce_wchar* charactersToLookFor,
  863. bool ignoreCase = false) const throw();
  864. // Substring extraction and manipulation methods..
  865. /** Returns the character at this index in the string.
  866. No checks are made to see if the index is within a valid range, so be careful!
  867. */
  868. inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; }
  869. juce_wchar& operator[] (int index);
  870. juce_wchar getLastCharacter() const throw();
  871. const String substring (int startIndex, int endIndex) const;
  872. const String substring (int startIndex) const;
  873. const String dropLastCharacters (int numberToDrop) const;
  874. const String getLastCharacters (int numCharacters) const;
  875. const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom,
  876. bool includeSubStringInResult,
  877. bool ignoreCase) const;
  878. const String fromLastOccurrenceOf (const juce_wchar* substringToFind,
  879. bool includeSubStringInResult,
  880. bool ignoreCase) const;
  881. const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith,
  882. bool includeSubStringInResult,
  883. bool ignoreCase) const;
  884. const String upToLastOccurrenceOf (const juce_wchar* substringToFind,
  885. bool includeSubStringInResult,
  886. bool ignoreCase) const;
  887. const String trim() const;
  888. const String trimStart() const;
  889. const String trimEnd() const;
  890. const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const;
  891. const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const;
  892. const String toUpperCase() const;
  893. const String toLowerCase() const;
  894. const String replaceSection (int startIndex,
  895. int numCharactersToReplace,
  896. const juce_wchar* stringToInsert) const;
  897. const String replace (const juce_wchar* stringToReplace,
  898. const juce_wchar* stringToInsertInstead,
  899. bool ignoreCase = false) const;
  900. const String replaceCharacter (juce_wchar characterToReplace,
  901. juce_wchar characterToInsertInstead) const;
  902. const String replaceCharacters (const String& charactersToReplace,
  903. const juce_wchar* charactersToInsertInstead) const;
  904. const String retainCharacters (const juce_wchar* charactersToRetain) const;
  905. const String removeCharacters (const juce_wchar* charactersToRemove) const;
  906. const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const;
  907. const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const;
  908. bool isQuotedString() const;
  909. const String unquoted() const;
  910. const String quoted (juce_wchar quoteCharacter = JUCE_T('"')) const;
  911. static const String repeatedString (const juce_wchar* stringToRepeat,
  912. int numberOfTimesToRepeat);
  913. const String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
  914. const String paddedRight (juce_wchar padCharacter, int minimumLength) const;
  915. static const String createStringFromData (const void* data, int size);
  916. static const String formatted (const juce_wchar* formatString, ... );
  917. // Numeric conversions..
  918. explicit String (int decimalInteger);
  919. explicit String (unsigned int decimalInteger);
  920. explicit String (short decimalInteger);
  921. explicit String (unsigned short decimalInteger);
  922. explicit String (int64 largeIntegerValue);
  923. explicit String (uint64 largeIntegerValue);
  924. explicit String (float floatValue,
  925. int numberOfDecimalPlaces = 0);
  926. explicit String (double doubleValue,
  927. int numberOfDecimalPlaces = 0);
  928. int getIntValue() const throw();
  929. int64 getLargeIntValue() const throw();
  930. int getTrailingIntValue() const throw();
  931. float getFloatValue() const throw();
  932. double getDoubleValue() const throw();
  933. int getHexValue32() const throw();
  934. int64 getHexValue64() const throw();
  935. static const String toHexString (int number);
  936. static const String toHexString (int64 number);
  937. static const String toHexString (short number);
  938. static const String toHexString (const unsigned char* data,
  939. int size,
  940. int groupSize = 1);
  941. inline operator const juce_wchar*() const throw() { return text; }
  942. inline operator juce_wchar*() throw() { return text; }
  943. const char* toUTF8() const;
  944. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  945. int getNumBytesAsUTF8() const throw();
  946. int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw();
  947. const char* toCString() const;
  948. int getNumBytesAsCString() const throw();
  949. int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw();
  950. void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
  951. void preallocateStorage (size_t numCharsNeeded);
  952. void swapWith (String& other) throw();
  953. class JUCE_API Concatenator
  954. {
  955. public:
  956. Concatenator (String& stringToAppendTo);
  957. ~Concatenator();
  958. void append (const String& s);
  959. private:
  960. String& result;
  961. int nextIndex;
  962. Concatenator (const Concatenator&);
  963. Concatenator& operator= (const Concatenator&);
  964. };
  965. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  966. private:
  967. juce_wchar* text;
  968. // internal constructor that preallocates a certain amount of memory
  969. String (size_t numChars, int dummyVariable);
  970. String (const String& stringToCopy, size_t charsToAllocate);
  971. void createInternal (const juce_wchar* text, size_t numChars);
  972. void appendInternal (const juce_wchar* text, int numExtraChars);
  973. };
  974. const String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
  975. const String JUCE_CALLTYPE operator+ (const juce_wchar* string1, const String& string2);
  976. const String JUCE_CALLTYPE operator+ (char string1, const String& string2);
  977. const String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
  978. const String JUCE_CALLTYPE operator+ (String string1, const String& string2);
  979. const String JUCE_CALLTYPE operator+ (String string1, const char* string2);
  980. const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar* string2);
  981. const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
  982. const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
  983. String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
  984. String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
  985. String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
  986. String& JUCE_CALLTYPE operator<< (String& string1, const juce_wchar* string2);
  987. String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
  988. String& JUCE_CALLTYPE operator<< (String& string1, short number);
  989. String& JUCE_CALLTYPE operator<< (String& string1, int number);
  990. String& JUCE_CALLTYPE operator<< (String& string1, unsigned int number);
  991. String& JUCE_CALLTYPE operator<< (String& string1, long number);
  992. String& JUCE_CALLTYPE operator<< (String& string1, unsigned long number);
  993. String& JUCE_CALLTYPE operator<< (String& string1, float number);
  994. String& JUCE_CALLTYPE operator<< (String& string1, double number);
  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 char* string2) throw();
  1000. bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* string2) throw();
  1001. bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw();
  1002. bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw();
  1003. bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw();
  1004. bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
  1005. template <class charT, class traits>
  1006. std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1007. {
  1008. return stream << stringToWrite.toUTF8();
  1009. }
  1010. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);
  1011. #endif // __JUCE_STRING_JUCEHEADER__
  1012. /*** End of inlined file: juce_String.h ***/
  1013. class JUCE_API Logger
  1014. {
  1015. public:
  1016. virtual ~Logger();
  1017. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1018. const bool deleteOldLogger = false);
  1019. static void JUCE_CALLTYPE writeToLog (const String& message);
  1020. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1021. protected:
  1022. Logger();
  1023. virtual void logMessage (const String& message) = 0;
  1024. };
  1025. #endif // __JUCE_LOGGER_JUCEHEADER__
  1026. /*** End of inlined file: juce_Logger.h ***/
  1027. END_JUCE_NAMESPACE
  1028. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1029. /*** End of inlined file: juce_StandardHeader.h ***/
  1030. BEGIN_JUCE_NAMESPACE
  1031. #if JUCE_MSVC
  1032. // this is set explicitly in case the app is using a different packing size.
  1033. #pragma pack (push, 8)
  1034. #pragma warning (push)
  1035. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1036. #endif
  1037. // this is where all the class header files get brought in..
  1038. /*** Start of inlined file: juce_core_includes.h ***/
  1039. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1040. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1041. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1042. /*** Start of inlined file: juce_Array.h ***/
  1043. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1044. #define __JUCE_ARRAY_JUCEHEADER__
  1045. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1046. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1047. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1048. /*** Start of inlined file: juce_HeapBlock.h ***/
  1049. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1050. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1051. template <class ElementType>
  1052. class HeapBlock
  1053. {
  1054. public:
  1055. HeapBlock() throw() : data (0)
  1056. {
  1057. }
  1058. HeapBlock (const size_t numElements)
  1059. : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1060. {
  1061. }
  1062. ~HeapBlock()
  1063. {
  1064. ::juce_free (data);
  1065. }
  1066. inline operator ElementType*() const throw() { return data; }
  1067. inline ElementType* getData() const throw() { return data; }
  1068. inline operator void*() const throw() { return static_cast <void*> (data); }
  1069. inline ElementType* operator->() const throw() { return data; }
  1070. template <typename IndexType>
  1071. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1072. template <typename IndexType>
  1073. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1074. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1075. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1076. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1077. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1078. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1079. {
  1080. ::juce_free (data);
  1081. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1082. }
  1083. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1084. {
  1085. ::juce_free (data);
  1086. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1087. }
  1088. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1089. {
  1090. ::juce_free (data);
  1091. if (initialiseToZero)
  1092. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1093. else
  1094. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1095. }
  1096. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1097. {
  1098. if (data == 0)
  1099. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1100. else
  1101. data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1102. }
  1103. void free()
  1104. {
  1105. ::juce_free (data);
  1106. data = 0;
  1107. }
  1108. void swapWith (HeapBlock <ElementType>& other) throw()
  1109. {
  1110. swapVariables (data, other.data);
  1111. }
  1112. private:
  1113. ElementType* data;
  1114. HeapBlock (const HeapBlock&);
  1115. HeapBlock& operator= (const HeapBlock&);
  1116. };
  1117. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1118. /*** End of inlined file: juce_HeapBlock.h ***/
  1119. template <class ElementType, class TypeOfCriticalSectionToUse>
  1120. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1121. {
  1122. public:
  1123. ArrayAllocationBase() throw()
  1124. : numAllocated (0)
  1125. {
  1126. }
  1127. ~ArrayAllocationBase()
  1128. {
  1129. }
  1130. void setAllocatedSize (const int numElements)
  1131. {
  1132. if (numAllocated != numElements)
  1133. {
  1134. if (numElements > 0)
  1135. elements.realloc (numElements);
  1136. else
  1137. elements.free();
  1138. numAllocated = numElements;
  1139. }
  1140. }
  1141. void ensureAllocatedSize (const int minNumElements)
  1142. {
  1143. if (minNumElements > numAllocated)
  1144. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1145. }
  1146. void shrinkToNoMoreThan (const int maxNumElements)
  1147. {
  1148. if (maxNumElements < numAllocated)
  1149. setAllocatedSize (maxNumElements);
  1150. }
  1151. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1152. {
  1153. elements.swapWith (other.elements);
  1154. swapVariables (numAllocated, other.numAllocated);
  1155. }
  1156. HeapBlock <ElementType> elements;
  1157. int numAllocated;
  1158. private:
  1159. ArrayAllocationBase (const ArrayAllocationBase&);
  1160. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1161. };
  1162. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1163. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1164. /*** Start of inlined file: juce_ElementComparator.h ***/
  1165. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1166. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1167. template <class ElementType, class ElementComparator>
  1168. static void sortArray (ElementComparator& comparator,
  1169. ElementType* const array,
  1170. int firstElement,
  1171. int lastElement,
  1172. const bool retainOrderOfEquivalentItems)
  1173. {
  1174. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1175. // avoids getting warning messages about the parameter being unused
  1176. if (lastElement > firstElement)
  1177. {
  1178. if (retainOrderOfEquivalentItems)
  1179. {
  1180. for (int i = firstElement; i < lastElement; ++i)
  1181. {
  1182. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1183. {
  1184. const ElementType temp = array [i];
  1185. array [i] = array[i + 1];
  1186. array [i + 1] = temp;
  1187. if (i > firstElement)
  1188. i -= 2;
  1189. }
  1190. }
  1191. }
  1192. else
  1193. {
  1194. int fromStack[30], toStack[30];
  1195. int stackIndex = 0;
  1196. for (;;)
  1197. {
  1198. const int size = (lastElement - firstElement) + 1;
  1199. if (size <= 8)
  1200. {
  1201. int j = lastElement;
  1202. int maxIndex;
  1203. while (j > firstElement)
  1204. {
  1205. maxIndex = firstElement;
  1206. for (int k = firstElement + 1; k <= j; ++k)
  1207. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1208. maxIndex = k;
  1209. const ElementType temp = array [maxIndex];
  1210. array [maxIndex] = array[j];
  1211. array [j] = temp;
  1212. --j;
  1213. }
  1214. }
  1215. else
  1216. {
  1217. const int mid = firstElement + (size >> 1);
  1218. ElementType temp = array [mid];
  1219. array [mid] = array [firstElement];
  1220. array [firstElement] = temp;
  1221. int i = firstElement;
  1222. int j = lastElement + 1;
  1223. for (;;)
  1224. {
  1225. while (++i <= lastElement
  1226. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1227. {}
  1228. while (--j > firstElement
  1229. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1230. {}
  1231. if (j < i)
  1232. break;
  1233. temp = array[i];
  1234. array[i] = array[j];
  1235. array[j] = temp;
  1236. }
  1237. temp = array [firstElement];
  1238. array [firstElement] = array[j];
  1239. array [j] = temp;
  1240. if (j - 1 - firstElement >= lastElement - i)
  1241. {
  1242. if (firstElement + 1 < j)
  1243. {
  1244. fromStack [stackIndex] = firstElement;
  1245. toStack [stackIndex] = j - 1;
  1246. ++stackIndex;
  1247. }
  1248. if (i < lastElement)
  1249. {
  1250. firstElement = i;
  1251. continue;
  1252. }
  1253. }
  1254. else
  1255. {
  1256. if (i < lastElement)
  1257. {
  1258. fromStack [stackIndex] = i;
  1259. toStack [stackIndex] = lastElement;
  1260. ++stackIndex;
  1261. }
  1262. if (firstElement + 1 < j)
  1263. {
  1264. lastElement = j - 1;
  1265. continue;
  1266. }
  1267. }
  1268. }
  1269. if (--stackIndex < 0)
  1270. break;
  1271. jassert (stackIndex < numElementsInArray (fromStack));
  1272. firstElement = fromStack [stackIndex];
  1273. lastElement = toStack [stackIndex];
  1274. }
  1275. }
  1276. }
  1277. }
  1278. template <class ElementType, class ElementComparator>
  1279. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1280. ElementType* const array,
  1281. const ElementType newElement,
  1282. int firstElement,
  1283. int lastElement)
  1284. {
  1285. jassert (firstElement <= lastElement);
  1286. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1287. // avoids getting warning messages about the parameter being unused
  1288. while (firstElement < lastElement)
  1289. {
  1290. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1291. {
  1292. ++firstElement;
  1293. break;
  1294. }
  1295. else
  1296. {
  1297. const int halfway = (firstElement + lastElement) >> 1;
  1298. if (halfway == firstElement)
  1299. {
  1300. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1301. ++firstElement;
  1302. break;
  1303. }
  1304. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1305. {
  1306. firstElement = halfway;
  1307. }
  1308. else
  1309. {
  1310. lastElement = halfway;
  1311. }
  1312. }
  1313. }
  1314. return firstElement;
  1315. }
  1316. template <class ElementType>
  1317. class IntegerElementComparator
  1318. {
  1319. public:
  1320. static int compareElements (const ElementType first,
  1321. const ElementType second) throw()
  1322. {
  1323. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1324. }
  1325. };
  1326. template <class ElementType>
  1327. class FloatElementComparator
  1328. {
  1329. public:
  1330. static int compareElements (const ElementType first,
  1331. const ElementType second) throw()
  1332. {
  1333. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1334. }
  1335. };
  1336. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1337. /*** End of inlined file: juce_ElementComparator.h ***/
  1338. /*** Start of inlined file: juce_CriticalSection.h ***/
  1339. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1340. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1341. class JUCE_API ScopedLock;
  1342. class JUCE_API ScopedUnlock;
  1343. class JUCE_API CriticalSection
  1344. {
  1345. public:
  1346. CriticalSection() throw();
  1347. ~CriticalSection() throw();
  1348. void enter() const throw();
  1349. bool tryEnter() const throw();
  1350. void exit() const throw();
  1351. typedef ScopedLock ScopedLockType;
  1352. typedef ScopedUnlock ScopedUnlockType;
  1353. juce_UseDebuggingNewOperator
  1354. private:
  1355. #if JUCE_WIN32
  1356. #if JUCE_64BIT
  1357. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1358. // block of memory here that's big enough to be used internally as a windows critical
  1359. // section object.
  1360. uint8 internal [44];
  1361. #else
  1362. uint8 internal [24];
  1363. #endif
  1364. #else
  1365. mutable pthread_mutex_t internal;
  1366. #endif
  1367. CriticalSection (const CriticalSection&);
  1368. CriticalSection& operator= (const CriticalSection&);
  1369. };
  1370. class JUCE_API DummyCriticalSection
  1371. {
  1372. public:
  1373. inline DummyCriticalSection() throw() {}
  1374. inline ~DummyCriticalSection() throw() {}
  1375. inline void enter() const throw() {}
  1376. inline void exit() const throw() {}
  1377. struct ScopedLockType
  1378. {
  1379. ScopedLockType (const DummyCriticalSection&) throw() {}
  1380. };
  1381. typedef ScopedLockType ScopedUnlockType;
  1382. private:
  1383. DummyCriticalSection (const DummyCriticalSection&);
  1384. DummyCriticalSection& operator= (const DummyCriticalSection&);
  1385. };
  1386. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1387. /*** End of inlined file: juce_CriticalSection.h ***/
  1388. template <typename ElementType,
  1389. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1390. class Array
  1391. {
  1392. public:
  1393. Array() throw()
  1394. : numUsed (0)
  1395. {
  1396. }
  1397. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1398. {
  1399. const ScopedLockType lock (other.getLock());
  1400. numUsed = other.numUsed;
  1401. data.setAllocatedSize (other.numUsed);
  1402. for (int i = 0; i < numUsed; ++i)
  1403. new (data.elements + i) ElementType (other.data.elements[i]);
  1404. }
  1405. explicit Array (const ElementType* values)
  1406. : numUsed (0)
  1407. {
  1408. while (*values != 0)
  1409. add (*values++);
  1410. }
  1411. Array (const ElementType* values, int numValues)
  1412. : numUsed (numValues)
  1413. {
  1414. data.setAllocatedSize (numValues);
  1415. for (int i = 0; i < numValues; ++i)
  1416. new (data.elements + i) ElementType (values[i]);
  1417. }
  1418. ~Array()
  1419. {
  1420. for (int i = 0; i < numUsed; ++i)
  1421. data.elements[i].~ElementType();
  1422. }
  1423. Array& operator= (const Array& other)
  1424. {
  1425. if (this != &other)
  1426. {
  1427. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1428. swapWithArray (otherCopy);
  1429. }
  1430. return *this;
  1431. }
  1432. template <class OtherArrayType>
  1433. bool operator== (const OtherArrayType& other) const
  1434. {
  1435. const ScopedLockType lock (getLock());
  1436. if (numUsed != other.numUsed)
  1437. return false;
  1438. for (int i = numUsed; --i >= 0;)
  1439. if (data.elements [i] != other.data.elements [i])
  1440. return false;
  1441. return true;
  1442. }
  1443. template <class OtherArrayType>
  1444. bool operator!= (const OtherArrayType& other) const
  1445. {
  1446. return ! operator== (other);
  1447. }
  1448. void clear()
  1449. {
  1450. const ScopedLockType lock (getLock());
  1451. for (int i = 0; i < numUsed; ++i)
  1452. data.elements[i].~ElementType();
  1453. data.setAllocatedSize (0);
  1454. numUsed = 0;
  1455. }
  1456. void clearQuick()
  1457. {
  1458. const ScopedLockType lock (getLock());
  1459. for (int i = 0; i < numUsed; ++i)
  1460. data.elements[i].~ElementType();
  1461. numUsed = 0;
  1462. }
  1463. inline int size() const throw()
  1464. {
  1465. return numUsed;
  1466. }
  1467. inline ElementType operator[] (const int index) const
  1468. {
  1469. const ScopedLockType lock (getLock());
  1470. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1471. : ElementType();
  1472. }
  1473. inline const ElementType getUnchecked (const int index) const
  1474. {
  1475. const ScopedLockType lock (getLock());
  1476. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1477. return data.elements [index];
  1478. }
  1479. inline ElementType& getReference (const int index) const throw()
  1480. {
  1481. const ScopedLockType lock (getLock());
  1482. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1483. return data.elements [index];
  1484. }
  1485. inline ElementType getFirst() const
  1486. {
  1487. const ScopedLockType lock (getLock());
  1488. return (numUsed > 0) ? data.elements [0]
  1489. : ElementType();
  1490. }
  1491. inline ElementType getLast() const
  1492. {
  1493. const ScopedLockType lock (getLock());
  1494. return (numUsed > 0) ? data.elements [numUsed - 1]
  1495. : ElementType();
  1496. }
  1497. int indexOf (const ElementType& elementToLookFor) const
  1498. {
  1499. const ScopedLockType lock (getLock());
  1500. const ElementType* e = data.elements.getData();
  1501. const ElementType* const end = e + numUsed;
  1502. while (e != end)
  1503. {
  1504. if (elementToLookFor == *e)
  1505. return static_cast <int> (e - data.elements.getData());
  1506. ++e;
  1507. }
  1508. return -1;
  1509. }
  1510. bool contains (const ElementType& elementToLookFor) const
  1511. {
  1512. const ScopedLockType lock (getLock());
  1513. const ElementType* e = data.elements.getData();
  1514. const ElementType* const end = e + numUsed;
  1515. while (e != end)
  1516. {
  1517. if (elementToLookFor == *e)
  1518. return true;
  1519. ++e;
  1520. }
  1521. return false;
  1522. }
  1523. void add (const ElementType& newElement)
  1524. {
  1525. const ScopedLockType lock (getLock());
  1526. data.ensureAllocatedSize (numUsed + 1);
  1527. new (data.elements + numUsed++) ElementType (newElement);
  1528. }
  1529. void insert (int indexToInsertAt, const ElementType& newElement)
  1530. {
  1531. const ScopedLockType lock (getLock());
  1532. data.ensureAllocatedSize (numUsed + 1);
  1533. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1534. {
  1535. ElementType* const insertPos = data.elements + indexToInsertAt;
  1536. const int numberToMove = numUsed - indexToInsertAt;
  1537. if (numberToMove > 0)
  1538. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1539. new (insertPos) ElementType (newElement);
  1540. ++numUsed;
  1541. }
  1542. else
  1543. {
  1544. new (data.elements + numUsed++) ElementType (newElement);
  1545. }
  1546. }
  1547. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1548. int numberOfTimesToInsertIt)
  1549. {
  1550. if (numberOfTimesToInsertIt > 0)
  1551. {
  1552. const ScopedLockType lock (getLock());
  1553. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1554. ElementType* insertPos;
  1555. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1556. {
  1557. insertPos = data.elements + indexToInsertAt;
  1558. const int numberToMove = numUsed - indexToInsertAt;
  1559. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1560. }
  1561. else
  1562. {
  1563. insertPos = data.elements + numUsed;
  1564. }
  1565. numUsed += numberOfTimesToInsertIt;
  1566. while (--numberOfTimesToInsertIt >= 0)
  1567. new (insertPos++) ElementType (newElement);
  1568. }
  1569. }
  1570. void insertArray (int indexToInsertAt,
  1571. const ElementType* newElements,
  1572. int numberOfElements)
  1573. {
  1574. if (numberOfElements > 0)
  1575. {
  1576. const ScopedLockType lock (getLock());
  1577. data.ensureAllocatedSize (numUsed + numberOfElements);
  1578. ElementType* insertPos;
  1579. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1580. {
  1581. insertPos = data.elements + indexToInsertAt;
  1582. const int numberToMove = numUsed - indexToInsertAt;
  1583. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1584. }
  1585. else
  1586. {
  1587. insertPos = data.elements + numUsed;
  1588. }
  1589. numUsed += numberOfElements;
  1590. while (--numberOfElements >= 0)
  1591. new (insertPos++) ElementType (*newElements++);
  1592. }
  1593. }
  1594. void addIfNotAlreadyThere (const ElementType& newElement)
  1595. {
  1596. const ScopedLockType lock (getLock());
  1597. if (! contains (newElement))
  1598. add (newElement);
  1599. }
  1600. void set (const int indexToChange, const ElementType& newValue)
  1601. {
  1602. jassert (indexToChange >= 0);
  1603. const ScopedLockType lock (getLock());
  1604. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1605. {
  1606. data.elements [indexToChange] = newValue;
  1607. }
  1608. else if (indexToChange >= 0)
  1609. {
  1610. data.ensureAllocatedSize (numUsed + 1);
  1611. new (data.elements + numUsed++) ElementType (newValue);
  1612. }
  1613. }
  1614. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1615. {
  1616. const ScopedLockType lock (getLock());
  1617. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1618. data.elements [indexToChange] = newValue;
  1619. }
  1620. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1621. {
  1622. const ScopedLockType lock (getLock());
  1623. if (numElementsToAdd > 0)
  1624. {
  1625. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1626. while (--numElementsToAdd >= 0)
  1627. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1628. }
  1629. }
  1630. void swapWithArray (Array& otherArray) throw()
  1631. {
  1632. const ScopedLockType lock1 (getLock());
  1633. const ScopedLockType lock2 (otherArray.getLock());
  1634. data.swapWith (otherArray.data);
  1635. swapVariables (numUsed, otherArray.numUsed);
  1636. }
  1637. template <class OtherArrayType>
  1638. void addArray (const OtherArrayType& arrayToAddFrom,
  1639. int startIndex = 0,
  1640. int numElementsToAdd = -1)
  1641. {
  1642. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1643. const ScopedLockType lock2 (getLock());
  1644. if (startIndex < 0)
  1645. {
  1646. jassertfalse
  1647. startIndex = 0;
  1648. }
  1649. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1650. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1651. while (--numElementsToAdd >= 0)
  1652. add (arrayToAddFrom.getUnchecked (startIndex++));
  1653. }
  1654. template <class ElementComparator>
  1655. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1656. {
  1657. const ScopedLockType lock (getLock());
  1658. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1659. }
  1660. template <class ElementComparator>
  1661. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1662. {
  1663. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1664. // avoids getting warning messages about the parameter being unused
  1665. const ScopedLockType lock (getLock());
  1666. int start = 0;
  1667. int end = numUsed;
  1668. for (;;)
  1669. {
  1670. if (start >= end)
  1671. {
  1672. return -1;
  1673. }
  1674. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1675. {
  1676. return start;
  1677. }
  1678. else
  1679. {
  1680. const int halfway = (start + end) >> 1;
  1681. if (halfway == start)
  1682. return -1;
  1683. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1684. start = halfway;
  1685. else
  1686. end = halfway;
  1687. }
  1688. }
  1689. }
  1690. ElementType remove (const int indexToRemove)
  1691. {
  1692. const ScopedLockType lock (getLock());
  1693. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1694. {
  1695. --numUsed;
  1696. ElementType* const e = data.elements + indexToRemove;
  1697. ElementType removed (*e);
  1698. e->~ElementType();
  1699. const int numberToShift = numUsed - indexToRemove;
  1700. if (numberToShift > 0)
  1701. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1702. if ((numUsed << 1) < data.numAllocated)
  1703. minimiseStorageOverheads();
  1704. return removed;
  1705. }
  1706. else
  1707. {
  1708. return ElementType();
  1709. }
  1710. }
  1711. void removeValue (const ElementType& valueToRemove)
  1712. {
  1713. const ScopedLockType lock (getLock());
  1714. ElementType* e = data.elements;
  1715. for (int i = numUsed; --i >= 0;)
  1716. {
  1717. if (valueToRemove == *e)
  1718. {
  1719. remove (static_cast <int> (e - data.elements.getData()));
  1720. break;
  1721. }
  1722. ++e;
  1723. }
  1724. }
  1725. void removeRange (int startIndex, int numberToRemove)
  1726. {
  1727. const ScopedLockType lock (getLock());
  1728. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1729. startIndex = jlimit (0, numUsed, startIndex);
  1730. if (endIndex > startIndex)
  1731. {
  1732. ElementType* const e = data.elements + startIndex;
  1733. numberToRemove = endIndex - startIndex;
  1734. for (int i = 0; i < numberToRemove; ++i)
  1735. e[i].~ElementType();
  1736. const int numToShift = numUsed - endIndex;
  1737. if (numToShift > 0)
  1738. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1739. numUsed -= numberToRemove;
  1740. if ((numUsed << 1) < data.numAllocated)
  1741. minimiseStorageOverheads();
  1742. }
  1743. }
  1744. void removeLast (int howManyToRemove = 1)
  1745. {
  1746. const ScopedLockType lock (getLock());
  1747. if (howManyToRemove > numUsed)
  1748. howManyToRemove = numUsed;
  1749. for (int i = 0; i < howManyToRemove; ++i)
  1750. data.elements [numUsed - i].~ElementType();
  1751. numUsed -= howManyToRemove;
  1752. if ((numUsed << 1) < data.numAllocated)
  1753. minimiseStorageOverheads();
  1754. }
  1755. template <class OtherArrayType>
  1756. void removeValuesIn (const OtherArrayType& otherArray)
  1757. {
  1758. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1759. const ScopedLockType lock2 (getLock());
  1760. if (this == &otherArray)
  1761. {
  1762. clear();
  1763. }
  1764. else
  1765. {
  1766. if (otherArray.size() > 0)
  1767. {
  1768. for (int i = numUsed; --i >= 0;)
  1769. if (otherArray.contains (data.elements [i]))
  1770. remove (i);
  1771. }
  1772. }
  1773. }
  1774. template <class OtherArrayType>
  1775. void removeValuesNotIn (const OtherArrayType& otherArray)
  1776. {
  1777. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1778. const ScopedLockType lock2 (getLock());
  1779. if (this != &otherArray)
  1780. {
  1781. if (otherArray.size() <= 0)
  1782. {
  1783. clear();
  1784. }
  1785. else
  1786. {
  1787. for (int i = numUsed; --i >= 0;)
  1788. if (! otherArray.contains (data.elements [i]))
  1789. remove (i);
  1790. }
  1791. }
  1792. }
  1793. void swap (const int index1,
  1794. const int index2)
  1795. {
  1796. const ScopedLockType lock (getLock());
  1797. if (((unsigned int) index1) < (unsigned int) numUsed
  1798. && ((unsigned int) index2) < (unsigned int) numUsed)
  1799. {
  1800. swapVariables (data.elements [index1],
  1801. data.elements [index2]);
  1802. }
  1803. }
  1804. void move (const int currentIndex, int newIndex) throw()
  1805. {
  1806. if (currentIndex != newIndex)
  1807. {
  1808. const ScopedLockType lock (getLock());
  1809. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1810. {
  1811. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1812. newIndex = numUsed - 1;
  1813. char tempCopy [sizeof (ElementType)];
  1814. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1815. if (newIndex > currentIndex)
  1816. {
  1817. memmove (data.elements + currentIndex,
  1818. data.elements + currentIndex + 1,
  1819. (newIndex - currentIndex) * sizeof (ElementType));
  1820. }
  1821. else
  1822. {
  1823. memmove (data.elements + newIndex + 1,
  1824. data.elements + newIndex,
  1825. (currentIndex - newIndex) * sizeof (ElementType));
  1826. }
  1827. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1828. }
  1829. }
  1830. }
  1831. void minimiseStorageOverheads()
  1832. {
  1833. const ScopedLockType lock (getLock());
  1834. data.shrinkToNoMoreThan (numUsed);
  1835. }
  1836. void ensureStorageAllocated (const int minNumElements)
  1837. {
  1838. const ScopedLockType lock (getLock());
  1839. data.ensureAllocatedSize (minNumElements);
  1840. }
  1841. template <class ElementComparator>
  1842. void sort (ElementComparator& comparator,
  1843. const bool retainOrderOfEquivalentItems = false) const
  1844. {
  1845. const ScopedLockType lock (getLock());
  1846. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1847. // avoids getting warning messages about the parameter being unused
  1848. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1849. }
  1850. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1851. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1852. juce_UseDebuggingNewOperator
  1853. private:
  1854. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1855. int numUsed;
  1856. };
  1857. #endif // __JUCE_ARRAY_JUCEHEADER__
  1858. /*** End of inlined file: juce_Array.h ***/
  1859. #endif
  1860. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1861. #endif
  1862. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1863. /*** Start of inlined file: juce_BitArray.h ***/
  1864. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1865. #define __JUCE_BITARRAY_JUCEHEADER__
  1866. class MemoryBlock;
  1867. class JUCE_API BigInteger
  1868. {
  1869. public:
  1870. BigInteger();
  1871. BigInteger (unsigned int value);
  1872. BigInteger (int value);
  1873. BigInteger (int64 value);
  1874. BigInteger (const BigInteger& other);
  1875. ~BigInteger();
  1876. BigInteger& operator= (const BigInteger& other);
  1877. void swapWith (BigInteger& other) throw();
  1878. bool operator[] (int bit) const throw();
  1879. bool isZero() const throw();
  1880. bool isOne() const throw();
  1881. int toInteger() const throw();
  1882. void clear();
  1883. void clearBit (int bitNumber) throw();
  1884. void setBit (int bitNumber);
  1885. void setBit (int bitNumber, bool shouldBeSet);
  1886. void setRange (int startBit, int numBits, bool shouldBeSet);
  1887. void insertBit (int bitNumber, bool shouldBeSet);
  1888. const BigInteger getBitRange (int startBit, int numBits) const;
  1889. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1890. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1891. void shiftBits (int howManyBitsLeft, int startBit);
  1892. int countNumberOfSetBits() const throw();
  1893. int findNextSetBit (int startIndex = 0) const throw();
  1894. int findNextClearBit (int startIndex = 0) const throw();
  1895. int getHighestBit() const throw();
  1896. // All the standard arithmetic ops...
  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&= (const BigInteger& other);
  1903. BigInteger& operator^= (const BigInteger& other);
  1904. BigInteger& operator%= (const BigInteger& other);
  1905. BigInteger& operator<<= (int numBitsToShift);
  1906. BigInteger& operator>>= (int numBitsToShift);
  1907. BigInteger& operator++();
  1908. BigInteger& operator--();
  1909. const BigInteger operator++ (int);
  1910. const BigInteger operator-- (int);
  1911. const BigInteger operator-() 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& (const BigInteger& other) const;
  1918. const BigInteger operator^ (const BigInteger& other) const;
  1919. const BigInteger operator% (const BigInteger& other) const;
  1920. const BigInteger operator<< (int numBitsToShift) const;
  1921. const BigInteger operator>> (int numBitsToShift) const;
  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. bool operator<= (const BigInteger& other) const throw();
  1926. bool operator> (const BigInteger& other) const throw();
  1927. bool operator>= (const BigInteger& other) const throw();
  1928. int compare (const BigInteger& other) const throw();
  1929. int compareAbsolute (const BigInteger& other) const throw();
  1930. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1931. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1932. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1933. void inverseModulo (const BigInteger& modulus);
  1934. bool isNegative() const throw();
  1935. void setNegative (const bool shouldBeNegative) throw();
  1936. void negate() throw();
  1937. const String toString (int base, int minimumNumCharacters = 1) const;
  1938. void parseString (const String& text, int base);
  1939. const MemoryBlock toMemoryBlock() const;
  1940. void loadFromMemoryBlock (const MemoryBlock& data);
  1941. juce_UseDebuggingNewOperator
  1942. private:
  1943. HeapBlock <unsigned int> values;
  1944. int numValues, highestBit;
  1945. bool negative;
  1946. void ensureSize (int numVals);
  1947. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1948. };
  1949. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1950. typedef BigInteger BitArray;
  1951. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1952. /*** End of inlined file: juce_BitArray.h ***/
  1953. #endif
  1954. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1955. /*** Start of inlined file: juce_DynamicObject.h ***/
  1956. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1957. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1958. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1959. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1960. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1961. /*** Start of inlined file: juce_Variant.h ***/
  1962. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1963. #define __JUCE_VARIANT_JUCEHEADER__
  1964. /*** Start of inlined file: juce_OutputStream.h ***/
  1965. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1966. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1967. /*** Start of inlined file: juce_InputStream.h ***/
  1968. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  1969. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  1970. /*** Start of inlined file: juce_MemoryBlock.h ***/
  1971. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1972. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1973. class JUCE_API MemoryBlock
  1974. {
  1975. public:
  1976. MemoryBlock() throw();
  1977. MemoryBlock (const size_t initialSize,
  1978. const bool initialiseToZero = false) throw();
  1979. MemoryBlock (const MemoryBlock& other) throw();
  1980. MemoryBlock (const void* const dataToInitialiseFrom,
  1981. const size_t sizeInBytes) throw();
  1982. ~MemoryBlock() throw();
  1983. MemoryBlock& operator= (const MemoryBlock& other) throw();
  1984. bool operator== (const MemoryBlock& other) const throw();
  1985. bool operator!= (const MemoryBlock& other) const throw();
  1986. bool matches (const void* data, size_t dataSize) const throw();
  1987. void* getData() const throw() { return data; }
  1988. template <typename Type>
  1989. char& operator[] (const Type offset) const throw() { return data [offset]; }
  1990. size_t getSize() const throw() { return size; }
  1991. void setSize (const size_t newSize,
  1992. const bool initialiseNewSpaceToZero = false) throw();
  1993. void ensureSize (const size_t minimumSize,
  1994. const bool initialiseNewSpaceToZero = false) throw();
  1995. void fillWith (const uint8 valueToUse) throw();
  1996. void append (const void* const data,
  1997. const size_t numBytes) throw();
  1998. void swapWith (MemoryBlock& other) throw();
  1999. void copyFrom (const void* srcData,
  2000. int destinationOffset,
  2001. size_t numBytes) throw();
  2002. void copyTo (void* destData,
  2003. int sourceOffset,
  2004. size_t numBytes) const throw();
  2005. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2006. const String toString() const throw();
  2007. void loadFromHexString (const String& sourceHexString) throw();
  2008. void setBitRange (size_t bitRangeStart,
  2009. size_t numBits,
  2010. int binaryNumberToApply) throw();
  2011. int getBitRange (size_t bitRangeStart,
  2012. size_t numBitsToRead) const throw();
  2013. const String toBase64Encoding() const throw();
  2014. bool fromBase64Encoding (const String& encodedString) throw();
  2015. juce_UseDebuggingNewOperator
  2016. private:
  2017. HeapBlock <char> data;
  2018. size_t size;
  2019. };
  2020. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2021. /*** End of inlined file: juce_MemoryBlock.h ***/
  2022. class JUCE_API InputStream
  2023. {
  2024. public:
  2025. virtual ~InputStream() {}
  2026. virtual int64 getTotalLength() = 0;
  2027. virtual bool isExhausted() = 0;
  2028. virtual int read (void* destBuffer,
  2029. int maxBytesToRead) = 0;
  2030. virtual char readByte();
  2031. virtual bool readBool();
  2032. virtual short readShort();
  2033. virtual short readShortBigEndian();
  2034. virtual int readInt();
  2035. virtual int readIntBigEndian();
  2036. virtual int64 readInt64();
  2037. virtual int64 readInt64BigEndian();
  2038. virtual float readFloat();
  2039. virtual float readFloatBigEndian();
  2040. virtual double readDouble();
  2041. virtual double readDoubleBigEndian();
  2042. virtual int readCompressedInt();
  2043. virtual const String readNextLine();
  2044. virtual const String readString();
  2045. virtual const String readEntireStreamAsString();
  2046. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2047. int maxNumBytesToRead = -1);
  2048. virtual int64 getPosition() = 0;
  2049. virtual bool setPosition (int64 newPosition) = 0;
  2050. virtual void skipNextBytes (int64 numBytesToSkip);
  2051. juce_UseDebuggingNewOperator
  2052. protected:
  2053. InputStream() throw() {}
  2054. };
  2055. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2056. /*** End of inlined file: juce_InputStream.h ***/
  2057. class JUCE_API OutputStream
  2058. {
  2059. protected:
  2060. OutputStream();
  2061. public:
  2062. virtual ~OutputStream();
  2063. virtual void flush() = 0;
  2064. virtual bool setPosition (int64 newPosition) = 0;
  2065. virtual int64 getPosition() = 0;
  2066. virtual bool write (const void* dataToWrite,
  2067. int howManyBytes) = 0;
  2068. virtual void writeByte (char byte);
  2069. virtual void writeBool (bool boolValue);
  2070. virtual void writeShort (short value);
  2071. virtual void writeShortBigEndian (short value);
  2072. virtual void writeInt (int value);
  2073. virtual void writeIntBigEndian (int value);
  2074. virtual void writeInt64 (int64 value);
  2075. virtual void writeInt64BigEndian (int64 value);
  2076. virtual void writeFloat (float value);
  2077. virtual void writeFloatBigEndian (float value);
  2078. virtual void writeDouble (double value);
  2079. virtual void writeDoubleBigEndian (double value);
  2080. virtual void writeCompressedInt (int value);
  2081. virtual void writeString (const String& text);
  2082. virtual void writeText (const String& text,
  2083. const bool asUnicode,
  2084. const bool writeUnicodeHeaderBytes);
  2085. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2086. juce_UseDebuggingNewOperator
  2087. };
  2088. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const int number);
  2089. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const double number);
  2090. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char character);
  2091. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* const text);
  2092. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2093. /*** End of inlined file: juce_OutputStream.h ***/
  2094. class JUCE_API DynamicObject;
  2095. class JUCE_API var
  2096. {
  2097. public:
  2098. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2099. var() throw();
  2100. ~var() throw();
  2101. static const var null;
  2102. var (const var& valueToCopy);
  2103. var (const int value) throw();
  2104. var (const bool value) throw();
  2105. var (const double value) throw();
  2106. var (const char* const value);
  2107. var (const juce_wchar* const value);
  2108. var (const String& value);
  2109. var (DynamicObject* const object);
  2110. var (MethodFunction method) throw();
  2111. var& operator= (const var& valueToCopy);
  2112. var& operator= (int value);
  2113. var& operator= (bool value);
  2114. var& operator= (double value);
  2115. var& operator= (const char* value);
  2116. var& operator= (const juce_wchar* value);
  2117. var& operator= (const String& value);
  2118. var& operator= (DynamicObject* object);
  2119. var& operator= (MethodFunction method);
  2120. void swapWith (var& other) throw();
  2121. operator int() const;
  2122. operator bool() const;
  2123. operator float() const;
  2124. operator double() const;
  2125. operator const String() const;
  2126. const String toString() const;
  2127. DynamicObject* getObject() const;
  2128. bool isVoid() const throw() { return type == voidType; }
  2129. bool isInt() const throw() { return type == intType; }
  2130. bool isBool() const throw() { return type == boolType; }
  2131. bool isDouble() const throw() { return type == doubleType; }
  2132. bool isString() const throw() { return type == stringType; }
  2133. bool isObject() const throw() { return type == objectType; }
  2134. bool isMethod() const throw() { return type == methodType; }
  2135. void writeToStream (OutputStream& output) const;
  2136. static const var readFromStream (InputStream& input);
  2137. class JUCE_API identifier
  2138. {
  2139. public:
  2140. identifier() throw();
  2141. identifier (const char* const name);
  2142. identifier (const String& name);
  2143. ~identifier();
  2144. bool operator== (const identifier& other) const throw()
  2145. {
  2146. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2147. return hashCode == other.hashCode;
  2148. }
  2149. String name;
  2150. int hashCode;
  2151. };
  2152. const var operator[] (const identifier& propertyName) const;
  2153. const var call (const identifier& method) const;
  2154. const var call (const identifier& method, const var& arg1) const;
  2155. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2156. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2157. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2158. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2159. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2160. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2161. juce_UseDebuggingNewOperator
  2162. bool equals (const var& other) const throw();
  2163. private:
  2164. enum Type
  2165. {
  2166. voidType = 0,
  2167. intType,
  2168. boolType,
  2169. doubleType,
  2170. stringType,
  2171. objectType,
  2172. methodType
  2173. };
  2174. union ValueUnion
  2175. {
  2176. int intValue;
  2177. bool boolValue;
  2178. double doubleValue;
  2179. String* stringValue;
  2180. DynamicObject* objectValue;
  2181. MethodFunction methodValue;
  2182. };
  2183. Type type;
  2184. ValueUnion value;
  2185. };
  2186. bool operator== (const var& v1, const var& v2) throw();
  2187. bool operator!= (const var& v1, const var& v2) throw();
  2188. bool operator== (const var& v1, const String& v2) throw();
  2189. bool operator!= (const var& v1, const String& v2) throw();
  2190. #endif // __JUCE_VARIANT_JUCEHEADER__
  2191. /*** End of inlined file: juce_Variant.h ***/
  2192. class JUCE_API NamedValueSet
  2193. {
  2194. public:
  2195. NamedValueSet() throw();
  2196. NamedValueSet (const NamedValueSet& other);
  2197. NamedValueSet& operator= (const NamedValueSet& other);
  2198. ~NamedValueSet();
  2199. int size() const throw();
  2200. const var& operator[] (const var::identifier& name) const;
  2201. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2202. var* getItem (const var::identifier& name) const;
  2203. bool set (const var::identifier& name, const var& newValue);
  2204. bool contains (const var::identifier& name) const;
  2205. bool remove (const var::identifier& name);
  2206. const var::identifier getName (int index) const;
  2207. void clear();
  2208. juce_UseDebuggingNewOperator
  2209. private:
  2210. struct NamedValue
  2211. {
  2212. NamedValue() throw();
  2213. NamedValue (const var::identifier& name, const var& value);
  2214. var::identifier name;
  2215. var value;
  2216. };
  2217. Array <NamedValue> values;
  2218. };
  2219. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2220. /*** End of inlined file: juce_NamedValueSet.h ***/
  2221. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2222. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2223. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2224. /*** Start of inlined file: juce_Atomic.h ***/
  2225. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2226. #define __JUCE_ATOMIC_JUCEHEADER__
  2227. class JUCE_API Atomic
  2228. {
  2229. public:
  2230. static void increment (int32& variable);
  2231. static int32 incrementAndReturn (int32& variable);
  2232. static void decrement (int32& variable);
  2233. static int32 decrementAndReturn (int32& variable);
  2234. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2235. static void* swapPointers (void* volatile* value1, void* value2);
  2236. };
  2237. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2238. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2239. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2240. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2241. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2242. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2243. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2244. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2245. {
  2246. void* currentVal = *value1;
  2247. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2248. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2249. #else
  2250. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2251. #endif
  2252. return currentVal;
  2253. }
  2254. #elif JUCE_LINUX // Linux...
  2255. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2256. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2257. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2258. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2259. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2260. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2261. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2262. {
  2263. void* currentVal = *value1;
  2264. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2265. return currentVal;
  2266. }
  2267. #elif JUCE_USE_INTRINSICS // Windows...
  2268. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2269. // declared in juce_win32_Threads.cpp)
  2270. #pragma intrinsic (_InterlockedIncrement)
  2271. #pragma intrinsic (_InterlockedDecrement)
  2272. #pragma intrinsic (_InterlockedCompareExchange)
  2273. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2274. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2275. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2276. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2277. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2278. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2279. #endif
  2280. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2281. /*** End of inlined file: juce_Atomic.h ***/
  2282. class JUCE_API ReferenceCountedObject
  2283. {
  2284. public:
  2285. inline void incReferenceCount() throw()
  2286. {
  2287. Atomic::increment (refCounts);
  2288. jassert (refCounts > 0);
  2289. }
  2290. inline void decReferenceCount() throw()
  2291. {
  2292. jassert (refCounts > 0);
  2293. if (Atomic::decrementAndReturn (refCounts) == 0)
  2294. delete this;
  2295. }
  2296. inline int getReferenceCount() const throw()
  2297. {
  2298. return refCounts;
  2299. }
  2300. protected:
  2301. ReferenceCountedObject()
  2302. : refCounts (0)
  2303. {
  2304. }
  2305. virtual ~ReferenceCountedObject()
  2306. {
  2307. // it's dangerous to delete an object that's still referenced by something else!
  2308. jassert (refCounts == 0);
  2309. }
  2310. private:
  2311. int refCounts;
  2312. };
  2313. template <class ReferenceCountedObjectClass>
  2314. class ReferenceCountedObjectPtr
  2315. {
  2316. public:
  2317. inline ReferenceCountedObjectPtr() throw()
  2318. : referencedObject (0)
  2319. {
  2320. }
  2321. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2322. : referencedObject (refCountedObject)
  2323. {
  2324. if (refCountedObject != 0)
  2325. refCountedObject->incReferenceCount();
  2326. }
  2327. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2328. : referencedObject (other.referencedObject)
  2329. {
  2330. if (referencedObject != 0)
  2331. referencedObject->incReferenceCount();
  2332. }
  2333. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2334. {
  2335. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2336. if (newObject != referencedObject)
  2337. {
  2338. if (newObject != 0)
  2339. newObject->incReferenceCount();
  2340. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2341. referencedObject = newObject;
  2342. if (oldObject != 0)
  2343. oldObject->decReferenceCount();
  2344. }
  2345. return *this;
  2346. }
  2347. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2348. {
  2349. if (referencedObject != newObject)
  2350. {
  2351. if (newObject != 0)
  2352. newObject->incReferenceCount();
  2353. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2354. referencedObject = newObject;
  2355. if (oldObject != 0)
  2356. oldObject->decReferenceCount();
  2357. }
  2358. return *this;
  2359. }
  2360. inline ~ReferenceCountedObjectPtr()
  2361. {
  2362. if (referencedObject != 0)
  2363. referencedObject->decReferenceCount();
  2364. }
  2365. inline operator ReferenceCountedObjectClass*() const throw()
  2366. {
  2367. return referencedObject;
  2368. }
  2369. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2370. {
  2371. return referencedObject == object;
  2372. }
  2373. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2374. {
  2375. return referencedObject != object;
  2376. }
  2377. // the -> operator is called on the referenced object
  2378. inline ReferenceCountedObjectClass* operator->() const throw()
  2379. {
  2380. return referencedObject;
  2381. }
  2382. private:
  2383. ReferenceCountedObjectClass* referencedObject;
  2384. };
  2385. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2386. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2387. class JUCE_API DynamicObject : public ReferenceCountedObject
  2388. {
  2389. public:
  2390. DynamicObject();
  2391. virtual ~DynamicObject();
  2392. virtual bool hasProperty (const var::identifier& propertyName) const;
  2393. virtual const var getProperty (const var::identifier& propertyName) const;
  2394. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2395. virtual void removeProperty (const var::identifier& propertyName);
  2396. virtual bool hasMethod (const var::identifier& methodName) const;
  2397. virtual const var invokeMethod (const var::identifier& methodName,
  2398. const var* parameters,
  2399. int numParameters);
  2400. void setMethod (const var::identifier& methodName,
  2401. var::MethodFunction methodFunction);
  2402. void clear();
  2403. juce_UseDebuggingNewOperator
  2404. private:
  2405. NamedValueSet properties;
  2406. };
  2407. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2408. /*** End of inlined file: juce_DynamicObject.h ***/
  2409. #endif
  2410. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2411. #endif
  2412. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2413. #endif
  2414. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2415. #endif
  2416. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2417. #endif
  2418. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2419. /*** Start of inlined file: juce_OwnedArray.h ***/
  2420. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2421. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2422. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2423. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2424. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2425. template <class ObjectType>
  2426. class JUCE_API ScopedPointer
  2427. {
  2428. public:
  2429. inline ScopedPointer() throw() : object (0)
  2430. {
  2431. }
  2432. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2433. : object (objectToTakePossessionOf)
  2434. {
  2435. }
  2436. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2437. : object (objectToTransferFrom.object)
  2438. {
  2439. objectToTransferFrom.object = 0;
  2440. }
  2441. inline ~ScopedPointer() { delete object; }
  2442. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2443. {
  2444. if (this != objectToTransferFrom.getAddress())
  2445. {
  2446. // Two ScopedPointers should never be able to refer to the same object - if
  2447. // this happens, you must have done something dodgy!
  2448. jassert (object == 0 || object != objectToTransferFrom.object);
  2449. ObjectType* const oldObject = object;
  2450. object = objectToTransferFrom.object;
  2451. objectToTransferFrom.object = 0;
  2452. delete oldObject;
  2453. }
  2454. return *this;
  2455. }
  2456. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2457. {
  2458. if (object != newObjectToTakePossessionOf)
  2459. {
  2460. ObjectType* const oldObject = object;
  2461. object = newObjectToTakePossessionOf;
  2462. delete oldObject;
  2463. }
  2464. return *this;
  2465. }
  2466. inline operator ObjectType*() const throw() { return object; }
  2467. inline ObjectType& operator*() const throw() { return *object; }
  2468. inline ObjectType* operator->() const throw() { return object; }
  2469. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2470. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2471. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2472. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2473. {
  2474. // Two ScopedPointers should never be able to refer to the same object - if
  2475. // this happens, you must have done something dodgy!
  2476. jassert (object != other.object);
  2477. swapVariables (object, other.object);
  2478. }
  2479. private:
  2480. ObjectType* object;
  2481. // (Required as an alternative to the overloaded & operator).
  2482. const ScopedPointer* getAddress() const throw() { return this; }
  2483. };
  2484. template <class ObjectType>
  2485. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2486. {
  2487. return static_cast <ObjectType*> (pointer1) == pointer2;
  2488. }
  2489. template <class ObjectType>
  2490. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2491. {
  2492. return static_cast <ObjectType*> (pointer1) != pointer2;
  2493. }
  2494. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2495. /*** End of inlined file: juce_ScopedPointer.h ***/
  2496. template <class ObjectClass,
  2497. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2498. class OwnedArray
  2499. {
  2500. public:
  2501. OwnedArray() throw()
  2502. : numUsed (0)
  2503. {
  2504. }
  2505. ~OwnedArray()
  2506. {
  2507. clear (true);
  2508. }
  2509. void clear (const bool deleteObjects = true)
  2510. {
  2511. const ScopedLockType lock (getLock());
  2512. if (deleteObjects)
  2513. {
  2514. while (numUsed > 0)
  2515. delete data.elements [--numUsed];
  2516. }
  2517. data.setAllocatedSize (0);
  2518. numUsed = 0;
  2519. }
  2520. inline int size() const throw()
  2521. {
  2522. return numUsed;
  2523. }
  2524. inline ObjectClass* operator[] (const int index) const throw()
  2525. {
  2526. const ScopedLockType lock (getLock());
  2527. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2528. : static_cast <ObjectClass*> (0);
  2529. }
  2530. inline ObjectClass* getUnchecked (const int index) const throw()
  2531. {
  2532. const ScopedLockType lock (getLock());
  2533. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2534. return data.elements [index];
  2535. }
  2536. inline ObjectClass* getFirst() const throw()
  2537. {
  2538. const ScopedLockType lock (getLock());
  2539. return numUsed > 0 ? data.elements [0]
  2540. : static_cast <ObjectClass*> (0);
  2541. }
  2542. inline ObjectClass* getLast() const throw()
  2543. {
  2544. const ScopedLockType lock (getLock());
  2545. return numUsed > 0 ? data.elements [numUsed - 1]
  2546. : static_cast <ObjectClass*> (0);
  2547. }
  2548. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2549. {
  2550. const ScopedLockType lock (getLock());
  2551. ObjectClass* const* e = data.elements.getData();
  2552. ObjectClass* const* const end = e + numUsed;
  2553. while (e != end)
  2554. {
  2555. if (objectToLookFor == *e)
  2556. return static_cast <int> (e - data.elements.getData());
  2557. ++e;
  2558. }
  2559. return -1;
  2560. }
  2561. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2562. {
  2563. const ScopedLockType lock (getLock());
  2564. ObjectClass* const* e = data.elements.getData();
  2565. ObjectClass* const* const end = e + numUsed;
  2566. while (e != end)
  2567. {
  2568. if (objectToLookFor == *e)
  2569. return true;
  2570. ++e;
  2571. }
  2572. return false;
  2573. }
  2574. void add (const ObjectClass* const newObject) throw()
  2575. {
  2576. const ScopedLockType lock (getLock());
  2577. data.ensureAllocatedSize (numUsed + 1);
  2578. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2579. }
  2580. void insert (int indexToInsertAt,
  2581. const ObjectClass* const newObject) throw()
  2582. {
  2583. if (indexToInsertAt >= 0)
  2584. {
  2585. const ScopedLockType lock (getLock());
  2586. if (indexToInsertAt > numUsed)
  2587. indexToInsertAt = numUsed;
  2588. data.ensureAllocatedSize (numUsed + 1);
  2589. ObjectClass** const e = data.elements + indexToInsertAt;
  2590. const int numToMove = numUsed - indexToInsertAt;
  2591. if (numToMove > 0)
  2592. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2593. *e = const_cast <ObjectClass*> (newObject);
  2594. ++numUsed;
  2595. }
  2596. else
  2597. {
  2598. add (newObject);
  2599. }
  2600. }
  2601. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2602. {
  2603. const ScopedLockType lock (getLock());
  2604. if (! contains (newObject))
  2605. add (newObject);
  2606. }
  2607. void set (const int indexToChange,
  2608. const ObjectClass* const newObject,
  2609. const bool deleteOldElement = true)
  2610. {
  2611. if (indexToChange >= 0)
  2612. {
  2613. ScopedPointer <ObjectClass> toDelete;
  2614. const ScopedLockType lock (getLock());
  2615. if (indexToChange < numUsed)
  2616. {
  2617. if (deleteOldElement)
  2618. {
  2619. toDelete = data.elements [indexToChange];
  2620. if (toDelete == newObject)
  2621. toDelete = 0;
  2622. }
  2623. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2624. }
  2625. else
  2626. {
  2627. data.ensureAllocatedSize (numUsed + 1);
  2628. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2629. }
  2630. }
  2631. }
  2632. template <class OtherArrayType>
  2633. void addArray (const OtherArrayType& arrayToAddFrom,
  2634. int startIndex = 0,
  2635. int numElementsToAdd = -1)
  2636. {
  2637. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2638. const ScopedLockType lock2 (getLock());
  2639. if (startIndex < 0)
  2640. {
  2641. jassertfalse
  2642. startIndex = 0;
  2643. }
  2644. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2645. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2646. while (--numElementsToAdd >= 0)
  2647. add (arrayToAddFrom.getUnchecked (startIndex++));
  2648. }
  2649. template <class ElementComparator>
  2650. void addSorted (ElementComparator& comparator,
  2651. ObjectClass* const newObject) throw()
  2652. {
  2653. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2654. // avoids getting warning messages about the parameter being unused
  2655. const ScopedLockType lock (getLock());
  2656. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2657. }
  2658. template <class ElementComparator>
  2659. int indexOfSorted (ElementComparator& comparator,
  2660. const ObjectClass* const objectToLookFor) const throw()
  2661. {
  2662. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2663. // avoids getting warning messages about the parameter being unused
  2664. const ScopedLockType lock (getLock());
  2665. int start = 0;
  2666. int end = numUsed;
  2667. for (;;)
  2668. {
  2669. if (start >= end)
  2670. {
  2671. return -1;
  2672. }
  2673. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2674. {
  2675. return start;
  2676. }
  2677. else
  2678. {
  2679. const int halfway = (start + end) >> 1;
  2680. if (halfway == start)
  2681. return -1;
  2682. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2683. start = halfway;
  2684. else
  2685. end = halfway;
  2686. }
  2687. }
  2688. }
  2689. void remove (const int indexToRemove,
  2690. const bool deleteObject = true)
  2691. {
  2692. ScopedPointer <ObjectClass> toDelete;
  2693. const ScopedLockType lock (getLock());
  2694. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2695. {
  2696. ObjectClass** const e = data.elements + indexToRemove;
  2697. if (deleteObject)
  2698. toDelete = *e;
  2699. --numUsed;
  2700. const int numToShift = numUsed - indexToRemove;
  2701. if (numToShift > 0)
  2702. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2703. if ((numUsed << 1) < data.numAllocated)
  2704. minimiseStorageOverheads();
  2705. }
  2706. }
  2707. void removeObject (const ObjectClass* const objectToRemove,
  2708. const bool deleteObject = true)
  2709. {
  2710. const ScopedLockType lock (getLock());
  2711. ObjectClass** e = data.elements.getData();
  2712. for (int i = numUsed; --i >= 0;)
  2713. {
  2714. if (objectToRemove == *e)
  2715. {
  2716. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2717. break;
  2718. }
  2719. ++e;
  2720. }
  2721. }
  2722. void removeRange (int startIndex,
  2723. const int numberToRemove,
  2724. const bool deleteObjects = true)
  2725. {
  2726. const ScopedLockType lock (getLock());
  2727. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2728. startIndex = jlimit (0, numUsed, startIndex);
  2729. if (endIndex > startIndex)
  2730. {
  2731. if (deleteObjects)
  2732. {
  2733. for (int i = startIndex; i < endIndex; ++i)
  2734. {
  2735. delete data.elements [i];
  2736. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2737. }
  2738. }
  2739. const int rangeSize = endIndex - startIndex;
  2740. ObjectClass** e = data.elements + startIndex;
  2741. int numToShift = numUsed - endIndex;
  2742. numUsed -= rangeSize;
  2743. while (--numToShift >= 0)
  2744. {
  2745. *e = e [rangeSize];
  2746. ++e;
  2747. }
  2748. if ((numUsed << 1) < data.numAllocated)
  2749. minimiseStorageOverheads();
  2750. }
  2751. }
  2752. void removeLast (int howManyToRemove = 1,
  2753. const bool deleteObjects = true)
  2754. {
  2755. const ScopedLockType lock (getLock());
  2756. if (howManyToRemove >= numUsed)
  2757. {
  2758. clear (deleteObjects);
  2759. }
  2760. else
  2761. {
  2762. while (--howManyToRemove >= 0)
  2763. remove (numUsed - 1, deleteObjects);
  2764. }
  2765. }
  2766. void swap (const int index1,
  2767. const int index2) throw()
  2768. {
  2769. const ScopedLockType lock (getLock());
  2770. if (((unsigned int) index1) < (unsigned int) numUsed
  2771. && ((unsigned int) index2) < (unsigned int) numUsed)
  2772. {
  2773. swapVariables (data.elements [index1],
  2774. data.elements [index2]);
  2775. }
  2776. }
  2777. void move (const int currentIndex,
  2778. int newIndex) throw()
  2779. {
  2780. if (currentIndex != newIndex)
  2781. {
  2782. const ScopedLockType lock (getLock());
  2783. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2784. {
  2785. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2786. newIndex = numUsed - 1;
  2787. ObjectClass* const value = data.elements [currentIndex];
  2788. if (newIndex > currentIndex)
  2789. {
  2790. memmove (data.elements + currentIndex,
  2791. data.elements + currentIndex + 1,
  2792. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2793. }
  2794. else
  2795. {
  2796. memmove (data.elements + newIndex + 1,
  2797. data.elements + newIndex,
  2798. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2799. }
  2800. data.elements [newIndex] = value;
  2801. }
  2802. }
  2803. }
  2804. void swapWithArray (OwnedArray& otherArray) throw()
  2805. {
  2806. const ScopedLockType lock1 (getLock());
  2807. const ScopedLockType lock2 (otherArray.getLock());
  2808. data.swapWith (otherArray.data);
  2809. swapVariables (numUsed, otherArray.numUsed);
  2810. }
  2811. void minimiseStorageOverheads() throw()
  2812. {
  2813. const ScopedLockType lock (getLock());
  2814. data.shrinkToNoMoreThan (numUsed);
  2815. }
  2816. void ensureStorageAllocated (const int minNumElements) throw()
  2817. {
  2818. const ScopedLockType lock (getLock());
  2819. data.ensureAllocatedSize (minNumElements);
  2820. }
  2821. template <class ElementComparator>
  2822. void sort (ElementComparator& comparator,
  2823. const bool retainOrderOfEquivalentItems = false) const throw()
  2824. {
  2825. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2826. // avoids getting warning messages about the parameter being unused
  2827. const ScopedLockType lock (getLock());
  2828. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2829. }
  2830. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2831. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2832. juce_UseDebuggingNewOperator
  2833. private:
  2834. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2835. int numUsed;
  2836. // disallow copy constructor and assignment
  2837. OwnedArray (const OwnedArray&);
  2838. OwnedArray& operator= (const OwnedArray&);
  2839. };
  2840. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2841. /*** End of inlined file: juce_OwnedArray.h ***/
  2842. #endif
  2843. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2844. /*** Start of inlined file: juce_PropertySet.h ***/
  2845. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2846. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2847. /*** Start of inlined file: juce_StringPairArray.h ***/
  2848. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2849. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2850. /*** Start of inlined file: juce_StringArray.h ***/
  2851. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2852. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2853. #ifndef DOXYGEN
  2854. // (used in StringArray::appendNumbersToDuplicates)
  2855. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2856. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2857. #endif
  2858. class JUCE_API StringArray
  2859. {
  2860. public:
  2861. StringArray() throw();
  2862. StringArray (const StringArray& other);
  2863. StringArray (const juce_wchar** const strings,
  2864. const int numberOfStrings);
  2865. StringArray (const char** const strings,
  2866. const int numberOfStrings);
  2867. explicit StringArray (const juce_wchar** const strings);
  2868. explicit StringArray (const char** const strings);
  2869. ~StringArray();
  2870. StringArray& operator= (const StringArray& other);
  2871. bool operator== (const StringArray& other) const;
  2872. bool operator!= (const StringArray& other) const;
  2873. inline int size() const throw() { return strings.size(); };
  2874. const String& operator[] (const int index) const throw();
  2875. bool contains (const String& stringToLookFor,
  2876. const bool ignoreCase = false) const;
  2877. int indexOf (const String& stringToLookFor,
  2878. const bool ignoreCase = false,
  2879. int startIndex = 0) const;
  2880. void add (const String& stringToAdd);
  2881. void insert (const int index, const String& stringToAdd);
  2882. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2883. void set (const int index, const String& newString);
  2884. void addArray (const StringArray& other,
  2885. int startIndex = 0,
  2886. int numElementsToAdd = -1);
  2887. int addTokens (const String& stringToTokenise,
  2888. const bool preserveQuotedStrings);
  2889. int addTokens (const String& stringToTokenise,
  2890. const String& breakCharacters,
  2891. const String& quoteCharacters);
  2892. int addLines (const String& stringToBreakUp);
  2893. void clear();
  2894. void remove (const int index);
  2895. void removeString (const String& stringToRemove,
  2896. const bool ignoreCase = false);
  2897. void removeDuplicates (const bool ignoreCase);
  2898. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2899. void move (const int currentIndex, int newIndex) throw();
  2900. void trim();
  2901. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2902. const bool appendNumberToFirstInstance,
  2903. const tchar* const preNumberString = defaultPreNumberString,
  2904. const tchar* const postNumberString = defaultPostNumberString);
  2905. const String joinIntoString (const String& separatorString,
  2906. int startIndex = 0,
  2907. int numberOfElements = -1) const;
  2908. void sort (const bool ignoreCase);
  2909. void minimiseStorageOverheads();
  2910. juce_UseDebuggingNewOperator
  2911. private:
  2912. Array <String> strings;
  2913. };
  2914. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2915. /*** End of inlined file: juce_StringArray.h ***/
  2916. class JUCE_API StringPairArray
  2917. {
  2918. public:
  2919. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2920. StringPairArray (const StringPairArray& other) throw();
  2921. ~StringPairArray() throw();
  2922. StringPairArray& operator= (const StringPairArray& other) throw();
  2923. bool operator== (const StringPairArray& other) const throw();
  2924. bool operator!= (const StringPairArray& other) const throw();
  2925. const String& operator[] (const String& key) const throw();
  2926. const String getValue (const String& key, const String& defaultReturnValue) const;
  2927. const StringArray& getAllKeys() const throw() { return keys; }
  2928. const StringArray& getAllValues() const throw() { return values; }
  2929. inline int size() const throw() { return keys.size(); };
  2930. void set (const String& key,
  2931. const String& value) throw();
  2932. void addArray (const StringPairArray& other);
  2933. void clear() throw();
  2934. void remove (const String& key) throw();
  2935. void remove (const int index) throw();
  2936. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2937. const String getDescription() const;
  2938. void minimiseStorageOverheads() throw();
  2939. juce_UseDebuggingNewOperator
  2940. private:
  2941. StringArray keys, values;
  2942. bool ignoreCase;
  2943. };
  2944. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2945. /*** End of inlined file: juce_StringPairArray.h ***/
  2946. /*** Start of inlined file: juce_XmlElement.h ***/
  2947. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  2948. #define __JUCE_XMLELEMENT_JUCEHEADER__
  2949. /*** Start of inlined file: juce_File.h ***/
  2950. #ifndef __JUCE_FILE_JUCEHEADER__
  2951. #define __JUCE_FILE_JUCEHEADER__
  2952. /*** Start of inlined file: juce_Time.h ***/
  2953. #ifndef __JUCE_TIME_JUCEHEADER__
  2954. #define __JUCE_TIME_JUCEHEADER__
  2955. /*** Start of inlined file: juce_RelativeTime.h ***/
  2956. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  2957. #define __JUCE_RELATIVETIME_JUCEHEADER__
  2958. class JUCE_API RelativeTime
  2959. {
  2960. public:
  2961. explicit RelativeTime (const double seconds = 0.0) throw();
  2962. RelativeTime (const RelativeTime& other) throw();
  2963. RelativeTime& operator= (const RelativeTime& other) throw();
  2964. ~RelativeTime() throw();
  2965. static const RelativeTime milliseconds (const int milliseconds) throw();
  2966. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  2967. static const RelativeTime minutes (const double numberOfMinutes) throw();
  2968. static const RelativeTime hours (const double numberOfHours) throw();
  2969. static const RelativeTime days (const double numberOfDays) throw();
  2970. static const RelativeTime weeks (const double numberOfWeeks) throw();
  2971. int64 inMilliseconds() const throw();
  2972. double inSeconds() const throw() { return seconds; }
  2973. double inMinutes() const throw();
  2974. double inHours() const throw();
  2975. double inDays() const throw();
  2976. double inWeeks() const throw();
  2977. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) 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. bool operator< (const RelativeTime& other) const throw();
  2982. bool operator>= (const RelativeTime& other) const throw();
  2983. bool operator<= (const RelativeTime& other) const throw();
  2984. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  2985. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  2986. const RelativeTime operator+ (const double secondsToAdd) const throw();
  2987. const RelativeTime operator- (const double secondsToSubtract) const throw();
  2988. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  2989. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  2990. const RelativeTime& operator+= (const double secondsToAdd) throw();
  2991. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  2992. juce_UseDebuggingNewOperator
  2993. private:
  2994. double seconds;
  2995. };
  2996. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  2997. /*** End of inlined file: juce_RelativeTime.h ***/
  2998. class JUCE_API Time
  2999. {
  3000. public:
  3001. Time() throw();
  3002. Time (const Time& other) throw();
  3003. Time (int64 millisecondsSinceEpoch) throw();
  3004. Time (int year,
  3005. int month,
  3006. int day,
  3007. int hours,
  3008. int minutes,
  3009. int seconds = 0,
  3010. int milliseconds = 0,
  3011. bool useLocalTime = true) throw();
  3012. ~Time() throw();
  3013. Time& operator= (const Time& other) throw();
  3014. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3015. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3016. int getYear() const throw();
  3017. int getMonth() const throw();
  3018. const String getMonthName (bool threeLetterVersion) const throw();
  3019. int getDayOfMonth() const throw();
  3020. int getDayOfWeek() const throw();
  3021. const String getWeekdayName (bool threeLetterVersion) const throw();
  3022. int getHours() const throw();
  3023. bool isAfternoon() const throw();
  3024. int getHoursInAmPmFormat() const throw();
  3025. int getMinutes() const throw();
  3026. int getSeconds() const throw();
  3027. int getMilliseconds() const throw();
  3028. bool isDaylightSavingTime() const throw();
  3029. const String getTimeZone() const throw();
  3030. const String toString (bool includeDate,
  3031. bool includeTime,
  3032. bool includeSeconds = true,
  3033. bool use24HourClock = false) const throw();
  3034. const String formatted (const juce_wchar* format) const throw();
  3035. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3036. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3037. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (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 operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3042. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3043. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3044. bool setSystemTimeToThisTime() const throw();
  3045. static const String getWeekdayName (int dayNumber,
  3046. bool threeLetterVersion) throw();
  3047. static const String getMonthName (int monthNumber,
  3048. bool threeLetterVersion) throw();
  3049. // Static methods for getting system timers directly..
  3050. static int64 currentTimeMillis() throw();
  3051. static uint32 getMillisecondCounter() throw();
  3052. static double getMillisecondCounterHiRes() throw();
  3053. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3054. static uint32 getApproximateMillisecondCounter() throw();
  3055. // High-resolution timers..
  3056. static int64 getHighResolutionTicks() throw();
  3057. static int64 getHighResolutionTicksPerSecond() throw();
  3058. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3059. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3060. private:
  3061. int64 millisSinceEpoch;
  3062. };
  3063. #endif // __JUCE_TIME_JUCEHEADER__
  3064. /*** End of inlined file: juce_Time.h ***/
  3065. class FileInputStream;
  3066. class FileOutputStream;
  3067. class JUCE_API File
  3068. {
  3069. public:
  3070. File() {}
  3071. File (const String& path);
  3072. File (const File& other);
  3073. ~File() {}
  3074. File& operator= (const String& newFilePath);
  3075. File& operator= (const File& otherFile);
  3076. static const File nonexistent;
  3077. bool exists() const;
  3078. bool existsAsFile() const;
  3079. bool isDirectory() const;
  3080. int64 getSize() const;
  3081. static const String descriptionOfSizeInBytes (const int64 bytes);
  3082. const String& getFullPathName() const throw() { return fullPath; }
  3083. const String getFileName() const;
  3084. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3085. const String getFileExtension() const;
  3086. bool hasFileExtension (const String& extensionToTest) const;
  3087. const File withFileExtension (const String& newExtension) const;
  3088. const String getFileNameWithoutExtension() const;
  3089. int hashCode() const;
  3090. int64 hashCode64() const;
  3091. const File getChildFile (String relativePath) const;
  3092. const File getSiblingFile (const String& siblingFileName) const;
  3093. const File getParentDirectory() const;
  3094. bool isAChildOf (const File& potentialParentDirectory) const;
  3095. const File getNonexistentChildFile (const String& prefix,
  3096. const String& suffix,
  3097. bool putNumbersInBrackets = true) const;
  3098. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3099. bool operator== (const File& otherFile) const;
  3100. bool operator!= (const File& otherFile) const;
  3101. bool hasWriteAccess() const;
  3102. bool setReadOnly (const bool shouldBeReadOnly,
  3103. const bool applyRecursively = false) const;
  3104. bool isHidden() const;
  3105. const File getLinkedTarget() const;
  3106. const Time getLastModificationTime() const;
  3107. const Time getLastAccessTime() const;
  3108. const Time getCreationTime() const;
  3109. bool setLastModificationTime (const Time& newTime) const;
  3110. bool setLastAccessTime (const Time& newTime) const;
  3111. bool setCreationTime (const Time& newTime) const;
  3112. const String getVersion() const;
  3113. bool create() const;
  3114. bool createDirectory() const;
  3115. bool deleteFile() const;
  3116. bool deleteRecursively() const;
  3117. bool moveToTrash() const;
  3118. bool moveFileTo (const File& targetLocation) const;
  3119. bool copyFileTo (const File& targetLocation) const;
  3120. bool copyDirectoryTo (const File& newDirectory) const;
  3121. enum TypesOfFileToFind
  3122. {
  3123. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3124. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3125. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3126. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3127. };
  3128. int findChildFiles (Array<File>& results,
  3129. const int whatToLookFor,
  3130. const bool searchRecursively,
  3131. const String& wildCardPattern = JUCE_T("*")) const;
  3132. int getNumberOfChildFiles (const int whatToLookFor,
  3133. const String& wildCardPattern = JUCE_T("*")) const;
  3134. bool containsSubDirectories() const;
  3135. FileInputStream* createInputStream() const;
  3136. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3137. bool loadFileAsData (MemoryBlock& result) const;
  3138. const String loadFileAsString() const;
  3139. bool appendData (const void* const dataToAppend,
  3140. const int numberOfBytes) const;
  3141. bool replaceWithData (const void* const dataToWrite,
  3142. const int numberOfBytes) const;
  3143. bool appendText (const String& textToAppend,
  3144. const bool asUnicode = false,
  3145. const bool writeUnicodeHeaderBytes = false) const;
  3146. bool replaceWithText (const String& textToWrite,
  3147. const bool asUnicode = false,
  3148. const bool writeUnicodeHeaderBytes = false) const;
  3149. static void findFileSystemRoots (Array<File>& results);
  3150. const String getVolumeLabel() const;
  3151. int getVolumeSerialNumber() const;
  3152. int64 getBytesFreeOnVolume() const;
  3153. int64 getVolumeTotalSize() const;
  3154. bool isOnCDRomDrive() const;
  3155. bool isOnHardDisk() const;
  3156. bool isOnRemovableDrive() const;
  3157. bool startAsProcess (const String& parameters = String::empty) const;
  3158. void revealToUser() const;
  3159. enum SpecialLocationType
  3160. {
  3161. userHomeDirectory,
  3162. userDocumentsDirectory,
  3163. userDesktopDirectory,
  3164. userApplicationDataDirectory,
  3165. commonApplicationDataDirectory,
  3166. tempDirectory,
  3167. currentExecutableFile,
  3168. currentApplicationFile,
  3169. invokedExecutableFile,
  3170. globalApplicationsDirectory,
  3171. userMusicDirectory,
  3172. userMoviesDirectory,
  3173. };
  3174. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3175. static const File createTempFile (const String& fileNameEnding);
  3176. static const File getCurrentWorkingDirectory();
  3177. bool setAsCurrentWorkingDirectory() const;
  3178. static const tchar separator;
  3179. static const tchar* separatorString;
  3180. static const String createLegalFileName (const String& fileNameToFix);
  3181. static const String createLegalPathName (const String& pathNameToFix);
  3182. static bool areFileNamesCaseSensitive();
  3183. static bool isAbsolutePath (const String& path);
  3184. static const File createFileWithoutCheckingPath (const String& path);
  3185. juce_UseDebuggingNewOperator
  3186. private:
  3187. String fullPath;
  3188. // internal way of contructing a file without checking the path
  3189. friend class DirectoryIterator;
  3190. File (const String&, int);
  3191. const String getPathUpToLastSlash() const;
  3192. };
  3193. #endif // __JUCE_FILE_JUCEHEADER__
  3194. /*** End of inlined file: juce_File.h ***/
  3195. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3196. \
  3197. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3198. childElementVariableName != 0; \
  3199. childElementVariableName = childElementVariableName->getNextElement())
  3200. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3201. \
  3202. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3203. childElementVariableName != 0; \
  3204. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3205. class JUCE_API XmlElement
  3206. {
  3207. public:
  3208. XmlElement (const String& tagName) throw();
  3209. XmlElement (const XmlElement& other) throw();
  3210. XmlElement& operator= (const XmlElement& other) throw();
  3211. ~XmlElement() throw();
  3212. bool isEquivalentTo (const XmlElement* const other,
  3213. const bool ignoreOrderOfAttributes) const throw();
  3214. const String createDocument (const String& dtdToUse,
  3215. const bool allOnOneLine = false,
  3216. const bool includeXmlHeader = true,
  3217. const String& encodingType = JUCE_T("UTF-8"),
  3218. const int lineWrapLength = 60) const;
  3219. void writeToStream (OutputStream& output,
  3220. const String& dtdToUse,
  3221. const bool allOnOneLine = false,
  3222. const bool includeXmlHeader = true,
  3223. const String& encodingType = JUCE_T("UTF-8"),
  3224. const int lineWrapLength = 60) const;
  3225. bool writeToFile (const File& destinationFile,
  3226. const String& dtdToUse,
  3227. const String& encodingType = JUCE_T("UTF-8"),
  3228. const int lineWrapLength = 60) const;
  3229. inline const String& getTagName() const throw() { return tagName; }
  3230. bool hasTagName (const String& possibleTagName) const throw();
  3231. int getNumAttributes() const throw();
  3232. const String& getAttributeName (const int attributeIndex) const throw();
  3233. const String& getAttributeValue (const int attributeIndex) const throw();
  3234. // Attribute-handling methods..
  3235. bool hasAttribute (const String& attributeName) const throw();
  3236. const String& getStringAttribute (const String& attributeName) const throw();
  3237. const String getStringAttribute (const String& attributeName,
  3238. const String& defaultReturnValue) const;
  3239. bool compareAttribute (const String& attributeName,
  3240. const String& stringToCompareAgainst,
  3241. const bool ignoreCase = false) const throw();
  3242. int getIntAttribute (const String& attributeName,
  3243. const int defaultReturnValue = 0) const;
  3244. double getDoubleAttribute (const String& attributeName,
  3245. const double defaultReturnValue = 0.0) const;
  3246. bool getBoolAttribute (const String& attributeName,
  3247. const bool defaultReturnValue = false) const;
  3248. void setAttribute (const String& attributeName,
  3249. const String& newValue);
  3250. void setAttribute (const String& attributeName,
  3251. const int newValue);
  3252. void setAttribute (const String& attributeName,
  3253. const double newValue);
  3254. void removeAttribute (const String& attributeName) throw();
  3255. void removeAllAttributes() throw();
  3256. // Child element methods..
  3257. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3258. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3259. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3260. int getNumChildElements() const throw();
  3261. XmlElement* getChildElement (const int index) const throw();
  3262. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3263. void addChildElement (XmlElement* const newChildElement) throw();
  3264. void insertChildElement (XmlElement* const newChildNode,
  3265. int indexToInsertAt) throw();
  3266. XmlElement* createNewChildElement (const String& tagName);
  3267. bool replaceChildElement (XmlElement* const currentChildElement,
  3268. XmlElement* const newChildNode) throw();
  3269. void removeChildElement (XmlElement* const childToRemove,
  3270. const bool shouldDeleteTheChild) throw();
  3271. void deleteAllChildElements() throw();
  3272. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3273. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3274. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3275. template <class ElementComparator>
  3276. void sortChildElements (ElementComparator& comparator,
  3277. const bool retainOrderOfEquivalentItems = false) throw()
  3278. {
  3279. const int num = getNumChildElements();
  3280. if (num > 1)
  3281. {
  3282. HeapBlock <XmlElement*> elems (num);
  3283. getChildElementsAsArray (elems);
  3284. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3285. reorderChildElements (elems, num);
  3286. }
  3287. }
  3288. bool isTextElement() const throw();
  3289. const String getText() const throw();
  3290. void setText (const String& newText) throw();
  3291. const String getAllSubText() const throw();
  3292. const String getChildElementAllSubText (const String& childTagName,
  3293. const String& defaultReturnValue) const throw();
  3294. void addTextElement (const String& text) throw();
  3295. void deleteAllTextElements() throw();
  3296. static XmlElement* createTextElement (const String& text) throw();
  3297. juce_UseDebuggingNewOperator
  3298. private:
  3299. friend class XmlDocument;
  3300. String tagName;
  3301. XmlElement* firstChildElement;
  3302. XmlElement* nextElement;
  3303. struct XmlAttributeNode
  3304. {
  3305. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3306. XmlAttributeNode (const String& name, const String& value) throw();
  3307. String name, value;
  3308. XmlAttributeNode* next;
  3309. private:
  3310. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3311. };
  3312. XmlAttributeNode* attributes;
  3313. XmlElement (int) throw(); // for internal use
  3314. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3315. void writeElementAsText (OutputStream& out,
  3316. const int indentationLevel,
  3317. const int lineWrapLength) const;
  3318. void getChildElementsAsArray (XmlElement**) const throw();
  3319. void reorderChildElements (XmlElement** const, const int) throw();
  3320. };
  3321. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3322. /*** End of inlined file: juce_XmlElement.h ***/
  3323. class JUCE_API PropertySet
  3324. {
  3325. public:
  3326. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3327. PropertySet (const PropertySet& other) throw();
  3328. PropertySet& operator= (const PropertySet& other) throw();
  3329. virtual ~PropertySet();
  3330. const String getValue (const String& keyName,
  3331. const String& defaultReturnValue = String::empty) const throw();
  3332. int getIntValue (const String& keyName,
  3333. const int defaultReturnValue = 0) const throw();
  3334. double getDoubleValue (const String& keyName,
  3335. const double defaultReturnValue = 0.0) const throw();
  3336. bool getBoolValue (const String& keyName,
  3337. const bool defaultReturnValue = false) const throw();
  3338. XmlElement* getXmlValue (const String& keyName) const;
  3339. void setValue (const String& keyName, const String& value) throw();
  3340. void setValue (const String& keyName, const tchar* const value) throw();
  3341. void setValue (const String& keyName, const int value) throw();
  3342. void setValue (const String& keyName, const double value) throw();
  3343. void setValue (const String& keyName, const bool value) throw();
  3344. void setValue (const String& keyName, const XmlElement* const xml);
  3345. void removeValue (const String& keyName) throw();
  3346. bool containsKey (const String& keyName) const throw();
  3347. void clear();
  3348. StringPairArray& getAllProperties() throw() { return properties; }
  3349. const CriticalSection& getLock() const throw() { return lock; }
  3350. XmlElement* createXml (const String& nodeName) const throw();
  3351. void restoreFromXml (const XmlElement& xml) throw();
  3352. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3353. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3354. juce_UseDebuggingNewOperator
  3355. protected:
  3356. virtual void propertyChanged();
  3357. private:
  3358. StringPairArray properties;
  3359. PropertySet* fallbackProperties;
  3360. CriticalSection lock;
  3361. bool ignoreCaseOfKeys;
  3362. };
  3363. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3364. /*** End of inlined file: juce_PropertySet.h ***/
  3365. #endif
  3366. #ifndef __JUCE_RANGE_JUCEHEADER__
  3367. /*** Start of inlined file: juce_Range.h ***/
  3368. #ifndef __JUCE_RANGE_JUCEHEADER__
  3369. #define __JUCE_RANGE_JUCEHEADER__
  3370. template <typename ValueType>
  3371. class Range
  3372. {
  3373. public:
  3374. Range() throw()
  3375. : start (ValueType()), end (ValueType())
  3376. {
  3377. }
  3378. Range (const ValueType start_, const ValueType end_) throw()
  3379. : start (start_), end (jmax (start_, end_))
  3380. {
  3381. }
  3382. Range (const Range& other) throw()
  3383. : start (other.start), end (other.end)
  3384. {
  3385. }
  3386. Range& operator= (const Range& other) throw()
  3387. {
  3388. start = other.start;
  3389. end = other.end;
  3390. return *this;
  3391. }
  3392. ~Range() throw()
  3393. {
  3394. }
  3395. static const Range between (const ValueType position1, const ValueType position2) throw()
  3396. {
  3397. return (position1 < position2) ? Range (position1, position2)
  3398. : Range (position2, position1);
  3399. }
  3400. static const Range emptyRange (const ValueType start) throw()
  3401. {
  3402. return Range (start, start);
  3403. }
  3404. inline ValueType getStart() const throw() { return start; }
  3405. inline ValueType getLength() const throw() { return end - start; }
  3406. inline ValueType getEnd() const throw() { return end; }
  3407. inline bool isEmpty() const throw() { return start == end; }
  3408. void setStart (const ValueType newStart) throw()
  3409. {
  3410. start = newStart;
  3411. if (newStart > end)
  3412. end = newStart;
  3413. }
  3414. const Range withStart (const ValueType newStart) const throw()
  3415. {
  3416. return Range (newStart, jmax (newStart, end));
  3417. }
  3418. void setEnd (const ValueType newEnd) throw()
  3419. {
  3420. end = newEnd;
  3421. if (newEnd < start)
  3422. start = newEnd;
  3423. }
  3424. const Range withEnd (const ValueType newEnd) const throw()
  3425. {
  3426. return Range (jmin (start, newEnd), newEnd);
  3427. }
  3428. void setLength (const ValueType newLength) throw()
  3429. {
  3430. end = start + jmax (ValueType(), newLength);
  3431. }
  3432. const Range withLength (const ValueType newLength) const throw()
  3433. {
  3434. return Range (start, start + newLength);
  3435. }
  3436. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3437. {
  3438. start += amountToAdd;
  3439. end += amountToAdd;
  3440. return *this;
  3441. }
  3442. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3443. {
  3444. start -= amountToSubtract;
  3445. end -= amountToSubtract;
  3446. return *this;
  3447. }
  3448. const Range operator+ (const ValueType amountToAdd) const throw()
  3449. {
  3450. return Range (start + amountToAdd, end + amountToAdd);
  3451. }
  3452. const Range operator- (const ValueType amountToSubtract) const throw()
  3453. {
  3454. return Range (start - amountToSubtract, end - amountToSubtract);
  3455. }
  3456. bool contains (const ValueType position) const throw()
  3457. {
  3458. return position >= start && position < end;
  3459. }
  3460. ValueType clipValue (const ValueType value) const throw()
  3461. {
  3462. return jlimit (start, end, value);
  3463. }
  3464. bool intersects (const Range& other) const throw()
  3465. {
  3466. return other.start < end && other.end > start;
  3467. }
  3468. const Range getIntersectionWith (const Range& other) const throw()
  3469. {
  3470. return Range (jmax (start, other.start),
  3471. jmin (end, other.end));
  3472. }
  3473. const Range getUnionWith (const Range& other) const throw()
  3474. {
  3475. return Range (jmin (start, other.start),
  3476. jmax (end, other.end));
  3477. }
  3478. juce_UseDebuggingNewOperator
  3479. private:
  3480. ValueType start, end;
  3481. };
  3482. #endif // __JUCE_RANGE_JUCEHEADER__
  3483. /*** End of inlined file: juce_Range.h ***/
  3484. #endif
  3485. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3486. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3487. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3488. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3489. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3490. class ReferenceCountedArray
  3491. {
  3492. public:
  3493. ReferenceCountedArray() throw()
  3494. : numUsed (0)
  3495. {
  3496. }
  3497. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3498. {
  3499. const ScopedLockType lock (other.getLock());
  3500. numUsed = other.numUsed;
  3501. data.setAllocatedSize (numUsed);
  3502. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3503. for (int i = numUsed; --i >= 0;)
  3504. if (data.elements[i] != 0)
  3505. data.elements[i]->incReferenceCount();
  3506. }
  3507. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3508. {
  3509. if (this != &other)
  3510. {
  3511. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3512. swapWithArray (other);
  3513. }
  3514. return *this;
  3515. }
  3516. ~ReferenceCountedArray()
  3517. {
  3518. clear();
  3519. }
  3520. void clear()
  3521. {
  3522. const ScopedLockType lock (getLock());
  3523. while (numUsed > 0)
  3524. if (data.elements [--numUsed] != 0)
  3525. data.elements [numUsed]->decReferenceCount();
  3526. jassert (numUsed == 0);
  3527. data.setAllocatedSize (0);
  3528. }
  3529. inline int size() const throw()
  3530. {
  3531. return numUsed;
  3532. }
  3533. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3534. {
  3535. const ScopedLockType lock (getLock());
  3536. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3537. : static_cast <ObjectClass*> (0);
  3538. }
  3539. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3540. {
  3541. const ScopedLockType lock (getLock());
  3542. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3543. return data.elements [index];
  3544. }
  3545. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3546. {
  3547. const ScopedLockType lock (getLock());
  3548. return numUsed > 0 ? data.elements [0]
  3549. : static_cast <ObjectClass*> (0);
  3550. }
  3551. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3552. {
  3553. const ScopedLockType lock (getLock());
  3554. return numUsed > 0 ? data.elements [numUsed - 1]
  3555. : static_cast <ObjectClass*> (0);
  3556. }
  3557. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3558. {
  3559. const ScopedLockType lock (getLock());
  3560. ObjectClass** e = data.elements.getData();
  3561. ObjectClass** const end = e + numUsed;
  3562. while (e != end)
  3563. {
  3564. if (objectToLookFor == *e)
  3565. return static_cast <int> (e - data.elements.getData());
  3566. ++e;
  3567. }
  3568. return -1;
  3569. }
  3570. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3571. {
  3572. const ScopedLockType lock (getLock());
  3573. ObjectClass** e = data.elements.getData();
  3574. ObjectClass** const end = e + numUsed;
  3575. while (e != end)
  3576. {
  3577. if (objectToLookFor == *e)
  3578. return true;
  3579. ++e;
  3580. }
  3581. return false;
  3582. }
  3583. void add (ObjectClass* const newObject) throw()
  3584. {
  3585. const ScopedLockType lock (getLock());
  3586. data.ensureAllocatedSize (numUsed + 1);
  3587. data.elements [numUsed++] = newObject;
  3588. if (newObject != 0)
  3589. newObject->incReferenceCount();
  3590. }
  3591. void insert (int indexToInsertAt,
  3592. ObjectClass* const newObject) throw()
  3593. {
  3594. if (indexToInsertAt >= 0)
  3595. {
  3596. const ScopedLockType lock (getLock());
  3597. if (indexToInsertAt > numUsed)
  3598. indexToInsertAt = numUsed;
  3599. data.ensureAllocatedSize (numUsed + 1);
  3600. ObjectClass** const e = data.elements + indexToInsertAt;
  3601. const int numToMove = numUsed - indexToInsertAt;
  3602. if (numToMove > 0)
  3603. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3604. *e = newObject;
  3605. if (newObject != 0)
  3606. newObject->incReferenceCount();
  3607. ++numUsed;
  3608. }
  3609. else
  3610. {
  3611. add (newObject);
  3612. }
  3613. }
  3614. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3615. {
  3616. const ScopedLockType lock (getLock());
  3617. if (! contains (newObject))
  3618. add (newObject);
  3619. }
  3620. void set (const int indexToChange,
  3621. ObjectClass* const newObject)
  3622. {
  3623. if (indexToChange >= 0)
  3624. {
  3625. const ScopedLockType lock (getLock());
  3626. if (newObject != 0)
  3627. newObject->incReferenceCount();
  3628. if (indexToChange < numUsed)
  3629. {
  3630. if (data.elements [indexToChange] != 0)
  3631. data.elements [indexToChange]->decReferenceCount();
  3632. data.elements [indexToChange] = newObject;
  3633. }
  3634. else
  3635. {
  3636. data.ensureAllocatedSize (numUsed + 1);
  3637. data.elements [numUsed++] = newObject;
  3638. }
  3639. }
  3640. }
  3641. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3642. int startIndex = 0,
  3643. int numElementsToAdd = -1) throw()
  3644. {
  3645. arrayToAddFrom.lockArray();
  3646. const ScopedLockType lock (getLock());
  3647. if (startIndex < 0)
  3648. {
  3649. jassertfalse
  3650. startIndex = 0;
  3651. }
  3652. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3653. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3654. if (numElementsToAdd > 0)
  3655. {
  3656. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3657. while (--numElementsToAdd >= 0)
  3658. add (arrayToAddFrom.getUnchecked (startIndex++));
  3659. }
  3660. arrayToAddFrom.unlockArray();
  3661. }
  3662. template <class ElementComparator>
  3663. void addSorted (ElementComparator& comparator,
  3664. ObjectClass* newObject) throw()
  3665. {
  3666. const ScopedLockType lock (getLock());
  3667. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3668. }
  3669. template <class ElementComparator>
  3670. void addOrReplaceSorted (ElementComparator& comparator,
  3671. ObjectClass* newObject) throw()
  3672. {
  3673. const ScopedLockType lock (getLock());
  3674. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3675. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3676. set (index - 1, newObject); // replace an existing object that matches
  3677. else
  3678. insert (index, newObject); // no match, so insert the new one
  3679. }
  3680. void remove (const int indexToRemove)
  3681. {
  3682. const ScopedLockType lock (getLock());
  3683. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3684. {
  3685. ObjectClass** const e = data.elements + indexToRemove;
  3686. if (*e != 0)
  3687. (*e)->decReferenceCount();
  3688. --numUsed;
  3689. const int numberToShift = numUsed - indexToRemove;
  3690. if (numberToShift > 0)
  3691. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3692. if ((numUsed << 1) < data.numAllocated)
  3693. minimiseStorageOverheads();
  3694. }
  3695. }
  3696. void removeObject (ObjectClass* const objectToRemove)
  3697. {
  3698. const ScopedLockType lock (getLock());
  3699. remove (indexOf (objectToRemove));
  3700. }
  3701. void removeRange (const int startIndex,
  3702. const int numberToRemove)
  3703. {
  3704. const ScopedLockType lock (getLock());
  3705. const int start = jlimit (0, numUsed, startIndex);
  3706. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3707. if (end > start)
  3708. {
  3709. int i;
  3710. for (i = start; i < end; ++i)
  3711. {
  3712. if (data.elements[i] != 0)
  3713. {
  3714. data.elements[i]->decReferenceCount();
  3715. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3716. }
  3717. }
  3718. const int rangeSize = end - start;
  3719. ObjectClass** e = data.elements + start;
  3720. i = numUsed - end;
  3721. numUsed -= rangeSize;
  3722. while (--i >= 0)
  3723. {
  3724. *e = e [rangeSize];
  3725. ++e;
  3726. }
  3727. if ((numUsed << 1) < data.numAllocated)
  3728. minimiseStorageOverheads();
  3729. }
  3730. }
  3731. void removeLast (int howManyToRemove = 1)
  3732. {
  3733. const ScopedLockType lock (getLock());
  3734. if (howManyToRemove > numUsed)
  3735. howManyToRemove = numUsed;
  3736. while (--howManyToRemove >= 0)
  3737. remove (numUsed - 1);
  3738. }
  3739. void swap (const int index1,
  3740. const int index2) throw()
  3741. {
  3742. const ScopedLockType lock (getLock());
  3743. if (((unsigned int) index1) < (unsigned int) numUsed
  3744. && ((unsigned int) index2) < (unsigned int) numUsed)
  3745. {
  3746. swapVariables (data.elements [index1],
  3747. data.elements [index2]);
  3748. }
  3749. }
  3750. void move (const int currentIndex,
  3751. int newIndex) throw()
  3752. {
  3753. if (currentIndex != newIndex)
  3754. {
  3755. const ScopedLockType lock (getLock());
  3756. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3757. {
  3758. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3759. newIndex = numUsed - 1;
  3760. ObjectClass* const value = data.elements [currentIndex];
  3761. if (newIndex > currentIndex)
  3762. {
  3763. memmove (data.elements + currentIndex,
  3764. data.elements + currentIndex + 1,
  3765. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3766. }
  3767. else
  3768. {
  3769. memmove (data.elements + newIndex + 1,
  3770. data.elements + newIndex,
  3771. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3772. }
  3773. data.elements [newIndex] = value;
  3774. }
  3775. }
  3776. }
  3777. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3778. {
  3779. const ScopedLockType lock1 (getLock());
  3780. const ScopedLockType lock2 (otherArray.getLock());
  3781. data.swapWith (otherArray.data);
  3782. swapVariables (numUsed, otherArray.numUsed);
  3783. }
  3784. bool operator== (const ReferenceCountedArray& other) const throw()
  3785. {
  3786. const ScopedLockType lock2 (other.getLock());
  3787. const ScopedLockType lock1 (getLock());
  3788. if (numUsed != other.numUsed)
  3789. return false;
  3790. for (int i = numUsed; --i >= 0;)
  3791. if (data.elements [i] != other.data.elements [i])
  3792. return false;
  3793. return true;
  3794. }
  3795. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3796. {
  3797. return ! operator== (other);
  3798. }
  3799. template <class ElementComparator>
  3800. void sort (ElementComparator& comparator,
  3801. const bool retainOrderOfEquivalentItems = false) const throw()
  3802. {
  3803. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3804. // avoids getting warning messages about the parameter being unused
  3805. const ScopedLockType lock (getLock());
  3806. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3807. }
  3808. void minimiseStorageOverheads() throw()
  3809. {
  3810. const ScopedLockType lock (getLock());
  3811. data.shrinkToNoMoreThan (numUsed);
  3812. }
  3813. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3814. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3815. juce_UseDebuggingNewOperator
  3816. private:
  3817. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3818. int numUsed;
  3819. };
  3820. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3821. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3822. #endif
  3823. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3824. #endif
  3825. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3826. #endif
  3827. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3828. /*** Start of inlined file: juce_SortedSet.h ***/
  3829. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3830. #define __JUCE_SORTEDSET_JUCEHEADER__
  3831. #if JUCE_MSVC
  3832. #pragma warning (push)
  3833. #pragma warning (disable: 4512)
  3834. #endif
  3835. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3836. class SortedSet
  3837. {
  3838. public:
  3839. SortedSet() throw()
  3840. : numUsed (0)
  3841. {
  3842. }
  3843. SortedSet (const SortedSet& other) throw()
  3844. {
  3845. const ScopedLockType lock (other.getLock());
  3846. numUsed = other.numUsed;
  3847. data.setAllocatedSize (other.numUsed);
  3848. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3849. }
  3850. ~SortedSet() throw()
  3851. {
  3852. }
  3853. SortedSet& operator= (const SortedSet& other) throw()
  3854. {
  3855. if (this != &other)
  3856. {
  3857. const ScopedLockType lock1 (other.getLock());
  3858. const ScopedLockType lock2 (getLock());
  3859. data.ensureAllocatedSize (other.size());
  3860. numUsed = other.numUsed;
  3861. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3862. minimiseStorageOverheads();
  3863. }
  3864. return *this;
  3865. }
  3866. bool operator== (const SortedSet<ElementType>& other) const throw()
  3867. {
  3868. const ScopedLockType lock (getLock());
  3869. if (numUsed != other.numUsed)
  3870. return false;
  3871. for (int i = numUsed; --i >= 0;)
  3872. if (data.elements[i] != other.data.elements[i])
  3873. return false;
  3874. return true;
  3875. }
  3876. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3877. {
  3878. return ! operator== (other);
  3879. }
  3880. void clear() throw()
  3881. {
  3882. const ScopedLockType lock (getLock());
  3883. data.setAllocatedSize (0);
  3884. numUsed = 0;
  3885. }
  3886. void clearQuick() throw()
  3887. {
  3888. const ScopedLockType lock (getLock());
  3889. numUsed = 0;
  3890. }
  3891. inline int size() const throw()
  3892. {
  3893. return numUsed;
  3894. }
  3895. inline ElementType operator[] (const int index) const throw()
  3896. {
  3897. const ScopedLockType lock (getLock());
  3898. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3899. : ElementType();
  3900. }
  3901. inline ElementType getUnchecked (const int index) const throw()
  3902. {
  3903. const ScopedLockType lock (getLock());
  3904. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3905. return data.elements [index];
  3906. }
  3907. inline ElementType getFirst() const throw()
  3908. {
  3909. const ScopedLockType lock (getLock());
  3910. return numUsed > 0 ? data.elements [0] : ElementType();
  3911. }
  3912. inline ElementType getLast() const throw()
  3913. {
  3914. const ScopedLockType lock (getLock());
  3915. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3916. }
  3917. int indexOf (const ElementType elementToLookFor) const throw()
  3918. {
  3919. const ScopedLockType lock (getLock());
  3920. int start = 0;
  3921. int end = numUsed;
  3922. for (;;)
  3923. {
  3924. if (start >= end)
  3925. {
  3926. return -1;
  3927. }
  3928. else if (elementToLookFor == data.elements [start])
  3929. {
  3930. return start;
  3931. }
  3932. else
  3933. {
  3934. const int halfway = (start + end) >> 1;
  3935. if (halfway == start)
  3936. return -1;
  3937. else if (elementToLookFor >= data.elements [halfway])
  3938. start = halfway;
  3939. else
  3940. end = halfway;
  3941. }
  3942. }
  3943. }
  3944. bool contains (const ElementType elementToLookFor) const throw()
  3945. {
  3946. const ScopedLockType lock (getLock());
  3947. int start = 0;
  3948. int end = numUsed;
  3949. for (;;)
  3950. {
  3951. if (start >= end)
  3952. {
  3953. return false;
  3954. }
  3955. else if (elementToLookFor == data.elements [start])
  3956. {
  3957. return true;
  3958. }
  3959. else
  3960. {
  3961. const int halfway = (start + end) >> 1;
  3962. if (halfway == start)
  3963. return false;
  3964. else if (elementToLookFor >= data.elements [halfway])
  3965. start = halfway;
  3966. else
  3967. end = halfway;
  3968. }
  3969. }
  3970. }
  3971. void add (const ElementType newElement) throw()
  3972. {
  3973. const ScopedLockType lock (getLock());
  3974. int start = 0;
  3975. int end = numUsed;
  3976. for (;;)
  3977. {
  3978. if (start >= end)
  3979. {
  3980. jassert (start <= end);
  3981. insertInternal (start, newElement);
  3982. break;
  3983. }
  3984. else if (newElement == data.elements [start])
  3985. {
  3986. break;
  3987. }
  3988. else
  3989. {
  3990. const int halfway = (start + end) >> 1;
  3991. if (halfway == start)
  3992. {
  3993. if (newElement >= data.elements [halfway])
  3994. insertInternal (start + 1, newElement);
  3995. else
  3996. insertInternal (start, newElement);
  3997. break;
  3998. }
  3999. else if (newElement >= data.elements [halfway])
  4000. start = halfway;
  4001. else
  4002. end = halfway;
  4003. }
  4004. }
  4005. }
  4006. void addArray (const ElementType* elementsToAdd,
  4007. int numElementsToAdd) throw()
  4008. {
  4009. const ScopedLockType lock (getLock());
  4010. while (--numElementsToAdd >= 0)
  4011. add (*elementsToAdd++);
  4012. }
  4013. template <class OtherSetType>
  4014. void addSet (const OtherSetType& setToAddFrom,
  4015. int startIndex = 0,
  4016. int numElementsToAdd = -1) throw()
  4017. {
  4018. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4019. const ScopedLockType lock2 (getLock());
  4020. jassert (this != &setToAddFrom);
  4021. if (this != &setToAddFrom)
  4022. {
  4023. if (startIndex < 0)
  4024. {
  4025. jassertfalse
  4026. startIndex = 0;
  4027. }
  4028. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4029. numElementsToAdd = setToAddFrom.size() - startIndex;
  4030. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4031. }
  4032. }
  4033. ElementType remove (const int indexToRemove) throw()
  4034. {
  4035. const ScopedLockType lock (getLock());
  4036. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4037. {
  4038. --numUsed;
  4039. ElementType* const e = data.elements + indexToRemove;
  4040. ElementType const removed = *e;
  4041. const int numberToShift = numUsed - indexToRemove;
  4042. if (numberToShift > 0)
  4043. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4044. if ((numUsed << 1) < data.numAllocated)
  4045. minimiseStorageOverheads();
  4046. return removed;
  4047. }
  4048. return 0;
  4049. }
  4050. void removeValue (const ElementType valueToRemove) throw()
  4051. {
  4052. const ScopedLockType lock (getLock());
  4053. remove (indexOf (valueToRemove));
  4054. }
  4055. template <class OtherSetType>
  4056. void removeValuesIn (const OtherSetType& otherSet) throw()
  4057. {
  4058. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4059. const ScopedLockType lock2 (getLock());
  4060. if (this == &otherSet)
  4061. {
  4062. clear();
  4063. }
  4064. else
  4065. {
  4066. if (otherSet.size() > 0)
  4067. {
  4068. for (int i = numUsed; --i >= 0;)
  4069. if (otherSet.contains (data.elements [i]))
  4070. remove (i);
  4071. }
  4072. }
  4073. }
  4074. template <class OtherSetType>
  4075. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4076. {
  4077. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4078. const ScopedLockType lock2 (getLock());
  4079. if (this != &otherSet)
  4080. {
  4081. if (otherSet.size() <= 0)
  4082. {
  4083. clear();
  4084. }
  4085. else
  4086. {
  4087. for (int i = numUsed; --i >= 0;)
  4088. if (! otherSet.contains (data.elements [i]))
  4089. remove (i);
  4090. }
  4091. }
  4092. }
  4093. void minimiseStorageOverheads() throw()
  4094. {
  4095. const ScopedLockType lock (getLock());
  4096. data.shrinkToNoMoreThan (numUsed);
  4097. }
  4098. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4099. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4100. juce_UseDebuggingNewOperator
  4101. private:
  4102. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4103. int numUsed;
  4104. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4105. {
  4106. data.ensureAllocatedSize (numUsed + 1);
  4107. ElementType* const insertPos = data.elements + indexToInsertAt;
  4108. const int numberToMove = numUsed - indexToInsertAt;
  4109. if (numberToMove > 0)
  4110. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4111. *insertPos = newElement;
  4112. ++numUsed;
  4113. }
  4114. };
  4115. #if JUCE_MSVC
  4116. #pragma warning (pop)
  4117. #endif
  4118. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4119. /*** End of inlined file: juce_SortedSet.h ***/
  4120. #endif
  4121. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4122. /*** Start of inlined file: juce_SparseSet.h ***/
  4123. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4124. #define __JUCE_SPARSESET_JUCEHEADER__
  4125. template <class Type>
  4126. class SparseSet
  4127. {
  4128. public:
  4129. SparseSet() throw()
  4130. {
  4131. }
  4132. SparseSet (const SparseSet<Type>& other) throw()
  4133. : values (other.values)
  4134. {
  4135. }
  4136. ~SparseSet() throw()
  4137. {
  4138. }
  4139. void clear() throw()
  4140. {
  4141. values.clear();
  4142. }
  4143. bool isEmpty() const throw()
  4144. {
  4145. return values.size() == 0;
  4146. }
  4147. Type size() const throw()
  4148. {
  4149. Type num = 0;
  4150. for (int i = 0; i < values.size(); i += 2)
  4151. num += values[i + 1] - values[i];
  4152. return num;
  4153. }
  4154. Type operator[] (int index) const throw()
  4155. {
  4156. for (int i = 0; i < values.size(); i += 2)
  4157. {
  4158. const Type s = values.getUnchecked(i);
  4159. const Type e = values.getUnchecked(i + 1);
  4160. if (index < e - s)
  4161. return s + index;
  4162. index -= e - s;
  4163. }
  4164. return (Type) 0;
  4165. }
  4166. bool contains (const Type valueToLookFor) const throw()
  4167. {
  4168. bool on = false;
  4169. for (int i = 0; i < values.size(); ++i)
  4170. {
  4171. if (values.getUnchecked(i) > valueToLookFor)
  4172. return on;
  4173. on = ! on;
  4174. }
  4175. return false;
  4176. }
  4177. int getNumRanges() const throw()
  4178. {
  4179. return values.size() >> 1;
  4180. }
  4181. bool getRange (const int rangeIndex,
  4182. Type& startValue,
  4183. Type& numValues) const throw()
  4184. {
  4185. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4186. {
  4187. startValue = values [rangeIndex << 1];
  4188. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4189. return true;
  4190. }
  4191. return false;
  4192. }
  4193. bool getTotalRange (Type& lowestValue,
  4194. Type& highestValue) const throw()
  4195. {
  4196. if (values.size() > 0)
  4197. {
  4198. lowestValue = values.getUnchecked (0);
  4199. highestValue = values.getUnchecked (values.size() - 1);
  4200. return true;
  4201. }
  4202. return false;
  4203. }
  4204. void addRange (const Type firstValue,
  4205. const Type numValuesToAdd) throw()
  4206. {
  4207. jassert (numValuesToAdd >= 0);
  4208. if (numValuesToAdd > 0)
  4209. {
  4210. removeRange (firstValue, numValuesToAdd);
  4211. IntegerElementComparator<Type> sorter;
  4212. values.addSorted (sorter, firstValue);
  4213. values.addSorted (sorter, firstValue + numValuesToAdd);
  4214. simplify();
  4215. }
  4216. }
  4217. void removeRange (const Type firstValue,
  4218. const Type numValuesToRemove) throw()
  4219. {
  4220. jassert (numValuesToRemove >= 0);
  4221. if (numValuesToRemove >= 0
  4222. && firstValue < values.getLast())
  4223. {
  4224. const bool onAtStart = contains (firstValue - 1);
  4225. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4226. const bool onAtEnd = contains (lastValue);
  4227. for (int i = values.size(); --i >= 0;)
  4228. {
  4229. if (values.getUnchecked(i) <= lastValue)
  4230. {
  4231. while (values.getUnchecked(i) >= firstValue)
  4232. {
  4233. values.remove (i);
  4234. if (--i < 0)
  4235. break;
  4236. }
  4237. break;
  4238. }
  4239. }
  4240. IntegerElementComparator<Type> sorter;
  4241. if (onAtStart)
  4242. values.addSorted (sorter, firstValue);
  4243. if (onAtEnd)
  4244. values.addSorted (sorter, lastValue);
  4245. simplify();
  4246. }
  4247. }
  4248. void invertRange (const Type firstValue,
  4249. const Type numValues)
  4250. {
  4251. SparseSet newItems;
  4252. newItems.addRange (firstValue, numValues);
  4253. int i;
  4254. for (i = getNumRanges(); --i >= 0;)
  4255. {
  4256. const int start = values [i << 1];
  4257. const int end = values [(i << 1) + 1];
  4258. newItems.removeRange (start, end);
  4259. }
  4260. removeRange (firstValue, numValues);
  4261. for (i = newItems.getNumRanges(); --i >= 0;)
  4262. {
  4263. const int start = newItems.values [i << 1];
  4264. const int end = newItems.values [(i << 1) + 1];
  4265. addRange (start, end);
  4266. }
  4267. }
  4268. bool overlapsRange (const Type firstValue,
  4269. const Type numValues) throw()
  4270. {
  4271. jassert (numValues >= 0);
  4272. if (numValues > 0)
  4273. {
  4274. for (int i = getNumRanges(); --i >= 0;)
  4275. {
  4276. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4277. return false;
  4278. if (firstValue + numValues > values.getUnchecked (i << 1))
  4279. return true;
  4280. }
  4281. }
  4282. return false;
  4283. }
  4284. bool containsRange (const Type firstValue,
  4285. const Type numValues) throw()
  4286. {
  4287. jassert (numValues >= 0);
  4288. if (numValues > 0)
  4289. {
  4290. for (int i = getNumRanges(); --i >= 0;)
  4291. {
  4292. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4293. return false;
  4294. if (firstValue >= values.getUnchecked (i << 1)
  4295. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4296. return true;
  4297. }
  4298. }
  4299. return false;
  4300. }
  4301. bool operator== (const SparseSet<Type>& other) throw()
  4302. {
  4303. return values == other.values;
  4304. }
  4305. bool operator!= (const SparseSet<Type>& other) throw()
  4306. {
  4307. return values != other.values;
  4308. }
  4309. juce_UseDebuggingNewOperator
  4310. private:
  4311. // alternating start/end values of ranges of values that are present.
  4312. Array<Type, DummyCriticalSection> values;
  4313. void simplify() throw()
  4314. {
  4315. jassert ((values.size() & 1) == 0);
  4316. for (int i = values.size(); --i > 0;)
  4317. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4318. values.removeRange (i - 1, 2);
  4319. }
  4320. };
  4321. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4322. /*** End of inlined file: juce_SparseSet.h ***/
  4323. #endif
  4324. #ifndef __JUCE_VALUE_JUCEHEADER__
  4325. /*** Start of inlined file: juce_Value.h ***/
  4326. #ifndef __JUCE_VALUE_JUCEHEADER__
  4327. #define __JUCE_VALUE_JUCEHEADER__
  4328. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4329. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4330. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4331. /*** Start of inlined file: juce_MessageListener.h ***/
  4332. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4333. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4334. /*** Start of inlined file: juce_Message.h ***/
  4335. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4336. #define __JUCE_MESSAGE_JUCEHEADER__
  4337. class MessageListener;
  4338. class MessageManager;
  4339. class JUCE_API Message
  4340. {
  4341. public:
  4342. Message() throw();
  4343. Message (const int intParameter1,
  4344. const int intParameter2,
  4345. const int intParameter3,
  4346. void* const pointerParameter) throw();
  4347. virtual ~Message() throw();
  4348. // These values can be used for carrying simple data that the application needs to
  4349. // pass around. For more complex messages, just create a subclass.
  4350. int intParameter1; /**< user-defined integer value. */
  4351. int intParameter2; /**< user-defined integer value. */
  4352. int intParameter3; /**< user-defined integer value. */
  4353. void* pointerParameter; /**< user-defined pointer value. */
  4354. juce_UseDebuggingNewOperator
  4355. private:
  4356. friend class MessageListener;
  4357. friend class MessageManager;
  4358. MessageListener* messageRecipient;
  4359. Message (const Message&);
  4360. Message& operator= (const Message&);
  4361. };
  4362. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4363. /*** End of inlined file: juce_Message.h ***/
  4364. class JUCE_API MessageListener
  4365. {
  4366. protected:
  4367. MessageListener() throw();
  4368. public:
  4369. virtual ~MessageListener();
  4370. virtual void handleMessage (const Message& message) = 0;
  4371. void postMessage (Message* const message) const throw();
  4372. bool isValidMessageListener() const throw();
  4373. };
  4374. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4375. /*** End of inlined file: juce_MessageListener.h ***/
  4376. class JUCE_API AsyncUpdater
  4377. {
  4378. public:
  4379. AsyncUpdater() throw();
  4380. virtual ~AsyncUpdater();
  4381. void triggerAsyncUpdate() throw();
  4382. void cancelPendingUpdate() throw();
  4383. void handleUpdateNowIfNeeded();
  4384. virtual void handleAsyncUpdate() = 0;
  4385. private:
  4386. class AsyncUpdaterInternal : public MessageListener
  4387. {
  4388. public:
  4389. AsyncUpdaterInternal() throw() {}
  4390. ~AsyncUpdaterInternal() {}
  4391. void handleMessage (const Message&);
  4392. AsyncUpdater* owner;
  4393. private:
  4394. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4395. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4396. };
  4397. AsyncUpdaterInternal internalAsyncHandler;
  4398. bool asyncMessagePending;
  4399. };
  4400. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4401. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4402. /*** Start of inlined file: juce_ListenerList.h ***/
  4403. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4404. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4405. template <class ListenerClass,
  4406. class ArrayType = Array <ListenerClass*> >
  4407. class ListenerList
  4408. {
  4409. public:
  4410. ListenerList()
  4411. {
  4412. }
  4413. ~ListenerList()
  4414. {
  4415. }
  4416. void add (ListenerClass* const listenerToAdd)
  4417. {
  4418. // Listeners can't be null pointers!
  4419. jassert (listenerToAdd != 0);
  4420. if (listenerToAdd != 0)
  4421. listeners.add (listenerToAdd);
  4422. }
  4423. void remove (ListenerClass* const listenerToRemove)
  4424. {
  4425. // Listeners can't be null pointers!
  4426. jassert (listenerToRemove != 0);
  4427. listeners.removeValue (listenerToRemove);
  4428. }
  4429. int size() const throw()
  4430. {
  4431. return listeners.size();
  4432. }
  4433. bool isEmpty() const throw()
  4434. {
  4435. return listeners.size() == 0;
  4436. }
  4437. bool contains (ListenerClass* const listener) const throw()
  4438. {
  4439. return listeners.contains (listener);
  4440. }
  4441. void call (void (ListenerClass::*callbackFunction) ())
  4442. {
  4443. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4444. }
  4445. template <class BailOutCheckerType>
  4446. void callChecked (const BailOutCheckerType& bailOutChecker,
  4447. void (ListenerClass::*callbackFunction) ())
  4448. {
  4449. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4450. (iter.getListener()->*callbackFunction) ();
  4451. }
  4452. template <typename P1, typename P2>
  4453. void call (void (ListenerClass::*callbackFunction) (P1),
  4454. P2& param1)
  4455. {
  4456. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4457. (iter.getListener()->*callbackFunction) (param1);
  4458. }
  4459. template <class BailOutCheckerType, typename P1, typename P2>
  4460. void callChecked (const BailOutCheckerType& bailOutChecker,
  4461. void (ListenerClass::*callbackFunction) (P1),
  4462. P2& param1)
  4463. {
  4464. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4465. (iter.getListener()->*callbackFunction) (param1);
  4466. }
  4467. template <typename P1, typename P2, typename P3, typename P4>
  4468. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4469. P3& param1, P4& param2)
  4470. {
  4471. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4472. (iter.getListener()->*callbackFunction) (param1, param2);
  4473. }
  4474. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4>
  4475. void callChecked (const BailOutCheckerType& bailOutChecker,
  4476. void (ListenerClass::*callbackFunction) (P1, P2),
  4477. P3& param1, P4& param2)
  4478. {
  4479. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4480. (iter.getListener()->*callbackFunction) (param1, param2);
  4481. }
  4482. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4483. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4484. P4& param1, P5& param2, P6& param3)
  4485. {
  4486. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4487. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4488. }
  4489. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4490. void callChecked (const BailOutCheckerType& bailOutChecker,
  4491. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4492. P4& param1, P5& param2, P6& param3)
  4493. {
  4494. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4495. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4496. }
  4497. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4498. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4499. P5& param1, P6& param2, P7& param3, P8& param4)
  4500. {
  4501. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4502. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4503. }
  4504. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4505. void callChecked (const BailOutCheckerType& bailOutChecker,
  4506. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4507. P5& param1, P6& param2, P7& param3, P8& param4)
  4508. {
  4509. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4510. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4511. }
  4512. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4513. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4514. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4515. {
  4516. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4517. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4518. }
  4519. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4520. void callChecked (const BailOutCheckerType& bailOutChecker,
  4521. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4522. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4523. {
  4524. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4525. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4526. }
  4527. class DummyBailOutChecker
  4528. {
  4529. public:
  4530. inline bool shouldBailOut() const throw() { return false; }
  4531. };
  4532. template <class BailOutCheckerType, class ListType>
  4533. class Iterator
  4534. {
  4535. public:
  4536. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4537. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4538. {}
  4539. ~Iterator() {}
  4540. bool next()
  4541. {
  4542. if (index <= 0 || bailOutChecker.shouldBailOut())
  4543. return false;
  4544. const int listSize = list.size();
  4545. if (--index < listSize)
  4546. return true;
  4547. index = listSize - 1;
  4548. return index >= 0;
  4549. }
  4550. typename ListType::ListenerType* getListener() const throw()
  4551. {
  4552. return list.getListeners().getUnchecked (index);
  4553. }
  4554. private:
  4555. const ListType& list;
  4556. const BailOutCheckerType& bailOutChecker;
  4557. int index;
  4558. Iterator (const Iterator&);
  4559. Iterator& operator= (const Iterator&);
  4560. };
  4561. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4562. typedef ListenerClass ListenerType;
  4563. const ArrayType& getListeners() const throw() { return listeners; }
  4564. private:
  4565. ArrayType listeners;
  4566. ListenerList (const ListenerList&);
  4567. ListenerList& operator= (const ListenerList&);
  4568. };
  4569. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4570. /*** End of inlined file: juce_ListenerList.h ***/
  4571. class JUCE_API Value
  4572. {
  4573. public:
  4574. Value();
  4575. Value (const Value& other);
  4576. Value (const var& initialValue);
  4577. ~Value();
  4578. const var getValue() const;
  4579. operator const var() const;
  4580. const String toString() const;
  4581. void setValue (const var& newValue);
  4582. Value& operator= (const var& newValue);
  4583. void referTo (const Value& valueToReferTo);
  4584. bool refersToSameSourceAs (const Value& other) const;
  4585. bool operator== (const Value& other) const;
  4586. bool operator!= (const Value& other) const;
  4587. class JUCE_API Listener
  4588. {
  4589. public:
  4590. Listener() {}
  4591. virtual ~Listener() {}
  4592. virtual void valueChanged (Value& value) = 0;
  4593. };
  4594. void addListener (Listener* const listener);
  4595. void removeListener (Listener* const listener);
  4596. class JUCE_API ValueSource : public ReferenceCountedObject,
  4597. public AsyncUpdater
  4598. {
  4599. public:
  4600. ValueSource();
  4601. virtual ~ValueSource();
  4602. virtual const var getValue() const = 0;
  4603. virtual void setValue (const var& newValue) = 0;
  4604. void sendChangeMessage (const bool dispatchSynchronously);
  4605. juce_UseDebuggingNewOperator
  4606. protected:
  4607. friend class Value;
  4608. SortedSet <Value*> valuesWithListeners;
  4609. void handleAsyncUpdate();
  4610. ValueSource (const ValueSource&);
  4611. ValueSource& operator= (const ValueSource&);
  4612. };
  4613. explicit Value (ValueSource* const valueSource);
  4614. ValueSource& getValueSource() { return *value; }
  4615. juce_UseDebuggingNewOperator
  4616. private:
  4617. friend class ValueSource;
  4618. ReferenceCountedObjectPtr <ValueSource> value;
  4619. ListenerList <Listener> listeners;
  4620. void callListeners();
  4621. // This is disallowed to avoid confusion about whether it should
  4622. // do a by-value or by-reference copy.
  4623. Value& operator= (const Value& other);
  4624. };
  4625. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4626. #endif // __JUCE_VALUE_JUCEHEADER__
  4627. /*** End of inlined file: juce_Value.h ***/
  4628. #endif
  4629. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4630. /*** Start of inlined file: juce_ValueTree.h ***/
  4631. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4632. #define __JUCE_VALUETREE_JUCEHEADER__
  4633. /*** Start of inlined file: juce_UndoManager.h ***/
  4634. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4635. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4636. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4637. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4638. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4639. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4640. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4641. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4642. /*** Start of inlined file: juce_ChangeListener.h ***/
  4643. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4644. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4645. class JUCE_API ChangeListener
  4646. {
  4647. public:
  4648. virtual ~ChangeListener() {}
  4649. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4650. };
  4651. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4652. /*** End of inlined file: juce_ChangeListener.h ***/
  4653. /*** Start of inlined file: juce_ScopedLock.h ***/
  4654. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4655. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4656. class JUCE_API ScopedLock
  4657. {
  4658. public:
  4659. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4660. inline ~ScopedLock() throw() { lock_.exit(); }
  4661. private:
  4662. const CriticalSection& lock_;
  4663. ScopedLock (const ScopedLock&);
  4664. ScopedLock& operator= (const ScopedLock&);
  4665. };
  4666. class ScopedUnlock
  4667. {
  4668. public:
  4669. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4670. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4671. private:
  4672. const CriticalSection& lock_;
  4673. ScopedUnlock (const ScopedLock&);
  4674. ScopedUnlock& operator= (const ScopedUnlock&);
  4675. };
  4676. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4677. /*** End of inlined file: juce_ScopedLock.h ***/
  4678. class JUCE_API ChangeListenerList : public MessageListener
  4679. {
  4680. public:
  4681. ChangeListenerList() throw();
  4682. ~ChangeListenerList() throw();
  4683. void addChangeListener (ChangeListener* const listener) throw();
  4684. void removeChangeListener (ChangeListener* const listener) throw();
  4685. void removeAllChangeListeners() throw();
  4686. void sendChangeMessage (void* objectThatHasChanged) throw();
  4687. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4688. void dispatchPendingMessages();
  4689. void handleMessage (const Message&);
  4690. juce_UseDebuggingNewOperator
  4691. private:
  4692. SortedSet <void*> listeners;
  4693. CriticalSection lock;
  4694. void* lastChangedObject;
  4695. bool messagePending;
  4696. ChangeListenerList (const ChangeListenerList&);
  4697. ChangeListenerList& operator= (const ChangeListenerList&);
  4698. };
  4699. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4700. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4701. class JUCE_API ChangeBroadcaster
  4702. {
  4703. public:
  4704. ChangeBroadcaster() throw();
  4705. virtual ~ChangeBroadcaster();
  4706. void addChangeListener (ChangeListener* const listener) throw();
  4707. void removeChangeListener (ChangeListener* const listener) throw();
  4708. void removeAllChangeListeners() throw();
  4709. void sendChangeMessage (void* objectThatHasChanged) throw();
  4710. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4711. void dispatchPendingMessages();
  4712. private:
  4713. ChangeListenerList changeListenerList;
  4714. ChangeBroadcaster (const ChangeBroadcaster&);
  4715. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4716. };
  4717. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4718. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4719. /*** Start of inlined file: juce_UndoableAction.h ***/
  4720. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4721. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4722. class JUCE_API UndoableAction
  4723. {
  4724. protected:
  4725. UndoableAction() throw() {}
  4726. public:
  4727. virtual ~UndoableAction() {}
  4728. virtual bool perform() = 0;
  4729. virtual bool undo() = 0;
  4730. virtual int getSizeInUnits() { return 10; }
  4731. };
  4732. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4733. /*** End of inlined file: juce_UndoableAction.h ***/
  4734. class JUCE_API UndoManager : public ChangeBroadcaster
  4735. {
  4736. public:
  4737. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4738. const int minimumTransactionsToKeep = 30);
  4739. ~UndoManager();
  4740. void clearUndoHistory();
  4741. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4742. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4743. const int minimumTransactionsToKeep);
  4744. bool perform (UndoableAction* const action,
  4745. const String& actionName = String::empty);
  4746. void beginNewTransaction (const String& actionName = String::empty);
  4747. void setCurrentTransactionName (const String& newName);
  4748. bool canUndo() const;
  4749. const String getUndoDescription() const;
  4750. bool undo();
  4751. bool undoCurrentTransactionOnly();
  4752. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4753. int getNumActionsInCurrentTransaction() const;
  4754. bool canRedo() const;
  4755. const String getRedoDescription() const;
  4756. bool redo();
  4757. juce_UseDebuggingNewOperator
  4758. private:
  4759. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4760. StringArray transactionNames;
  4761. String currentTransactionName;
  4762. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4763. bool newTransaction, reentrancyCheck;
  4764. // disallow copy constructor
  4765. UndoManager (const UndoManager&);
  4766. UndoManager& operator= (const UndoManager&);
  4767. };
  4768. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4769. /*** End of inlined file: juce_UndoManager.h ***/
  4770. class JUCE_API ValueTree
  4771. {
  4772. public:
  4773. ValueTree (const String& type);
  4774. ValueTree (const ValueTree& other);
  4775. ValueTree& operator= (const ValueTree& other);
  4776. ~ValueTree();
  4777. bool operator== (const ValueTree& other) const;
  4778. bool operator!= (const ValueTree& other) const;
  4779. bool isValid() const { return object != 0; }
  4780. ValueTree createCopy() const;
  4781. const String getType() const;
  4782. bool hasType (const String& typeName) const;
  4783. const var& getProperty (const var::identifier& name) const;
  4784. const var& operator[] (const var::identifier& name) const;
  4785. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4786. bool hasProperty (const var::identifier& name) const;
  4787. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4788. void removeAllProperties (UndoManager* const undoManager);
  4789. int getNumProperties() const;
  4790. const var::identifier getPropertyName (int index) const;
  4791. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4792. int getNumChildren() const;
  4793. ValueTree getChild (int index) const;
  4794. ValueTree getChildWithName (const String& type) const;
  4795. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4796. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4797. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4798. void removeChild (const int childIndex, UndoManager* const undoManager);
  4799. void removeAllChildren (UndoManager* const undoManager);
  4800. bool isAChildOf (const ValueTree& possibleParent) const;
  4801. ValueTree getParent() const;
  4802. XmlElement* createXml() const;
  4803. static ValueTree fromXml (const XmlElement& xml);
  4804. void writeToStream (OutputStream& output);
  4805. static ValueTree readFromStream (InputStream& input);
  4806. class JUCE_API Listener
  4807. {
  4808. public:
  4809. virtual ~Listener() {}
  4810. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4811. const var::identifier& property) = 0;
  4812. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4813. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4814. };
  4815. void addListener (Listener* listener);
  4816. void removeListener (Listener* listener);
  4817. template <typename ElementComparator>
  4818. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4819. {
  4820. if (object != 0)
  4821. {
  4822. ComparatorAdapter <ElementComparator> adapter (comparator);
  4823. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4824. object->sendChildChangeMessage();
  4825. }
  4826. }
  4827. juce_UseDebuggingNewOperator
  4828. private:
  4829. friend class ValueTreeSetPropertyAction;
  4830. friend class ValueTreeChildChangeAction;
  4831. class JUCE_API SharedObject : public ReferenceCountedObject
  4832. {
  4833. public:
  4834. SharedObject (const String& type);
  4835. SharedObject (const SharedObject& other);
  4836. ~SharedObject();
  4837. const String type;
  4838. NamedValueSet properties;
  4839. ReferenceCountedArray <SharedObject> children;
  4840. SortedSet <ValueTree*> valueTreesWithListeners;
  4841. SharedObject* parent;
  4842. void sendPropertyChangeMessage (const var::identifier& property);
  4843. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4844. void sendChildChangeMessage();
  4845. void sendChildChangeMessage (ValueTree& tree);
  4846. void sendParentChangeMessage();
  4847. const var& getProperty (const var::identifier& name) const;
  4848. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4849. bool hasProperty (const var::identifier& name) const;
  4850. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4851. void removeAllProperties (UndoManager* const undoManager);
  4852. bool isAChildOf (const SharedObject* const possibleParent) const;
  4853. ValueTree getChildWithName (const String& type) const;
  4854. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4855. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4856. void removeChild (const int childIndex, UndoManager* const undoManager);
  4857. void removeAllChildren (UndoManager* const undoManager);
  4858. XmlElement* createXml() const;
  4859. juce_UseDebuggingNewOperator
  4860. private:
  4861. SharedObject& operator= (const SharedObject&);
  4862. };
  4863. template <typename ElementComparator>
  4864. class ComparatorAdapter
  4865. {
  4866. public:
  4867. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4868. int compareElements (SharedObject* const first, SharedObject* const second)
  4869. {
  4870. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4871. }
  4872. private:
  4873. ElementComparator& comparator;
  4874. };
  4875. friend class SharedObject;
  4876. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4877. ReferenceCountedObjectPtr <SharedObject> object;
  4878. ListenerList <Listener> listeners;
  4879. public:
  4880. ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
  4881. };
  4882. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4883. /*** End of inlined file: juce_ValueTree.h ***/
  4884. #endif
  4885. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4886. #endif
  4887. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4888. /*** Start of inlined file: juce_VoidArray.h ***/
  4889. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4890. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4891. typedef Array <void*> VoidArray;
  4892. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4893. /*** End of inlined file: juce_VoidArray.h ***/
  4894. #endif
  4895. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4896. #endif
  4897. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4898. #endif
  4899. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4900. /*** Start of inlined file: juce_FileLogger.h ***/
  4901. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4902. #define __JUCE_FILELOGGER_JUCEHEADER__
  4903. class JUCE_API FileLogger : public Logger
  4904. {
  4905. public:
  4906. FileLogger (const File& fileToWriteTo,
  4907. const String& welcomeMessage,
  4908. const int maxInitialFileSizeBytes = 128 * 1024);
  4909. ~FileLogger();
  4910. void logMessage (const String& message);
  4911. const File getLogFile() const { return logFile; }
  4912. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4913. const String& logFileName,
  4914. const String& welcomeMessage,
  4915. const int maxInitialFileSizeBytes = 128 * 1024);
  4916. juce_UseDebuggingNewOperator
  4917. private:
  4918. File logFile;
  4919. CriticalSection logLock;
  4920. ScopedPointer <FileOutputStream> logStream;
  4921. void trimFileSize (int maxFileSizeBytes) const;
  4922. FileLogger (const FileLogger&);
  4923. FileLogger& operator= (const FileLogger&);
  4924. };
  4925. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4926. /*** End of inlined file: juce_FileLogger.h ***/
  4927. #endif
  4928. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4929. /*** Start of inlined file: juce_Initialisation.h ***/
  4930. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4931. #define __JUCE_INITIALISATION_JUCEHEADER__
  4932. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4933. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4934. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4935. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4936. class ScopedJuceInitialiser_NonGUI
  4937. {
  4938. public:
  4939. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4940. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4941. };
  4942. class ScopedJuceInitialiser_GUI
  4943. {
  4944. public:
  4945. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4946. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4947. };
  4948. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4949. /*** End of inlined file: juce_Initialisation.h ***/
  4950. #endif
  4951. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4952. #endif
  4953. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4954. #endif
  4955. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4956. #endif
  4957. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4958. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4959. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4960. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4961. class JUCE_API PerformanceCounter
  4962. {
  4963. public:
  4964. PerformanceCounter (const String& counterName,
  4965. int runsPerPrintout = 100,
  4966. const File& loggingFile = File::nonexistent);
  4967. ~PerformanceCounter();
  4968. void start();
  4969. void stop();
  4970. void printStatistics();
  4971. juce_UseDebuggingNewOperator
  4972. private:
  4973. String name;
  4974. int numRuns, runsPerPrint;
  4975. double totalTime;
  4976. int64 started;
  4977. File outputFile;
  4978. };
  4979. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4980. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4981. #endif
  4982. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4983. #endif
  4984. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4985. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4986. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4987. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4988. class JUCE_API PlatformUtilities
  4989. {
  4990. public:
  4991. static void beep();
  4992. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4993. const String& emailSubject,
  4994. const String& bodyText,
  4995. const StringArray& filesToAttach);
  4996. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4997. static const String cfStringToJuceString (CFStringRef cfString);
  4998. static CFStringRef juceStringToCFString (const String& s);
  4999. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5000. static const String makePathFromFSRef (FSRef* file);
  5001. static const String convertToPrecomposedUnicode (const String& s);
  5002. static OSType getTypeOfFile (const String& filename);
  5003. static bool isBundle (const String& filename);
  5004. static void addItemToDock (const File& file);
  5005. static int getOSXMinorVersionNumber();
  5006. #endif
  5007. #if JUCE_WINDOWS || DOXYGEN
  5008. // Some registry helper functions:
  5009. static const String getRegistryValue (const String& regValuePath,
  5010. const String& defaultValue = String::empty);
  5011. static void setRegistryValue (const String& regValuePath,
  5012. const String& value);
  5013. static bool registryValueExists (const String& regValuePath);
  5014. static void deleteRegistryValue (const String& regValuePath);
  5015. static void deleteRegistryKey (const String& regKeyPath);
  5016. static void registerFileAssociation (const String& fileExtension,
  5017. const String& symbolicDescription,
  5018. const String& fullDescription,
  5019. const File& targetExecutable,
  5020. int iconResourceNumber);
  5021. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5022. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5023. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5024. #endif
  5025. static void fpuReset();
  5026. #if JUCE_LINUX || JUCE_WINDOWS
  5027. static void* loadDynamicLibrary (const String& pathOrFilename);
  5028. static void freeDynamicLibrary (void* libraryHandle);
  5029. static void* getProcedureEntryPoint (void* libraryHandle,
  5030. const String& procedureName);
  5031. #endif
  5032. #if JUCE_LINUX || DOXYGEN
  5033. #endif
  5034. };
  5035. #if JUCE_MAC || JUCE_IPHONE
  5036. class ScopedAutoReleasePool
  5037. {
  5038. public:
  5039. ScopedAutoReleasePool();
  5040. ~ScopedAutoReleasePool();
  5041. private:
  5042. void* pool;
  5043. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5044. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5045. };
  5046. #endif
  5047. #if JUCE_LINUX
  5048. class ScopedXLock
  5049. {
  5050. public:
  5051. ScopedXLock();
  5052. ~ScopedXLock();
  5053. };
  5054. #endif
  5055. #if JUCE_MAC
  5056. class JUCE_API AppleRemoteDevice
  5057. {
  5058. public:
  5059. AppleRemoteDevice();
  5060. virtual ~AppleRemoteDevice();
  5061. enum ButtonType
  5062. {
  5063. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5064. playButton, /**< The play button. */
  5065. plusButton, /**< The plus or volume-up button. */
  5066. minusButton, /**< The minus or volume-down button. */
  5067. rightButton, /**< The right button (if it's held for a short time). */
  5068. leftButton, /**< The left button (if it's held for a short time). */
  5069. rightButton_Long, /**< The right button (if it's held for a long time). */
  5070. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5071. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5072. playButtonSleepMode,
  5073. switched
  5074. };
  5075. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5076. bool start (const bool inExclusiveMode);
  5077. void stop();
  5078. bool isActive() const;
  5079. int getRemoteId() const { return remoteId; }
  5080. juce_UseDebuggingNewOperator
  5081. void handleCallbackInternal();
  5082. private:
  5083. void* device;
  5084. void* queue;
  5085. int remoteId;
  5086. bool open (const bool openInExclusiveMode);
  5087. AppleRemoteDevice (const AppleRemoteDevice&);
  5088. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5089. };
  5090. #endif
  5091. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5092. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5093. #endif
  5094. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5095. /*** Start of inlined file: juce_Random.h ***/
  5096. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5097. #define __JUCE_RANDOM_JUCEHEADER__
  5098. class JUCE_API Random
  5099. {
  5100. public:
  5101. Random (int64 seedValue) throw();
  5102. ~Random() throw();
  5103. int nextInt() throw();
  5104. int nextInt (int maxValue) throw();
  5105. int64 nextInt64() throw();
  5106. float nextFloat() throw();
  5107. double nextDouble() throw();
  5108. bool nextBool() throw();
  5109. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5110. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5111. static Random& getSystemRandom() throw();
  5112. void setSeed (int64 newSeed) throw();
  5113. void combineSeed (int64 seedValue) throw();
  5114. void setSeedRandomly();
  5115. juce_UseDebuggingNewOperator
  5116. private:
  5117. int64 seed;
  5118. };
  5119. #endif // __JUCE_RANDOM_JUCEHEADER__
  5120. /*** End of inlined file: juce_Random.h ***/
  5121. #endif
  5122. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5123. #endif
  5124. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5125. /*** Start of inlined file: juce_Singleton.h ***/
  5126. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5127. #define __JUCE_SINGLETON_JUCEHEADER__
  5128. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5129. \
  5130. static classname* _singletonInstance; \
  5131. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5132. \
  5133. static classname* getInstance() \
  5134. { \
  5135. if (_singletonInstance == 0) \
  5136. {\
  5137. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5138. \
  5139. if (_singletonInstance == 0) \
  5140. { \
  5141. static bool alreadyInside = false; \
  5142. static bool createdOnceAlready = false; \
  5143. \
  5144. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5145. jassert (! problem); \
  5146. if (! problem) \
  5147. { \
  5148. createdOnceAlready = true; \
  5149. alreadyInside = true; \
  5150. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5151. alreadyInside = false; \
  5152. \
  5153. _singletonInstance = newObject; \
  5154. } \
  5155. } \
  5156. } \
  5157. \
  5158. return _singletonInstance; \
  5159. } \
  5160. \
  5161. static inline classname* getInstanceWithoutCreating() throw() \
  5162. { \
  5163. return _singletonInstance; \
  5164. } \
  5165. \
  5166. static void deleteInstance() \
  5167. { \
  5168. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5169. if (_singletonInstance != 0) \
  5170. { \
  5171. classname* const old = _singletonInstance; \
  5172. _singletonInstance = 0; \
  5173. delete old; \
  5174. } \
  5175. } \
  5176. \
  5177. void clearSingletonInstance() throw() \
  5178. { \
  5179. if (_singletonInstance == this) \
  5180. _singletonInstance = 0; \
  5181. }
  5182. #define juce_ImplementSingleton(classname) \
  5183. \
  5184. classname* classname::_singletonInstance = 0; \
  5185. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5186. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5187. \
  5188. static classname* _singletonInstance; \
  5189. \
  5190. static classname* getInstance() \
  5191. { \
  5192. if (_singletonInstance == 0) \
  5193. { \
  5194. static bool alreadyInside = false; \
  5195. static bool createdOnceAlready = false; \
  5196. \
  5197. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5198. jassert (! problem); \
  5199. if (! problem) \
  5200. { \
  5201. createdOnceAlready = true; \
  5202. alreadyInside = true; \
  5203. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5204. alreadyInside = false; \
  5205. \
  5206. _singletonInstance = newObject; \
  5207. } \
  5208. } \
  5209. \
  5210. return _singletonInstance; \
  5211. } \
  5212. \
  5213. static inline classname* getInstanceWithoutCreating() throw() \
  5214. { \
  5215. return _singletonInstance; \
  5216. } \
  5217. \
  5218. static void deleteInstance() \
  5219. { \
  5220. if (_singletonInstance != 0) \
  5221. { \
  5222. classname* const old = _singletonInstance; \
  5223. _singletonInstance = 0; \
  5224. delete old; \
  5225. } \
  5226. } \
  5227. \
  5228. void clearSingletonInstance() throw() \
  5229. { \
  5230. if (_singletonInstance == this) \
  5231. _singletonInstance = 0; \
  5232. }
  5233. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5234. \
  5235. static classname* _singletonInstance; \
  5236. \
  5237. static classname* getInstance() \
  5238. { \
  5239. if (_singletonInstance == 0) \
  5240. _singletonInstance = new classname(); \
  5241. \
  5242. return _singletonInstance; \
  5243. } \
  5244. \
  5245. static inline classname* getInstanceWithoutCreating() throw() \
  5246. { \
  5247. return _singletonInstance; \
  5248. } \
  5249. \
  5250. static void deleteInstance() \
  5251. { \
  5252. if (_singletonInstance != 0) \
  5253. { \
  5254. classname* const old = _singletonInstance; \
  5255. _singletonInstance = 0; \
  5256. delete old; \
  5257. } \
  5258. } \
  5259. \
  5260. void clearSingletonInstance() throw() \
  5261. { \
  5262. if (_singletonInstance == this) \
  5263. _singletonInstance = 0; \
  5264. }
  5265. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5266. \
  5267. classname* classname::_singletonInstance = 0;
  5268. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5269. /*** End of inlined file: juce_Singleton.h ***/
  5270. #endif
  5271. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5272. #endif
  5273. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5274. /*** Start of inlined file: juce_SystemStats.h ***/
  5275. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5276. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5277. class JUCE_API SystemStats
  5278. {
  5279. public:
  5280. static const String getJUCEVersion() throw();
  5281. enum OperatingSystemType
  5282. {
  5283. UnknownOS = 0,
  5284. MacOSX = 0x1000,
  5285. Linux = 0x2000,
  5286. Win95 = 0x4001,
  5287. Win98 = 0x4002,
  5288. WinNT351 = 0x4103,
  5289. WinNT40 = 0x4104,
  5290. Win2000 = 0x4105,
  5291. WinXP = 0x4106,
  5292. WinVista = 0x4107,
  5293. Windows7 = 0x4108,
  5294. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5295. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5296. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5297. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5298. };
  5299. static OperatingSystemType getOperatingSystemType() throw();
  5300. static const String getOperatingSystemName() throw();
  5301. static bool isOperatingSystem64Bit() throw();
  5302. static const String getLogonName();
  5303. static const String getFullUserName();
  5304. // CPU and memory information..
  5305. static int getCpuSpeedInMegaherz() throw();
  5306. static const String getCpuVendor() throw();
  5307. static bool hasMMX() throw();
  5308. static bool hasSSE() throw();
  5309. static bool hasSSE2() throw();
  5310. static bool has3DNow() throw();
  5311. static int getNumCpus() throw();
  5312. static int64 getClockCycleCounter() throw();
  5313. static int getMemorySizeInMegabytes() throw();
  5314. static int getPageSize() throw();
  5315. static int getMACAddresses (int64* addresses, int maxNum,
  5316. #if JUCE_MAC
  5317. const bool littleEndian = true);
  5318. #else
  5319. const bool littleEndian = false);
  5320. #endif
  5321. static const StringArray getMACAddressStrings();
  5322. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5323. static void initialiseStats() throw();
  5324. };
  5325. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5326. /*** End of inlined file: juce_SystemStats.h ***/
  5327. #endif
  5328. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5329. #endif
  5330. #ifndef __JUCE_TIME_JUCEHEADER__
  5331. #endif
  5332. #ifndef __JUCE_UUID_JUCEHEADER__
  5333. /*** Start of inlined file: juce_Uuid.h ***/
  5334. #ifndef __JUCE_UUID_JUCEHEADER__
  5335. #define __JUCE_UUID_JUCEHEADER__
  5336. class JUCE_API Uuid
  5337. {
  5338. public:
  5339. Uuid();
  5340. ~Uuid() throw();
  5341. Uuid (const Uuid& other);
  5342. Uuid& operator= (const Uuid& other);
  5343. bool isNull() const throw();
  5344. bool operator== (const Uuid& other) const;
  5345. bool operator!= (const Uuid& other) const;
  5346. const String toString() const;
  5347. Uuid (const String& uuidString);
  5348. Uuid& operator= (const String& uuidString);
  5349. const uint8* getRawData() const throw() { return value.asBytes; }
  5350. Uuid (const uint8* const rawData);
  5351. Uuid& operator= (const uint8* const rawData);
  5352. juce_UseDebuggingNewOperator
  5353. private:
  5354. union
  5355. {
  5356. uint8 asBytes [16];
  5357. int asInt[4];
  5358. int64 asInt64[2];
  5359. } value;
  5360. };
  5361. #endif // __JUCE_UUID_JUCEHEADER__
  5362. /*** End of inlined file: juce_Uuid.h ***/
  5363. #endif
  5364. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5365. /*** Start of inlined file: juce_BlowFish.h ***/
  5366. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5367. #define __JUCE_BLOWFISH_JUCEHEADER__
  5368. class JUCE_API BlowFish
  5369. {
  5370. public:
  5371. BlowFish (const void* keyData, int keyBytes);
  5372. BlowFish (const BlowFish& other);
  5373. BlowFish& operator= (const BlowFish& other);
  5374. ~BlowFish();
  5375. void encrypt (uint32& data1, uint32& data2) const throw();
  5376. void decrypt (uint32& data1, uint32& data2) const throw();
  5377. juce_UseDebuggingNewOperator
  5378. private:
  5379. uint32 p[18];
  5380. HeapBlock <uint32> s[4];
  5381. uint32 F (uint32 x) const throw();
  5382. };
  5383. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5384. /*** End of inlined file: juce_BlowFish.h ***/
  5385. #endif
  5386. #ifndef __JUCE_MD5_JUCEHEADER__
  5387. /*** Start of inlined file: juce_MD5.h ***/
  5388. #ifndef __JUCE_MD5_JUCEHEADER__
  5389. #define __JUCE_MD5_JUCEHEADER__
  5390. class JUCE_API MD5
  5391. {
  5392. public:
  5393. MD5();
  5394. MD5 (const MD5& other);
  5395. MD5& operator= (const MD5& other);
  5396. MD5 (const MemoryBlock& data);
  5397. MD5 (const char* data, const size_t numBytes);
  5398. MD5 (const String& text);
  5399. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5400. MD5 (const File& file);
  5401. ~MD5();
  5402. const MemoryBlock getRawChecksumData() const;
  5403. const String toHexString() const;
  5404. bool operator== (const MD5& other) const;
  5405. bool operator!= (const MD5& other) const;
  5406. juce_UseDebuggingNewOperator
  5407. private:
  5408. uint8 result [16];
  5409. struct ProcessContext
  5410. {
  5411. uint8 buffer [64];
  5412. uint32 state [4];
  5413. uint32 count [2];
  5414. ProcessContext();
  5415. void processBlock (const uint8* const data, size_t dataSize);
  5416. void transform (const uint8* const buffer);
  5417. void finish (uint8* const result);
  5418. };
  5419. void processStream (InputStream& input, int64 numBytesToRead);
  5420. };
  5421. #endif // __JUCE_MD5_JUCEHEADER__
  5422. /*** End of inlined file: juce_MD5.h ***/
  5423. #endif
  5424. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5425. /*** Start of inlined file: juce_Primes.h ***/
  5426. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5427. #define __JUCE_PRIMES_JUCEHEADER__
  5428. class JUCE_API Primes
  5429. {
  5430. public:
  5431. static const BigInteger createProbablePrime (int bitLength,
  5432. int certainty,
  5433. const int* randomSeeds = 0,
  5434. int numRandomSeeds = 0);
  5435. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5436. };
  5437. #endif // __JUCE_PRIMES_JUCEHEADER__
  5438. /*** End of inlined file: juce_Primes.h ***/
  5439. #endif
  5440. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5441. /*** Start of inlined file: juce_RSAKey.h ***/
  5442. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5443. #define __JUCE_RSAKEY_JUCEHEADER__
  5444. class JUCE_API RSAKey
  5445. {
  5446. public:
  5447. RSAKey();
  5448. RSAKey (const String& stringRepresentation);
  5449. ~RSAKey();
  5450. const String toString() const;
  5451. bool applyToValue (BigInteger& value) const;
  5452. static void createKeyPair (RSAKey& publicKey,
  5453. RSAKey& privateKey,
  5454. int numBits,
  5455. const int* randomSeeds = 0,
  5456. int numRandomSeeds = 0);
  5457. juce_UseDebuggingNewOperator
  5458. protected:
  5459. BigInteger part1, part2;
  5460. };
  5461. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5462. /*** End of inlined file: juce_RSAKey.h ***/
  5463. #endif
  5464. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5465. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5466. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5467. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5468. class JUCE_API DirectoryIterator
  5469. {
  5470. public:
  5471. DirectoryIterator (const File& directory,
  5472. bool isRecursive,
  5473. const String& wildCard = JUCE_T("*"),
  5474. const int whatToLookFor = File::findFiles);
  5475. ~DirectoryIterator();
  5476. bool next();
  5477. const File getFile() const;
  5478. float getEstimatedProgress() const;
  5479. juce_UseDebuggingNewOperator
  5480. private:
  5481. Array <File> filesFound;
  5482. Array <File> dirsFound;
  5483. String wildCard;
  5484. int index;
  5485. const int whatToLookFor;
  5486. ScopedPointer <DirectoryIterator> subIterator;
  5487. DirectoryIterator (const DirectoryIterator&);
  5488. DirectoryIterator& operator= (const DirectoryIterator&);
  5489. };
  5490. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5491. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5492. #endif
  5493. #ifndef __JUCE_FILE_JUCEHEADER__
  5494. #endif
  5495. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5496. /*** Start of inlined file: juce_FileInputStream.h ***/
  5497. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5498. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5499. class JUCE_API FileInputStream : public InputStream
  5500. {
  5501. public:
  5502. FileInputStream (const File& fileToRead);
  5503. ~FileInputStream();
  5504. const File& getFile() const throw() { return file; }
  5505. int64 getTotalLength();
  5506. int read (void* destBuffer, int maxBytesToRead);
  5507. bool isExhausted();
  5508. int64 getPosition();
  5509. bool setPosition (int64 pos);
  5510. juce_UseDebuggingNewOperator
  5511. private:
  5512. File file;
  5513. void* fileHandle;
  5514. int64 currentPosition, totalSize;
  5515. bool needToSeek;
  5516. FileInputStream (const FileInputStream&);
  5517. FileInputStream& operator= (const FileInputStream&);
  5518. };
  5519. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5520. /*** End of inlined file: juce_FileInputStream.h ***/
  5521. #endif
  5522. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5523. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5524. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5525. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5526. class JUCE_API FileOutputStream : public OutputStream
  5527. {
  5528. public:
  5529. FileOutputStream (const File& fileToWriteTo,
  5530. const int bufferSizeToUse = 16384);
  5531. ~FileOutputStream();
  5532. const File& getFile() const { return file; }
  5533. bool failedToOpen() const { return fileHandle == 0; }
  5534. void flush();
  5535. int64 getPosition();
  5536. bool setPosition (int64 pos);
  5537. bool write (const void* data, int numBytes);
  5538. juce_UseDebuggingNewOperator
  5539. private:
  5540. File file;
  5541. void* fileHandle;
  5542. int64 currentPosition;
  5543. int bufferSize, bytesInBuffer;
  5544. HeapBlock <char> buffer;
  5545. FileOutputStream (const FileOutputStream&);
  5546. FileOutputStream& operator= (const FileOutputStream&);
  5547. };
  5548. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5549. /*** End of inlined file: juce_FileOutputStream.h ***/
  5550. #endif
  5551. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5552. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5553. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5554. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5555. class JUCE_API FileSearchPath
  5556. {
  5557. public:
  5558. FileSearchPath();
  5559. FileSearchPath (const String& path);
  5560. FileSearchPath (const FileSearchPath& other);
  5561. ~FileSearchPath();
  5562. FileSearchPath& operator= (const String& path);
  5563. int getNumPaths() const;
  5564. const File operator[] (const int index) const;
  5565. const String toString() const;
  5566. void add (const File& directoryToAdd,
  5567. const int insertIndex = -1);
  5568. void addIfNotAlreadyThere (const File& directoryToAdd);
  5569. void remove (const int indexToRemove);
  5570. void addPath (const FileSearchPath& other);
  5571. void removeRedundantPaths();
  5572. void removeNonExistentPaths();
  5573. int findChildFiles (Array<File>& results,
  5574. const int whatToLookFor,
  5575. const bool searchRecursively,
  5576. const String& wildCardPattern = JUCE_T("*")) const;
  5577. bool isFileInPath (const File& fileToCheck,
  5578. const bool checkRecursively) const;
  5579. juce_UseDebuggingNewOperator
  5580. private:
  5581. StringArray directories;
  5582. void init (const String& path);
  5583. };
  5584. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5585. /*** End of inlined file: juce_FileSearchPath.h ***/
  5586. #endif
  5587. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5588. /*** Start of inlined file: juce_NamedPipe.h ***/
  5589. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5590. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5591. class JUCE_API NamedPipe
  5592. {
  5593. public:
  5594. NamedPipe();
  5595. ~NamedPipe();
  5596. bool openExisting (const String& pipeName);
  5597. bool createNewPipe (const String& pipeName);
  5598. void close();
  5599. bool isOpen() const;
  5600. const String getName() const;
  5601. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5602. int write (const void* sourceBuffer, int numBytesToWrite,
  5603. int timeOutMilliseconds = 2000);
  5604. void cancelPendingReads();
  5605. juce_UseDebuggingNewOperator
  5606. private:
  5607. void* internal;
  5608. String currentPipeName;
  5609. CriticalSection lock;
  5610. NamedPipe (const NamedPipe&);
  5611. NamedPipe& operator= (const NamedPipe&);
  5612. bool openInternal (const String& pipeName, const bool createPipe);
  5613. };
  5614. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5615. /*** End of inlined file: juce_NamedPipe.h ***/
  5616. #endif
  5617. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5618. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5619. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5620. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5621. class JUCE_API TemporaryFile
  5622. {
  5623. public:
  5624. enum OptionFlags
  5625. {
  5626. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5627. i.e. its name should start with a dot. */
  5628. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5629. the file is unique, they should go in brackets rather
  5630. than just being appended (see File::getNonexistentSibling() )*/
  5631. };
  5632. TemporaryFile (const String& suffix = String::empty,
  5633. const int optionFlags = 0);
  5634. TemporaryFile (const File& targetFile,
  5635. const int optionFlags = 0);
  5636. ~TemporaryFile();
  5637. const File getFile() const { return temporaryFile; }
  5638. const File getTargetFile() const { return targetFile; }
  5639. bool overwriteTargetFileWithTemporary() const;
  5640. juce_UseDebuggingNewOperator
  5641. private:
  5642. File temporaryFile, targetFile;
  5643. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5644. TemporaryFile (const TemporaryFile&);
  5645. TemporaryFile& operator= (const TemporaryFile&);
  5646. };
  5647. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5648. /*** End of inlined file: juce_TemporaryFile.h ***/
  5649. #endif
  5650. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5651. /*** Start of inlined file: juce_ZipFile.h ***/
  5652. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5653. #define __JUCE_ZIPFILE_JUCEHEADER__
  5654. /*** Start of inlined file: juce_InputSource.h ***/
  5655. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5656. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5657. class JUCE_API InputSource
  5658. {
  5659. public:
  5660. InputSource() throw() {}
  5661. virtual ~InputSource() {}
  5662. virtual InputStream* createInputStream() = 0;
  5663. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5664. virtual int64 hashCode() const = 0;
  5665. juce_UseDebuggingNewOperator
  5666. };
  5667. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5668. /*** End of inlined file: juce_InputSource.h ***/
  5669. class JUCE_API ZipFile
  5670. {
  5671. public:
  5672. ZipFile (InputStream* const inputStream,
  5673. const bool deleteStreamWhenDestroyed) throw();
  5674. ZipFile (const File& file);
  5675. ZipFile (InputSource* const inputSource);
  5676. ~ZipFile() throw();
  5677. struct ZipEntry
  5678. {
  5679. String filename;
  5680. unsigned int uncompressedSize;
  5681. Time fileTime;
  5682. };
  5683. int getNumEntries() const throw();
  5684. const ZipEntry* getEntry (const int index) const throw();
  5685. int getIndexOfFileName (const String& fileName) const throw();
  5686. const ZipEntry* getEntry (const String& fileName) const throw();
  5687. void sortEntriesByFilename();
  5688. InputStream* createStreamForEntry (const int index);
  5689. void uncompressTo (const File& targetDirectory,
  5690. const bool shouldOverwriteFiles = true);
  5691. juce_UseDebuggingNewOperator
  5692. private:
  5693. class ZipInputStream;
  5694. class ZipFilenameComparator;
  5695. class ZipEntryInfo;
  5696. friend class ZipInputStream;
  5697. friend class ZipFilenameComparator;
  5698. friend class ZipEntryInfo;
  5699. OwnedArray <ZipEntryInfo> entries;
  5700. CriticalSection lock;
  5701. InputStream* inputStream;
  5702. ScopedPointer <InputStream> streamToDelete;
  5703. ScopedPointer <InputSource> inputSource;
  5704. #ifdef JUCE_DEBUG
  5705. int numOpenStreams;
  5706. #endif
  5707. void init();
  5708. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5709. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5710. ZipFile (const ZipFile&);
  5711. ZipFile& operator= (const ZipFile&);
  5712. };
  5713. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5714. /*** End of inlined file: juce_ZipFile.h ***/
  5715. #endif
  5716. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5717. /*** Start of inlined file: juce_Socket.h ***/
  5718. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5719. #define __JUCE_SOCKET_JUCEHEADER__
  5720. class JUCE_API StreamingSocket
  5721. {
  5722. public:
  5723. StreamingSocket();
  5724. ~StreamingSocket();
  5725. bool bindToPort (const int localPortNumber);
  5726. bool connect (const String& remoteHostname,
  5727. const int remotePortNumber,
  5728. const int timeOutMillisecs = 3000);
  5729. bool isConnected() const throw() { return connected; }
  5730. void close();
  5731. const String& getHostName() const throw() { return hostName; }
  5732. int getPort() const throw() { return portNumber; }
  5733. bool isLocal() const throw();
  5734. int waitUntilReady (const bool readyForReading,
  5735. const int timeoutMsecs) const;
  5736. int read (void* destBuffer, const int maxBytesToRead,
  5737. const bool blockUntilSpecifiedAmountHasArrived);
  5738. int write (const void* sourceBuffer, const int numBytesToWrite);
  5739. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5740. StreamingSocket* waitForNextConnection() const;
  5741. juce_UseDebuggingNewOperator
  5742. private:
  5743. String hostName;
  5744. int volatile portNumber, handle;
  5745. bool connected, isListener;
  5746. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5747. StreamingSocket (const StreamingSocket&);
  5748. StreamingSocket& operator= (const StreamingSocket&);
  5749. };
  5750. class JUCE_API DatagramSocket
  5751. {
  5752. public:
  5753. DatagramSocket (const int localPortNumber,
  5754. const bool enableBroadcasting = false);
  5755. ~DatagramSocket();
  5756. bool bindToPort (const int localPortNumber);
  5757. bool connect (const String& remoteHostname,
  5758. const int remotePortNumber,
  5759. const int timeOutMillisecs = 3000);
  5760. bool isConnected() const throw() { return connected; }
  5761. void close();
  5762. const String& getHostName() const throw() { return hostName; }
  5763. int getPort() const throw() { return portNumber; }
  5764. bool isLocal() const throw();
  5765. int waitUntilReady (const bool readyForReading,
  5766. const int timeoutMsecs) const;
  5767. int read (void* destBuffer, const int maxBytesToRead,
  5768. const bool blockUntilSpecifiedAmountHasArrived);
  5769. int write (const void* sourceBuffer, const int numBytesToWrite);
  5770. DatagramSocket* waitForNextConnection() const;
  5771. juce_UseDebuggingNewOperator
  5772. private:
  5773. String hostName;
  5774. int volatile portNumber, handle;
  5775. bool connected, allowBroadcast;
  5776. void* serverAddress;
  5777. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5778. DatagramSocket (const DatagramSocket&);
  5779. DatagramSocket& operator= (const DatagramSocket&);
  5780. };
  5781. #endif // __JUCE_SOCKET_JUCEHEADER__
  5782. /*** End of inlined file: juce_Socket.h ***/
  5783. #endif
  5784. #ifndef __JUCE_URL_JUCEHEADER__
  5785. /*** Start of inlined file: juce_URL.h ***/
  5786. #ifndef __JUCE_URL_JUCEHEADER__
  5787. #define __JUCE_URL_JUCEHEADER__
  5788. class JUCE_API URL
  5789. {
  5790. public:
  5791. URL();
  5792. URL (const String& url);
  5793. URL (const URL& other);
  5794. ~URL();
  5795. URL& operator= (const URL& other);
  5796. const String toString (const bool includeGetParameters) const;
  5797. bool isWellFormed() const;
  5798. const String getDomain() const;
  5799. const String getSubPath() const;
  5800. const String getScheme() const;
  5801. const URL withNewSubPath (const String& newPath) const;
  5802. const URL withParameter (const String& parameterName,
  5803. const String& parameterValue) const;
  5804. const URL withFileToUpload (const String& parameterName,
  5805. const File& fileToUpload,
  5806. const String& mimeType) const;
  5807. const StringPairArray& getParameters() const;
  5808. const StringPairArray& getFilesToUpload() const;
  5809. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5810. const URL withPOSTData (const String& postData) const;
  5811. const String getPostData() const { return postData; }
  5812. bool launchInDefaultBrowser() const;
  5813. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5814. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5815. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5816. InputStream* createInputStream (const bool usePostCommand,
  5817. OpenStreamProgressCallback* const progressCallback = 0,
  5818. void* const progressCallbackContext = 0,
  5819. const String& extraHeaders = String::empty,
  5820. const int connectionTimeOutMs = 0) const;
  5821. bool readEntireBinaryStream (MemoryBlock& destData,
  5822. const bool usePostCommand = false) const;
  5823. const String readEntireTextStream (const bool usePostCommand = false) const;
  5824. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5825. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5826. const bool isParameter);
  5827. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5828. juce_UseDebuggingNewOperator
  5829. private:
  5830. String url, postData;
  5831. StringPairArray parameters, filesToUpload, mimeTypes;
  5832. };
  5833. #endif // __JUCE_URL_JUCEHEADER__
  5834. /*** End of inlined file: juce_URL.h ***/
  5835. #endif
  5836. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5837. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5838. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5839. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5840. class JUCE_API BufferedInputStream : public InputStream
  5841. {
  5842. public:
  5843. BufferedInputStream (InputStream* const sourceStream,
  5844. const int bufferSize,
  5845. const bool deleteSourceWhenDestroyed);
  5846. ~BufferedInputStream();
  5847. int64 getTotalLength();
  5848. int64 getPosition();
  5849. bool setPosition (int64 newPosition);
  5850. int read (void* destBuffer, int maxBytesToRead);
  5851. const String readString();
  5852. bool isExhausted();
  5853. juce_UseDebuggingNewOperator
  5854. private:
  5855. InputStream* const source;
  5856. ScopedPointer <InputStream> sourceToDelete;
  5857. int bufferSize;
  5858. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5859. HeapBlock <char> buffer;
  5860. void ensureBuffered();
  5861. BufferedInputStream (const BufferedInputStream&);
  5862. BufferedInputStream& operator= (const BufferedInputStream&);
  5863. };
  5864. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5865. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5866. #endif
  5867. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5868. /*** Start of inlined file: juce_FileInputSource.h ***/
  5869. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5870. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5871. class JUCE_API FileInputSource : public InputSource
  5872. {
  5873. public:
  5874. FileInputSource (const File& file);
  5875. ~FileInputSource();
  5876. InputStream* createInputStream();
  5877. InputStream* createInputStreamFor (const String& relatedItemPath);
  5878. int64 hashCode() const;
  5879. juce_UseDebuggingNewOperator
  5880. private:
  5881. const File file;
  5882. FileInputSource (const FileInputSource&);
  5883. FileInputSource& operator= (const FileInputSource&);
  5884. };
  5885. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5886. /*** End of inlined file: juce_FileInputSource.h ***/
  5887. #endif
  5888. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5889. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5890. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5891. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5892. class GZIPCompressorHelper;
  5893. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5894. {
  5895. public:
  5896. GZIPCompressorOutputStream (OutputStream* destStream,
  5897. int compressionLevel = 0,
  5898. bool deleteDestStreamWhenDestroyed = false,
  5899. bool noWrap = false);
  5900. ~GZIPCompressorOutputStream();
  5901. void flush();
  5902. int64 getPosition();
  5903. bool setPosition (int64 newPosition);
  5904. bool write (const void* destBuffer, int howMany);
  5905. juce_UseDebuggingNewOperator
  5906. private:
  5907. OutputStream* const destStream;
  5908. ScopedPointer <OutputStream> streamToDelete;
  5909. HeapBlock <uint8> buffer;
  5910. ScopedPointer <GZIPCompressorHelper> helper;
  5911. bool doNextBlock();
  5912. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5913. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5914. };
  5915. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5916. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5917. #endif
  5918. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5919. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5920. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5921. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5922. class GZIPDecompressHelper;
  5923. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5924. {
  5925. public:
  5926. GZIPDecompressorInputStream (InputStream* sourceStream,
  5927. bool deleteSourceWhenDestroyed,
  5928. bool noWrap = false,
  5929. int64 uncompressedStreamLength = -1);
  5930. ~GZIPDecompressorInputStream();
  5931. int64 getPosition();
  5932. bool setPosition (int64 pos);
  5933. int64 getTotalLength();
  5934. bool isExhausted();
  5935. int read (void* destBuffer, int maxBytesToRead);
  5936. juce_UseDebuggingNewOperator
  5937. private:
  5938. InputStream* const sourceStream;
  5939. ScopedPointer <InputStream> streamToDelete;
  5940. const int64 uncompressedStreamLength;
  5941. const bool noWrap;
  5942. bool isEof;
  5943. int activeBufferSize;
  5944. int64 originalSourcePos, currentPos;
  5945. HeapBlock <uint8> buffer;
  5946. ScopedPointer <GZIPDecompressHelper> helper;
  5947. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5948. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5949. };
  5950. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5951. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5952. #endif
  5953. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5954. #endif
  5955. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5956. #endif
  5957. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5958. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5959. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5960. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5961. class JUCE_API MemoryInputStream : public InputStream
  5962. {
  5963. public:
  5964. MemoryInputStream (const void* sourceData,
  5965. size_t sourceDataSize,
  5966. bool keepInternalCopyOfData);
  5967. MemoryInputStream (const MemoryBlock& data,
  5968. bool keepInternalCopyOfData);
  5969. ~MemoryInputStream();
  5970. int64 getPosition();
  5971. bool setPosition (int64 pos);
  5972. int64 getTotalLength();
  5973. bool isExhausted();
  5974. int read (void* destBuffer, int maxBytesToRead);
  5975. juce_UseDebuggingNewOperator
  5976. private:
  5977. const char* data;
  5978. size_t dataSize, position;
  5979. MemoryBlock internalCopy;
  5980. MemoryInputStream (const MemoryInputStream&);
  5981. MemoryInputStream& operator= (const MemoryInputStream&);
  5982. };
  5983. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5984. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5985. #endif
  5986. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5987. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5988. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5989. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5990. class JUCE_API MemoryOutputStream : public OutputStream
  5991. {
  5992. public:
  5993. MemoryOutputStream (size_t initialSize = 256,
  5994. size_t granularity = 256,
  5995. MemoryBlock* memoryBlockToWriteTo = 0);
  5996. ~MemoryOutputStream();
  5997. const char* getData() const throw();
  5998. size_t getDataSize() const throw();
  5999. void reset() throw();
  6000. void flush();
  6001. bool write (const void* buffer, int howMany);
  6002. int64 getPosition();
  6003. bool setPosition (int64 newPosition);
  6004. juce_UseDebuggingNewOperator
  6005. private:
  6006. MemoryBlock* data;
  6007. ScopedPointer <MemoryBlock> dataToDelete;
  6008. size_t position, size, blockSize;
  6009. MemoryOutputStream (const MemoryOutputStream&);
  6010. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6011. };
  6012. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6013. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6014. #endif
  6015. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6016. #endif
  6017. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6018. /*** Start of inlined file: juce_SubregionStream.h ***/
  6019. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6020. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6021. class JUCE_API SubregionStream : public InputStream
  6022. {
  6023. public:
  6024. SubregionStream (InputStream* const sourceStream,
  6025. const int64 startPositionInSourceStream,
  6026. const int64 lengthOfSourceStream,
  6027. const bool deleteSourceWhenDestroyed) throw();
  6028. ~SubregionStream() throw();
  6029. int64 getTotalLength();
  6030. int64 getPosition();
  6031. bool setPosition (int64 newPosition);
  6032. int read (void* destBuffer, int maxBytesToRead);
  6033. bool isExhausted();
  6034. juce_UseDebuggingNewOperator
  6035. private:
  6036. InputStream* const source;
  6037. ScopedPointer <InputStream> sourceToDelete;
  6038. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6039. SubregionStream (const SubregionStream&);
  6040. SubregionStream& operator= (const SubregionStream&);
  6041. };
  6042. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6043. /*** End of inlined file: juce_SubregionStream.h ***/
  6044. #endif
  6045. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6046. #endif
  6047. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6048. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6049. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6050. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6051. #define TRANS(stringLiteral) \
  6052. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6053. class JUCE_API LocalisedStrings
  6054. {
  6055. public:
  6056. LocalisedStrings (const String& fileContents);
  6057. LocalisedStrings (const File& fileToLoad);
  6058. ~LocalisedStrings();
  6059. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6060. static LocalisedStrings* getCurrentMappings();
  6061. static const String translateWithCurrentMappings (const String& text);
  6062. static const String translateWithCurrentMappings (const char* text);
  6063. const String translate (const String& text) const;
  6064. const String getLanguageName() const { return languageName; }
  6065. const StringArray getCountryCodes() const { return countryCodes; }
  6066. void setIgnoresCase (const bool shouldIgnoreCase);
  6067. juce_UseDebuggingNewOperator
  6068. private:
  6069. String languageName;
  6070. StringArray countryCodes;
  6071. StringPairArray translations;
  6072. void loadFromText (const String& fileContents);
  6073. };
  6074. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6075. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6076. #endif
  6077. #ifndef __JUCE_STRING_JUCEHEADER__
  6078. #endif
  6079. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6080. #endif
  6081. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6082. #endif
  6083. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6084. /*** Start of inlined file: juce_XmlDocument.h ***/
  6085. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6086. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6087. class JUCE_API XmlDocument
  6088. {
  6089. public:
  6090. XmlDocument (const String& documentText) throw();
  6091. XmlDocument (const File& file);
  6092. ~XmlDocument() throw();
  6093. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6094. const String& getLastParseError() const throw();
  6095. void setInputSource (InputSource* const newSource) throw();
  6096. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6097. juce_UseDebuggingNewOperator
  6098. private:
  6099. String originalText;
  6100. const juce_wchar* input;
  6101. bool outOfData, errorOccurred;
  6102. bool identifierLookupTable [128];
  6103. String lastError, dtdText;
  6104. StringArray tokenisedDTD;
  6105. bool needToLoadDTD, ignoreEmptyTextElements;
  6106. ScopedPointer <InputSource> inputSource;
  6107. void setLastError (const String& desc, const bool carryOn) throw();
  6108. void skipHeader() throw();
  6109. void skipNextWhiteSpace() throw();
  6110. juce_wchar readNextChar() throw();
  6111. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  6112. void readChildElements (XmlElement* parent) throw();
  6113. int findNextTokenLength() throw();
  6114. void readQuotedString (String& result) throw();
  6115. void readEntity (String& result) throw();
  6116. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6117. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6118. const String getFileContents (const String& filename) const;
  6119. const String expandEntity (const String& entity);
  6120. const String expandExternalEntity (const String& entity);
  6121. const String getParameterEntity (const String& entity);
  6122. XmlDocument (const XmlDocument&);
  6123. XmlDocument& operator= (const XmlDocument&);
  6124. };
  6125. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6126. /*** End of inlined file: juce_XmlDocument.h ***/
  6127. #endif
  6128. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6129. #endif
  6130. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6131. #endif
  6132. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6133. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6134. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6135. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6136. class JUCE_API InterProcessLock
  6137. {
  6138. public:
  6139. InterProcessLock (const String& name);
  6140. ~InterProcessLock();
  6141. bool enter (int timeOutMillisecs = -1);
  6142. void exit();
  6143. juce_UseDebuggingNewOperator
  6144. private:
  6145. #if JUCE_WINDOWS
  6146. void* internal;
  6147. // #elif JUCE_64BIT
  6148. // long long internal;
  6149. #else
  6150. int internal;
  6151. #endif
  6152. String name;
  6153. int reentrancyLevel;
  6154. InterProcessLock (const InterProcessLock&);
  6155. InterProcessLock& operator= (const InterProcessLock&);
  6156. };
  6157. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6158. /*** End of inlined file: juce_InterProcessLock.h ***/
  6159. #endif
  6160. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6161. /*** Start of inlined file: juce_Process.h ***/
  6162. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6163. #define __JUCE_PROCESS_JUCEHEADER__
  6164. class JUCE_API Process
  6165. {
  6166. public:
  6167. enum ProcessPriority
  6168. {
  6169. LowPriority = 0,
  6170. NormalPriority = 1,
  6171. HighPriority = 2,
  6172. RealtimePriority = 3
  6173. };
  6174. static void setPriority (const ProcessPriority priority);
  6175. static void terminate();
  6176. static bool isForegroundProcess();
  6177. static void raisePrivilege();
  6178. static void lowerPrivilege();
  6179. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6180. };
  6181. #endif // __JUCE_PROCESS_JUCEHEADER__
  6182. /*** End of inlined file: juce_Process.h ***/
  6183. #endif
  6184. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6185. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6186. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6187. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6188. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6189. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6190. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6191. class JUCE_API WaitableEvent
  6192. {
  6193. public:
  6194. WaitableEvent() throw();
  6195. ~WaitableEvent() throw();
  6196. bool wait (const int timeOutMilliseconds = -1) const throw();
  6197. void signal() const throw();
  6198. void reset() const throw();
  6199. juce_UseDebuggingNewOperator
  6200. private:
  6201. void* internal;
  6202. WaitableEvent (const WaitableEvent&);
  6203. WaitableEvent& operator= (const WaitableEvent&);
  6204. };
  6205. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6206. /*** End of inlined file: juce_WaitableEvent.h ***/
  6207. /*** Start of inlined file: juce_Thread.h ***/
  6208. #ifndef __JUCE_THREAD_JUCEHEADER__
  6209. #define __JUCE_THREAD_JUCEHEADER__
  6210. class JUCE_API Thread
  6211. {
  6212. public:
  6213. Thread (const String& threadName);
  6214. virtual ~Thread();
  6215. virtual void run() = 0;
  6216. // Thread control functions..
  6217. void startThread();
  6218. void startThread (const int priority);
  6219. void stopThread (const int timeOutMilliseconds);
  6220. bool isThreadRunning() const;
  6221. void signalThreadShouldExit();
  6222. inline bool threadShouldExit() const { return threadShouldExit_; }
  6223. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6224. bool setPriority (const int priority);
  6225. static bool setCurrentThreadPriority (const int priority);
  6226. void setAffinityMask (const uint32 affinityMask);
  6227. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6228. // this can be called from any thread that needs to pause..
  6229. static void JUCE_CALLTYPE sleep (int milliseconds);
  6230. static void JUCE_CALLTYPE yield();
  6231. bool wait (const int timeOutMilliseconds) const;
  6232. void notify() const;
  6233. typedef void* ThreadID;
  6234. static ThreadID getCurrentThreadId();
  6235. static Thread* getCurrentThread();
  6236. ThreadID getThreadId() const { return threadId_; }
  6237. const String getThreadName() const { return threadName_; }
  6238. static int getNumRunningThreads();
  6239. static void stopAllThreads (const int timeoutInMillisecs);
  6240. juce_UseDebuggingNewOperator
  6241. private:
  6242. const String threadName_;
  6243. void* volatile threadHandle_;
  6244. CriticalSection startStopLock;
  6245. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6246. int threadPriority_;
  6247. ThreadID threadId_;
  6248. uint32 affinityMask_;
  6249. bool volatile threadShouldExit_;
  6250. friend void JUCE_API juce_threadEntryPoint (void*);
  6251. static void threadEntryPoint (Thread* thread);
  6252. static Array<Thread*> runningThreads;
  6253. static CriticalSection runningThreadsLock;
  6254. Thread (const Thread&);
  6255. Thread& operator= (const Thread&);
  6256. };
  6257. #endif // __JUCE_THREAD_JUCEHEADER__
  6258. /*** End of inlined file: juce_Thread.h ***/
  6259. class JUCE_API ReadWriteLock
  6260. {
  6261. public:
  6262. ReadWriteLock() throw();
  6263. ~ReadWriteLock() throw();
  6264. void enterRead() const throw();
  6265. void exitRead() const throw();
  6266. void enterWrite() const throw();
  6267. bool tryEnterWrite() const throw();
  6268. void exitWrite() const throw();
  6269. juce_UseDebuggingNewOperator
  6270. private:
  6271. CriticalSection accessLock;
  6272. WaitableEvent waitEvent;
  6273. mutable int numWaitingWriters, numWriters;
  6274. mutable Thread::ThreadID writerThreadId;
  6275. mutable Array <Thread::ThreadID> readerThreads;
  6276. ReadWriteLock (const ReadWriteLock&);
  6277. ReadWriteLock& operator= (const ReadWriteLock&);
  6278. };
  6279. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6280. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6281. #endif
  6282. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6283. #endif
  6284. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6285. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6286. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6287. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6288. class JUCE_API ScopedReadLock
  6289. {
  6290. public:
  6291. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6292. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6293. private:
  6294. const ReadWriteLock& lock_;
  6295. ScopedReadLock (const ScopedReadLock&);
  6296. ScopedReadLock& operator= (const ScopedReadLock&);
  6297. };
  6298. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6299. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6300. #endif
  6301. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6302. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6303. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6304. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6305. class JUCE_API ScopedTryLock
  6306. {
  6307. public:
  6308. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6309. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6310. bool isLocked() const throw() { return lockWasSuccessful; }
  6311. private:
  6312. const CriticalSection& lock_;
  6313. const bool lockWasSuccessful;
  6314. ScopedTryLock (const ScopedTryLock&);
  6315. ScopedTryLock& operator= (const ScopedTryLock&);
  6316. };
  6317. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6318. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6319. #endif
  6320. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6321. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6322. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6323. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6324. class JUCE_API ScopedWriteLock
  6325. {
  6326. public:
  6327. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6328. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6329. private:
  6330. const ReadWriteLock& lock_;
  6331. ScopedWriteLock (const ScopedWriteLock&);
  6332. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6333. };
  6334. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6335. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6336. #endif
  6337. #ifndef __JUCE_THREAD_JUCEHEADER__
  6338. #endif
  6339. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6340. /*** Start of inlined file: juce_ThreadPool.h ***/
  6341. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6342. #define __JUCE_THREADPOOL_JUCEHEADER__
  6343. class ThreadPool;
  6344. class ThreadPoolThread;
  6345. class JUCE_API ThreadPoolJob
  6346. {
  6347. public:
  6348. ThreadPoolJob (const String& name);
  6349. virtual ~ThreadPoolJob();
  6350. const String getJobName() const;
  6351. void setJobName (const String& newName);
  6352. enum JobStatus
  6353. {
  6354. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6355. removed from the pool. */
  6356. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6357. should be automatically deleted by the pool. */
  6358. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6359. again when a thread is free. */
  6360. };
  6361. virtual JobStatus runJob() = 0;
  6362. bool isRunning() const { return isActive; }
  6363. bool shouldExit() const { return shouldStop; }
  6364. void signalJobShouldExit();
  6365. juce_UseDebuggingNewOperator
  6366. private:
  6367. friend class ThreadPool;
  6368. friend class ThreadPoolThread;
  6369. String jobName;
  6370. ThreadPool* pool;
  6371. bool shouldStop, isActive, shouldBeDeleted;
  6372. ThreadPoolJob (const ThreadPoolJob&);
  6373. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6374. };
  6375. class JUCE_API ThreadPool
  6376. {
  6377. public:
  6378. ThreadPool (const int numberOfThreads,
  6379. const bool startThreadsOnlyWhenNeeded = true,
  6380. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6381. ~ThreadPool();
  6382. class JUCE_API JobSelector
  6383. {
  6384. public:
  6385. virtual ~JobSelector() {}
  6386. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6387. };
  6388. void addJob (ThreadPoolJob* const job);
  6389. bool removeJob (ThreadPoolJob* const job,
  6390. const bool interruptIfRunning,
  6391. const int timeOutMilliseconds);
  6392. bool removeAllJobs (const bool interruptRunningJobs,
  6393. const int timeOutMilliseconds,
  6394. const bool deleteInactiveJobs = false,
  6395. JobSelector* selectedJobsToRemove = 0);
  6396. int getNumJobs() const;
  6397. ThreadPoolJob* getJob (const int index) const;
  6398. bool contains (const ThreadPoolJob* const job) const;
  6399. bool isJobRunning (const ThreadPoolJob* const job) const;
  6400. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6401. const int timeOutMilliseconds) const;
  6402. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6403. bool setThreadPriorities (const int newPriority);
  6404. juce_UseDebuggingNewOperator
  6405. private:
  6406. const int threadStopTimeout;
  6407. int priority;
  6408. class ThreadPoolThread;
  6409. OwnedArray <ThreadPoolThread> threads;
  6410. Array <ThreadPoolJob*> jobs;
  6411. CriticalSection lock;
  6412. uint32 lastJobEndTime;
  6413. WaitableEvent jobFinishedSignal;
  6414. friend class ThreadPoolThread;
  6415. bool runNextJob();
  6416. ThreadPool (const ThreadPool&);
  6417. ThreadPool& operator= (const ThreadPool&);
  6418. };
  6419. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6420. /*** End of inlined file: juce_ThreadPool.h ***/
  6421. #endif
  6422. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6423. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6424. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6425. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6426. class JUCE_API TimeSliceClient
  6427. {
  6428. public:
  6429. virtual ~TimeSliceClient() {}
  6430. virtual bool useTimeSlice() = 0;
  6431. };
  6432. class JUCE_API TimeSliceThread : public Thread
  6433. {
  6434. public:
  6435. TimeSliceThread (const String& threadName);
  6436. ~TimeSliceThread();
  6437. void addTimeSliceClient (TimeSliceClient* const client);
  6438. void removeTimeSliceClient (TimeSliceClient* const client);
  6439. int getNumClients() const;
  6440. TimeSliceClient* getClient (const int index) const;
  6441. void run();
  6442. juce_UseDebuggingNewOperator
  6443. private:
  6444. CriticalSection callbackLock, listLock;
  6445. Array <TimeSliceClient*> clients;
  6446. int index;
  6447. TimeSliceClient* clientBeingCalled;
  6448. bool clientsChanged;
  6449. TimeSliceThread (const TimeSliceThread&);
  6450. TimeSliceThread& operator= (const TimeSliceThread&);
  6451. };
  6452. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6453. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6454. #endif
  6455. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6456. #endif
  6457. #endif
  6458. /*** End of inlined file: juce_core_includes.h ***/
  6459. // if you're compiling a command-line app, you might want to just include the core headers,
  6460. // so you can set this macro before including juce.h
  6461. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6462. /*** Start of inlined file: juce_app_includes.h ***/
  6463. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6464. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6465. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6466. /*** Start of inlined file: juce_Application.h ***/
  6467. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6468. #define __JUCE_APPLICATION_JUCEHEADER__
  6469. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6470. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6471. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6472. /*** Start of inlined file: juce_Component.h ***/
  6473. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6474. #define __JUCE_COMPONENT_JUCEHEADER__
  6475. /*** Start of inlined file: juce_MouseCursor.h ***/
  6476. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6477. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6478. class Image;
  6479. class SharedMouseCursorInternal;
  6480. class ComponentPeer;
  6481. class Component;
  6482. class JUCE_API MouseCursor
  6483. {
  6484. public:
  6485. enum StandardCursorType
  6486. {
  6487. NoCursor = 0, /**< An invisible cursor. */
  6488. NormalCursor, /**< The stardard arrow cursor. */
  6489. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6490. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6491. CrosshairCursor, /**< A pair of crosshairs. */
  6492. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6493. that you're dragging a copy of something. */
  6494. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6495. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6496. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6497. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6498. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6499. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6500. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6501. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6502. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6503. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6504. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6505. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6506. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6507. };
  6508. MouseCursor() throw();
  6509. MouseCursor (const StandardCursorType type) throw();
  6510. MouseCursor (const Image& image,
  6511. const int hotSpotX,
  6512. const int hotSpotY) throw();
  6513. MouseCursor (const MouseCursor& other) throw();
  6514. MouseCursor& operator= (const MouseCursor& other) throw();
  6515. ~MouseCursor() throw();
  6516. bool operator== (const MouseCursor& other) const throw();
  6517. bool operator!= (const MouseCursor& other) const throw();
  6518. static void showWaitCursor() throw();
  6519. static void hideWaitCursor() throw();
  6520. juce_UseDebuggingNewOperator
  6521. private:
  6522. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6523. friend class MouseInputSourceInternal;
  6524. void showInWindow (ComponentPeer* window) const throw();
  6525. void showInAllWindows() const throw();
  6526. void* getHandle() const throw();
  6527. };
  6528. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6529. /*** End of inlined file: juce_MouseCursor.h ***/
  6530. /*** Start of inlined file: juce_MouseListener.h ***/
  6531. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6532. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6533. class MouseEvent;
  6534. class JUCE_API MouseListener
  6535. {
  6536. public:
  6537. virtual ~MouseListener() {}
  6538. virtual void mouseMove (const MouseEvent& e);
  6539. virtual void mouseEnter (const MouseEvent& e);
  6540. virtual void mouseExit (const MouseEvent& e);
  6541. virtual void mouseDown (const MouseEvent& e);
  6542. virtual void mouseDrag (const MouseEvent& e);
  6543. virtual void mouseUp (const MouseEvent& e);
  6544. virtual void mouseDoubleClick (const MouseEvent& e);
  6545. virtual void mouseWheelMove (const MouseEvent& e,
  6546. float wheelIncrementX,
  6547. float wheelIncrementY);
  6548. };
  6549. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6550. /*** End of inlined file: juce_MouseListener.h ***/
  6551. /*** Start of inlined file: juce_MouseEvent.h ***/
  6552. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6553. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6554. class Component;
  6555. class MouseInputSource;
  6556. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6557. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6558. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6559. class JUCE_API ModifierKeys
  6560. {
  6561. public:
  6562. ModifierKeys (const int flags = 0) throw();
  6563. ModifierKeys (const ModifierKeys& other) throw();
  6564. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6565. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6566. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6567. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6568. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6569. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6570. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6571. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6572. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6573. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6574. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6575. enum Flags
  6576. {
  6577. shiftModifier = 1,
  6578. ctrlModifier = 2,
  6579. altModifier = 4,
  6580. leftButtonModifier = 16,
  6581. rightButtonModifier = 32,
  6582. middleButtonModifier = 64,
  6583. #if JUCE_MAC
  6584. commandModifier = 8,
  6585. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6586. #else
  6587. commandModifier = ctrlModifier,
  6588. popupMenuClickModifier = rightButtonModifier,
  6589. #endif
  6590. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6591. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6592. };
  6593. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6594. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6595. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6596. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6597. inline int getRawFlags() const throw() { return flags; }
  6598. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6599. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6600. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6601. int getNumMouseButtonsDown() const throw();
  6602. static const ModifierKeys getCurrentModifiers() throw();
  6603. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6604. private:
  6605. int flags;
  6606. static ModifierKeys currentModifiers;
  6607. friend class ComponentPeer;
  6608. friend class MouseInputSource;
  6609. friend class MouseInputSourceInternal;
  6610. static void updateCurrentModifiers() throw();
  6611. };
  6612. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6613. /*** End of inlined file: juce_ModifierKeys.h ***/
  6614. /*** Start of inlined file: juce_Point.h ***/
  6615. #ifndef __JUCE_POINT_JUCEHEADER__
  6616. #define __JUCE_POINT_JUCEHEADER__
  6617. /*** Start of inlined file: juce_AffineTransform.h ***/
  6618. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6619. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6620. class JUCE_API AffineTransform
  6621. {
  6622. public:
  6623. AffineTransform() throw();
  6624. AffineTransform (const AffineTransform& other) throw();
  6625. AffineTransform (const float mat00, const float mat01, const float mat02,
  6626. const float mat10, const float mat11, const float mat12) throw();
  6627. AffineTransform& operator= (const AffineTransform& other) throw();
  6628. bool operator== (const AffineTransform& other) const throw();
  6629. bool operator!= (const AffineTransform& other) const throw();
  6630. static const AffineTransform identity;
  6631. void transformPoint (float& x,
  6632. float& y) const throw();
  6633. void transformPoint (double& x,
  6634. double& y) const throw();
  6635. const AffineTransform translated (const float deltaX,
  6636. const float deltaY) const throw();
  6637. static const AffineTransform translation (const float deltaX,
  6638. const float deltaY) throw();
  6639. const AffineTransform rotated (const float angleInRadians) const throw();
  6640. const AffineTransform rotated (const float angleInRadians,
  6641. const float pivotX,
  6642. const float pivotY) const throw();
  6643. static const AffineTransform rotation (const float angleInRadians) throw();
  6644. static const AffineTransform rotation (const float angleInRadians,
  6645. const float pivotX,
  6646. const float pivotY) throw();
  6647. const AffineTransform scaled (const float factorX,
  6648. const float factorY) const throw();
  6649. static const AffineTransform scale (const float factorX,
  6650. const float factorY) throw();
  6651. const AffineTransform sheared (const float shearX,
  6652. const float shearY) const throw();
  6653. const AffineTransform inverted() const throw();
  6654. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6655. bool isIdentity() const throw();
  6656. bool isSingularity() const throw();
  6657. bool isOnlyTranslation() const throw();
  6658. float getTranslationX() const throw() { return mat02; }
  6659. float getTranslationY() const throw() { return mat12; }
  6660. juce_UseDebuggingNewOperator
  6661. float mat00, mat01, mat02;
  6662. float mat10, mat11, mat12;
  6663. private:
  6664. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6665. const float mat10, const float mat11, const float mat12) const throw();
  6666. };
  6667. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6668. /*** End of inlined file: juce_AffineTransform.h ***/
  6669. template <typename ValueType>
  6670. class Point
  6671. {
  6672. public:
  6673. Point() throw() : x (0), y (0) {}
  6674. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6675. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6676. ~Point() throw() {}
  6677. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6678. inline ValueType getX() const throw() { return x; }
  6679. inline ValueType getY() const throw() { return y; }
  6680. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6681. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6682. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6683. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6684. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6685. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6686. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6687. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6688. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6689. const Point operator-() const throw() { return Point (-x, -y); }
  6690. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6691. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6692. const String toString() const { return String (x) + ", " + String (y); }
  6693. juce_UseDebuggingNewOperator
  6694. private:
  6695. ValueType x, y;
  6696. };
  6697. #endif // __JUCE_POINT_JUCEHEADER__
  6698. /*** End of inlined file: juce_Point.h ***/
  6699. class JUCE_API MouseEvent
  6700. {
  6701. public:
  6702. MouseEvent (MouseInputSource& source,
  6703. const Point<int>& position,
  6704. const ModifierKeys& modifiers,
  6705. Component* const originator,
  6706. const Time& eventTime,
  6707. const Point<int> mouseDownPos,
  6708. const Time& mouseDownTime,
  6709. const int numberOfClicks,
  6710. const bool mouseWasDragged) throw();
  6711. ~MouseEvent() throw();
  6712. const int x;
  6713. const int y;
  6714. const ModifierKeys mods;
  6715. Component* const eventComponent;
  6716. Component* const originalComponent;
  6717. const Time eventTime;
  6718. MouseInputSource& source;
  6719. int getMouseDownX() const throw();
  6720. int getMouseDownY() const throw();
  6721. const Point<int> getMouseDownPosition() const throw();
  6722. int getDistanceFromDragStart() const throw();
  6723. int getDistanceFromDragStartX() const throw();
  6724. int getDistanceFromDragStartY() const throw();
  6725. const Point<int> getOffsetFromDragStart() const throw();
  6726. bool mouseWasClicked() const throw();
  6727. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6728. int getLengthOfMousePress() const throw();
  6729. const Point<int> getPosition() const throw();
  6730. int getScreenX() const;
  6731. int getScreenY() const;
  6732. const Point<int> getScreenPosition() const;
  6733. int getMouseDownScreenX() const;
  6734. int getMouseDownScreenY() const;
  6735. const Point<int> getMouseDownScreenPosition() const;
  6736. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6737. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6738. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6739. static int getDoubleClickTimeout() throw();
  6740. juce_UseDebuggingNewOperator
  6741. private:
  6742. const Point<int> mouseDownPos;
  6743. const Time mouseDownTime;
  6744. const int numberOfClicks;
  6745. const bool wasMovedSinceMouseDown;
  6746. MouseEvent& operator= (const MouseEvent&);
  6747. };
  6748. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6749. /*** End of inlined file: juce_MouseEvent.h ***/
  6750. /*** Start of inlined file: juce_ComponentListener.h ***/
  6751. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6752. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6753. class Component;
  6754. class JUCE_API ComponentListener
  6755. {
  6756. public:
  6757. virtual ~ComponentListener() {}
  6758. virtual void componentMovedOrResized (Component& component,
  6759. bool wasMoved,
  6760. bool wasResized);
  6761. virtual void componentBroughtToFront (Component& component);
  6762. virtual void componentVisibilityChanged (Component& component);
  6763. virtual void componentChildrenChanged (Component& component);
  6764. virtual void componentParentHierarchyChanged (Component& component);
  6765. virtual void componentNameChanged (Component& component);
  6766. virtual void componentBeingDeleted (Component& component);
  6767. };
  6768. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6769. /*** End of inlined file: juce_ComponentListener.h ***/
  6770. /*** Start of inlined file: juce_KeyListener.h ***/
  6771. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6772. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6773. /*** Start of inlined file: juce_KeyPress.h ***/
  6774. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6775. #define __JUCE_KEYPRESS_JUCEHEADER__
  6776. class JUCE_API KeyPress
  6777. {
  6778. public:
  6779. KeyPress() throw();
  6780. KeyPress (const int keyCode,
  6781. const ModifierKeys& modifiers,
  6782. const juce_wchar textCharacter) throw();
  6783. KeyPress (const int keyCode) throw();
  6784. KeyPress (const KeyPress& other) throw();
  6785. KeyPress& operator= (const KeyPress& other) throw();
  6786. bool operator== (const KeyPress& other) const throw();
  6787. bool operator!= (const KeyPress& other) const throw();
  6788. bool isValid() const throw() { return keyCode != 0; }
  6789. int getKeyCode() const throw() { return keyCode; }
  6790. const ModifierKeys getModifiers() const throw() { return mods; }
  6791. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6792. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6793. static const KeyPress createFromDescription (const String& textVersion) throw();
  6794. const String getTextDescription() const throw();
  6795. bool isCurrentlyDown() const throw();
  6796. static bool isKeyCurrentlyDown (int keyCode) throw();
  6797. // Key codes
  6798. //
  6799. // Note that the actual values of these are platform-specific and may change
  6800. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6801. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6802. //
  6803. static const int spaceKey; /**< key-code for the space bar */
  6804. static const int escapeKey; /**< key-code for the escape key */
  6805. static const int returnKey; /**< key-code for the return key*/
  6806. static const int tabKey; /**< key-code for the tab key*/
  6807. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6808. static const int backspaceKey; /**< key-code for the backspace key */
  6809. static const int insertKey; /**< key-code for the insert key */
  6810. static const int upKey; /**< key-code for the cursor-up key */
  6811. static const int downKey; /**< key-code for the cursor-down key */
  6812. static const int leftKey; /**< key-code for the cursor-left key */
  6813. static const int rightKey; /**< key-code for the cursor-right key */
  6814. static const int pageUpKey; /**< key-code for the page-up key */
  6815. static const int pageDownKey; /**< key-code for the page-down key */
  6816. static const int homeKey; /**< key-code for the home key */
  6817. static const int endKey; /**< key-code for the end key */
  6818. static const int F1Key; /**< key-code for the F1 key */
  6819. static const int F2Key; /**< key-code for the F2 key */
  6820. static const int F3Key; /**< key-code for the F3 key */
  6821. static const int F4Key; /**< key-code for the F4 key */
  6822. static const int F5Key; /**< key-code for the F5 key */
  6823. static const int F6Key; /**< key-code for the F6 key */
  6824. static const int F7Key; /**< key-code for the F7 key */
  6825. static const int F8Key; /**< key-code for the F8 key */
  6826. static const int F9Key; /**< key-code for the F9 key */
  6827. static const int F10Key; /**< key-code for the F10 key */
  6828. static const int F11Key; /**< key-code for the F11 key */
  6829. static const int F12Key; /**< key-code for the F12 key */
  6830. static const int F13Key; /**< key-code for the F13 key */
  6831. static const int F14Key; /**< key-code for the F14 key */
  6832. static const int F15Key; /**< key-code for the F15 key */
  6833. static const int F16Key; /**< key-code for the F16 key */
  6834. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6835. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6836. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6837. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6838. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6839. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6840. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6841. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6842. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6843. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6844. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6845. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6846. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6847. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6848. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6849. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6850. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6851. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6852. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6853. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6854. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6855. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6856. juce_UseDebuggingNewOperator
  6857. private:
  6858. int keyCode;
  6859. ModifierKeys mods;
  6860. juce_wchar textCharacter;
  6861. };
  6862. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6863. /*** End of inlined file: juce_KeyPress.h ***/
  6864. class Component;
  6865. class JUCE_API KeyListener
  6866. {
  6867. public:
  6868. virtual ~KeyListener() {}
  6869. virtual bool keyPressed (const KeyPress& key,
  6870. Component* originatingComponent) = 0;
  6871. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6872. };
  6873. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6874. /*** End of inlined file: juce_KeyListener.h ***/
  6875. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6876. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6877. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6878. class Component;
  6879. class JUCE_API KeyboardFocusTraverser
  6880. {
  6881. public:
  6882. KeyboardFocusTraverser();
  6883. virtual ~KeyboardFocusTraverser();
  6884. virtual Component* getNextComponent (Component* current);
  6885. virtual Component* getPreviousComponent (Component* current);
  6886. virtual Component* getDefaultComponent (Component* parentComponent);
  6887. };
  6888. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6889. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6890. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6891. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6892. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6893. /*** Start of inlined file: juce_Graphics.h ***/
  6894. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6895. #define __JUCE_GRAPHICS_JUCEHEADER__
  6896. /*** Start of inlined file: juce_Font.h ***/
  6897. #ifndef __JUCE_FONT_JUCEHEADER__
  6898. #define __JUCE_FONT_JUCEHEADER__
  6899. /*** Start of inlined file: juce_Typeface.h ***/
  6900. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6901. #define __JUCE_TYPEFACE_JUCEHEADER__
  6902. /*** Start of inlined file: juce_Path.h ***/
  6903. #ifndef __JUCE_PATH_JUCEHEADER__
  6904. #define __JUCE_PATH_JUCEHEADER__
  6905. /*** Start of inlined file: juce_Rectangle.h ***/
  6906. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6907. #define __JUCE_RECTANGLE_JUCEHEADER__
  6908. class RectangleList;
  6909. template <typename ValueType>
  6910. class Rectangle
  6911. {
  6912. public:
  6913. Rectangle() throw()
  6914. : x (0), y (0), w (0), h (0)
  6915. {
  6916. }
  6917. Rectangle (const Rectangle& other) throw()
  6918. : x (other.x), y (other.y),
  6919. w (other.w), h (other.h)
  6920. {
  6921. }
  6922. Rectangle (const ValueType initialX, const ValueType initialY,
  6923. const ValueType width, const ValueType height) throw()
  6924. : x (initialX), y (initialY),
  6925. w (width), h (height)
  6926. {
  6927. }
  6928. Rectangle (const ValueType width, const ValueType height) throw()
  6929. : x (0), y (0), w (width), h (height)
  6930. {
  6931. }
  6932. Rectangle& operator= (const Rectangle& other) throw()
  6933. {
  6934. x = other.x; y = other.y;
  6935. w = other.w; h = other.h;
  6936. return *this;
  6937. }
  6938. ~Rectangle() throw() {}
  6939. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6940. inline ValueType getX() const throw() { return x; }
  6941. inline ValueType getY() const throw() { return y; }
  6942. inline ValueType getWidth() const throw() { return w; }
  6943. inline ValueType getHeight() const throw() { return h; }
  6944. inline ValueType getRight() const throw() { return x + w; }
  6945. inline ValueType getBottom() const throw() { return y + h; }
  6946. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6947. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6948. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6949. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  6950. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6951. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6952. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6953. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  6954. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6955. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  6956. void setBounds (const ValueType newX, const ValueType newY,
  6957. const ValueType newWidth, const ValueType newHeight) throw()
  6958. {
  6959. x = newX; y = newY; w = newWidth; h = newHeight;
  6960. }
  6961. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6962. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6963. void setLeft (const ValueType newLeft) throw()
  6964. {
  6965. w = jmax (ValueType(), x + w - newLeft);
  6966. x = newLeft;
  6967. }
  6968. void setTop (const ValueType newTop) throw()
  6969. {
  6970. h = jmax (ValueType(), y + h - newTop);
  6971. y = newTop;
  6972. }
  6973. void setRight (const ValueType newRight) throw()
  6974. {
  6975. x = jmin (x, newRight);
  6976. w = newRight - x;
  6977. }
  6978. void setBottom (const ValueType newBottom) throw()
  6979. {
  6980. y = jmin (y, newBottom);
  6981. h = newBottom - y;
  6982. }
  6983. void translate (const ValueType deltaX,
  6984. const ValueType deltaY) throw()
  6985. {
  6986. x += deltaX;
  6987. y += deltaY;
  6988. }
  6989. const Rectangle translated (const ValueType deltaX,
  6990. const ValueType deltaY) const throw()
  6991. {
  6992. return Rectangle (x + deltaX, y + deltaY, w, h);
  6993. }
  6994. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  6995. {
  6996. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  6997. }
  6998. void expand (const ValueType deltaX,
  6999. const ValueType deltaY) throw()
  7000. {
  7001. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7002. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7003. setBounds (x - deltaX, y - deltaY, nw, nh);
  7004. }
  7005. const Rectangle expanded (const ValueType deltaX,
  7006. const ValueType deltaY) const throw()
  7007. {
  7008. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7009. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7010. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7011. }
  7012. void reduce (const ValueType deltaX,
  7013. const ValueType deltaY) throw()
  7014. {
  7015. expand (-deltaX, -deltaY);
  7016. }
  7017. const Rectangle reduced (const ValueType deltaX,
  7018. const ValueType deltaY) const throw()
  7019. {
  7020. return expanded (-deltaX, -deltaY);
  7021. }
  7022. bool operator== (const Rectangle& other) const throw()
  7023. {
  7024. return x == other.x && y == other.y
  7025. && w == other.w && h == other.h;
  7026. }
  7027. bool operator!= (const Rectangle& other) const throw()
  7028. {
  7029. return x != other.x || y != other.y
  7030. || w != other.w || h != other.h;
  7031. }
  7032. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7033. {
  7034. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7035. }
  7036. bool contains (const Point<ValueType>& point) const throw()
  7037. {
  7038. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7039. }
  7040. bool contains (const Rectangle& other) const throw()
  7041. {
  7042. return x <= other.x && y <= other.y
  7043. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7044. }
  7045. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7046. {
  7047. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7048. jlimit (y, y + h, point.getY()));
  7049. }
  7050. bool intersects (const Rectangle& other) const throw()
  7051. {
  7052. return x + w > other.x
  7053. && y + h > other.y
  7054. && x < other.x + other.w
  7055. && y < other.y + other.h
  7056. && w > ValueType() && h > ValueType();
  7057. }
  7058. const Rectangle getIntersection (const Rectangle& other) const throw()
  7059. {
  7060. const ValueType nx = jmax (x, other.x);
  7061. const ValueType ny = jmax (y, other.y);
  7062. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7063. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7064. if (nw >= ValueType() && nh >= ValueType())
  7065. return Rectangle (nx, ny, nw, nh);
  7066. return Rectangle();
  7067. }
  7068. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7069. {
  7070. const int maxX = jmax (otherX, x);
  7071. otherW = jmin (otherX + otherW, x + w) - maxX;
  7072. if (otherW > 0)
  7073. {
  7074. const int maxY = jmax (otherY, y);
  7075. otherH = jmin (otherY + otherH, y + h) - maxY;
  7076. if (otherH > 0)
  7077. {
  7078. otherX = maxX; otherY = maxY;
  7079. return true;
  7080. }
  7081. }
  7082. return false;
  7083. }
  7084. const Rectangle getUnion (const Rectangle& other) const throw()
  7085. {
  7086. const ValueType newX = jmin (x, other.x);
  7087. const ValueType newY = jmin (y, other.y);
  7088. return Rectangle (newX, newY,
  7089. jmax (x + w, other.x + other.w) - newX,
  7090. jmax (y + h, other.y + other.h) - newY);
  7091. }
  7092. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7093. {
  7094. if (x == other.x && getRight() == other.getRight()
  7095. && (other.getBottom() >= y && other.y <= getBottom()))
  7096. {
  7097. const ValueType newY = jmin (y, other.y);
  7098. h = jmax (getBottom(), other.getBottom()) - newY;
  7099. y = newY;
  7100. return true;
  7101. }
  7102. else if (y == other.y && getBottom() == other.getBottom()
  7103. && (other.getRight() >= x && other.x <= getRight()))
  7104. {
  7105. const ValueType newX = jmin (x, other.x);
  7106. w = jmax (getRight(), other.getRight()) - newX;
  7107. x = newX;
  7108. return true;
  7109. }
  7110. return false;
  7111. }
  7112. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7113. {
  7114. int inside = 0;
  7115. const int otherR = other.getRight();
  7116. if (x >= other.x && x < otherR) inside = 1;
  7117. const int otherB = other.getBottom();
  7118. if (y >= other.y && y < otherB) inside |= 2;
  7119. const int r = x + w;
  7120. if (r >= other.x && r < otherR) inside |= 4;
  7121. const int b = y + h;
  7122. if (b >= other.y && b < otherB) inside |= 8;
  7123. switch (inside)
  7124. {
  7125. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7126. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7127. case 2 + 4 + 8: w = other.x - x; return true;
  7128. case 1 + 4 + 8: h = other.y - y; return true;
  7129. }
  7130. return false;
  7131. }
  7132. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7133. {
  7134. float x1 = x, y1 = y;
  7135. float x2 = x + w, y2 = y;
  7136. float x3 = x, y3 = y + h;
  7137. float x4 = x2, y4 = y3;
  7138. transform.transformPoint (x1, y1);
  7139. transform.transformPoint (x2, y2);
  7140. transform.transformPoint (x3, y3);
  7141. transform.transformPoint (x4, y4);
  7142. const float x = jmin (x1, x2, x3, x4);
  7143. const float y = jmin (y1, y2, y3, y4);
  7144. return Rectangle (x, y,
  7145. jmax (x1, x2, x3, x4) - x,
  7146. jmax (y1, y2, y3, y4) - y);
  7147. }
  7148. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7149. {
  7150. const int x1 = (int) floorf ((float) x);
  7151. const int y1 = (int) floorf ((float) y);
  7152. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7153. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7154. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7155. }
  7156. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7157. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7158. {
  7159. const ValueType x = jmax (x1, x2);
  7160. w1 = jmin (x1 + w1, x2 + w2) - x;
  7161. if (w1 > 0)
  7162. {
  7163. const ValueType y = jmax (y1, y2);
  7164. h1 = jmin (y1 + h1, y2 + h2) - y;
  7165. if (h1 > 0)
  7166. {
  7167. x1 = x; y1 = y;
  7168. return true;
  7169. }
  7170. }
  7171. return false;
  7172. }
  7173. const String toString() const
  7174. {
  7175. String s;
  7176. s.preallocateStorage (16);
  7177. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  7178. return s;
  7179. }
  7180. static const Rectangle fromString (const String& stringVersion)
  7181. {
  7182. StringArray toks;
  7183. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), String::empty);
  7184. return Rectangle (toks[0].trim().getIntValue(),
  7185. toks[1].trim().getIntValue(),
  7186. toks[2].trim().getIntValue(),
  7187. toks[3].trim().getIntValue());
  7188. }
  7189. juce_UseDebuggingNewOperator
  7190. private:
  7191. friend class RectangleList;
  7192. ValueType x, y, w, h;
  7193. };
  7194. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7195. /*** End of inlined file: juce_Rectangle.h ***/
  7196. /*** Start of inlined file: juce_Justification.h ***/
  7197. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7198. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7199. class JUCE_API Justification
  7200. {
  7201. public:
  7202. inline Justification (const int flags_) throw() : flags (flags_) {}
  7203. Justification (const Justification& other) throw();
  7204. Justification& operator= (const Justification& other) throw();
  7205. inline int getFlags() const throw() { return flags; }
  7206. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7207. int getOnlyVerticalFlags() const throw();
  7208. int getOnlyHorizontalFlags() const throw();
  7209. void applyToRectangle (int& x, int& y,
  7210. const int w, const int h,
  7211. const int spaceX, const int spaceY,
  7212. const int spaceW, const int spaceH) const throw();
  7213. enum
  7214. {
  7215. left = 1,
  7216. right = 2,
  7217. horizontallyCentred = 4,
  7218. top = 8,
  7219. bottom = 16,
  7220. verticallyCentred = 32,
  7221. horizontallyJustified = 64,
  7222. centred = 36,
  7223. centredLeft = 33,
  7224. centredRight = 34,
  7225. centredTop = 12,
  7226. centredBottom = 20,
  7227. topLeft = 9,
  7228. topRight = 10,
  7229. bottomLeft = 17,
  7230. bottomRight = 18
  7231. };
  7232. private:
  7233. int flags;
  7234. };
  7235. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7236. /*** End of inlined file: juce_Justification.h ***/
  7237. /*** Start of inlined file: juce_EdgeTable.h ***/
  7238. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7239. #define __JUCE_EDGETABLE_JUCEHEADER__
  7240. class Path;
  7241. class RectangleList;
  7242. class Image;
  7243. class JUCE_API EdgeTable
  7244. {
  7245. public:
  7246. EdgeTable (const Rectangle<int>& clipLimits,
  7247. const Path& pathToAdd,
  7248. const AffineTransform& transform);
  7249. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7250. EdgeTable (const RectangleList& rectanglesToAdd);
  7251. EdgeTable (const float x, const float y,
  7252. const float w, const float h);
  7253. EdgeTable (const EdgeTable& other);
  7254. EdgeTable& operator= (const EdgeTable& other);
  7255. ~EdgeTable();
  7256. void clipToRectangle (const Rectangle<int>& r) throw();
  7257. void excludeRectangle (const Rectangle<int>& r) throw();
  7258. void clipToEdgeTable (const EdgeTable& other);
  7259. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7260. bool isEmpty() throw();
  7261. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7262. void translate (float dx, int dy) throw();
  7263. void optimiseTable() throw();
  7264. template <class EdgeTableIterationCallback>
  7265. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7266. {
  7267. const int* lineStart = table;
  7268. for (int y = 0; y < bounds.getHeight(); ++y)
  7269. {
  7270. const int* line = lineStart;
  7271. lineStart += lineStrideElements;
  7272. int numPoints = line[0];
  7273. if (--numPoints > 0)
  7274. {
  7275. int x = *++line;
  7276. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7277. int levelAccumulator = 0;
  7278. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7279. while (--numPoints >= 0)
  7280. {
  7281. const int level = *++line;
  7282. jassert (((unsigned int) level) < (unsigned int) 256);
  7283. const int endX = *++line;
  7284. jassert (endX >= x);
  7285. const int endOfRun = (endX >> 8);
  7286. if (endOfRun == (x >> 8))
  7287. {
  7288. // small segment within the same pixel, so just save it for the next
  7289. // time round..
  7290. levelAccumulator += (endX - x) * level;
  7291. }
  7292. else
  7293. {
  7294. // plot the fist pixel of this segment, including any accumulated
  7295. // levels from smaller segments that haven't been drawn yet
  7296. levelAccumulator += (0xff - (x & 0xff)) * level;
  7297. levelAccumulator >>= 8;
  7298. x >>= 8;
  7299. if (levelAccumulator > 0)
  7300. {
  7301. if (levelAccumulator >> 8)
  7302. levelAccumulator = 0xff;
  7303. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7304. }
  7305. // if there's a run of similar pixels, do it all in one go..
  7306. if (level > 0)
  7307. {
  7308. jassert (endOfRun <= bounds.getRight());
  7309. const int numPix = endOfRun - ++x;
  7310. if (numPix > 0)
  7311. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7312. }
  7313. // save the bit at the end to be drawn next time round the loop.
  7314. levelAccumulator = (endX & 0xff) * level;
  7315. }
  7316. x = endX;
  7317. }
  7318. if (levelAccumulator > 0)
  7319. {
  7320. levelAccumulator >>= 8;
  7321. if (levelAccumulator >> 8)
  7322. levelAccumulator = 0xff;
  7323. x >>= 8;
  7324. jassert (x >= bounds.getX() && x < bounds.getRight());
  7325. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7326. }
  7327. }
  7328. }
  7329. }
  7330. juce_UseDebuggingNewOperator
  7331. private:
  7332. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7333. HeapBlock<int> table;
  7334. Rectangle<int> bounds;
  7335. int maxEdgesPerLine, lineStrideElements;
  7336. bool needToCheckEmptinesss;
  7337. void addEdgePoint (const int x, const int y, const int winding) throw();
  7338. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7339. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7340. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7341. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7342. static void copyEdgeTableData (int* dest, const int destLineStride, const int* src, const int srcLineStride, int numLines) throw();
  7343. };
  7344. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7345. /*** End of inlined file: juce_EdgeTable.h ***/
  7346. class Image;
  7347. class JUCE_API Path
  7348. {
  7349. public:
  7350. Path();
  7351. Path (const Path& other);
  7352. ~Path();
  7353. Path& operator= (const Path& other);
  7354. bool isEmpty() const throw();
  7355. const Rectangle<float> getBounds() const throw();
  7356. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7357. bool contains (float x, float y,
  7358. float tolerence = 10.0f) const;
  7359. bool intersectsLine (float x1, float y1,
  7360. float x2, float y2,
  7361. float tolerence = 10.0f);
  7362. void clear() throw();
  7363. void startNewSubPath (float startX, float startY);
  7364. void closeSubPath();
  7365. void lineTo (float endX, float endY);
  7366. void quadraticTo (float controlPointX,
  7367. float controlPointY,
  7368. float endPointX,
  7369. float endPointY);
  7370. void cubicTo (float controlPoint1X,
  7371. float controlPoint1Y,
  7372. float controlPoint2X,
  7373. float controlPoint2Y,
  7374. float endPointX,
  7375. float endPointY);
  7376. const Point<float> getCurrentPosition() const;
  7377. void addRectangle (float x, float y, float width, float height);
  7378. void addRectangle (const Rectangle<int>& rectangle);
  7379. void addRoundedRectangle (float x, float y, float width, float height,
  7380. float cornerSize);
  7381. void addRoundedRectangle (float x, float y, float width, float height,
  7382. float cornerSizeX,
  7383. float cornerSizeY);
  7384. void addTriangle (float x1, float y1,
  7385. float x2, float y2,
  7386. float x3, float y3);
  7387. void addQuadrilateral (float x1, float y1,
  7388. float x2, float y2,
  7389. float x3, float y3,
  7390. float x4, float y4);
  7391. void addEllipse (float x, float y, float width, float height);
  7392. void addArc (float x, float y, float width, float height,
  7393. float fromRadians,
  7394. float toRadians,
  7395. bool startAsNewSubPath = false);
  7396. void addCentredArc (float centreX, float centreY,
  7397. float radiusX, float radiusY,
  7398. float rotationOfEllipse,
  7399. float fromRadians,
  7400. float toRadians,
  7401. bool startAsNewSubPath = false);
  7402. void addPieSegment (float x, float y,
  7403. float width, float height,
  7404. float fromRadians,
  7405. float toRadians,
  7406. float innerCircleProportionalSize);
  7407. void addLineSegment (float startX, float startY,
  7408. float endX, float endY,
  7409. float lineThickness);
  7410. void addArrow (float startX, float startY,
  7411. float endX, float endY,
  7412. float lineThickness,
  7413. float arrowheadWidth,
  7414. float arrowheadLength);
  7415. void addStar (float centreX,
  7416. float centreY,
  7417. int numberOfPoints,
  7418. float innerRadius,
  7419. float outerRadius,
  7420. float startAngle = 0.0f);
  7421. void addBubble (float bodyX, float bodyY,
  7422. float bodyW, float bodyH,
  7423. float cornerSize,
  7424. float arrowTipX,
  7425. float arrowTipY,
  7426. int whichSide,
  7427. float arrowPositionAlongEdgeProportional,
  7428. float arrowWidth);
  7429. void addPath (const Path& pathToAppend);
  7430. void addPath (const Path& pathToAppend,
  7431. const AffineTransform& transformToApply);
  7432. void swapWithPath (Path& other);
  7433. void applyTransform (const AffineTransform& transform) throw();
  7434. void scaleToFit (float x, float y, float width, float height,
  7435. bool preserveProportions) throw();
  7436. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7437. bool preserveProportions,
  7438. const Justification& justificationType = Justification::centred) const;
  7439. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7440. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7441. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7442. class JUCE_API Iterator
  7443. {
  7444. public:
  7445. Iterator (const Path& path);
  7446. ~Iterator();
  7447. bool next();
  7448. enum PathElementType
  7449. {
  7450. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7451. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7452. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7453. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7454. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7455. };
  7456. PathElementType elementType;
  7457. float x1, y1, x2, y2, x3, y3;
  7458. private:
  7459. const Path& path;
  7460. size_t index;
  7461. Iterator (const Iterator&);
  7462. Iterator& operator= (const Iterator&);
  7463. };
  7464. void loadPathFromStream (InputStream& source);
  7465. void loadPathFromData (const void* data, int numberOfBytes);
  7466. void writePathToStream (OutputStream& destination) const;
  7467. const String toString() const;
  7468. void restoreFromString (const String& stringVersion);
  7469. juce_UseDebuggingNewOperator
  7470. private:
  7471. friend class PathFlatteningIterator;
  7472. friend class Path::Iterator;
  7473. ArrayAllocationBase <float, DummyCriticalSection> data;
  7474. size_t numElements;
  7475. float pathXMin, pathXMax, pathYMin, pathYMax;
  7476. bool useNonZeroWinding;
  7477. static const float lineMarker;
  7478. static const float moveMarker;
  7479. static const float quadMarker;
  7480. static const float cubicMarker;
  7481. static const float closeSubPathMarker;
  7482. };
  7483. #endif // __JUCE_PATH_JUCEHEADER__
  7484. /*** End of inlined file: juce_Path.h ***/
  7485. class Font;
  7486. class JUCE_API Typeface : public ReferenceCountedObject
  7487. {
  7488. public:
  7489. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7490. const String getName() const throw() { return name; }
  7491. static const Ptr createSystemTypefaceFor (const Font& font);
  7492. virtual ~Typeface();
  7493. virtual float getAscent() const = 0;
  7494. virtual float getDescent() const = 0;
  7495. virtual float getStringWidth (const String& text) = 0;
  7496. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7497. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7498. juce_UseDebuggingNewOperator
  7499. protected:
  7500. String name;
  7501. Typeface (const String& name) throw();
  7502. private:
  7503. Typeface (const Typeface&);
  7504. Typeface& operator= (const Typeface&);
  7505. };
  7506. class JUCE_API CustomTypeface : public Typeface
  7507. {
  7508. public:
  7509. CustomTypeface();
  7510. CustomTypeface (InputStream& serialisedTypefaceStream);
  7511. ~CustomTypeface();
  7512. void clear();
  7513. void setCharacteristics (const String& name, const float ascent,
  7514. const bool isBold, const bool isItalic,
  7515. const juce_wchar defaultCharacter) throw();
  7516. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7517. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7518. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7519. bool writeToStream (OutputStream& outputStream);
  7520. // The following methods implement the basic Typeface behaviour.
  7521. float getAscent() const;
  7522. float getDescent() const;
  7523. float getStringWidth (const String& text);
  7524. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7525. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7526. int getGlyphForCharacter (juce_wchar character);
  7527. juce_UseDebuggingNewOperator
  7528. protected:
  7529. juce_wchar defaultCharacter;
  7530. float ascent;
  7531. bool isBold, isItalic;
  7532. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7533. private:
  7534. class GlyphInfo;
  7535. friend class OwnedArray<GlyphInfo>;
  7536. OwnedArray <GlyphInfo> glyphs;
  7537. short lookupTable [128];
  7538. CustomTypeface (const CustomTypeface&);
  7539. CustomTypeface& operator= (const CustomTypeface&);
  7540. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7541. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7542. };
  7543. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7544. /*** End of inlined file: juce_Typeface.h ***/
  7545. class LowLevelGraphicsContext;
  7546. class JUCE_API Font
  7547. {
  7548. public:
  7549. enum FontStyleFlags
  7550. {
  7551. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7552. bold = 1, /**< boldens the font. @see setStyleFlags */
  7553. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7554. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7555. };
  7556. Font (const float fontHeight,
  7557. const int styleFlags = plain) throw();
  7558. Font (const String& typefaceName,
  7559. const float fontHeight,
  7560. const int styleFlags) throw();
  7561. Font (const Font& other) throw();
  7562. Font (const Typeface::Ptr& typeface) throw();
  7563. Font() throw();
  7564. Font& operator= (const Font& other) throw();
  7565. bool operator== (const Font& other) const throw();
  7566. bool operator!= (const Font& other) const throw();
  7567. ~Font() throw();
  7568. void setTypefaceName (const String& faceName) throw();
  7569. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7570. static const String getDefaultSansSerifFontName() throw();
  7571. static const String getDefaultSerifFontName() throw();
  7572. static const String getDefaultMonospacedFontName() throw();
  7573. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7574. float getHeight() const throw() { return font->height; }
  7575. void setHeight (float newHeight) throw();
  7576. void setHeightWithoutChangingWidth (float newHeight) throw();
  7577. float getAscent() const throw();
  7578. float getDescent() const throw();
  7579. int getStyleFlags() const throw() { return font->styleFlags; }
  7580. void setStyleFlags (const int newFlags) throw();
  7581. void setBold (const bool shouldBeBold) throw();
  7582. bool isBold() const throw();
  7583. void setItalic (const bool shouldBeItalic) throw();
  7584. bool isItalic() const throw();
  7585. void setUnderline (const bool shouldBeUnderlined) throw();
  7586. bool isUnderlined() const throw();
  7587. void setHorizontalScale (const float scaleFactor) throw();
  7588. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7589. void setExtraKerningFactor (const float extraKerning) throw();
  7590. float getExtraKerningFactor() const throw() { return font->kerning; }
  7591. void setSizeAndStyle (float newHeight,
  7592. const int newStyleFlags,
  7593. const float newHorizontalScale,
  7594. const float newKerningAmount) throw();
  7595. int getStringWidth (const String& text) const throw();
  7596. float getStringWidthFloat (const String& text) const throw();
  7597. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7598. Typeface* getTypeface() const throw();
  7599. static void findFonts (Array<Font>& results) throw();
  7600. static const StringArray findAllTypefaceNames() throw();
  7601. static const String getFallbackFontName() throw();
  7602. static void setFallbackFontName (const String& name) throw();
  7603. juce_UseDebuggingNewOperator
  7604. private:
  7605. friend class FontGlyphAlphaMap;
  7606. friend class TypefaceCache;
  7607. class SharedFontInternal : public ReferenceCountedObject
  7608. {
  7609. public:
  7610. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7611. const float kerning, const float ascent, const int styleFlags,
  7612. Typeface* const typeface) throw();
  7613. SharedFontInternal (const SharedFontInternal& other) throw();
  7614. String typefaceName;
  7615. float height, horizontalScale, kerning, ascent;
  7616. int styleFlags;
  7617. Typeface::Ptr typeface;
  7618. };
  7619. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7620. void dupeInternalIfShared() throw();
  7621. };
  7622. #endif // __JUCE_FONT_JUCEHEADER__
  7623. /*** End of inlined file: juce_Font.h ***/
  7624. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7625. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7626. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7627. class JUCE_API PathStrokeType
  7628. {
  7629. public:
  7630. enum JointStyle
  7631. {
  7632. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7633. Note that for angles that curve back on themselves, drawing a
  7634. mitre could require extending the point too far away from the
  7635. path, so a mitre limit is imposed and any corners that exceed it
  7636. are drawn as bevelled instead. */
  7637. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7638. beveled /**< Indicates that corners should be drawn with a line flattening their
  7639. outside edge. */
  7640. };
  7641. enum EndCapStyle
  7642. {
  7643. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7644. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7645. the thickness of the stroke. */
  7646. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7647. };
  7648. PathStrokeType (const float strokeThickness,
  7649. const JointStyle jointStyle = mitered,
  7650. const EndCapStyle endStyle = butt) throw();
  7651. PathStrokeType (const PathStrokeType& other) throw();
  7652. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7653. ~PathStrokeType() throw();
  7654. void createStrokedPath (Path& destPath,
  7655. const Path& sourcePath,
  7656. const AffineTransform& transform = AffineTransform::identity,
  7657. const float extraAccuracy = 1.0f) const;
  7658. void createDashedStroke (Path& destPath,
  7659. const Path& sourcePath,
  7660. const float* dashLengths,
  7661. int numDashLengths,
  7662. const AffineTransform& transform = AffineTransform::identity,
  7663. const float extraAccuracy = 1.0f) const;
  7664. float getStrokeThickness() const throw() { return thickness; }
  7665. JointStyle getJointStyle() const throw() { return jointStyle; }
  7666. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7667. juce_UseDebuggingNewOperator
  7668. bool operator== (const PathStrokeType& other) const throw();
  7669. bool operator!= (const PathStrokeType& other) const throw();
  7670. private:
  7671. float thickness;
  7672. JointStyle jointStyle;
  7673. EndCapStyle endStyle;
  7674. };
  7675. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7676. /*** End of inlined file: juce_PathStrokeType.h ***/
  7677. /*** Start of inlined file: juce_Line.h ***/
  7678. #ifndef __JUCE_LINE_JUCEHEADER__
  7679. #define __JUCE_LINE_JUCEHEADER__
  7680. class JUCE_API Line
  7681. {
  7682. public:
  7683. Line() throw();
  7684. Line (const Line& other) throw();
  7685. Line (const float startX,
  7686. const float startY,
  7687. const float endX,
  7688. const float endY) throw();
  7689. Line (const Point<float>& start,
  7690. const Point<float>& end) throw();
  7691. Line& operator= (const Line& other) throw();
  7692. ~Line() throw();
  7693. inline float getStartX() const throw() { return startX; }
  7694. inline float getStartY() const throw() { return startY; }
  7695. inline float getEndX() const throw() { return endX; }
  7696. inline float getEndY() const throw() { return endY; }
  7697. const Point<float> getStart() const throw();
  7698. const Point<float> getEnd() const throw();
  7699. void setStart (const float newStartX,
  7700. const float newStartY) throw();
  7701. void setEnd (const float newEndX,
  7702. const float newEndY) throw();
  7703. void setStart (const Point<float>& newStart) throw();
  7704. void setEnd (const Point<float>& newEnd) throw();
  7705. void applyTransform (const AffineTransform& transform) throw();
  7706. float getLength() const throw();
  7707. bool isVertical() const throw();
  7708. bool isHorizontal() const throw();
  7709. float getAngle() const throw();
  7710. bool operator== (const Line& other) const throw();
  7711. bool operator!= (const Line& other) const throw();
  7712. bool intersects (const Line& line,
  7713. float& intersectionX,
  7714. float& intersectionY) const throw();
  7715. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7716. const Point<float> getPointAlongLine (const float distanceFromStart,
  7717. const float perpendicularDistance) const throw();
  7718. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7719. float getDistanceFromLine (const float x,
  7720. const float y) const throw();
  7721. float findNearestPointTo (const float x,
  7722. const float y) const throw();
  7723. bool isPointAbove (const float x, const float y) const throw();
  7724. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7725. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7726. bool clipToPath (const Path& path,
  7727. const bool keepSectionOutsidePath) throw();
  7728. juce_UseDebuggingNewOperator
  7729. private:
  7730. float startX, startY, endX, endY;
  7731. };
  7732. #endif // __JUCE_LINE_JUCEHEADER__
  7733. /*** End of inlined file: juce_Line.h ***/
  7734. /*** Start of inlined file: juce_Colours.h ***/
  7735. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7736. #define __JUCE_COLOURS_JUCEHEADER__
  7737. /*** Start of inlined file: juce_Colour.h ***/
  7738. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7739. #define __JUCE_COLOUR_JUCEHEADER__
  7740. /*** Start of inlined file: juce_PixelFormats.h ***/
  7741. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7742. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7743. #if JUCE_MSVC
  7744. #pragma pack (push, 1)
  7745. #define PACKED
  7746. #elif JUCE_GCC
  7747. #define PACKED __attribute__((packed))
  7748. #else
  7749. #define PACKED
  7750. #endif
  7751. class PixelRGB;
  7752. class PixelAlpha;
  7753. class JUCE_API PixelARGB
  7754. {
  7755. public:
  7756. PixelARGB() throw() {}
  7757. ~PixelARGB() throw() {}
  7758. PixelARGB (const uint32 argb_) throw()
  7759. : argb (argb_)
  7760. {
  7761. }
  7762. forcedinline uint32 getARGB() const throw() { return argb; }
  7763. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7764. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7765. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7766. forcedinline uint8 getRed() const throw() { return components.r; }
  7767. forcedinline uint8 getGreen() const throw() { return components.g; }
  7768. forcedinline uint8 getBlue() const throw() { return components.b; }
  7769. forcedinline void blend (const PixelARGB& src) throw()
  7770. {
  7771. uint32 sargb = src.getARGB();
  7772. const uint32 alpha = 0x100 - (sargb >> 24);
  7773. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7774. sargb += 0xff00ff00 & (getAG() * alpha);
  7775. argb = sargb;
  7776. }
  7777. forcedinline void blend (const PixelAlpha& src) throw();
  7778. forcedinline void blend (const PixelRGB& src) throw();
  7779. template <class Pixel>
  7780. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7781. {
  7782. ++extraAlpha;
  7783. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7784. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7785. const uint32 alpha = 0x100 - (sargb >> 24);
  7786. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7787. sargb += 0xff00ff00 & (getAG() * alpha);
  7788. argb = sargb;
  7789. }
  7790. template <class Pixel>
  7791. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7792. {
  7793. uint32 drb = getRB();
  7794. drb += (((src.getRB() - drb) * amount) >> 8);
  7795. drb &= 0x00ff00ff;
  7796. uint32 dag = getAG();
  7797. dag += (((src.getAG() - dag) * amount) >> 8);
  7798. dag &= 0x00ff00ff;
  7799. dag <<= 8;
  7800. dag |= drb;
  7801. argb = dag;
  7802. }
  7803. template <class Pixel>
  7804. forcedinline void set (const Pixel& src) throw()
  7805. {
  7806. argb = src.getARGB();
  7807. }
  7808. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7809. {
  7810. components.a = newAlpha;
  7811. }
  7812. forcedinline void multiplyAlpha (int multiplier) throw()
  7813. {
  7814. ++multiplier;
  7815. argb = ((multiplier * getAG()) & 0xff00ff00)
  7816. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7817. }
  7818. forcedinline void multiplyAlpha (const float multiplier) throw()
  7819. {
  7820. multiplyAlpha ((int) (multiplier * 256.0f));
  7821. }
  7822. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7823. {
  7824. components.b = b;
  7825. components.g = g;
  7826. components.r = r;
  7827. components.a = a;
  7828. }
  7829. forcedinline void premultiply() throw()
  7830. {
  7831. const uint32 alpha = components.a;
  7832. if (alpha < 0xff)
  7833. {
  7834. if (alpha == 0)
  7835. {
  7836. components.b = 0;
  7837. components.g = 0;
  7838. components.r = 0;
  7839. }
  7840. else
  7841. {
  7842. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7843. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7844. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7845. }
  7846. }
  7847. }
  7848. forcedinline void unpremultiply() throw()
  7849. {
  7850. const uint32 alpha = components.a;
  7851. if (alpha < 0xff)
  7852. {
  7853. if (alpha == 0)
  7854. {
  7855. components.b = 0;
  7856. components.g = 0;
  7857. components.r = 0;
  7858. }
  7859. else
  7860. {
  7861. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7862. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7863. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7864. }
  7865. }
  7866. }
  7867. forcedinline void desaturate() throw()
  7868. {
  7869. if (components.a < 0xff && components.a > 0)
  7870. {
  7871. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7872. components.r = components.g = components.b
  7873. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7874. }
  7875. else
  7876. {
  7877. components.r = components.g = components.b
  7878. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7879. }
  7880. }
  7881. #if JUCE_BIG_ENDIAN
  7882. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7883. #else
  7884. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7885. #endif
  7886. private:
  7887. union
  7888. {
  7889. uint32 argb;
  7890. struct
  7891. {
  7892. #if JUCE_BIG_ENDIAN
  7893. uint8 a : 8, r : 8, g : 8, b : 8;
  7894. #else
  7895. uint8 b, g, r, a;
  7896. #endif
  7897. } PACKED components;
  7898. };
  7899. } PACKED;
  7900. class JUCE_API PixelRGB
  7901. {
  7902. public:
  7903. PixelRGB() throw() {}
  7904. ~PixelRGB() throw() {}
  7905. PixelRGB (const uint32 argb) throw()
  7906. {
  7907. r = (uint8) (argb >> 16);
  7908. g = (uint8) (argb >> 8);
  7909. b = (uint8) (argb);
  7910. }
  7911. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7912. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7913. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7914. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7915. forcedinline uint8 getRed() const throw() { return r; }
  7916. forcedinline uint8 getGreen() const throw() { return g; }
  7917. forcedinline uint8 getBlue() const throw() { return b; }
  7918. forcedinline void blend (const PixelARGB& src) throw()
  7919. {
  7920. uint32 sargb = src.getARGB();
  7921. const uint32 alpha = 0x100 - (sargb >> 24);
  7922. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7923. sargb += 0x0000ff00 & (g * alpha);
  7924. r = (uint8) (sargb >> 16);
  7925. g = (uint8) (sargb >> 8);
  7926. b = (uint8) sargb;
  7927. }
  7928. forcedinline void blend (const PixelRGB& src) throw()
  7929. {
  7930. set (src);
  7931. }
  7932. forcedinline void blend (const PixelAlpha& src) throw();
  7933. template <class Pixel>
  7934. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7935. {
  7936. ++extraAlpha;
  7937. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7938. const uint32 sag = extraAlpha * src.getAG();
  7939. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7940. const uint32 alpha = 0x100 - (sargb >> 24);
  7941. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7942. sargb += 0x0000ff00 & (g * alpha);
  7943. b = (uint8) sargb;
  7944. g = (uint8) (sargb >> 8);
  7945. r = (uint8) (sargb >> 16);
  7946. }
  7947. template <class Pixel>
  7948. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7949. {
  7950. uint32 drb = getRB();
  7951. drb += (((src.getRB() - drb) * amount) >> 8);
  7952. uint32 dag = getAG();
  7953. dag += (((src.getAG() - dag) * amount) >> 8);
  7954. b = (uint8) drb;
  7955. g = (uint8) dag;
  7956. r = (uint8) (drb >> 16);
  7957. }
  7958. template <class Pixel>
  7959. forcedinline void set (const Pixel& src) throw()
  7960. {
  7961. b = src.getBlue();
  7962. g = src.getGreen();
  7963. r = src.getRed();
  7964. }
  7965. forcedinline void setAlpha (const uint8) throw() {}
  7966. forcedinline void multiplyAlpha (int) throw() {}
  7967. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7968. {
  7969. r = r_;
  7970. g = g_;
  7971. b = b_;
  7972. }
  7973. forcedinline void premultiply() throw() {}
  7974. forcedinline void unpremultiply() throw() {}
  7975. forcedinline void desaturate() throw()
  7976. {
  7977. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7978. }
  7979. #if JUCE_MAC
  7980. enum { indexR = 0, indexG = 1, indexB = 2 };
  7981. #else
  7982. enum { indexR = 2, indexG = 1, indexB = 0 };
  7983. #endif
  7984. private:
  7985. #if JUCE_MAC
  7986. uint8 r, g, b;
  7987. #else
  7988. uint8 b, g, r;
  7989. #endif
  7990. } PACKED;
  7991. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7992. {
  7993. set (src);
  7994. }
  7995. class JUCE_API PixelAlpha
  7996. {
  7997. public:
  7998. PixelAlpha() throw() {}
  7999. ~PixelAlpha() throw() {}
  8000. PixelAlpha (const uint32 argb) throw()
  8001. {
  8002. a = (uint8) (argb >> 24);
  8003. }
  8004. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8005. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8006. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8007. forcedinline uint8 getAlpha() const throw() { return a; }
  8008. forcedinline uint8 getRed() const throw() { return 0; }
  8009. forcedinline uint8 getGreen() const throw() { return 0; }
  8010. forcedinline uint8 getBlue() const throw() { return 0; }
  8011. template <class Pixel>
  8012. forcedinline void blend (const Pixel& src) throw()
  8013. {
  8014. const int srcA = src.getAlpha();
  8015. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8016. }
  8017. template <class Pixel>
  8018. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8019. {
  8020. ++extraAlpha;
  8021. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8022. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8023. }
  8024. template <class Pixel>
  8025. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8026. {
  8027. a += ((src,getAlpha() - a) * amount) >> 8;
  8028. }
  8029. template <class Pixel>
  8030. forcedinline void set (const Pixel& src) throw()
  8031. {
  8032. a = src.getAlpha();
  8033. }
  8034. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8035. {
  8036. a = newAlpha;
  8037. }
  8038. forcedinline void multiplyAlpha (int multiplier) throw()
  8039. {
  8040. ++multiplier;
  8041. a = (uint8) ((a * multiplier) >> 8);
  8042. }
  8043. forcedinline void multiplyAlpha (const float multiplier) throw()
  8044. {
  8045. a = (uint8) (a * multiplier);
  8046. }
  8047. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8048. {
  8049. a = a_;
  8050. }
  8051. forcedinline void premultiply() throw()
  8052. {
  8053. }
  8054. forcedinline void unpremultiply() throw()
  8055. {
  8056. }
  8057. forcedinline void desaturate() throw()
  8058. {
  8059. }
  8060. private:
  8061. uint8 a : 8;
  8062. } PACKED;
  8063. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8064. {
  8065. blend (PixelARGB (src.getARGB()));
  8066. }
  8067. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8068. {
  8069. uint32 sargb = src.getARGB();
  8070. const uint32 alpha = 0x100 - (sargb >> 24);
  8071. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8072. sargb += 0xff00ff00 & (getAG() * alpha);
  8073. argb = sargb;
  8074. }
  8075. #if JUCE_MSVC
  8076. #pragma pack (pop)
  8077. #endif
  8078. #undef PACKED
  8079. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8080. /*** End of inlined file: juce_PixelFormats.h ***/
  8081. class JUCE_API Colour
  8082. {
  8083. public:
  8084. Colour() throw();
  8085. Colour (const Colour& other) throw();
  8086. explicit Colour (const uint32 argb) throw();
  8087. Colour (const uint8 red,
  8088. const uint8 green,
  8089. const uint8 blue) throw();
  8090. static const Colour fromRGB (const uint8 red,
  8091. const uint8 green,
  8092. const uint8 blue) throw();
  8093. Colour (const uint8 red,
  8094. const uint8 green,
  8095. const uint8 blue,
  8096. const uint8 alpha) throw();
  8097. static const Colour fromRGBA (const uint8 red,
  8098. const uint8 green,
  8099. const uint8 blue,
  8100. const uint8 alpha) throw();
  8101. Colour (const uint8 red,
  8102. const uint8 green,
  8103. const uint8 blue,
  8104. const float alpha) throw();
  8105. static const Colour fromRGBAFloat (const uint8 red,
  8106. const uint8 green,
  8107. const uint8 blue,
  8108. const float alpha) throw();
  8109. Colour (const float hue,
  8110. const float saturation,
  8111. const float brightness,
  8112. const uint8 alpha) throw();
  8113. Colour (const float hue,
  8114. const float saturation,
  8115. const float brightness,
  8116. const float alpha) throw();
  8117. static const Colour fromHSV (const float hue,
  8118. const float saturation,
  8119. const float brightness,
  8120. const float alpha) throw();
  8121. ~Colour() throw();
  8122. Colour& operator= (const Colour& other) throw();
  8123. bool operator== (const Colour& other) const throw();
  8124. bool operator!= (const Colour& other) const throw();
  8125. uint8 getRed() const throw() { return argb.getRed(); }
  8126. uint8 getGreen() const throw() { return argb.getGreen(); }
  8127. uint8 getBlue() const throw() { return argb.getBlue(); }
  8128. float getFloatRed() const throw();
  8129. float getFloatGreen() const throw();
  8130. float getFloatBlue() const throw();
  8131. const PixelARGB getPixelARGB() const throw();
  8132. uint32 getARGB() const throw();
  8133. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8134. float getFloatAlpha() const throw();
  8135. bool isOpaque() const throw();
  8136. bool isTransparent() const throw();
  8137. const Colour withAlpha (const uint8 newAlpha) const throw();
  8138. const Colour withAlpha (const float newAlpha) const throw();
  8139. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  8140. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8141. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8142. float getHue() const throw();
  8143. float getSaturation() const throw();
  8144. float getBrightness() const throw();
  8145. void getHSB (float& hue,
  8146. float& saturation,
  8147. float& brightness) const throw();
  8148. const Colour withHue (const float newHue) const throw();
  8149. const Colour withSaturation (const float newSaturation) const throw();
  8150. const Colour withBrightness (const float newBrightness) const throw();
  8151. const Colour withRotatedHue (const float amountToRotate) const throw();
  8152. const Colour withMultipliedSaturation (const float multiplier) const throw();
  8153. const Colour withMultipliedBrightness (const float amount) const throw();
  8154. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8155. const Colour darker (float amountDarker = 0.4f) const throw();
  8156. const Colour contrasting (const float amount = 1.0f) const throw();
  8157. static const Colour contrasting (const Colour& colour1,
  8158. const Colour& colour2) throw();
  8159. static const Colour greyLevel (const float brightness) throw();
  8160. const String toString() const;
  8161. static const Colour fromString (const String& encodedColourString);
  8162. const String toDisplayString (bool includeAlphaValue) const;
  8163. juce_UseDebuggingNewOperator
  8164. private:
  8165. PixelARGB argb;
  8166. };
  8167. #endif // __JUCE_COLOUR_JUCEHEADER__
  8168. /*** End of inlined file: juce_Colour.h ***/
  8169. class Colours
  8170. {
  8171. public:
  8172. static JUCE_API const Colour
  8173. transparentBlack, /**< ARGB = 0x00000000 */
  8174. transparentWhite, /**< ARGB = 0x00ffffff */
  8175. black, /**< ARGB = 0xff000000 */
  8176. white, /**< ARGB = 0xffffffff */
  8177. blue, /**< ARGB = 0xff0000ff */
  8178. grey, /**< ARGB = 0xff808080 */
  8179. green, /**< ARGB = 0xff008000 */
  8180. red, /**< ARGB = 0xffff0000 */
  8181. yellow, /**< ARGB = 0xffffff00 */
  8182. aliceblue, antiquewhite, aqua, aquamarine,
  8183. azure, beige, bisque, blanchedalmond,
  8184. blueviolet, brown, burlywood, cadetblue,
  8185. chartreuse, chocolate, coral, cornflowerblue,
  8186. cornsilk, crimson, cyan, darkblue,
  8187. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8188. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8189. darkorchid, darkred, darksalmon, darkseagreen,
  8190. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8191. deeppink, deepskyblue, dimgrey, dodgerblue,
  8192. firebrick, floralwhite, forestgreen, fuchsia,
  8193. gainsboro, gold, goldenrod, greenyellow,
  8194. honeydew, hotpink, indianred, indigo,
  8195. ivory, khaki, lavender, lavenderblush,
  8196. lemonchiffon, lightblue, lightcoral, lightcyan,
  8197. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8198. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8199. lightsteelblue, lightyellow, lime, limegreen,
  8200. linen, magenta, maroon, mediumaquamarine,
  8201. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8202. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8203. midnightblue, mintcream, mistyrose, navajowhite,
  8204. navy, oldlace, olive, olivedrab,
  8205. orange, orangered, orchid, palegoldenrod,
  8206. palegreen, paleturquoise, palevioletred, papayawhip,
  8207. peachpuff, peru, pink, plum,
  8208. powderblue, purple, rosybrown, royalblue,
  8209. saddlebrown, salmon, sandybrown, seagreen,
  8210. seashell, sienna, silver, skyblue,
  8211. slateblue, slategrey, snow, springgreen,
  8212. steelblue, tan, teal, thistle,
  8213. tomato, turquoise, violet, wheat,
  8214. whitesmoke, yellowgreen;
  8215. static JUCE_API const Colour findColourForName (const String& colourName,
  8216. const Colour& defaultColour);
  8217. private:
  8218. // this isn't a class you should ever instantiate - it's just here for the
  8219. // static values in it.
  8220. Colours();
  8221. };
  8222. #endif // __JUCE_COLOURS_JUCEHEADER__
  8223. /*** End of inlined file: juce_Colours.h ***/
  8224. /*** Start of inlined file: juce_FillType.h ***/
  8225. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8226. #define __JUCE_FILLTYPE_JUCEHEADER__
  8227. /*** Start of inlined file: juce_ColourGradient.h ***/
  8228. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8229. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8230. class JUCE_API ColourGradient
  8231. {
  8232. public:
  8233. ColourGradient (const Colour& colour1,
  8234. const float x1,
  8235. const float y1,
  8236. const Colour& colour2,
  8237. const float x2,
  8238. const float y2,
  8239. const bool isRadial) throw();
  8240. ColourGradient() throw();
  8241. ~ColourGradient() throw();
  8242. void clearColours() throw();
  8243. void addColour (const double proportionAlongGradient,
  8244. const Colour& colour) throw();
  8245. void multiplyOpacity (const float multiplier) throw();
  8246. int getNumColours() const throw();
  8247. double getColourPosition (const int index) const throw();
  8248. const Colour getColour (const int index) const throw();
  8249. const Colour getColourAtPosition (const float position) const throw();
  8250. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8251. bool isOpaque() const throw();
  8252. bool isInvisible() const throw();
  8253. float x1;
  8254. float y1;
  8255. float x2;
  8256. float y2;
  8257. bool isRadial;
  8258. juce_UseDebuggingNewOperator
  8259. private:
  8260. Array <uint32> colours;
  8261. };
  8262. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8263. /*** End of inlined file: juce_ColourGradient.h ***/
  8264. class Image;
  8265. class JUCE_API FillType
  8266. {
  8267. public:
  8268. FillType() throw();
  8269. FillType (const Colour& colour) throw();
  8270. FillType (const ColourGradient& gradient) throw();
  8271. FillType (const Image& image, const AffineTransform& transform) throw();
  8272. FillType (const FillType& other) throw();
  8273. FillType& operator= (const FillType& other) throw();
  8274. ~FillType() throw();
  8275. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8276. bool isGradient() const throw() { return gradient != 0; }
  8277. bool isTiledImage() const throw() { return image != 0; }
  8278. void setColour (const Colour& newColour) throw();
  8279. void setGradient (const ColourGradient& newGradient) throw();
  8280. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8281. void setOpacity (const float newOpacity) throw();
  8282. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8283. Colour colour;
  8284. ScopedPointer <ColourGradient> gradient;
  8285. const Image* image;
  8286. AffineTransform transform;
  8287. juce_UseDebuggingNewOperator
  8288. };
  8289. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8290. /*** End of inlined file: juce_FillType.h ***/
  8291. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8292. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8293. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8294. class JUCE_API RectanglePlacement
  8295. {
  8296. public:
  8297. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8298. RectanglePlacement (const RectanglePlacement& other) throw();
  8299. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8300. enum
  8301. {
  8302. xLeft = 1,
  8303. xRight = 2,
  8304. xMid = 4,
  8305. yTop = 8,
  8306. yBottom = 16,
  8307. yMid = 32,
  8308. stretchToFit = 64,
  8309. fillDestination = 128,
  8310. onlyReduceInSize = 256,
  8311. onlyIncreaseInSize = 512,
  8312. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8313. centred = 4 + 32
  8314. };
  8315. inline int getFlags() const throw() { return flags; }
  8316. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8317. void applyTo (double& sourceX,
  8318. double& sourceY,
  8319. double& sourceW,
  8320. double& sourceH,
  8321. double destinationX,
  8322. double destinationY,
  8323. double destinationW,
  8324. double destinationH) const throw();
  8325. const AffineTransform getTransformToFit (float sourceX,
  8326. float sourceY,
  8327. float sourceW,
  8328. float sourceH,
  8329. float destinationX,
  8330. float destinationY,
  8331. float destinationW,
  8332. float destinationH) const throw();
  8333. private:
  8334. int flags;
  8335. };
  8336. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8337. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8338. class LowLevelGraphicsContext;
  8339. class Image;
  8340. class RectangleList;
  8341. class JUCE_API Graphics
  8342. {
  8343. public:
  8344. Graphics (Image& imageToDrawOnto) throw();
  8345. ~Graphics() throw();
  8346. void setColour (const Colour& newColour) throw();
  8347. void setOpacity (const float newOpacity) throw();
  8348. void setGradientFill (const ColourGradient& gradient) throw();
  8349. void setTiledImageFill (const Image& imageToUse,
  8350. const int anchorX,
  8351. const int anchorY,
  8352. const float opacity) throw();
  8353. void setFillType (const FillType& newFill) throw();
  8354. void setFont (const Font& newFont) throw();
  8355. void setFont (const float newFontHeight,
  8356. const int fontStyleFlags = Font::plain) throw();
  8357. void drawSingleLineText (const String& text,
  8358. const int startX,
  8359. const int baselineY) const throw();
  8360. void drawMultiLineText (const String& text,
  8361. const int startX,
  8362. const int baselineY,
  8363. const int maximumLineWidth) const throw();
  8364. void drawTextAsPath (const String& text,
  8365. const AffineTransform& transform) const throw();
  8366. void drawText (const String& text,
  8367. const int x,
  8368. const int y,
  8369. const int width,
  8370. const int height,
  8371. const Justification& justificationType,
  8372. const bool useEllipsesIfTooBig) const throw();
  8373. void drawFittedText (const String& text,
  8374. const int x,
  8375. const int y,
  8376. const int width,
  8377. const int height,
  8378. const Justification& justificationFlags,
  8379. const int maximumNumberOfLines,
  8380. const float minimumHorizontalScale = 0.7f) const throw();
  8381. void fillAll() const throw();
  8382. void fillAll (const Colour& colourToUse) const throw();
  8383. void fillRect (int x,
  8384. int y,
  8385. int width,
  8386. int height) const throw();
  8387. void fillRect (const Rectangle<int>& rectangle) const throw();
  8388. void fillRect (const float x,
  8389. const float y,
  8390. const float width,
  8391. const float height) const throw();
  8392. void fillRoundedRectangle (const float x,
  8393. const float y,
  8394. const float width,
  8395. const float height,
  8396. const float cornerSize) const throw();
  8397. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8398. const float cornerSize) const throw();
  8399. void fillCheckerBoard (int x, int y,
  8400. int width, int height,
  8401. const int checkWidth,
  8402. const int checkHeight,
  8403. const Colour& colour1,
  8404. const Colour& colour2) const throw();
  8405. void drawRect (const int x,
  8406. const int y,
  8407. const int width,
  8408. const int height,
  8409. const int lineThickness = 1) const throw();
  8410. void drawRect (const float x,
  8411. const float y,
  8412. const float width,
  8413. const float height,
  8414. const float lineThickness = 1.0f) const throw();
  8415. void drawRect (const Rectangle<int>& rectangle,
  8416. const int lineThickness = 1) const throw();
  8417. void drawRoundedRectangle (const float x,
  8418. const float y,
  8419. const float width,
  8420. const float height,
  8421. const float cornerSize,
  8422. const float lineThickness) const throw();
  8423. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8424. const float cornerSize,
  8425. const float lineThickness) const throw();
  8426. void drawBevel (const int x,
  8427. const int y,
  8428. const int width,
  8429. const int height,
  8430. const int bevelThickness,
  8431. const Colour& topLeftColour = Colours::white,
  8432. const Colour& bottomRightColour = Colours::black,
  8433. const bool useGradient = true,
  8434. const bool sharpEdgeOnOutside = true) const throw();
  8435. void setPixel (int x, int y) const throw();
  8436. void fillEllipse (const float x,
  8437. const float y,
  8438. const float width,
  8439. const float height) const throw();
  8440. void drawEllipse (const float x,
  8441. const float y,
  8442. const float width,
  8443. const float height,
  8444. const float lineThickness) const throw();
  8445. void drawLine (float startX,
  8446. float startY,
  8447. float endX,
  8448. float endY) const throw();
  8449. void drawLine (const float startX,
  8450. const float startY,
  8451. const float endX,
  8452. const float endY,
  8453. const float lineThickness) const throw();
  8454. void drawLine (const Line& line) const throw();
  8455. void drawLine (const Line& line,
  8456. const float lineThickness) const throw();
  8457. void drawDashedLine (const float startX,
  8458. const float startY,
  8459. const float endX,
  8460. const float endY,
  8461. const float* const dashLengths,
  8462. const int numDashLengths,
  8463. const float lineThickness = 1.0f) const throw();
  8464. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8465. void drawHorizontalLine (const int y, float left, float right) const throw();
  8466. void fillPath (const Path& path,
  8467. const AffineTransform& transform = AffineTransform::identity) const throw();
  8468. void strokePath (const Path& path,
  8469. const PathStrokeType& strokeType,
  8470. const AffineTransform& transform = AffineTransform::identity) const throw();
  8471. void drawArrow (const float startX,
  8472. const float startY,
  8473. const float endX,
  8474. const float endY,
  8475. const float lineThickness,
  8476. const float arrowheadWidth,
  8477. const float arrowheadLength) const throw();
  8478. enum ResamplingQuality
  8479. {
  8480. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8481. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8482. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8483. };
  8484. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8485. void drawImageAt (const Image* const imageToDraw,
  8486. const int topLeftX,
  8487. const int topLeftY,
  8488. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8489. void drawImage (const Image* const imageToDraw,
  8490. int destX,
  8491. int destY,
  8492. int destWidth,
  8493. int destHeight,
  8494. int sourceX,
  8495. int sourceY,
  8496. int sourceWidth,
  8497. int sourceHeight,
  8498. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8499. void drawImageTransformed (const Image* const imageToDraw,
  8500. const Rectangle<int>& imageSubRegion,
  8501. const AffineTransform& transform,
  8502. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8503. void drawImageWithin (const Image* const imageToDraw,
  8504. const int destX,
  8505. const int destY,
  8506. const int destWidth,
  8507. const int destHeight,
  8508. const RectanglePlacement& placementWithinTarget,
  8509. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8510. const Rectangle<int> getClipBounds() const throw();
  8511. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8512. bool reduceClipRegion (const int x, const int y,
  8513. const int width, const int height) throw();
  8514. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8515. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8516. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8517. const AffineTransform& transform) throw();
  8518. void excludeClipRegion (const Rectangle<int>& rectangleToExclude) throw();
  8519. bool isClipEmpty() const throw();
  8520. void saveState() throw();
  8521. void restoreState() throw();
  8522. void setOrigin (const int newOriginX,
  8523. const int newOriginY) throw();
  8524. void resetToDefaultState() throw();
  8525. bool isVectorDevice() const throw();
  8526. juce_UseDebuggingNewOperator
  8527. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8528. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8529. private:
  8530. LowLevelGraphicsContext* const context;
  8531. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8532. bool saveStatePending;
  8533. void saveStateIfPending() throw();
  8534. Graphics (const Graphics&);
  8535. Graphics& operator= (const Graphics& other);
  8536. };
  8537. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8538. /*** End of inlined file: juce_Graphics.h ***/
  8539. class JUCE_API ImageEffectFilter
  8540. {
  8541. public:
  8542. virtual void applyEffect (Image& sourceImage,
  8543. Graphics& destContext) = 0;
  8544. virtual ~ImageEffectFilter() {}
  8545. };
  8546. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8547. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8548. /*** Start of inlined file: juce_RectangleList.h ***/
  8549. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8550. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8551. class JUCE_API RectangleList
  8552. {
  8553. public:
  8554. RectangleList() throw();
  8555. RectangleList (const RectangleList& other) throw();
  8556. RectangleList (const Rectangle<int>& rect) throw();
  8557. RectangleList& operator= (const RectangleList& other) throw();
  8558. ~RectangleList() throw();
  8559. bool isEmpty() const throw();
  8560. int getNumRectangles() const throw() { return rects.size(); }
  8561. const Rectangle<int> getRectangle (const int index) const throw();
  8562. void clear() throw();
  8563. void add (const int x, const int y,
  8564. const int w, const int h) throw();
  8565. void add (const Rectangle<int>& rect) throw();
  8566. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8567. void add (const RectangleList& other) throw();
  8568. void subtract (const Rectangle<int>& rect) throw();
  8569. void subtract (const RectangleList& otherList) throw();
  8570. bool clipTo (const Rectangle<int>& rect) throw();
  8571. bool clipTo (const RectangleList& other) throw();
  8572. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8573. void swapWith (RectangleList& otherList) throw();
  8574. bool containsPoint (const int x, const int y) const throw();
  8575. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8576. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8577. bool intersects (const RectangleList& other) const throw();
  8578. const Rectangle<int> getBounds() const throw();
  8579. void consolidate() throw();
  8580. void offsetAll (const int dx, const int dy) throw();
  8581. const Path toPath() const throw();
  8582. class Iterator
  8583. {
  8584. public:
  8585. Iterator (const RectangleList& list) throw();
  8586. ~Iterator() throw();
  8587. bool next() throw();
  8588. const Rectangle<int>* getRectangle() const throw() { return current; }
  8589. juce_UseDebuggingNewOperator
  8590. private:
  8591. const Rectangle<int>* current;
  8592. const RectangleList& owner;
  8593. int index;
  8594. Iterator (const Iterator&);
  8595. Iterator& operator= (const Iterator&);
  8596. };
  8597. juce_UseDebuggingNewOperator
  8598. private:
  8599. friend class Iterator;
  8600. Array <Rectangle<int> > rects;
  8601. };
  8602. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8603. /*** End of inlined file: juce_RectangleList.h ***/
  8604. /*** Start of inlined file: juce_BorderSize.h ***/
  8605. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8606. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8607. class JUCE_API BorderSize
  8608. {
  8609. public:
  8610. BorderSize() throw();
  8611. BorderSize (const BorderSize& other) throw();
  8612. BorderSize (const int topGap,
  8613. const int leftGap,
  8614. const int bottomGap,
  8615. const int rightGap) throw();
  8616. BorderSize (const int allGaps) throw();
  8617. ~BorderSize() throw();
  8618. int getTop() const throw() { return top; }
  8619. int getLeft() const throw() { return left; }
  8620. int getBottom() const throw() { return bottom; }
  8621. int getRight() const throw() { return right; }
  8622. int getTopAndBottom() const throw() { return top + bottom; }
  8623. int getLeftAndRight() const throw() { return left + right; }
  8624. void setTop (const int newTopGap) throw();
  8625. void setLeft (const int newLeftGap) throw();
  8626. void setBottom (const int newBottomGap) throw();
  8627. void setRight (const int newRightGap) throw();
  8628. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8629. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8630. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8631. void addTo (Rectangle<int>& original) const throw();
  8632. bool operator== (const BorderSize& other) const throw();
  8633. bool operator!= (const BorderSize& other) const throw();
  8634. juce_UseDebuggingNewOperator
  8635. private:
  8636. int top, left, bottom, right;
  8637. };
  8638. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8639. /*** End of inlined file: juce_BorderSize.h ***/
  8640. class LookAndFeel;
  8641. class MouseInputSource;
  8642. class MouseInputSourceInternal;
  8643. class ComponentPeer;
  8644. class JUCE_API Component : public MouseListener,
  8645. protected MessageListener
  8646. {
  8647. public:
  8648. Component();
  8649. virtual ~Component();
  8650. Component (const String& componentName);
  8651. const String& getName() const throw() { return componentName_; }
  8652. virtual void setName (const String& newName);
  8653. bool isValidComponent() const;
  8654. virtual void setVisible (bool shouldBeVisible);
  8655. bool isVisible() const throw() { return flags.visibleFlag; }
  8656. virtual void visibilityChanged();
  8657. bool isShowing() const;
  8658. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8659. const int deltaXToMove = 0,
  8660. const int deltaYToMove = 0,
  8661. const float scaleFactorAtEnd = 1.0f);
  8662. virtual void addToDesktop (int windowStyleFlags,
  8663. void* nativeWindowToAttachTo = 0);
  8664. void removeFromDesktop();
  8665. bool isOnDesktop() const throw();
  8666. ComponentPeer* getPeer() const;
  8667. virtual void userTriedToCloseWindow();
  8668. virtual void minimisationStateChanged (bool isNowMinimised);
  8669. void toFront (const bool shouldAlsoGainFocus);
  8670. void toBack();
  8671. void toBehind (Component* const other);
  8672. void setAlwaysOnTop (const bool shouldStayOnTop);
  8673. bool isAlwaysOnTop() const throw();
  8674. inline int getX() const throw() { return bounds_.getX(); }
  8675. inline int getY() const throw() { return bounds_.getY(); }
  8676. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8677. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8678. int getRight() const throw() { return bounds_.getRight(); }
  8679. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8680. int getBottom() const throw() { return bounds_.getBottom(); }
  8681. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8682. void getVisibleArea (RectangleList& result,
  8683. const bool includeSiblings) const;
  8684. int getScreenX() const;
  8685. int getScreenY() const;
  8686. const Point<int> getScreenPosition() const;
  8687. const Rectangle<int> getScreenBounds() const;
  8688. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8689. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8690. const Point<int> relativePositionToOtherComponent (const Component* const targetComponent,
  8691. const Point<int>& positionRelativeToThis) const;
  8692. void setTopLeftPosition (const int x, const int y);
  8693. void setTopRightPosition (const int x, const int y);
  8694. void setSize (const int newWidth, const int newHeight);
  8695. void setBounds (int x, int y, int width, int height);
  8696. void setBounds (const Rectangle<int>& newBounds);
  8697. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8698. const float proportionalWidth, const float proportionalHeight);
  8699. void setBoundsInset (const BorderSize& borders);
  8700. void setBoundsToFit (int x, int y, int width, int height,
  8701. const Justification& justification,
  8702. const bool onlyReduceInSize);
  8703. void setCentrePosition (const int x, const int y);
  8704. void setCentreRelative (const float x, const float y);
  8705. void centreWithSize (const int width, const int height);
  8706. int proportionOfWidth (const float proportion) const throw();
  8707. int proportionOfHeight (const float proportion) const throw();
  8708. int getParentWidth() const throw();
  8709. int getParentHeight() const throw();
  8710. const Rectangle<int> getParentMonitorArea() const;
  8711. int getNumChildComponents() const throw();
  8712. Component* getChildComponent (const int index) const throw();
  8713. int getIndexOfChildComponent (const Component* const child) const throw();
  8714. void addChildComponent (Component* const child,
  8715. int zOrder = -1);
  8716. void addAndMakeVisible (Component* const child,
  8717. int zOrder = -1);
  8718. void removeChildComponent (Component* const childToRemove);
  8719. Component* removeChildComponent (const int childIndexToRemove);
  8720. void removeAllChildren();
  8721. void deleteAllChildren();
  8722. Component* getParentComponent() const throw() { return parentComponent_; }
  8723. template <class TargetClass>
  8724. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8725. {
  8726. (void) dummyParameter;
  8727. Component* p = parentComponent_;
  8728. while (p != 0)
  8729. {
  8730. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8731. if (target != 0)
  8732. return target;
  8733. p = p->parentComponent_;
  8734. }
  8735. return 0;
  8736. }
  8737. Component* getTopLevelComponent() const throw();
  8738. bool isParentOf (const Component* possibleChild) const throw();
  8739. virtual void parentHierarchyChanged();
  8740. virtual void childrenChanged();
  8741. virtual bool hitTest (int x, int y);
  8742. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8743. const bool allowClicksOnChildComponents) throw();
  8744. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8745. bool& allowsClicksOnChildComponents) const throw();
  8746. virtual bool contains (int x, int y);
  8747. bool reallyContains (int x, int y,
  8748. const bool returnTrueIfWithinAChild);
  8749. Component* getComponentAt (const int x, const int y);
  8750. Component* getComponentAt (const Point<int>& position);
  8751. void repaint();
  8752. void repaint (const int x, const int y,
  8753. const int width, const int height);
  8754. void setBufferedToImage (const bool shouldBeBuffered);
  8755. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8756. const bool clipImageToComponentBounds = true);
  8757. void paintEntireComponent (Graphics& context);
  8758. void setComponentEffect (ImageEffectFilter* const newEffect);
  8759. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8760. LookAndFeel& getLookAndFeel() const throw();
  8761. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8762. virtual void lookAndFeelChanged();
  8763. void sendLookAndFeelChange();
  8764. void setOpaque (const bool shouldBeOpaque);
  8765. bool isOpaque() const throw();
  8766. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8767. bool isBroughtToFrontOnMouseClick() const throw();
  8768. // Keyboard focus methods
  8769. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8770. bool getWantsKeyboardFocus() const throw();
  8771. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8772. bool getMouseClickGrabsKeyboardFocus() const throw();
  8773. void grabKeyboardFocus();
  8774. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const;
  8775. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8776. void moveKeyboardFocusToSibling (const bool moveToNext);
  8777. virtual KeyboardFocusTraverser* createFocusTraverser();
  8778. int getExplicitFocusOrder() const;
  8779. void setExplicitFocusOrder (const int newFocusOrderIndex);
  8780. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8781. bool isFocusContainer() const throw();
  8782. bool isEnabled() const throw();
  8783. void setEnabled (const bool shouldBeEnabled);
  8784. virtual void enablementChanged();
  8785. void setMouseCursor (const MouseCursor& cursorType);
  8786. virtual const MouseCursor getMouseCursor();
  8787. void updateMouseCursor() const;
  8788. virtual void paint (Graphics& g);
  8789. virtual void paintOverChildren (Graphics& g);
  8790. virtual void mouseMove (const MouseEvent& e);
  8791. virtual void mouseEnter (const MouseEvent& e);
  8792. virtual void mouseExit (const MouseEvent& e);
  8793. virtual void mouseDown (const MouseEvent& e);
  8794. virtual void mouseDrag (const MouseEvent& e);
  8795. virtual void mouseUp (const MouseEvent& e);
  8796. virtual void mouseDoubleClick (const MouseEvent& e);
  8797. virtual void mouseWheelMove (const MouseEvent& e,
  8798. float wheelIncrementX,
  8799. float wheelIncrementY);
  8800. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8801. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8802. void addMouseListener (MouseListener* const newListener,
  8803. const bool wantsEventsForAllNestedChildComponents);
  8804. void removeMouseListener (MouseListener* const listenerToRemove);
  8805. void addKeyListener (KeyListener* const newListener);
  8806. void removeKeyListener (KeyListener* const listenerToRemove);
  8807. virtual bool keyPressed (const KeyPress& key);
  8808. virtual bool keyStateChanged (const bool isKeyDown);
  8809. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8810. enum FocusChangeType
  8811. {
  8812. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8813. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8814. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8815. };
  8816. virtual void focusGained (FocusChangeType cause);
  8817. virtual void focusLost (FocusChangeType cause);
  8818. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8819. bool isMouseOver() const throw();
  8820. bool isMouseButtonDown() const throw();
  8821. bool isMouseOverOrDragging() const throw();
  8822. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8823. const Point<int> getMouseXYRelative() const;
  8824. virtual void resized();
  8825. virtual void moved();
  8826. virtual void childBoundsChanged (Component* child);
  8827. virtual void parentSizeChanged();
  8828. virtual void broughtToFront();
  8829. void addComponentListener (ComponentListener* const newListener);
  8830. void removeComponentListener (ComponentListener* const listenerToRemove);
  8831. void postCommandMessage (const int commandId);
  8832. virtual void handleCommandMessage (int commandId);
  8833. int runModalLoop();
  8834. void enterModalState (const bool takeKeyboardFocus = true);
  8835. void exitModalState (const int returnValue);
  8836. bool isCurrentlyModal() const throw();
  8837. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8838. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8839. bool isCurrentlyBlockedByAnotherModalComponent() const;
  8840. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8841. virtual void inputAttemptWhenModal();
  8842. NamedValueSet& getProperties() throw() { return properties; }
  8843. const NamedValueSet& getProperties() const throw() { return properties; }
  8844. const Colour findColour (const int colourId, const bool inheritFromParent = false) const;
  8845. void setColour (const int colourId, const Colour& colour);
  8846. void removeColour (const int colourId);
  8847. bool isColourSpecified (const int colourId) const;
  8848. void copyAllExplicitColoursTo (Component& target) const;
  8849. virtual void colourChanged();
  8850. void* getWindowHandle() const;
  8851. uint32 getComponentUID() const throw() { return componentUID; }
  8852. template <class ComponentType>
  8853. class SafePointer : private ComponentListener
  8854. {
  8855. public:
  8856. SafePointer() : comp (0) {}
  8857. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8858. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8859. ~SafePointer() { detach(); }
  8860. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8861. SafePointer& operator= (ComponentType* const newComponent)
  8862. {
  8863. detach();
  8864. comp = newComponent;
  8865. attach();
  8866. return *this;
  8867. }
  8868. operator ComponentType*() const throw() { return comp; }
  8869. ComponentType* getComponent() const throw() { return comp; }
  8870. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8871. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8872. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8873. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8874. juce_UseDebuggingNewOperator
  8875. private:
  8876. ComponentType* comp;
  8877. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8878. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8879. void componentBeingDeleted (Component&) { comp = 0; }
  8880. };
  8881. class BailOutChecker
  8882. {
  8883. public:
  8884. BailOutChecker (Component* const component1,
  8885. Component* const component2 = 0);
  8886. bool shouldBailOut() const throw();
  8887. private:
  8888. typedef SafePointer<Component> SafeComponentPtr;
  8889. SafeComponentPtr safePointer1, safePointer2;
  8890. Component* const component2;
  8891. BailOutChecker (const BailOutChecker&);
  8892. BailOutChecker& operator= (const BailOutChecker&);
  8893. };
  8894. juce_UseDebuggingNewOperator
  8895. private:
  8896. friend class ComponentPeer;
  8897. friend class InternalDragRepeater;
  8898. friend class MouseInputSource;
  8899. friend class MouseInputSourceInternal;
  8900. static Component* currentlyFocusedComponent;
  8901. String componentName_;
  8902. Component* parentComponent_;
  8903. uint32 componentUID;
  8904. Rectangle<int> bounds_;
  8905. int numDeepMouseListeners;
  8906. Array <Component*> childComponentList_;
  8907. LookAndFeel* lookAndFeel_;
  8908. MouseCursor cursor_;
  8909. ImageEffectFilter* effect_;
  8910. Image* bufferedImage_;
  8911. VoidArray* mouseListeners_;
  8912. VoidArray* keyListeners_;
  8913. ListenerList <ComponentListener> componentListeners;
  8914. NamedValueSet properties;
  8915. struct ComponentFlags
  8916. {
  8917. bool hasHeavyweightPeerFlag : 1;
  8918. bool visibleFlag : 1;
  8919. bool opaqueFlag : 1;
  8920. bool ignoresMouseClicksFlag : 1;
  8921. bool allowChildMouseClicksFlag : 1;
  8922. bool wantsFocusFlag : 1;
  8923. bool isFocusContainerFlag : 1;
  8924. bool dontFocusOnMouseClickFlag : 1;
  8925. bool alwaysOnTopFlag : 1;
  8926. bool bufferToImageFlag : 1;
  8927. bool bringToFrontOnClickFlag : 1;
  8928. bool repaintOnMouseActivityFlag : 1;
  8929. bool draggingFlag : 1;
  8930. bool mouseOverFlag : 1;
  8931. bool mouseInsideFlag : 1;
  8932. bool currentlyModalFlag : 1;
  8933. bool isDisabledFlag : 1;
  8934. bool childCompFocusedFlag : 1;
  8935. #ifdef JUCE_DEBUG
  8936. bool isInsidePaintCall : 1;
  8937. #endif
  8938. };
  8939. union
  8940. {
  8941. uint32 componentFlags_;
  8942. ComponentFlags flags;
  8943. };
  8944. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8945. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8946. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8947. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8948. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8949. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8950. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const float amountX, const float amountY);
  8951. void internalBroughtToFront();
  8952. void internalFocusGain (const FocusChangeType cause);
  8953. void internalFocusLoss (const FocusChangeType cause);
  8954. void internalChildFocusChange (FocusChangeType cause);
  8955. void internalModalInputAttempt();
  8956. void internalModifierKeysChanged();
  8957. void internalChildrenChanged();
  8958. void internalHierarchyChanged();
  8959. void renderComponent (Graphics& context);
  8960. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8961. void repaintParent();
  8962. void sendFakeMouseMove() const;
  8963. void takeKeyboardFocus (const FocusChangeType cause);
  8964. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8965. static void giveAwayFocus();
  8966. void sendEnablementChangeMessage();
  8967. static void* runModalLoopCallback (void*);
  8968. static void bringModalComponentToFront();
  8969. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  8970. const Rectangle<int>& clipRect,
  8971. const Component* const compToAvoid) const;
  8972. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8973. const int deltaX, const int deltaY) const;
  8974. // how much of the component is not off the edges of its parents
  8975. const Rectangle<int> getUnclippedArea() const;
  8976. void sendVisibilityChangeMessage();
  8977. // This is included here just to cause a compile error if your code is still handling
  8978. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8979. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8980. // implement its methods instead of this Component method).
  8981. virtual void filesDropped (const StringArray&, int, int) {}
  8982. // components aren't allowed to have copy constructors, as this would mess up parent
  8983. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8984. // this one to avoid compiler warnings.
  8985. Component (const Component&);
  8986. Component& operator= (const Component&);
  8987. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8988. // subclass to use the new parameters to keyStateChanged)
  8989. virtual void keyStateChanged() {};
  8990. protected:
  8991. virtual void internalRepaint (int x, int y, int w, int h);
  8992. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8993. void handleMessage (const Message&);
  8994. };
  8995. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8996. /*** End of inlined file: juce_Component.h ***/
  8997. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8998. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8999. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9000. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9001. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9002. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9003. typedef int CommandID;
  9004. namespace StandardApplicationCommandIDs
  9005. {
  9006. static const CommandID quit = 0x1001;
  9007. static const CommandID del = 0x1002;
  9008. static const CommandID cut = 0x1003;
  9009. static const CommandID copy = 0x1004;
  9010. static const CommandID paste = 0x1005;
  9011. static const CommandID selectAll = 0x1006;
  9012. static const CommandID deselectAll = 0x1007;
  9013. }
  9014. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9015. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9016. struct JUCE_API ApplicationCommandInfo
  9017. {
  9018. ApplicationCommandInfo (const CommandID commandID) throw();
  9019. void setInfo (const String& shortName,
  9020. const String& description,
  9021. const String& categoryName,
  9022. const int flags) throw();
  9023. void setActive (const bool isActive) throw();
  9024. void setTicked (const bool isTicked) throw();
  9025. void addDefaultKeypress (const int keyCode,
  9026. const ModifierKeys& modifiers) throw();
  9027. CommandID commandID;
  9028. String shortName;
  9029. String description;
  9030. String categoryName;
  9031. Array <KeyPress> defaultKeypresses;
  9032. enum CommandFlags
  9033. {
  9034. isDisabled = 1 << 0,
  9035. isTicked = 1 << 1,
  9036. wantsKeyUpDownCallbacks = 1 << 2,
  9037. hiddenFromKeyEditor = 1 << 3,
  9038. readOnlyInKeyEditor = 1 << 4,
  9039. dontTriggerVisualFeedback = 1 << 5
  9040. };
  9041. int flags;
  9042. };
  9043. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9044. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9045. class JUCE_API ApplicationCommandTarget
  9046. {
  9047. public:
  9048. ApplicationCommandTarget();
  9049. virtual ~ApplicationCommandTarget();
  9050. struct JUCE_API InvocationInfo
  9051. {
  9052. InvocationInfo (const CommandID commandID) throw();
  9053. CommandID commandID;
  9054. int commandFlags;
  9055. enum InvocationMethod
  9056. {
  9057. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9058. fromKeyPress, /**< The command is being invoked by a key-press. */
  9059. fromMenu, /**< The command is being invoked by a menu selection. */
  9060. fromButton /**< The command is being invoked by a button click. */
  9061. };
  9062. InvocationMethod invocationMethod;
  9063. Component* originatingComponent;
  9064. KeyPress keyPress;
  9065. bool isKeyDown;
  9066. int millisecsSinceKeyPressed;
  9067. };
  9068. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9069. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9070. virtual void getCommandInfo (const CommandID commandID,
  9071. ApplicationCommandInfo& result) = 0;
  9072. virtual bool perform (const InvocationInfo& info) = 0;
  9073. bool invoke (const InvocationInfo& invocationInfo,
  9074. const bool asynchronously);
  9075. bool invokeDirectly (const CommandID commandID,
  9076. const bool asynchronously);
  9077. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9078. bool isCommandActive (const CommandID commandID);
  9079. ApplicationCommandTarget* findFirstTargetParentComponent();
  9080. juce_UseDebuggingNewOperator
  9081. private:
  9082. // (for async invocation of commands)
  9083. class CommandTargetMessageInvoker : public MessageListener
  9084. {
  9085. public:
  9086. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9087. ~CommandTargetMessageInvoker();
  9088. void handleMessage (const Message& message);
  9089. private:
  9090. ApplicationCommandTarget* const owner;
  9091. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9092. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9093. };
  9094. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9095. friend class CommandTargetMessageInvoker;
  9096. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9097. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9098. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9099. };
  9100. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9101. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9102. /*** Start of inlined file: juce_ActionListener.h ***/
  9103. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9104. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9105. class JUCE_API ActionListener
  9106. {
  9107. public:
  9108. virtual ~ActionListener() {}
  9109. virtual void actionListenerCallback (const String& message) = 0;
  9110. };
  9111. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9112. /*** End of inlined file: juce_ActionListener.h ***/
  9113. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9114. private ActionListener
  9115. {
  9116. protected:
  9117. JUCEApplication();
  9118. public:
  9119. virtual ~JUCEApplication();
  9120. static JUCEApplication* getInstance() throw();
  9121. virtual void initialise (const String& commandLineParameters) = 0;
  9122. bool isInitialising() const throw();
  9123. virtual void shutdown() = 0;
  9124. virtual const String getApplicationName() = 0;
  9125. virtual const String getApplicationVersion();
  9126. virtual bool moreThanOneInstanceAllowed();
  9127. virtual void anotherInstanceStarted (const String& commandLine);
  9128. virtual void systemRequestedQuit();
  9129. virtual void unhandledException (const std::exception* e,
  9130. const String& sourceFilename,
  9131. const int lineNumber);
  9132. static void quit();
  9133. void setApplicationReturnValue (const int newReturnValue) throw();
  9134. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9135. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9136. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9137. static int main (String& commandLine, JUCEApplication* const newApp);
  9138. static int main (int argc, const char* argv[], JUCEApplication* const newApp);
  9139. static void sendUnhandledException (const std::exception* const e,
  9140. const char* const sourceFile,
  9141. const int lineNumber);
  9142. ApplicationCommandTarget* getNextCommandTarget();
  9143. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  9144. void getAllCommands (Array <CommandID>& commands);
  9145. bool perform (const InvocationInfo& info);
  9146. void actionListenerCallback (const String& message);
  9147. private:
  9148. String commandLineParameters;
  9149. int appReturnValue;
  9150. bool stillInitialising;
  9151. ScopedPointer<InterProcessLock> appLock;
  9152. JUCEApplication (const JUCEApplication&);
  9153. JUCEApplication& operator= (const JUCEApplication&);
  9154. public:
  9155. bool initialiseApp (String& commandLine);
  9156. static int shutdownAppAndClearUp();
  9157. };
  9158. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9159. /*** End of inlined file: juce_Application.h ***/
  9160. #endif
  9161. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9162. #endif
  9163. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9164. #endif
  9165. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9166. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9167. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9168. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9169. /*** Start of inlined file: juce_Desktop.h ***/
  9170. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9171. #define __JUCE_DESKTOP_JUCEHEADER__
  9172. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9173. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9174. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9175. class JUCE_API DeletedAtShutdown
  9176. {
  9177. protected:
  9178. DeletedAtShutdown();
  9179. virtual ~DeletedAtShutdown();
  9180. public:
  9181. static void deleteAll();
  9182. private:
  9183. DeletedAtShutdown (const DeletedAtShutdown&);
  9184. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9185. };
  9186. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9187. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9188. /*** Start of inlined file: juce_Timer.h ***/
  9189. #ifndef __JUCE_TIMER_JUCEHEADER__
  9190. #define __JUCE_TIMER_JUCEHEADER__
  9191. class InternalTimerThread;
  9192. class JUCE_API Timer
  9193. {
  9194. protected:
  9195. Timer() throw();
  9196. Timer (const Timer& other) throw();
  9197. public:
  9198. virtual ~Timer();
  9199. virtual void timerCallback() = 0;
  9200. void startTimer (const int intervalInMilliseconds) throw();
  9201. void stopTimer() throw();
  9202. bool isTimerRunning() const throw() { return periodMs > 0; }
  9203. int getTimerInterval() const throw() { return periodMs; }
  9204. private:
  9205. friend class InternalTimerThread;
  9206. int countdownMs, periodMs;
  9207. Timer* previous;
  9208. Timer* next;
  9209. Timer& operator= (const Timer&);
  9210. };
  9211. #endif // __JUCE_TIMER_JUCEHEADER__
  9212. /*** End of inlined file: juce_Timer.h ***/
  9213. class MouseInputSource;
  9214. class MouseInputSourceInternal;
  9215. class MouseListener;
  9216. class JUCE_API FocusChangeListener
  9217. {
  9218. public:
  9219. virtual ~FocusChangeListener() {}
  9220. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9221. };
  9222. class JUCE_API Desktop : private DeletedAtShutdown,
  9223. private Timer,
  9224. private AsyncUpdater
  9225. {
  9226. public:
  9227. static Desktop& JUCE_CALLTYPE getInstance();
  9228. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9229. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9230. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, const bool clippedToWorkArea = true) const;
  9231. static const Point<int> getMousePosition();
  9232. static void setMousePosition (const Point<int>& newPosition);
  9233. static const Point<int> getLastMouseDownPosition() throw();
  9234. static int getMouseButtonClickCounter() throw();
  9235. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9236. static bool isScreenSaverEnabled() throw();
  9237. void addGlobalMouseListener (MouseListener* const listener);
  9238. void removeGlobalMouseListener (MouseListener* const listener);
  9239. void addFocusChangeListener (FocusChangeListener* const listener);
  9240. void removeFocusChangeListener (FocusChangeListener* const listener);
  9241. void setKioskModeComponent (Component* componentToUse,
  9242. const bool allowMenusAndBars = true);
  9243. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9244. int getNumComponents() const throw();
  9245. Component* getComponent (const int index) const throw();
  9246. Component* findComponentAt (const Point<int>& screenPosition) const;
  9247. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9248. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9249. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9250. int getNumDraggingMouseSources() const throw();
  9251. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9252. juce_UseDebuggingNewOperator
  9253. void refreshMonitorSizes();
  9254. static bool canUseSemiTransparentWindows() throw();
  9255. private:
  9256. static Desktop* instance;
  9257. friend class Component;
  9258. friend class ComponentPeer;
  9259. friend class MouseInputSource;
  9260. friend class MouseInputSourceInternal;
  9261. friend class DeletedAtShutdown;
  9262. friend class TopLevelWindowManager;
  9263. OwnedArray <MouseInputSource> mouseSources;
  9264. void createMouseInputSources();
  9265. ListenerList <MouseListener> mouseListeners;
  9266. ListenerList <FocusChangeListener> focusListeners;
  9267. Array <Component*> desktopComponents;
  9268. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9269. Point<int> lastFakeMouseMove;
  9270. void sendMouseMove();
  9271. int mouseClickCounter;
  9272. void incrementMouseClickCounter() throw();
  9273. Component* kioskModeComponent;
  9274. Rectangle<int> kioskComponentOriginalBounds;
  9275. void timerCallback();
  9276. void resetTimer();
  9277. int getNumDisplayMonitors() const throw();
  9278. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9279. void addDesktopComponent (Component* const c);
  9280. void removeDesktopComponent (Component* const c);
  9281. void componentBroughtToFront (Component* const c);
  9282. void triggerFocusCallback();
  9283. void handleAsyncUpdate();
  9284. Desktop();
  9285. ~Desktop();
  9286. Desktop (const Desktop&);
  9287. Desktop& operator= (const Desktop&);
  9288. };
  9289. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9290. /*** End of inlined file: juce_Desktop.h ***/
  9291. class KeyPressMappingSet;
  9292. class ApplicationCommandManagerListener;
  9293. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9294. private FocusChangeListener
  9295. {
  9296. public:
  9297. ApplicationCommandManager();
  9298. virtual ~ApplicationCommandManager();
  9299. void clearCommands();
  9300. void registerCommand (const ApplicationCommandInfo& newCommand);
  9301. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9302. void removeCommand (const CommandID commandID);
  9303. void commandStatusChanged();
  9304. int getNumCommands() const throw() { return commands.size(); }
  9305. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9306. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9307. const String getNameOfCommand (const CommandID commandID) const throw();
  9308. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9309. const StringArray getCommandCategories() const throw();
  9310. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9311. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9312. bool invokeDirectly (const CommandID commandID,
  9313. const bool asynchronously);
  9314. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9315. const bool asynchronously);
  9316. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9317. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9318. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9319. ApplicationCommandInfo& upToDateInfo);
  9320. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9321. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9322. static ApplicationCommandTarget* findDefaultComponentTarget();
  9323. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9324. juce_UseDebuggingNewOperator
  9325. private:
  9326. OwnedArray <ApplicationCommandInfo> commands;
  9327. ListenerList <ApplicationCommandManagerListener> listeners;
  9328. ScopedPointer <KeyPressMappingSet> keyMappings;
  9329. ApplicationCommandTarget* firstTarget;
  9330. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9331. void handleAsyncUpdate();
  9332. void globalFocusChanged (Component*);
  9333. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9334. // version of this method.
  9335. virtual short getFirstCommandTarget() { return 0; }
  9336. ApplicationCommandManager (const ApplicationCommandManager&);
  9337. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9338. };
  9339. class JUCE_API ApplicationCommandManagerListener
  9340. {
  9341. public:
  9342. virtual ~ApplicationCommandManagerListener() {}
  9343. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9344. virtual void applicationCommandListChanged() = 0;
  9345. };
  9346. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9347. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9348. #endif
  9349. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9350. #endif
  9351. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9352. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9353. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9354. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9355. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9356. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9357. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9358. class JUCE_API PropertiesFile : public PropertySet,
  9359. public ChangeBroadcaster,
  9360. private Timer
  9361. {
  9362. public:
  9363. enum FileFormatOptions
  9364. {
  9365. ignoreCaseOfKeyNames = 1,
  9366. storeAsBinary = 2,
  9367. storeAsCompressedBinary = 4,
  9368. storeAsXML = 8
  9369. };
  9370. PropertiesFile (const File& file,
  9371. int millisecondsBeforeSaving,
  9372. int optionFlags);
  9373. ~PropertiesFile();
  9374. bool isValidFile() const throw() { return loadedOk; }
  9375. bool saveIfNeeded();
  9376. bool save();
  9377. bool needsToBeSaved() const;
  9378. void setNeedsToBeSaved (bool needsToBeSaved);
  9379. const File getFile() const { return file; }
  9380. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9381. const String& fileNameSuffix,
  9382. const String& folderName,
  9383. bool commonToAllUsers,
  9384. int millisecondsBeforeSaving,
  9385. int propertiesFileOptions);
  9386. static const File getDefaultAppSettingsFile (const String& applicationName,
  9387. const String& fileNameSuffix,
  9388. const String& folderName,
  9389. bool commonToAllUsers);
  9390. juce_UseDebuggingNewOperator
  9391. protected:
  9392. virtual void propertyChanged();
  9393. private:
  9394. File file;
  9395. int timerInterval;
  9396. const int options;
  9397. bool loadedOk, needsWriting;
  9398. void timerCallback();
  9399. PropertiesFile (const PropertiesFile&);
  9400. PropertiesFile& operator= (const PropertiesFile&);
  9401. };
  9402. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9403. /*** End of inlined file: juce_PropertiesFile.h ***/
  9404. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9405. {
  9406. public:
  9407. ApplicationProperties() throw();
  9408. ~ApplicationProperties();
  9409. juce_DeclareSingleton (ApplicationProperties, false)
  9410. void setStorageParameters (const String& applicationName,
  9411. const String& fileNameSuffix,
  9412. const String& folderName,
  9413. const int millisecondsBeforeSaving,
  9414. const int propertiesFileOptions) throw();
  9415. bool testWriteAccess (const bool testUserSettings,
  9416. const bool testCommonSettings,
  9417. const bool showWarningDialogOnFailure);
  9418. PropertiesFile* getUserSettings() throw();
  9419. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9420. bool saveIfNeeded();
  9421. void closeFiles();
  9422. juce_UseDebuggingNewOperator
  9423. private:
  9424. ScopedPointer <PropertiesFile> userProps, commonProps;
  9425. String appName, fileSuffix, folderName;
  9426. int msBeforeSaving, options;
  9427. int commonSettingsAreReadOnly;
  9428. ApplicationProperties (const ApplicationProperties&);
  9429. ApplicationProperties& operator= (const ApplicationProperties&);
  9430. void openFiles() throw();
  9431. };
  9432. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9433. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9434. #endif
  9435. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9436. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9437. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9438. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9439. /*** Start of inlined file: juce_AudioFormat.h ***/
  9440. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9441. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9442. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9443. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9444. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9445. class AudioFormat;
  9446. class JUCE_API AudioFormatReader
  9447. {
  9448. protected:
  9449. AudioFormatReader (InputStream* const sourceStream,
  9450. const String& formatName);
  9451. public:
  9452. virtual ~AudioFormatReader();
  9453. const String getFormatName() const throw() { return formatName; }
  9454. bool read (int** destSamples,
  9455. int numDestChannels,
  9456. int64 startSampleInSource,
  9457. int numSamplesToRead,
  9458. const bool fillLeftoverChannelsWithCopies);
  9459. virtual void readMaxLevels (int64 startSample,
  9460. int64 numSamples,
  9461. float& lowestLeft,
  9462. float& highestLeft,
  9463. float& lowestRight,
  9464. float& highestRight);
  9465. int64 searchForLevel (int64 startSample,
  9466. int64 numSamplesToSearch,
  9467. const double magnitudeRangeMinimum,
  9468. const double magnitudeRangeMaximum,
  9469. const int minimumConsecutiveSamples);
  9470. double sampleRate;
  9471. unsigned int bitsPerSample;
  9472. int64 lengthInSamples;
  9473. unsigned int numChannels;
  9474. bool usesFloatingPointData;
  9475. StringPairArray metadataValues;
  9476. InputStream* input;
  9477. virtual bool readSamples (int** destSamples,
  9478. int numDestChannels,
  9479. int startOffsetInDestBuffer,
  9480. int64 startSampleInFile,
  9481. int numSamples) = 0;
  9482. juce_UseDebuggingNewOperator
  9483. private:
  9484. String formatName;
  9485. AudioFormatReader (const AudioFormatReader&);
  9486. AudioFormatReader& operator= (const AudioFormatReader&);
  9487. };
  9488. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9489. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9490. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9491. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9492. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9493. /*** Start of inlined file: juce_AudioSource.h ***/
  9494. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9495. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9496. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9497. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9498. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9499. class AudioFormatReader;
  9500. class AudioFormatWriter;
  9501. class JUCE_API AudioSampleBuffer
  9502. {
  9503. public:
  9504. AudioSampleBuffer (const int numChannels,
  9505. const int numSamples) throw();
  9506. AudioSampleBuffer (float** dataToReferTo,
  9507. const int numChannels,
  9508. const int numSamples) throw();
  9509. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9510. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9511. virtual ~AudioSampleBuffer() throw();
  9512. int getNumChannels() const throw() { return numChannels; }
  9513. int getNumSamples() const throw() { return size; }
  9514. float* getSampleData (const int channelNumber) const throw()
  9515. {
  9516. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9517. return channels [channelNumber];
  9518. }
  9519. float* getSampleData (const int channelNumber,
  9520. const int sampleOffset) const throw()
  9521. {
  9522. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9523. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9524. return channels [channelNumber] + sampleOffset;
  9525. }
  9526. float** getArrayOfChannels() const throw() { return channels; }
  9527. void setSize (const int newNumChannels,
  9528. const int newNumSamples,
  9529. const bool keepExistingContent = false,
  9530. const bool clearExtraSpace = false,
  9531. const bool avoidReallocating = false) throw();
  9532. void setDataToReferTo (float** dataToReferTo,
  9533. const int numChannels,
  9534. const int numSamples) throw();
  9535. void clear() throw();
  9536. void clear (const int startSample,
  9537. const int numSamples) throw();
  9538. void clear (const int channel,
  9539. const int startSample,
  9540. const int numSamples) throw();
  9541. void applyGain (const int channel,
  9542. const int startSample,
  9543. int numSamples,
  9544. const float gain) throw();
  9545. void applyGain (const int startSample,
  9546. const int numSamples,
  9547. const float gain) throw();
  9548. void applyGainRamp (const int channel,
  9549. const int startSample,
  9550. int numSamples,
  9551. float startGain,
  9552. float endGain) throw();
  9553. void addFrom (const int destChannel,
  9554. const int destStartSample,
  9555. const AudioSampleBuffer& source,
  9556. const int sourceChannel,
  9557. const int sourceStartSample,
  9558. int numSamples,
  9559. const float gainToApplyToSource = 1.0f) throw();
  9560. void addFrom (const int destChannel,
  9561. const int destStartSample,
  9562. const float* source,
  9563. int numSamples,
  9564. const float gainToApplyToSource = 1.0f) throw();
  9565. void addFromWithRamp (const int destChannel,
  9566. const int destStartSample,
  9567. const float* source,
  9568. int numSamples,
  9569. float startGain,
  9570. float endGain) throw();
  9571. void copyFrom (const int destChannel,
  9572. const int destStartSample,
  9573. const AudioSampleBuffer& source,
  9574. const int sourceChannel,
  9575. const int sourceStartSample,
  9576. int numSamples) throw();
  9577. void copyFrom (const int destChannel,
  9578. const int destStartSample,
  9579. const float* source,
  9580. int numSamples) throw();
  9581. void copyFrom (const int destChannel,
  9582. const int destStartSample,
  9583. const float* source,
  9584. int numSamples,
  9585. const float gain) throw();
  9586. void copyFromWithRamp (const int destChannel,
  9587. const int destStartSample,
  9588. const float* source,
  9589. int numSamples,
  9590. float startGain,
  9591. float endGain) throw();
  9592. void findMinMax (const int channel,
  9593. const int startSample,
  9594. int numSamples,
  9595. float& minVal,
  9596. float& maxVal) const throw();
  9597. float getMagnitude (const int channel,
  9598. const int startSample,
  9599. const int numSamples) const throw();
  9600. float getMagnitude (const int startSample,
  9601. const int numSamples) const throw();
  9602. float getRMSLevel (const int channel,
  9603. const int startSample,
  9604. const int numSamples) const throw();
  9605. void readFromAudioReader (AudioFormatReader* reader,
  9606. const int startSample,
  9607. const int numSamples,
  9608. const int readerStartSample,
  9609. const bool useReaderLeftChan,
  9610. const bool useReaderRightChan) throw();
  9611. void writeToAudioWriter (AudioFormatWriter* writer,
  9612. const int startSample,
  9613. const int numSamples) const throw();
  9614. juce_UseDebuggingNewOperator
  9615. private:
  9616. int numChannels, size;
  9617. size_t allocatedBytes;
  9618. float** channels;
  9619. HeapBlock <char> allocatedData;
  9620. float* preallocatedChannelSpace [32];
  9621. void allocateData();
  9622. void allocateChannels (float** const dataToReferTo);
  9623. };
  9624. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9625. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9626. struct JUCE_API AudioSourceChannelInfo
  9627. {
  9628. AudioSampleBuffer* buffer;
  9629. int startSample;
  9630. int numSamples;
  9631. void clearActiveBufferRegion() const
  9632. {
  9633. if (buffer != 0)
  9634. buffer->clear (startSample, numSamples);
  9635. }
  9636. };
  9637. class JUCE_API AudioSource
  9638. {
  9639. protected:
  9640. AudioSource() throw() {}
  9641. public:
  9642. virtual ~AudioSource() {}
  9643. virtual void prepareToPlay (int samplesPerBlockExpected,
  9644. double sampleRate) = 0;
  9645. virtual void releaseResources() = 0;
  9646. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9647. };
  9648. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9649. /*** End of inlined file: juce_AudioSource.h ***/
  9650. class JUCE_API AudioFormatWriter
  9651. {
  9652. protected:
  9653. AudioFormatWriter (OutputStream* const destStream,
  9654. const String& formatName,
  9655. const double sampleRate,
  9656. const unsigned int numberOfChannels,
  9657. const unsigned int bitsPerSample);
  9658. public:
  9659. virtual ~AudioFormatWriter();
  9660. const String getFormatName() const throw() { return formatName; }
  9661. virtual bool write (const int** samplesToWrite,
  9662. int numSamples) = 0;
  9663. bool writeFromAudioReader (AudioFormatReader& reader,
  9664. int64 startSample,
  9665. int64 numSamplesToRead);
  9666. bool writeFromAudioSource (AudioSource& source,
  9667. int numSamplesToRead,
  9668. const int samplesPerBlock = 2048);
  9669. double getSampleRate() const throw() { return sampleRate; }
  9670. int getNumChannels() const throw() { return numChannels; }
  9671. int getBitsPerSample() const throw() { return bitsPerSample; }
  9672. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9673. juce_UseDebuggingNewOperator
  9674. protected:
  9675. double sampleRate;
  9676. unsigned int numChannels;
  9677. unsigned int bitsPerSample;
  9678. bool usesFloatingPointData;
  9679. OutputStream* output;
  9680. private:
  9681. String formatName;
  9682. AudioFormatWriter (const AudioFormatWriter&);
  9683. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9684. };
  9685. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9686. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9687. class JUCE_API AudioFormat
  9688. {
  9689. public:
  9690. virtual ~AudioFormat();
  9691. const String& getFormatName() const;
  9692. const StringArray& getFileExtensions() const;
  9693. virtual bool canHandleFile (const File& fileToTest);
  9694. virtual const Array <int> getPossibleSampleRates() = 0;
  9695. virtual const Array <int> getPossibleBitDepths() = 0;
  9696. virtual bool canDoStereo() = 0;
  9697. virtual bool canDoMono() = 0;
  9698. virtual bool isCompressed();
  9699. virtual const StringArray getQualityOptions();
  9700. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9701. const bool deleteStreamIfOpeningFails) = 0;
  9702. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9703. double sampleRateToUse,
  9704. unsigned int numberOfChannels,
  9705. int bitsPerSample,
  9706. const StringPairArray& metadataValues,
  9707. int qualityOptionIndex) = 0;
  9708. protected:
  9709. AudioFormat (const String& formatName,
  9710. const tchar** const fileExtensions);
  9711. private:
  9712. String formatName;
  9713. StringArray fileExtensions;
  9714. };
  9715. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9716. /*** End of inlined file: juce_AudioFormat.h ***/
  9717. class JUCE_API AiffAudioFormat : public AudioFormat
  9718. {
  9719. public:
  9720. AiffAudioFormat();
  9721. ~AiffAudioFormat();
  9722. const Array <int> getPossibleSampleRates();
  9723. const Array <int> getPossibleBitDepths();
  9724. bool canDoStereo();
  9725. bool canDoMono();
  9726. #if JUCE_MAC
  9727. bool canHandleFile (const File& fileToTest);
  9728. #endif
  9729. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9730. const bool deleteStreamIfOpeningFails);
  9731. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9732. double sampleRateToUse,
  9733. unsigned int numberOfChannels,
  9734. int bitsPerSample,
  9735. const StringPairArray& metadataValues,
  9736. int qualityOptionIndex);
  9737. juce_UseDebuggingNewOperator
  9738. };
  9739. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9740. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9741. #endif
  9742. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9743. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9744. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9745. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9746. #if JUCE_USE_CDBURNER
  9747. class AudioCDBurner : public ChangeBroadcaster
  9748. {
  9749. public:
  9750. static const StringArray findAvailableDevices();
  9751. static AudioCDBurner* openDevice (const int deviceIndex);
  9752. ~AudioCDBurner();
  9753. enum DiskState
  9754. {
  9755. unknown, /**< An error condition, if the device isn't responding. */
  9756. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9757. may seem to be permanently open. */
  9758. noDisc, /**< The drive has no disk in it. */
  9759. writableDiskPresent, /**< The drive contains a writeable disk. */
  9760. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9761. };
  9762. DiskState getDiskState() const;
  9763. bool isDiskPresent() const;
  9764. bool openTray();
  9765. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9766. const Array<int> getAvailableWriteSpeeds() const;
  9767. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9768. int getNumAvailableAudioBlocks() const;
  9769. bool addAudioTrack (AudioSource* source, int numSamples);
  9770. class BurnProgressListener
  9771. {
  9772. public:
  9773. BurnProgressListener() throw() {}
  9774. virtual ~BurnProgressListener() {}
  9775. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9776. };
  9777. const String burn (BurnProgressListener* listener,
  9778. bool ejectDiscAfterwards,
  9779. bool performFakeBurnForTesting,
  9780. int writeSpeed);
  9781. void abortBurn();
  9782. juce_UseDebuggingNewOperator
  9783. private:
  9784. AudioCDBurner (const int deviceIndex);
  9785. class Pimpl;
  9786. friend class ScopedPointer<Pimpl>;
  9787. ScopedPointer<Pimpl> pimpl;
  9788. };
  9789. #endif
  9790. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9791. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9792. #endif
  9793. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9794. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9795. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9796. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9797. #if JUCE_USE_CDREADER
  9798. #if JUCE_MAC
  9799. #endif
  9800. class JUCE_API AudioCDReader : public AudioFormatReader
  9801. {
  9802. public:
  9803. static const StringArray getAvailableCDNames();
  9804. static AudioCDReader* createReaderForCD (const int index);
  9805. ~AudioCDReader();
  9806. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9807. int64 startSampleInFile, int numSamples);
  9808. bool isCDStillPresent() const;
  9809. int getNumTracks() const;
  9810. int getPositionOfTrackStart (int trackNum) const;
  9811. bool isTrackAudio (int trackNum) const;
  9812. void refreshTrackLengths();
  9813. void enableIndexScanning (bool enabled);
  9814. int getLastIndex() const;
  9815. const Array <int> findIndexesInTrack (const int trackNumber);
  9816. int getCDDBId();
  9817. void ejectDisk();
  9818. juce_UseDebuggingNewOperator
  9819. private:
  9820. #if JUCE_MAC
  9821. File volumeDir;
  9822. Array<File> tracks;
  9823. Array<int> trackStartSamples;
  9824. int currentReaderTrack;
  9825. ScopedPointer <AudioFormatReader> reader;
  9826. AudioCDReader (const File& volume);
  9827. public:
  9828. static int compareElements (const File&, const File&);
  9829. private:
  9830. #elif JUCE_WINDOWS
  9831. int numTracks;
  9832. int trackStarts[100];
  9833. bool audioTracks [100];
  9834. void* handle;
  9835. bool indexingEnabled;
  9836. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9837. MemoryBlock buffer;
  9838. AudioCDReader (void* handle);
  9839. int getIndexAt (int samplePos);
  9840. #elif JUCE_LINUX
  9841. AudioCDReader();
  9842. #endif
  9843. AudioCDReader (const AudioCDReader&);
  9844. AudioCDReader& operator= (const AudioCDReader&);
  9845. };
  9846. #endif
  9847. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9848. /*** End of inlined file: juce_AudioCDReader.h ***/
  9849. #endif
  9850. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9851. #endif
  9852. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9853. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9854. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9855. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9856. class JUCE_API AudioFormatManager
  9857. {
  9858. public:
  9859. AudioFormatManager();
  9860. ~AudioFormatManager();
  9861. juce_DeclareSingleton (AudioFormatManager, false);
  9862. void registerFormat (AudioFormat* newFormat,
  9863. const bool makeThisTheDefaultFormat);
  9864. void registerBasicFormats();
  9865. void clearFormats();
  9866. int getNumKnownFormats() const;
  9867. AudioFormat* getKnownFormat (const int index) const;
  9868. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9869. AudioFormat* getDefaultFormat() const;
  9870. const String getWildcardForAllFormats() const;
  9871. AudioFormatReader* createReaderFor (const File& audioFile);
  9872. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9873. juce_UseDebuggingNewOperator
  9874. private:
  9875. VoidArray knownFormats;
  9876. int defaultFormatIndex;
  9877. };
  9878. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9879. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9880. #endif
  9881. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9882. #endif
  9883. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9884. #endif
  9885. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9886. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9887. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9888. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9889. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9890. {
  9891. public:
  9892. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9893. const int64 subsectionStartSample,
  9894. const int64 subsectionLength,
  9895. const bool deleteSourceWhenDeleted);
  9896. ~AudioSubsectionReader();
  9897. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9898. int64 startSampleInFile, int numSamples);
  9899. void readMaxLevels (int64 startSample,
  9900. int64 numSamples,
  9901. float& lowestLeft,
  9902. float& highestLeft,
  9903. float& lowestRight,
  9904. float& highestRight);
  9905. juce_UseDebuggingNewOperator
  9906. private:
  9907. AudioFormatReader* const source;
  9908. int64 startSample, length;
  9909. const bool deleteSourceWhenDeleted;
  9910. AudioSubsectionReader (const AudioSubsectionReader&);
  9911. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9912. };
  9913. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9914. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9915. #endif
  9916. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9917. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9918. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9919. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9920. class AudioThumbnailCache;
  9921. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9922. public TimeSliceClient,
  9923. private Timer
  9924. {
  9925. public:
  9926. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9927. AudioFormatManager& formatManagerToUse,
  9928. AudioThumbnailCache& cacheToUse);
  9929. ~AudioThumbnail();
  9930. void setSource (InputSource* const newSource);
  9931. void loadFrom (InputStream& input);
  9932. void saveTo (OutputStream& output) const;
  9933. int getNumChannels() const throw();
  9934. double getTotalLength() const throw();
  9935. void drawChannel (Graphics& g,
  9936. int x, int y, int w, int h,
  9937. double startTimeSeconds,
  9938. double endTimeSeconds,
  9939. int channelNum,
  9940. const float verticalZoomFactor);
  9941. bool isFullyLoaded() const throw();
  9942. bool useTimeSlice();
  9943. void timerCallback();
  9944. juce_UseDebuggingNewOperator
  9945. private:
  9946. AudioFormatManager& formatManagerToUse;
  9947. AudioThumbnailCache& cache;
  9948. ScopedPointer <InputSource> source;
  9949. CriticalSection readerLock;
  9950. ScopedPointer <AudioFormatReader> reader;
  9951. MemoryBlock data, cachedLevels;
  9952. int orginalSamplesPerThumbnailSample;
  9953. int numChannelsCached, numSamplesCached;
  9954. double cachedStart, cachedTimePerPixel;
  9955. bool cacheNeedsRefilling;
  9956. void clear();
  9957. AudioFormatReader* createReader() const;
  9958. void generateSection (AudioFormatReader& reader,
  9959. int64 startSample,
  9960. int numSamples);
  9961. char* getChannelData (int channel) const;
  9962. void refillCache (const int numSamples,
  9963. double startTime,
  9964. const double timePerPixel);
  9965. friend class AudioThumbnailCache;
  9966. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9967. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9968. // returns true if more needs to be read
  9969. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9970. };
  9971. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9972. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9973. #endif
  9974. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9975. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9976. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9977. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9978. struct ThumbnailCacheEntry;
  9979. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9980. {
  9981. public:
  9982. AudioThumbnailCache (const int maxNumThumbsToStore);
  9983. ~AudioThumbnailCache();
  9984. void clear();
  9985. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9986. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9987. juce_UseDebuggingNewOperator
  9988. private:
  9989. OwnedArray <ThumbnailCacheEntry> thumbs;
  9990. int maxNumThumbsToStore;
  9991. friend class AudioThumbnail;
  9992. void addThumbnail (AudioThumbnail* const thumb);
  9993. void removeThumbnail (AudioThumbnail* const thumb);
  9994. };
  9995. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9996. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9997. #endif
  9998. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9999. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10000. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10001. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10002. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10003. class JUCE_API FlacAudioFormat : public AudioFormat
  10004. {
  10005. public:
  10006. FlacAudioFormat();
  10007. ~FlacAudioFormat();
  10008. const Array <int> getPossibleSampleRates();
  10009. const Array <int> getPossibleBitDepths();
  10010. bool canDoStereo();
  10011. bool canDoMono();
  10012. bool isCompressed();
  10013. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10014. const bool deleteStreamIfOpeningFails);
  10015. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10016. double sampleRateToUse,
  10017. unsigned int numberOfChannels,
  10018. int bitsPerSample,
  10019. const StringPairArray& metadataValues,
  10020. int qualityOptionIndex);
  10021. juce_UseDebuggingNewOperator
  10022. };
  10023. #endif
  10024. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10025. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10026. #endif
  10027. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10028. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10029. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10030. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10031. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10032. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10033. {
  10034. public:
  10035. OggVorbisAudioFormat();
  10036. ~OggVorbisAudioFormat();
  10037. const Array <int> getPossibleSampleRates();
  10038. const Array <int> getPossibleBitDepths();
  10039. bool canDoStereo();
  10040. bool canDoMono();
  10041. bool isCompressed();
  10042. const StringArray getQualityOptions();
  10043. int estimateOggFileQuality (const File& source);
  10044. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10045. const bool deleteStreamIfOpeningFails);
  10046. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10047. double sampleRateToUse,
  10048. unsigned int numberOfChannels,
  10049. int bitsPerSample,
  10050. const StringPairArray& metadataValues,
  10051. int qualityOptionIndex);
  10052. juce_UseDebuggingNewOperator
  10053. };
  10054. #endif
  10055. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10056. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10057. #endif
  10058. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10059. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10060. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10061. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10062. #if JUCE_QUICKTIME
  10063. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10064. {
  10065. public:
  10066. QuickTimeAudioFormat();
  10067. ~QuickTimeAudioFormat();
  10068. const Array <int> getPossibleSampleRates();
  10069. const Array <int> getPossibleBitDepths();
  10070. bool canDoStereo();
  10071. bool canDoMono();
  10072. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10073. const bool deleteStreamIfOpeningFails);
  10074. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10075. double sampleRateToUse,
  10076. unsigned int numberOfChannels,
  10077. int bitsPerSample,
  10078. const StringPairArray& metadataValues,
  10079. int qualityOptionIndex);
  10080. juce_UseDebuggingNewOperator
  10081. };
  10082. #endif
  10083. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10084. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10085. #endif
  10086. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10087. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10088. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10089. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10090. class JUCE_API WavAudioFormat : public AudioFormat
  10091. {
  10092. public:
  10093. WavAudioFormat();
  10094. ~WavAudioFormat();
  10095. static const tchar* const bwavDescription;
  10096. static const tchar* const bwavOriginator;
  10097. static const tchar* const bwavOriginatorRef;
  10098. static const tchar* const bwavOriginationDate;
  10099. static const tchar* const bwavOriginationTime;
  10100. static const tchar* const bwavTimeReference;
  10101. static const tchar* const bwavCodingHistory;
  10102. static const StringPairArray createBWAVMetadata (const String& description,
  10103. const String& originator,
  10104. const String& originatorRef,
  10105. const Time& dateAndTime,
  10106. const int64 timeReferenceSamples,
  10107. const String& codingHistory);
  10108. const Array <int> getPossibleSampleRates();
  10109. const Array <int> getPossibleBitDepths();
  10110. bool canDoStereo();
  10111. bool canDoMono();
  10112. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10113. const bool deleteStreamIfOpeningFails);
  10114. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10115. double sampleRateToUse,
  10116. unsigned int numberOfChannels,
  10117. int bitsPerSample,
  10118. const StringPairArray& metadataValues,
  10119. int qualityOptionIndex);
  10120. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10121. juce_UseDebuggingNewOperator
  10122. };
  10123. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10124. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10125. #endif
  10126. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10127. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10128. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10129. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10130. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10131. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10132. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10133. class JUCE_API PositionableAudioSource : public AudioSource
  10134. {
  10135. protected:
  10136. PositionableAudioSource() throw() {}
  10137. public:
  10138. ~PositionableAudioSource() {}
  10139. virtual void setNextReadPosition (int newPosition) = 0;
  10140. virtual int getNextReadPosition() const = 0;
  10141. virtual int getTotalLength() const = 0;
  10142. virtual bool isLooping() const = 0;
  10143. };
  10144. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10145. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10146. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10147. {
  10148. public:
  10149. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10150. const bool deleteReaderWhenThisIsDeleted);
  10151. ~AudioFormatReaderSource();
  10152. void setLooping (const bool shouldLoop) throw();
  10153. bool isLooping() const { return looping; }
  10154. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10155. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10156. void releaseResources();
  10157. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10158. void setNextReadPosition (int newPosition);
  10159. int getNextReadPosition() const;
  10160. int getTotalLength() const;
  10161. juce_UseDebuggingNewOperator
  10162. private:
  10163. AudioFormatReader* reader;
  10164. bool deleteReader;
  10165. int volatile nextPlayPos;
  10166. bool volatile looping;
  10167. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10168. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10169. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10170. };
  10171. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10172. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10173. #endif
  10174. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10175. #endif
  10176. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10177. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10178. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10179. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10180. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10181. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10182. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10183. class AudioIODevice;
  10184. class JUCE_API AudioIODeviceCallback
  10185. {
  10186. public:
  10187. virtual ~AudioIODeviceCallback() {}
  10188. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10189. int numInputChannels,
  10190. float** outputChannelData,
  10191. int numOutputChannels,
  10192. int numSamples) = 0;
  10193. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10194. virtual void audioDeviceStopped() = 0;
  10195. };
  10196. class JUCE_API AudioIODevice
  10197. {
  10198. public:
  10199. virtual ~AudioIODevice();
  10200. const String& getName() const throw() { return name; }
  10201. const String& getTypeName() const throw() { return typeName; }
  10202. virtual const StringArray getOutputChannelNames() = 0;
  10203. virtual const StringArray getInputChannelNames() = 0;
  10204. virtual int getNumSampleRates() = 0;
  10205. virtual double getSampleRate (int index) = 0;
  10206. virtual int getNumBufferSizesAvailable() = 0;
  10207. virtual int getBufferSizeSamples (int index) = 0;
  10208. virtual int getDefaultBufferSize() = 0;
  10209. virtual const String open (const BigInteger& inputChannels,
  10210. const BigInteger& outputChannels,
  10211. double sampleRate,
  10212. int bufferSizeSamples) = 0;
  10213. virtual void close() = 0;
  10214. virtual bool isOpen() = 0;
  10215. virtual void start (AudioIODeviceCallback* callback) = 0;
  10216. virtual void stop() = 0;
  10217. virtual bool isPlaying() = 0;
  10218. virtual const String getLastError() = 0;
  10219. virtual int getCurrentBufferSizeSamples() = 0;
  10220. virtual double getCurrentSampleRate() = 0;
  10221. virtual int getCurrentBitDepth() = 0;
  10222. virtual const BigInteger getActiveOutputChannels() const = 0;
  10223. virtual const BigInteger getActiveInputChannels() const = 0;
  10224. virtual int getOutputLatencyInSamples() = 0;
  10225. virtual int getInputLatencyInSamples() = 0;
  10226. virtual bool hasControlPanel() const;
  10227. virtual bool showControlPanel();
  10228. protected:
  10229. AudioIODevice (const String& deviceName,
  10230. const String& typeName);
  10231. String name, typeName;
  10232. };
  10233. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10234. /*** End of inlined file: juce_AudioIODevice.h ***/
  10235. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10236. {
  10237. public:
  10238. AudioSourcePlayer();
  10239. virtual ~AudioSourcePlayer();
  10240. void setSource (AudioSource* newSource);
  10241. AudioSource* getCurrentSource() const throw() { return source; }
  10242. void setGain (const float newGain) throw();
  10243. void audioDeviceIOCallback (const float** inputChannelData,
  10244. int totalNumInputChannels,
  10245. float** outputChannelData,
  10246. int totalNumOutputChannels,
  10247. int numSamples);
  10248. void audioDeviceAboutToStart (AudioIODevice* device);
  10249. void audioDeviceStopped();
  10250. juce_UseDebuggingNewOperator
  10251. private:
  10252. CriticalSection readLock;
  10253. AudioSource* source;
  10254. double sampleRate;
  10255. int bufferSize;
  10256. float* channels [128];
  10257. float* outputChans [128];
  10258. const float* inputChans [128];
  10259. AudioSampleBuffer tempBuffer;
  10260. float lastGain, gain;
  10261. AudioSourcePlayer (const AudioSourcePlayer&);
  10262. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10263. };
  10264. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10265. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10266. #endif
  10267. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10268. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10269. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10270. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10271. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10272. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10273. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10274. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10275. {
  10276. public:
  10277. BufferingAudioSource (PositionableAudioSource* source,
  10278. const bool deleteSourceWhenDeleted,
  10279. int numberOfSamplesToBuffer);
  10280. ~BufferingAudioSource();
  10281. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10282. void releaseResources();
  10283. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10284. void setNextReadPosition (int newPosition);
  10285. int getNextReadPosition() const;
  10286. int getTotalLength() const { return source->getTotalLength(); }
  10287. bool isLooping() const { return source->isLooping(); }
  10288. juce_UseDebuggingNewOperator
  10289. private:
  10290. PositionableAudioSource* source;
  10291. bool deleteSourceWhenDeleted;
  10292. int numberOfSamplesToBuffer;
  10293. AudioSampleBuffer buffer;
  10294. CriticalSection bufferStartPosLock;
  10295. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10296. bool wasSourceLooping;
  10297. double volatile sampleRate;
  10298. friend class SharedBufferingAudioSourceThread;
  10299. bool readNextBufferChunk();
  10300. void readBufferSection (int start, int length, int bufferOffset);
  10301. BufferingAudioSource (const BufferingAudioSource&);
  10302. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10303. };
  10304. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10305. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10306. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10307. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10308. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10309. class JUCE_API ResamplingAudioSource : public AudioSource
  10310. {
  10311. public:
  10312. ResamplingAudioSource (AudioSource* const inputSource,
  10313. const bool deleteInputWhenDeleted);
  10314. ~ResamplingAudioSource();
  10315. void setResamplingRatio (const double samplesInPerOutputSample);
  10316. double getResamplingRatio() const throw() { return ratio; }
  10317. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10318. void releaseResources();
  10319. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10320. juce_UseDebuggingNewOperator
  10321. private:
  10322. AudioSource* const input;
  10323. const bool deleteInputWhenDeleted;
  10324. double ratio, lastRatio;
  10325. AudioSampleBuffer buffer;
  10326. int bufferPos, sampsInBuffer;
  10327. double subSampleOffset;
  10328. double coefficients[6];
  10329. CriticalSection ratioLock;
  10330. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10331. void createLowPass (const double proportionalRate);
  10332. struct FilterState
  10333. {
  10334. double x1, x2, y1, y2;
  10335. };
  10336. FilterState filterStates[2];
  10337. void resetFilters();
  10338. void applyFilter (float* samples, int num, FilterState& fs);
  10339. ResamplingAudioSource (const ResamplingAudioSource&);
  10340. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10341. };
  10342. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10343. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10344. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10345. public ChangeBroadcaster
  10346. {
  10347. public:
  10348. AudioTransportSource();
  10349. ~AudioTransportSource();
  10350. void setSource (PositionableAudioSource* const newSource,
  10351. int readAheadBufferSize = 0,
  10352. double sourceSampleRateToCorrectFor = 0.0);
  10353. void setPosition (double newPosition);
  10354. double getCurrentPosition() const;
  10355. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10356. void start();
  10357. void stop();
  10358. bool isPlaying() const throw() { return playing; }
  10359. void setGain (const float newGain) throw();
  10360. float getGain() const throw() { return gain; }
  10361. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10362. void releaseResources();
  10363. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10364. void setNextReadPosition (int newPosition);
  10365. int getNextReadPosition() const;
  10366. int getTotalLength() const;
  10367. bool isLooping() const;
  10368. juce_UseDebuggingNewOperator
  10369. private:
  10370. PositionableAudioSource* source;
  10371. ResamplingAudioSource* resamplerSource;
  10372. BufferingAudioSource* bufferingSource;
  10373. PositionableAudioSource* positionableSource;
  10374. AudioSource* masterSource;
  10375. CriticalSection callbackLock;
  10376. float volatile gain, lastGain;
  10377. bool volatile playing, stopped;
  10378. double sampleRate, sourceSampleRate;
  10379. int blockSize, readAheadBufferSize;
  10380. bool isPrepared, inputStreamEOF;
  10381. AudioTransportSource (const AudioTransportSource&);
  10382. AudioTransportSource& operator= (const AudioTransportSource&);
  10383. };
  10384. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10385. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10386. #endif
  10387. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10388. #endif
  10389. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10390. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10391. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10392. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10393. class ChannelRemappingAudioSource : public AudioSource
  10394. {
  10395. public:
  10396. ChannelRemappingAudioSource (AudioSource* const source,
  10397. const bool deleteSourceWhenDeleted);
  10398. ~ChannelRemappingAudioSource();
  10399. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10400. void clearAllMappings() throw();
  10401. void setInputChannelMapping (const int destChannelIndex,
  10402. const int sourceChannelIndex) throw();
  10403. void setOutputChannelMapping (const int sourceChannelIndex,
  10404. const int destChannelIndex) throw();
  10405. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10406. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10407. XmlElement* createXml() const throw();
  10408. void restoreFromXml (const XmlElement& e) throw();
  10409. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10410. void releaseResources();
  10411. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10412. juce_UseDebuggingNewOperator
  10413. private:
  10414. int requiredNumberOfChannels;
  10415. Array <int> remappedInputs, remappedOutputs;
  10416. AudioSource* const source;
  10417. const bool deleteSourceWhenDeleted;
  10418. AudioSampleBuffer buffer;
  10419. AudioSourceChannelInfo remappedInfo;
  10420. CriticalSection lock;
  10421. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10422. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10423. };
  10424. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10425. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10426. #endif
  10427. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10428. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10429. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10430. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10431. /*** Start of inlined file: juce_IIRFilter.h ***/
  10432. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10433. #define __JUCE_IIRFILTER_JUCEHEADER__
  10434. class JUCE_API IIRFilter
  10435. {
  10436. public:
  10437. IIRFilter() throw();
  10438. IIRFilter (const IIRFilter& other) throw();
  10439. ~IIRFilter() throw();
  10440. void reset() throw();
  10441. void processSamples (float* const samples,
  10442. const int numSamples) throw();
  10443. float processSingleSampleRaw (const float sample) throw();
  10444. void makeLowPass (const double sampleRate,
  10445. const double frequency) throw();
  10446. void makeHighPass (const double sampleRate,
  10447. const double frequency) throw();
  10448. void makeLowShelf (const double sampleRate,
  10449. const double cutOffFrequency,
  10450. const double Q,
  10451. const float gainFactor) throw();
  10452. void makeHighShelf (const double sampleRate,
  10453. const double cutOffFrequency,
  10454. const double Q,
  10455. const float gainFactor) throw();
  10456. void makeBandPass (const double sampleRate,
  10457. const double centreFrequency,
  10458. const double Q,
  10459. const float gainFactor) throw();
  10460. void makeInactive() throw();
  10461. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10462. juce_UseDebuggingNewOperator
  10463. protected:
  10464. CriticalSection processLock;
  10465. void setCoefficients (double c1, double c2, double c3,
  10466. double c4, double c5, double c6) throw();
  10467. bool active;
  10468. float coefficients[6];
  10469. float x1, x2, y1, y2;
  10470. // (use the copyCoefficientsFrom() method instead of this operator)
  10471. IIRFilter& operator= (const IIRFilter&);
  10472. };
  10473. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10474. /*** End of inlined file: juce_IIRFilter.h ***/
  10475. class JUCE_API IIRFilterAudioSource : public AudioSource
  10476. {
  10477. public:
  10478. IIRFilterAudioSource (AudioSource* const inputSource,
  10479. const bool deleteInputWhenDeleted);
  10480. ~IIRFilterAudioSource();
  10481. void setFilterParameters (const IIRFilter& newSettings);
  10482. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10483. void releaseResources();
  10484. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10485. juce_UseDebuggingNewOperator
  10486. private:
  10487. AudioSource* const input;
  10488. const bool deleteInputWhenDeleted;
  10489. OwnedArray <IIRFilter> iirFilters;
  10490. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10491. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10492. };
  10493. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10494. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10495. #endif
  10496. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10497. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10498. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10499. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10500. class JUCE_API MixerAudioSource : public AudioSource
  10501. {
  10502. public:
  10503. MixerAudioSource();
  10504. ~MixerAudioSource();
  10505. void addInputSource (AudioSource* newInput,
  10506. const bool deleteWhenRemoved);
  10507. void removeInputSource (AudioSource* input,
  10508. const bool deleteSource);
  10509. void removeAllInputs();
  10510. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10511. void releaseResources();
  10512. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10513. juce_UseDebuggingNewOperator
  10514. private:
  10515. VoidArray inputs;
  10516. BigInteger inputsToDelete;
  10517. CriticalSection lock;
  10518. AudioSampleBuffer tempBuffer;
  10519. double currentSampleRate;
  10520. int bufferSizeExpected;
  10521. MixerAudioSource (const MixerAudioSource&);
  10522. MixerAudioSource& operator= (const MixerAudioSource&);
  10523. };
  10524. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10525. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10526. #endif
  10527. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10528. #endif
  10529. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10530. #endif
  10531. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10532. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10533. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10534. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10535. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10536. {
  10537. public:
  10538. ToneGeneratorAudioSource();
  10539. ~ToneGeneratorAudioSource();
  10540. void setAmplitude (const float newAmplitude);
  10541. void setFrequency (const double newFrequencyHz);
  10542. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10543. void releaseResources();
  10544. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10545. juce_UseDebuggingNewOperator
  10546. private:
  10547. double frequency, sampleRate;
  10548. double currentPhase, phasePerSample;
  10549. float amplitude;
  10550. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10551. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10552. };
  10553. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10554. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10555. #endif
  10556. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10557. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10558. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10559. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10560. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10561. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10562. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10563. class AudioDeviceManager;
  10564. class Component;
  10565. class JUCE_API AudioIODeviceType
  10566. {
  10567. public:
  10568. const String& getTypeName() const throw() { return typeName; }
  10569. virtual void scanForDevices() = 0;
  10570. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10571. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10572. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10573. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10574. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10575. const String& inputDeviceName) = 0;
  10576. struct DeviceSetupDetails
  10577. {
  10578. AudioDeviceManager* manager;
  10579. int minNumInputChannels, maxNumInputChannels;
  10580. int minNumOutputChannels, maxNumOutputChannels;
  10581. bool useStereoPairs;
  10582. };
  10583. virtual ~AudioIODeviceType();
  10584. protected:
  10585. AudioIODeviceType (const tchar* const typeName);
  10586. private:
  10587. String typeName;
  10588. AudioIODeviceType (const AudioIODeviceType&);
  10589. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10590. };
  10591. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10592. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10593. /*** Start of inlined file: juce_MidiInput.h ***/
  10594. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10595. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10596. /*** Start of inlined file: juce_MidiMessage.h ***/
  10597. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10598. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10599. class JUCE_API MidiMessage
  10600. {
  10601. public:
  10602. MidiMessage (const int byte1,
  10603. const int byte2,
  10604. const int byte3,
  10605. const double timeStamp = 0) throw();
  10606. MidiMessage (const int byte1,
  10607. const int byte2,
  10608. const double timeStamp = 0) throw();
  10609. MidiMessage (const int byte1,
  10610. const double timeStamp = 0) throw();
  10611. MidiMessage (const uint8* const data,
  10612. const int dataSize,
  10613. const double timeStamp = 0) throw();
  10614. MidiMessage (const uint8* data,
  10615. int size,
  10616. int& numBytesUsed,
  10617. uint8 lastStatusByte,
  10618. double timeStamp = 0) throw();
  10619. MidiMessage (const MidiMessage& other) throw();
  10620. MidiMessage (const MidiMessage& other,
  10621. const double newTimeStamp) throw();
  10622. ~MidiMessage() throw();
  10623. MidiMessage& operator= (const MidiMessage& other) throw();
  10624. uint8* getRawData() const throw() { return data; }
  10625. int getRawDataSize() const throw() { return size; }
  10626. double getTimeStamp() const throw() { return timeStamp; }
  10627. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10628. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10629. int getChannel() const throw();
  10630. bool isForChannel (const int channelNumber) const throw();
  10631. void setChannel (const int newChannelNumber) throw();
  10632. bool isSysEx() const throw();
  10633. const uint8* getSysExData() const throw();
  10634. int getSysExDataSize() const throw();
  10635. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10636. static const MidiMessage noteOn (const int channel,
  10637. const int noteNumber,
  10638. const float velocity) throw();
  10639. static const MidiMessage noteOn (const int channel,
  10640. const int noteNumber,
  10641. const uint8 velocity) throw();
  10642. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10643. static const MidiMessage noteOff (const int channel,
  10644. const int noteNumber) throw();
  10645. bool isNoteOnOrOff() const throw();
  10646. int getNoteNumber() const throw();
  10647. void setNoteNumber (const int newNoteNumber) throw();
  10648. uint8 getVelocity() const throw();
  10649. float getFloatVelocity() const throw();
  10650. void setVelocity (const float newVelocity) throw();
  10651. void multiplyVelocity (const float scaleFactor) throw();
  10652. bool isProgramChange() const throw();
  10653. int getProgramChangeNumber() const throw();
  10654. static const MidiMessage programChange (const int channel,
  10655. const int programNumber) throw();
  10656. bool isPitchWheel() const throw();
  10657. int getPitchWheelValue() const throw();
  10658. static const MidiMessage pitchWheel (const int channel,
  10659. const int position) throw();
  10660. bool isAftertouch() const throw();
  10661. int getAfterTouchValue() const throw();
  10662. static const MidiMessage aftertouchChange (const int channel,
  10663. const int noteNumber,
  10664. const int aftertouchAmount) throw();
  10665. bool isChannelPressure() const throw();
  10666. int getChannelPressureValue() const throw();
  10667. static const MidiMessage channelPressureChange (const int channel,
  10668. const int pressure) throw();
  10669. bool isController() const throw();
  10670. int getControllerNumber() const throw();
  10671. int getControllerValue() const throw();
  10672. static const MidiMessage controllerEvent (const int channel,
  10673. const int controllerType,
  10674. const int value) throw();
  10675. bool isAllNotesOff() const throw();
  10676. bool isAllSoundOff() const throw();
  10677. static const MidiMessage allNotesOff (const int channel) throw();
  10678. static const MidiMessage allSoundOff (const int channel) throw();
  10679. static const MidiMessage allControllersOff (const int channel) throw();
  10680. bool isMetaEvent() const throw();
  10681. int getMetaEventType() const throw();
  10682. const uint8* getMetaEventData() const throw();
  10683. int getMetaEventLength() const throw();
  10684. bool isTrackMetaEvent() const throw();
  10685. bool isEndOfTrackMetaEvent() const throw();
  10686. static const MidiMessage endOfTrack() throw();
  10687. bool isTrackNameEvent() const throw();
  10688. bool isTextMetaEvent() const throw();
  10689. const String getTextFromTextMetaEvent() const throw();
  10690. bool isTempoMetaEvent() const throw();
  10691. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10692. double getTempoSecondsPerQuarterNote() const throw();
  10693. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10694. bool isTimeSignatureMetaEvent() const throw();
  10695. void getTimeSignatureInfo (int& numerator,
  10696. int& denominator) const throw();
  10697. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10698. const int denominator) throw();
  10699. bool isKeySignatureMetaEvent() const throw();
  10700. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10701. bool isMidiChannelMetaEvent() const throw();
  10702. int getMidiChannelMetaEventChannel() const throw();
  10703. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10704. bool isActiveSense() const throw();
  10705. bool isMidiStart() const throw();
  10706. static const MidiMessage midiStart() throw();
  10707. bool isMidiContinue() const throw();
  10708. static const MidiMessage midiContinue() throw();
  10709. bool isMidiStop() const throw();
  10710. static const MidiMessage midiStop() throw();
  10711. bool isMidiClock() const throw();
  10712. static const MidiMessage midiClock() throw();
  10713. bool isSongPositionPointer() const throw();
  10714. int getSongPositionPointerMidiBeat() const throw();
  10715. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10716. bool isQuarterFrame() const throw();
  10717. int getQuarterFrameSequenceNumber() const throw();
  10718. int getQuarterFrameValue() const throw();
  10719. static const MidiMessage quarterFrame (const int sequenceNumber,
  10720. const int value) throw();
  10721. enum SmpteTimecodeType
  10722. {
  10723. fps24 = 0,
  10724. fps25 = 1,
  10725. fps30drop = 2,
  10726. fps30 = 3
  10727. };
  10728. bool isFullFrame() const throw();
  10729. void getFullFrameParameters (int& hours,
  10730. int& minutes,
  10731. int& seconds,
  10732. int& frames,
  10733. SmpteTimecodeType& timecodeType) const throw();
  10734. static const MidiMessage fullFrame (const int hours,
  10735. const int minutes,
  10736. const int seconds,
  10737. const int frames,
  10738. SmpteTimecodeType timecodeType);
  10739. enum MidiMachineControlCommand
  10740. {
  10741. mmc_stop = 1,
  10742. mmc_play = 2,
  10743. mmc_deferredplay = 3,
  10744. mmc_fastforward = 4,
  10745. mmc_rewind = 5,
  10746. mmc_recordStart = 6,
  10747. mmc_recordStop = 7,
  10748. mmc_pause = 9
  10749. };
  10750. bool isMidiMachineControlMessage() const throw();
  10751. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10752. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10753. bool isMidiMachineControlGoto (int& hours,
  10754. int& minutes,
  10755. int& seconds,
  10756. int& frames) const throw();
  10757. static const MidiMessage midiMachineControlGoto (int hours,
  10758. int minutes,
  10759. int seconds,
  10760. int frames);
  10761. static const MidiMessage masterVolume (const float volume) throw();
  10762. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10763. const int dataSize) throw();
  10764. static int readVariableLengthVal (const uint8* data,
  10765. int& numBytesUsed) throw();
  10766. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10767. static const String getMidiNoteName (int noteNumber,
  10768. bool useSharps,
  10769. bool includeOctaveNumber,
  10770. int octaveNumForMiddleC) throw();
  10771. static const double getMidiNoteInHertz (int noteNumber) throw();
  10772. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10773. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10774. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10775. static const String getControllerName (int controllerNumber) throw();
  10776. juce_UseDebuggingNewOperator
  10777. private:
  10778. double timeStamp;
  10779. uint8* data;
  10780. int message, size;
  10781. };
  10782. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10783. /*** End of inlined file: juce_MidiMessage.h ***/
  10784. class MidiInput;
  10785. class JUCE_API MidiInputCallback
  10786. {
  10787. public:
  10788. virtual ~MidiInputCallback() {}
  10789. virtual void handleIncomingMidiMessage (MidiInput* source,
  10790. const MidiMessage& message) = 0;
  10791. virtual void handlePartialSysexMessage (MidiInput* source,
  10792. const uint8* messageData,
  10793. const int numBytesSoFar,
  10794. const double timestamp)
  10795. {
  10796. // (this bit is just to avoid compiler warnings about unused variables)
  10797. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10798. }
  10799. };
  10800. class JUCE_API MidiInput
  10801. {
  10802. public:
  10803. static const StringArray getDevices();
  10804. static int getDefaultDeviceIndex();
  10805. static MidiInput* openDevice (int deviceIndex,
  10806. MidiInputCallback* callback);
  10807. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10808. static MidiInput* createNewDevice (const String& deviceName,
  10809. MidiInputCallback* callback);
  10810. #endif
  10811. virtual ~MidiInput();
  10812. virtual const String getName() const throw() { return name; }
  10813. virtual void setName (const String& newName) throw() { name = newName; }
  10814. virtual void start();
  10815. virtual void stop();
  10816. juce_UseDebuggingNewOperator
  10817. protected:
  10818. String name;
  10819. void* internal;
  10820. MidiInput (const String& name);
  10821. private:
  10822. MidiInput (const MidiInput&);
  10823. MidiInput& operator= (const MidiInput&);
  10824. };
  10825. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10826. /*** End of inlined file: juce_MidiInput.h ***/
  10827. /*** Start of inlined file: juce_MidiOutput.h ***/
  10828. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10829. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10830. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10831. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10832. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10833. class JUCE_API MidiBuffer
  10834. {
  10835. public:
  10836. MidiBuffer() throw();
  10837. MidiBuffer (const MidiMessage& message) throw();
  10838. MidiBuffer (const MidiBuffer& other) throw();
  10839. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10840. ~MidiBuffer() throw();
  10841. void clear() throw();
  10842. void clear (const int start,
  10843. const int numSamples) throw();
  10844. bool isEmpty() const throw();
  10845. int getNumEvents() const throw();
  10846. void addEvent (const MidiMessage& midiMessage,
  10847. const int sampleNumber) throw();
  10848. void addEvent (const uint8* const rawMidiData,
  10849. const int maxBytesOfMidiData,
  10850. const int sampleNumber) throw();
  10851. void addEvents (const MidiBuffer& otherBuffer,
  10852. const int startSample,
  10853. const int numSamples,
  10854. const int sampleDeltaToAdd) throw();
  10855. int getFirstEventTime() const throw();
  10856. int getLastEventTime() const throw();
  10857. void swap (MidiBuffer& other);
  10858. class Iterator
  10859. {
  10860. public:
  10861. Iterator (const MidiBuffer& buffer) throw();
  10862. ~Iterator() throw();
  10863. void setNextSamplePosition (const int samplePosition) throw();
  10864. bool getNextEvent (MidiMessage& result,
  10865. int& samplePosition) throw();
  10866. bool getNextEvent (const uint8* &midiData,
  10867. int& numBytesOfMidiData,
  10868. int& samplePosition) throw();
  10869. juce_UseDebuggingNewOperator
  10870. private:
  10871. const MidiBuffer& buffer;
  10872. const uint8* data;
  10873. Iterator (const Iterator&);
  10874. Iterator& operator= (const Iterator&);
  10875. };
  10876. juce_UseDebuggingNewOperator
  10877. private:
  10878. friend class MidiBuffer::Iterator;
  10879. MemoryBlock data;
  10880. int bytesUsed;
  10881. uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
  10882. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10883. };
  10884. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10885. /*** End of inlined file: juce_MidiBuffer.h ***/
  10886. class JUCE_API MidiOutput : private Thread
  10887. {
  10888. public:
  10889. static const StringArray getDevices();
  10890. static int getDefaultDeviceIndex();
  10891. static MidiOutput* openDevice (int deviceIndex);
  10892. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10893. static MidiOutput* createNewDevice (const String& deviceName);
  10894. #endif
  10895. virtual ~MidiOutput();
  10896. virtual void sendMessageNow (const MidiMessage& message);
  10897. virtual void reset();
  10898. virtual bool getVolume (float& leftVol,
  10899. float& rightVol);
  10900. virtual void setVolume (float leftVol,
  10901. float rightVol);
  10902. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10903. const double millisecondCounterToStartAt,
  10904. double samplesPerSecondForBuffer);
  10905. virtual void clearAllPendingMessages();
  10906. virtual void startBackgroundThread();
  10907. virtual void stopBackgroundThread();
  10908. juce_UseDebuggingNewOperator
  10909. protected:
  10910. void* internal;
  10911. struct PendingMessage
  10912. {
  10913. PendingMessage (const uint8* data, int len, double sampleNumber);
  10914. MidiMessage message;
  10915. PendingMessage* next;
  10916. juce_UseDebuggingNewOperator
  10917. };
  10918. CriticalSection lock;
  10919. PendingMessage* firstMessage;
  10920. MidiOutput();
  10921. void run();
  10922. private:
  10923. MidiOutput (const MidiOutput&);
  10924. MidiOutput& operator= (const MidiOutput&);
  10925. };
  10926. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10927. /*** End of inlined file: juce_MidiOutput.h ***/
  10928. /*** Start of inlined file: juce_ComboBox.h ***/
  10929. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10930. #define __JUCE_COMBOBOX_JUCEHEADER__
  10931. /*** Start of inlined file: juce_Label.h ***/
  10932. #ifndef __JUCE_LABEL_JUCEHEADER__
  10933. #define __JUCE_LABEL_JUCEHEADER__
  10934. /*** Start of inlined file: juce_TextEditor.h ***/
  10935. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10936. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10937. /*** Start of inlined file: juce_Viewport.h ***/
  10938. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10939. #define __JUCE_VIEWPORT_JUCEHEADER__
  10940. /*** Start of inlined file: juce_ScrollBar.h ***/
  10941. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10942. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10943. /*** Start of inlined file: juce_Button.h ***/
  10944. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10945. #define __JUCE_BUTTON_JUCEHEADER__
  10946. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10947. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10948. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10949. /*** Start of inlined file: juce_TooltipClient.h ***/
  10950. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10951. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10952. class JUCE_API TooltipClient
  10953. {
  10954. public:
  10955. virtual ~TooltipClient() {}
  10956. virtual const String getTooltip() = 0;
  10957. };
  10958. class JUCE_API SettableTooltipClient : public TooltipClient
  10959. {
  10960. public:
  10961. virtual ~SettableTooltipClient() {}
  10962. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10963. virtual const String getTooltip() { return tooltipString; }
  10964. juce_UseDebuggingNewOperator
  10965. protected:
  10966. String tooltipString;
  10967. };
  10968. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10969. /*** End of inlined file: juce_TooltipClient.h ***/
  10970. class JUCE_API TooltipWindow : public Component,
  10971. private Timer
  10972. {
  10973. public:
  10974. TooltipWindow (Component* parentComponent = 0,
  10975. const int millisecondsBeforeTipAppears = 700);
  10976. ~TooltipWindow();
  10977. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10978. enum ColourIds
  10979. {
  10980. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10981. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10982. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10983. };
  10984. juce_UseDebuggingNewOperator
  10985. private:
  10986. int millisecondsBeforeTipAppears;
  10987. Point<int> lastMousePos;
  10988. int mouseClicks;
  10989. unsigned int lastCompChangeTime, lastHideTime;
  10990. Component* lastComponentUnderMouse;
  10991. bool changedCompsSinceShown;
  10992. String tipShowing, lastTipUnderMouse;
  10993. void paint (Graphics& g);
  10994. void mouseEnter (const MouseEvent& e);
  10995. void timerCallback();
  10996. static const String getTipFor (Component* const c);
  10997. void showFor (const String& tip);
  10998. void hide();
  10999. TooltipWindow (const TooltipWindow&);
  11000. TooltipWindow& operator= (const TooltipWindow&);
  11001. };
  11002. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11003. /*** End of inlined file: juce_TooltipWindow.h ***/
  11004. class Button;
  11005. class JUCE_API ButtonListener
  11006. {
  11007. public:
  11008. virtual ~ButtonListener() {}
  11009. virtual void buttonClicked (Button* button) = 0;
  11010. virtual void buttonStateChanged (Button*) {}
  11011. };
  11012. class JUCE_API Button : public Component,
  11013. public SettableTooltipClient,
  11014. public ApplicationCommandManagerListener,
  11015. public Value::Listener,
  11016. private KeyListener
  11017. {
  11018. protected:
  11019. Button (const String& buttonName);
  11020. public:
  11021. virtual ~Button();
  11022. void setButtonText (const String& newText);
  11023. const String getButtonText() const { return text; }
  11024. bool isDown() const throw();
  11025. bool isOver() const throw();
  11026. void setToggleState (const bool shouldBeOn,
  11027. const bool sendChangeNotification);
  11028. bool getToggleState() const throw() { return isOn.getValue(); }
  11029. Value& getToggleStateValue() { return isOn; }
  11030. void setClickingTogglesState (const bool shouldToggle) throw();
  11031. bool getClickingTogglesState() const throw();
  11032. void setRadioGroupId (const int newGroupId);
  11033. int getRadioGroupId() const throw() { return radioGroupId; }
  11034. void addButtonListener (ButtonListener* const newListener);
  11035. void removeButtonListener (ButtonListener* const listener);
  11036. virtual void triggerClick();
  11037. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11038. const int commandID,
  11039. const bool generateTooltip);
  11040. int getCommandID() const throw() { return commandID; }
  11041. void addShortcut (const KeyPress& key);
  11042. void clearShortcuts();
  11043. bool isRegisteredForShortcut (const KeyPress& key) const;
  11044. void setRepeatSpeed (const int initialDelayInMillisecs,
  11045. const int repeatDelayInMillisecs,
  11046. const int minimumDelayInMillisecs = -1) throw();
  11047. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  11048. uint32 getMillisecondsSinceButtonDown() const throw();
  11049. void setVisible (bool shouldBeVisible);
  11050. void setTooltip (const String& newTooltip);
  11051. // (implementation of the TooltipClient method)
  11052. const String getTooltip();
  11053. enum ConnectedEdgeFlags
  11054. {
  11055. ConnectedOnLeft = 1,
  11056. ConnectedOnRight = 2,
  11057. ConnectedOnTop = 4,
  11058. ConnectedOnBottom = 8
  11059. };
  11060. void setConnectedEdges (const int connectedEdgeFlags);
  11061. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11062. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11063. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11064. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11065. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11066. enum ButtonState
  11067. {
  11068. buttonNormal,
  11069. buttonOver,
  11070. buttonDown
  11071. };
  11072. void setState (const ButtonState newState);
  11073. juce_UseDebuggingNewOperator
  11074. protected:
  11075. virtual void clicked();
  11076. virtual void clicked (const ModifierKeys& modifiers);
  11077. virtual void paintButton (Graphics& g,
  11078. bool isMouseOverButton,
  11079. bool isButtonDown) = 0;
  11080. virtual void buttonStateChanged();
  11081. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11082. void handleCommandMessage (int commandId);
  11083. void mouseEnter (const MouseEvent& e);
  11084. void mouseExit (const MouseEvent& e);
  11085. void mouseDown (const MouseEvent& e);
  11086. void mouseDrag (const MouseEvent& e);
  11087. void mouseUp (const MouseEvent& e);
  11088. bool keyPressed (const KeyPress& key);
  11089. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11090. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  11091. void paint (Graphics& g);
  11092. void parentHierarchyChanged();
  11093. void focusGained (FocusChangeType cause);
  11094. void focusLost (FocusChangeType cause);
  11095. void enablementChanged();
  11096. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11097. void applicationCommandListChanged();
  11098. void valueChanged (Value& value);
  11099. private:
  11100. Array <KeyPress> shortcuts;
  11101. Component::SafePointer<Component> keySource;
  11102. String text;
  11103. ListenerList <ButtonListener> buttonListeners;
  11104. class RepeatTimer;
  11105. friend class RepeatTimer;
  11106. friend class ScopedPointer <RepeatTimer>;
  11107. ScopedPointer <RepeatTimer> repeatTimer;
  11108. uint32 buttonPressTime, lastTimeCallbackTime;
  11109. ApplicationCommandManager* commandManagerToUse;
  11110. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11111. int radioGroupId, commandID, connectedEdgeFlags;
  11112. ButtonState buttonState;
  11113. Value isOn;
  11114. bool lastToggleState : 1;
  11115. bool clickTogglesState : 1;
  11116. bool needsToRelease : 1;
  11117. bool needsRepainting : 1;
  11118. bool isKeyDown : 1;
  11119. bool triggerOnMouseDown : 1;
  11120. bool generateTooltip : 1;
  11121. void repeatTimerCallback();
  11122. RepeatTimer& getRepeatTimer();
  11123. ButtonState updateState (const MouseEvent* const e);
  11124. bool isShortcutPressed() const;
  11125. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11126. void flashButtonState();
  11127. void sendClickMessage (const ModifierKeys& modifiers);
  11128. void sendStateMessage();
  11129. Button (const Button&);
  11130. Button& operator= (const Button&);
  11131. };
  11132. #endif // __JUCE_BUTTON_JUCEHEADER__
  11133. /*** End of inlined file: juce_Button.h ***/
  11134. class ScrollBar;
  11135. class JUCE_API ScrollBarListener
  11136. {
  11137. public:
  11138. virtual ~ScrollBarListener() {}
  11139. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11140. double newRangeStart) = 0;
  11141. };
  11142. class JUCE_API ScrollBar : public Component,
  11143. public AsyncUpdater,
  11144. private Timer
  11145. {
  11146. public:
  11147. ScrollBar (const bool isVertical,
  11148. const bool buttonsAreVisible = true);
  11149. ~ScrollBar();
  11150. bool isVertical() const throw() { return vertical; }
  11151. void setOrientation (const bool shouldBeVertical) throw();
  11152. void setButtonVisibility (const bool buttonsAreVisible);
  11153. void setAutoHide (const bool shouldHideWhenFullRange);
  11154. void setRangeLimits (const double minimum,
  11155. const double maximum) throw();
  11156. double getMinimumRangeLimit() const throw() { return minimum; }
  11157. double getMaximumRangeLimit() const throw() { return maximum; }
  11158. void setCurrentRange (double newStart,
  11159. double newSize) throw();
  11160. void setCurrentRangeStart (double newStart) throw();
  11161. double getCurrentRangeStart() const throw() { return rangeStart; }
  11162. double getCurrentRangeSize() const throw() { return rangeSize; }
  11163. void setSingleStepSize (const double newSingleStepSize) throw();
  11164. void moveScrollbarInSteps (const int howManySteps) throw();
  11165. void moveScrollbarInPages (const int howManyPages) throw();
  11166. void scrollToTop() throw();
  11167. void scrollToBottom() throw();
  11168. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  11169. const int repeatDelayInMillisecs,
  11170. const int minimumDelayInMillisecs = -1) throw();
  11171. enum ColourIds
  11172. {
  11173. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11174. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11175. 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. */
  11176. };
  11177. void addListener (ScrollBarListener* const listener) throw();
  11178. void removeListener (ScrollBarListener* const listener) throw();
  11179. bool keyPressed (const KeyPress& key);
  11180. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11181. void lookAndFeelChanged();
  11182. void handleAsyncUpdate();
  11183. void mouseDown (const MouseEvent& e);
  11184. void mouseDrag (const MouseEvent& e);
  11185. void mouseUp (const MouseEvent& e);
  11186. void paint (Graphics& g);
  11187. void resized();
  11188. juce_UseDebuggingNewOperator
  11189. private:
  11190. double minimum, maximum;
  11191. double rangeStart, rangeSize;
  11192. double singleStepSize, dragStartRange;
  11193. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11194. int dragStartMousePos, lastMousePos;
  11195. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11196. bool vertical, isDraggingThumb, alwaysVisible;
  11197. Button* upButton;
  11198. Button* downButton;
  11199. ListenerList <ScrollBarListener> listeners;
  11200. void updateThumbPosition() throw();
  11201. void timerCallback();
  11202. ScrollBar (const ScrollBar&);
  11203. ScrollBar& operator= (const ScrollBar&);
  11204. };
  11205. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11206. /*** End of inlined file: juce_ScrollBar.h ***/
  11207. class JUCE_API Viewport : public Component,
  11208. private ComponentListener,
  11209. private ScrollBarListener
  11210. {
  11211. public:
  11212. Viewport (const String& componentName = String::empty);
  11213. ~Viewport();
  11214. void setViewedComponent (Component* const newViewedComponent);
  11215. Component* getViewedComponent() const throw() { return contentComp; }
  11216. void setViewPosition (const int xPixelsOffset,
  11217. const int yPixelsOffset);
  11218. void setViewPositionProportionately (const double proportionX,
  11219. const double proportionY);
  11220. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11221. int getViewPositionX() const throw() { return lastVX; }
  11222. int getViewPositionY() const throw() { return lastVY; }
  11223. int getViewWidth() const throw() { return lastVW; }
  11224. int getViewHeight() const throw() { return lastVH; }
  11225. int getMaximumVisibleWidth() const throw();
  11226. int getMaximumVisibleHeight() const throw();
  11227. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11228. int visibleW, int visibleH);
  11229. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11230. const bool showHorizontalScrollbarIfNeeded);
  11231. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11232. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11233. void setScrollBarThickness (const int thickness);
  11234. int getScrollBarThickness() const throw();
  11235. void setSingleStepSizes (const int stepX, const int stepY);
  11236. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11237. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11238. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11239. juce_UseDebuggingNewOperator
  11240. void resized();
  11241. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11242. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11243. bool keyPressed (const KeyPress& key);
  11244. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11245. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11246. private:
  11247. Component::SafePointer<Component> contentComp;
  11248. int lastVX, lastVY, lastVW, lastVH;
  11249. int scrollBarThickness;
  11250. int singleStepX, singleStepY;
  11251. bool showHScrollbar, showVScrollbar;
  11252. Component* contentHolder;
  11253. ScrollBar* verticalScrollBar;
  11254. ScrollBar* horizontalScrollBar;
  11255. void updateVisibleRegion();
  11256. Viewport (const Viewport&);
  11257. Viewport& operator= (const Viewport&);
  11258. };
  11259. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11260. /*** End of inlined file: juce_Viewport.h ***/
  11261. /*** Start of inlined file: juce_PopupMenu.h ***/
  11262. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11263. #define __JUCE_POPUPMENU_JUCEHEADER__
  11264. class PopupMenuCustomComponent;
  11265. class JUCE_API PopupMenu
  11266. {
  11267. public:
  11268. PopupMenu();
  11269. PopupMenu (const PopupMenu& other);
  11270. ~PopupMenu();
  11271. PopupMenu& operator= (const PopupMenu& other);
  11272. void clear();
  11273. void addItem (const int itemResultId,
  11274. const String& itemText,
  11275. const bool isActive = true,
  11276. const bool isTicked = false,
  11277. const Image* const iconToUse = 0);
  11278. void addCommandItem (ApplicationCommandManager* commandManager,
  11279. const int commandID,
  11280. const String& displayName = String::empty);
  11281. void addColouredItem (const int itemResultId,
  11282. const String& itemText,
  11283. const Colour& itemTextColour,
  11284. const bool isActive = true,
  11285. const bool isTicked = false,
  11286. const Image* const iconToUse = 0);
  11287. void addCustomItem (const int itemResultId,
  11288. PopupMenuCustomComponent* const customComponent);
  11289. void addCustomItem (const int itemResultId,
  11290. Component* customComponent,
  11291. int idealWidth, int idealHeight,
  11292. const bool triggerMenuItemAutomaticallyWhenClicked);
  11293. void addSubMenu (const String& subMenuName,
  11294. const PopupMenu& subMenu,
  11295. const bool isActive = true,
  11296. Image* const iconToUse = 0,
  11297. const bool isTicked = false);
  11298. void addSeparator();
  11299. void addSectionHeader (const String& title);
  11300. int getNumItems() const throw();
  11301. bool containsCommandItem (const int commandID) const;
  11302. bool containsAnyActiveItems() const throw();
  11303. int show (const int itemIdThatMustBeVisible = 0,
  11304. const int minimumWidth = 0,
  11305. const int maximumNumColumns = 0,
  11306. const int standardItemHeight = 0);
  11307. int showAt (const int screenX,
  11308. const int screenY,
  11309. const int itemIdThatMustBeVisible = 0,
  11310. const int minimumWidth = 0,
  11311. const int maximumNumColumns = 0,
  11312. const int standardItemHeight = 0);
  11313. int showAt (Component* componentToAttachTo,
  11314. const int itemIdThatMustBeVisible = 0,
  11315. const int minimumWidth = 0,
  11316. const int maximumNumColumns = 0,
  11317. const int standardItemHeight = 0);
  11318. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11319. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11320. enum ColourIds
  11321. {
  11322. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11323. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11324. colour is specified when the item is added). */
  11325. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11326. addSectionHeader() method). */
  11327. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11328. highlighted menu item. */
  11329. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11330. highlighted item. */
  11331. };
  11332. class JUCE_API MenuItemIterator
  11333. {
  11334. public:
  11335. MenuItemIterator (const PopupMenu& menu);
  11336. ~MenuItemIterator();
  11337. bool next();
  11338. String itemName;
  11339. const PopupMenu* subMenu;
  11340. int itemId;
  11341. bool isSeparator;
  11342. bool isTicked;
  11343. bool isEnabled;
  11344. bool isCustomComponent;
  11345. bool isSectionHeader;
  11346. const Colour* customColour;
  11347. const Image* customImage;
  11348. ApplicationCommandManager* commandManager;
  11349. juce_UseDebuggingNewOperator
  11350. private:
  11351. const PopupMenu& menu;
  11352. int index;
  11353. MenuItemIterator (const MenuItemIterator&);
  11354. MenuItemIterator& operator= (const MenuItemIterator&);
  11355. };
  11356. juce_UseDebuggingNewOperator
  11357. private:
  11358. class Item;
  11359. class ItemComponent;
  11360. class Window;
  11361. friend class MenuItemIterator;
  11362. friend class ItemComponent;
  11363. friend class Window;
  11364. friend class PopupMenuCustomComponent;
  11365. friend class OwnedArray <Item>;
  11366. friend class ScopedPointer <Window>;
  11367. OwnedArray <Item> items;
  11368. LookAndFeel* lookAndFeel;
  11369. bool separatorPending;
  11370. void addSeparatorIfPending();
  11371. int showMenu (const int x, const int y, const int w, const int h,
  11372. const int itemIdThatMustBeVisible,
  11373. const int minimumWidth,
  11374. const int maximumNumColumns,
  11375. const int standardItemHeight,
  11376. const bool alignToRectangle,
  11377. Component* const componentAttachedTo);
  11378. friend class MenuBarComponent;
  11379. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11380. const int itemIdThatMustBeVisible,
  11381. const int minimumWidth,
  11382. const int maximumNumColumns,
  11383. const int standardItemHeight,
  11384. const bool alignToRectangle,
  11385. Component* menuBarComponent,
  11386. ApplicationCommandManager** managerOfChosenCommand,
  11387. Component* const componentAttachedTo);
  11388. };
  11389. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11390. /*** End of inlined file: juce_PopupMenu.h ***/
  11391. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11392. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11393. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11394. class JUCE_API TextInputTarget
  11395. {
  11396. public:
  11397. TextInputTarget() {}
  11398. virtual ~TextInputTarget() {}
  11399. virtual const Range<int> getHighlightedRegion() const = 0;
  11400. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11401. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11402. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11403. };
  11404. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11405. /*** End of inlined file: juce_TextInputTarget.h ***/
  11406. class TextEditor;
  11407. class TextHolderComponent;
  11408. class JUCE_API TextEditorListener
  11409. {
  11410. public:
  11411. virtual ~TextEditorListener() {}
  11412. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11413. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11414. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11415. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11416. };
  11417. class JUCE_API TextEditor : public Component,
  11418. public TextInputTarget,
  11419. public SettableTooltipClient
  11420. {
  11421. public:
  11422. TextEditor (const String& componentName = String::empty,
  11423. const tchar passwordCharacter = 0);
  11424. virtual ~TextEditor();
  11425. void setMultiLine (const bool shouldBeMultiLine,
  11426. const bool shouldWordWrap = true);
  11427. bool isMultiLine() const;
  11428. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11429. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11430. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11431. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11432. void setReadOnly (const bool shouldBeReadOnly);
  11433. bool isReadOnly() const;
  11434. void setCaretVisible (const bool shouldBeVisible);
  11435. bool isCaretVisible() const { return caretVisible; }
  11436. void setScrollbarsShown (bool shouldBeEnabled);
  11437. bool areScrollbarsShown() const { return scrollbarVisible; }
  11438. void setPasswordCharacter (const tchar passwordCharacter);
  11439. tchar getPasswordCharacter() const { return passwordCharacter; }
  11440. void setPopupMenuEnabled (const bool menuEnabled);
  11441. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11442. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11443. enum ColourIds
  11444. {
  11445. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11446. transparent if necessary. */
  11447. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11448. that because the editor can contain multiple colours, calling this
  11449. method won't change the colour of existing text - to do that, call
  11450. applyFontToAllText() after calling this method.*/
  11451. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11452. the text - this can be transparent if you don't want to show any
  11453. highlighting.*/
  11454. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11455. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11456. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11457. the edge of the component. */
  11458. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11459. the edge of the component when it has focus. */
  11460. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11461. around the edge of the editor. */
  11462. };
  11463. void setFont (const Font& newFont);
  11464. void applyFontToAllText (const Font& newFont);
  11465. const Font getFont() const;
  11466. void setSelectAllWhenFocused (const bool b);
  11467. void setInputRestrictions (const int maxTextLength,
  11468. const String& allowedCharacters = String::empty);
  11469. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11470. void setScrollBarThickness (const int newThicknessPixels);
  11471. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11472. void addListener (TextEditorListener* const newListener);
  11473. void removeListener (TextEditorListener* const listenerToRemove);
  11474. const String getText() const;
  11475. const String getTextInRange (const Range<int>& textRange) const;
  11476. bool isEmpty() const;
  11477. void setText (const String& newText,
  11478. const bool sendTextChangeMessage = true);
  11479. Value& getTextValue();
  11480. void insertTextAtCaret (const String& textToInsert);
  11481. void clear();
  11482. void cut();
  11483. void copy();
  11484. void paste();
  11485. void setCaretPosition (const int newIndex);
  11486. int getCaretPosition() const;
  11487. void scrollEditorToPositionCaret (const int desiredCaretX,
  11488. const int desiredCaretY);
  11489. const Rectangle<int> getCaretRectangle();
  11490. void setHighlightedRegion (const Range<int>& newSelection);
  11491. const Range<int> getHighlightedRegion() const { return selection; }
  11492. const String getHighlightedText() const;
  11493. int getTextIndexAt (const int x, const int y);
  11494. int getTotalNumChars() const;
  11495. int getTextWidth() const;
  11496. int getTextHeight() const;
  11497. void setIndents (const int newLeftIndent, const int newTopIndent);
  11498. void setBorder (const BorderSize& border);
  11499. const BorderSize getBorder() const;
  11500. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11501. void paint (Graphics& g);
  11502. void paintOverChildren (Graphics& g);
  11503. void mouseDown (const MouseEvent& e);
  11504. void mouseUp (const MouseEvent& e);
  11505. void mouseDrag (const MouseEvent& e);
  11506. void mouseDoubleClick (const MouseEvent& e);
  11507. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11508. bool keyPressed (const KeyPress& key);
  11509. bool keyStateChanged (const bool isKeyDown);
  11510. void focusGained (FocusChangeType cause);
  11511. void focusLost (FocusChangeType cause);
  11512. void resized();
  11513. void enablementChanged();
  11514. void colourChanged();
  11515. juce_UseDebuggingNewOperator
  11516. protected:
  11517. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11518. const MouseEvent* mouseClickEvent);
  11519. virtual void performPopupMenuAction (const int menuItemID);
  11520. void scrollToMakeSureCursorIsVisible();
  11521. void moveCaret (int newCaretPos);
  11522. void moveCursorTo (const int newPosition, const bool isSelecting);
  11523. void textChanged();
  11524. void newTransaction();
  11525. void doUndoRedo (const bool isRedo);
  11526. virtual void returnPressed();
  11527. virtual void escapePressed();
  11528. void handleCommandMessage (int commandId);
  11529. private:
  11530. ScopedPointer <Viewport> viewport;
  11531. TextHolderComponent* textHolder;
  11532. BorderSize borderSize;
  11533. bool readOnly : 1;
  11534. bool multiline : 1;
  11535. bool wordWrap : 1;
  11536. bool returnKeyStartsNewLine : 1;
  11537. bool caretVisible : 1;
  11538. bool popupMenuEnabled : 1;
  11539. bool selectAllTextWhenFocused : 1;
  11540. bool scrollbarVisible : 1;
  11541. bool wasFocused : 1;
  11542. bool caretFlashState : 1;
  11543. bool keepCursorOnScreen : 1;
  11544. bool tabKeyUsed : 1;
  11545. bool menuActive : 1;
  11546. bool valueTextNeedsUpdating : 1;
  11547. UndoManager undoManager;
  11548. float cursorX, cursorY, cursorHeight;
  11549. int maxTextLength;
  11550. Range<int> selection;
  11551. int leftIndent, topIndent;
  11552. unsigned int lastTransactionTime;
  11553. Font currentFont;
  11554. mutable int totalNumChars;
  11555. int caretPosition;
  11556. VoidArray sections;
  11557. String textToShowWhenEmpty;
  11558. Colour colourForTextWhenEmpty;
  11559. tchar passwordCharacter;
  11560. Value textValue;
  11561. enum
  11562. {
  11563. notDragging,
  11564. draggingSelectionStart,
  11565. draggingSelectionEnd
  11566. } dragType;
  11567. String allowedCharacters;
  11568. ListenerList <TextEditorListener> listeners;
  11569. friend class TextEditorInsertAction;
  11570. friend class TextEditorRemoveAction;
  11571. void coalesceSimilarSections();
  11572. void splitSection (const int sectionIndex, const int charToSplitAt);
  11573. void clearInternal (UndoManager* const um);
  11574. void insert (const String& text,
  11575. const int insertIndex,
  11576. const Font& font,
  11577. const Colour& colour,
  11578. UndoManager* const um,
  11579. const int caretPositionToMoveTo);
  11580. void reinsert (const int insertIndex,
  11581. const VoidArray& sections);
  11582. void remove (const Range<int>& range,
  11583. UndoManager* const um,
  11584. const int caretPositionToMoveTo);
  11585. void getCharPosition (const int index,
  11586. float& x, float& y,
  11587. float& lineHeight) const;
  11588. void updateCaretPosition();
  11589. void textWasChangedByValue();
  11590. int indexAtPosition (const float x,
  11591. const float y);
  11592. int findWordBreakAfter (const int position) const;
  11593. int findWordBreakBefore (const int position) const;
  11594. friend class TextHolderComponent;
  11595. friend class TextEditorViewport;
  11596. void drawContent (Graphics& g);
  11597. void updateTextHolderSize();
  11598. float getWordWrapWidth() const;
  11599. void timerCallbackInt();
  11600. void repaintCaret();
  11601. void repaintText (const Range<int>& range);
  11602. UndoManager* getUndoManager() throw();
  11603. TextEditor (const TextEditor&);
  11604. TextEditor& operator= (const TextEditor&);
  11605. };
  11606. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11607. /*** End of inlined file: juce_TextEditor.h ***/
  11608. class Label;
  11609. class JUCE_API LabelListener
  11610. {
  11611. public:
  11612. virtual ~LabelListener() {}
  11613. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11614. };
  11615. class JUCE_API Label : public Component,
  11616. public SettableTooltipClient,
  11617. protected TextEditorListener,
  11618. private ComponentListener,
  11619. private Value::Listener
  11620. {
  11621. public:
  11622. Label (const String& componentName,
  11623. const String& labelText);
  11624. ~Label();
  11625. void setText (const String& newText,
  11626. const bool broadcastChangeMessage);
  11627. const String getText (const bool returnActiveEditorContents = false) const throw();
  11628. Value& getTextValue() { return textValue; }
  11629. void setFont (const Font& newFont) throw();
  11630. const Font& getFont() const throw();
  11631. enum ColourIds
  11632. {
  11633. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11634. textColourId = 0x1000281, /**< The colour for the text. */
  11635. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11636. Leave this transparent to not have an outline. */
  11637. };
  11638. void setJustificationType (const Justification& justification) throw();
  11639. const Justification getJustificationType() const throw() { return justification; }
  11640. void setBorderSize (int horizontalBorder, int verticalBorder);
  11641. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11642. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11643. void attachToComponent (Component* owner,
  11644. const bool onLeft);
  11645. Component* getAttachedComponent() const;
  11646. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11647. void setMinimumHorizontalScale (const float newScale);
  11648. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11649. void addListener (LabelListener* const listener) throw();
  11650. void removeListener (LabelListener* const listener) throw();
  11651. void setEditable (const bool editOnSingleClick,
  11652. const bool editOnDoubleClick = false,
  11653. const bool lossOfFocusDiscardsChanges = false) throw();
  11654. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11655. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11656. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11657. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11658. void showEditor();
  11659. void hideEditor (const bool discardCurrentEditorContents);
  11660. bool isBeingEdited() const throw();
  11661. juce_UseDebuggingNewOperator
  11662. protected:
  11663. virtual TextEditor* createEditorComponent();
  11664. virtual void textWasEdited();
  11665. virtual void textWasChanged();
  11666. virtual void editorShown (TextEditor* editorComponent);
  11667. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11668. void paint (Graphics& g);
  11669. void resized();
  11670. void mouseUp (const MouseEvent& e);
  11671. void mouseDoubleClick (const MouseEvent& e);
  11672. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11673. void componentParentHierarchyChanged (Component& component);
  11674. void componentVisibilityChanged (Component& component);
  11675. void inputAttemptWhenModal();
  11676. void focusGained (FocusChangeType);
  11677. void enablementChanged();
  11678. KeyboardFocusTraverser* createFocusTraverser();
  11679. void textEditorTextChanged (TextEditor& editor);
  11680. void textEditorReturnKeyPressed (TextEditor& editor);
  11681. void textEditorEscapeKeyPressed (TextEditor& editor);
  11682. void textEditorFocusLost (TextEditor& editor);
  11683. void colourChanged();
  11684. void valueChanged (Value&);
  11685. private:
  11686. Value textValue;
  11687. String lastTextValue;
  11688. Font font;
  11689. Justification justification;
  11690. ScopedPointer <TextEditor> editor;
  11691. ListenerList <LabelListener> listeners;
  11692. Component::SafePointer<Component> ownerComponent;
  11693. int horizontalBorderSize, verticalBorderSize;
  11694. float minimumHorizontalScale;
  11695. bool editSingleClick : 1;
  11696. bool editDoubleClick : 1;
  11697. bool lossOfFocusDiscardsChanges : 1;
  11698. bool leftOfOwnerComp : 1;
  11699. bool updateFromTextEditorContents();
  11700. void callChangeListeners();
  11701. Label (const Label&);
  11702. Label& operator= (const Label&);
  11703. };
  11704. #endif // __JUCE_LABEL_JUCEHEADER__
  11705. /*** End of inlined file: juce_Label.h ***/
  11706. class ComboBox;
  11707. class JUCE_API ComboBoxListener
  11708. {
  11709. public:
  11710. virtual ~ComboBoxListener() {}
  11711. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11712. };
  11713. class JUCE_API ComboBox : public Component,
  11714. public SettableTooltipClient,
  11715. private LabelListener,
  11716. private AsyncUpdater,
  11717. private Value::Listener
  11718. {
  11719. public:
  11720. ComboBox (const String& componentName);
  11721. ~ComboBox();
  11722. void setEditableText (const bool isEditable);
  11723. bool isTextEditable() const throw();
  11724. void setJustificationType (const Justification& justification) throw();
  11725. const Justification getJustificationType() const throw();
  11726. void addItem (const String& newItemText,
  11727. const int newItemId) throw();
  11728. void addSeparator() throw();
  11729. void addSectionHeading (const String& headingName) throw();
  11730. void setItemEnabled (const int itemId,
  11731. const bool shouldBeEnabled) throw();
  11732. void changeItemText (const int itemId,
  11733. const String& newText) throw();
  11734. void clear (const bool dontSendChangeMessage = false);
  11735. int getNumItems() const throw();
  11736. const String getItemText (const int index) const throw();
  11737. int getItemId (const int index) const throw();
  11738. int indexOfItemId (const int itemId) const throw();
  11739. int getSelectedId() const throw();
  11740. Value& getSelectedIdAsValue() throw() { return currentId; }
  11741. void setSelectedId (const int newItemId,
  11742. const bool dontSendChangeMessage = false) throw();
  11743. int getSelectedItemIndex() const throw();
  11744. void setSelectedItemIndex (const int newItemIndex,
  11745. const bool dontSendChangeMessage = false) throw();
  11746. const String getText() const throw();
  11747. void setText (const String& newText,
  11748. const bool dontSendChangeMessage = false) throw();
  11749. void showEditor();
  11750. void addListener (ComboBoxListener* const listener) throw();
  11751. void removeListener (ComboBoxListener* const listener) throw();
  11752. void setTextWhenNothingSelected (const String& newMessage) throw();
  11753. const String getTextWhenNothingSelected() const throw();
  11754. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11755. const String getTextWhenNoChoicesAvailable() const throw();
  11756. void setTooltip (const String& newTooltip);
  11757. enum ColourIds
  11758. {
  11759. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11760. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11761. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11762. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11763. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11764. };
  11765. void labelTextChanged (Label*);
  11766. void enablementChanged();
  11767. void colourChanged();
  11768. void focusGained (Component::FocusChangeType cause);
  11769. void focusLost (Component::FocusChangeType cause);
  11770. void handleAsyncUpdate();
  11771. const String getTooltip() { return label->getTooltip(); }
  11772. void mouseDown (const MouseEvent&);
  11773. void mouseDrag (const MouseEvent&);
  11774. void mouseUp (const MouseEvent&);
  11775. void lookAndFeelChanged();
  11776. void paint (Graphics&);
  11777. void resized();
  11778. bool keyStateChanged (const bool isKeyDown);
  11779. bool keyPressed (const KeyPress&);
  11780. void valueChanged (Value&);
  11781. juce_UseDebuggingNewOperator
  11782. private:
  11783. struct ItemInfo
  11784. {
  11785. String name;
  11786. int itemId;
  11787. bool isEnabled : 1, isHeading : 1;
  11788. bool isSeparator() const throw();
  11789. bool isRealItem() const throw();
  11790. };
  11791. OwnedArray <ItemInfo> items;
  11792. Value currentId;
  11793. int lastCurrentId;
  11794. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11795. ListenerList <ComboBoxListener> listeners;
  11796. ScopedPointer<Label> label;
  11797. String textWhenNothingSelected, noChoicesMessage;
  11798. void showPopup();
  11799. ItemInfo* getItemForId (const int itemId) const throw();
  11800. ItemInfo* getItemForIndex (const int index) const throw();
  11801. ComboBox (const ComboBox&);
  11802. ComboBox& operator= (const ComboBox&);
  11803. };
  11804. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11805. /*** End of inlined file: juce_ComboBox.h ***/
  11806. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11807. {
  11808. public:
  11809. AudioDeviceManager();
  11810. ~AudioDeviceManager();
  11811. struct JUCE_API AudioDeviceSetup
  11812. {
  11813. AudioDeviceSetup();
  11814. bool operator== (const AudioDeviceSetup& other) const;
  11815. String outputDeviceName;
  11816. String inputDeviceName;
  11817. double sampleRate;
  11818. int bufferSize;
  11819. BigInteger inputChannels;
  11820. bool useDefaultInputChannels;
  11821. BigInteger outputChannels;
  11822. bool useDefaultOutputChannels;
  11823. };
  11824. const String initialise (const int numInputChannelsNeeded,
  11825. const int numOutputChannelsNeeded,
  11826. const XmlElement* const savedState,
  11827. const bool selectDefaultDeviceOnFailure,
  11828. const String& preferredDefaultDeviceName = String::empty,
  11829. const AudioDeviceSetup* preferredSetupOptions = 0);
  11830. XmlElement* createStateXml() const;
  11831. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11832. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11833. const bool treatAsChosenDevice);
  11834. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11835. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11836. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11837. void setCurrentAudioDeviceType (const String& type,
  11838. const bool treatAsChosenDevice);
  11839. void closeAudioDevice();
  11840. void restartLastAudioDevice();
  11841. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11842. void removeAudioCallback (AudioIODeviceCallback* callback);
  11843. double getCpuUsage() const;
  11844. void setMidiInputEnabled (const String& midiInputDeviceName,
  11845. const bool enabled);
  11846. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11847. void addMidiInputCallback (const String& midiInputDeviceName,
  11848. MidiInputCallback* callback);
  11849. void removeMidiInputCallback (const String& midiInputDeviceName,
  11850. MidiInputCallback* callback);
  11851. void setDefaultMidiOutput (const String& deviceName);
  11852. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11853. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11854. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11855. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11856. void playTestSound();
  11857. void enableInputLevelMeasurement (const bool enableMeasurement);
  11858. double getCurrentInputLevel() const;
  11859. juce_UseDebuggingNewOperator
  11860. private:
  11861. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11862. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11863. AudioDeviceSetup currentSetup;
  11864. ScopedPointer <AudioIODevice> currentAudioDevice;
  11865. SortedSet <AudioIODeviceCallback*> callbacks;
  11866. int numInputChansNeeded, numOutputChansNeeded;
  11867. String currentDeviceType;
  11868. BigInteger inputChannels, outputChannels;
  11869. ScopedPointer <XmlElement> lastExplicitSettings;
  11870. mutable bool listNeedsScanning;
  11871. bool useInputNames;
  11872. int inputLevelMeasurementEnabledCount;
  11873. double inputLevel;
  11874. ScopedPointer <AudioSampleBuffer> testSound;
  11875. int testSoundPosition;
  11876. AudioSampleBuffer tempBuffer;
  11877. StringArray midiInsFromXml;
  11878. OwnedArray <MidiInput> enabledMidiInputs;
  11879. Array <MidiInputCallback*> midiCallbacks;
  11880. Array <MidiInput*> midiCallbackDevices;
  11881. String defaultMidiOutputName;
  11882. ScopedPointer <MidiOutput> defaultMidiOutput;
  11883. CriticalSection audioCallbackLock, midiCallbackLock;
  11884. double cpuUsageMs, timeToCpuScale;
  11885. class CallbackHandler : public AudioIODeviceCallback,
  11886. public MidiInputCallback
  11887. {
  11888. public:
  11889. AudioDeviceManager* owner;
  11890. void audioDeviceIOCallback (const float** inputChannelData,
  11891. int totalNumInputChannels,
  11892. float** outputChannelData,
  11893. int totalNumOutputChannels,
  11894. int numSamples);
  11895. void audioDeviceAboutToStart (AudioIODevice*);
  11896. void audioDeviceStopped();
  11897. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11898. };
  11899. CallbackHandler callbackHandler;
  11900. friend class CallbackHandler;
  11901. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11902. int totalNumInputChannels,
  11903. float** outputChannelData,
  11904. int totalNumOutputChannels,
  11905. int numSamples);
  11906. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11907. void audioDeviceStoppedInt();
  11908. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11909. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11910. const BigInteger& ins, const BigInteger& outs);
  11911. void stopDevice();
  11912. void updateXml();
  11913. void createDeviceTypesIfNeeded();
  11914. void scanDevicesIfNeeded();
  11915. void deleteCurrentDevice();
  11916. double chooseBestSampleRate (double preferred) const;
  11917. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11918. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11919. AudioDeviceManager (const AudioDeviceManager&);
  11920. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11921. };
  11922. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11923. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11924. #endif
  11925. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11926. #endif
  11927. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11928. #endif
  11929. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11930. #endif
  11931. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11932. #endif
  11933. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11934. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11935. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11936. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11937. class JUCE_API AudioDataConverters
  11938. {
  11939. public:
  11940. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11941. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11942. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11943. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11944. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11945. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11946. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11947. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11948. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11949. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11950. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11951. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11952. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11953. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11954. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11955. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11956. enum DataFormat
  11957. {
  11958. int16LE,
  11959. int16BE,
  11960. int24LE,
  11961. int24BE,
  11962. int32LE,
  11963. int32BE,
  11964. float32LE,
  11965. float32BE,
  11966. };
  11967. static void convertFloatToFormat (const DataFormat destFormat,
  11968. const float* source, void* dest, int numSamples);
  11969. static void convertFormatToFloat (const DataFormat sourceFormat,
  11970. const void* source, float* dest, int numSamples);
  11971. static void interleaveSamples (const float** source, float* dest,
  11972. const int numSamples, const int numChannels);
  11973. static void deinterleaveSamples (const float* source, float** dest,
  11974. const int numSamples, const int numChannels);
  11975. };
  11976. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11977. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11978. #endif
  11979. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11980. #endif
  11981. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11982. #endif
  11983. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11984. #endif
  11985. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11986. /*** Start of inlined file: juce_MidiFile.h ***/
  11987. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11988. #define __JUCE_MIDIFILE_JUCEHEADER__
  11989. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11990. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11991. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11992. class JUCE_API MidiMessageSequence
  11993. {
  11994. public:
  11995. MidiMessageSequence();
  11996. MidiMessageSequence (const MidiMessageSequence& other);
  11997. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11998. ~MidiMessageSequence();
  11999. class MidiEventHolder
  12000. {
  12001. public:
  12002. ~MidiEventHolder();
  12003. MidiMessage message;
  12004. MidiEventHolder* noteOffObject;
  12005. juce_UseDebuggingNewOperator
  12006. private:
  12007. friend class MidiMessageSequence;
  12008. MidiEventHolder (const MidiMessage& message);
  12009. };
  12010. void clear();
  12011. int getNumEvents() const;
  12012. MidiEventHolder* getEventPointer (const int index) const;
  12013. double getTimeOfMatchingKeyUp (const int index) const;
  12014. int getIndexOfMatchingKeyUp (const int index) const;
  12015. int getIndexOf (MidiEventHolder* const event) const;
  12016. int getNextIndexAtTime (const double timeStamp) const;
  12017. double getStartTime() const;
  12018. double getEndTime() const;
  12019. double getEventTime (const int index) const;
  12020. void addEvent (const MidiMessage& newMessage,
  12021. double timeAdjustment = 0);
  12022. void deleteEvent (const int index,
  12023. const bool deleteMatchingNoteUp);
  12024. void addSequence (const MidiMessageSequence& other,
  12025. double timeAdjustmentDelta,
  12026. double firstAllowableDestTime,
  12027. double endOfAllowableDestTimes);
  12028. void updateMatchedPairs();
  12029. void extractMidiChannelMessages (const int channelNumberToExtract,
  12030. MidiMessageSequence& destSequence,
  12031. const bool alsoIncludeMetaEvents) const;
  12032. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12033. void deleteMidiChannelMessages (const int channelNumberToRemove);
  12034. void deleteSysExMessages();
  12035. void addTimeToMessages (const double deltaTime);
  12036. void createControllerUpdatesForTime (const int channelNumber,
  12037. const double time,
  12038. OwnedArray<MidiMessage>& resultMessages);
  12039. void swapWith (MidiMessageSequence& other) throw();
  12040. juce_UseDebuggingNewOperator
  12041. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12042. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12043. private:
  12044. friend class MidiFile;
  12045. OwnedArray <MidiEventHolder> list;
  12046. void sort();
  12047. };
  12048. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12049. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12050. class JUCE_API MidiFile
  12051. {
  12052. public:
  12053. MidiFile() throw();
  12054. ~MidiFile() throw();
  12055. int getNumTracks() const throw();
  12056. const MidiMessageSequence* getTrack (const int index) const throw();
  12057. void addTrack (const MidiMessageSequence& trackSequence) throw();
  12058. void clear() throw();
  12059. short getTimeFormat() const throw();
  12060. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12061. void setSmpteTimeFormat (const int framesPerSecond,
  12062. const int subframeResolution) throw();
  12063. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12064. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12065. double getLastTimestamp() const;
  12066. bool readFrom (InputStream& sourceStream);
  12067. bool writeTo (OutputStream& destStream);
  12068. void convertTimestampTicksToSeconds();
  12069. juce_UseDebuggingNewOperator
  12070. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12071. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12072. private:
  12073. OwnedArray <MidiMessageSequence> tracks;
  12074. short timeFormat;
  12075. MidiFile (const MidiFile&);
  12076. MidiFile& operator= (const MidiFile&);
  12077. void readNextTrack (const char* data, int size);
  12078. void writeTrack (OutputStream& mainOut, const int trackNum);
  12079. };
  12080. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12081. /*** End of inlined file: juce_MidiFile.h ***/
  12082. #endif
  12083. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12084. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12085. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12086. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12087. class MidiKeyboardState;
  12088. class JUCE_API MidiKeyboardStateListener
  12089. {
  12090. public:
  12091. MidiKeyboardStateListener() throw() {}
  12092. virtual ~MidiKeyboardStateListener() {}
  12093. virtual void handleNoteOn (MidiKeyboardState* source,
  12094. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12095. virtual void handleNoteOff (MidiKeyboardState* source,
  12096. int midiChannel, int midiNoteNumber) = 0;
  12097. };
  12098. class JUCE_API MidiKeyboardState
  12099. {
  12100. public:
  12101. MidiKeyboardState();
  12102. ~MidiKeyboardState();
  12103. void reset();
  12104. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12105. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12106. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12107. void noteOff (const int midiChannel, const int midiNoteNumber);
  12108. void allNotesOff (const int midiChannel);
  12109. void processNextMidiEvent (const MidiMessage& message);
  12110. void processNextMidiBuffer (MidiBuffer& buffer,
  12111. const int startSample,
  12112. const int numSamples,
  12113. const bool injectIndirectEvents);
  12114. void addListener (MidiKeyboardStateListener* const listener) throw();
  12115. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12116. juce_UseDebuggingNewOperator
  12117. private:
  12118. CriticalSection lock;
  12119. uint16 noteStates [128];
  12120. MidiBuffer eventsToAdd;
  12121. VoidArray listeners;
  12122. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12123. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12124. MidiKeyboardState (const MidiKeyboardState&);
  12125. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12126. };
  12127. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12128. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12129. #endif
  12130. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12131. #endif
  12132. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12133. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12134. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12135. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12136. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12137. public MidiInputCallback
  12138. {
  12139. public:
  12140. MidiMessageCollector();
  12141. ~MidiMessageCollector();
  12142. void reset (const double sampleRate);
  12143. void addMessageToQueue (const MidiMessage& message);
  12144. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12145. const int numSamples);
  12146. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12147. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12148. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12149. juce_UseDebuggingNewOperator
  12150. private:
  12151. double lastCallbackTime;
  12152. CriticalSection midiCallbackLock;
  12153. MidiBuffer incomingMessages;
  12154. double sampleRate;
  12155. MidiMessageCollector (const MidiMessageCollector&);
  12156. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12157. };
  12158. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12159. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12160. #endif
  12161. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12162. #endif
  12163. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12164. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12165. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12166. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12167. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12168. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12169. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12170. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12171. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12172. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12173. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12174. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12175. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12176. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12177. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12178. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12179. class AudioProcessor;
  12180. class JUCE_API AudioProcessorEditor : public Component
  12181. {
  12182. protected:
  12183. AudioProcessorEditor (AudioProcessor* const owner);
  12184. public:
  12185. ~AudioProcessorEditor();
  12186. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12187. private:
  12188. AudioProcessor* const owner;
  12189. AudioProcessorEditor (const AudioProcessorEditor&);
  12190. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12191. };
  12192. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12193. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12194. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12195. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12196. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12197. class AudioProcessor;
  12198. class JUCE_API AudioProcessorListener
  12199. {
  12200. public:
  12201. virtual ~AudioProcessorListener() {}
  12202. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12203. int parameterIndex,
  12204. float newValue) = 0;
  12205. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12206. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12207. int parameterIndex);
  12208. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12209. int parameterIndex);
  12210. };
  12211. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12212. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12213. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12214. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12215. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12216. class JUCE_API AudioPlayHead
  12217. {
  12218. protected:
  12219. AudioPlayHead() {}
  12220. public:
  12221. virtual ~AudioPlayHead() {}
  12222. enum FrameRateType
  12223. {
  12224. fps24 = 0,
  12225. fps25 = 1,
  12226. fps2997 = 2,
  12227. fps30 = 3,
  12228. fps2997drop = 4,
  12229. fps30drop = 5,
  12230. fpsUnknown = 99
  12231. };
  12232. struct CurrentPositionInfo
  12233. {
  12234. double bpm;
  12235. int timeSigNumerator;
  12236. int timeSigDenominator;
  12237. double timeInSeconds;
  12238. double editOriginTime;
  12239. double ppqPosition;
  12240. double ppqPositionOfLastBarStart;
  12241. FrameRateType frameRate;
  12242. bool isPlaying;
  12243. bool isRecording;
  12244. };
  12245. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12246. };
  12247. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12248. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12249. class JUCE_API AudioProcessor
  12250. {
  12251. protected:
  12252. AudioProcessor();
  12253. public:
  12254. virtual ~AudioProcessor();
  12255. virtual const String getName() const = 0;
  12256. virtual void prepareToPlay (double sampleRate,
  12257. int estimatedSamplesPerBlock) = 0;
  12258. virtual void releaseResources() = 0;
  12259. virtual void processBlock (AudioSampleBuffer& buffer,
  12260. MidiBuffer& midiMessages) = 0;
  12261. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12262. double getSampleRate() const throw() { return sampleRate; }
  12263. int getBlockSize() const throw() { return blockSize; }
  12264. int getNumInputChannels() const throw() { return numInputChannels; }
  12265. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12266. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12267. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12268. virtual bool isInputChannelStereoPair (int index) const = 0;
  12269. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12270. int getLatencySamples() const throw() { return latencySamples; }
  12271. void setLatencySamples (const int newLatency);
  12272. virtual bool acceptsMidi() const = 0;
  12273. virtual bool producesMidi() const = 0;
  12274. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12275. void suspendProcessing (const bool shouldBeSuspended);
  12276. bool isSuspended() const throw() { return suspended; }
  12277. virtual void reset();
  12278. bool isNonRealtime() const throw() { return nonRealtime; }
  12279. void setNonRealtime (const bool isNonRealtime) throw();
  12280. virtual AudioProcessorEditor* createEditor() = 0;
  12281. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12282. AudioProcessorEditor* createEditorIfNeeded();
  12283. virtual int getNumParameters() = 0;
  12284. virtual const String getParameterName (int parameterIndex) = 0;
  12285. virtual float getParameter (int parameterIndex) = 0;
  12286. virtual const String getParameterText (int parameterIndex) = 0;
  12287. virtual void setParameter (int parameterIndex,
  12288. float newValue) = 0;
  12289. void setParameterNotifyingHost (int parameterIndex,
  12290. float newValue);
  12291. virtual bool isParameterAutomatable (int parameterIndex) const;
  12292. virtual bool isMetaParameter (int parameterIndex) const;
  12293. void beginParameterChangeGesture (int parameterIndex);
  12294. void endParameterChangeGesture (int parameterIndex);
  12295. void updateHostDisplay();
  12296. virtual int getNumPrograms() = 0;
  12297. virtual int getCurrentProgram() = 0;
  12298. virtual void setCurrentProgram (int index) = 0;
  12299. virtual const String getProgramName (int index) = 0;
  12300. virtual void changeProgramName (int index, const String& newName) = 0;
  12301. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12302. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12303. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12304. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12305. void addListener (AudioProcessorListener* const newListener) throw();
  12306. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12307. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12308. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12309. void setPlayConfigDetails (const int numIns, const int numOuts,
  12310. const double sampleRate,
  12311. const int blockSize) throw();
  12312. juce_UseDebuggingNewOperator
  12313. protected:
  12314. static void copyXmlToBinary (const XmlElement& xml,
  12315. JUCE_NAMESPACE::MemoryBlock& destData);
  12316. static XmlElement* getXmlFromBinary (const void* data,
  12317. const int sizeInBytes);
  12318. AudioPlayHead* playHead;
  12319. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12320. private:
  12321. VoidArray listeners;
  12322. AudioProcessorEditor* activeEditor;
  12323. double sampleRate;
  12324. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12325. bool suspended, nonRealtime;
  12326. CriticalSection callbackLock, listenerLock;
  12327. #ifdef JUCE_DEBUG
  12328. BigInteger changingParams;
  12329. #endif
  12330. AudioProcessor (const AudioProcessor&);
  12331. AudioProcessor& operator= (const AudioProcessor&);
  12332. };
  12333. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12334. /*** End of inlined file: juce_AudioProcessor.h ***/
  12335. /*** Start of inlined file: juce_PluginDescription.h ***/
  12336. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12337. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12338. class JUCE_API PluginDescription
  12339. {
  12340. public:
  12341. PluginDescription() throw();
  12342. PluginDescription (const PluginDescription& other) throw();
  12343. PluginDescription& operator= (const PluginDescription& other) throw();
  12344. ~PluginDescription() throw();
  12345. String name;
  12346. String pluginFormatName;
  12347. String category;
  12348. String manufacturerName;
  12349. String version;
  12350. String fileOrIdentifier;
  12351. Time lastFileModTime;
  12352. int uid;
  12353. bool isInstrument;
  12354. int numInputChannels;
  12355. int numOutputChannels;
  12356. bool isDuplicateOf (const PluginDescription& other) const;
  12357. const String createIdentifierString() const throw();
  12358. XmlElement* createXml() const;
  12359. bool loadFromXml (const XmlElement& xml);
  12360. juce_UseDebuggingNewOperator
  12361. };
  12362. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12363. /*** End of inlined file: juce_PluginDescription.h ***/
  12364. class JUCE_API AudioPluginInstance : public AudioProcessor
  12365. {
  12366. public:
  12367. virtual ~AudioPluginInstance();
  12368. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12369. juce_UseDebuggingNewOperator
  12370. protected:
  12371. AudioPluginInstance();
  12372. AudioPluginInstance (const AudioPluginInstance&);
  12373. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12374. };
  12375. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12376. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12377. class PluginDescription;
  12378. class JUCE_API AudioPluginFormat
  12379. {
  12380. public:
  12381. virtual ~AudioPluginFormat();
  12382. virtual const String getName() const = 0;
  12383. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12384. const String& fileOrIdentifier) = 0;
  12385. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12386. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12387. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12388. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12389. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12390. const bool recursive) = 0;
  12391. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12392. juce_UseDebuggingNewOperator
  12393. protected:
  12394. AudioPluginFormat() throw();
  12395. AudioPluginFormat (const AudioPluginFormat&);
  12396. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12397. };
  12398. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12399. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12400. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12401. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12402. {
  12403. public:
  12404. AudioUnitPluginFormat();
  12405. ~AudioUnitPluginFormat();
  12406. const String getName() const { return "AudioUnit"; }
  12407. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12408. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12409. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12410. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12411. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12412. bool doesPluginStillExist (const PluginDescription& desc);
  12413. const FileSearchPath getDefaultLocationsToSearch();
  12414. juce_UseDebuggingNewOperator
  12415. private:
  12416. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12417. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12418. };
  12419. #endif
  12420. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12421. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12422. #endif
  12423. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12424. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12425. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12426. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12427. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12428. // Sorry, this file is just a placeholder at the moment!...
  12429. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12430. {
  12431. public:
  12432. DirectXPluginFormat();
  12433. ~DirectXPluginFormat();
  12434. const String getName() const { return "DirectX"; }
  12435. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12436. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12437. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12438. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12439. const FileSearchPath getDefaultLocationsToSearch();
  12440. juce_UseDebuggingNewOperator
  12441. private:
  12442. DirectXPluginFormat (const DirectXPluginFormat&);
  12443. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12444. };
  12445. #endif
  12446. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12447. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12448. #endif
  12449. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12450. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12451. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12452. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12453. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12454. // Sorry, this file is just a placeholder at the moment!...
  12455. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12456. {
  12457. public:
  12458. LADSPAPluginFormat();
  12459. ~LADSPAPluginFormat();
  12460. const String getName() const { return "LADSPA"; }
  12461. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12462. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12463. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12464. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12465. const FileSearchPath getDefaultLocationsToSearch();
  12466. juce_UseDebuggingNewOperator
  12467. private:
  12468. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12469. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12470. };
  12471. #endif
  12472. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12473. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12474. #endif
  12475. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12476. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12477. #ifdef __aeffect__
  12478. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12479. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12480. class VSTMidiEventList
  12481. {
  12482. public:
  12483. VSTMidiEventList()
  12484. : numEventsUsed (0), numEventsAllocated (0)
  12485. {
  12486. }
  12487. ~VSTMidiEventList()
  12488. {
  12489. freeEvents();
  12490. }
  12491. void clear()
  12492. {
  12493. numEventsUsed = 0;
  12494. if (events != 0)
  12495. events->numEvents = 0;
  12496. }
  12497. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12498. {
  12499. ensureSize (numEventsUsed + 1);
  12500. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12501. events->numEvents = ++numEventsUsed;
  12502. if (numBytes <= 4)
  12503. {
  12504. if (e->type == kVstSysExType)
  12505. {
  12506. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12507. e->type = kVstMidiType;
  12508. e->byteSize = sizeof (VstMidiEvent);
  12509. e->noteLength = 0;
  12510. e->noteOffset = 0;
  12511. e->detune = 0;
  12512. e->noteOffVelocity = 0;
  12513. }
  12514. e->deltaFrames = frameOffset;
  12515. memcpy (e->midiData, midiData, numBytes);
  12516. }
  12517. else
  12518. {
  12519. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12520. if (se->type == kVstSysExType)
  12521. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12522. else
  12523. se->sysexDump = (char*) juce_malloc (numBytes);
  12524. memcpy (se->sysexDump, midiData, numBytes);
  12525. se->type = kVstSysExType;
  12526. se->byteSize = sizeof (VstMidiSysexEvent);
  12527. se->deltaFrames = frameOffset;
  12528. se->flags = 0;
  12529. se->dumpBytes = numBytes;
  12530. se->resvd1 = 0;
  12531. se->resvd2 = 0;
  12532. }
  12533. }
  12534. // Handy method to pull the events out of an event buffer supplied by the host
  12535. // or plugin.
  12536. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12537. {
  12538. for (int i = 0; i < events->numEvents; ++i)
  12539. {
  12540. const VstEvent* const e = events->events[i];
  12541. if (e != 0)
  12542. {
  12543. if (e->type == kVstMidiType)
  12544. {
  12545. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12546. 4, e->deltaFrames);
  12547. }
  12548. else if (e->type == kVstSysExType)
  12549. {
  12550. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12551. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12552. e->deltaFrames);
  12553. }
  12554. }
  12555. }
  12556. }
  12557. void ensureSize (int numEventsNeeded)
  12558. {
  12559. if (numEventsNeeded > numEventsAllocated)
  12560. {
  12561. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12562. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12563. if (events == 0)
  12564. events.calloc (size, 1);
  12565. else
  12566. events.realloc (size, 1);
  12567. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12568. {
  12569. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12570. (int) sizeof (VstMidiSysexEvent)));
  12571. e->type = kVstMidiType;
  12572. e->byteSize = sizeof (VstMidiEvent);
  12573. events->events[i] = (VstEvent*) e;
  12574. }
  12575. numEventsAllocated = numEventsNeeded;
  12576. }
  12577. }
  12578. void freeEvents()
  12579. {
  12580. if (events != 0)
  12581. {
  12582. for (int i = numEventsAllocated; --i >= 0;)
  12583. {
  12584. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12585. if (e->type == kVstSysExType)
  12586. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12587. juce_free (e);
  12588. }
  12589. events.free();
  12590. numEventsUsed = 0;
  12591. numEventsAllocated = 0;
  12592. }
  12593. }
  12594. HeapBlock <VstEvents> events;
  12595. private:
  12596. int numEventsUsed, numEventsAllocated;
  12597. };
  12598. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12599. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12600. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12601. #endif
  12602. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12603. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12604. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12605. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12606. #if JUCE_PLUGINHOST_VST
  12607. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12608. {
  12609. public:
  12610. VSTPluginFormat();
  12611. ~VSTPluginFormat();
  12612. const String getName() const { return "VST"; }
  12613. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12614. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12615. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12616. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12617. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12618. bool doesPluginStillExist (const PluginDescription& desc);
  12619. const FileSearchPath getDefaultLocationsToSearch();
  12620. juce_UseDebuggingNewOperator
  12621. private:
  12622. VSTPluginFormat (const VSTPluginFormat&);
  12623. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12624. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12625. };
  12626. #endif
  12627. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12628. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12629. #endif
  12630. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12631. #endif
  12632. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12633. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12634. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12635. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12636. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12637. {
  12638. public:
  12639. AudioPluginFormatManager() throw();
  12640. ~AudioPluginFormatManager() throw();
  12641. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12642. void addDefaultFormats();
  12643. int getNumFormats() throw();
  12644. AudioPluginFormat* getFormat (const int index) throw();
  12645. void addFormat (AudioPluginFormat* const format) throw();
  12646. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12647. String& errorMessage) const;
  12648. bool doesPluginStillExist (const PluginDescription& description) const;
  12649. juce_UseDebuggingNewOperator
  12650. private:
  12651. OwnedArray <AudioPluginFormat> formats;
  12652. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12653. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12654. };
  12655. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12656. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12657. #endif
  12658. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12659. #endif
  12660. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12661. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12662. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12663. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12664. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12665. {
  12666. public:
  12667. KnownPluginList();
  12668. ~KnownPluginList();
  12669. void clear();
  12670. int getNumTypes() const throw() { return types.size(); }
  12671. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12672. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12673. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12674. bool addType (const PluginDescription& type);
  12675. void removeType (const int index) throw();
  12676. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12677. const bool dontRescanIfAlreadyInList,
  12678. OwnedArray <PluginDescription>& typesFound,
  12679. AudioPluginFormat& formatToUse);
  12680. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12681. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12682. OwnedArray <PluginDescription>& typesFound);
  12683. enum SortMethod
  12684. {
  12685. defaultOrder = 0,
  12686. sortAlphabetically,
  12687. sortByCategory,
  12688. sortByManufacturer,
  12689. sortByFileSystemLocation
  12690. };
  12691. void addToMenu (PopupMenu& menu,
  12692. const SortMethod sortMethod) const;
  12693. int getIndexChosenByMenu (const int menuResultCode) const;
  12694. void sort (const SortMethod method);
  12695. XmlElement* createXml() const;
  12696. void recreateFromXml (const XmlElement& xml);
  12697. juce_UseDebuggingNewOperator
  12698. private:
  12699. OwnedArray <PluginDescription> types;
  12700. KnownPluginList (const KnownPluginList&);
  12701. KnownPluginList& operator= (const KnownPluginList&);
  12702. };
  12703. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12704. /*** End of inlined file: juce_KnownPluginList.h ***/
  12705. #endif
  12706. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12707. #endif
  12708. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12709. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12710. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12711. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12712. class JUCE_API PluginDirectoryScanner
  12713. {
  12714. public:
  12715. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12716. AudioPluginFormat& formatToLookFor,
  12717. FileSearchPath directoriesToSearch,
  12718. const bool searchRecursively,
  12719. const File& deadMansPedalFile);
  12720. ~PluginDirectoryScanner();
  12721. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12722. const String getNextPluginFileThatWillBeScanned() const throw();
  12723. float getProgress() const { return progress; }
  12724. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12725. juce_UseDebuggingNewOperator
  12726. private:
  12727. KnownPluginList& list;
  12728. AudioPluginFormat& format;
  12729. StringArray filesOrIdentifiersToScan;
  12730. File deadMansPedalFile;
  12731. StringArray failedFiles;
  12732. int nextIndex;
  12733. float progress;
  12734. const StringArray getDeadMansPedalFile() throw();
  12735. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12736. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12737. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12738. };
  12739. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12740. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12741. #endif
  12742. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12743. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12744. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12745. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12746. /*** Start of inlined file: juce_ListBox.h ***/
  12747. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12748. #define __JUCE_LISTBOX_JUCEHEADER__
  12749. class ListViewport;
  12750. class JUCE_API ListBoxModel
  12751. {
  12752. public:
  12753. virtual ~ListBoxModel() {}
  12754. virtual int getNumRows() = 0;
  12755. virtual void paintListBoxItem (int rowNumber,
  12756. Graphics& g,
  12757. int width, int height,
  12758. bool rowIsSelected) = 0;
  12759. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12760. Component* existingComponentToUpdate);
  12761. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12762. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12763. virtual void backgroundClicked();
  12764. virtual void selectedRowsChanged (int lastRowSelected);
  12765. virtual void deleteKeyPressed (int lastRowSelected);
  12766. virtual void returnKeyPressed (int lastRowSelected);
  12767. virtual void listWasScrolled();
  12768. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12769. virtual const String getTooltipForRow (int row);
  12770. };
  12771. class JUCE_API ListBox : public Component,
  12772. public SettableTooltipClient
  12773. {
  12774. public:
  12775. ListBox (const String& componentName,
  12776. ListBoxModel* const model);
  12777. ~ListBox();
  12778. void setModel (ListBoxModel* const newModel);
  12779. ListBoxModel* getModel() const throw() { return model; }
  12780. void updateContent();
  12781. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12782. void setMouseMoveSelectsRows (bool shouldSelect);
  12783. void selectRow (const int rowNumber,
  12784. bool dontScrollToShowThisRow = false,
  12785. bool deselectOthersFirst = true);
  12786. void selectRangeOfRows (int firstRow,
  12787. int lastRow);
  12788. void deselectRow (const int rowNumber);
  12789. void deselectAllRows();
  12790. void flipRowSelection (const int rowNumber);
  12791. const SparseSet<int> getSelectedRows() const;
  12792. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12793. const bool sendNotificationEventToModel = true);
  12794. bool isRowSelected (const int rowNumber) const;
  12795. int getNumSelectedRows() const;
  12796. int getSelectedRow (const int index = 0) const;
  12797. int getLastRowSelected() const;
  12798. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12799. const ModifierKeys& modifiers);
  12800. void setVerticalPosition (const double newProportion);
  12801. double getVerticalPosition() const;
  12802. void scrollToEnsureRowIsOnscreen (const int row);
  12803. ScrollBar* getVerticalScrollBar() const throw();
  12804. ScrollBar* getHorizontalScrollBar() const throw();
  12805. int getRowContainingPosition (const int x, const int y) const throw();
  12806. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12807. const Rectangle<int> getRowPosition (const int rowNumber,
  12808. const bool relativeToComponentTopLeft) const throw();
  12809. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12810. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12811. int getVisibleRowWidth() const throw();
  12812. void setRowHeight (const int newHeight);
  12813. int getRowHeight() const throw() { return rowHeight; }
  12814. int getNumRowsOnScreen() const throw();
  12815. enum ColourIds
  12816. {
  12817. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12818. Make this transparent if you don't want the background to be filled. */
  12819. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12820. Make this transparent to not have an outline. */
  12821. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12822. };
  12823. void setOutlineThickness (const int outlineThickness);
  12824. int getOutlineThickness() const throw() { return outlineThickness; }
  12825. void setHeaderComponent (Component* const newHeaderComponent);
  12826. void setMinimumContentWidth (const int newMinimumWidth);
  12827. int getVisibleContentWidth() const throw();
  12828. void repaintRow (const int rowNumber) throw();
  12829. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12830. Viewport* getViewport() const throw();
  12831. bool keyPressed (const KeyPress& key);
  12832. bool keyStateChanged (const bool isKeyDown);
  12833. void paint (Graphics& g);
  12834. void paintOverChildren (Graphics& g);
  12835. void resized();
  12836. void visibilityChanged();
  12837. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12838. void mouseMove (const MouseEvent&);
  12839. void mouseExit (const MouseEvent&);
  12840. void mouseUp (const MouseEvent&);
  12841. void colourChanged();
  12842. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12843. juce_UseDebuggingNewOperator
  12844. private:
  12845. friend class ListViewport;
  12846. friend class TableListBox;
  12847. ListBoxModel* model;
  12848. ListViewport* viewport;
  12849. Component* headerComponent;
  12850. int totalItems, rowHeight, minimumRowWidth;
  12851. int outlineThickness;
  12852. int lastRowSelected;
  12853. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12854. SparseSet <int> selected;
  12855. void selectRowInternal (const int rowNumber,
  12856. bool dontScrollToShowThisRow,
  12857. bool deselectOthersFirst,
  12858. bool isMouseClick);
  12859. ListBox (const ListBox&);
  12860. ListBox& operator= (const ListBox&);
  12861. };
  12862. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12863. /*** End of inlined file: juce_ListBox.h ***/
  12864. /*** Start of inlined file: juce_TextButton.h ***/
  12865. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12866. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12867. class JUCE_API TextButton : public Button
  12868. {
  12869. public:
  12870. TextButton (const String& buttonName,
  12871. const String& toolTip = String::empty);
  12872. ~TextButton();
  12873. enum ColourIds
  12874. {
  12875. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12876. 'off'). The look-and-feel class might re-interpret this to add
  12877. effects, etc. */
  12878. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12879. 'on'). The look-and-feel class might re-interpret this to add
  12880. effects, etc. */
  12881. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12882. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12883. };
  12884. void changeWidthToFitText (const int newHeight = -1);
  12885. virtual const Font getFont();
  12886. juce_UseDebuggingNewOperator
  12887. protected:
  12888. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12889. void colourChanged();
  12890. private:
  12891. TextButton (const TextButton&);
  12892. TextButton& operator= (const TextButton&);
  12893. };
  12894. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12895. /*** End of inlined file: juce_TextButton.h ***/
  12896. class JUCE_API PluginListComponent : public Component,
  12897. public ListBoxModel,
  12898. public ChangeListener,
  12899. public ButtonListener,
  12900. public Timer
  12901. {
  12902. public:
  12903. PluginListComponent (KnownPluginList& listToRepresent,
  12904. const File& deadMansPedalFile,
  12905. PropertiesFile* const propertiesToUse);
  12906. ~PluginListComponent();
  12907. void resized();
  12908. bool isInterestedInFileDrag (const StringArray& files);
  12909. void filesDropped (const StringArray& files, int, int);
  12910. int getNumRows();
  12911. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12912. void deleteKeyPressed (int lastRowSelected);
  12913. void buttonClicked (Button* b);
  12914. void changeListenerCallback (void*);
  12915. void timerCallback();
  12916. juce_UseDebuggingNewOperator
  12917. private:
  12918. KnownPluginList& list;
  12919. File deadMansPedalFile;
  12920. ListBox* listBox;
  12921. TextButton* optionsButton;
  12922. PropertiesFile* propertiesToUse;
  12923. int typeToScan;
  12924. void scanFor (AudioPluginFormat* format);
  12925. PluginListComponent (const PluginListComponent&);
  12926. PluginListComponent& operator= (const PluginListComponent&);
  12927. };
  12928. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12929. /*** End of inlined file: juce_PluginListComponent.h ***/
  12930. #endif
  12931. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12932. #endif
  12933. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12934. #endif
  12935. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12936. #endif
  12937. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12938. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12939. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12940. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12941. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12942. public AsyncUpdater
  12943. {
  12944. public:
  12945. AudioProcessorGraph();
  12946. ~AudioProcessorGraph();
  12947. class JUCE_API Node : public ReferenceCountedObject
  12948. {
  12949. public:
  12950. ~Node();
  12951. const uint32 id;
  12952. AudioProcessor* const processor;
  12953. NamedValueSet properties;
  12954. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12955. juce_UseDebuggingNewOperator
  12956. private:
  12957. friend class AudioProcessorGraph;
  12958. bool isPrepared;
  12959. Node (const uint32 id, AudioProcessor* const processor);
  12960. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12961. void unprepare();
  12962. Node (const Node&);
  12963. Node& operator= (const Node&);
  12964. };
  12965. struct JUCE_API Connection
  12966. {
  12967. public:
  12968. uint32 sourceNodeId;
  12969. int sourceChannelIndex;
  12970. uint32 destNodeId;
  12971. int destChannelIndex;
  12972. juce_UseDebuggingNewOperator
  12973. private:
  12974. };
  12975. void clear();
  12976. int getNumNodes() const { return nodes.size(); }
  12977. Node* getNode (const int index) const { return nodes [index]; }
  12978. Node* getNodeForId (const uint32 nodeId) const;
  12979. Node* addNode (AudioProcessor* const newProcessor,
  12980. uint32 nodeId = 0);
  12981. bool removeNode (const uint32 nodeId);
  12982. int getNumConnections() const { return connections.size(); }
  12983. const Connection* getConnection (const int index) const { return connections [index]; }
  12984. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12985. const int sourceChannelIndex,
  12986. const uint32 destNodeId,
  12987. const int destChannelIndex) const;
  12988. bool isConnected (const uint32 possibleSourceNodeId,
  12989. const uint32 possibleDestNodeId) const;
  12990. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12991. const uint32 destNodeId, const int destChannelIndex) const;
  12992. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12993. const uint32 destNodeId, const int destChannelIndex);
  12994. void removeConnection (const int index);
  12995. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12996. const uint32 destNodeId, const int destChannelIndex);
  12997. bool disconnectNode (const uint32 nodeId);
  12998. bool removeIllegalConnections();
  12999. static const int midiChannelIndex;
  13000. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13001. {
  13002. public:
  13003. enum IODeviceType
  13004. {
  13005. audioInputNode, /**< In this mode, the processor has output channels
  13006. representing all the audio input channels that are
  13007. coming into its parent audio graph. */
  13008. audioOutputNode, /**< In this mode, the processor has input channels
  13009. representing all the audio output channels that are
  13010. going out of its parent audio graph. */
  13011. midiInputNode, /**< In this mode, the processor has a midi output which
  13012. delivers the same midi data that is arriving at its
  13013. parent graph. */
  13014. midiOutputNode /**< In this mode, the processor has a midi input and
  13015. any data sent to it will be passed out of the parent
  13016. graph. */
  13017. };
  13018. IODeviceType getType() const { return type; }
  13019. AudioProcessorGraph* getParentGraph() const { return graph; }
  13020. bool isInput() const;
  13021. bool isOutput() const;
  13022. AudioGraphIOProcessor (const IODeviceType type);
  13023. ~AudioGraphIOProcessor();
  13024. const String getName() const;
  13025. void fillInPluginDescription (PluginDescription& d) const;
  13026. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13027. void releaseResources();
  13028. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13029. const String getInputChannelName (const int channelIndex) const;
  13030. const String getOutputChannelName (const int channelIndex) const;
  13031. bool isInputChannelStereoPair (int index) const;
  13032. bool isOutputChannelStereoPair (int index) const;
  13033. bool acceptsMidi() const;
  13034. bool producesMidi() const;
  13035. AudioProcessorEditor* createEditor();
  13036. int getNumParameters();
  13037. const String getParameterName (int);
  13038. float getParameter (int);
  13039. const String getParameterText (int);
  13040. void setParameter (int, float);
  13041. int getNumPrograms();
  13042. int getCurrentProgram();
  13043. void setCurrentProgram (int);
  13044. const String getProgramName (int);
  13045. void changeProgramName (int, const String&);
  13046. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13047. void setStateInformation (const void* data, int sizeInBytes);
  13048. void setParentGraph (AudioProcessorGraph* const graph);
  13049. juce_UseDebuggingNewOperator
  13050. private:
  13051. const IODeviceType type;
  13052. AudioProcessorGraph* graph;
  13053. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13054. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13055. };
  13056. // AudioProcessor methods:
  13057. const String getName() const;
  13058. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13059. void releaseResources();
  13060. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13061. const String getInputChannelName (const int channelIndex) const;
  13062. const String getOutputChannelName (const int channelIndex) const;
  13063. bool isInputChannelStereoPair (int index) const;
  13064. bool isOutputChannelStereoPair (int index) const;
  13065. bool acceptsMidi() const;
  13066. bool producesMidi() const;
  13067. AudioProcessorEditor* createEditor() { return 0; }
  13068. int getNumParameters() { return 0; }
  13069. const String getParameterName (int) { return String::empty; }
  13070. float getParameter (int) { return 0; }
  13071. const String getParameterText (int) { return String::empty; }
  13072. void setParameter (int, float) { }
  13073. int getNumPrograms() { return 0; }
  13074. int getCurrentProgram() { return 0; }
  13075. void setCurrentProgram (int) { }
  13076. const String getProgramName (int) { return String::empty; }
  13077. void changeProgramName (int, const String&) { }
  13078. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13079. void setStateInformation (const void* data, int sizeInBytes);
  13080. void handleAsyncUpdate();
  13081. juce_UseDebuggingNewOperator
  13082. private:
  13083. ReferenceCountedArray <Node> nodes;
  13084. OwnedArray <Connection> connections;
  13085. int lastNodeId;
  13086. AudioSampleBuffer renderingBuffers;
  13087. OwnedArray <MidiBuffer> midiBuffers;
  13088. CriticalSection renderLock;
  13089. VoidArray renderingOps;
  13090. friend class AudioGraphIOProcessor;
  13091. AudioSampleBuffer* currentAudioInputBuffer;
  13092. AudioSampleBuffer currentAudioOutputBuffer;
  13093. MidiBuffer* currentMidiInputBuffer;
  13094. MidiBuffer currentMidiOutputBuffer;
  13095. void clearRenderingSequence();
  13096. void buildRenderingSequence();
  13097. bool isAnInputTo (const uint32 possibleInputId,
  13098. const uint32 possibleDestinationId,
  13099. const int recursionCheck) const;
  13100. AudioProcessorGraph (const AudioProcessorGraph&);
  13101. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13102. };
  13103. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13104. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13105. #endif
  13106. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13107. #endif
  13108. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13109. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13110. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13111. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13112. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13113. public MidiInputCallback
  13114. {
  13115. public:
  13116. AudioProcessorPlayer();
  13117. virtual ~AudioProcessorPlayer();
  13118. void setProcessor (AudioProcessor* const processorToPlay);
  13119. AudioProcessor* getCurrentProcessor() const { return processor; }
  13120. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13121. void audioDeviceIOCallback (const float** inputChannelData,
  13122. int totalNumInputChannels,
  13123. float** outputChannelData,
  13124. int totalNumOutputChannels,
  13125. int numSamples);
  13126. void audioDeviceAboutToStart (AudioIODevice* device);
  13127. void audioDeviceStopped();
  13128. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13129. juce_UseDebuggingNewOperator
  13130. private:
  13131. AudioProcessor* processor;
  13132. CriticalSection lock;
  13133. double sampleRate;
  13134. int blockSize;
  13135. bool isPrepared;
  13136. int numInputChans, numOutputChans;
  13137. float* channels [128];
  13138. AudioSampleBuffer tempBuffer;
  13139. MidiBuffer incomingMidi;
  13140. MidiMessageCollector messageCollector;
  13141. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13142. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13143. };
  13144. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13145. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13146. #endif
  13147. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13148. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13149. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13150. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13151. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13152. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13153. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13154. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13155. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13156. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13157. class EditableProperty;
  13158. class JUCE_API PropertyComponent : public Component,
  13159. public SettableTooltipClient
  13160. {
  13161. public:
  13162. PropertyComponent (const String& propertyName,
  13163. const int preferredHeight = 25);
  13164. ~PropertyComponent();
  13165. int getPreferredHeight() const throw() { return preferredHeight; }
  13166. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13167. virtual void refresh() = 0;
  13168. void paint (Graphics& g);
  13169. void resized();
  13170. void enablementChanged();
  13171. juce_UseDebuggingNewOperator
  13172. protected:
  13173. int preferredHeight;
  13174. };
  13175. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13176. /*** End of inlined file: juce_PropertyComponent.h ***/
  13177. class JUCE_API PropertyPanel : public Component
  13178. {
  13179. public:
  13180. PropertyPanel();
  13181. ~PropertyPanel();
  13182. void clear();
  13183. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13184. void addSection (const String& sectionTitle,
  13185. const Array <PropertyComponent*>& newPropertyComponents,
  13186. const bool shouldSectionInitiallyBeOpen = true);
  13187. void refreshAll() const;
  13188. const StringArray getSectionNames() const;
  13189. bool isSectionOpen (const int sectionIndex) const;
  13190. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  13191. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  13192. XmlElement* getOpennessState() const;
  13193. void restoreOpennessState (const XmlElement& newState);
  13194. void setMessageWhenEmpty (const String& newMessage);
  13195. const String& getMessageWhenEmpty() const;
  13196. void paint (Graphics& g);
  13197. void resized();
  13198. juce_UseDebuggingNewOperator
  13199. private:
  13200. Viewport* viewport;
  13201. Component* propertyHolderComponent;
  13202. String messageWhenEmpty;
  13203. void updatePropHolderLayout() const;
  13204. void updatePropHolderLayout (const int width) const;
  13205. };
  13206. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13207. /*** End of inlined file: juce_PropertyPanel.h ***/
  13208. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13209. {
  13210. public:
  13211. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13212. ~GenericAudioProcessorEditor();
  13213. void paint (Graphics& g);
  13214. void resized();
  13215. juce_UseDebuggingNewOperator
  13216. private:
  13217. PropertyPanel* panel;
  13218. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13219. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13220. };
  13221. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13222. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13223. #endif
  13224. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13225. /*** Start of inlined file: juce_Sampler.h ***/
  13226. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13227. #define __JUCE_SAMPLER_JUCEHEADER__
  13228. /*** Start of inlined file: juce_Synthesiser.h ***/
  13229. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13230. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13231. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13232. {
  13233. protected:
  13234. SynthesiserSound();
  13235. public:
  13236. virtual ~SynthesiserSound();
  13237. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13238. virtual bool appliesToChannel (const int midiChannel) = 0;
  13239. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13240. juce_UseDebuggingNewOperator
  13241. };
  13242. class JUCE_API SynthesiserVoice
  13243. {
  13244. public:
  13245. SynthesiserVoice();
  13246. virtual ~SynthesiserVoice();
  13247. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13248. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13249. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13250. virtual void startNote (const int midiNoteNumber,
  13251. const float velocity,
  13252. SynthesiserSound* sound,
  13253. const int currentPitchWheelPosition) = 0;
  13254. virtual void stopNote (const bool allowTailOff) = 0;
  13255. virtual void pitchWheelMoved (const int newValue) = 0;
  13256. virtual void controllerMoved (const int controllerNumber,
  13257. const int newValue) = 0;
  13258. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13259. int startSample,
  13260. int numSamples) = 0;
  13261. bool isPlayingChannel (const int midiChannel) const;
  13262. void setCurrentPlaybackSampleRate (const double newRate);
  13263. juce_UseDebuggingNewOperator
  13264. protected:
  13265. double getSampleRate() const { return currentSampleRate; }
  13266. void clearCurrentNote();
  13267. private:
  13268. friend class Synthesiser;
  13269. double currentSampleRate;
  13270. int currentlyPlayingNote;
  13271. uint32 noteOnTime;
  13272. SynthesiserSound::Ptr currentlyPlayingSound;
  13273. };
  13274. class JUCE_API Synthesiser
  13275. {
  13276. public:
  13277. Synthesiser();
  13278. virtual ~Synthesiser();
  13279. void clearVoices();
  13280. int getNumVoices() const { return voices.size(); }
  13281. SynthesiserVoice* getVoice (const int index) const;
  13282. void addVoice (SynthesiserVoice* const newVoice);
  13283. void removeVoice (const int index);
  13284. void clearSounds();
  13285. int getNumSounds() const { return sounds.size(); }
  13286. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13287. void addSound (const SynthesiserSound::Ptr& newSound);
  13288. void removeSound (const int index);
  13289. void setNoteStealingEnabled (const bool shouldStealNotes);
  13290. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13291. virtual void noteOn (const int midiChannel,
  13292. const int midiNoteNumber,
  13293. const float velocity);
  13294. virtual void noteOff (const int midiChannel,
  13295. const int midiNoteNumber,
  13296. const bool allowTailOff);
  13297. virtual void allNotesOff (const int midiChannel,
  13298. const bool allowTailOff);
  13299. virtual void handlePitchWheel (const int midiChannel,
  13300. const int wheelValue);
  13301. virtual void handleController (const int midiChannel,
  13302. const int controllerNumber,
  13303. const int controllerValue);
  13304. void setCurrentPlaybackSampleRate (const double sampleRate);
  13305. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13306. const MidiBuffer& inputMidi,
  13307. int startSample,
  13308. int numSamples);
  13309. juce_UseDebuggingNewOperator
  13310. protected:
  13311. CriticalSection lock;
  13312. OwnedArray <SynthesiserVoice> voices;
  13313. ReferenceCountedArray <SynthesiserSound> sounds;
  13314. int lastPitchWheelValues [16];
  13315. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13316. const bool stealIfNoneAvailable) const;
  13317. void startVoice (SynthesiserVoice* const voice,
  13318. SynthesiserSound* const sound,
  13319. const int midiChannel,
  13320. const int midiNoteNumber,
  13321. const float velocity);
  13322. int findFreeVoice (const bool) const { return 0; }
  13323. private:
  13324. double sampleRate;
  13325. uint32 lastNoteOnCounter;
  13326. bool shouldStealNotes;
  13327. Synthesiser (const Synthesiser&);
  13328. Synthesiser& operator= (const Synthesiser&);
  13329. };
  13330. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13331. /*** End of inlined file: juce_Synthesiser.h ***/
  13332. class JUCE_API SamplerSound : public SynthesiserSound
  13333. {
  13334. public:
  13335. SamplerSound (const String& name,
  13336. AudioFormatReader& source,
  13337. const BigInteger& midiNotes,
  13338. const int midiNoteForNormalPitch,
  13339. const double attackTimeSecs,
  13340. const double releaseTimeSecs,
  13341. const double maxSampleLengthSeconds);
  13342. ~SamplerSound();
  13343. const String& getName() const { return name; }
  13344. AudioSampleBuffer* getAudioData() const { return data; }
  13345. bool appliesToNote (const int midiNoteNumber);
  13346. bool appliesToChannel (const int midiChannel);
  13347. juce_UseDebuggingNewOperator
  13348. private:
  13349. friend class SamplerVoice;
  13350. String name;
  13351. ScopedPointer <AudioSampleBuffer> data;
  13352. double sourceSampleRate;
  13353. BigInteger midiNotes;
  13354. int length, attackSamples, releaseSamples;
  13355. int midiRootNote;
  13356. };
  13357. class JUCE_API SamplerVoice : public SynthesiserVoice
  13358. {
  13359. public:
  13360. SamplerVoice();
  13361. ~SamplerVoice();
  13362. bool canPlaySound (SynthesiserSound* sound);
  13363. void startNote (const int midiNoteNumber,
  13364. const float velocity,
  13365. SynthesiserSound* sound,
  13366. const int currentPitchWheelPosition);
  13367. void stopNote (const bool allowTailOff);
  13368. void pitchWheelMoved (const int newValue);
  13369. void controllerMoved (const int controllerNumber,
  13370. const int newValue);
  13371. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13372. juce_UseDebuggingNewOperator
  13373. private:
  13374. double pitchRatio;
  13375. double sourceSamplePosition;
  13376. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13377. bool isInAttack, isInRelease;
  13378. };
  13379. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13380. /*** End of inlined file: juce_Sampler.h ***/
  13381. #endif
  13382. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13383. #endif
  13384. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13385. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13386. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13387. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13388. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13389. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13390. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13391. class JUCE_API ActionListenerList : public MessageListener
  13392. {
  13393. public:
  13394. ActionListenerList() throw();
  13395. ~ActionListenerList() throw();
  13396. void addActionListener (ActionListener* const listener) throw();
  13397. void removeActionListener (ActionListener* const listener) throw();
  13398. void removeAllActionListeners() throw();
  13399. void sendActionMessage (const String& message) const;
  13400. void handleMessage (const Message&);
  13401. juce_UseDebuggingNewOperator
  13402. private:
  13403. SortedSet <void*> actionListeners_;
  13404. CriticalSection actionListenerLock_;
  13405. ActionListenerList (const ActionListenerList&);
  13406. ActionListenerList& operator= (const ActionListenerList&);
  13407. };
  13408. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13409. /*** End of inlined file: juce_ActionListenerList.h ***/
  13410. class JUCE_API ActionBroadcaster
  13411. {
  13412. public:
  13413. ActionBroadcaster() throw();
  13414. virtual ~ActionBroadcaster();
  13415. void addActionListener (ActionListener* const listener);
  13416. void removeActionListener (ActionListener* const listener);
  13417. void removeAllActionListeners();
  13418. void sendActionMessage (const String& message) const;
  13419. private:
  13420. ActionListenerList actionListenerList;
  13421. ActionBroadcaster (const ActionBroadcaster&);
  13422. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13423. };
  13424. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13425. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13426. #endif
  13427. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13428. #endif
  13429. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13430. #endif
  13431. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13432. #endif
  13433. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13434. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13435. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13436. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13437. class JUCE_API CallbackMessage : public Message
  13438. {
  13439. public:
  13440. CallbackMessage() throw();
  13441. ~CallbackMessage() throw();
  13442. virtual void messageCallback() = 0;
  13443. void post();
  13444. juce_UseDebuggingNewOperator
  13445. private:
  13446. CallbackMessage (const CallbackMessage&);
  13447. CallbackMessage& operator= (const CallbackMessage&);
  13448. };
  13449. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13450. /*** End of inlined file: juce_CallbackMessage.h ***/
  13451. #endif
  13452. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13453. #endif
  13454. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13455. #endif
  13456. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13457. #endif
  13458. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13459. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13460. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13461. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13462. class InterprocessConnectionServer;
  13463. class JUCE_API InterprocessConnection : public Thread,
  13464. private MessageListener
  13465. {
  13466. public:
  13467. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13468. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13469. ~InterprocessConnection();
  13470. bool connectToSocket (const String& hostName,
  13471. const int portNumber,
  13472. const int timeOutMillisecs);
  13473. bool connectToPipe (const String& pipeName,
  13474. const int pipeReceiveMessageTimeoutMs = -1);
  13475. bool createPipe (const String& pipeName,
  13476. const int pipeReceiveMessageTimeoutMs = -1);
  13477. void disconnect();
  13478. bool isConnected() const;
  13479. StreamingSocket* getSocket() const throw() { return socket; }
  13480. NamedPipe* getPipe() const throw() { return pipe; }
  13481. const String getConnectedHostName() const;
  13482. bool sendMessage (const MemoryBlock& message);
  13483. virtual void connectionMade() = 0;
  13484. virtual void connectionLost() = 0;
  13485. virtual void messageReceived (const MemoryBlock& message) = 0;
  13486. juce_UseDebuggingNewOperator
  13487. private:
  13488. CriticalSection pipeAndSocketLock;
  13489. ScopedPointer <StreamingSocket> socket;
  13490. ScopedPointer <NamedPipe> pipe;
  13491. bool callbackConnectionState;
  13492. const bool useMessageThread;
  13493. const uint32 magicMessageHeader;
  13494. int pipeReceiveMessageTimeout;
  13495. friend class InterprocessConnectionServer;
  13496. void initialiseWithSocket (StreamingSocket* const socket_);
  13497. void initialiseWithPipe (NamedPipe* const pipe_);
  13498. void handleMessage (const Message& message);
  13499. void connectionMadeInt();
  13500. void connectionLostInt();
  13501. void deliverDataInt (const MemoryBlock& data);
  13502. bool readNextMessageInt();
  13503. void run();
  13504. InterprocessConnection (const InterprocessConnection&);
  13505. InterprocessConnection& operator= (const InterprocessConnection&);
  13506. };
  13507. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13508. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13509. #endif
  13510. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13511. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13512. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13513. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13514. class JUCE_API InterprocessConnectionServer : private Thread
  13515. {
  13516. public:
  13517. InterprocessConnectionServer();
  13518. ~InterprocessConnectionServer();
  13519. bool beginWaitingForSocket (const int portNumber);
  13520. void stop();
  13521. protected:
  13522. virtual InterprocessConnection* createConnectionObject() = 0;
  13523. public:
  13524. juce_UseDebuggingNewOperator
  13525. private:
  13526. ScopedPointer <StreamingSocket> socket;
  13527. void run();
  13528. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13529. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13530. };
  13531. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13532. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13533. #endif
  13534. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13535. #endif
  13536. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13537. #endif
  13538. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13539. #endif
  13540. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13541. /*** Start of inlined file: juce_MessageManager.h ***/
  13542. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13543. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13544. class Component;
  13545. class MessageManagerLock;
  13546. typedef void* (MessageCallbackFunction) (void* userData);
  13547. class JUCE_API MessageManager
  13548. {
  13549. public:
  13550. static MessageManager* getInstance() throw();
  13551. void runDispatchLoop();
  13552. void stopDispatchLoop();
  13553. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13554. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13555. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13556. void* userData);
  13557. bool isThisTheMessageThread() const throw();
  13558. void setCurrentThreadAsMessageThread();
  13559. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13560. bool currentThreadHasLockedMessageManager() const throw();
  13561. static void broadcastMessage (const String& messageText) throw();
  13562. void registerBroadcastListener (ActionListener* listener) throw();
  13563. void deregisterBroadcastListener (ActionListener* listener) throw();
  13564. void deliverMessage (void*);
  13565. void deliverBroadcastMessage (const String&);
  13566. ~MessageManager() throw();
  13567. juce_UseDebuggingNewOperator
  13568. private:
  13569. MessageManager() throw();
  13570. friend class MessageListener;
  13571. friend class ChangeBroadcaster;
  13572. friend class ActionBroadcaster;
  13573. friend class CallbackMessage;
  13574. static MessageManager* instance;
  13575. SortedSet <const MessageListener*> messageListeners;
  13576. ScopedPointer <ActionListenerList> broadcastListeners;
  13577. friend class JUCEApplication;
  13578. bool quitMessagePosted, quitMessageReceived;
  13579. Thread::ThreadID messageThreadId;
  13580. VoidArray modalComponents;
  13581. static void* exitModalLoopCallback (void*);
  13582. void postMessageToQueue (Message* const message);
  13583. void postCallbackMessage (Message* const message);
  13584. static void doPlatformSpecificInitialisation();
  13585. static void doPlatformSpecificShutdown();
  13586. friend class MessageManagerLock;
  13587. Thread::ThreadID volatile threadWithLock;
  13588. CriticalSection lockingLock;
  13589. MessageManager (const MessageManager&);
  13590. MessageManager& operator= (const MessageManager&);
  13591. };
  13592. class JUCE_API MessageManagerLock
  13593. {
  13594. public:
  13595. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13596. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13597. ~MessageManagerLock() throw();
  13598. bool lockWasGained() const throw() { return locked; }
  13599. private:
  13600. class SharedEvents;
  13601. class BlockingMessage;
  13602. friend class SharedEvents;
  13603. friend class BlockingMessage;
  13604. SharedEvents* sharedEvents;
  13605. bool locked;
  13606. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13607. MessageManagerLock (const MessageManagerLock&);
  13608. MessageManagerLock& operator= (const MessageManagerLock&);
  13609. };
  13610. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13611. /*** End of inlined file: juce_MessageManager.h ***/
  13612. #endif
  13613. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13614. /*** Start of inlined file: juce_MultiTimer.h ***/
  13615. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13616. #define __JUCE_MULTITIMER_JUCEHEADER__
  13617. class JUCE_API MultiTimer
  13618. {
  13619. protected:
  13620. MultiTimer() throw();
  13621. MultiTimer (const MultiTimer& other) throw();
  13622. public:
  13623. virtual ~MultiTimer();
  13624. virtual void timerCallback (const int timerId) = 0;
  13625. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13626. void stopTimer (const int timerId) throw();
  13627. bool isTimerRunning (const int timerId) const throw();
  13628. int getTimerInterval (const int timerId) const throw();
  13629. private:
  13630. class MultiTimerCallback;
  13631. CriticalSection timerListLock;
  13632. OwnedArray <MultiTimerCallback> timers;
  13633. MultiTimer& operator= (const MultiTimer&);
  13634. };
  13635. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13636. /*** End of inlined file: juce_MultiTimer.h ***/
  13637. #endif
  13638. #ifndef __JUCE_TIMER_JUCEHEADER__
  13639. #endif
  13640. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13641. /*** Start of inlined file: juce_ArrowButton.h ***/
  13642. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13643. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13644. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13645. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13646. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13647. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13648. {
  13649. public:
  13650. DropShadowEffect();
  13651. ~DropShadowEffect();
  13652. void setShadowProperties (const float newRadius,
  13653. const float newOpacity,
  13654. const int newShadowOffsetX,
  13655. const int newShadowOffsetY);
  13656. void applyEffect (Image& sourceImage, Graphics& destContext);
  13657. juce_UseDebuggingNewOperator
  13658. private:
  13659. int offsetX, offsetY;
  13660. float radius, opacity;
  13661. };
  13662. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13663. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13664. class JUCE_API ArrowButton : public Button
  13665. {
  13666. public:
  13667. ArrowButton (const String& buttonName,
  13668. float arrowDirection,
  13669. const Colour& arrowColour);
  13670. ~ArrowButton();
  13671. juce_UseDebuggingNewOperator
  13672. protected:
  13673. void paintButton (Graphics& g,
  13674. bool isMouseOverButton,
  13675. bool isButtonDown);
  13676. void buttonStateChanged();
  13677. private:
  13678. Colour colour;
  13679. DropShadowEffect shadow;
  13680. Path path;
  13681. int offset;
  13682. ArrowButton (const ArrowButton&);
  13683. ArrowButton& operator= (const ArrowButton&);
  13684. };
  13685. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13686. /*** End of inlined file: juce_ArrowButton.h ***/
  13687. #endif
  13688. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13689. #endif
  13690. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13691. /*** Start of inlined file: juce_DrawableButton.h ***/
  13692. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13693. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13694. /*** Start of inlined file: juce_Drawable.h ***/
  13695. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13696. #define __JUCE_DRAWABLE_JUCEHEADER__
  13697. class JUCE_API Drawable
  13698. {
  13699. protected:
  13700. Drawable();
  13701. public:
  13702. virtual ~Drawable();
  13703. virtual Drawable* createCopy() const = 0;
  13704. void draw (Graphics& g, const float opacity,
  13705. const AffineTransform& transform = AffineTransform::identity) const;
  13706. void drawAt (Graphics& g,
  13707. const float x,
  13708. const float y,
  13709. const float opacity) const;
  13710. void drawWithin (Graphics& g,
  13711. const int destX,
  13712. const int destY,
  13713. const int destWidth,
  13714. const int destHeight,
  13715. const RectanglePlacement& placement,
  13716. const float opacity) const;
  13717. class RenderingContext
  13718. {
  13719. public:
  13720. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13721. Graphics& g;
  13722. AffineTransform transform;
  13723. float opacity;
  13724. private:
  13725. RenderingContext& operator= (const RenderingContext&);
  13726. };
  13727. virtual void render (const RenderingContext& context) const = 0;
  13728. virtual const Rectangle<float> getBounds() const = 0;
  13729. virtual bool hitTest (float x, float y) const = 0;
  13730. const String& getName() const throw() { return name; }
  13731. void setName (const String& newName) throw() { name = newName; }
  13732. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13733. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13734. static Drawable* createFromImageFile (const File& file);
  13735. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13736. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13737. virtual ValueTree createValueTree() const throw() = 0;
  13738. juce_UseDebuggingNewOperator
  13739. private:
  13740. Drawable (const Drawable&);
  13741. Drawable& operator= (const Drawable&);
  13742. String name;
  13743. };
  13744. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13745. /*** End of inlined file: juce_Drawable.h ***/
  13746. class JUCE_API DrawableButton : public Button
  13747. {
  13748. public:
  13749. enum ButtonStyle
  13750. {
  13751. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13752. ImageRaw, /**< The button will just display the images in their normal size and position.
  13753. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13754. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13755. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13756. };
  13757. DrawableButton (const String& buttonName,
  13758. const ButtonStyle buttonStyle);
  13759. ~DrawableButton();
  13760. void setImages (const Drawable* normalImage,
  13761. const Drawable* overImage = 0,
  13762. const Drawable* downImage = 0,
  13763. const Drawable* disabledImage = 0,
  13764. const Drawable* normalImageOn = 0,
  13765. const Drawable* overImageOn = 0,
  13766. const Drawable* downImageOn = 0,
  13767. const Drawable* disabledImageOn = 0);
  13768. void setButtonStyle (const ButtonStyle newStyle);
  13769. void setBackgroundColours (const Colour& toggledOffColour,
  13770. const Colour& toggledOnColour);
  13771. const Colour& getBackgroundColour() const throw();
  13772. void setEdgeIndent (const int numPixelsIndent);
  13773. const Drawable* getCurrentImage() const throw();
  13774. const Drawable* getNormalImage() const throw();
  13775. const Drawable* getOverImage() const throw();
  13776. const Drawable* getDownImage() const throw();
  13777. juce_UseDebuggingNewOperator
  13778. protected:
  13779. void paintButton (Graphics& g,
  13780. bool isMouseOverButton,
  13781. bool isButtonDown);
  13782. private:
  13783. ButtonStyle style;
  13784. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13785. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13786. Colour backgroundOff, backgroundOn;
  13787. int edgeIndent;
  13788. void deleteImages();
  13789. DrawableButton (const DrawableButton&);
  13790. DrawableButton& operator= (const DrawableButton&);
  13791. };
  13792. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13793. /*** End of inlined file: juce_DrawableButton.h ***/
  13794. #endif
  13795. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13796. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13797. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13798. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13799. class JUCE_API HyperlinkButton : public Button
  13800. {
  13801. public:
  13802. HyperlinkButton (const String& linkText,
  13803. const URL& linkURL);
  13804. ~HyperlinkButton();
  13805. void setFont (const Font& newFont,
  13806. const bool resizeToMatchComponentHeight,
  13807. const Justification& justificationType = Justification::horizontallyCentred);
  13808. enum ColourIds
  13809. {
  13810. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13811. };
  13812. void setURL (const URL& newURL) throw();
  13813. const URL& getURL() const throw() { return url; }
  13814. void changeWidthToFitText();
  13815. juce_UseDebuggingNewOperator
  13816. protected:
  13817. void clicked();
  13818. void colourChanged();
  13819. void paintButton (Graphics& g,
  13820. bool isMouseOverButton,
  13821. bool isButtonDown);
  13822. private:
  13823. URL url;
  13824. Font font;
  13825. bool resizeFont;
  13826. Justification justification;
  13827. const Font getFontToUse() const;
  13828. HyperlinkButton (const HyperlinkButton&);
  13829. HyperlinkButton& operator= (const HyperlinkButton&);
  13830. };
  13831. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13832. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13833. #endif
  13834. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13835. /*** Start of inlined file: juce_ImageButton.h ***/
  13836. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13837. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13838. class JUCE_API ImageButton : public Button
  13839. {
  13840. public:
  13841. ImageButton (const String& name);
  13842. ~ImageButton();
  13843. void setImages (const bool resizeButtonNowToFitThisImage,
  13844. const bool rescaleImagesWhenButtonSizeChanges,
  13845. const bool preserveImageProportions,
  13846. Image* const normalImage,
  13847. const float imageOpacityWhenNormal,
  13848. const Colour& overlayColourWhenNormal,
  13849. Image* const overImage,
  13850. const float imageOpacityWhenOver,
  13851. const Colour& overlayColourWhenOver,
  13852. Image* const downImage,
  13853. const float imageOpacityWhenDown,
  13854. const Colour& overlayColourWhenDown,
  13855. const float hitTestAlphaThreshold = 0.0f);
  13856. Image* getNormalImage() const throw();
  13857. Image* getOverImage() const throw();
  13858. Image* getDownImage() const throw();
  13859. juce_UseDebuggingNewOperator
  13860. protected:
  13861. bool hitTest (int x, int y);
  13862. void paintButton (Graphics& g,
  13863. bool isMouseOverButton,
  13864. bool isButtonDown);
  13865. private:
  13866. bool scaleImageToFit, preserveProportions;
  13867. unsigned char alphaThreshold;
  13868. int imageX, imageY, imageW, imageH;
  13869. Image* normalImage;
  13870. Image* overImage;
  13871. Image* downImage;
  13872. float normalOpacity, overOpacity, downOpacity;
  13873. Colour normalOverlay, overOverlay, downOverlay;
  13874. Image* getCurrentImage() const;
  13875. void deleteImages();
  13876. ImageButton (const ImageButton&);
  13877. ImageButton& operator= (const ImageButton&);
  13878. };
  13879. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13880. /*** End of inlined file: juce_ImageButton.h ***/
  13881. #endif
  13882. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13883. /*** Start of inlined file: juce_ShapeButton.h ***/
  13884. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13885. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13886. class JUCE_API ShapeButton : public Button
  13887. {
  13888. public:
  13889. ShapeButton (const String& name,
  13890. const Colour& normalColour,
  13891. const Colour& overColour,
  13892. const Colour& downColour);
  13893. ~ShapeButton();
  13894. void setShape (const Path& newShape,
  13895. const bool resizeNowToFitThisShape,
  13896. const bool maintainShapeProportions,
  13897. const bool hasDropShadow);
  13898. void setColours (const Colour& normalColour,
  13899. const Colour& overColour,
  13900. const Colour& downColour);
  13901. void setOutline (const Colour& outlineColour,
  13902. const float outlineStrokeWidth);
  13903. juce_UseDebuggingNewOperator
  13904. protected:
  13905. void paintButton (Graphics& g,
  13906. bool isMouseOverButton,
  13907. bool isButtonDown);
  13908. private:
  13909. Colour normalColour, overColour, downColour, outlineColour;
  13910. DropShadowEffect shadow;
  13911. Path shape;
  13912. bool maintainShapeProportions;
  13913. float outlineWidth;
  13914. ShapeButton (const ShapeButton&);
  13915. ShapeButton& operator= (const ShapeButton&);
  13916. };
  13917. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13918. /*** End of inlined file: juce_ShapeButton.h ***/
  13919. #endif
  13920. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13921. #endif
  13922. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13923. /*** Start of inlined file: juce_ToggleButton.h ***/
  13924. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13925. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13926. class JUCE_API ToggleButton : public Button
  13927. {
  13928. public:
  13929. ToggleButton (const String& buttonText);
  13930. ~ToggleButton();
  13931. void changeWidthToFitText();
  13932. enum ColourIds
  13933. {
  13934. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13935. };
  13936. juce_UseDebuggingNewOperator
  13937. protected:
  13938. void paintButton (Graphics& g,
  13939. bool isMouseOverButton,
  13940. bool isButtonDown);
  13941. void colourChanged();
  13942. private:
  13943. ToggleButton (const ToggleButton&);
  13944. ToggleButton& operator= (const ToggleButton&);
  13945. };
  13946. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13947. /*** End of inlined file: juce_ToggleButton.h ***/
  13948. #endif
  13949. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13950. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13951. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13952. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13953. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13954. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13955. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13956. /*** Start of inlined file: juce_Toolbar.h ***/
  13957. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13958. #define __JUCE_TOOLBAR_JUCEHEADER__
  13959. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13960. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13961. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13962. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13963. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13964. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13965. class JUCE_API DragAndDropTarget
  13966. {
  13967. public:
  13968. virtual ~DragAndDropTarget() {}
  13969. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13970. Component* sourceComponent) = 0;
  13971. virtual void itemDragEnter (const String& sourceDescription,
  13972. Component* sourceComponent,
  13973. int x,
  13974. int y);
  13975. virtual void itemDragMove (const String& sourceDescription,
  13976. Component* sourceComponent,
  13977. int x,
  13978. int y);
  13979. virtual void itemDragExit (const String& sourceDescription,
  13980. Component* sourceComponent);
  13981. virtual void itemDropped (const String& sourceDescription,
  13982. Component* sourceComponent,
  13983. int x,
  13984. int y) = 0;
  13985. virtual bool shouldDrawDragImageWhenOver();
  13986. };
  13987. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13988. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13989. class JUCE_API DragAndDropContainer
  13990. {
  13991. public:
  13992. DragAndDropContainer();
  13993. virtual ~DragAndDropContainer();
  13994. void startDragging (const String& sourceDescription,
  13995. Component* sourceComponent,
  13996. Image* dragImage = 0,
  13997. const bool allowDraggingToOtherJuceWindows = false,
  13998. const Point<int>* imageOffsetFromMouse = 0);
  13999. bool isDragAndDropActive() const;
  14000. const String getCurrentDragDescription() const;
  14001. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14002. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  14003. static bool performExternalDragDropOfText (const String& text);
  14004. juce_UseDebuggingNewOperator
  14005. protected:
  14006. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14007. Component* dragSourceComponent,
  14008. StringArray& files,
  14009. bool& canMoveFiles);
  14010. private:
  14011. friend class DragImageComponent;
  14012. ScopedPointer <Component> dragImageComponent;
  14013. String currentDragDesc;
  14014. };
  14015. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14016. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14017. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14018. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14019. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14020. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14021. private Timer
  14022. {
  14023. public:
  14024. ComponentAnimator();
  14025. ~ComponentAnimator();
  14026. void animateComponent (Component* const component,
  14027. const Rectangle<int>& finalPosition,
  14028. const int millisecondsToSpendMoving,
  14029. const double startSpeed = 1.0,
  14030. const double endSpeed = 1.0);
  14031. void cancelAnimation (Component* const component,
  14032. const bool moveComponentToItsFinalPosition);
  14033. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  14034. const Rectangle<int> getComponentDestination (Component* const component);
  14035. bool isAnimating (Component* component) const;
  14036. juce_UseDebuggingNewOperator
  14037. private:
  14038. VoidArray tasks;
  14039. uint32 lastTime;
  14040. void* findTaskFor (Component* const component) const;
  14041. void timerCallback();
  14042. };
  14043. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14044. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14045. class ToolbarItemComponent;
  14046. class ToolbarItemFactory;
  14047. class MissingItemsComponent;
  14048. class JUCE_API Toolbar : public Component,
  14049. public DragAndDropContainer,
  14050. public DragAndDropTarget,
  14051. private ButtonListener
  14052. {
  14053. public:
  14054. Toolbar();
  14055. ~Toolbar();
  14056. void setVertical (const bool shouldBeVertical);
  14057. bool isVertical() const throw() { return vertical; }
  14058. int getThickness() const throw();
  14059. int getLength() const throw();
  14060. void clear();
  14061. void addItem (ToolbarItemFactory& factory,
  14062. const int itemId,
  14063. const int insertIndex = -1);
  14064. void removeToolbarItem (const int itemIndex);
  14065. int getNumItems() const throw();
  14066. int getItemId (const int itemIndex) const throw();
  14067. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  14068. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14069. enum ToolbarItemStyle
  14070. {
  14071. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14072. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14073. textOnly /**< Means that the toolbar only display text labels for each item. */
  14074. };
  14075. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14076. void setStyle (const ToolbarItemStyle& newStyle);
  14077. enum CustomisationFlags
  14078. {
  14079. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14080. show the "icons only" option on its choice of toolbar styles. */
  14081. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14082. show the "icons with text" option on its choice of toolbar styles. */
  14083. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14084. show the "text only" option on its choice of toolbar styles. */
  14085. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14086. show a button to reset the toolbar to its default set of items. */
  14087. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14088. };
  14089. void showCustomisationDialog (ToolbarItemFactory& factory,
  14090. const int optionFlags = allCustomisationOptionsEnabled);
  14091. void setEditingActive (const bool editingEnabled);
  14092. enum ColourIds
  14093. {
  14094. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14095. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14096. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14097. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14098. over them. */
  14099. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14100. held down on them. */
  14101. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14102. when the style is set to iconsWithText or textOnly. */
  14103. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14104. the customisation dialog is active and the mouse moves over them. */
  14105. };
  14106. const String toString() const;
  14107. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14108. const String& savedVersion);
  14109. void paint (Graphics& g);
  14110. void resized();
  14111. void buttonClicked (Button*);
  14112. void mouseDown (const MouseEvent&);
  14113. bool isInterestedInDragSource (const String&, Component*);
  14114. void itemDragMove (const String&, Component*, int, int);
  14115. void itemDragExit (const String&, Component*);
  14116. void itemDropped (const String&, Component*, int, int);
  14117. void updateAllItemPositions (const bool animate);
  14118. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14119. juce_UseDebuggingNewOperator
  14120. private:
  14121. Button* missingItemsButton;
  14122. bool vertical, isEditingActive;
  14123. ToolbarItemStyle toolbarStyle;
  14124. ComponentAnimator animator;
  14125. friend class MissingItemsComponent;
  14126. Array <ToolbarItemComponent*> items;
  14127. friend class ItemDragAndDropOverlayComponent;
  14128. static const tchar* const toolbarDragDescriptor;
  14129. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14130. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14131. Toolbar (const Toolbar&);
  14132. Toolbar& operator= (const Toolbar&);
  14133. };
  14134. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14135. /*** End of inlined file: juce_Toolbar.h ***/
  14136. class ItemDragAndDropOverlayComponent;
  14137. class JUCE_API ToolbarItemComponent : public Button
  14138. {
  14139. public:
  14140. ToolbarItemComponent (const int itemId,
  14141. const String& labelText,
  14142. const bool isBeingUsedAsAButton);
  14143. ~ToolbarItemComponent();
  14144. int getItemId() const throw() { return itemId; }
  14145. Toolbar* getToolbar() const;
  14146. bool isToolbarVertical() const;
  14147. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14148. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14149. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14150. virtual bool getToolbarItemSizes (int toolbarThickness,
  14151. bool isToolbarVertical,
  14152. int& preferredSize,
  14153. int& minSize,
  14154. int& maxSize) = 0;
  14155. virtual void paintButtonArea (Graphics& g,
  14156. int width, int height,
  14157. bool isMouseOver, bool isMouseDown) = 0;
  14158. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14159. enum ToolbarEditingMode
  14160. {
  14161. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14162. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14163. customisation mode, and the items can be dragged around. */
  14164. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14165. dragged onto a toolbar to add it to that bar.*/
  14166. };
  14167. void setEditingMode (const ToolbarEditingMode newMode);
  14168. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14169. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14170. void resized();
  14171. juce_UseDebuggingNewOperator
  14172. private:
  14173. friend class Toolbar;
  14174. friend class ItemDragAndDropOverlayComponent;
  14175. const int itemId;
  14176. ToolbarEditingMode mode;
  14177. Toolbar::ToolbarItemStyle toolbarStyle;
  14178. ScopedPointer <Component> overlayComp;
  14179. int dragOffsetX, dragOffsetY;
  14180. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14181. Rectangle<int> contentArea;
  14182. ToolbarItemComponent (const ToolbarItemComponent&);
  14183. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14184. };
  14185. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14186. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14187. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14188. {
  14189. public:
  14190. ToolbarButton (const int itemId,
  14191. const String& labelText,
  14192. Drawable* const normalImage,
  14193. Drawable* const toggledOnImage);
  14194. ~ToolbarButton();
  14195. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14196. int& minSize, int& maxSize);
  14197. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14198. void contentAreaChanged (const Rectangle<int>& newBounds);
  14199. juce_UseDebuggingNewOperator
  14200. private:
  14201. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14202. ToolbarButton (const ToolbarButton&);
  14203. ToolbarButton& operator= (const ToolbarButton&);
  14204. };
  14205. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14206. /*** End of inlined file: juce_ToolbarButton.h ***/
  14207. #endif
  14208. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14209. /*** Start of inlined file: juce_CodeDocument.h ***/
  14210. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14211. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14212. class CodeDocumentLine;
  14213. class JUCE_API CodeDocument
  14214. {
  14215. public:
  14216. CodeDocument();
  14217. ~CodeDocument();
  14218. class JUCE_API Position
  14219. {
  14220. public:
  14221. Position() throw();
  14222. Position (const CodeDocument* const ownerDocument,
  14223. const int line, const int indexInLine) throw();
  14224. Position (const CodeDocument* const ownerDocument,
  14225. const int charactersFromStartOfDocument) throw();
  14226. Position (const Position& other) throw();
  14227. ~Position() throw();
  14228. Position& operator= (const Position& other) throw();
  14229. bool operator== (const Position& other) const throw();
  14230. bool operator!= (const Position& other) const throw();
  14231. void setPosition (const int charactersFromStartOfDocument) throw();
  14232. int getPosition() const throw() { return characterPos; }
  14233. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14234. int getLineNumber() const throw() { return line; }
  14235. int getIndexInLine() const throw() { return indexInLine; }
  14236. void setPositionMaintained (const bool isMaintained) throw();
  14237. void moveBy (int characterDelta) throw();
  14238. const Position movedBy (const int characterDelta) const throw();
  14239. const Position movedByLines (const int deltaLines) const throw();
  14240. const tchar getCharacter() const throw();
  14241. const String getLineText() const throw();
  14242. private:
  14243. CodeDocument* owner;
  14244. int characterPos, line, indexInLine;
  14245. bool positionMaintained;
  14246. };
  14247. const String getAllContent() const throw();
  14248. const String getTextBetween (const Position& start, const Position& end) const throw();
  14249. const String getLine (const int lineIndex) const throw();
  14250. int getNumCharacters() const throw();
  14251. int getNumLines() const throw() { return lines.size(); }
  14252. int getMaximumLineLength() throw();
  14253. void deleteSection (const Position& startPosition, const Position& endPosition);
  14254. void insertText (const Position& position, const String& text);
  14255. void replaceAllContent (const String& newContent);
  14256. bool loadFromStream (InputStream& stream);
  14257. bool writeToStream (OutputStream& stream);
  14258. const String getNewLineCharacters() const throw() { return newLineChars; }
  14259. void setNewLineCharacters (const String& newLine) throw();
  14260. void newTransaction();
  14261. void undo();
  14262. void redo();
  14263. void clearUndoHistory();
  14264. UndoManager& getUndoManager() throw() { return undoManager; }
  14265. void setSavePoint() throw();
  14266. bool hasChangedSinceSavePoint() const throw();
  14267. const Position findWordBreakAfter (const Position& position) const throw();
  14268. const Position findWordBreakBefore (const Position& position) const throw();
  14269. class JUCE_API Listener
  14270. {
  14271. public:
  14272. Listener() {}
  14273. virtual ~Listener() {}
  14274. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14275. const Position& affectedTextEnd) = 0;
  14276. };
  14277. void addListener (Listener* const listener) throw();
  14278. void removeListener (Listener* const listener) throw();
  14279. class Iterator
  14280. {
  14281. public:
  14282. Iterator (CodeDocument* const document);
  14283. Iterator (const Iterator& other);
  14284. Iterator& operator= (const Iterator& other) throw();
  14285. ~Iterator() throw();
  14286. juce_wchar nextChar();
  14287. juce_wchar peekNextChar() const;
  14288. void skip();
  14289. int getPosition() const throw() { return position; }
  14290. void skipWhitespace();
  14291. void skipToEndOfLine();
  14292. int getLine() const throw() { return line; }
  14293. bool isEOF() const throw();
  14294. private:
  14295. CodeDocument* document;
  14296. CodeDocumentLine* currentLine;
  14297. int line, position;
  14298. };
  14299. juce_UseDebuggingNewOperator
  14300. private:
  14301. friend class CodeDocumentInsertAction;
  14302. friend class CodeDocumentDeleteAction;
  14303. friend class Iterator;
  14304. friend class Position;
  14305. OwnedArray <CodeDocumentLine> lines;
  14306. Array <Position*> positionsToMaintain;
  14307. UndoManager undoManager;
  14308. int currentActionIndex, indexOfSavedState;
  14309. int maximumLineLength;
  14310. VoidArray listeners;
  14311. String newLineChars;
  14312. void sendListenerChangeMessage (const int startLine, const int endLine);
  14313. void insert (const String& text, const int insertPos, const bool undoable);
  14314. void remove (const int startPos, const int endPos, const bool undoable);
  14315. void checkLastLineStatus();
  14316. CodeDocument (const CodeDocument&);
  14317. CodeDocument& operator= (const CodeDocument&);
  14318. };
  14319. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14320. /*** End of inlined file: juce_CodeDocument.h ***/
  14321. #endif
  14322. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14323. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14324. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14325. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14326. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14327. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14328. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14329. class JUCE_API CodeTokeniser
  14330. {
  14331. public:
  14332. CodeTokeniser() {}
  14333. virtual ~CodeTokeniser() {}
  14334. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14335. virtual const StringArray getTokenTypes() = 0;
  14336. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14337. juce_UseDebuggingNewOperator
  14338. };
  14339. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14340. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14341. class JUCE_API CodeEditorComponent : public Component,
  14342. public TextInputTarget,
  14343. public Timer,
  14344. public ScrollBarListener,
  14345. public CodeDocument::Listener,
  14346. public AsyncUpdater
  14347. {
  14348. public:
  14349. CodeEditorComponent (CodeDocument& document,
  14350. CodeTokeniser* const codeTokeniser);
  14351. ~CodeEditorComponent();
  14352. CodeDocument& getDocument() const throw() { return document; }
  14353. void loadContent (const String& newContent);
  14354. float getCharWidth() const throw() { return charWidth; }
  14355. int getLineHeight() const throw() { return lineHeight; }
  14356. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14357. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14358. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14359. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14360. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14361. const CodeDocument::Position getPositionAt (int x, int y);
  14362. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14363. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14364. void cursorDown (const bool selecting);
  14365. void cursorUp (const bool selecting);
  14366. void pageDown (const bool selecting);
  14367. void pageUp (const bool selecting);
  14368. void scrollDown();
  14369. void scrollUp();
  14370. void scrollToLine (int newFirstLineOnScreen);
  14371. void scrollBy (int deltaLines);
  14372. void scrollToColumn (int newFirstColumnOnScreen);
  14373. void scrollToKeepCaretOnScreen();
  14374. void goToStartOfDocument (const bool selecting);
  14375. void goToStartOfLine (const bool selecting);
  14376. void goToEndOfDocument (const bool selecting);
  14377. void goToEndOfLine (const bool selecting);
  14378. void deselectAll();
  14379. void selectAll();
  14380. void insertTextAtCaret (const String& textToInsert);
  14381. void insertTabAtCaret();
  14382. void cut();
  14383. void copy();
  14384. void copyThenCut();
  14385. void paste();
  14386. void backspace (const bool moveInWholeWordSteps);
  14387. void deleteForward (const bool moveInWholeWordSteps);
  14388. void undo();
  14389. void redo();
  14390. const Range<int> getHighlightedRegion() const;
  14391. void setHighlightedRegion (const Range<int>& newRange);
  14392. const String getTextInRange (const Range<int>& range) const;
  14393. void setTabSize (const int numSpacesPerTab,
  14394. const bool insertSpacesInsteadOfTabCharacters) throw();
  14395. int getTabSize() const throw() { return spacesPerTab; }
  14396. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14397. void setFont (const Font& newFont);
  14398. void resetToDefaultColours();
  14399. void setColourForTokenType (const int tokenType, const Colour& colour);
  14400. const Colour getColourForTokenType (const int tokenType) const throw();
  14401. enum ColourIds
  14402. {
  14403. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14404. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14405. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14406. selected text. */
  14407. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14408. enabled. */
  14409. };
  14410. void setScrollbarThickness (const int thickness) throw();
  14411. void resized();
  14412. void paint (Graphics& g);
  14413. bool keyPressed (const KeyPress& key);
  14414. void mouseDown (const MouseEvent& e);
  14415. void mouseDrag (const MouseEvent& e);
  14416. void mouseUp (const MouseEvent& e);
  14417. void mouseDoubleClick (const MouseEvent& e);
  14418. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14419. void timerCallback();
  14420. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14421. void handleAsyncUpdate();
  14422. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14423. const CodeDocument::Position& affectedTextEnd);
  14424. juce_UseDebuggingNewOperator
  14425. private:
  14426. CodeDocument& document;
  14427. Font font;
  14428. int firstLineOnScreen, gutter, spacesPerTab;
  14429. float charWidth;
  14430. int lineHeight, linesOnScreen, columnsOnScreen;
  14431. int scrollbarThickness, columnToTryToMaintain;
  14432. bool useSpacesForTabs;
  14433. double xOffset;
  14434. CodeDocument::Position caretPos;
  14435. CodeDocument::Position selectionStart, selectionEnd;
  14436. Component* caret;
  14437. ScrollBar* verticalScrollBar;
  14438. ScrollBar* horizontalScrollBar;
  14439. enum DragType
  14440. {
  14441. notDragging,
  14442. draggingSelectionStart,
  14443. draggingSelectionEnd
  14444. };
  14445. DragType dragType;
  14446. CodeTokeniser* codeTokeniser;
  14447. Array <Colour> coloursForTokenCategories;
  14448. class CodeEditorLine;
  14449. OwnedArray <CodeEditorLine> lines;
  14450. void rebuildLineTokens();
  14451. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14452. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14453. void updateCachedIterators (int maxLineNum);
  14454. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14455. void moveLineDelta (const int delta, const bool selecting);
  14456. void updateScrollBars();
  14457. void scrollToLineInternal (int line);
  14458. void scrollToColumnInternal (double column);
  14459. void newTransaction();
  14460. int indexToColumn (int line, int index) const throw();
  14461. int columnToIndex (int line, int column) const throw();
  14462. CodeEditorComponent (const CodeEditorComponent&);
  14463. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14464. };
  14465. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14466. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14467. #endif
  14468. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14469. #endif
  14470. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14471. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14472. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14473. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14474. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14475. {
  14476. public:
  14477. CPlusPlusCodeTokeniser();
  14478. ~CPlusPlusCodeTokeniser();
  14479. enum TokenType
  14480. {
  14481. tokenType_error = 0,
  14482. tokenType_comment,
  14483. tokenType_builtInKeyword,
  14484. tokenType_identifier,
  14485. tokenType_integerLiteral,
  14486. tokenType_floatLiteral,
  14487. tokenType_stringLiteral,
  14488. tokenType_operator,
  14489. tokenType_bracket,
  14490. tokenType_punctuation,
  14491. tokenType_preprocessor
  14492. };
  14493. int readNextToken (CodeDocument::Iterator& source);
  14494. const StringArray getTokenTypes();
  14495. const Colour getDefaultColour (const int tokenType);
  14496. juce_UseDebuggingNewOperator
  14497. };
  14498. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14499. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14500. #endif
  14501. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14502. #endif
  14503. #ifndef __JUCE_LABEL_JUCEHEADER__
  14504. #endif
  14505. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14506. #endif
  14507. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14508. /*** Start of inlined file: juce_ProgressBar.h ***/
  14509. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14510. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14511. class JUCE_API ProgressBar : public Component,
  14512. public SettableTooltipClient,
  14513. private Timer
  14514. {
  14515. public:
  14516. ProgressBar (double& progress);
  14517. ~ProgressBar();
  14518. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14519. void setTextToDisplay (const String& text);
  14520. enum ColourIds
  14521. {
  14522. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14523. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14524. classes will probably use variations on this colour. */
  14525. };
  14526. juce_UseDebuggingNewOperator
  14527. protected:
  14528. void paint (Graphics& g);
  14529. void lookAndFeelChanged();
  14530. void visibilityChanged();
  14531. void colourChanged();
  14532. private:
  14533. double& progress;
  14534. double currentValue;
  14535. bool displayPercentage;
  14536. String displayedMessage, currentMessage;
  14537. uint32 lastCallbackTime;
  14538. void timerCallback();
  14539. ProgressBar (const ProgressBar&);
  14540. ProgressBar& operator= (const ProgressBar&);
  14541. };
  14542. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14543. /*** End of inlined file: juce_ProgressBar.h ***/
  14544. #endif
  14545. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14546. /*** Start of inlined file: juce_Slider.h ***/
  14547. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14548. #define __JUCE_SLIDER_JUCEHEADER__
  14549. /*** Start of inlined file: juce_SliderListener.h ***/
  14550. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14551. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14552. class Slider;
  14553. class JUCE_API SliderListener
  14554. {
  14555. public:
  14556. virtual ~SliderListener() {}
  14557. virtual void sliderValueChanged (Slider* slider) = 0;
  14558. virtual void sliderDragStarted (Slider* slider);
  14559. virtual void sliderDragEnded (Slider* slider);
  14560. };
  14561. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14562. /*** End of inlined file: juce_SliderListener.h ***/
  14563. class JUCE_API Slider : public Component,
  14564. public SettableTooltipClient,
  14565. private AsyncUpdater,
  14566. private ButtonListener,
  14567. private LabelListener,
  14568. private Value::Listener
  14569. {
  14570. public:
  14571. Slider (const String& componentName);
  14572. ~Slider();
  14573. enum SliderStyle
  14574. {
  14575. LinearHorizontal, /**< A traditional horizontal slider. */
  14576. LinearVertical, /**< A traditional vertical slider. */
  14577. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14578. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14579. @see setRotaryParameters */
  14580. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14581. @see setRotaryParameters */
  14582. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14583. @see setRotaryParameters */
  14584. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14585. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14586. @see setMinValue, setMaxValue */
  14587. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14588. @see setMinValue, setMaxValue */
  14589. ThreeValueHorizontal, /**< A horizontal 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. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14593. value, with the current value being somewhere between them.
  14594. @see setMinValue, setMaxValue */
  14595. };
  14596. void setSliderStyle (const SliderStyle newStyle);
  14597. SliderStyle getSliderStyle() const { return style; }
  14598. void setRotaryParameters (const float startAngleRadians,
  14599. const float endAngleRadians,
  14600. const bool stopAtEnd);
  14601. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14602. void setVelocityBasedMode (const bool isVelocityBased);
  14603. bool getVelocityBasedMode() const { return isVelocityBased; }
  14604. void setVelocityModeParameters (const double sensitivity = 1.0,
  14605. const int threshold = 1,
  14606. const double offset = 0.0,
  14607. const bool userCanPressKeyToSwapMode = true);
  14608. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14609. int getVelocityThreshold() const { return velocityModeThreshold; }
  14610. double getVelocityOffset() const { return velocityModeOffset; }
  14611. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14612. void setSkewFactor (const double factor);
  14613. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14614. double getSkewFactor() const { return skewFactor; }
  14615. enum IncDecButtonMode
  14616. {
  14617. incDecButtonsNotDraggable,
  14618. incDecButtonsDraggable_AutoDirection,
  14619. incDecButtonsDraggable_Horizontal,
  14620. incDecButtonsDraggable_Vertical
  14621. };
  14622. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14623. enum TextEntryBoxPosition
  14624. {
  14625. NoTextBox, /**< Doesn't display a text box. */
  14626. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14627. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14628. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14629. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14630. };
  14631. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14632. const bool isReadOnly,
  14633. const int textEntryBoxWidth,
  14634. const int textEntryBoxHeight);
  14635. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14636. int getTextBoxWidth() const { return textBoxWidth; }
  14637. int getTextBoxHeight() const { return textBoxHeight; }
  14638. void setTextBoxIsEditable (const bool shouldBeEditable);
  14639. bool isTextBoxEditable() const { return editableText; }
  14640. void showTextBox();
  14641. void hideTextBox (const bool discardCurrentEditorContents);
  14642. void setValue (double newValue,
  14643. const bool sendUpdateMessage = true,
  14644. const bool sendMessageSynchronously = false);
  14645. double getValue() const;
  14646. Value& getValueObject() { return currentValue; }
  14647. void setRange (const double newMinimum,
  14648. const double newMaximum,
  14649. const double newInterval = 0);
  14650. double getMaximum() const { return maximum; }
  14651. double getMinimum() const { return minimum; }
  14652. double getInterval() const { return interval; }
  14653. double getMinValue() const;
  14654. Value& getMinValueObject() { return valueMin; }
  14655. void setMinValue (double newValue,
  14656. const bool sendUpdateMessage = true,
  14657. const bool sendMessageSynchronously = false,
  14658. const bool allowNudgingOfOtherValues = false);
  14659. double getMaxValue() const;
  14660. Value& getMaxValueObject() { return valueMax; }
  14661. void setMaxValue (double newValue,
  14662. const bool sendUpdateMessage = true,
  14663. const bool sendMessageSynchronously = false,
  14664. const bool allowNudgingOfOtherValues = false);
  14665. void addListener (SliderListener* const listener);
  14666. void removeListener (SliderListener* const listener);
  14667. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14668. const double valueToSetOnDoubleClick);
  14669. double getDoubleClickReturnValue (bool& isEnabled) const;
  14670. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14671. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14672. void setPopupDisplayEnabled (const bool isEnabled,
  14673. Component* const parentComponentToUse);
  14674. void setPopupMenuEnabled (const bool menuEnabled);
  14675. void setScrollWheelEnabled (const bool enabled);
  14676. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14677. virtual void startedDragging();
  14678. virtual void stoppedDragging();
  14679. virtual void valueChanged();
  14680. /** Callback to indicate that the user has just moved the slider.
  14681. Note - the valueChanged() method has changed its format and now no longer has
  14682. any parameters. Update your code to use the new version.
  14683. This version has been left here with an int as its return value to cause
  14684. a syntax error if you've got existing code that uses the old version.
  14685. */
  14686. virtual int valueChanged (double) { jassertfalse; return 0; }
  14687. virtual double getValueFromText (const String& text);
  14688. virtual const String getTextFromValue (double value);
  14689. void setTextValueSuffix (const String& suffix);
  14690. virtual double proportionOfLengthToValue (double proportion);
  14691. virtual double valueToProportionOfLength (double value);
  14692. float getPositionOfValue (const double value);
  14693. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14694. void updateText();
  14695. bool isHorizontal() const;
  14696. bool isVertical() const;
  14697. enum ColourIds
  14698. {
  14699. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14700. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14701. and feel class how this is used. */
  14702. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14703. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14704. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14705. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14706. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14707. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14708. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14709. };
  14710. juce_UseDebuggingNewOperator
  14711. protected:
  14712. void labelTextChanged (Label*);
  14713. void paint (Graphics& g);
  14714. void resized();
  14715. void mouseDown (const MouseEvent& e);
  14716. void mouseUp (const MouseEvent& e);
  14717. void mouseDrag (const MouseEvent& e);
  14718. void mouseDoubleClick (const MouseEvent& e);
  14719. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14720. void modifierKeysChanged (const ModifierKeys& modifiers);
  14721. void buttonClicked (Button* button);
  14722. void lookAndFeelChanged();
  14723. void enablementChanged();
  14724. void focusOfChildComponentChanged (FocusChangeType cause);
  14725. void handleAsyncUpdate();
  14726. void colourChanged();
  14727. void valueChanged (Value& value);
  14728. private:
  14729. ListenerList <SliderListener> listeners;
  14730. Value currentValue, valueMin, valueMax;
  14731. double lastCurrentValue, lastValueMin, lastValueMax;
  14732. double minimum, maximum, interval, doubleClickReturnValue;
  14733. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14734. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14735. int velocityModeThreshold;
  14736. float rotaryStart, rotaryEnd;
  14737. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14738. int mouseDragStartX, mouseDragStartY;
  14739. int sliderRegionStart, sliderRegionSize;
  14740. int sliderBeingDragged;
  14741. int pixelsForFullDragExtent;
  14742. Rectangle<int> sliderRect;
  14743. String textSuffix;
  14744. SliderStyle style;
  14745. TextEntryBoxPosition textBoxPos;
  14746. int textBoxWidth, textBoxHeight;
  14747. IncDecButtonMode incDecButtonMode;
  14748. bool editableText : 1, doubleClickToValue : 1;
  14749. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14750. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14751. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14752. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14753. Font font;
  14754. Label* valueBox;
  14755. Button* incButton;
  14756. Button* decButton;
  14757. ScopedPointer <Component> popupDisplay;
  14758. Component* parentForPopupDisplay;
  14759. float getLinearSliderPos (const double value);
  14760. void restoreMouseIfHidden();
  14761. void sendDragStart();
  14762. void sendDragEnd();
  14763. double constrainedValue (double value) const;
  14764. void triggerChangeMessage (const bool synchronous);
  14765. bool incDecDragDirectionIsHorizontal() const;
  14766. Slider (const Slider&);
  14767. Slider& operator= (const Slider&);
  14768. };
  14769. #endif // __JUCE_SLIDER_JUCEHEADER__
  14770. /*** End of inlined file: juce_Slider.h ***/
  14771. #endif
  14772. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14773. #endif
  14774. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14775. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14776. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14777. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14778. class TableHeaderComponent;
  14779. class JUCE_API TableHeaderListener
  14780. {
  14781. public:
  14782. TableHeaderListener() {}
  14783. virtual ~TableHeaderListener() {}
  14784. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14785. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14786. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14787. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14788. int columnIdNowBeingDragged);
  14789. };
  14790. class JUCE_API TableHeaderComponent : public Component,
  14791. private AsyncUpdater
  14792. {
  14793. public:
  14794. TableHeaderComponent();
  14795. ~TableHeaderComponent();
  14796. enum ColumnPropertyFlags
  14797. {
  14798. 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. */
  14799. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14800. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14801. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14802. 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. */
  14803. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14804. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14805. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14806. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14807. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14808. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14809. };
  14810. void addColumn (const String& columnName,
  14811. const int columnId,
  14812. const int width,
  14813. const int minimumWidth = 30,
  14814. const int maximumWidth = -1,
  14815. const int propertyFlags = defaultFlags,
  14816. const int insertIndex = -1);
  14817. void removeColumn (const int columnIdToRemove);
  14818. void removeAllColumns();
  14819. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14820. const String getColumnName (const int columnId) const;
  14821. void setColumnName (const int columnId, const String& newName);
  14822. void moveColumn (const int columnId, int newVisibleIndex);
  14823. int getColumnWidth (const int columnId) const;
  14824. void setColumnWidth (const int columnId, const int newWidth);
  14825. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14826. bool isColumnVisible (const int columnId) const;
  14827. void setSortColumnId (const int columnId, const bool sortForwards);
  14828. int getSortColumnId() const;
  14829. bool isSortedForwards() const;
  14830. void reSortTable();
  14831. int getTotalWidth() const;
  14832. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14833. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14834. const Rectangle<int> getColumnPosition (const int index) const;
  14835. int getColumnIdAtX (const int xToFind) const;
  14836. void setStretchToFitActive (const bool shouldStretchToFit);
  14837. bool isStretchToFitActive() const;
  14838. void resizeAllColumnsToFit (int targetTotalWidth);
  14839. void setPopupMenuActive (const bool hasMenu);
  14840. bool isPopupMenuActive() const;
  14841. const String toString() const;
  14842. void restoreFromString (const String& storedVersion);
  14843. void addListener (TableHeaderListener* const newListener);
  14844. void removeListener (TableHeaderListener* const listenerToRemove);
  14845. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14846. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14847. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14848. void paint (Graphics& g);
  14849. void resized();
  14850. void mouseMove (const MouseEvent&);
  14851. void mouseEnter (const MouseEvent&);
  14852. void mouseExit (const MouseEvent&);
  14853. void mouseDown (const MouseEvent&);
  14854. void mouseDrag (const MouseEvent&);
  14855. void mouseUp (const MouseEvent&);
  14856. const MouseCursor getMouseCursor();
  14857. virtual void showColumnChooserMenu (const int columnIdClicked);
  14858. juce_UseDebuggingNewOperator
  14859. private:
  14860. struct ColumnInfo
  14861. {
  14862. String name;
  14863. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14864. double lastDeliberateWidth;
  14865. bool isVisible() const;
  14866. };
  14867. OwnedArray <ColumnInfo> columns;
  14868. Array <TableHeaderListener*> listeners;
  14869. ScopedPointer <Component> dragOverlayComp;
  14870. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14871. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14872. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14873. ColumnInfo* getInfoForId (const int columnId) const;
  14874. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14875. void sendColumnsChanged();
  14876. void handleAsyncUpdate();
  14877. void beginDrag (const MouseEvent&);
  14878. void endDrag (const int finalIndex);
  14879. int getResizeDraggerAt (const int mouseX) const;
  14880. void updateColumnUnderMouse (int x, int y);
  14881. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14882. TableHeaderComponent (const TableHeaderComponent&);
  14883. TableHeaderComponent operator= (const TableHeaderComponent&);
  14884. };
  14885. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14886. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14887. #endif
  14888. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14889. /*** Start of inlined file: juce_TableListBox.h ***/
  14890. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14891. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14892. class JUCE_API TableListBoxModel
  14893. {
  14894. public:
  14895. TableListBoxModel() {}
  14896. virtual ~TableListBoxModel() {}
  14897. virtual int getNumRows() = 0;
  14898. virtual void paintRowBackground (Graphics& g,
  14899. int rowNumber,
  14900. int width, int height,
  14901. bool rowIsSelected) = 0;
  14902. virtual void paintCell (Graphics& g,
  14903. int rowNumber,
  14904. int columnId,
  14905. int width, int height,
  14906. bool rowIsSelected) = 0;
  14907. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14908. Component* existingComponentToUpdate);
  14909. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14910. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14911. virtual void backgroundClicked();
  14912. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14913. virtual int getColumnAutoSizeWidth (int columnId);
  14914. virtual const String getCellTooltip (int rowNumber, int columnId);
  14915. virtual void selectedRowsChanged (int lastRowSelected);
  14916. virtual void deleteKeyPressed (int lastRowSelected);
  14917. virtual void returnKeyPressed (int lastRowSelected);
  14918. virtual void listWasScrolled();
  14919. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14920. };
  14921. class JUCE_API TableListBox : public ListBox,
  14922. private ListBoxModel,
  14923. private TableHeaderListener
  14924. {
  14925. public:
  14926. TableListBox (const String& componentName,
  14927. TableListBoxModel* const model);
  14928. ~TableListBox();
  14929. void setModel (TableListBoxModel* const newModel);
  14930. TableListBoxModel* getModel() const { return model; }
  14931. TableHeaderComponent* getHeader() const { return header; }
  14932. void setHeaderHeight (const int newHeight);
  14933. int getHeaderHeight() const;
  14934. void autoSizeColumn (const int columnId);
  14935. void autoSizeAllColumns();
  14936. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14937. bool isAutoSizeMenuOptionShown() const;
  14938. const Rectangle<int> getCellPosition (const int columnId,
  14939. const int rowNumber,
  14940. const bool relativeToComponentTopLeft) const;
  14941. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14942. int getNumRows();
  14943. void paintListBoxItem (int, Graphics&, int, int, bool);
  14944. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14945. void selectedRowsChanged (int lastRowSelected);
  14946. void deleteKeyPressed (int currentSelectedRow);
  14947. void returnKeyPressed (int currentSelectedRow);
  14948. void backgroundClicked();
  14949. void listWasScrolled();
  14950. void tableColumnsChanged (TableHeaderComponent*);
  14951. void tableColumnsResized (TableHeaderComponent*);
  14952. void tableSortOrderChanged (TableHeaderComponent*);
  14953. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14954. void resized();
  14955. juce_UseDebuggingNewOperator
  14956. private:
  14957. TableHeaderComponent* header;
  14958. TableListBoxModel* model;
  14959. int columnIdNowBeingDragged;
  14960. bool autoSizeOptionsShown;
  14961. void updateColumnComponents() const;
  14962. TableListBox (const TableListBox&);
  14963. TableListBox& operator= (const TableListBox&);
  14964. };
  14965. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14966. /*** End of inlined file: juce_TableListBox.h ***/
  14967. #endif
  14968. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14969. #endif
  14970. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14971. #endif
  14972. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14973. #endif
  14974. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14975. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14976. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14977. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14978. class JUCE_API ToolbarItemFactory
  14979. {
  14980. public:
  14981. ToolbarItemFactory();
  14982. virtual ~ToolbarItemFactory();
  14983. enum SpecialItemIds
  14984. {
  14985. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14986. can be placed between sets of items to break them into groups. */
  14987. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14988. items.*/
  14989. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14990. either side of it, filling any available space. */
  14991. };
  14992. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14993. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14994. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14995. };
  14996. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14997. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14998. #endif
  14999. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15000. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15001. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15002. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15003. class JUCE_API ToolbarItemPalette : public Component,
  15004. public DragAndDropContainer
  15005. {
  15006. public:
  15007. ToolbarItemPalette (ToolbarItemFactory& factory,
  15008. Toolbar* const toolbar);
  15009. ~ToolbarItemPalette();
  15010. void resized();
  15011. juce_UseDebuggingNewOperator
  15012. private:
  15013. ToolbarItemFactory& factory;
  15014. Toolbar* toolbar;
  15015. Viewport* viewport;
  15016. friend class Toolbar;
  15017. void replaceComponent (ToolbarItemComponent* const comp);
  15018. ToolbarItemPalette (const ToolbarItemPalette&);
  15019. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15020. };
  15021. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15022. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15023. #endif
  15024. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15025. /*** Start of inlined file: juce_TreeView.h ***/
  15026. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15027. #define __JUCE_TREEVIEW_JUCEHEADER__
  15028. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15029. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15030. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15031. class JUCE_API FileDragAndDropTarget
  15032. {
  15033. public:
  15034. virtual ~FileDragAndDropTarget() {}
  15035. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15036. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15037. virtual void fileDragMove (const StringArray& files, int x, int y);
  15038. virtual void fileDragExit (const StringArray& files);
  15039. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15040. };
  15041. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15042. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15043. class TreeView;
  15044. class JUCE_API TreeViewItem
  15045. {
  15046. public:
  15047. TreeViewItem();
  15048. virtual ~TreeViewItem();
  15049. int getNumSubItems() const throw();
  15050. TreeViewItem* getSubItem (const int index) const throw();
  15051. void clearSubItems();
  15052. void addSubItem (TreeViewItem* const newItem,
  15053. const int insertPosition = -1);
  15054. void removeSubItem (const int index,
  15055. const bool deleteItem = true);
  15056. TreeView* getOwnerView() const throw() { return ownerView; }
  15057. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15058. bool isOpen() const throw();
  15059. void setOpen (const bool shouldBeOpen);
  15060. bool isSelected() const throw();
  15061. void setSelected (const bool shouldBeSelected,
  15062. const bool deselectOtherItemsFirst);
  15063. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  15064. void treeHasChanged() const throw();
  15065. void repaintItem() const;
  15066. int getRowNumberInTree() const throw();
  15067. bool areAllParentsOpen() const throw();
  15068. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  15069. virtual bool mightContainSubItems() = 0;
  15070. virtual const String getUniqueName() const;
  15071. virtual void itemOpennessChanged (bool isNowOpen);
  15072. virtual int getItemWidth() const { return -1; }
  15073. virtual int getItemHeight() const { return 20; }
  15074. virtual bool canBeSelected() const { return true; }
  15075. virtual Component* createItemComponent() { return 0; }
  15076. virtual void paintItem (Graphics& g, int width, int height);
  15077. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15078. virtual void itemClicked (const MouseEvent& e);
  15079. virtual void itemDoubleClicked (const MouseEvent& e);
  15080. virtual void itemSelectionChanged (bool isNowSelected);
  15081. virtual const String getTooltip();
  15082. virtual const String getDragSourceDescription();
  15083. virtual bool isInterestedInFileDrag (const StringArray& files);
  15084. virtual void filesDropped (const StringArray& files, int insertIndex);
  15085. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15086. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15087. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15088. XmlElement* getOpennessState() const throw();
  15089. void restoreOpennessState (const XmlElement& xml) throw();
  15090. int getIndexInParent() const throw();
  15091. bool isLastOfSiblings() const throw();
  15092. const String getItemIdentifierString() const;
  15093. juce_UseDebuggingNewOperator
  15094. private:
  15095. TreeView* ownerView;
  15096. TreeViewItem* parentItem;
  15097. OwnedArray <TreeViewItem> subItems;
  15098. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15099. int uid;
  15100. bool selected : 1;
  15101. bool redrawNeeded : 1;
  15102. bool drawLinesInside : 1;
  15103. bool drawsInLeftMargin : 1;
  15104. unsigned int openness : 2;
  15105. friend class TreeView;
  15106. friend class TreeViewContentComponent;
  15107. void updatePositions (int newY);
  15108. int getIndentX() const throw();
  15109. void setOwnerView (TreeView* const newOwner) throw();
  15110. void paintRecursively (Graphics& g, int width);
  15111. TreeViewItem* getTopLevelItem() throw();
  15112. TreeViewItem* findItemRecursively (int y) throw();
  15113. TreeViewItem* getDeepestOpenParentItem() throw();
  15114. int getNumRows() const throw();
  15115. TreeViewItem* getItemOnRow (int index) throw();
  15116. void deselectAllRecursively();
  15117. int countSelectedItemsRecursively() const throw();
  15118. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15119. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  15120. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15121. TreeViewItem (const TreeViewItem&);
  15122. TreeViewItem& operator= (const TreeViewItem&);
  15123. };
  15124. class JUCE_API TreeView : public Component,
  15125. public SettableTooltipClient,
  15126. public FileDragAndDropTarget,
  15127. public DragAndDropTarget,
  15128. private AsyncUpdater
  15129. {
  15130. public:
  15131. TreeView (const String& componentName = String::empty);
  15132. ~TreeView();
  15133. void setRootItem (TreeViewItem* const newRootItem);
  15134. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15135. void deleteRootItem();
  15136. void setRootItemVisible (const bool shouldBeVisible);
  15137. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15138. void setDefaultOpenness (const bool isOpenByDefault);
  15139. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15140. void setMultiSelectEnabled (const bool canMultiSelect);
  15141. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15142. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  15143. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15144. void clearSelectedItems();
  15145. int getNumSelectedItems() const throw();
  15146. TreeViewItem* getSelectedItem (const int index) const throw();
  15147. int getNumRowsInTree() const;
  15148. TreeViewItem* getItemOnRow (int index) const;
  15149. TreeViewItem* getItemAt (int yPosition) const throw();
  15150. void scrollToKeepItemVisible (TreeViewItem* item);
  15151. Viewport* getViewport() const throw() { return viewport; }
  15152. int getIndentSize() const throw() { return indentSize; }
  15153. void setIndentSize (const int newIndentSize);
  15154. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15155. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  15156. void restoreOpennessState (const XmlElement& newState);
  15157. enum ColourIds
  15158. {
  15159. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15160. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15161. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15162. };
  15163. void paint (Graphics& g);
  15164. void resized();
  15165. bool keyPressed (const KeyPress& key);
  15166. void colourChanged();
  15167. void enablementChanged();
  15168. bool isInterestedInFileDrag (const StringArray& files);
  15169. void fileDragEnter (const StringArray& files, int x, int y);
  15170. void fileDragMove (const StringArray& files, int x, int y);
  15171. void fileDragExit (const StringArray& files);
  15172. void filesDropped (const StringArray& files, int x, int y);
  15173. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15174. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15175. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15176. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15177. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15178. juce_UseDebuggingNewOperator
  15179. private:
  15180. friend class TreeViewItem;
  15181. friend class TreeViewContentComponent;
  15182. Viewport* viewport;
  15183. CriticalSection nodeAlterationLock;
  15184. TreeViewItem* rootItem;
  15185. Component* dragInsertPointHighlight;
  15186. Component* dragTargetGroupHighlight;
  15187. int indentSize;
  15188. bool defaultOpenness : 1;
  15189. bool needsRecalculating : 1;
  15190. bool rootItemVisible : 1;
  15191. bool multiSelectEnabled : 1;
  15192. bool openCloseButtonsVisible : 1;
  15193. void itemsChanged() throw();
  15194. void handleAsyncUpdate();
  15195. void moveSelectedRow (int delta);
  15196. void updateButtonUnderMouse (const MouseEvent& e);
  15197. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15198. void hideDragHighlight() throw();
  15199. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15200. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15201. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15202. const StringArray& files, const String& sourceDescription,
  15203. Component* sourceComponent) const throw();
  15204. TreeView (const TreeView&);
  15205. TreeView& operator= (const TreeView&);
  15206. };
  15207. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15208. /*** End of inlined file: juce_TreeView.h ***/
  15209. #endif
  15210. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15211. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15212. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15213. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15214. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15215. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15216. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15217. /*** Start of inlined file: juce_FileFilter.h ***/
  15218. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15219. #define __JUCE_FILEFILTER_JUCEHEADER__
  15220. class JUCE_API FileFilter
  15221. {
  15222. public:
  15223. FileFilter (const String& filterDescription);
  15224. virtual ~FileFilter();
  15225. const String& getDescription() const throw();
  15226. virtual bool isFileSuitable (const File& file) const = 0;
  15227. virtual bool isDirectorySuitable (const File& file) const = 0;
  15228. protected:
  15229. String description;
  15230. };
  15231. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15232. /*** End of inlined file: juce_FileFilter.h ***/
  15233. /*** Start of inlined file: juce_Image.h ***/
  15234. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15235. #define __JUCE_IMAGE_JUCEHEADER__
  15236. class JUCE_API Image
  15237. {
  15238. public:
  15239. enum PixelFormat
  15240. {
  15241. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15242. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15243. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15244. };
  15245. Image (PixelFormat format,
  15246. int imageWidth,
  15247. int imageHeight,
  15248. bool clearImage);
  15249. Image (const Image& other);
  15250. virtual ~Image();
  15251. static Image* createNativeImage (PixelFormat format,
  15252. int imageWidth,
  15253. int imageHeight,
  15254. bool clearImage);
  15255. int getWidth() const throw() { return imageWidth; }
  15256. int getHeight() const throw() { return imageHeight; }
  15257. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15258. PixelFormat getFormat() const throw() { return format; }
  15259. bool isARGB() const throw() { return format == ARGB; }
  15260. bool isRGB() const throw() { return format == RGB; }
  15261. bool hasAlphaChannel() const throw() { return format != RGB; }
  15262. virtual void clear (int x, int y, int w, int h,
  15263. const Colour& colourToClearTo = Colour (0x00000000));
  15264. virtual Image* createCopy (int newWidth = -1,
  15265. int newHeight = -1,
  15266. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15267. virtual Image* createCopyOfAlphaChannel() const;
  15268. virtual const Colour getPixelAt (int x, int y) const;
  15269. virtual void setPixelAt (int x, int y, const Colour& colour);
  15270. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15271. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15272. virtual void desaturate();
  15273. class BitmapData
  15274. {
  15275. public:
  15276. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15277. BitmapData (const Image& image, int x, int y, int w, int h);
  15278. ~BitmapData();
  15279. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15280. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15281. uint8* data;
  15282. int lineStride, pixelStride, width, height;
  15283. private:
  15284. BitmapData (const BitmapData&);
  15285. BitmapData& operator= (const BitmapData&);
  15286. };
  15287. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15288. const uint8* sourcePixelData, int sourceLineStride);
  15289. virtual void moveImageSection (int destX, int destY,
  15290. int sourceX, int sourceY,
  15291. int width, int height);
  15292. void createSolidAreaMask (RectangleList& result,
  15293. float alphaThreshold = 0.5f) const;
  15294. juce_UseDebuggingNewOperator
  15295. virtual LowLevelGraphicsContext* createLowLevelContext();
  15296. protected:
  15297. friend class BitmapData;
  15298. const PixelFormat format;
  15299. const int imageWidth, imageHeight;
  15300. Image (PixelFormat format,
  15301. int imageWidth,
  15302. int imageHeight);
  15303. int pixelStride, lineStride;
  15304. HeapBlock <uint8> imageDataAllocated;
  15305. uint8* imageData;
  15306. private:
  15307. Image& operator= (const Image&);
  15308. };
  15309. #endif // __JUCE_IMAGE_JUCEHEADER__
  15310. /*** End of inlined file: juce_Image.h ***/
  15311. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15312. public TimeSliceClient
  15313. {
  15314. public:
  15315. DirectoryContentsList (const FileFilter* const fileFilter,
  15316. TimeSliceThread& threadToUse);
  15317. ~DirectoryContentsList();
  15318. void setDirectory (const File& directory,
  15319. const bool includeDirectories,
  15320. const bool includeFiles);
  15321. const File& getDirectory() const;
  15322. void clear();
  15323. void refresh();
  15324. bool isStillLoading() const;
  15325. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15326. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15327. struct FileInfo
  15328. {
  15329. String filename;
  15330. int64 fileSize;
  15331. Time modificationTime;
  15332. Time creationTime;
  15333. bool isDirectory;
  15334. bool isReadOnly;
  15335. };
  15336. int getNumFiles() const;
  15337. bool getFileInfo (const int index,
  15338. FileInfo& resultInfo) const;
  15339. const File getFile (const int index) const;
  15340. const FileFilter* getFilter() const { return fileFilter; }
  15341. bool useTimeSlice();
  15342. TimeSliceThread& getTimeSliceThread() { return thread; }
  15343. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15344. const DirectoryContentsList::FileInfo* const second);
  15345. juce_UseDebuggingNewOperator
  15346. private:
  15347. File root;
  15348. const FileFilter* fileFilter;
  15349. TimeSliceThread& thread;
  15350. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15351. CriticalSection fileListLock;
  15352. OwnedArray <FileInfo> files;
  15353. void* volatile fileFindHandle;
  15354. bool volatile shouldStop;
  15355. void changed();
  15356. bool checkNextFile (bool& hasChanged);
  15357. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15358. const int64 fileSize, const Time& modTime,
  15359. const Time& creationTime, const bool isReadOnly);
  15360. DirectoryContentsList (const DirectoryContentsList&);
  15361. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15362. };
  15363. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15364. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15365. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15366. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15367. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15368. class JUCE_API FileBrowserListener
  15369. {
  15370. public:
  15371. virtual ~FileBrowserListener();
  15372. virtual void selectionChanged() = 0;
  15373. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15374. virtual void fileDoubleClicked (const File& file) = 0;
  15375. };
  15376. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15377. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15378. class JUCE_API DirectoryContentsDisplayComponent
  15379. {
  15380. public:
  15381. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15382. virtual ~DirectoryContentsDisplayComponent();
  15383. virtual int getNumSelectedFiles() const = 0;
  15384. virtual const File getSelectedFile (int index) const = 0;
  15385. virtual void scrollToTop() = 0;
  15386. void addListener (FileBrowserListener* const listener) throw();
  15387. void removeListener (FileBrowserListener* const listener) throw();
  15388. enum ColourIds
  15389. {
  15390. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15391. textColourId = 0x1000541, /**< The colour for the text. */
  15392. };
  15393. void sendSelectionChangeMessage();
  15394. void sendDoubleClickMessage (const File& file);
  15395. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15396. juce_UseDebuggingNewOperator
  15397. protected:
  15398. DirectoryContentsList& fileList;
  15399. ListenerList <FileBrowserListener> listeners;
  15400. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15401. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15402. };
  15403. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15404. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15405. #endif
  15406. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15407. #endif
  15408. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15409. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15410. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15411. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15412. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15413. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15414. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15415. class JUCE_API FilePreviewComponent : public Component
  15416. {
  15417. public:
  15418. FilePreviewComponent();
  15419. ~FilePreviewComponent();
  15420. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15421. juce_UseDebuggingNewOperator
  15422. private:
  15423. FilePreviewComponent (const FilePreviewComponent&);
  15424. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15425. };
  15426. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15427. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15428. class JUCE_API FileBrowserComponent : public Component,
  15429. public ChangeBroadcaster,
  15430. private FileBrowserListener,
  15431. private TextEditorListener,
  15432. private ButtonListener,
  15433. private ComboBoxListener,
  15434. private FileFilter
  15435. {
  15436. public:
  15437. enum FileChooserFlags
  15438. {
  15439. openMode = 1, /**< specifies that the component should allow the user to
  15440. choose an existing file with the intention of opening it. */
  15441. saveMode = 2, /**< specifies that the component should allow the user to specify
  15442. the name of a file that will be used to save something. */
  15443. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15444. conjunction with canSelectDirectories). */
  15445. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15446. conjuction with canSelectFiles). */
  15447. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15448. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15449. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15450. };
  15451. FileBrowserComponent (int flags,
  15452. const File& initialFileOrDirectory,
  15453. const FileFilter* fileFilter,
  15454. FilePreviewComponent* previewComp);
  15455. ~FileBrowserComponent();
  15456. int getNumSelectedFiles() const throw();
  15457. const File getSelectedFile (int index) const throw();
  15458. bool currentFileIsValid() const;
  15459. const File getHighlightedFile() const throw();
  15460. const File getRoot() const;
  15461. void setRoot (const File& newRootDirectory);
  15462. void goUp();
  15463. void refresh();
  15464. virtual const String getActionVerb() const;
  15465. bool isSaveMode() const throw();
  15466. void addListener (FileBrowserListener* const listener) throw();
  15467. void removeListener (FileBrowserListener* const listener) throw();
  15468. void resized();
  15469. void buttonClicked (Button* b);
  15470. void comboBoxChanged (ComboBox*);
  15471. void textEditorTextChanged (TextEditor& editor);
  15472. void textEditorReturnKeyPressed (TextEditor& editor);
  15473. void textEditorEscapeKeyPressed (TextEditor& editor);
  15474. void textEditorFocusLost (TextEditor& editor);
  15475. bool keyPressed (const KeyPress& key);
  15476. void selectionChanged();
  15477. void fileClicked (const File& f, const MouseEvent& e);
  15478. void fileDoubleClicked (const File& f);
  15479. bool isFileSuitable (const File& file) const;
  15480. bool isDirectorySuitable (const File&) const;
  15481. FilePreviewComponent* getPreviewComponent() const throw();
  15482. juce_UseDebuggingNewOperator
  15483. protected:
  15484. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15485. private:
  15486. ScopedPointer <DirectoryContentsList> fileList;
  15487. const FileFilter* fileFilter;
  15488. int flags;
  15489. File currentRoot;
  15490. Array<File> chosenFiles;
  15491. ListenerList <FileBrowserListener> listeners;
  15492. DirectoryContentsDisplayComponent* fileListComponent;
  15493. FilePreviewComponent* previewComp;
  15494. ComboBox* currentPathBox;
  15495. TextEditor* filenameBox;
  15496. Button* goUpButton;
  15497. TimeSliceThread thread;
  15498. void sendListenerChangeMessage();
  15499. bool isFileOrDirSuitable (const File& f) const;
  15500. FileBrowserComponent (const FileBrowserComponent&);
  15501. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15502. };
  15503. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15504. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15505. #endif
  15506. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15507. #endif
  15508. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15509. /*** Start of inlined file: juce_FileChooser.h ***/
  15510. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15511. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15512. class JUCE_API FileChooser
  15513. {
  15514. public:
  15515. FileChooser (const String& dialogBoxTitle,
  15516. const File& initialFileOrDirectory = File::nonexistent,
  15517. const String& filePatternsAllowed = String::empty,
  15518. const bool useOSNativeDialogBox = true);
  15519. ~FileChooser();
  15520. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15521. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15522. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15523. bool browseForDirectory();
  15524. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15525. const File getResult() const;
  15526. const Array<File>& getResults() const;
  15527. juce_UseDebuggingNewOperator
  15528. private:
  15529. String title, filters;
  15530. File startingFile;
  15531. Array<File> results;
  15532. bool useNativeDialogBox;
  15533. bool showDialog (const bool selectsDirectories,
  15534. const bool selectsFiles,
  15535. const bool isSave,
  15536. const bool warnAboutOverwritingExistingFiles,
  15537. const bool selectMultipleFiles,
  15538. FilePreviewComponent* const previewComponent);
  15539. static void showPlatformDialog (Array<File>& results,
  15540. const String& title,
  15541. const File& file,
  15542. const String& filters,
  15543. bool selectsDirectories,
  15544. bool selectsFiles,
  15545. bool isSave,
  15546. bool warnAboutOverwritingExistingFiles,
  15547. bool selectMultipleFiles,
  15548. FilePreviewComponent* previewComponent);
  15549. };
  15550. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15551. /*** End of inlined file: juce_FileChooser.h ***/
  15552. #endif
  15553. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15554. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15555. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15556. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15557. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15558. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15559. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15560. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15561. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15562. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15563. /*** Start of inlined file: juce_DropShadower.h ***/
  15564. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15565. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15566. class JUCE_API DropShadower : public ComponentListener
  15567. {
  15568. public:
  15569. DropShadower (const float alpha = 0.5f,
  15570. const int xOffset = 1,
  15571. const int yOffset = 5,
  15572. const float blurRadius = 10.0f);
  15573. virtual ~DropShadower();
  15574. void setOwner (Component* componentToFollow);
  15575. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15576. void componentBroughtToFront (Component& component);
  15577. void componentChildrenChanged (Component& component);
  15578. void componentParentHierarchyChanged (Component& component);
  15579. void componentVisibilityChanged (Component& component);
  15580. juce_UseDebuggingNewOperator
  15581. private:
  15582. Component* owner;
  15583. int numShadows;
  15584. Component* shadowWindows[4];
  15585. Image* shadowImageSections[12];
  15586. const int shadowEdge, xOffset, yOffset;
  15587. const float alpha, blurRadius;
  15588. bool inDestructor, reentrant;
  15589. void updateShadows();
  15590. void setShadowImage (Image* const src,
  15591. const int num,
  15592. const int w, const int h,
  15593. const int sx, const int sy);
  15594. void bringShadowWindowsToFront();
  15595. void deleteShadowWindows();
  15596. DropShadower (const DropShadower&);
  15597. DropShadower& operator= (const DropShadower&);
  15598. };
  15599. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15600. /*** End of inlined file: juce_DropShadower.h ***/
  15601. class JUCE_API TopLevelWindow : public Component
  15602. {
  15603. public:
  15604. TopLevelWindow (const String& name,
  15605. const bool addToDesktop);
  15606. ~TopLevelWindow();
  15607. bool isActiveWindow() const throw() { return windowIsActive_; }
  15608. void centreAroundComponent (Component* componentToCentreAround,
  15609. const int width, const int height);
  15610. void setDropShadowEnabled (const bool useShadow);
  15611. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15612. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15613. static int getNumTopLevelWindows() throw();
  15614. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15615. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15616. juce_UseDebuggingNewOperator
  15617. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15618. protected:
  15619. virtual void activeWindowStatusChanged();
  15620. void focusOfChildComponentChanged (FocusChangeType cause);
  15621. void parentHierarchyChanged();
  15622. void visibilityChanged();
  15623. virtual int getDesktopWindowStyleFlags() const;
  15624. void recreateDesktopWindow();
  15625. private:
  15626. friend class TopLevelWindowManager;
  15627. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15628. ScopedPointer <DropShadower> shadower;
  15629. void setWindowActive (const bool isNowActive) throw();
  15630. TopLevelWindow (const TopLevelWindow&);
  15631. TopLevelWindow& operator= (const TopLevelWindow&);
  15632. };
  15633. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15634. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15635. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15636. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15637. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15638. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15639. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15640. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15641. class JUCE_API ComponentBoundsConstrainer
  15642. {
  15643. public:
  15644. ComponentBoundsConstrainer() throw();
  15645. virtual ~ComponentBoundsConstrainer();
  15646. void setMinimumWidth (const int minimumWidth) throw();
  15647. int getMinimumWidth() const throw() { return minW; }
  15648. void setMaximumWidth (const int maximumWidth) throw();
  15649. int getMaximumWidth() const throw() { return maxW; }
  15650. void setMinimumHeight (const int minimumHeight) throw();
  15651. int getMinimumHeight() const throw() { return minH; }
  15652. void setMaximumHeight (const int maximumHeight) throw();
  15653. int getMaximumHeight() const throw() { return maxH; }
  15654. void setMinimumSize (const int minimumWidth,
  15655. const int minimumHeight) throw();
  15656. void setMaximumSize (const int maximumWidth,
  15657. const int maximumHeight) throw();
  15658. void setSizeLimits (const int minimumWidth,
  15659. const int minimumHeight,
  15660. const int maximumWidth,
  15661. const int maximumHeight) throw();
  15662. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15663. const int minimumWhenOffTheLeft,
  15664. const int minimumWhenOffTheBottom,
  15665. const int minimumWhenOffTheRight) throw();
  15666. void setFixedAspectRatio (const double widthOverHeight) throw();
  15667. double getFixedAspectRatio() const throw();
  15668. virtual void checkBounds (Rectangle<int>& bounds,
  15669. const Rectangle<int>& previousBounds,
  15670. const Rectangle<int>& limits,
  15671. const bool isStretchingTop,
  15672. const bool isStretchingLeft,
  15673. const bool isStretchingBottom,
  15674. const bool isStretchingRight);
  15675. virtual void resizeStart();
  15676. virtual void resizeEnd();
  15677. void setBoundsForComponent (Component* const component,
  15678. const Rectangle<int>& bounds,
  15679. const bool isStretchingTop,
  15680. const bool isStretchingLeft,
  15681. const bool isStretchingBottom,
  15682. const bool isStretchingRight);
  15683. void checkComponentBounds (Component* component);
  15684. virtual void applyBoundsToComponent (Component* component,
  15685. const Rectangle<int>& bounds);
  15686. juce_UseDebuggingNewOperator
  15687. private:
  15688. int minW, maxW, minH, maxH;
  15689. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15690. double aspectRatio;
  15691. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15692. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15693. };
  15694. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15695. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15696. class JUCE_API ComponentDragger
  15697. {
  15698. public:
  15699. ComponentDragger();
  15700. virtual ~ComponentDragger();
  15701. void startDraggingComponent (Component* const componentToDrag,
  15702. ComponentBoundsConstrainer* constrainer);
  15703. void dragComponent (Component* const componentToDrag,
  15704. const MouseEvent& e);
  15705. juce_UseDebuggingNewOperator
  15706. private:
  15707. ComponentBoundsConstrainer* constrainer;
  15708. Point<int> originalPos;
  15709. ComponentDragger (const ComponentDragger&);
  15710. ComponentDragger& operator= (const ComponentDragger&);
  15711. };
  15712. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15713. /*** End of inlined file: juce_ComponentDragger.h ***/
  15714. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15715. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15716. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15717. class JUCE_API ResizableBorderComponent : public Component
  15718. {
  15719. public:
  15720. ResizableBorderComponent (Component* const componentToResize,
  15721. ComponentBoundsConstrainer* const constrainer);
  15722. ~ResizableBorderComponent();
  15723. void setBorderThickness (const BorderSize& newBorderSize);
  15724. const BorderSize getBorderThickness() const;
  15725. juce_UseDebuggingNewOperator
  15726. protected:
  15727. void paint (Graphics& g);
  15728. void mouseEnter (const MouseEvent& e);
  15729. void mouseMove (const MouseEvent& e);
  15730. void mouseDown (const MouseEvent& e);
  15731. void mouseDrag (const MouseEvent& e);
  15732. void mouseUp (const MouseEvent& e);
  15733. bool hitTest (int x, int y);
  15734. private:
  15735. Component::SafePointer<Component> component;
  15736. ComponentBoundsConstrainer* constrainer;
  15737. BorderSize borderSize;
  15738. Rectangle<int> originalBounds;
  15739. int mouseZone;
  15740. void updateMouseZone (const MouseEvent& e);
  15741. ResizableBorderComponent (const ResizableBorderComponent&);
  15742. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15743. };
  15744. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15745. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15746. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15747. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15748. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15749. class JUCE_API ResizableCornerComponent : public Component
  15750. {
  15751. public:
  15752. ResizableCornerComponent (Component* const componentToResize,
  15753. ComponentBoundsConstrainer* const constrainer);
  15754. ~ResizableCornerComponent();
  15755. juce_UseDebuggingNewOperator
  15756. protected:
  15757. void paint (Graphics& g);
  15758. void mouseDown (const MouseEvent& e);
  15759. void mouseDrag (const MouseEvent& e);
  15760. void mouseUp (const MouseEvent& e);
  15761. bool hitTest (int x, int y);
  15762. private:
  15763. Component::SafePointer<Component> component;
  15764. ComponentBoundsConstrainer* constrainer;
  15765. Rectangle<int> originalBounds;
  15766. ResizableCornerComponent (const ResizableCornerComponent&);
  15767. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15768. };
  15769. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15770. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15771. class JUCE_API ResizableWindow : public TopLevelWindow
  15772. {
  15773. public:
  15774. ResizableWindow (const String& name,
  15775. const bool addToDesktop);
  15776. ResizableWindow (const String& name,
  15777. const Colour& backgroundColour,
  15778. const bool addToDesktop);
  15779. ~ResizableWindow();
  15780. const Colour getBackgroundColour() const throw();
  15781. void setBackgroundColour (const Colour& newColour);
  15782. void setResizable (const bool shouldBeResizable,
  15783. const bool useBottomRightCornerResizer);
  15784. bool isResizable() const throw();
  15785. void setResizeLimits (const int newMinimumWidth,
  15786. const int newMinimumHeight,
  15787. const int newMaximumWidth,
  15788. const int newMaximumHeight) throw();
  15789. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15790. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15791. void setBoundsConstrained (const Rectangle<int>& bounds);
  15792. bool isFullScreen() const;
  15793. void setFullScreen (const bool shouldBeFullScreen);
  15794. bool isMinimised() const;
  15795. void setMinimised (const bool shouldMinimise);
  15796. const String getWindowStateAsString();
  15797. bool restoreWindowStateFromString (const String& previousState);
  15798. Component* getContentComponent() const throw() { return contentComponent; }
  15799. void setContentComponent (Component* const newContentComponent,
  15800. const bool deleteOldOne = true,
  15801. const bool resizeToFit = false);
  15802. void setContentComponentSize (int width, int height);
  15803. enum ColourIds
  15804. {
  15805. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15806. };
  15807. juce_UseDebuggingNewOperator
  15808. protected:
  15809. void paint (Graphics& g);
  15810. void moved();
  15811. void resized();
  15812. void mouseDown (const MouseEvent& e);
  15813. void mouseDrag (const MouseEvent& e);
  15814. void lookAndFeelChanged();
  15815. void childBoundsChanged (Component* child);
  15816. void parentSizeChanged();
  15817. void visibilityChanged();
  15818. void activeWindowStatusChanged();
  15819. int getDesktopWindowStyleFlags() const;
  15820. virtual const BorderSize getBorderThickness();
  15821. virtual const BorderSize getContentComponentBorder();
  15822. #ifdef JUCE_DEBUG
  15823. void addChildComponent (Component* const child, int zOrder = -1);
  15824. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15825. #endif
  15826. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15827. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15828. private:
  15829. ScopedPointer <Component> contentComponent;
  15830. bool resizeToFitContent, fullscreen;
  15831. ComponentDragger dragger;
  15832. Rectangle<int> lastNonFullScreenPos;
  15833. ComponentBoundsConstrainer defaultConstrainer;
  15834. ComponentBoundsConstrainer* constrainer;
  15835. #ifdef JUCE_DEBUG
  15836. bool hasBeenResized;
  15837. #endif
  15838. void updateLastPos();
  15839. ResizableWindow (const ResizableWindow&);
  15840. ResizableWindow& operator= (const ResizableWindow&);
  15841. // (xxx remove these eventually)
  15842. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15843. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15844. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15845. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15846. };
  15847. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15848. /*** End of inlined file: juce_ResizableWindow.h ***/
  15849. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15850. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15851. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15852. class JUCE_API PositionedGlyph
  15853. {
  15854. public:
  15855. juce_wchar getCharacter() const { return character; }
  15856. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15857. float getLeft() const { return x; }
  15858. float getRight() const { return x + w; }
  15859. float getBaselineY() const { return y; }
  15860. float getTop() const { return y - font.getAscent(); }
  15861. float getBottom() const { return y + font.getDescent(); }
  15862. void moveBy (const float deltaX,
  15863. const float deltaY);
  15864. void draw (const Graphics& g) const;
  15865. void draw (const Graphics& g, const AffineTransform& transform) const;
  15866. void createPath (Path& path) const;
  15867. bool hitTest (float x, float y) const;
  15868. juce_UseDebuggingNewOperator
  15869. private:
  15870. friend class GlyphArrangement;
  15871. float x, y, w;
  15872. Font font;
  15873. juce_wchar character;
  15874. int glyph;
  15875. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  15876. PositionedGlyph (const PositionedGlyph& other);
  15877. };
  15878. class JUCE_API GlyphArrangement
  15879. {
  15880. public:
  15881. GlyphArrangement();
  15882. GlyphArrangement (const GlyphArrangement& other);
  15883. GlyphArrangement& operator= (const GlyphArrangement& other);
  15884. ~GlyphArrangement();
  15885. int getNumGlyphs() const { return glyphs.size(); }
  15886. PositionedGlyph& getGlyph (const int index) const;
  15887. void clear();
  15888. void addLineOfText (const Font& font,
  15889. const String& text,
  15890. const float x,
  15891. const float y);
  15892. void addCurtailedLineOfText (const Font& font,
  15893. const String& text,
  15894. float x,
  15895. const float y,
  15896. const float maxWidthPixels,
  15897. const bool useEllipsis);
  15898. void addJustifiedText (const Font& font,
  15899. const String& text,
  15900. float x, float y,
  15901. const float maxLineWidth,
  15902. const Justification& horizontalLayout);
  15903. void addFittedText (const Font& font,
  15904. const String& text,
  15905. const float x, const float y,
  15906. const float width, const float height,
  15907. const Justification& layout,
  15908. int maximumLinesToUse,
  15909. const float minimumHorizontalScale = 0.7f);
  15910. void addGlyphArrangement (const GlyphArrangement& other);
  15911. void draw (const Graphics& g) const;
  15912. void draw (const Graphics& g, const AffineTransform& transform) const;
  15913. void createPath (Path& path) const;
  15914. int findGlyphIndexAt (float x, float y) const;
  15915. void getBoundingBox (int startIndex,
  15916. int numGlyphs,
  15917. float& left,
  15918. float& top,
  15919. float& right,
  15920. float& bottom,
  15921. const bool includeWhitespace) const;
  15922. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15923. const float deltaX,
  15924. const float deltaY);
  15925. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15926. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15927. const float horizontalScaleFactor);
  15928. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15929. const float x,
  15930. const float y,
  15931. const float width,
  15932. const float height,
  15933. const Justification& justification);
  15934. juce_UseDebuggingNewOperator
  15935. private:
  15936. OwnedArray <PositionedGlyph> glyphs;
  15937. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15938. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15939. const Justification& justification, float minimumHorizontalScale);
  15940. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15941. };
  15942. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15943. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15944. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15945. public ButtonListener,
  15946. public FileBrowserListener
  15947. {
  15948. public:
  15949. FileChooserDialogBox (const String& title,
  15950. const String& instructions,
  15951. FileBrowserComponent& browserComponent,
  15952. const bool warnAboutOverwritingExistingFiles,
  15953. const Colour& backgroundColour);
  15954. ~FileChooserDialogBox();
  15955. bool show (int width = 0,int height = 0);
  15956. enum ColourIds
  15957. {
  15958. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15959. };
  15960. void buttonClicked (Button* button);
  15961. void closeButtonPressed();
  15962. void selectionChanged();
  15963. void fileClicked (const File& file, const MouseEvent& e);
  15964. void fileDoubleClicked (const File& file);
  15965. juce_UseDebuggingNewOperator
  15966. private:
  15967. class ContentComponent : public Component
  15968. {
  15969. public:
  15970. ContentComponent();
  15971. ~ContentComponent();
  15972. void paint (Graphics& g);
  15973. void resized();
  15974. String instructions;
  15975. GlyphArrangement text;
  15976. FileBrowserComponent* chooserComponent;
  15977. FilePreviewComponent* previewComponent;
  15978. TextButton* okButton;
  15979. TextButton* cancelButton;
  15980. };
  15981. ContentComponent* content;
  15982. const bool warnAboutOverwritingExistingFiles;
  15983. FileChooserDialogBox (const FileChooserDialogBox&);
  15984. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15985. };
  15986. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15987. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15988. #endif
  15989. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15990. #endif
  15991. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15992. /*** Start of inlined file: juce_FileListComponent.h ***/
  15993. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15994. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15995. class JUCE_API FileListComponent : public ListBox,
  15996. public DirectoryContentsDisplayComponent,
  15997. private ListBoxModel,
  15998. private ChangeListener
  15999. {
  16000. public:
  16001. FileListComponent (DirectoryContentsList& listToShow);
  16002. ~FileListComponent();
  16003. int getNumSelectedFiles() const;
  16004. const File getSelectedFile (int index = 0) const;
  16005. void scrollToTop();
  16006. void changeListenerCallback (void*);
  16007. int getNumRows();
  16008. void paintListBoxItem (int, Graphics&, int, int, bool);
  16009. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16010. void selectedRowsChanged (int lastRowSelected);
  16011. void deleteKeyPressed (int currentSelectedRow);
  16012. void returnKeyPressed (int currentSelectedRow);
  16013. juce_UseDebuggingNewOperator
  16014. private:
  16015. FileListComponent (const FileListComponent&);
  16016. FileListComponent& operator= (const FileListComponent&);
  16017. File lastDirectory;
  16018. };
  16019. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16020. /*** End of inlined file: juce_FileListComponent.h ***/
  16021. #endif
  16022. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16023. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16024. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16025. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16026. class FilenameComponent;
  16027. class JUCE_API FilenameComponentListener
  16028. {
  16029. public:
  16030. virtual ~FilenameComponentListener() {}
  16031. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16032. };
  16033. class JUCE_API FilenameComponent : public Component,
  16034. public SettableTooltipClient,
  16035. public FileDragAndDropTarget,
  16036. private AsyncUpdater,
  16037. private ButtonListener,
  16038. private ComboBoxListener
  16039. {
  16040. public:
  16041. FilenameComponent (const String& name,
  16042. const File& currentFile,
  16043. const bool canEditFilename,
  16044. const bool isDirectory,
  16045. const bool isForSaving,
  16046. const String& fileBrowserWildcard,
  16047. const String& enforcedSuffix,
  16048. const String& textWhenNothingSelected);
  16049. ~FilenameComponent();
  16050. const File getCurrentFile() const;
  16051. void setCurrentFile (File newFile,
  16052. const bool addToRecentlyUsedList,
  16053. const bool sendChangeNotification = true);
  16054. void setFilenameIsEditable (const bool shouldBeEditable);
  16055. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16056. const StringArray getRecentlyUsedFilenames() const;
  16057. void setRecentlyUsedFilenames (const StringArray& filenames);
  16058. void addRecentlyUsedFile (const File& file);
  16059. void setMaxNumberOfRecentFiles (const int newMaximum);
  16060. void setBrowseButtonText (const String& browseButtonText);
  16061. void addListener (FilenameComponentListener* const listener) throw();
  16062. void removeListener (FilenameComponentListener* const listener) throw();
  16063. void setTooltip (const String& newTooltip);
  16064. void paintOverChildren (Graphics& g);
  16065. void resized();
  16066. void lookAndFeelChanged();
  16067. bool isInterestedInFileDrag (const StringArray& files);
  16068. void filesDropped (const StringArray& files, int, int);
  16069. void fileDragEnter (const StringArray& files, int, int);
  16070. void fileDragExit (const StringArray& files);
  16071. juce_UseDebuggingNewOperator
  16072. private:
  16073. ComboBox* filenameBox;
  16074. String lastFilename;
  16075. Button* browseButton;
  16076. int maxRecentFiles;
  16077. bool isDir, isSaving, isFileDragOver;
  16078. String wildcard, enforcedSuffix, browseButtonText;
  16079. ListenerList <FilenameComponentListener> listeners;
  16080. File defaultBrowseFile;
  16081. void comboBoxChanged (ComboBox*);
  16082. void buttonClicked (Button* button);
  16083. void handleAsyncUpdate();
  16084. FilenameComponent (const FilenameComponent&);
  16085. FilenameComponent& operator= (const FilenameComponent&);
  16086. };
  16087. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16088. /*** End of inlined file: juce_FilenameComponent.h ***/
  16089. #endif
  16090. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16091. #endif
  16092. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16093. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16094. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16095. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16096. class JUCE_API FileSearchPathListComponent : public Component,
  16097. public SettableTooltipClient,
  16098. public FileDragAndDropTarget,
  16099. private ButtonListener,
  16100. private ListBoxModel
  16101. {
  16102. public:
  16103. FileSearchPathListComponent();
  16104. ~FileSearchPathListComponent();
  16105. const FileSearchPath& getPath() const throw() { return path; }
  16106. void setPath (const FileSearchPath& newPath);
  16107. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16108. enum ColourIds
  16109. {
  16110. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16111. Make this transparent if you don't want the background to be filled. */
  16112. };
  16113. int getNumRows();
  16114. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16115. void deleteKeyPressed (int lastRowSelected);
  16116. void returnKeyPressed (int lastRowSelected);
  16117. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16118. void selectedRowsChanged (int lastRowSelected);
  16119. void resized();
  16120. void paint (Graphics& g);
  16121. bool isInterestedInFileDrag (const StringArray& files);
  16122. void filesDropped (const StringArray& files, int, int);
  16123. void buttonClicked (Button* button);
  16124. juce_UseDebuggingNewOperator
  16125. private:
  16126. FileSearchPath path;
  16127. File defaultBrowseTarget;
  16128. ListBox* listBox;
  16129. Button* addButton;
  16130. Button* removeButton;
  16131. Button* changeButton;
  16132. Button* upButton;
  16133. Button* downButton;
  16134. void changed() throw();
  16135. void updateButtons() throw();
  16136. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16137. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16138. };
  16139. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16140. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16141. #endif
  16142. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16143. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16144. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16145. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16146. class JUCE_API FileTreeComponent : public TreeView,
  16147. public DirectoryContentsDisplayComponent
  16148. {
  16149. public:
  16150. FileTreeComponent (DirectoryContentsList& listToShow);
  16151. ~FileTreeComponent();
  16152. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16153. const File getSelectedFile (int index = 0) const;
  16154. void scrollToTop();
  16155. void setDragAndDropDescription (const String& description) throw();
  16156. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16157. juce_UseDebuggingNewOperator
  16158. private:
  16159. String dragAndDropDescription;
  16160. FileTreeComponent (const FileTreeComponent&);
  16161. FileTreeComponent& operator= (const FileTreeComponent&);
  16162. };
  16163. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16164. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16165. #endif
  16166. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16167. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16168. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16169. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16170. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16171. private Timer
  16172. {
  16173. public:
  16174. ImagePreviewComponent();
  16175. ~ImagePreviewComponent();
  16176. void selectedFileChanged (const File& newSelectedFile);
  16177. void paint (Graphics& g);
  16178. void timerCallback();
  16179. juce_UseDebuggingNewOperator
  16180. private:
  16181. File fileToLoad;
  16182. ScopedPointer <Image> currentThumbnail;
  16183. String currentDetails;
  16184. void getThumbSize (int& w, int& h) const;
  16185. ImagePreviewComponent (const ImagePreviewComponent&);
  16186. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16187. };
  16188. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16189. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16190. #endif
  16191. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16192. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16193. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16194. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16195. class JUCE_API WildcardFileFilter : public FileFilter
  16196. {
  16197. public:
  16198. WildcardFileFilter (const String& fileWildcardPatterns,
  16199. const String& directoryWildcardPatterns,
  16200. const String& description);
  16201. ~WildcardFileFilter();
  16202. bool isFileSuitable (const File& file) const;
  16203. bool isDirectorySuitable (const File& file) const;
  16204. juce_UseDebuggingNewOperator
  16205. private:
  16206. StringArray fileWildcards, directoryWildcards;
  16207. static void parse (const String& pattern, StringArray& result) throw();
  16208. static bool match (const File& file, const StringArray& wildcards) throw();
  16209. };
  16210. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16211. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16212. #endif
  16213. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16214. #endif
  16215. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16216. #endif
  16217. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16218. #endif
  16219. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16220. #endif
  16221. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16222. #endif
  16223. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16224. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16225. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16226. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16227. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16228. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16229. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16230. class JUCE_API KeyPressMappingSet : public KeyListener,
  16231. public ChangeBroadcaster,
  16232. public FocusChangeListener
  16233. {
  16234. public:
  16235. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16236. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16237. ~KeyPressMappingSet();
  16238. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16239. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16240. void addKeyPress (const CommandID commandID,
  16241. const KeyPress& newKeyPress,
  16242. int insertIndex = -1) throw();
  16243. void resetToDefaultMappings() throw();
  16244. void resetToDefaultMapping (const CommandID commandID) throw();
  16245. void clearAllKeyPresses() throw();
  16246. void clearAllKeyPresses (const CommandID commandID) throw();
  16247. void removeKeyPress (const CommandID commandID,
  16248. const int keyPressIndex) throw();
  16249. void removeKeyPress (const KeyPress& keypress) throw();
  16250. bool containsMapping (const CommandID commandID,
  16251. const KeyPress& keyPress) const throw();
  16252. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16253. bool restoreFromXml (const XmlElement& xmlVersion);
  16254. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16255. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16256. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16257. void globalFocusChanged (Component* focusedComponent);
  16258. juce_UseDebuggingNewOperator
  16259. private:
  16260. ApplicationCommandManager* commandManager;
  16261. struct CommandMapping
  16262. {
  16263. CommandID commandID;
  16264. Array <KeyPress> keypresses;
  16265. bool wantsKeyUpDownCallbacks;
  16266. };
  16267. OwnedArray <CommandMapping> mappings;
  16268. struct KeyPressTime
  16269. {
  16270. KeyPress key;
  16271. uint32 timeWhenPressed;
  16272. };
  16273. OwnedArray <KeyPressTime> keysDown;
  16274. void handleMessage (const Message& message);
  16275. void invokeCommand (const CommandID commandID,
  16276. const KeyPress& keyPress,
  16277. const bool isKeyDown,
  16278. const int millisecsSinceKeyPressed,
  16279. Component* const originatingComponent) const;
  16280. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16281. };
  16282. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16283. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16284. class JUCE_API KeyMappingEditorComponent : public Component,
  16285. public TreeViewItem,
  16286. public ChangeListener,
  16287. private ButtonListener
  16288. {
  16289. public:
  16290. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16291. const bool showResetToDefaultButton);
  16292. virtual ~KeyMappingEditorComponent();
  16293. void setColours (const Colour& mainBackground,
  16294. const Colour& textColour);
  16295. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16296. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16297. virtual bool isCommandReadOnly (const CommandID commandID);
  16298. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16299. enum ColourIds
  16300. {
  16301. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16302. textColourId = 0x100ad01, /**< The colour for the text. */
  16303. };
  16304. void parentHierarchyChanged();
  16305. void resized();
  16306. void changeListenerCallback (void*);
  16307. bool mightContainSubItems();
  16308. const String getUniqueName() const;
  16309. void buttonClicked (Button* button);
  16310. juce_UseDebuggingNewOperator
  16311. private:
  16312. KeyPressMappingSet* mappings;
  16313. TreeView* tree;
  16314. friend class KeyMappingTreeViewItem;
  16315. friend class KeyCategoryTreeViewItem;
  16316. friend class KeyMappingItemComponent;
  16317. friend class KeyMappingChangeButton;
  16318. TextButton* resetButton;
  16319. void assignNewKey (const CommandID commandID, int index);
  16320. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16321. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16322. };
  16323. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16324. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16325. #endif
  16326. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16327. #endif
  16328. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16329. #endif
  16330. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16331. #endif
  16332. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16333. #endif
  16334. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16335. #endif
  16336. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16337. #endif
  16338. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16339. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16340. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16341. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16342. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16343. {
  16344. public:
  16345. ComponentMovementWatcher (Component* const component);
  16346. ~ComponentMovementWatcher();
  16347. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16348. virtual void componentPeerChanged() = 0;
  16349. juce_UseDebuggingNewOperator
  16350. void componentParentHierarchyChanged (Component& component);
  16351. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16352. private:
  16353. Component::SafePointer<Component> component;
  16354. ComponentPeer* lastPeer;
  16355. VoidArray registeredParentComps;
  16356. bool reentrant;
  16357. Rectangle<int> lastBounds;
  16358. void unregister() throw();
  16359. void registerWithParentComps() throw();
  16360. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16361. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16362. };
  16363. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16364. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16365. #endif
  16366. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16367. /*** Start of inlined file: juce_GroupComponent.h ***/
  16368. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16369. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16370. class JUCE_API GroupComponent : public Component
  16371. {
  16372. public:
  16373. GroupComponent (const String& componentName,
  16374. const String& labelText);
  16375. ~GroupComponent();
  16376. void setText (const String& newText) throw();
  16377. const String getText() const throw();
  16378. void setTextLabelPosition (const Justification& justification);
  16379. const Justification getTextLabelPosition() const throw() { return justification; }
  16380. enum ColourIds
  16381. {
  16382. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16383. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16384. };
  16385. void paint (Graphics& g);
  16386. void enablementChanged();
  16387. void colourChanged();
  16388. private:
  16389. String text;
  16390. Justification justification;
  16391. GroupComponent (const GroupComponent&);
  16392. GroupComponent& operator= (const GroupComponent&);
  16393. };
  16394. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16395. /*** End of inlined file: juce_GroupComponent.h ***/
  16396. #endif
  16397. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16398. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16399. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16400. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16401. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16402. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16403. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16404. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16405. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16406. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16407. class TabbedButtonBar;
  16408. class JUCE_API TabBarButton : public Button
  16409. {
  16410. public:
  16411. TabBarButton (const String& name,
  16412. TabbedButtonBar* const ownerBar,
  16413. const int tabIndex);
  16414. ~TabBarButton();
  16415. virtual int getBestTabLength (const int depth);
  16416. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16417. void clicked (const ModifierKeys& mods);
  16418. bool hitTest (int x, int y);
  16419. juce_UseDebuggingNewOperator
  16420. protected:
  16421. friend class TabbedButtonBar;
  16422. TabbedButtonBar* const owner;
  16423. int tabIndex, overlapPixels;
  16424. DropShadowEffect shadow;
  16425. void getActiveArea (int& x, int& y, int& w, int& h);
  16426. private:
  16427. TabBarButton (const TabBarButton&);
  16428. TabBarButton& operator= (const TabBarButton&);
  16429. };
  16430. class JUCE_API TabbedButtonBar : public Component,
  16431. public ChangeBroadcaster,
  16432. public ButtonListener
  16433. {
  16434. public:
  16435. enum Orientation
  16436. {
  16437. TabsAtTop,
  16438. TabsAtBottom,
  16439. TabsAtLeft,
  16440. TabsAtRight
  16441. };
  16442. TabbedButtonBar (const Orientation orientation);
  16443. ~TabbedButtonBar();
  16444. void setOrientation (const Orientation orientation);
  16445. Orientation getOrientation() const throw() { return orientation; }
  16446. void clearTabs();
  16447. void addTab (const String& tabName,
  16448. const Colour& tabBackgroundColour,
  16449. int insertIndex = -1);
  16450. void setTabName (const int tabIndex,
  16451. const String& newName);
  16452. void removeTab (const int tabIndex);
  16453. void moveTab (const int currentIndex,
  16454. const int newIndex);
  16455. int getNumTabs() const;
  16456. const StringArray getTabNames() const;
  16457. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16458. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16459. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16460. TabBarButton* getTabButton (const int index) const;
  16461. virtual void currentTabChanged (const int newCurrentTabIndex,
  16462. const String& newCurrentTabName);
  16463. virtual void popupMenuClickOnTab (const int tabIndex,
  16464. const String& tabName);
  16465. const Colour getTabBackgroundColour (const int tabIndex);
  16466. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16467. enum ColourIds
  16468. {
  16469. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16470. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16471. the look and feel will choose an appropriate colour. */
  16472. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16473. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16474. this isn't specified, the look and feel will choose an appropriate
  16475. colour. */
  16476. };
  16477. void resized();
  16478. void buttonClicked (Button* button);
  16479. void lookAndFeelChanged();
  16480. juce_UseDebuggingNewOperator
  16481. protected:
  16482. virtual TabBarButton* createTabButton (const String& tabName,
  16483. const int tabIndex);
  16484. private:
  16485. Orientation orientation;
  16486. StringArray tabs;
  16487. Array <Colour> tabColours;
  16488. int currentTabIndex;
  16489. Component* behindFrontTab;
  16490. Button* extraTabsButton;
  16491. TabbedButtonBar (const TabbedButtonBar&);
  16492. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16493. };
  16494. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16495. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16496. class JUCE_API TabbedComponent : public Component
  16497. {
  16498. public:
  16499. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16500. ~TabbedComponent();
  16501. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16502. TabbedButtonBar::Orientation getOrientation() const throw();
  16503. void setTabBarDepth (const int newDepth);
  16504. int getTabBarDepth() const throw() { return tabDepth; }
  16505. void setOutline (const int newThickness);
  16506. void setIndent (const int indentThickness);
  16507. void clearTabs();
  16508. void addTab (const String& tabName,
  16509. const Colour& tabBackgroundColour,
  16510. Component* const contentComponent,
  16511. const bool deleteComponentWhenNotNeeded,
  16512. const int insertIndex = -1);
  16513. void setTabName (const int tabIndex,
  16514. const String& newName);
  16515. void removeTab (const int tabIndex);
  16516. int getNumTabs() const;
  16517. const StringArray getTabNames() const;
  16518. Component* getTabContentComponent (const int tabIndex) const throw();
  16519. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16520. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16521. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16522. int getCurrentTabIndex() const;
  16523. const String& getCurrentTabName() const;
  16524. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16525. virtual void currentTabChanged (const int newCurrentTabIndex,
  16526. const String& newCurrentTabName);
  16527. virtual void popupMenuClickOnTab (const int tabIndex,
  16528. const String& tabName);
  16529. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16530. enum ColourIds
  16531. {
  16532. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16533. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16534. (See setOutline) */
  16535. };
  16536. void paint (Graphics& g);
  16537. void resized();
  16538. void lookAndFeelChanged();
  16539. juce_UseDebuggingNewOperator
  16540. protected:
  16541. TabbedButtonBar* tabs;
  16542. virtual TabBarButton* createTabButton (const String& tabName,
  16543. const int tabIndex);
  16544. private:
  16545. Array <Component*> contentComponents;
  16546. Component* panelComponent;
  16547. int tabDepth;
  16548. int outlineThickness, edgeIndent;
  16549. friend class TabCompButtonBar;
  16550. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16551. TabbedComponent (const TabbedComponent&);
  16552. TabbedComponent& operator= (const TabbedComponent&);
  16553. };
  16554. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16555. /*** End of inlined file: juce_TabbedComponent.h ***/
  16556. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16557. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16558. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16559. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16560. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16561. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16562. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16563. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16564. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16565. class MenuBarModel;
  16566. class JUCE_API MenuBarModelListener
  16567. {
  16568. public:
  16569. virtual ~MenuBarModelListener() {}
  16570. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16571. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16572. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16573. };
  16574. class JUCE_API MenuBarModel : private AsyncUpdater,
  16575. private ApplicationCommandManagerListener
  16576. {
  16577. public:
  16578. MenuBarModel() throw();
  16579. virtual ~MenuBarModel();
  16580. void menuItemsChanged();
  16581. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16582. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16583. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16584. virtual const StringArray getMenuBarNames() = 0;
  16585. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16586. const String& menuName) = 0;
  16587. virtual void menuItemSelected (int menuItemID,
  16588. int topLevelMenuIndex) = 0;
  16589. #if JUCE_MAC || DOXYGEN
  16590. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16591. const PopupMenu* extraAppleMenuItems = 0);
  16592. static MenuBarModel* getMacMainMenu();
  16593. #endif
  16594. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16595. void applicationCommandListChanged();
  16596. void handleAsyncUpdate();
  16597. juce_UseDebuggingNewOperator
  16598. private:
  16599. ApplicationCommandManager* manager;
  16600. ListenerList <MenuBarModelListener> listeners;
  16601. MenuBarModel (const MenuBarModel&);
  16602. MenuBarModel& operator= (const MenuBarModel&);
  16603. };
  16604. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16605. /*** End of inlined file: juce_MenuBarModel.h ***/
  16606. class JUCE_API MenuBarComponent : public Component,
  16607. private MenuBarModelListener,
  16608. private Timer
  16609. {
  16610. public:
  16611. MenuBarComponent (MenuBarModel* const model);
  16612. ~MenuBarComponent();
  16613. void setModel (MenuBarModel* const newModel);
  16614. void showMenu (const int menuIndex);
  16615. void paint (Graphics& g);
  16616. void resized();
  16617. void mouseEnter (const MouseEvent& e);
  16618. void mouseExit (const MouseEvent& e);
  16619. void mouseDown (const MouseEvent& e);
  16620. void mouseDrag (const MouseEvent& e);
  16621. void mouseUp (const MouseEvent& e);
  16622. void mouseMove (const MouseEvent& e);
  16623. void inputAttemptWhenModal();
  16624. void handleCommandMessage (int commandId);
  16625. bool keyPressed (const KeyPress& key);
  16626. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16627. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16628. const ApplicationCommandTarget::InvocationInfo& info);
  16629. juce_UseDebuggingNewOperator
  16630. private:
  16631. MenuBarModel* model;
  16632. StringArray menuNames;
  16633. Array <int> xPositions;
  16634. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16635. int lastMouseX, lastMouseY;
  16636. bool inModalState;
  16637. ScopedPointer <Component> currentPopup;
  16638. int getItemAt (int x, int y);
  16639. void updateItemUnderMouse (const int x, const int y);
  16640. void hideCurrentMenu();
  16641. void timerCallback();
  16642. void repaintMenuItem (int index);
  16643. MenuBarComponent (const MenuBarComponent&);
  16644. MenuBarComponent& operator= (const MenuBarComponent&);
  16645. };
  16646. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16647. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16648. class JUCE_API DocumentWindow : public ResizableWindow
  16649. {
  16650. public:
  16651. enum TitleBarButtons
  16652. {
  16653. minimiseButton = 1,
  16654. maximiseButton = 2,
  16655. closeButton = 4,
  16656. allButtons = 7
  16657. };
  16658. DocumentWindow (const String& name,
  16659. const Colour& backgroundColour,
  16660. const int requiredButtons,
  16661. const bool addToDesktop = true);
  16662. ~DocumentWindow();
  16663. void setName (const String& newName);
  16664. void setIcon (const Image* imageToUse);
  16665. void setTitleBarHeight (const int newHeight);
  16666. int getTitleBarHeight() const;
  16667. void setTitleBarButtonsRequired (const int requiredButtons,
  16668. const bool positionTitleBarButtonsOnLeft);
  16669. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16670. void setMenuBar (MenuBarModel* menuBarModel,
  16671. const int menuBarHeight = 0);
  16672. virtual void closeButtonPressed();
  16673. virtual void minimiseButtonPressed();
  16674. virtual void maximiseButtonPressed();
  16675. Button* getCloseButton() const throw();
  16676. Button* getMinimiseButton() const throw();
  16677. Button* getMaximiseButton() const throw();
  16678. enum ColourIds
  16679. {
  16680. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16681. and feel class how this is used. */
  16682. };
  16683. void paint (Graphics& g);
  16684. void resized();
  16685. void lookAndFeelChanged();
  16686. const BorderSize getBorderThickness();
  16687. const BorderSize getContentComponentBorder();
  16688. void mouseDoubleClick (const MouseEvent& e);
  16689. void userTriedToCloseWindow();
  16690. void activeWindowStatusChanged();
  16691. int getDesktopWindowStyleFlags() const;
  16692. void parentHierarchyChanged();
  16693. const Rectangle<int> getTitleBarArea();
  16694. juce_UseDebuggingNewOperator
  16695. private:
  16696. int titleBarHeight, menuBarHeight, requiredButtons;
  16697. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16698. ScopedPointer <Button> titleBarButtons [3];
  16699. ScopedPointer <Image> titleBarIcon;
  16700. ScopedPointer <MenuBarComponent> menuBar;
  16701. MenuBarModel* menuBarModel;
  16702. class ButtonListenerProxy;
  16703. friend class ScopedPointer <ButtonListenerProxy>;
  16704. ScopedPointer <ButtonListenerProxy> buttonListener;
  16705. void repaintTitleBar();
  16706. DocumentWindow (const DocumentWindow&);
  16707. DocumentWindow& operator= (const DocumentWindow&);
  16708. };
  16709. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16710. /*** End of inlined file: juce_DocumentWindow.h ***/
  16711. class MultiDocumentPanel;
  16712. class MDITabbedComponentInternal;
  16713. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16714. {
  16715. public:
  16716. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16717. ~MultiDocumentPanelWindow();
  16718. void maximiseButtonPressed();
  16719. void closeButtonPressed();
  16720. void activeWindowStatusChanged();
  16721. void broughtToFront();
  16722. juce_UseDebuggingNewOperator
  16723. private:
  16724. void updateOrder();
  16725. MultiDocumentPanel* getOwner() const throw();
  16726. };
  16727. class JUCE_API MultiDocumentPanel : public Component,
  16728. private ComponentListener
  16729. {
  16730. public:
  16731. MultiDocumentPanel();
  16732. ~MultiDocumentPanel();
  16733. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16734. bool addDocument (Component* const component,
  16735. const Colour& backgroundColour,
  16736. const bool deleteWhenRemoved);
  16737. bool closeDocument (Component* component,
  16738. const bool checkItsOkToCloseFirst);
  16739. int getNumDocuments() const throw();
  16740. Component* getDocument (const int index) const throw();
  16741. Component* getActiveDocument() const throw();
  16742. void setActiveDocument (Component* component);
  16743. virtual void activeDocumentChanged();
  16744. void setMaximumNumDocuments (const int maximumNumDocuments);
  16745. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16746. bool isFullscreenWhenOneDocument() const throw();
  16747. enum LayoutMode
  16748. {
  16749. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16750. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16751. };
  16752. void setLayoutMode (const LayoutMode newLayoutMode);
  16753. LayoutMode getLayoutMode() const throw() { return mode; }
  16754. void setBackgroundColour (const Colour& newBackgroundColour);
  16755. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16756. virtual bool tryToCloseDocument (Component* component) = 0;
  16757. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16758. void paint (Graphics& g);
  16759. void resized();
  16760. void componentNameChanged (Component&);
  16761. juce_UseDebuggingNewOperator
  16762. private:
  16763. LayoutMode mode;
  16764. Array <Component*> components;
  16765. TabbedComponent* tabComponent;
  16766. Colour backgroundColour;
  16767. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16768. friend class MultiDocumentPanelWindow;
  16769. friend class MDITabbedComponentInternal;
  16770. Component* getContainerComp (Component* c) const;
  16771. void updateOrder();
  16772. void addWindow (Component* component);
  16773. };
  16774. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16775. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16776. #endif
  16777. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16778. #endif
  16779. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16780. #endif
  16781. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16782. #endif
  16783. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16784. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16785. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16786. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16787. class JUCE_API StretchableLayoutManager
  16788. {
  16789. public:
  16790. StretchableLayoutManager();
  16791. ~StretchableLayoutManager();
  16792. void setItemLayout (const int itemIndex,
  16793. const double minimumSize,
  16794. const double maximumSize,
  16795. const double preferredSize);
  16796. bool getItemLayout (const int itemIndex,
  16797. double& minimumSize,
  16798. double& maximumSize,
  16799. double& preferredSize) const;
  16800. void clearAllItems();
  16801. void layOutComponents (Component** const components,
  16802. int numComponents,
  16803. int x, int y, int width, int height,
  16804. const bool vertically,
  16805. const bool resizeOtherDimension);
  16806. int getItemCurrentPosition (const int itemIndex) const;
  16807. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16808. double getItemCurrentRelativeSize (const int itemIndex) const;
  16809. void setItemPosition (const int itemIndex,
  16810. int newPosition);
  16811. juce_UseDebuggingNewOperator
  16812. private:
  16813. struct ItemLayoutProperties
  16814. {
  16815. int itemIndex;
  16816. int currentSize;
  16817. double minSize, maxSize, preferredSize;
  16818. };
  16819. OwnedArray <ItemLayoutProperties> items;
  16820. int totalSize;
  16821. static int sizeToRealSize (double size, int totalSpace);
  16822. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16823. void setTotalSize (const int newTotalSize);
  16824. int fitComponentsIntoSpace (const int startIndex,
  16825. const int endIndex,
  16826. const int availableSpace,
  16827. int startPos);
  16828. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16829. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16830. void updatePrefSizesToMatchCurrentPositions();
  16831. StretchableLayoutManager (const StretchableLayoutManager&);
  16832. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16833. };
  16834. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16835. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16836. #endif
  16837. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16838. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16839. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16840. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16841. class JUCE_API StretchableLayoutResizerBar : public Component
  16842. {
  16843. public:
  16844. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16845. const int itemIndexInLayout,
  16846. const bool isBarVertical);
  16847. ~StretchableLayoutResizerBar();
  16848. virtual void hasBeenMoved();
  16849. void paint (Graphics& g);
  16850. void mouseDown (const MouseEvent& e);
  16851. void mouseDrag (const MouseEvent& e);
  16852. juce_UseDebuggingNewOperator
  16853. private:
  16854. StretchableLayoutManager* layout;
  16855. int itemIndex, mouseDownPos;
  16856. bool isVertical;
  16857. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16858. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16859. };
  16860. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16861. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16862. #endif
  16863. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16864. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16865. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16866. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16867. class StretchableObjectResizer
  16868. {
  16869. public:
  16870. StretchableObjectResizer();
  16871. ~StretchableObjectResizer();
  16872. void addItem (const double currentSize,
  16873. const double minSize,
  16874. const double maxSize,
  16875. const int order = 0);
  16876. void resizeToFit (const double targetSize);
  16877. int getNumItems() const throw() { return items.size(); }
  16878. double getItemSize (const int index) const throw();
  16879. juce_UseDebuggingNewOperator
  16880. private:
  16881. struct Item
  16882. {
  16883. double size;
  16884. double minSize;
  16885. double maxSize;
  16886. int order;
  16887. };
  16888. OwnedArray <Item> items;
  16889. StretchableObjectResizer (const StretchableObjectResizer&);
  16890. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16891. };
  16892. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16893. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16894. #endif
  16895. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16896. #endif
  16897. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16898. #endif
  16899. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16900. #endif
  16901. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16902. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16903. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16904. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16905. /*** Start of inlined file: juce_AlertWindow.h ***/
  16906. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16907. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16908. /*** Start of inlined file: juce_TextLayout.h ***/
  16909. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16910. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16911. class Graphics;
  16912. class JUCE_API TextLayout
  16913. {
  16914. public:
  16915. TextLayout() throw();
  16916. TextLayout (const TextLayout& other) throw();
  16917. TextLayout (const String& text, const Font& font) throw();
  16918. ~TextLayout() throw();
  16919. TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16920. void clear() throw();
  16921. void appendText (const String& textToAppend,
  16922. const Font& fontToUse) throw();
  16923. void setText (const String& newText,
  16924. const Font& fontToUse) throw();
  16925. void layout (int maximumWidth,
  16926. const Justification& justification,
  16927. const bool attemptToBalanceLineLengths) throw();
  16928. int getWidth() const throw();
  16929. int getHeight() const throw();
  16930. int getNumLines() const throw() { return totalLines; }
  16931. int getLineWidth (const int lineNumber) const throw();
  16932. void draw (Graphics& g,
  16933. const int topLeftX,
  16934. const int topLeftY) const throw();
  16935. void drawWithin (Graphics& g,
  16936. int x, int y, int w, int h,
  16937. const Justification& layoutFlags) const throw();
  16938. juce_UseDebuggingNewOperator
  16939. private:
  16940. class Token;
  16941. friend class OwnedArray <Token>;
  16942. OwnedArray <Token> tokens;
  16943. int totalLines;
  16944. };
  16945. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16946. /*** End of inlined file: juce_TextLayout.h ***/
  16947. class JUCE_API AlertWindow : public TopLevelWindow,
  16948. private ButtonListener
  16949. {
  16950. public:
  16951. enum AlertIconType
  16952. {
  16953. NoIcon, /**< No icon will be shown on the dialog box. */
  16954. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16955. user to answer a question. */
  16956. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16957. warning about something and shouldn't be ignored. */
  16958. InfoIcon /**< An icon that indicates that the dialog box is just
  16959. giving the user some information, which doesn't require
  16960. a response from them. */
  16961. };
  16962. AlertWindow (const String& title,
  16963. const String& message,
  16964. AlertIconType iconType,
  16965. Component* associatedComponent = 0);
  16966. ~AlertWindow();
  16967. AlertIconType getAlertType() const throw() { return alertIconType; }
  16968. void setMessage (const String& message);
  16969. void addButton (const String& name,
  16970. const int returnValue,
  16971. const KeyPress& shortcutKey1 = KeyPress(),
  16972. const KeyPress& shortcutKey2 = KeyPress());
  16973. int getNumButtons() const;
  16974. void addTextEditor (const String& name,
  16975. const String& initialContents,
  16976. const String& onScreenLabel = String::empty,
  16977. const bool isPasswordBox = false);
  16978. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16979. void addComboBox (const String& name,
  16980. const StringArray& items,
  16981. const String& onScreenLabel = String::empty);
  16982. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16983. void addTextBlock (const String& text);
  16984. void addProgressBarComponent (double& progressValue);
  16985. void addCustomComponent (Component* const component);
  16986. int getNumCustomComponents() const;
  16987. Component* getCustomComponent (const int index) const;
  16988. Component* removeCustomComponent (const int index);
  16989. bool containsAnyExtraComponents() const;
  16990. // easy-to-use message box functions:
  16991. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16992. const String& title,
  16993. const String& message,
  16994. const String& buttonText = String::empty,
  16995. Component* associatedComponent = 0);
  16996. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16997. const String& title,
  16998. const String& message,
  16999. const String& button1Text = String::empty,
  17000. const String& button2Text = String::empty,
  17001. Component* associatedComponent = 0);
  17002. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17003. const String& title,
  17004. const String& message,
  17005. const String& button1Text = String::empty,
  17006. const String& button2Text = String::empty,
  17007. const String& button3Text = String::empty,
  17008. Component* associatedComponent = 0);
  17009. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17010. const String& bodyText,
  17011. bool isOkCancel);
  17012. enum ColourIds
  17013. {
  17014. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17015. textColourId = 0x1001810, /**< The colour for the text. */
  17016. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17017. };
  17018. juce_UseDebuggingNewOperator
  17019. protected:
  17020. void paint (Graphics& g);
  17021. void mouseDown (const MouseEvent& e);
  17022. void mouseDrag (const MouseEvent& e);
  17023. bool keyPressed (const KeyPress& key);
  17024. void buttonClicked (Button* button);
  17025. void lookAndFeelChanged();
  17026. void userTriedToCloseWindow();
  17027. int getDesktopWindowStyleFlags() const;
  17028. private:
  17029. String text;
  17030. TextLayout textLayout;
  17031. AlertIconType alertIconType;
  17032. ComponentBoundsConstrainer constrainer;
  17033. ComponentDragger dragger;
  17034. Rectangle<int> textArea;
  17035. VoidArray buttons, textBoxes, comboBoxes;
  17036. VoidArray progressBars, customComps, textBlocks, allComps;
  17037. StringArray textboxNames, comboBoxNames;
  17038. Font font;
  17039. Component* associatedComponent;
  17040. void updateLayout (const bool onlyIncreaseSize);
  17041. // disable copy constructor
  17042. AlertWindow (const AlertWindow&);
  17043. AlertWindow& operator= (const AlertWindow&);
  17044. };
  17045. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17046. /*** End of inlined file: juce_AlertWindow.h ***/
  17047. class ToggleButton;
  17048. class TextButton;
  17049. class AlertWindow;
  17050. class TextLayout;
  17051. class ScrollBar;
  17052. class BubbleComponent;
  17053. class ComboBox;
  17054. class Button;
  17055. class FilenameComponent;
  17056. class DocumentWindow;
  17057. class ResizableWindow;
  17058. class GroupComponent;
  17059. class MenuBarComponent;
  17060. class DropShadower;
  17061. class GlyphArrangement;
  17062. class PropertyComponent;
  17063. class TableHeaderComponent;
  17064. class Toolbar;
  17065. class ToolbarItemComponent;
  17066. class PopupMenu;
  17067. class ProgressBar;
  17068. class FileBrowserComponent;
  17069. class DirectoryContentsDisplayComponent;
  17070. class FilePreviewComponent;
  17071. class ImageButton;
  17072. class JUCE_API LookAndFeel
  17073. {
  17074. public:
  17075. LookAndFeel();
  17076. virtual ~LookAndFeel();
  17077. static LookAndFeel& getDefaultLookAndFeel() throw();
  17078. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17079. const Colour findColour (const int colourId) const throw();
  17080. void setColour (const int colourId, const Colour& colour) throw();
  17081. bool isColourSpecified (const int colourId) const throw();
  17082. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17083. void setDefaultSansSerifTypefaceName (const String& newName);
  17084. virtual const MouseCursor getMouseCursorFor (Component& component);
  17085. virtual void drawButtonBackground (Graphics& g,
  17086. Button& button,
  17087. const Colour& backgroundColour,
  17088. bool isMouseOverButton,
  17089. bool isButtonDown);
  17090. virtual const Font getFontForTextButton (TextButton& button);
  17091. virtual void drawButtonText (Graphics& g,
  17092. TextButton& button,
  17093. bool isMouseOverButton,
  17094. bool isButtonDown);
  17095. virtual void drawToggleButton (Graphics& g,
  17096. ToggleButton& button,
  17097. bool isMouseOverButton,
  17098. bool isButtonDown);
  17099. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17100. virtual void drawTickBox (Graphics& g,
  17101. Component& component,
  17102. float x, float y, float w, float h,
  17103. const bool ticked,
  17104. const bool isEnabled,
  17105. const bool isMouseOverButton,
  17106. const bool isButtonDown);
  17107. virtual AlertWindow* createAlertWindow (const String& title,
  17108. const String& message,
  17109. const String& button1,
  17110. const String& button2,
  17111. const String& button3,
  17112. AlertWindow::AlertIconType iconType,
  17113. int numButtons,
  17114. Component* associatedComponent);
  17115. virtual void drawAlertBox (Graphics& g,
  17116. AlertWindow& alert,
  17117. const Rectangle<int>& textArea,
  17118. TextLayout& textLayout);
  17119. virtual int getAlertBoxWindowFlags();
  17120. virtual int getAlertWindowButtonHeight();
  17121. virtual const Font getAlertWindowFont();
  17122. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17123. int width, int height,
  17124. double progress, const String& textToShow);
  17125. // Draws a small image that spins to indicate that something's happening..
  17126. // This method should use the current time to animate itself, so just keep
  17127. // repainting it every so often.
  17128. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17129. int x, int y, int w, int h);
  17130. virtual void drawScrollbarButton (Graphics& g,
  17131. ScrollBar& scrollbar,
  17132. int width, int height,
  17133. int buttonDirection,
  17134. bool isScrollbarVertical,
  17135. bool isMouseOverButton,
  17136. bool isButtonDown);
  17137. virtual void drawScrollbar (Graphics& g,
  17138. ScrollBar& scrollbar,
  17139. int x, int y,
  17140. int width, int height,
  17141. bool isScrollbarVertical,
  17142. int thumbStartPosition,
  17143. int thumbSize,
  17144. bool isMouseOver,
  17145. bool isMouseDown);
  17146. virtual ImageEffectFilter* getScrollbarEffect();
  17147. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17148. virtual int getDefaultScrollbarWidth();
  17149. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17150. virtual const Path getTickShape (const float height);
  17151. virtual const Path getCrossShape (const float height);
  17152. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17153. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17154. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17155. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17156. virtual Image* getDefaultFolderImage();
  17157. virtual Image* getDefaultDocumentFileImage();
  17158. virtual void createFileChooserHeaderText (const String& title,
  17159. const String& instructions,
  17160. GlyphArrangement& destArrangement,
  17161. int width);
  17162. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17163. const String& filename, Image* icon,
  17164. const String& fileSizeDescription,
  17165. const String& fileTimeDescription,
  17166. const bool isDirectory,
  17167. const bool isItemSelected,
  17168. const int itemIndex);
  17169. virtual Button* createFileBrowserGoUpButton();
  17170. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17171. DirectoryContentsDisplayComponent* fileListComponent,
  17172. FilePreviewComponent* previewComp,
  17173. ComboBox* currentPathBox,
  17174. TextEditor* filenameBox,
  17175. Button* goUpButton);
  17176. virtual void drawBubble (Graphics& g,
  17177. float tipX, float tipY,
  17178. float boxX, float boxY, float boxW, float boxH);
  17179. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17180. virtual void drawPopupMenuItem (Graphics& g,
  17181. int width, int height,
  17182. const bool isSeparator,
  17183. const bool isActive,
  17184. const bool isHighlighted,
  17185. const bool isTicked,
  17186. const bool hasSubMenu,
  17187. const String& text,
  17188. const String& shortcutKeyText,
  17189. Image* image,
  17190. const Colour* const textColour);
  17191. virtual const Font getPopupMenuFont();
  17192. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17193. int width, int height,
  17194. bool isScrollUpArrow);
  17195. virtual void getIdealPopupMenuItemSize (const String& text,
  17196. const bool isSeparator,
  17197. int standardMenuItemHeight,
  17198. int& idealWidth,
  17199. int& idealHeight);
  17200. virtual int getMenuWindowFlags();
  17201. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17202. bool isMouseOverBar,
  17203. MenuBarComponent& menuBar);
  17204. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17205. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17206. virtual void drawMenuBarItem (Graphics& g,
  17207. int width, int height,
  17208. int itemIndex,
  17209. const String& itemText,
  17210. bool isMouseOverItem,
  17211. bool isMenuOpen,
  17212. bool isMouseOverBar,
  17213. MenuBarComponent& menuBar);
  17214. virtual void drawComboBox (Graphics& g, int width, int height,
  17215. const bool isButtonDown,
  17216. int buttonX, int buttonY,
  17217. int buttonW, int buttonH,
  17218. ComboBox& box);
  17219. virtual const Font getComboBoxFont (ComboBox& box);
  17220. virtual Label* createComboBoxTextBox (ComboBox& box);
  17221. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17222. virtual void drawLabel (Graphics& g, Label& label);
  17223. virtual void drawLinearSlider (Graphics& g,
  17224. int x, int y,
  17225. int width, int height,
  17226. float sliderPos,
  17227. float minSliderPos,
  17228. float maxSliderPos,
  17229. const Slider::SliderStyle style,
  17230. Slider& slider);
  17231. virtual void drawLinearSliderBackground (Graphics& g,
  17232. int x, int y,
  17233. int width, int height,
  17234. float sliderPos,
  17235. float minSliderPos,
  17236. float maxSliderPos,
  17237. const Slider::SliderStyle style,
  17238. Slider& slider);
  17239. virtual void drawLinearSliderThumb (Graphics& g,
  17240. int x, int y,
  17241. int width, int height,
  17242. float sliderPos,
  17243. float minSliderPos,
  17244. float maxSliderPos,
  17245. const Slider::SliderStyle style,
  17246. Slider& slider);
  17247. virtual int getSliderThumbRadius (Slider& slider);
  17248. virtual void drawRotarySlider (Graphics& g,
  17249. int x, int y,
  17250. int width, int height,
  17251. float sliderPosProportional,
  17252. const float rotaryStartAngle,
  17253. const float rotaryEndAngle,
  17254. Slider& slider);
  17255. virtual Button* createSliderButton (const bool isIncrement);
  17256. virtual Label* createSliderTextBox (Slider& slider);
  17257. virtual ImageEffectFilter* getSliderEffect();
  17258. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17259. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17260. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17261. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17262. ComboBox* filenameBox, Button* browseButton);
  17263. virtual void drawCornerResizer (Graphics& g,
  17264. int w, int h,
  17265. bool isMouseOver,
  17266. bool isMouseDragging);
  17267. virtual void drawResizableFrame (Graphics& g,
  17268. int w, int h,
  17269. const BorderSize& borders);
  17270. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17271. const BorderSize& border,
  17272. ResizableWindow& window);
  17273. virtual void drawResizableWindowBorder (Graphics& g,
  17274. int w, int h,
  17275. const BorderSize& border,
  17276. ResizableWindow& window);
  17277. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17278. Graphics& g, int w, int h,
  17279. int titleSpaceX, int titleSpaceW,
  17280. const Image* icon,
  17281. bool drawTitleTextOnLeft);
  17282. virtual Button* createDocumentWindowButton (int buttonType);
  17283. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17284. int titleBarX, int titleBarY,
  17285. int titleBarW, int titleBarH,
  17286. Button* minimiseButton,
  17287. Button* maximiseButton,
  17288. Button* closeButton,
  17289. bool positionTitleBarButtonsOnLeft);
  17290. virtual int getDefaultMenuBarHeight();
  17291. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17292. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17293. int w, int h,
  17294. bool isVerticalBar,
  17295. bool isMouseOver,
  17296. bool isMouseDragging);
  17297. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17298. const String& text,
  17299. const Justification& position,
  17300. GroupComponent& group);
  17301. virtual void createTabButtonShape (Path& p,
  17302. int width, int height,
  17303. int tabIndex,
  17304. const String& text,
  17305. Button& button,
  17306. TabbedButtonBar::Orientation orientation,
  17307. const bool isMouseOver,
  17308. const bool isMouseDown,
  17309. const bool isFrontTab);
  17310. virtual void fillTabButtonShape (Graphics& g,
  17311. const Path& path,
  17312. const Colour& preferredBackgroundColour,
  17313. int tabIndex,
  17314. const String& text,
  17315. Button& button,
  17316. TabbedButtonBar::Orientation orientation,
  17317. const bool isMouseOver,
  17318. const bool isMouseDown,
  17319. const bool isFrontTab);
  17320. virtual void drawTabButtonText (Graphics& g,
  17321. int x, int y, int w, int h,
  17322. const Colour& preferredBackgroundColour,
  17323. int tabIndex,
  17324. const String& text,
  17325. Button& button,
  17326. TabbedButtonBar::Orientation orientation,
  17327. const bool isMouseOver,
  17328. const bool isMouseDown,
  17329. const bool isFrontTab);
  17330. virtual int getTabButtonOverlap (int tabDepth);
  17331. virtual int getTabButtonSpaceAroundImage();
  17332. virtual int getTabButtonBestWidth (int tabIndex,
  17333. const String& text,
  17334. int tabDepth,
  17335. Button& button);
  17336. virtual void drawTabButton (Graphics& g,
  17337. int w, int h,
  17338. const Colour& preferredColour,
  17339. int tabIndex,
  17340. const String& text,
  17341. Button& button,
  17342. TabbedButtonBar::Orientation orientation,
  17343. const bool isMouseOver,
  17344. const bool isMouseDown,
  17345. const bool isFrontTab);
  17346. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17347. int w, int h,
  17348. TabbedButtonBar& tabBar,
  17349. TabbedButtonBar::Orientation orientation);
  17350. virtual Button* createTabBarExtrasButton();
  17351. virtual void drawImageButton (Graphics& g, Image* image,
  17352. int imageX, int imageY, int imageW, int imageH,
  17353. const Colour& overlayColour,
  17354. float imageOpacity,
  17355. ImageButton& button);
  17356. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17357. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17358. int width, int height,
  17359. bool isMouseOver, bool isMouseDown,
  17360. int columnFlags);
  17361. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17362. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17363. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17364. bool isMouseOver, bool isMouseDown,
  17365. ToolbarItemComponent& component);
  17366. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17367. const String& text, ToolbarItemComponent& component);
  17368. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17369. bool isOpen, int width, int height);
  17370. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17371. PropertyComponent& component);
  17372. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17373. PropertyComponent& component);
  17374. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17375. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17376. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17377. virtual void playAlertSound();
  17378. static void drawGlassSphere (Graphics& g,
  17379. const float x, const float y,
  17380. const float diameter,
  17381. const Colour& colour,
  17382. const float outlineThickness) throw();
  17383. static void drawGlassPointer (Graphics& g,
  17384. const float x, const float y,
  17385. const float diameter,
  17386. const Colour& colour, const float outlineThickness,
  17387. const int direction) throw();
  17388. static void drawGlassLozenge (Graphics& g,
  17389. const float x, const float y,
  17390. const float width, const float height,
  17391. const Colour& colour,
  17392. const float outlineThickness,
  17393. const float cornerSize,
  17394. const bool flatOnLeft, const bool flatOnRight,
  17395. const bool flatOnTop, const bool flatOnBottom) throw();
  17396. juce_UseDebuggingNewOperator
  17397. private:
  17398. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17399. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17400. Array <int> colourIds;
  17401. Array <Colour> colours;
  17402. // default typeface names
  17403. String defaultSans, defaultSerif, defaultFixed;
  17404. void drawShinyButtonShape (Graphics& g,
  17405. float x, float y, float w, float h, float maxCornerSize,
  17406. const Colour& baseColour,
  17407. const float strokeWidth,
  17408. const bool flatOnLeft,
  17409. const bool flatOnRight,
  17410. const bool flatOnTop,
  17411. const bool flatOnBottom) throw();
  17412. LookAndFeel (const LookAndFeel&);
  17413. LookAndFeel& operator= (const LookAndFeel&);
  17414. };
  17415. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17416. /*** End of inlined file: juce_LookAndFeel.h ***/
  17417. #endif
  17418. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17419. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17420. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17421. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17422. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17423. {
  17424. public:
  17425. OldSchoolLookAndFeel();
  17426. virtual ~OldSchoolLookAndFeel();
  17427. virtual void drawButtonBackground (Graphics& g,
  17428. Button& button,
  17429. const Colour& backgroundColour,
  17430. bool isMouseOverButton,
  17431. bool isButtonDown);
  17432. virtual void drawToggleButton (Graphics& g,
  17433. ToggleButton& button,
  17434. bool isMouseOverButton,
  17435. bool isButtonDown);
  17436. virtual void drawTickBox (Graphics& g,
  17437. Component& component,
  17438. float x, float y, float w, float h,
  17439. const bool ticked,
  17440. const bool isEnabled,
  17441. const bool isMouseOverButton,
  17442. const bool isButtonDown);
  17443. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17444. int width, int height,
  17445. double progress, const String& textToShow);
  17446. virtual void drawScrollbarButton (Graphics& g,
  17447. ScrollBar& scrollbar,
  17448. int width, int height,
  17449. int buttonDirection,
  17450. bool isScrollbarVertical,
  17451. bool isMouseOverButton,
  17452. bool isButtonDown);
  17453. virtual void drawScrollbar (Graphics& g,
  17454. ScrollBar& scrollbar,
  17455. int x, int y,
  17456. int width, int height,
  17457. bool isScrollbarVertical,
  17458. int thumbStartPosition,
  17459. int thumbSize,
  17460. bool isMouseOver,
  17461. bool isMouseDown);
  17462. virtual ImageEffectFilter* getScrollbarEffect();
  17463. virtual void drawTextEditorOutline (Graphics& g,
  17464. int width, int height,
  17465. TextEditor& textEditor);
  17466. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17467. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17468. bool isMouseOverBar,
  17469. MenuBarComponent& menuBar);
  17470. virtual void drawComboBox (Graphics& g, int width, int height,
  17471. const bool isButtonDown,
  17472. int buttonX, int buttonY,
  17473. int buttonW, int buttonH,
  17474. ComboBox& box);
  17475. virtual const Font getComboBoxFont (ComboBox& box);
  17476. virtual void drawLinearSlider (Graphics& g,
  17477. int x, int y,
  17478. int width, int height,
  17479. float sliderPos,
  17480. float minSliderPos,
  17481. float maxSliderPos,
  17482. const Slider::SliderStyle style,
  17483. Slider& slider);
  17484. virtual int getSliderThumbRadius (Slider& slider);
  17485. virtual Button* createSliderButton (const bool isIncrement);
  17486. virtual ImageEffectFilter* getSliderEffect();
  17487. virtual void drawCornerResizer (Graphics& g,
  17488. int w, int h,
  17489. bool isMouseOver,
  17490. bool isMouseDragging);
  17491. virtual Button* createDocumentWindowButton (int buttonType);
  17492. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17493. int titleBarX, int titleBarY,
  17494. int titleBarW, int titleBarH,
  17495. Button* minimiseButton,
  17496. Button* maximiseButton,
  17497. Button* closeButton,
  17498. bool positionTitleBarButtonsOnLeft);
  17499. juce_UseDebuggingNewOperator
  17500. private:
  17501. DropShadowEffect scrollbarShadow;
  17502. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17503. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17504. };
  17505. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17506. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17507. #endif
  17508. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17509. #endif
  17510. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17511. #endif
  17512. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17513. #endif
  17514. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17515. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17516. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17517. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17518. class JUCE_API PopupMenuCustomComponent : public Component,
  17519. public ReferenceCountedObject
  17520. {
  17521. public:
  17522. ~PopupMenuCustomComponent();
  17523. virtual void getIdealSize (int& idealWidth,
  17524. int& idealHeight) = 0;
  17525. void triggerMenuItem();
  17526. bool isItemHighlighted() const throw() { return isHighlighted; }
  17527. protected:
  17528. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17529. private:
  17530. friend class PopupMenu;
  17531. friend class PopupMenu::ItemComponent;
  17532. friend class PopupMenu::Window;
  17533. bool isHighlighted, isTriggeredAutomatically;
  17534. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17535. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17536. };
  17537. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17538. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17539. #endif
  17540. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17541. #endif
  17542. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17543. #endif
  17544. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17545. #endif
  17546. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17547. #endif
  17548. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17549. /*** Start of inlined file: juce_LassoComponent.h ***/
  17550. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17551. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17552. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17553. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17554. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17555. template <class SelectableItemType>
  17556. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17557. {
  17558. public:
  17559. SelectedItemSet()
  17560. {
  17561. }
  17562. SelectedItemSet (const Array <SelectableItemType>& items)
  17563. : selectedItems (items)
  17564. {
  17565. }
  17566. SelectedItemSet (const SelectedItemSet& other)
  17567. : selectedItems (other.selectedItems)
  17568. {
  17569. }
  17570. SelectedItemSet& operator= (const SelectedItemSet& other)
  17571. {
  17572. if (selectedItems != other.selectedItems)
  17573. {
  17574. selectedItems = other.selectedItems;
  17575. changed();
  17576. }
  17577. return *this;
  17578. }
  17579. ~SelectedItemSet()
  17580. {
  17581. }
  17582. void selectOnly (SelectableItemType item)
  17583. {
  17584. if (isSelected (item))
  17585. {
  17586. for (int i = selectedItems.size(); --i >= 0;)
  17587. {
  17588. if (selectedItems.getUnchecked(i) != item)
  17589. {
  17590. deselect (selectedItems.getUnchecked(i));
  17591. i = jmin (i, selectedItems.size());
  17592. }
  17593. }
  17594. }
  17595. else
  17596. {
  17597. deselectAll();
  17598. changed();
  17599. selectedItems.add (item);
  17600. itemSelected (item);
  17601. }
  17602. }
  17603. void addToSelection (SelectableItemType item)
  17604. {
  17605. if (! isSelected (item))
  17606. {
  17607. changed();
  17608. selectedItems.add (item);
  17609. itemSelected (item);
  17610. }
  17611. }
  17612. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17613. const ModifierKeys& modifiers)
  17614. {
  17615. if (modifiers.isShiftDown())
  17616. {
  17617. addToSelection (item);
  17618. }
  17619. else if (modifiers.isCommandDown())
  17620. {
  17621. if (isSelected (item))
  17622. deselect (item);
  17623. else
  17624. addToSelection (item);
  17625. }
  17626. else
  17627. {
  17628. selectOnly (item);
  17629. }
  17630. }
  17631. bool addToSelectionOnMouseDown (SelectableItemType item,
  17632. const ModifierKeys& modifiers)
  17633. {
  17634. if (isSelected (item))
  17635. {
  17636. return ! modifiers.isPopupMenu();
  17637. }
  17638. else
  17639. {
  17640. addToSelectionBasedOnModifiers (item, modifiers);
  17641. return false;
  17642. }
  17643. }
  17644. void addToSelectionOnMouseUp (SelectableItemType item,
  17645. const ModifierKeys& modifiers,
  17646. const bool wasItemDragged,
  17647. const bool resultOfMouseDownSelectMethod)
  17648. {
  17649. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17650. addToSelectionBasedOnModifiers (item, modifiers);
  17651. }
  17652. void deselect (SelectableItemType item)
  17653. {
  17654. const int i = selectedItems.indexOf (item);
  17655. if (i >= 0)
  17656. {
  17657. changed();
  17658. itemDeselected (selectedItems.remove (i));
  17659. }
  17660. }
  17661. void deselectAll()
  17662. {
  17663. if (selectedItems.size() > 0)
  17664. {
  17665. changed();
  17666. for (int i = selectedItems.size(); --i >= 0;)
  17667. {
  17668. itemDeselected (selectedItems.remove (i));
  17669. i = jmin (i, selectedItems.size());
  17670. }
  17671. }
  17672. }
  17673. int getNumSelected() const throw()
  17674. {
  17675. return selectedItems.size();
  17676. }
  17677. SelectableItemType getSelectedItem (const int index) const throw()
  17678. {
  17679. return selectedItems [index];
  17680. }
  17681. bool isSelected (const SelectableItemType item) const throw()
  17682. {
  17683. return selectedItems.contains (item);
  17684. }
  17685. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17686. virtual void itemSelected (SelectableItemType item) {}
  17687. virtual void itemDeselected (SelectableItemType item) {}
  17688. void changed (const bool synchronous = false)
  17689. {
  17690. if (synchronous)
  17691. sendSynchronousChangeMessage (this);
  17692. else
  17693. sendChangeMessage (this);
  17694. }
  17695. juce_UseDebuggingNewOperator
  17696. private:
  17697. Array <SelectableItemType> selectedItems;
  17698. };
  17699. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17700. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17701. template <class SelectableItemType>
  17702. class LassoSource
  17703. {
  17704. public:
  17705. virtual ~LassoSource() {}
  17706. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17707. int x, int y, int width, int height) = 0;
  17708. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17709. };
  17710. template <class SelectableItemType>
  17711. class LassoComponent : public Component
  17712. {
  17713. public:
  17714. LassoComponent (const int outlineThickness_ = 1)
  17715. : source (0),
  17716. outlineThickness (outlineThickness_)
  17717. {
  17718. }
  17719. ~LassoComponent()
  17720. {
  17721. }
  17722. void beginLasso (const MouseEvent& e,
  17723. LassoSource <SelectableItemType>* const lassoSource)
  17724. {
  17725. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17726. jassert (lassoSource != 0); // the source can't be null!
  17727. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17728. source = lassoSource;
  17729. if (lassoSource != 0)
  17730. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17731. setSize (0, 0);
  17732. }
  17733. void dragLasso (const MouseEvent& e)
  17734. {
  17735. if (source != 0)
  17736. {
  17737. const int x1 = e.getMouseDownX();
  17738. const int y1 = e.getMouseDownY();
  17739. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17740. setVisible (true);
  17741. Array <SelectableItemType> itemsInLasso;
  17742. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17743. if (e.mods.isShiftDown())
  17744. {
  17745. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17746. itemsInLasso.addArray (originalSelection);
  17747. }
  17748. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17749. {
  17750. Array <SelectableItemType> originalMinusNew (originalSelection);
  17751. originalMinusNew.removeValuesIn (itemsInLasso);
  17752. itemsInLasso.removeValuesIn (originalSelection);
  17753. itemsInLasso.addArray (originalMinusNew);
  17754. }
  17755. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17756. }
  17757. }
  17758. void endLasso()
  17759. {
  17760. source = 0;
  17761. originalSelection.clear();
  17762. setVisible (false);
  17763. }
  17764. enum ColourIds
  17765. {
  17766. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17767. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17768. };
  17769. void paint (Graphics& g)
  17770. {
  17771. g.fillAll (findColour (lassoFillColourId));
  17772. g.setColour (findColour (lassoOutlineColourId));
  17773. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17774. // this suggests that you've left a lasso comp lying around after the
  17775. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17776. // mouse-up event.
  17777. jassert (isMouseButtonDownAnywhere());
  17778. }
  17779. bool hitTest (int x, int y) { return false; }
  17780. juce_UseDebuggingNewOperator
  17781. private:
  17782. Array <SelectableItemType> originalSelection;
  17783. LassoSource <SelectableItemType>* source;
  17784. int outlineThickness;
  17785. };
  17786. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17787. /*** End of inlined file: juce_LassoComponent.h ***/
  17788. #endif
  17789. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17790. #endif
  17791. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17792. #endif
  17793. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17794. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17795. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17796. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17797. class JUCE_API MouseHoverDetector
  17798. {
  17799. public:
  17800. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17801. virtual ~MouseHoverDetector();
  17802. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17803. void setHoverComponent (Component* const newSourceComponent);
  17804. protected:
  17805. virtual void mouseHovered (int mouseX,
  17806. int mouseY) = 0;
  17807. virtual void mouseMovedAfterHover() = 0;
  17808. private:
  17809. class JUCE_API HoverDetectorInternal : public MouseListener,
  17810. public Timer
  17811. {
  17812. public:
  17813. MouseHoverDetector* owner;
  17814. int lastX, lastY;
  17815. void timerCallback();
  17816. void mouseEnter (const MouseEvent&);
  17817. void mouseExit (const MouseEvent&);
  17818. void mouseDown (const MouseEvent&);
  17819. void mouseUp (const MouseEvent&);
  17820. void mouseMove (const MouseEvent&);
  17821. void mouseWheelMove (const MouseEvent&, float, float);
  17822. } internalTimer;
  17823. friend class HoverDetectorInternal;
  17824. Component* source;
  17825. int hoverTimeMillisecs;
  17826. bool hasJustHovered;
  17827. void hoverTimerCallback();
  17828. void checkJustHoveredCallback();
  17829. MouseHoverDetector (const MouseHoverDetector&);
  17830. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17831. };
  17832. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17833. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17834. #endif
  17835. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17836. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17837. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17838. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17839. class Component;
  17840. class ComponentPeer;
  17841. class MouseInputSourceInternal;
  17842. class JUCE_API MouseInputSource
  17843. {
  17844. public:
  17845. MouseInputSource (int index, bool isMouseDevice);
  17846. ~MouseInputSource();
  17847. bool isMouse() const;
  17848. bool isTouch() const;
  17849. bool canHover() const;
  17850. bool hasMouseWheel() const;
  17851. int getIndex() const;
  17852. bool isDragging() const;
  17853. const Point<int> getScreenPosition() const;
  17854. const ModifierKeys getCurrentModifiers() const;
  17855. Component* getComponentUnderMouse() const;
  17856. void triggerFakeMove() const;
  17857. int getNumberOfMultipleClicks() const throw();
  17858. const Time getLastMouseDownTime() const throw();
  17859. const Point<int> getLastMouseDownPosition() const throw();
  17860. bool hasMouseMovedSignificantlySincePressed() const throw();
  17861. bool hasMouseCursor() const throw();
  17862. void showMouseCursor (const MouseCursor& cursor);
  17863. void hideCursor();
  17864. void revealCursor();
  17865. void forceMouseCursorUpdate();
  17866. bool canDoUnboundedMovement() const throw();
  17867. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17868. juce_UseDebuggingNewOperator
  17869. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17870. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17871. private:
  17872. friend class Desktop;
  17873. friend class ComponentPeer;
  17874. friend class MouseInputSourceInternal;
  17875. ScopedPointer<MouseInputSourceInternal> pimpl;
  17876. MouseInputSource (const MouseInputSource&);
  17877. MouseInputSource& operator= (const MouseInputSource&);
  17878. };
  17879. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17880. /*** End of inlined file: juce_MouseInputSource.h ***/
  17881. #endif
  17882. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17883. #endif
  17884. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17885. #endif
  17886. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17887. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17888. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17889. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17890. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17891. private ButtonListener
  17892. {
  17893. protected:
  17894. BooleanPropertyComponent (const String& propertyName,
  17895. const String& buttonTextWhenTrue,
  17896. const String& buttonTextWhenFalse);
  17897. public:
  17898. BooleanPropertyComponent (const Value& valueToControl,
  17899. const String& propertyName,
  17900. const String& buttonText);
  17901. ~BooleanPropertyComponent();
  17902. virtual void setState (const bool newState);
  17903. virtual bool getState() const;
  17904. void paint (Graphics& g);
  17905. void refresh();
  17906. void buttonClicked (Button*);
  17907. juce_UseDebuggingNewOperator
  17908. private:
  17909. ToggleButton* button;
  17910. String onText, offText;
  17911. void createButton();
  17912. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17913. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17914. };
  17915. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17916. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17917. #endif
  17918. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17919. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17920. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17921. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17922. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17923. private ButtonListener
  17924. {
  17925. public:
  17926. ButtonPropertyComponent (const String& propertyName,
  17927. const bool triggerOnMouseDown);
  17928. ~ButtonPropertyComponent();
  17929. virtual void buttonClicked() = 0;
  17930. virtual const String getButtonText() const = 0;
  17931. void refresh();
  17932. void buttonClicked (Button*);
  17933. juce_UseDebuggingNewOperator
  17934. private:
  17935. TextButton* button;
  17936. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17937. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17938. };
  17939. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17940. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17941. #endif
  17942. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17943. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17944. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17945. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17946. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17947. private ComboBoxListener
  17948. {
  17949. protected:
  17950. ChoicePropertyComponent (const String& propertyName);
  17951. public:
  17952. ChoicePropertyComponent (const Value& valueToControl,
  17953. const String& propertyName,
  17954. const StringArray& choices,
  17955. const Array <int>* choiceIDs = 0);
  17956. ~ChoicePropertyComponent();
  17957. virtual void setIndex (const int newIndex);
  17958. virtual int getIndex() const;
  17959. const StringArray& getChoices() const;
  17960. void refresh();
  17961. void comboBoxChanged (ComboBox*);
  17962. juce_UseDebuggingNewOperator
  17963. protected:
  17964. StringArray choices;
  17965. private:
  17966. ComboBox* comboBox;
  17967. void createComboBox (const Array <int>* choiceIDs);
  17968. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17969. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17970. };
  17971. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17972. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17973. #endif
  17974. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17975. #endif
  17976. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17977. #endif
  17978. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17979. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17980. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17981. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17982. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17983. private SliderListener
  17984. {
  17985. protected:
  17986. SliderPropertyComponent (const String& propertyName,
  17987. const double rangeMin,
  17988. const double rangeMax,
  17989. const double interval,
  17990. const double skewFactor = 1.0);
  17991. public:
  17992. SliderPropertyComponent (Value& valueToControl,
  17993. const String& propertyName,
  17994. const double rangeMin,
  17995. const double rangeMax,
  17996. const double interval,
  17997. const double skewFactor = 1.0);
  17998. ~SliderPropertyComponent();
  17999. virtual void setValue (const double newValue);
  18000. virtual const double getValue() const;
  18001. void refresh();
  18002. void changeListenerCallback (void*);
  18003. void sliderValueChanged (Slider*);
  18004. juce_UseDebuggingNewOperator
  18005. protected:
  18006. Slider* slider;
  18007. SliderPropertyComponent (const SliderPropertyComponent&);
  18008. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18009. };
  18010. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18011. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18012. #endif
  18013. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18014. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18015. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18016. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18017. class JUCE_API TextPropertyComponent : public PropertyComponent
  18018. {
  18019. protected:
  18020. TextPropertyComponent (const String& propertyName,
  18021. const int maxNumChars,
  18022. const bool isMultiLine);
  18023. public:
  18024. TextPropertyComponent (const Value& valueToControl,
  18025. const String& propertyName,
  18026. const int maxNumChars,
  18027. const bool isMultiLine);
  18028. ~TextPropertyComponent();
  18029. virtual void setText (const String& newText);
  18030. virtual const String getText() const;
  18031. void refresh();
  18032. void textWasEdited();
  18033. juce_UseDebuggingNewOperator
  18034. private:
  18035. Label* textEditor;
  18036. void createEditor (const int maxNumChars, const bool isMultiLine);
  18037. TextPropertyComponent (const TextPropertyComponent&);
  18038. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18039. };
  18040. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18041. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18042. #endif
  18043. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18044. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18045. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18046. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18047. #if JUCE_WINDOWS || DOXYGEN
  18048. class JUCE_API ActiveXControlComponent : public Component
  18049. {
  18050. public:
  18051. ActiveXControlComponent();
  18052. ~ActiveXControlComponent();
  18053. bool createControl (const void* controlIID);
  18054. void deleteControl();
  18055. bool isControlOpen() const throw() { return control != 0; }
  18056. void* queryInterface (const void* iid) const;
  18057. void setMouseEventsAllowed (const bool eventsCanReachControl);
  18058. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18059. void paint (Graphics& g);
  18060. void* originalWndProc;
  18061. juce_UseDebuggingNewOperator
  18062. private:
  18063. class ActiveXControlData;
  18064. friend class ActiveXControlData;
  18065. void* control;
  18066. bool mouseEventsAllowed;
  18067. ActiveXControlComponent (const ActiveXControlComponent&);
  18068. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18069. void setControlBounds (const Rectangle<int>& bounds) const;
  18070. void setControlVisible (const bool b) const;
  18071. };
  18072. #endif
  18073. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18074. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18075. #endif
  18076. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18077. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18078. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18079. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18080. class MidiInputSelectorComponentListBox;
  18081. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18082. public ComboBoxListener,
  18083. public ButtonListener,
  18084. public ChangeListener
  18085. {
  18086. public:
  18087. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18088. const int minAudioInputChannels,
  18089. const int maxAudioInputChannels,
  18090. const int minAudioOutputChannels,
  18091. const int maxAudioOutputChannels,
  18092. const bool showMidiInputOptions,
  18093. const bool showMidiOutputSelector,
  18094. const bool showChannelsAsStereoPairs,
  18095. const bool hideAdvancedOptionsWithButton);
  18096. ~AudioDeviceSelectorComponent();
  18097. void resized();
  18098. void comboBoxChanged (ComboBox*);
  18099. void buttonClicked (Button*);
  18100. void changeListenerCallback (void*);
  18101. void childBoundsChanged (Component*);
  18102. juce_UseDebuggingNewOperator
  18103. private:
  18104. AudioDeviceManager& deviceManager;
  18105. ComboBox* deviceTypeDropDown;
  18106. Label* deviceTypeDropDownLabel;
  18107. Component* audioDeviceSettingsComp;
  18108. String audioDeviceSettingsCompType;
  18109. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18110. const bool showChannelsAsStereoPairs;
  18111. const bool hideAdvancedOptionsWithButton;
  18112. MidiInputSelectorComponentListBox* midiInputsList;
  18113. Label* midiInputsLabel;
  18114. ComboBox* midiOutputSelector;
  18115. Label* midiOutputLabel;
  18116. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18117. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18118. };
  18119. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18120. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18121. #endif
  18122. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18123. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18124. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18125. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18126. class JUCE_API BubbleComponent : public Component
  18127. {
  18128. protected:
  18129. BubbleComponent();
  18130. public:
  18131. ~BubbleComponent();
  18132. enum BubblePlacement
  18133. {
  18134. above = 1,
  18135. below = 2,
  18136. left = 4,
  18137. right = 8
  18138. };
  18139. void setAllowedPlacement (const int newPlacement);
  18140. void setPosition (Component* componentToPointTo);
  18141. void setPosition (const int arrowTipX,
  18142. const int arrowTipY);
  18143. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18144. protected:
  18145. virtual void getContentSize (int& width, int& height) = 0;
  18146. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18147. public:
  18148. void paint (Graphics& g);
  18149. juce_UseDebuggingNewOperator
  18150. private:
  18151. Rectangle<int> content;
  18152. int side, allowablePlacements;
  18153. float arrowTipX, arrowTipY;
  18154. DropShadowEffect shadow;
  18155. BubbleComponent (const BubbleComponent&);
  18156. BubbleComponent& operator= (const BubbleComponent&);
  18157. };
  18158. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18159. /*** End of inlined file: juce_BubbleComponent.h ***/
  18160. #endif
  18161. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18162. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18163. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18164. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18165. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18166. private Timer
  18167. {
  18168. public:
  18169. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  18170. ~BubbleMessageComponent();
  18171. void showAt (int x, int y,
  18172. const String& message,
  18173. const int numMillisecondsBeforeRemoving,
  18174. const bool removeWhenMouseClicked = true,
  18175. const bool deleteSelfAfterUse = false);
  18176. void showAt (Component* const component,
  18177. const String& message,
  18178. const int numMillisecondsBeforeRemoving,
  18179. const bool removeWhenMouseClicked = true,
  18180. const bool deleteSelfAfterUse = false);
  18181. void getContentSize (int& w, int& h);
  18182. void paintContent (Graphics& g, int w, int h);
  18183. void timerCallback();
  18184. juce_UseDebuggingNewOperator
  18185. private:
  18186. int fadeOutLength, mouseClickCounter;
  18187. TextLayout textLayout;
  18188. int64 expiryTime;
  18189. bool deleteAfterUse;
  18190. void init (const int numMillisecondsBeforeRemoving,
  18191. const bool removeWhenMouseClicked,
  18192. const bool deleteSelfAfterUse);
  18193. BubbleMessageComponent (const BubbleMessageComponent&);
  18194. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18195. };
  18196. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18197. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18198. #endif
  18199. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18200. /*** Start of inlined file: juce_ColourSelector.h ***/
  18201. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18202. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18203. class JUCE_API ColourSelector : public Component,
  18204. public ChangeBroadcaster,
  18205. protected SliderListener
  18206. {
  18207. public:
  18208. enum ColourSelectorOptions
  18209. {
  18210. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18211. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18212. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18213. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18214. };
  18215. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18216. const int edgeGap = 4,
  18217. const int gapAroundColourSpaceComponent = 7);
  18218. ~ColourSelector();
  18219. const Colour getCurrentColour() const;
  18220. void setCurrentColour (const Colour& newColour);
  18221. virtual int getNumSwatches() const;
  18222. virtual const Colour getSwatchColour (const int index) const;
  18223. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  18224. enum ColourIds
  18225. {
  18226. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18227. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18228. };
  18229. juce_UseDebuggingNewOperator
  18230. private:
  18231. friend class ColourSpaceView;
  18232. friend class HueSelectorComp;
  18233. Colour colour;
  18234. float h, s, v;
  18235. Slider* sliders[4];
  18236. Component* colourSpace;
  18237. Component* hueSelector;
  18238. class SwatchComponent;
  18239. OwnedArray <SwatchComponent> swatchComponents;
  18240. const int flags;
  18241. int topSpace, edgeGap;
  18242. void setHue (float newH);
  18243. void setSV (float newS, float newV);
  18244. void updateHSV();
  18245. void update();
  18246. void sliderValueChanged (Slider*);
  18247. void paint (Graphics& g);
  18248. void resized();
  18249. ColourSelector (const ColourSelector&);
  18250. ColourSelector& operator= (const ColourSelector&);
  18251. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18252. // have changed - if you get an error here, update your code to use the new constructor instead..
  18253. // (xxx - note to self: remember to remove this at some point in the future)
  18254. ColourSelector (const bool);
  18255. };
  18256. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18257. /*** End of inlined file: juce_ColourSelector.h ***/
  18258. #endif
  18259. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18260. #endif
  18261. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18262. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18263. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18264. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18265. class JUCE_API MagnifierComponent : public Component
  18266. {
  18267. public:
  18268. MagnifierComponent (Component* const contentComponent,
  18269. const bool deleteContentCompWhenNoLongerNeeded);
  18270. ~MagnifierComponent();
  18271. Component* getContentComponent() const { return content; }
  18272. void setScaleFactor (double newScaleFactor);
  18273. double getScaleFactor() const { return scaleFactor; }
  18274. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18275. juce_UseDebuggingNewOperator
  18276. void childBoundsChanged (Component*);
  18277. private:
  18278. Component* content;
  18279. Component* holderComp;
  18280. double scaleFactor;
  18281. ComponentPeer* peer;
  18282. bool deleteContent;
  18283. Graphics::ResamplingQuality quality;
  18284. MouseInputSource mouseSource;
  18285. void paint (Graphics& g);
  18286. void mouseDown (const MouseEvent& e);
  18287. void mouseUp (const MouseEvent& e);
  18288. void mouseDrag (const MouseEvent& e);
  18289. void mouseMove (const MouseEvent& e);
  18290. void mouseEnter (const MouseEvent& e);
  18291. void mouseExit (const MouseEvent& e);
  18292. void mouseWheelMove (const MouseEvent& e, float, float);
  18293. void passOnMouseEventToPeer (const MouseEvent& e);
  18294. int scaleInt (const int n) const;
  18295. MagnifierComponent (const MagnifierComponent&);
  18296. MagnifierComponent& operator= (const MagnifierComponent&);
  18297. };
  18298. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18299. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18300. #endif
  18301. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18302. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18303. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18304. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18305. class JUCE_API MidiKeyboardComponent : public Component,
  18306. public MidiKeyboardStateListener,
  18307. public ChangeBroadcaster,
  18308. private Timer,
  18309. private AsyncUpdater
  18310. {
  18311. public:
  18312. enum Orientation
  18313. {
  18314. horizontalKeyboard,
  18315. verticalKeyboardFacingLeft,
  18316. verticalKeyboardFacingRight,
  18317. };
  18318. MidiKeyboardComponent (MidiKeyboardState& state,
  18319. const Orientation orientation);
  18320. ~MidiKeyboardComponent();
  18321. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18322. void setMidiChannel (const int midiChannelNumber);
  18323. int getMidiChannel() const throw() { return midiChannel; }
  18324. void setMidiChannelsToDisplay (const int midiChannelMask);
  18325. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18326. void setKeyWidth (const float widthInPixels);
  18327. float getKeyWidth() const throw() { return keyWidth; }
  18328. void setOrientation (const Orientation newOrientation);
  18329. const Orientation getOrientation() const throw() { return orientation; }
  18330. void setAvailableRange (const int lowestNote,
  18331. const int highestNote);
  18332. int getRangeStart() const throw() { return rangeStart; }
  18333. int getRangeEnd() const throw() { return rangeEnd; }
  18334. void setLowestVisibleKey (int noteNumber);
  18335. int getLowestVisibleKey() const throw() { return firstKey; }
  18336. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18337. void setScrollButtonsVisible (const bool canScroll);
  18338. enum ColourIds
  18339. {
  18340. whiteNoteColourId = 0x1005000,
  18341. blackNoteColourId = 0x1005001,
  18342. keySeparatorLineColourId = 0x1005002,
  18343. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18344. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18345. textLabelColourId = 0x1005005,
  18346. upDownButtonBackgroundColourId = 0x1005006,
  18347. upDownButtonArrowColourId = 0x1005007
  18348. };
  18349. int getKeyStartPosition (const int midiNoteNumber) const;
  18350. void clearKeyMappings();
  18351. void setKeyPressForNote (const KeyPress& key,
  18352. const int midiNoteOffsetFromC);
  18353. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18354. void setKeyPressBaseOctave (const int newOctaveNumber);
  18355. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18356. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18357. void paint (Graphics& g);
  18358. void resized();
  18359. void mouseMove (const MouseEvent& e);
  18360. void mouseDrag (const MouseEvent& e);
  18361. void mouseDown (const MouseEvent& e);
  18362. void mouseUp (const MouseEvent& e);
  18363. void mouseEnter (const MouseEvent& e);
  18364. void mouseExit (const MouseEvent& e);
  18365. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18366. void timerCallback();
  18367. bool keyStateChanged (const bool isKeyDown);
  18368. void focusLost (FocusChangeType cause);
  18369. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18370. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18371. void handleAsyncUpdate();
  18372. void colourChanged();
  18373. juce_UseDebuggingNewOperator
  18374. protected:
  18375. friend class MidiKeyboardUpDownButton;
  18376. virtual void drawWhiteNote (int midiNoteNumber,
  18377. Graphics& g,
  18378. int x, int y, int w, int h,
  18379. bool isDown, bool isOver,
  18380. const Colour& lineColour,
  18381. const Colour& textColour);
  18382. virtual void drawBlackNote (int midiNoteNumber,
  18383. Graphics& g,
  18384. int x, int y, int w, int h,
  18385. bool isDown, bool isOver,
  18386. const Colour& noteFillColour);
  18387. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18388. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18389. const bool isMouseOver,
  18390. const bool isButtonPressed,
  18391. const bool movesOctavesUp);
  18392. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18393. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18394. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18395. int& x, int& w) const;
  18396. private:
  18397. MidiKeyboardState& state;
  18398. int xOffset, blackNoteLength;
  18399. float keyWidth;
  18400. Orientation orientation;
  18401. int midiChannel, midiInChannelMask;
  18402. float velocity;
  18403. int noteUnderMouse, mouseDownNote;
  18404. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18405. int rangeStart, rangeEnd, firstKey;
  18406. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18407. Button* scrollDown;
  18408. Button* scrollUp;
  18409. Array <KeyPress> keyPresses;
  18410. Array <int> keyPressNotes;
  18411. int keyMappingOctave;
  18412. int octaveNumForMiddleC;
  18413. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18414. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18415. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18416. void resetAnyKeysInUse();
  18417. void updateNoteUnderMouse (const Point<int>& pos);
  18418. void repaintNote (const int midiNoteNumber);
  18419. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18420. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18421. };
  18422. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18423. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18424. #endif
  18425. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18426. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18427. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18428. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18429. #if ! DOXYGEN
  18430. class NSViewComponentInternal;
  18431. #endif
  18432. #if JUCE_MAC || DOXYGEN
  18433. class JUCE_API NSViewComponent : public Component
  18434. {
  18435. public:
  18436. NSViewComponent();
  18437. ~NSViewComponent();
  18438. void setView (void* nsView);
  18439. void* getView() const;
  18440. void paint (Graphics& g);
  18441. juce_UseDebuggingNewOperator
  18442. private:
  18443. friend class NSViewComponentInternal;
  18444. ScopedPointer <NSViewComponentInternal> info;
  18445. NSViewComponent (const NSViewComponent&);
  18446. NSViewComponent& operator= (const NSViewComponent&);
  18447. };
  18448. #endif
  18449. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18450. /*** End of inlined file: juce_NSViewComponent.h ***/
  18451. #endif
  18452. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18453. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18454. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18455. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18456. // this is used to disable OpenGL, and is defined in juce_Config.h
  18457. #if JUCE_OPENGL || DOXYGEN
  18458. class JUCE_API OpenGLPixelFormat
  18459. {
  18460. public:
  18461. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18462. const int alphaBits = 8,
  18463. const int depthBufferBits = 16,
  18464. const int stencilBufferBits = 0);
  18465. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18466. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18467. bool operator== (const OpenGLPixelFormat&) const;
  18468. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18469. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18470. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18471. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18472. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18473. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18474. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18475. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18476. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18477. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18478. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18479. static void getAvailablePixelFormats (Component* component,
  18480. OwnedArray <OpenGLPixelFormat>& results);
  18481. juce_UseDebuggingNewOperator
  18482. };
  18483. class JUCE_API OpenGLContext
  18484. {
  18485. public:
  18486. virtual ~OpenGLContext();
  18487. virtual bool makeActive() const throw() = 0;
  18488. virtual bool makeInactive() const throw() = 0;
  18489. virtual bool isActive() const throw() = 0;
  18490. virtual void swapBuffers() = 0;
  18491. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18492. virtual int getSwapInterval() const = 0;
  18493. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18494. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18495. virtual void repaint() = 0;
  18496. virtual void* getRawContext() const throw() = 0;
  18497. static OpenGLContext* getCurrentContext();
  18498. juce_UseDebuggingNewOperator
  18499. protected:
  18500. OpenGLContext() throw();
  18501. };
  18502. class JUCE_API OpenGLComponent : public Component
  18503. {
  18504. public:
  18505. enum OpenGLType
  18506. {
  18507. openGLDefault = 0,
  18508. #if JUCE_IPHONE
  18509. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18510. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18511. #endif
  18512. };
  18513. OpenGLComponent (OpenGLType type = openGLDefault);
  18514. ~OpenGLComponent();
  18515. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18516. const OpenGLPixelFormat getPixelFormat() const;
  18517. void shareWith (OpenGLContext* contextToShareListsWith);
  18518. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18519. void swapBuffers();
  18520. virtual void renderOpenGL() = 0;
  18521. virtual void newOpenGLContextCreated() = 0;
  18522. OpenGLContext* getCurrentContext() const throw() { return context; }
  18523. bool makeCurrentContextActive();
  18524. void makeCurrentContextInactive();
  18525. bool isActiveContext() const throw();
  18526. virtual bool renderAndSwapBuffers();
  18527. CriticalSection& getContextLock() throw() { return contextLock; }
  18528. void paint (Graphics& g);
  18529. void* getNativeWindowHandle() const;
  18530. juce_UseDebuggingNewOperator
  18531. private:
  18532. const OpenGLType type;
  18533. class OpenGLComponentWatcher;
  18534. friend class OpenGLComponentWatcher;
  18535. friend class ScopedPointer <OpenGLComponentWatcher>;
  18536. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18537. OpenGLContext* context;
  18538. OpenGLContext* contextToShareListsWith;
  18539. CriticalSection contextLock;
  18540. OpenGLPixelFormat preferredPixelFormat;
  18541. bool needToUpdateViewport;
  18542. OpenGLContext* createContext();
  18543. void deleteContext();
  18544. void updateContextPosition();
  18545. void internalRepaint (int x, int y, int w, int h);
  18546. OpenGLComponent (const OpenGLComponent&);
  18547. OpenGLComponent& operator= (const OpenGLComponent&);
  18548. };
  18549. #endif
  18550. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18551. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18552. #endif
  18553. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18554. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18555. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18556. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18557. class JUCE_API PreferencesPanel : public Component,
  18558. private ButtonListener
  18559. {
  18560. public:
  18561. PreferencesPanel();
  18562. ~PreferencesPanel();
  18563. void addSettingsPage (const String& pageTitle,
  18564. const Drawable* normalIcon,
  18565. const Drawable* overIcon,
  18566. const Drawable* downIcon);
  18567. void addSettingsPage (const String& pageTitle,
  18568. const char* imageData,
  18569. const int imageDataSize);
  18570. void showInDialogBox (const String& dialogtitle,
  18571. int dialogWidth,
  18572. int dialogHeight,
  18573. const Colour& backgroundColour = Colours::white);
  18574. virtual Component* createComponentForPage (const String& pageName) = 0;
  18575. void setCurrentPage (const String& pageName);
  18576. void resized();
  18577. void paint (Graphics& g);
  18578. void buttonClicked (Button* button);
  18579. juce_UseDebuggingNewOperator
  18580. private:
  18581. String currentPageName;
  18582. ScopedPointer <Component> currentPage;
  18583. int buttonSize;
  18584. PreferencesPanel (const PreferencesPanel&);
  18585. PreferencesPanel& operator= (const PreferencesPanel&);
  18586. };
  18587. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18588. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18589. #endif
  18590. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18591. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18592. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18593. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18594. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18595. // amalgamated build)
  18596. #if JUCE_WINDOWS
  18597. typedef ActiveXControlComponent QTCompBaseClass;
  18598. #elif JUCE_MAC
  18599. typedef NSViewComponent QTCompBaseClass;
  18600. #endif
  18601. // this is used to disable QuickTime, and is defined in juce_Config.h
  18602. #if JUCE_QUICKTIME || DOXYGEN
  18603. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18604. {
  18605. public:
  18606. QuickTimeMovieComponent();
  18607. ~QuickTimeMovieComponent();
  18608. static bool isQuickTimeAvailable() throw();
  18609. bool loadMovie (const File& movieFile,
  18610. const bool isControllerVisible);
  18611. bool loadMovie (const URL& movieURL,
  18612. const bool isControllerVisible);
  18613. bool loadMovie (InputStream* movieStream,
  18614. const bool isControllerVisible);
  18615. void closeMovie();
  18616. const File getCurrentMovieFile() const;
  18617. bool isMovieOpen() const;
  18618. double getMovieDuration() const;
  18619. void getMovieNormalSize (int& width, int& height) const;
  18620. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18621. const RectanglePlacement& placement);
  18622. void play();
  18623. void stop();
  18624. bool isPlaying() const;
  18625. void goToStart();
  18626. void setPosition (const double seconds);
  18627. double getPosition() const;
  18628. void setSpeed (const float newSpeed);
  18629. void setMovieVolume (const float newVolume);
  18630. float getMovieVolume() const;
  18631. void setLooping (const bool shouldLoop);
  18632. bool isLooping() const;
  18633. bool isControllerVisible() const;
  18634. void paint (Graphics& g);
  18635. juce_UseDebuggingNewOperator
  18636. private:
  18637. File movieFile;
  18638. bool movieLoaded, controllerVisible, looping;
  18639. #if JUCE_WINDOWS
  18640. void parentHierarchyChanged();
  18641. void visibilityChanged();
  18642. void createControlIfNeeded();
  18643. bool isControlCreated() const;
  18644. class Pimpl;
  18645. friend class ScopedPointer <Pimpl>;
  18646. ScopedPointer <Pimpl> pimpl;
  18647. #else
  18648. void* movie;
  18649. #endif
  18650. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18651. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18652. };
  18653. #endif
  18654. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18655. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18656. #endif
  18657. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18658. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18659. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18660. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18661. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18662. class JUCE_API SystemTrayIconComponent : public Component
  18663. {
  18664. public:
  18665. SystemTrayIconComponent();
  18666. ~SystemTrayIconComponent();
  18667. void setIconImage (const Image& newImage);
  18668. void setIconTooltip (const String& tooltip);
  18669. #if JUCE_LINUX
  18670. void paint (Graphics& g);
  18671. #endif
  18672. juce_UseDebuggingNewOperator
  18673. private:
  18674. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18675. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18676. };
  18677. #endif
  18678. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18679. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18680. #endif
  18681. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18682. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18683. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18684. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18685. #if JUCE_WEB_BROWSER || DOXYGEN
  18686. #if ! DOXYGEN
  18687. class WebBrowserComponentInternal;
  18688. #endif
  18689. class JUCE_API WebBrowserComponent : public Component
  18690. {
  18691. public:
  18692. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18693. ~WebBrowserComponent();
  18694. void goToURL (const String& url,
  18695. const StringArray* headers = 0,
  18696. const MemoryBlock* postData = 0);
  18697. void stop();
  18698. void goBack();
  18699. void goForward();
  18700. void refresh();
  18701. virtual bool pageAboutToLoad (const String& newURL);
  18702. void paint (Graphics& g);
  18703. void resized();
  18704. void parentHierarchyChanged();
  18705. void visibilityChanged();
  18706. juce_UseDebuggingNewOperator
  18707. private:
  18708. WebBrowserComponentInternal* browser;
  18709. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18710. String lastURL;
  18711. StringArray lastHeaders;
  18712. MemoryBlock lastPostData;
  18713. void reloadLastURL();
  18714. void checkWindowAssociation();
  18715. WebBrowserComponent (const WebBrowserComponent&);
  18716. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18717. };
  18718. #endif
  18719. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18720. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18721. #endif
  18722. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18723. #endif
  18724. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18725. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18726. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18727. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18728. class ComponentBoundsConstrainer;
  18729. class JUCE_API ComponentPeer
  18730. {
  18731. public:
  18732. enum StyleFlags
  18733. {
  18734. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18735. entry on the taskbar (ignored on MacOSX) */
  18736. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18737. tooltip, etc. */
  18738. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18739. through it (may not be possible on some platforms). */
  18740. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18741. title bar and frame\. if not specified, the window will be
  18742. borderless. */
  18743. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18744. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18745. minimise button on it. */
  18746. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18747. maximise button on it. */
  18748. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18749. close button on it. */
  18750. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18751. not be possible on all platforms). */
  18752. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18753. do its own repainting, but only to repaint when the
  18754. performAnyPendingRepaintsNow() method is called. */
  18755. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18756. be used for things like plugin windows, to stop them interfering
  18757. with the host's shortcut keys */
  18758. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18759. };
  18760. ComponentPeer (Component* const component,
  18761. const int styleFlags) throw();
  18762. virtual ~ComponentPeer();
  18763. Component* getComponent() const throw() { return component; }
  18764. int getStyleFlags() const throw() { return styleFlags; }
  18765. virtual void* getNativeHandle() const = 0;
  18766. virtual void setVisible (bool shouldBeVisible) = 0;
  18767. virtual void setTitle (const String& title) = 0;
  18768. virtual void setPosition (int x, int y) = 0;
  18769. virtual void setSize (int w, int h) = 0;
  18770. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  18771. virtual const Rectangle<int> getBounds() const = 0;
  18772. virtual const Point<int> getScreenPosition() const = 0;
  18773. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18774. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18775. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18776. virtual bool isMinimised() const = 0;
  18777. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18778. virtual bool isFullScreen() const = 0;
  18779. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18780. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18781. virtual void setIcon (const Image& newIcon) = 0;
  18782. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  18783. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18784. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18785. virtual const BorderSize getFrameSize() const = 0;
  18786. void handleMovedOrResized();
  18787. void handleScreenSizeChange();
  18788. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18789. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18790. virtual void toFront (bool makeActive) = 0;
  18791. virtual void toBehind (ComponentPeer* other) = 0;
  18792. void handleBroughtToFront();
  18793. virtual bool isFocused() const = 0;
  18794. virtual void grabFocus() = 0;
  18795. virtual void textInputRequired (const Point<int>& position) = 0;
  18796. void handleFocusGain();
  18797. void handleFocusLoss();
  18798. Component* getLastFocusedSubcomponent() const throw();
  18799. bool handleKeyPress (const int keyCode,
  18800. const juce_wchar textCharacter);
  18801. bool handleKeyUpOrDown (const bool isKeyDown);
  18802. void handleModifierKeysChange();
  18803. TextInputTarget* findCurrentTextInputTarget();
  18804. virtual void repaint (int x, int y, int w, int h) = 0;
  18805. virtual void performAnyPendingRepaintsNow() = 0;
  18806. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, const int64 time);
  18807. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, const int64 time, float x, float y);
  18808. void handleUserClosingWindow();
  18809. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18810. void handleFileDragExit (const StringArray& files);
  18811. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18812. void clearMaskedRegion() throw();
  18813. void addMaskedRegion (int x, int y, int w, int h) throw();
  18814. static int getNumPeers() throw();
  18815. static ComponentPeer* getPeer (const int index) throw();
  18816. static bool isValidPeer (const ComponentPeer* const peer) throw();
  18817. static void bringModalComponentToFront();
  18818. virtual const StringArray getAvailableRenderingEngines() throw();
  18819. virtual int getCurrentRenderingEngine() throw();
  18820. virtual void setCurrentRenderingEngine (int index) throw();
  18821. juce_UseDebuggingNewOperator
  18822. protected:
  18823. Component* const component;
  18824. const int styleFlags;
  18825. RectangleList maskedRegion;
  18826. Rectangle<int> lastNonFullscreenBounds;
  18827. uint32 lastPaintTime;
  18828. ComponentBoundsConstrainer* constrainer;
  18829. static void updateCurrentModifiers() throw();
  18830. private:
  18831. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  18832. Component* lastDragAndDropCompUnderMouse;
  18833. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18834. friend class Component;
  18835. static ComponentPeer* getPeerFor (const Component* const component) throw();
  18836. void setLastDragDropTarget (Component* comp);
  18837. ComponentPeer (const ComponentPeer&);
  18838. ComponentPeer& operator= (const ComponentPeer&);
  18839. };
  18840. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18841. /*** End of inlined file: juce_ComponentPeer.h ***/
  18842. #endif
  18843. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18844. /*** Start of inlined file: juce_DialogWindow.h ***/
  18845. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18846. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18847. class JUCE_API DialogWindow : public DocumentWindow
  18848. {
  18849. public:
  18850. DialogWindow (const String& name,
  18851. const Colour& backgroundColour,
  18852. const bool escapeKeyTriggersCloseButton,
  18853. const bool addToDesktop = true);
  18854. ~DialogWindow();
  18855. static int showModalDialog (const String& dialogTitle,
  18856. Component* contentComponent,
  18857. Component* componentToCentreAround,
  18858. const Colour& backgroundColour,
  18859. const bool escapeKeyTriggersCloseButton,
  18860. const bool shouldBeResizable = false,
  18861. const bool useBottomRightCornerResizer = false);
  18862. juce_UseDebuggingNewOperator
  18863. protected:
  18864. void resized();
  18865. private:
  18866. bool escapeKeyTriggersCloseButton;
  18867. DialogWindow (const DialogWindow&);
  18868. DialogWindow& operator= (const DialogWindow&);
  18869. };
  18870. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18871. /*** End of inlined file: juce_DialogWindow.h ***/
  18872. #endif
  18873. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18874. #endif
  18875. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18876. #endif
  18877. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18878. /*** Start of inlined file: juce_SplashScreen.h ***/
  18879. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18880. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18881. class JUCE_API SplashScreen : public Component,
  18882. public Timer,
  18883. private DeletedAtShutdown
  18884. {
  18885. public:
  18886. SplashScreen();
  18887. ~SplashScreen();
  18888. void show (const String& title,
  18889. Image* const backgroundImage,
  18890. const int minimumTimeToDisplayFor,
  18891. const bool useDropShadow,
  18892. const bool removeOnMouseClick = true);
  18893. void show (const String& title,
  18894. const int width,
  18895. const int height,
  18896. const int minimumTimeToDisplayFor,
  18897. const bool useDropShadow,
  18898. const bool removeOnMouseClick = true);
  18899. void paint (Graphics& g);
  18900. void timerCallback();
  18901. juce_UseDebuggingNewOperator
  18902. private:
  18903. Image* backgroundImage;
  18904. Time earliestTimeToDelete;
  18905. int originalClickCounter;
  18906. SplashScreen (const SplashScreen&);
  18907. SplashScreen& operator= (const SplashScreen&);
  18908. };
  18909. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18910. /*** End of inlined file: juce_SplashScreen.h ***/
  18911. #endif
  18912. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18913. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18914. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18915. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18916. class JUCE_API ThreadWithProgressWindow : public Thread,
  18917. private Timer
  18918. {
  18919. public:
  18920. ThreadWithProgressWindow (const String& windowTitle,
  18921. const bool hasProgressBar,
  18922. const bool hasCancelButton,
  18923. const int timeOutMsWhenCancelling = 10000,
  18924. const String& cancelButtonText = JUCE_T("Cancel"));
  18925. ~ThreadWithProgressWindow();
  18926. bool runThread (const int threadPriority = 5);
  18927. void setProgress (const double newProgress);
  18928. void setStatusMessage (const String& newStatusMessage);
  18929. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18930. juce_UseDebuggingNewOperator
  18931. private:
  18932. void timerCallback();
  18933. double progress;
  18934. ScopedPointer <AlertWindow> alertWindow;
  18935. String message;
  18936. CriticalSection messageLock;
  18937. const int timeOutMsWhenCancelling;
  18938. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18939. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18940. };
  18941. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18942. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18943. #endif
  18944. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18945. #endif
  18946. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18947. #endif
  18948. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18949. #endif
  18950. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18951. #endif
  18952. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18953. #endif
  18954. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18955. #endif
  18956. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18957. #endif
  18958. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18959. #endif
  18960. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18961. #endif
  18962. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18963. #endif
  18964. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18965. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18966. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18967. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18968. class JUCE_API LowLevelGraphicsContext
  18969. {
  18970. protected:
  18971. LowLevelGraphicsContext();
  18972. public:
  18973. virtual ~LowLevelGraphicsContext();
  18974. virtual bool isVectorDevice() const = 0;
  18975. virtual void setOrigin (int x, int y) = 0;
  18976. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18977. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18978. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18979. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18980. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18981. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18982. virtual const Rectangle<int> getClipBounds() const = 0;
  18983. virtual bool isClipEmpty() const = 0;
  18984. virtual void saveState() = 0;
  18985. virtual void restoreState() = 0;
  18986. virtual void setFill (const FillType& fillType) = 0;
  18987. virtual void setOpacity (float newOpacity) = 0;
  18988. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18989. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18990. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18991. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18992. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18993. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18994. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18995. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18996. virtual void setFont (const Font& newFont) = 0;
  18997. virtual const Font getFont() = 0;
  18998. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18999. };
  19000. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19001. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  19002. #endif
  19003. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19004. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19005. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19006. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19007. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  19008. {
  19009. public:
  19010. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19011. const String& documentTitle,
  19012. const int totalWidth,
  19013. const int totalHeight);
  19014. ~LowLevelGraphicsPostScriptRenderer();
  19015. bool isVectorDevice() const;
  19016. void setOrigin (int x, int y);
  19017. bool clipToRectangle (const Rectangle<int>& r);
  19018. bool clipToRectangleList (const RectangleList& clipRegion);
  19019. void excludeClipRectangle (const Rectangle<int>& r);
  19020. void clipToPath (const Path& path, const AffineTransform& transform);
  19021. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19022. void saveState();
  19023. void restoreState();
  19024. bool clipRegionIntersects (const Rectangle<int>& r);
  19025. const Rectangle<int> getClipBounds() const;
  19026. bool isClipEmpty() const;
  19027. void setFill (const FillType& fillType);
  19028. void setOpacity (float opacity);
  19029. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19030. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  19031. void fillPath (const Path& path, const AffineTransform& transform);
  19032. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19033. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  19034. void drawLine (double x1, double y1, double x2, double y2);
  19035. void drawVerticalLine (const int x, double top, double bottom);
  19036. void drawHorizontalLine (const int x, double top, double bottom);
  19037. const Font getFont();
  19038. void setFont (const Font& newFont);
  19039. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19040. juce_UseDebuggingNewOperator
  19041. protected:
  19042. OutputStream& out;
  19043. int totalWidth, totalHeight;
  19044. bool needToClip;
  19045. Colour lastColour;
  19046. struct SavedState
  19047. {
  19048. SavedState();
  19049. ~SavedState();
  19050. RectangleList clip;
  19051. int xOffset, yOffset;
  19052. FillType fillType;
  19053. Font font;
  19054. private:
  19055. SavedState& operator= (const SavedState&);
  19056. };
  19057. OwnedArray <SavedState> stateStack;
  19058. void writeClip();
  19059. void writeColour (const Colour& colour);
  19060. void writePath (const Path& path) const;
  19061. void writeXY (const float x, const float y) const;
  19062. void writeTransform (const AffineTransform& trans) const;
  19063. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  19064. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19065. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19066. };
  19067. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19068. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19069. #endif
  19070. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19071. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19072. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19073. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19074. class LLGCSavedState;
  19075. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19076. {
  19077. public:
  19078. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19079. ~LowLevelGraphicsSoftwareRenderer();
  19080. bool isVectorDevice() const;
  19081. void setOrigin (int x, int y);
  19082. bool clipToRectangle (const Rectangle<int>& r);
  19083. bool clipToRectangleList (const RectangleList& clipRegion);
  19084. void excludeClipRectangle (const Rectangle<int>& r);
  19085. void clipToPath (const Path& path, const AffineTransform& transform);
  19086. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19087. bool clipRegionIntersects (const Rectangle<int>& r);
  19088. const Rectangle<int> getClipBounds() const;
  19089. bool isClipEmpty() const;
  19090. void saveState();
  19091. void restoreState();
  19092. void setFill (const FillType& fillType);
  19093. void setOpacity (float opacity);
  19094. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19095. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  19096. void fillPath (const Path& path, const AffineTransform& transform);
  19097. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19098. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  19099. void drawLine (double x1, double y1, double x2, double y2);
  19100. void drawVerticalLine (const int x, double top, double bottom);
  19101. void drawHorizontalLine (const int x, double top, double bottom);
  19102. void setFont (const Font& newFont);
  19103. const Font getFont();
  19104. void drawGlyph (int glyphNumber, float x, float y);
  19105. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19106. juce_UseDebuggingNewOperator
  19107. protected:
  19108. Image& image;
  19109. ScopedPointer <LLGCSavedState> currentState;
  19110. OwnedArray <LLGCSavedState> stateStack;
  19111. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19112. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19113. };
  19114. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19115. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19116. #endif
  19117. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19118. #endif
  19119. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19120. #endif
  19121. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19122. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19123. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19124. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19125. class JUCE_API DrawableComposite : public Drawable
  19126. {
  19127. public:
  19128. DrawableComposite();
  19129. virtual ~DrawableComposite();
  19130. void insertDrawable (Drawable* drawable,
  19131. const AffineTransform& transform = AffineTransform::identity,
  19132. const int index = -1);
  19133. void insertDrawable (const Drawable& drawable,
  19134. const AffineTransform& transform = AffineTransform::identity,
  19135. const int index = -1);
  19136. void removeDrawable (const int index, const bool deleteDrawable = true);
  19137. int getNumDrawables() const throw() { return drawables.size(); }
  19138. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  19139. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  19140. void bringToFront (const int index);
  19141. void render (const Drawable::RenderingContext& context) const;
  19142. const Rectangle<float> getBounds() const;
  19143. bool hitTest (float x, float y) const;
  19144. Drawable* createCopy() const;
  19145. ValueTree createValueTree() const throw();
  19146. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19147. juce_UseDebuggingNewOperator
  19148. private:
  19149. OwnedArray <Drawable> drawables;
  19150. OwnedArray <AffineTransform> transforms;
  19151. DrawableComposite (const DrawableComposite&);
  19152. DrawableComposite& operator= (const DrawableComposite&);
  19153. };
  19154. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19155. /*** End of inlined file: juce_DrawableComposite.h ***/
  19156. #endif
  19157. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19158. /*** Start of inlined file: juce_DrawableImage.h ***/
  19159. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19160. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19161. class JUCE_API DrawableImage : public Drawable
  19162. {
  19163. public:
  19164. DrawableImage();
  19165. virtual ~DrawableImage();
  19166. void setImage (const Image& imageToCopy);
  19167. void setImage (Image* imageToUse,
  19168. const bool releaseWhenNotNeeded);
  19169. Image* getImage() const throw() { return image; }
  19170. void clearImage();
  19171. void setOpacity (const float newOpacity);
  19172. float getOpacity() const throw() { return opacity; }
  19173. void setOverlayColour (const Colour& newOverlayColour);
  19174. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19175. void render (const Drawable::RenderingContext& context) const;
  19176. const Rectangle<float> getBounds() const;
  19177. bool hitTest (float x, float y) const;
  19178. Drawable* createCopy() const;
  19179. ValueTree createValueTree() const throw();
  19180. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19181. juce_UseDebuggingNewOperator
  19182. private:
  19183. Image* image;
  19184. bool canDeleteImage;
  19185. float opacity;
  19186. Colour overlayColour;
  19187. DrawableImage (const DrawableImage&);
  19188. DrawableImage& operator= (const DrawableImage&);
  19189. };
  19190. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19191. /*** End of inlined file: juce_DrawableImage.h ***/
  19192. #endif
  19193. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19194. /*** Start of inlined file: juce_DrawablePath.h ***/
  19195. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19196. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19197. class JUCE_API DrawablePath : public Drawable
  19198. {
  19199. public:
  19200. DrawablePath();
  19201. virtual ~DrawablePath();
  19202. void setPath (const Path& newPath) throw();
  19203. const Path& getPath() const throw() { return path; }
  19204. void setFill (const FillType& newFill) throw();
  19205. const FillType& getFill() const throw() { return mainFill; }
  19206. void setStrokeFill (const FillType& newStrokeFill) throw();
  19207. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19208. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19209. void setStrokeThickness (const float newThickness) throw();
  19210. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19211. void render (const Drawable::RenderingContext& context) const;
  19212. const Rectangle<float> getBounds() const;
  19213. bool hitTest (float x, float y) const;
  19214. Drawable* createCopy() const;
  19215. ValueTree createValueTree() const throw();
  19216. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19217. juce_UseDebuggingNewOperator
  19218. private:
  19219. Path path, stroke;
  19220. FillType mainFill, strokeFill;
  19221. PathStrokeType strokeType;
  19222. void updateOutline();
  19223. DrawablePath (const DrawablePath&);
  19224. DrawablePath& operator= (const DrawablePath&);
  19225. };
  19226. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19227. /*** End of inlined file: juce_DrawablePath.h ***/
  19228. #endif
  19229. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19230. /*** Start of inlined file: juce_DrawableText.h ***/
  19231. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19232. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19233. class JUCE_API DrawableText : public Drawable
  19234. {
  19235. public:
  19236. DrawableText();
  19237. virtual ~DrawableText();
  19238. void setText (const GlyphArrangement& newText);
  19239. void setText (const String& newText, const Font& fontToUse);
  19240. const GlyphArrangement& getText() const throw() { return text; }
  19241. void setColour (const Colour& newColour);
  19242. const Colour& getColour() const throw() { return colour; }
  19243. void render (const Drawable::RenderingContext& context) const;
  19244. const Rectangle<float> getBounds() const;
  19245. bool hitTest (float x, float y) const;
  19246. Drawable* createCopy() const;
  19247. ValueTree createValueTree() const throw();
  19248. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19249. juce_UseDebuggingNewOperator
  19250. private:
  19251. GlyphArrangement text;
  19252. Colour colour;
  19253. DrawableText (const DrawableText&);
  19254. DrawableText& operator= (const DrawableText&);
  19255. };
  19256. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19257. /*** End of inlined file: juce_DrawableText.h ***/
  19258. #endif
  19259. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19260. #endif
  19261. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19262. /*** Start of inlined file: juce_GlowEffect.h ***/
  19263. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19264. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19265. class JUCE_API GlowEffect : public ImageEffectFilter
  19266. {
  19267. public:
  19268. GlowEffect();
  19269. ~GlowEffect();
  19270. void setGlowProperties (const float newRadius,
  19271. const Colour& newColour);
  19272. void applyEffect (Image& sourceImage, Graphics& destContext);
  19273. juce_UseDebuggingNewOperator
  19274. private:
  19275. float radius;
  19276. Colour colour;
  19277. };
  19278. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19279. /*** End of inlined file: juce_GlowEffect.h ***/
  19280. #endif
  19281. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19282. #endif
  19283. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19284. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19285. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19286. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19287. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19288. {
  19289. public:
  19290. ReduceOpacityEffect (const float opacity = 1.0f);
  19291. ~ReduceOpacityEffect();
  19292. void setOpacity (const float newOpacity);
  19293. void applyEffect (Image& sourceImage, Graphics& destContext);
  19294. juce_UseDebuggingNewOperator
  19295. private:
  19296. float opacity;
  19297. };
  19298. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19299. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19300. #endif
  19301. #ifndef __JUCE_FONT_JUCEHEADER__
  19302. #endif
  19303. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19304. #endif
  19305. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19306. #endif
  19307. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19308. #endif
  19309. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19310. #endif
  19311. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19312. #endif
  19313. #ifndef __JUCE_LINE_JUCEHEADER__
  19314. #endif
  19315. #ifndef __JUCE_PATH_JUCEHEADER__
  19316. #endif
  19317. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19318. /*** Start of inlined file: juce_PathIterator.h ***/
  19319. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19320. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19321. class JUCE_API PathFlatteningIterator
  19322. {
  19323. public:
  19324. PathFlatteningIterator (const Path& path,
  19325. const AffineTransform& transform = AffineTransform::identity,
  19326. float tolerence = 6.0f);
  19327. ~PathFlatteningIterator();
  19328. bool next();
  19329. float x1;
  19330. float y1;
  19331. float x2;
  19332. float y2;
  19333. bool closesSubPath;
  19334. int subPathIndex;
  19335. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19336. && (index >= path.numElements
  19337. || points [index] == Path::moveMarker); }
  19338. juce_UseDebuggingNewOperator
  19339. private:
  19340. const Path& path;
  19341. const AffineTransform transform;
  19342. float* points;
  19343. float tolerence, subPathCloseX, subPathCloseY;
  19344. const bool isIdentityTransform;
  19345. HeapBlock <float> stackBase;
  19346. float* stackPos;
  19347. size_t index, stackSize;
  19348. PathFlatteningIterator (const PathFlatteningIterator&);
  19349. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19350. };
  19351. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19352. /*** End of inlined file: juce_PathIterator.h ***/
  19353. #endif
  19354. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19355. #endif
  19356. #ifndef __JUCE_POINT_JUCEHEADER__
  19357. #endif
  19358. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19359. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19360. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19361. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19362. class JUCE_API PositionedRectangle
  19363. {
  19364. public:
  19365. PositionedRectangle() throw();
  19366. PositionedRectangle (const String& stringVersion) throw();
  19367. PositionedRectangle (const PositionedRectangle& other) throw();
  19368. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19369. ~PositionedRectangle() throw();
  19370. const String toString() const throw();
  19371. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19372. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19373. double& x,
  19374. double& y,
  19375. double& width,
  19376. double& height) const throw();
  19377. void applyToComponent (Component& comp) const throw();
  19378. void updateFrom (const Rectangle<int>& newPosition,
  19379. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19380. void updateFromDouble (const double x, const double y,
  19381. const double width, const double height,
  19382. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19383. void updateFromComponent (const Component& comp) throw();
  19384. enum AnchorPoint
  19385. {
  19386. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19387. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19388. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19389. };
  19390. enum PositionMode
  19391. {
  19392. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19393. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19394. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19395. 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. */
  19396. };
  19397. enum SizeMode
  19398. {
  19399. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19400. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19401. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19402. };
  19403. void setModes (const AnchorPoint xAnchorMode,
  19404. const PositionMode xPositionMode,
  19405. const AnchorPoint yAnchorMode,
  19406. const PositionMode yPositionMode,
  19407. const SizeMode widthMode,
  19408. const SizeMode heightMode,
  19409. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19410. AnchorPoint getAnchorPointX() const throw();
  19411. PositionMode getPositionModeX() const throw();
  19412. double getX() const throw() { return x; }
  19413. void setX (const double newX) throw() { x = newX; }
  19414. AnchorPoint getAnchorPointY() const throw();
  19415. PositionMode getPositionModeY() const throw();
  19416. double getY() const throw() { return y; }
  19417. void setY (const double newY) throw() { y = newY; }
  19418. SizeMode getWidthMode() const throw();
  19419. double getWidth() const throw() { return w; }
  19420. void setWidth (const double newWidth) throw() { w = newWidth; }
  19421. SizeMode getHeightMode() const throw();
  19422. double getHeight() const throw() { return h; }
  19423. void setHeight (const double newHeight) throw() { h = newHeight; }
  19424. bool isPositionAbsolute() const throw();
  19425. bool operator== (const PositionedRectangle& other) const throw();
  19426. bool operator!= (const PositionedRectangle& other) const throw();
  19427. juce_UseDebuggingNewOperator
  19428. private:
  19429. double x, y, w, h;
  19430. uint8 xMode, yMode, wMode, hMode;
  19431. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19432. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19433. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19434. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19435. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19436. const uint8 xMode, const uint8 wMode,
  19437. const int parentPos, const int parentSize) const throw();
  19438. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19439. const uint8 xMode, const uint8 wMode,
  19440. const int parentPos, const int parentSize) const throw();
  19441. };
  19442. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19443. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19444. #endif
  19445. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19446. #endif
  19447. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19448. #endif
  19449. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19450. /*** Start of inlined file: juce_CameraDevice.h ***/
  19451. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19452. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19453. #if JUCE_USE_CAMERA
  19454. class CameraImageListener
  19455. {
  19456. public:
  19457. CameraImageListener() {}
  19458. virtual ~CameraImageListener() {}
  19459. virtual void imageReceived (Image& image) = 0;
  19460. };
  19461. class JUCE_API CameraDevice
  19462. {
  19463. public:
  19464. virtual ~CameraDevice();
  19465. static const StringArray getAvailableDevices();
  19466. static CameraDevice* openDevice (int deviceIndex,
  19467. int minWidth = 128, int minHeight = 64,
  19468. int maxWidth = 1024, int maxHeight = 768);
  19469. const String getName() const { return name; }
  19470. Component* createViewerComponent();
  19471. void startRecordingToFile (const File& file, int quality = 2);
  19472. void stopRecording();
  19473. static const String getFileExtension();
  19474. const Time getTimeOfFirstRecordedFrame() const;
  19475. void addListener (CameraImageListener* listenerToAdd);
  19476. void removeListener (CameraImageListener* listenerToRemove);
  19477. juce_UseDebuggingNewOperator
  19478. protected:
  19479. CameraDevice (const String& name, int index);
  19480. private:
  19481. void* internal;
  19482. bool isRecording;
  19483. String name;
  19484. CameraDevice (const CameraDevice&);
  19485. CameraDevice& operator= (const CameraDevice&);
  19486. };
  19487. #endif
  19488. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19489. /*** End of inlined file: juce_CameraDevice.h ***/
  19490. #endif
  19491. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19492. #endif
  19493. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19494. /*** Start of inlined file: juce_ImageCache.h ***/
  19495. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19496. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19497. class JUCE_API ImageCache : private DeletedAtShutdown,
  19498. private Timer
  19499. {
  19500. public:
  19501. static Image* getFromFile (const File& file);
  19502. static Image* getFromMemory (const void* imageData, int dataSize);
  19503. static void release (Image* imageToRelease);
  19504. static void releaseOrDelete (Image* imageToRelease);
  19505. static bool isImageInCache (Image* imageToLookFor);
  19506. static void incReferenceCount (Image* image);
  19507. static Image* getFromHashCode (int64 hashCode);
  19508. static void addImageToCache (Image* image, int64 hashCode);
  19509. static void setCacheTimeout (int millisecs);
  19510. juce_UseDebuggingNewOperator
  19511. private:
  19512. CriticalSection lock;
  19513. struct Item;
  19514. friend class ScopedPointer<Item>;
  19515. friend class OwnedArray<Item>;
  19516. OwnedArray<Item> images;
  19517. static ImageCache* instance;
  19518. static int cacheTimeout;
  19519. ImageCache();
  19520. ImageCache (const ImageCache&);
  19521. ImageCache& operator= (const ImageCache&);
  19522. ~ImageCache();
  19523. void timerCallback();
  19524. };
  19525. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19526. /*** End of inlined file: juce_ImageCache.h ***/
  19527. #endif
  19528. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19529. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19530. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19531. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19532. class JUCE_API ImageConvolutionKernel
  19533. {
  19534. public:
  19535. ImageConvolutionKernel (const int size);
  19536. ~ImageConvolutionKernel();
  19537. void clear();
  19538. float getKernelValue (int x, int y) const throw();
  19539. void setKernelValue (int x, int y, float value) throw();
  19540. void setOverallSum (const float desiredTotalSum);
  19541. void rescaleAllValues (const float multiplier);
  19542. void createGaussianBlur (const float blurRadius);
  19543. int getKernelSize() const { return size; }
  19544. void applyToImage (Image& destImage,
  19545. const Image* sourceImage,
  19546. int x,
  19547. int y,
  19548. int width,
  19549. int height) const;
  19550. juce_UseDebuggingNewOperator
  19551. private:
  19552. HeapBlock <float> values;
  19553. const int size;
  19554. // no reason not to implement these one day..
  19555. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19556. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19557. };
  19558. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19559. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19560. #endif
  19561. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19562. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19563. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19564. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19565. class JUCE_API ImageFileFormat
  19566. {
  19567. protected:
  19568. ImageFileFormat() {}
  19569. public:
  19570. virtual ~ImageFileFormat() {}
  19571. virtual const String getFormatName() = 0;
  19572. virtual bool canUnderstand (InputStream& input) = 0;
  19573. virtual Image* decodeImage (InputStream& input) = 0;
  19574. virtual bool writeImageToStream (const Image& sourceImage,
  19575. OutputStream& destStream) = 0;
  19576. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19577. static Image* loadFrom (InputStream& input);
  19578. static Image* loadFrom (const File& file);
  19579. static Image* loadFrom (const void* rawData,
  19580. const int numBytesOfData);
  19581. };
  19582. class JUCE_API PNGImageFormat : public ImageFileFormat
  19583. {
  19584. public:
  19585. PNGImageFormat();
  19586. ~PNGImageFormat();
  19587. const String getFormatName();
  19588. bool canUnderstand (InputStream& input);
  19589. Image* decodeImage (InputStream& input);
  19590. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19591. };
  19592. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19593. {
  19594. public:
  19595. JPEGImageFormat();
  19596. ~JPEGImageFormat();
  19597. void setQuality (const float newQuality);
  19598. const String getFormatName();
  19599. bool canUnderstand (InputStream& input);
  19600. Image* decodeImage (InputStream& input);
  19601. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19602. private:
  19603. float quality;
  19604. };
  19605. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19606. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19607. #endif
  19608. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19609. #endif
  19610. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19611. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19612. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19613. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19614. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19615. {
  19616. public:
  19617. FileBasedDocument (const String& fileExtension,
  19618. const String& fileWildCard,
  19619. const String& openFileDialogTitle,
  19620. const String& saveFileDialogTitle);
  19621. virtual ~FileBasedDocument();
  19622. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19623. virtual void changed();
  19624. void setChangedFlag (const bool hasChanged);
  19625. bool loadFrom (const File& fileToLoadFrom,
  19626. const bool showMessageOnFailure);
  19627. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19628. enum SaveResult
  19629. {
  19630. savedOk = 0, /**< indicates that a file was saved successfully. */
  19631. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19632. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19633. };
  19634. SaveResult save (const bool askUserForFileIfNotSpecified,
  19635. const bool showMessageOnFailure);
  19636. SaveResult saveIfNeededAndUserAgrees();
  19637. SaveResult saveAs (const File& newFile,
  19638. const bool warnAboutOverwritingExistingFiles,
  19639. const bool askUserForFileIfNotSpecified,
  19640. const bool showMessageOnFailure);
  19641. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19642. const File getFile() const { return documentFile; }
  19643. void setFile (const File& newFile);
  19644. protected:
  19645. virtual const String getDocumentTitle() = 0;
  19646. virtual const String loadDocument (const File& file) = 0;
  19647. virtual const String saveDocument (const File& file) = 0;
  19648. virtual const File getLastDocumentOpened() = 0;
  19649. virtual void setLastDocumentOpened (const File& file) = 0;
  19650. public:
  19651. juce_UseDebuggingNewOperator
  19652. private:
  19653. File documentFile;
  19654. bool changedSinceSave;
  19655. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19656. FileBasedDocument (const FileBasedDocument&);
  19657. FileBasedDocument& operator= (const FileBasedDocument&);
  19658. };
  19659. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19660. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19661. #endif
  19662. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19663. #endif
  19664. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19665. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19666. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19667. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19668. class JUCE_API RecentlyOpenedFilesList
  19669. {
  19670. public:
  19671. RecentlyOpenedFilesList();
  19672. ~RecentlyOpenedFilesList();
  19673. void setMaxNumberOfItems (const int newMaxNumber);
  19674. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19675. int getNumFiles() const;
  19676. const File getFile (const int index) const;
  19677. const StringArray& getAllFilenames() const throw() { return files; }
  19678. void clear();
  19679. void addFile (const File& file);
  19680. void removeNonExistentFiles();
  19681. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19682. const int baseItemId,
  19683. const bool showFullPaths,
  19684. const bool dontAddNonExistentFiles,
  19685. const File** filesToAvoid = 0);
  19686. const String toString() const;
  19687. void restoreFromString (const String& stringifiedVersion);
  19688. juce_UseDebuggingNewOperator
  19689. private:
  19690. StringArray files;
  19691. int maxNumberOfItems;
  19692. };
  19693. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19694. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19695. #endif
  19696. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19697. #endif
  19698. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19699. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19700. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19701. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19702. class JUCE_API SystemClipboard
  19703. {
  19704. public:
  19705. static void copyTextToClipboard (const String& text) throw();
  19706. static const String getTextFromClipboard() throw();
  19707. };
  19708. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19709. /*** End of inlined file: juce_SystemClipboard.h ***/
  19710. #endif
  19711. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19712. #endif
  19713. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19714. #endif
  19715. #endif
  19716. /*** End of inlined file: juce_app_includes.h ***/
  19717. #endif
  19718. #if JUCE_MSVC
  19719. #pragma warning (pop)
  19720. #pragma pack (pop)
  19721. #endif
  19722. END_JUCE_NAMESPACE
  19723. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19724. #ifdef JUCE_NAMESPACE
  19725. // this will obviously save a lot of typing, but can be disabled by
  19726. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19727. using namespace JUCE_NAMESPACE;
  19728. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19729. #define Component JUCE_NAMESPACE::Component
  19730. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19731. #define Point JUCE_NAMESPACE::Point
  19732. #define Button JUCE_NAMESPACE::Button
  19733. #endif
  19734. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19735. #define Rectangle JUCE_NAMESPACE::Rectangle
  19736. #endif
  19737. #endif
  19738. #endif
  19739. #if JUCE_MSVC
  19740. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19741. #ifdef JUCE_DLL
  19742. #ifdef JUCE_DEBUG
  19743. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19744. #else
  19745. #define AUTOLINKEDLIB "JUCE.lib"
  19746. #endif
  19747. #else
  19748. #ifdef JUCE_DEBUG
  19749. #ifdef _WIN64
  19750. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19751. #else
  19752. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19753. #endif
  19754. #else
  19755. #ifdef _WIN64
  19756. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19757. #else
  19758. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19759. #endif
  19760. #endif
  19761. #endif
  19762. #pragma comment(lib, AUTOLINKEDLIB)
  19763. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19764. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19765. #endif
  19766. // Auto-link the other win32 libs that are needed by library calls..
  19767. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19768. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19769. // Auto-links to various win32 libs that are needed by library calls..
  19770. #pragma comment(lib, "kernel32.lib")
  19771. #pragma comment(lib, "user32.lib")
  19772. #pragma comment(lib, "shell32.lib")
  19773. #pragma comment(lib, "gdi32.lib")
  19774. #pragma comment(lib, "vfw32.lib")
  19775. #pragma comment(lib, "comdlg32.lib")
  19776. #pragma comment(lib, "winmm.lib")
  19777. #pragma comment(lib, "wininet.lib")
  19778. #pragma comment(lib, "ole32.lib")
  19779. #pragma comment(lib, "oleaut32.lib")
  19780. #pragma comment(lib, "advapi32.lib")
  19781. #pragma comment(lib, "ws2_32.lib")
  19782. #pragma comment(lib, "comsupp.lib")
  19783. #pragma comment(lib, "version.lib")
  19784. #if JUCE_OPENGL
  19785. #pragma comment(lib, "OpenGL32.Lib")
  19786. #pragma comment(lib, "GlU32.Lib")
  19787. #endif
  19788. #if JUCE_QUICKTIME
  19789. #pragma comment (lib, "QTMLClient.lib")
  19790. #endif
  19791. #if JUCE_USE_CAMERA
  19792. #pragma comment (lib, "Strmiids.lib")
  19793. #pragma comment (lib, "wmvcore.lib")
  19794. #endif
  19795. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19796. #endif
  19797. #endif
  19798. #endif
  19799. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19800. #define START_JUCE_APPLICATION(AppClass) \
  19801. int main (int argc, char* argv[]) \
  19802. { \
  19803. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19804. }
  19805. #elif JUCE_WINDOWS
  19806. #ifdef _CONSOLE
  19807. #define START_JUCE_APPLICATION(AppClass) \
  19808. int main (int, char* argv[]) \
  19809. { \
  19810. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19811. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19812. }
  19813. #elif ! defined (_AFXDLL)
  19814. #ifdef _WINDOWS_
  19815. #define START_JUCE_APPLICATION(AppClass) \
  19816. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19817. { \
  19818. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19819. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19820. }
  19821. #else
  19822. #define START_JUCE_APPLICATION(AppClass) \
  19823. int __stdcall WinMain (int, int, const char*, int) \
  19824. { \
  19825. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19826. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19827. }
  19828. #endif
  19829. #endif
  19830. #endif
  19831. #endif // __JUCE_JUCEHEADER__
  19832. /*** End of inlined file: juce.h ***/
  19833. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__