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.

28660 lines
734KB

  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. private:
  648. ByteOrder();
  649. ByteOrder (const ByteOrder&);
  650. ByteOrder& operator= (const ByteOrder&);
  651. };
  652. #if JUCE_USE_INTRINSICS
  653. #pragma intrinsic (_byteswap_ulong)
  654. #endif
  655. inline uint16 ByteOrder::swap (uint16 n)
  656. {
  657. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  658. return static_cast <uint16> (_byteswap_ushort (n));
  659. #else
  660. return static_cast <uint16> ((n << 8) | (n >> 8));
  661. #endif
  662. }
  663. inline uint32 ByteOrder::swap (uint32 n)
  664. {
  665. #if JUCE_MAC || JUCE_IPHONE
  666. return OSSwapInt32 (n);
  667. #elif JUCE_GCC
  668. asm("bswap %%eax" : "=a"(n) : "a"(n));
  669. return n;
  670. #elif JUCE_USE_INTRINSICS
  671. return _byteswap_ulong (n);
  672. #else
  673. __asm {
  674. mov eax, n
  675. bswap eax
  676. mov n, eax
  677. }
  678. return n;
  679. #endif
  680. }
  681. inline uint64 ByteOrder::swap (uint64 value)
  682. {
  683. #if JUCE_MAC || JUCE_IPHONE
  684. return OSSwapInt64 (value);
  685. #elif JUCE_USE_INTRINSICS
  686. return _byteswap_uint64 (value);
  687. #else
  688. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  689. #endif
  690. }
  691. #if JUCE_LITTLE_ENDIAN
  692. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  693. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  694. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  695. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  696. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  697. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  698. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  699. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  700. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  701. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  702. inline bool ByteOrder::isBigEndian() { return false; }
  703. #else
  704. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  705. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  706. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  707. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  708. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  709. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  710. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); }
  711. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); }
  712. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); }
  713. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); }
  714. inline bool ByteOrder::isBigEndian() { return true; }
  715. #endif
  716. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  717. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  718. 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); }
  719. 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); }
  720. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  721. /*** End of inlined file: juce_ByteOrder.h ***/
  722. /*** Start of inlined file: juce_Logger.h ***/
  723. #ifndef __JUCE_LOGGER_JUCEHEADER__
  724. #define __JUCE_LOGGER_JUCEHEADER__
  725. /*** Start of inlined file: juce_String.h ***/
  726. #ifndef __JUCE_STRING_JUCEHEADER__
  727. #define __JUCE_STRING_JUCEHEADER__
  728. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  729. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  730. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  731. #define JUCE_T(stringLiteral) (L##stringLiteral)
  732. typedef juce_wchar tchar;
  733. #if ! JUCE_DONT_DEFINE_MACROS
  734. #define T(stringLiteral) JUCE_T(stringLiteral)
  735. #endif
  736. class JUCE_API CharacterFunctions
  737. {
  738. public:
  739. static int length (const char* const s) throw();
  740. static int length (const juce_wchar* const s) throw();
  741. static void copy (char* dest, const char* src, const int maxBytes) throw();
  742. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  743. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  744. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  745. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  746. static void append (char* dest, const char* src) throw();
  747. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  748. static int compare (const char* const s1, const char* const s2) throw();
  749. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  750. static int compare (const juce_wchar* s1, const char* s2) throw();
  751. static int compare (const char* s1, const juce_wchar* s2) throw();
  752. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  753. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  754. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  755. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  756. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  757. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  758. static const char* find (const char* const haystack, const char* const needle) throw();
  759. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  760. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  761. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  762. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  763. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  764. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  765. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  766. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  767. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  768. static int getIntValue (const char* const s) throw();
  769. static int getIntValue (const juce_wchar* s) throw();
  770. static int64 getInt64Value (const char* s) throw();
  771. static int64 getInt64Value (const juce_wchar* s) throw();
  772. static double getDoubleValue (const char* const s) throw();
  773. static double getDoubleValue (const juce_wchar* const s) throw();
  774. static char toUpperCase (const char character) throw();
  775. static juce_wchar toUpperCase (const juce_wchar character) throw();
  776. static void toUpperCase (char* s) throw();
  777. static void toUpperCase (juce_wchar* s) throw();
  778. static bool isUpperCase (const char character) throw();
  779. static bool isUpperCase (const juce_wchar character) throw();
  780. static char toLowerCase (const char character) throw();
  781. static juce_wchar toLowerCase (const juce_wchar character) throw();
  782. static void toLowerCase (char* s) throw();
  783. static void toLowerCase (juce_wchar* s) throw();
  784. static bool isLowerCase (const char character) throw();
  785. static bool isLowerCase (const juce_wchar character) throw();
  786. static bool isWhitespace (const char character) throw();
  787. static bool isWhitespace (const juce_wchar character) throw();
  788. static bool isDigit (const char character) throw();
  789. static bool isDigit (const juce_wchar character) throw();
  790. static bool isLetter (const char character) throw();
  791. static bool isLetter (const juce_wchar character) throw();
  792. static bool isLetterOrDigit (const char character) throw();
  793. static bool isLetterOrDigit (const juce_wchar character) throw();
  794. static int getHexDigitValue (const juce_wchar digit) throw();
  795. };
  796. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  797. /*** End of inlined file: juce_CharacterFunctions.h ***/
  798. class OutputStream;
  799. class JUCE_API String
  800. {
  801. public:
  802. String() throw();
  803. String (const String& other) throw();
  804. String (const char* text);
  805. String (const char* text, size_t maxChars);
  806. String (const juce_wchar* unicodeText);
  807. String (const juce_wchar* unicodeText, size_t maxChars);
  808. static const String charToString (juce_wchar character);
  809. ~String() throw();
  810. //========================juce_wchar======================================================
  811. static const String empty;
  812. int hashCode() const throw();
  813. int64 hashCode64() const throw();
  814. int length() const throw();
  815. // Assignment and concatenation operators..
  816. String& operator= (const String& other) throw();
  817. String& operator+= (const juce_wchar* textToAppend);
  818. String& operator+= (const String& stringToAppend);
  819. String& operator+= (char characterToAppend);
  820. String& operator+= (juce_wchar characterToAppend);
  821. String& operator+= (int numberToAppend);
  822. String& operator+= (unsigned int numberToAppend);
  823. void append (const juce_wchar* textToAppend, int maxCharsToTake);
  824. // Comparison methods..
  825. inline bool isEmpty() const throw() { return text[0] == 0; }
  826. inline bool isNotEmpty() const throw() { return text[0] != 0; }
  827. bool equalsIgnoreCase (const String& other) const throw();
  828. bool equalsIgnoreCase (const juce_wchar* other) const throw();
  829. int compare (const String& other) const throw();
  830. int compare (const char* other) const throw();
  831. int compare (const juce_wchar* other) const throw();
  832. int compareIgnoreCase (const String& other) const throw();
  833. int compareLexicographically (const String& other) const throw();
  834. bool startsWith (const juce_wchar* text) const throw();
  835. bool startsWithChar (juce_wchar character) const throw();
  836. bool startsWithIgnoreCase (const juce_wchar* text) const throw();
  837. bool endsWith (const juce_wchar* text) const throw();
  838. bool endsWithChar (juce_wchar character) const throw();
  839. bool endsWithIgnoreCase (const juce_wchar* text) const throw();
  840. bool contains (const juce_wchar* text) const throw();
  841. bool containsChar (juce_wchar character) const throw();
  842. bool containsIgnoreCase (const juce_wchar* text) const throw();
  843. bool containsWholeWord (const juce_wchar* wordToLookFor) const throw();
  844. bool containsWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  845. int indexOfWholeWord (const juce_wchar* wordToLookFor) const throw();
  846. int indexOfWholeWordIgnoreCase (const juce_wchar* wordToLookFor) const throw();
  847. bool containsAnyOf (const juce_wchar* charactersItMightContain) const throw();
  848. bool containsOnly (const juce_wchar* charactersItMightContain) const throw();
  849. bool containsNonWhitespaceChars() const throw();
  850. bool matchesWildcard (const juce_wchar* wildcard, bool ignoreCase) const throw();
  851. // Substring location methods..
  852. int indexOfChar (juce_wchar characterToLookFor) const throw();
  853. int indexOfChar (int startIndex, juce_wchar characterToLookFor) const throw();
  854. int indexOfAnyOf (const juce_wchar* charactersToLookFor,
  855. int startIndex = 0,
  856. bool ignoreCase = false) const throw();
  857. int indexOf (const juce_wchar* text) const throw();
  858. int indexOf (int startIndex,
  859. const juce_wchar* textToLookFor) const throw();
  860. int indexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  861. int indexOfIgnoreCase (int startIndex,
  862. const juce_wchar* textToLookFor) const throw();
  863. int lastIndexOfChar (juce_wchar character) const throw();
  864. int lastIndexOf (const juce_wchar* textToLookFor) const throw();
  865. int lastIndexOfIgnoreCase (const juce_wchar* textToLookFor) const throw();
  866. int lastIndexOfAnyOf (const juce_wchar* charactersToLookFor,
  867. bool ignoreCase = false) const throw();
  868. // Substring extraction and manipulation methods..
  869. /** Returns the character at this index in the string.
  870. No checks are made to see if the index is within a valid range, so be careful!
  871. */
  872. inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; }
  873. juce_wchar& operator[] (int index);
  874. juce_wchar getLastCharacter() const throw();
  875. const String substring (int startIndex, int endIndex) const;
  876. const String substring (int startIndex) const;
  877. const String dropLastCharacters (int numberToDrop) const;
  878. const String getLastCharacters (int numCharacters) const;
  879. const String fromFirstOccurrenceOf (const juce_wchar* substringToStartFrom,
  880. bool includeSubStringInResult,
  881. bool ignoreCase) const;
  882. const String fromLastOccurrenceOf (const juce_wchar* substringToFind,
  883. bool includeSubStringInResult,
  884. bool ignoreCase) const;
  885. const String upToFirstOccurrenceOf (const juce_wchar* substringToEndWith,
  886. bool includeSubStringInResult,
  887. bool ignoreCase) const;
  888. const String upToLastOccurrenceOf (const juce_wchar* substringToFind,
  889. bool includeSubStringInResult,
  890. bool ignoreCase) const;
  891. const String trim() const;
  892. const String trimStart() const;
  893. const String trimEnd() const;
  894. const String trimCharactersAtStart (const juce_wchar* charactersToTrim) const;
  895. const String trimCharactersAtEnd (const juce_wchar* charactersToTrim) const;
  896. const String toUpperCase() const;
  897. const String toLowerCase() const;
  898. const String replaceSection (int startIndex,
  899. int numCharactersToReplace,
  900. const juce_wchar* stringToInsert) const;
  901. const String replace (const juce_wchar* stringToReplace,
  902. const juce_wchar* stringToInsertInstead,
  903. bool ignoreCase = false) const;
  904. const String replaceCharacter (juce_wchar characterToReplace,
  905. juce_wchar characterToInsertInstead) const;
  906. const String replaceCharacters (const String& charactersToReplace,
  907. const juce_wchar* charactersToInsertInstead) const;
  908. const String retainCharacters (const juce_wchar* charactersToRetain) const;
  909. const String removeCharacters (const juce_wchar* charactersToRemove) const;
  910. const String initialSectionContainingOnly (const juce_wchar* permittedCharacters) const;
  911. const String initialSectionNotContaining (const juce_wchar* charactersToStopAt) const;
  912. bool isQuotedString() const;
  913. const String unquoted() const;
  914. const String quoted (juce_wchar quoteCharacter = '"') const;
  915. static const String repeatedString (const juce_wchar* stringToRepeat,
  916. int numberOfTimesToRepeat);
  917. const String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
  918. const String paddedRight (juce_wchar padCharacter, int minimumLength) const;
  919. static const String createStringFromData (const void* data, int size);
  920. static const String formatted (const juce_wchar* formatString, ... );
  921. // Numeric conversions..
  922. explicit String (int decimalInteger);
  923. explicit String (unsigned int decimalInteger);
  924. explicit String (short decimalInteger);
  925. explicit String (unsigned short decimalInteger);
  926. explicit String (int64 largeIntegerValue);
  927. explicit String (uint64 largeIntegerValue);
  928. explicit String (float floatValue,
  929. int numberOfDecimalPlaces = 0);
  930. explicit String (double doubleValue,
  931. int numberOfDecimalPlaces = 0);
  932. int getIntValue() const throw();
  933. int64 getLargeIntValue() const throw();
  934. int getTrailingIntValue() const throw();
  935. float getFloatValue() const throw();
  936. double getDoubleValue() const throw();
  937. int getHexValue32() const throw();
  938. int64 getHexValue64() const throw();
  939. static const String toHexString (int number);
  940. static const String toHexString (int64 number);
  941. static const String toHexString (short number);
  942. static const String toHexString (const unsigned char* data,
  943. int size,
  944. int groupSize = 1);
  945. inline operator const juce_wchar*() const throw() { return text; }
  946. inline operator juce_wchar*() throw() { return text; }
  947. const char* toUTF8() const;
  948. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  949. int getNumBytesAsUTF8() const throw();
  950. int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw();
  951. const char* toCString() const;
  952. int getNumBytesAsCString() const throw();
  953. int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw();
  954. void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
  955. void preallocateStorage (size_t numCharsNeeded);
  956. void swapWith (String& other) throw();
  957. class JUCE_API Concatenator
  958. {
  959. public:
  960. Concatenator (String& stringToAppendTo);
  961. ~Concatenator();
  962. void append (const String& s);
  963. private:
  964. String& result;
  965. int nextIndex;
  966. Concatenator (const Concatenator&);
  967. Concatenator& operator= (const Concatenator&);
  968. };
  969. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  970. private:
  971. juce_wchar* text;
  972. // internal constructor that preallocates a certain amount of memory
  973. String (size_t numChars, int dummyVariable);
  974. String (const String& stringToCopy, size_t charsToAllocate);
  975. void createInternal (const juce_wchar* text, size_t numChars);
  976. void appendInternal (const juce_wchar* text, int numExtraChars);
  977. };
  978. const String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
  979. const String JUCE_CALLTYPE operator+ (const juce_wchar* string1, const String& string2);
  980. const String JUCE_CALLTYPE operator+ (char string1, const String& string2);
  981. const String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
  982. const String JUCE_CALLTYPE operator+ (String string1, const String& string2);
  983. const String JUCE_CALLTYPE operator+ (String string1, const char* string2);
  984. const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar* string2);
  985. const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
  986. const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
  987. String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
  988. String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
  989. String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
  990. String& JUCE_CALLTYPE operator<< (String& string1, const juce_wchar* string2);
  991. String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
  992. String& JUCE_CALLTYPE operator<< (String& string1, short number);
  993. String& JUCE_CALLTYPE operator<< (String& string1, int number);
  994. String& JUCE_CALLTYPE operator<< (String& string1, unsigned int number);
  995. String& JUCE_CALLTYPE operator<< (String& string1, long number);
  996. String& JUCE_CALLTYPE operator<< (String& string1, unsigned long number);
  997. String& JUCE_CALLTYPE operator<< (String& string1, float number);
  998. String& JUCE_CALLTYPE operator<< (String& string1, double number);
  999. bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw();
  1000. bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw();
  1001. bool JUCE_CALLTYPE operator== (const String& string1, const juce_wchar* string2) throw();
  1002. bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw();
  1003. bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw();
  1004. bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* string2) throw();
  1005. bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw();
  1006. bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw();
  1007. bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw();
  1008. bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
  1009. template <class charT, class traits>
  1010. std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1011. {
  1012. return stream << stringToWrite.toUTF8();
  1013. }
  1014. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);
  1015. #endif // __JUCE_STRING_JUCEHEADER__
  1016. /*** End of inlined file: juce_String.h ***/
  1017. class JUCE_API Logger
  1018. {
  1019. public:
  1020. virtual ~Logger();
  1021. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1022. const bool deleteOldLogger = false);
  1023. static void JUCE_CALLTYPE writeToLog (const String& message);
  1024. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1025. protected:
  1026. Logger();
  1027. virtual void logMessage (const String& message) = 0;
  1028. };
  1029. #endif // __JUCE_LOGGER_JUCEHEADER__
  1030. /*** End of inlined file: juce_Logger.h ***/
  1031. END_JUCE_NAMESPACE
  1032. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1033. /*** End of inlined file: juce_StandardHeader.h ***/
  1034. BEGIN_JUCE_NAMESPACE
  1035. #if JUCE_MSVC
  1036. // this is set explicitly in case the app is using a different packing size.
  1037. #pragma pack (push, 8)
  1038. #pragma warning (push)
  1039. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1040. #endif
  1041. // this is where all the class header files get brought in..
  1042. /*** Start of inlined file: juce_core_includes.h ***/
  1043. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1044. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1045. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1046. /*** Start of inlined file: juce_Array.h ***/
  1047. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1048. #define __JUCE_ARRAY_JUCEHEADER__
  1049. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1050. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1051. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1052. /*** Start of inlined file: juce_HeapBlock.h ***/
  1053. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1054. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1055. template <class ElementType>
  1056. class HeapBlock
  1057. {
  1058. public:
  1059. HeapBlock() throw() : data (0)
  1060. {
  1061. }
  1062. HeapBlock (const size_t numElements)
  1063. : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1064. {
  1065. }
  1066. ~HeapBlock()
  1067. {
  1068. ::juce_free (data);
  1069. }
  1070. inline operator ElementType*() const throw() { return data; }
  1071. inline ElementType* getData() const throw() { return data; }
  1072. inline operator void*() const throw() { return static_cast <void*> (data); }
  1073. inline ElementType* operator->() const throw() { return data; }
  1074. template <typename IndexType>
  1075. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1076. template <typename IndexType>
  1077. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1078. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1079. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1080. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1081. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1082. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1083. {
  1084. ::juce_free (data);
  1085. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1086. }
  1087. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1088. {
  1089. ::juce_free (data);
  1090. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1091. }
  1092. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1093. {
  1094. ::juce_free (data);
  1095. if (initialiseToZero)
  1096. data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1097. else
  1098. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1099. }
  1100. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1101. {
  1102. if (data == 0)
  1103. data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1104. else
  1105. data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1106. }
  1107. void free()
  1108. {
  1109. ::juce_free (data);
  1110. data = 0;
  1111. }
  1112. void swapWith (HeapBlock <ElementType>& other) throw()
  1113. {
  1114. swapVariables (data, other.data);
  1115. }
  1116. private:
  1117. ElementType* data;
  1118. HeapBlock (const HeapBlock&);
  1119. HeapBlock& operator= (const HeapBlock&);
  1120. };
  1121. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1122. /*** End of inlined file: juce_HeapBlock.h ***/
  1123. template <class ElementType, class TypeOfCriticalSectionToUse>
  1124. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1125. {
  1126. public:
  1127. ArrayAllocationBase() throw()
  1128. : numAllocated (0)
  1129. {
  1130. }
  1131. ~ArrayAllocationBase()
  1132. {
  1133. }
  1134. void setAllocatedSize (const int numElements)
  1135. {
  1136. if (numAllocated != numElements)
  1137. {
  1138. if (numElements > 0)
  1139. elements.realloc (numElements);
  1140. else
  1141. elements.free();
  1142. numAllocated = numElements;
  1143. }
  1144. }
  1145. void ensureAllocatedSize (const int minNumElements)
  1146. {
  1147. if (minNumElements > numAllocated)
  1148. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1149. }
  1150. void shrinkToNoMoreThan (const int maxNumElements)
  1151. {
  1152. if (maxNumElements < numAllocated)
  1153. setAllocatedSize (maxNumElements);
  1154. }
  1155. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1156. {
  1157. elements.swapWith (other.elements);
  1158. swapVariables (numAllocated, other.numAllocated);
  1159. }
  1160. HeapBlock <ElementType> elements;
  1161. int numAllocated;
  1162. private:
  1163. ArrayAllocationBase (const ArrayAllocationBase&);
  1164. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1165. };
  1166. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1167. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1168. /*** Start of inlined file: juce_ElementComparator.h ***/
  1169. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1170. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1171. template <class ElementType, class ElementComparator>
  1172. static void sortArray (ElementComparator& comparator,
  1173. ElementType* const array,
  1174. int firstElement,
  1175. int lastElement,
  1176. const bool retainOrderOfEquivalentItems)
  1177. {
  1178. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1179. // avoids getting warning messages about the parameter being unused
  1180. if (lastElement > firstElement)
  1181. {
  1182. if (retainOrderOfEquivalentItems)
  1183. {
  1184. for (int i = firstElement; i < lastElement; ++i)
  1185. {
  1186. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1187. {
  1188. const ElementType temp = array [i];
  1189. array [i] = array[i + 1];
  1190. array [i + 1] = temp;
  1191. if (i > firstElement)
  1192. i -= 2;
  1193. }
  1194. }
  1195. }
  1196. else
  1197. {
  1198. int fromStack[30], toStack[30];
  1199. int stackIndex = 0;
  1200. for (;;)
  1201. {
  1202. const int size = (lastElement - firstElement) + 1;
  1203. if (size <= 8)
  1204. {
  1205. int j = lastElement;
  1206. int maxIndex;
  1207. while (j > firstElement)
  1208. {
  1209. maxIndex = firstElement;
  1210. for (int k = firstElement + 1; k <= j; ++k)
  1211. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1212. maxIndex = k;
  1213. const ElementType temp = array [maxIndex];
  1214. array [maxIndex] = array[j];
  1215. array [j] = temp;
  1216. --j;
  1217. }
  1218. }
  1219. else
  1220. {
  1221. const int mid = firstElement + (size >> 1);
  1222. ElementType temp = array [mid];
  1223. array [mid] = array [firstElement];
  1224. array [firstElement] = temp;
  1225. int i = firstElement;
  1226. int j = lastElement + 1;
  1227. for (;;)
  1228. {
  1229. while (++i <= lastElement
  1230. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1231. {}
  1232. while (--j > firstElement
  1233. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1234. {}
  1235. if (j < i)
  1236. break;
  1237. temp = array[i];
  1238. array[i] = array[j];
  1239. array[j] = temp;
  1240. }
  1241. temp = array [firstElement];
  1242. array [firstElement] = array[j];
  1243. array [j] = temp;
  1244. if (j - 1 - firstElement >= lastElement - i)
  1245. {
  1246. if (firstElement + 1 < j)
  1247. {
  1248. fromStack [stackIndex] = firstElement;
  1249. toStack [stackIndex] = j - 1;
  1250. ++stackIndex;
  1251. }
  1252. if (i < lastElement)
  1253. {
  1254. firstElement = i;
  1255. continue;
  1256. }
  1257. }
  1258. else
  1259. {
  1260. if (i < lastElement)
  1261. {
  1262. fromStack [stackIndex] = i;
  1263. toStack [stackIndex] = lastElement;
  1264. ++stackIndex;
  1265. }
  1266. if (firstElement + 1 < j)
  1267. {
  1268. lastElement = j - 1;
  1269. continue;
  1270. }
  1271. }
  1272. }
  1273. if (--stackIndex < 0)
  1274. break;
  1275. jassert (stackIndex < numElementsInArray (fromStack));
  1276. firstElement = fromStack [stackIndex];
  1277. lastElement = toStack [stackIndex];
  1278. }
  1279. }
  1280. }
  1281. }
  1282. template <class ElementType, class ElementComparator>
  1283. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1284. ElementType* const array,
  1285. const ElementType newElement,
  1286. int firstElement,
  1287. int lastElement)
  1288. {
  1289. jassert (firstElement <= lastElement);
  1290. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1291. // avoids getting warning messages about the parameter being unused
  1292. while (firstElement < lastElement)
  1293. {
  1294. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1295. {
  1296. ++firstElement;
  1297. break;
  1298. }
  1299. else
  1300. {
  1301. const int halfway = (firstElement + lastElement) >> 1;
  1302. if (halfway == firstElement)
  1303. {
  1304. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1305. ++firstElement;
  1306. break;
  1307. }
  1308. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1309. {
  1310. firstElement = halfway;
  1311. }
  1312. else
  1313. {
  1314. lastElement = halfway;
  1315. }
  1316. }
  1317. }
  1318. return firstElement;
  1319. }
  1320. template <class ElementType>
  1321. class IntegerElementComparator
  1322. {
  1323. public:
  1324. static int compareElements (const ElementType first,
  1325. const ElementType second) throw()
  1326. {
  1327. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1328. }
  1329. };
  1330. template <class ElementType>
  1331. class FloatElementComparator
  1332. {
  1333. public:
  1334. static int compareElements (const ElementType first,
  1335. const ElementType second) throw()
  1336. {
  1337. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1338. }
  1339. };
  1340. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1341. /*** End of inlined file: juce_ElementComparator.h ***/
  1342. /*** Start of inlined file: juce_CriticalSection.h ***/
  1343. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1344. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1345. class JUCE_API ScopedLock;
  1346. class JUCE_API ScopedUnlock;
  1347. class JUCE_API CriticalSection
  1348. {
  1349. public:
  1350. CriticalSection() throw();
  1351. ~CriticalSection() throw();
  1352. void enter() const throw();
  1353. bool tryEnter() const throw();
  1354. void exit() const throw();
  1355. typedef ScopedLock ScopedLockType;
  1356. typedef ScopedUnlock ScopedUnlockType;
  1357. juce_UseDebuggingNewOperator
  1358. private:
  1359. #if JUCE_WIN32
  1360. #if JUCE_64BIT
  1361. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1362. // block of memory here that's big enough to be used internally as a windows critical
  1363. // section object.
  1364. uint8 internal [44];
  1365. #else
  1366. uint8 internal [24];
  1367. #endif
  1368. #else
  1369. mutable pthread_mutex_t internal;
  1370. #endif
  1371. CriticalSection (const CriticalSection&);
  1372. CriticalSection& operator= (const CriticalSection&);
  1373. };
  1374. class JUCE_API DummyCriticalSection
  1375. {
  1376. public:
  1377. inline DummyCriticalSection() throw() {}
  1378. inline ~DummyCriticalSection() throw() {}
  1379. inline void enter() const throw() {}
  1380. inline void exit() const throw() {}
  1381. struct ScopedLockType
  1382. {
  1383. ScopedLockType (const DummyCriticalSection&) throw() {}
  1384. };
  1385. typedef ScopedLockType ScopedUnlockType;
  1386. private:
  1387. DummyCriticalSection (const DummyCriticalSection&);
  1388. DummyCriticalSection& operator= (const DummyCriticalSection&);
  1389. };
  1390. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1391. /*** End of inlined file: juce_CriticalSection.h ***/
  1392. template <typename ElementType,
  1393. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1394. class Array
  1395. {
  1396. public:
  1397. Array() throw()
  1398. : numUsed (0)
  1399. {
  1400. }
  1401. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1402. {
  1403. const ScopedLockType lock (other.getLock());
  1404. numUsed = other.numUsed;
  1405. data.setAllocatedSize (other.numUsed);
  1406. for (int i = 0; i < numUsed; ++i)
  1407. new (data.elements + i) ElementType (other.data.elements[i]);
  1408. }
  1409. explicit Array (const ElementType* values)
  1410. : numUsed (0)
  1411. {
  1412. while (*values != 0)
  1413. add (*values++);
  1414. }
  1415. Array (const ElementType* values, int numValues)
  1416. : numUsed (numValues)
  1417. {
  1418. data.setAllocatedSize (numValues);
  1419. for (int i = 0; i < numValues; ++i)
  1420. new (data.elements + i) ElementType (values[i]);
  1421. }
  1422. ~Array()
  1423. {
  1424. for (int i = 0; i < numUsed; ++i)
  1425. data.elements[i].~ElementType();
  1426. }
  1427. Array& operator= (const Array& other)
  1428. {
  1429. if (this != &other)
  1430. {
  1431. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1432. swapWithArray (otherCopy);
  1433. }
  1434. return *this;
  1435. }
  1436. template <class OtherArrayType>
  1437. bool operator== (const OtherArrayType& other) const
  1438. {
  1439. const ScopedLockType lock (getLock());
  1440. if (numUsed != other.numUsed)
  1441. return false;
  1442. for (int i = numUsed; --i >= 0;)
  1443. if (data.elements [i] != other.data.elements [i])
  1444. return false;
  1445. return true;
  1446. }
  1447. template <class OtherArrayType>
  1448. bool operator!= (const OtherArrayType& other) const
  1449. {
  1450. return ! operator== (other);
  1451. }
  1452. void clear()
  1453. {
  1454. const ScopedLockType lock (getLock());
  1455. for (int i = 0; i < numUsed; ++i)
  1456. data.elements[i].~ElementType();
  1457. data.setAllocatedSize (0);
  1458. numUsed = 0;
  1459. }
  1460. void clearQuick()
  1461. {
  1462. const ScopedLockType lock (getLock());
  1463. for (int i = 0; i < numUsed; ++i)
  1464. data.elements[i].~ElementType();
  1465. numUsed = 0;
  1466. }
  1467. inline int size() const throw()
  1468. {
  1469. return numUsed;
  1470. }
  1471. inline ElementType operator[] (const int index) const
  1472. {
  1473. const ScopedLockType lock (getLock());
  1474. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1475. : ElementType();
  1476. }
  1477. inline const ElementType getUnchecked (const int index) const
  1478. {
  1479. const ScopedLockType lock (getLock());
  1480. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1481. return data.elements [index];
  1482. }
  1483. inline ElementType& getReference (const int index) const throw()
  1484. {
  1485. const ScopedLockType lock (getLock());
  1486. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1487. return data.elements [index];
  1488. }
  1489. inline ElementType getFirst() const
  1490. {
  1491. const ScopedLockType lock (getLock());
  1492. return (numUsed > 0) ? data.elements [0]
  1493. : ElementType();
  1494. }
  1495. inline ElementType getLast() const
  1496. {
  1497. const ScopedLockType lock (getLock());
  1498. return (numUsed > 0) ? data.elements [numUsed - 1]
  1499. : ElementType();
  1500. }
  1501. int indexOf (const ElementType& elementToLookFor) const
  1502. {
  1503. const ScopedLockType lock (getLock());
  1504. const ElementType* e = data.elements.getData();
  1505. const ElementType* const end = e + numUsed;
  1506. while (e != end)
  1507. {
  1508. if (elementToLookFor == *e)
  1509. return static_cast <int> (e - data.elements.getData());
  1510. ++e;
  1511. }
  1512. return -1;
  1513. }
  1514. bool contains (const ElementType& elementToLookFor) const
  1515. {
  1516. const ScopedLockType lock (getLock());
  1517. const ElementType* e = data.elements.getData();
  1518. const ElementType* const end = e + numUsed;
  1519. while (e != end)
  1520. {
  1521. if (elementToLookFor == *e)
  1522. return true;
  1523. ++e;
  1524. }
  1525. return false;
  1526. }
  1527. void add (const ElementType& newElement)
  1528. {
  1529. const ScopedLockType lock (getLock());
  1530. data.ensureAllocatedSize (numUsed + 1);
  1531. new (data.elements + numUsed++) ElementType (newElement);
  1532. }
  1533. void insert (int indexToInsertAt, const ElementType& newElement)
  1534. {
  1535. const ScopedLockType lock (getLock());
  1536. data.ensureAllocatedSize (numUsed + 1);
  1537. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1538. {
  1539. ElementType* const insertPos = data.elements + indexToInsertAt;
  1540. const int numberToMove = numUsed - indexToInsertAt;
  1541. if (numberToMove > 0)
  1542. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1543. new (insertPos) ElementType (newElement);
  1544. ++numUsed;
  1545. }
  1546. else
  1547. {
  1548. new (data.elements + numUsed++) ElementType (newElement);
  1549. }
  1550. }
  1551. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1552. int numberOfTimesToInsertIt)
  1553. {
  1554. if (numberOfTimesToInsertIt > 0)
  1555. {
  1556. const ScopedLockType lock (getLock());
  1557. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1558. ElementType* insertPos;
  1559. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1560. {
  1561. insertPos = data.elements + indexToInsertAt;
  1562. const int numberToMove = numUsed - indexToInsertAt;
  1563. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1564. }
  1565. else
  1566. {
  1567. insertPos = data.elements + numUsed;
  1568. }
  1569. numUsed += numberOfTimesToInsertIt;
  1570. while (--numberOfTimesToInsertIt >= 0)
  1571. new (insertPos++) ElementType (newElement);
  1572. }
  1573. }
  1574. void insertArray (int indexToInsertAt,
  1575. const ElementType* newElements,
  1576. int numberOfElements)
  1577. {
  1578. if (numberOfElements > 0)
  1579. {
  1580. const ScopedLockType lock (getLock());
  1581. data.ensureAllocatedSize (numUsed + numberOfElements);
  1582. ElementType* insertPos;
  1583. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1584. {
  1585. insertPos = data.elements + indexToInsertAt;
  1586. const int numberToMove = numUsed - indexToInsertAt;
  1587. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1588. }
  1589. else
  1590. {
  1591. insertPos = data.elements + numUsed;
  1592. }
  1593. numUsed += numberOfElements;
  1594. while (--numberOfElements >= 0)
  1595. new (insertPos++) ElementType (*newElements++);
  1596. }
  1597. }
  1598. void addIfNotAlreadyThere (const ElementType& newElement)
  1599. {
  1600. const ScopedLockType lock (getLock());
  1601. if (! contains (newElement))
  1602. add (newElement);
  1603. }
  1604. void set (const int indexToChange, const ElementType& newValue)
  1605. {
  1606. jassert (indexToChange >= 0);
  1607. const ScopedLockType lock (getLock());
  1608. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1609. {
  1610. data.elements [indexToChange] = newValue;
  1611. }
  1612. else if (indexToChange >= 0)
  1613. {
  1614. data.ensureAllocatedSize (numUsed + 1);
  1615. new (data.elements + numUsed++) ElementType (newValue);
  1616. }
  1617. }
  1618. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1619. {
  1620. const ScopedLockType lock (getLock());
  1621. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1622. data.elements [indexToChange] = newValue;
  1623. }
  1624. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1625. {
  1626. const ScopedLockType lock (getLock());
  1627. if (numElementsToAdd > 0)
  1628. {
  1629. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1630. while (--numElementsToAdd >= 0)
  1631. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1632. }
  1633. }
  1634. void swapWithArray (Array& otherArray) throw()
  1635. {
  1636. const ScopedLockType lock1 (getLock());
  1637. const ScopedLockType lock2 (otherArray.getLock());
  1638. data.swapWith (otherArray.data);
  1639. swapVariables (numUsed, otherArray.numUsed);
  1640. }
  1641. template <class OtherArrayType>
  1642. void addArray (const OtherArrayType& arrayToAddFrom,
  1643. int startIndex = 0,
  1644. int numElementsToAdd = -1)
  1645. {
  1646. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1647. const ScopedLockType lock2 (getLock());
  1648. if (startIndex < 0)
  1649. {
  1650. jassertfalse
  1651. startIndex = 0;
  1652. }
  1653. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1654. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1655. while (--numElementsToAdd >= 0)
  1656. add (arrayToAddFrom.getUnchecked (startIndex++));
  1657. }
  1658. template <class ElementComparator>
  1659. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1660. {
  1661. const ScopedLockType lock (getLock());
  1662. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1663. }
  1664. template <class ElementComparator>
  1665. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1666. {
  1667. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1668. // avoids getting warning messages about the parameter being unused
  1669. const ScopedLockType lock (getLock());
  1670. int start = 0;
  1671. int end = numUsed;
  1672. for (;;)
  1673. {
  1674. if (start >= end)
  1675. {
  1676. return -1;
  1677. }
  1678. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1679. {
  1680. return start;
  1681. }
  1682. else
  1683. {
  1684. const int halfway = (start + end) >> 1;
  1685. if (halfway == start)
  1686. return -1;
  1687. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1688. start = halfway;
  1689. else
  1690. end = halfway;
  1691. }
  1692. }
  1693. }
  1694. ElementType remove (const int indexToRemove)
  1695. {
  1696. const ScopedLockType lock (getLock());
  1697. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1698. {
  1699. --numUsed;
  1700. ElementType* const e = data.elements + indexToRemove;
  1701. ElementType removed (*e);
  1702. e->~ElementType();
  1703. const int numberToShift = numUsed - indexToRemove;
  1704. if (numberToShift > 0)
  1705. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1706. if ((numUsed << 1) < data.numAllocated)
  1707. minimiseStorageOverheads();
  1708. return removed;
  1709. }
  1710. else
  1711. {
  1712. return ElementType();
  1713. }
  1714. }
  1715. void removeValue (const ElementType& valueToRemove)
  1716. {
  1717. const ScopedLockType lock (getLock());
  1718. ElementType* e = data.elements;
  1719. for (int i = numUsed; --i >= 0;)
  1720. {
  1721. if (valueToRemove == *e)
  1722. {
  1723. remove (static_cast <int> (e - data.elements.getData()));
  1724. break;
  1725. }
  1726. ++e;
  1727. }
  1728. }
  1729. void removeRange (int startIndex, int numberToRemove)
  1730. {
  1731. const ScopedLockType lock (getLock());
  1732. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1733. startIndex = jlimit (0, numUsed, startIndex);
  1734. if (endIndex > startIndex)
  1735. {
  1736. ElementType* const e = data.elements + startIndex;
  1737. numberToRemove = endIndex - startIndex;
  1738. for (int i = 0; i < numberToRemove; ++i)
  1739. e[i].~ElementType();
  1740. const int numToShift = numUsed - endIndex;
  1741. if (numToShift > 0)
  1742. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1743. numUsed -= numberToRemove;
  1744. if ((numUsed << 1) < data.numAllocated)
  1745. minimiseStorageOverheads();
  1746. }
  1747. }
  1748. void removeLast (int howManyToRemove = 1)
  1749. {
  1750. const ScopedLockType lock (getLock());
  1751. if (howManyToRemove > numUsed)
  1752. howManyToRemove = numUsed;
  1753. for (int i = 0; i < howManyToRemove; ++i)
  1754. data.elements [numUsed - i].~ElementType();
  1755. numUsed -= howManyToRemove;
  1756. if ((numUsed << 1) < data.numAllocated)
  1757. minimiseStorageOverheads();
  1758. }
  1759. template <class OtherArrayType>
  1760. void removeValuesIn (const OtherArrayType& otherArray)
  1761. {
  1762. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1763. const ScopedLockType lock2 (getLock());
  1764. if (this == &otherArray)
  1765. {
  1766. clear();
  1767. }
  1768. else
  1769. {
  1770. if (otherArray.size() > 0)
  1771. {
  1772. for (int i = numUsed; --i >= 0;)
  1773. if (otherArray.contains (data.elements [i]))
  1774. remove (i);
  1775. }
  1776. }
  1777. }
  1778. template <class OtherArrayType>
  1779. void removeValuesNotIn (const OtherArrayType& otherArray)
  1780. {
  1781. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1782. const ScopedLockType lock2 (getLock());
  1783. if (this != &otherArray)
  1784. {
  1785. if (otherArray.size() <= 0)
  1786. {
  1787. clear();
  1788. }
  1789. else
  1790. {
  1791. for (int i = numUsed; --i >= 0;)
  1792. if (! otherArray.contains (data.elements [i]))
  1793. remove (i);
  1794. }
  1795. }
  1796. }
  1797. void swap (const int index1,
  1798. const int index2)
  1799. {
  1800. const ScopedLockType lock (getLock());
  1801. if (((unsigned int) index1) < (unsigned int) numUsed
  1802. && ((unsigned int) index2) < (unsigned int) numUsed)
  1803. {
  1804. swapVariables (data.elements [index1],
  1805. data.elements [index2]);
  1806. }
  1807. }
  1808. void move (const int currentIndex, int newIndex) throw()
  1809. {
  1810. if (currentIndex != newIndex)
  1811. {
  1812. const ScopedLockType lock (getLock());
  1813. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1814. {
  1815. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1816. newIndex = numUsed - 1;
  1817. char tempCopy [sizeof (ElementType)];
  1818. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1819. if (newIndex > currentIndex)
  1820. {
  1821. memmove (data.elements + currentIndex,
  1822. data.elements + currentIndex + 1,
  1823. (newIndex - currentIndex) * sizeof (ElementType));
  1824. }
  1825. else
  1826. {
  1827. memmove (data.elements + newIndex + 1,
  1828. data.elements + newIndex,
  1829. (currentIndex - newIndex) * sizeof (ElementType));
  1830. }
  1831. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1832. }
  1833. }
  1834. }
  1835. void minimiseStorageOverheads()
  1836. {
  1837. const ScopedLockType lock (getLock());
  1838. data.shrinkToNoMoreThan (numUsed);
  1839. }
  1840. void ensureStorageAllocated (const int minNumElements)
  1841. {
  1842. const ScopedLockType lock (getLock());
  1843. data.ensureAllocatedSize (minNumElements);
  1844. }
  1845. template <class ElementComparator>
  1846. void sort (ElementComparator& comparator,
  1847. const bool retainOrderOfEquivalentItems = false) const
  1848. {
  1849. const ScopedLockType lock (getLock());
  1850. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1851. // avoids getting warning messages about the parameter being unused
  1852. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1853. }
  1854. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1855. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1856. juce_UseDebuggingNewOperator
  1857. private:
  1858. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1859. int numUsed;
  1860. };
  1861. #endif // __JUCE_ARRAY_JUCEHEADER__
  1862. /*** End of inlined file: juce_Array.h ***/
  1863. #endif
  1864. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1865. #endif
  1866. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1867. /*** Start of inlined file: juce_BitArray.h ***/
  1868. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1869. #define __JUCE_BITARRAY_JUCEHEADER__
  1870. class MemoryBlock;
  1871. class JUCE_API BigInteger
  1872. {
  1873. public:
  1874. BigInteger();
  1875. BigInteger (unsigned int value);
  1876. BigInteger (int value);
  1877. BigInteger (int64 value);
  1878. BigInteger (const BigInteger& other);
  1879. ~BigInteger();
  1880. BigInteger& operator= (const BigInteger& other);
  1881. void swapWith (BigInteger& other) throw();
  1882. bool operator[] (int bit) const throw();
  1883. bool isZero() const throw();
  1884. bool isOne() const throw();
  1885. int toInteger() const throw();
  1886. void clear();
  1887. void clearBit (int bitNumber) throw();
  1888. void setBit (int bitNumber);
  1889. void setBit (int bitNumber, bool shouldBeSet);
  1890. void setRange (int startBit, int numBits, bool shouldBeSet);
  1891. void insertBit (int bitNumber, bool shouldBeSet);
  1892. const BigInteger getBitRange (int startBit, int numBits) const;
  1893. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1894. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1895. void shiftBits (int howManyBitsLeft, int startBit);
  1896. int countNumberOfSetBits() const throw();
  1897. int findNextSetBit (int startIndex = 0) const throw();
  1898. int findNextClearBit (int startIndex = 0) const throw();
  1899. int getHighestBit() const throw();
  1900. // All the standard arithmetic ops...
  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|= (const BigInteger& other);
  1906. BigInteger& operator&= (const BigInteger& other);
  1907. BigInteger& operator^= (const BigInteger& other);
  1908. BigInteger& operator%= (const BigInteger& other);
  1909. BigInteger& operator<<= (int numBitsToShift);
  1910. BigInteger& operator>>= (int numBitsToShift);
  1911. BigInteger& operator++();
  1912. BigInteger& operator--();
  1913. const BigInteger operator++ (int);
  1914. const BigInteger operator-- (int);
  1915. const BigInteger operator-() 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| (const BigInteger& other) const;
  1921. const BigInteger operator& (const BigInteger& other) const;
  1922. const BigInteger operator^ (const BigInteger& other) const;
  1923. const BigInteger operator% (const BigInteger& other) const;
  1924. const BigInteger operator<< (int numBitsToShift) const;
  1925. const BigInteger operator>> (int numBitsToShift) const;
  1926. bool operator== (const BigInteger& other) const throw();
  1927. bool operator!= (const BigInteger& other) const throw();
  1928. bool operator< (const BigInteger& other) const throw();
  1929. bool operator<= (const BigInteger& other) const throw();
  1930. bool operator> (const BigInteger& other) const throw();
  1931. bool operator>= (const BigInteger& other) const throw();
  1932. int compare (const BigInteger& other) const throw();
  1933. int compareAbsolute (const BigInteger& other) const throw();
  1934. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1935. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1936. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1937. void inverseModulo (const BigInteger& modulus);
  1938. bool isNegative() const throw();
  1939. void setNegative (const bool shouldBeNegative) throw();
  1940. void negate() throw();
  1941. const String toString (int base, int minimumNumCharacters = 1) const;
  1942. void parseString (const String& text, int base);
  1943. const MemoryBlock toMemoryBlock() const;
  1944. void loadFromMemoryBlock (const MemoryBlock& data);
  1945. juce_UseDebuggingNewOperator
  1946. private:
  1947. HeapBlock <unsigned int> values;
  1948. int numValues, highestBit;
  1949. bool negative;
  1950. void ensureSize (int numVals);
  1951. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1952. };
  1953. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1954. typedef BigInteger BitArray;
  1955. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1956. /*** End of inlined file: juce_BitArray.h ***/
  1957. #endif
  1958. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1959. /*** Start of inlined file: juce_DynamicObject.h ***/
  1960. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1961. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1962. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1963. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1964. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1965. /*** Start of inlined file: juce_Variant.h ***/
  1966. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1967. #define __JUCE_VARIANT_JUCEHEADER__
  1968. /*** Start of inlined file: juce_OutputStream.h ***/
  1969. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1970. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1971. /*** Start of inlined file: juce_InputStream.h ***/
  1972. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  1973. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  1974. /*** Start of inlined file: juce_MemoryBlock.h ***/
  1975. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1976. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1977. class JUCE_API MemoryBlock
  1978. {
  1979. public:
  1980. MemoryBlock() throw();
  1981. MemoryBlock (const size_t initialSize,
  1982. const bool initialiseToZero = false) throw();
  1983. MemoryBlock (const MemoryBlock& other) throw();
  1984. MemoryBlock (const void* const dataToInitialiseFrom,
  1985. const size_t sizeInBytes) throw();
  1986. ~MemoryBlock() throw();
  1987. MemoryBlock& operator= (const MemoryBlock& other) throw();
  1988. bool operator== (const MemoryBlock& other) const throw();
  1989. bool operator!= (const MemoryBlock& other) const throw();
  1990. bool matches (const void* data, size_t dataSize) const throw();
  1991. void* getData() const throw() { return data; }
  1992. template <typename Type>
  1993. char& operator[] (const Type offset) const throw() { return data [offset]; }
  1994. size_t getSize() const throw() { return size; }
  1995. void setSize (const size_t newSize,
  1996. const bool initialiseNewSpaceToZero = false) throw();
  1997. void ensureSize (const size_t minimumSize,
  1998. const bool initialiseNewSpaceToZero = false) throw();
  1999. void fillWith (const uint8 valueToUse) throw();
  2000. void append (const void* const data,
  2001. const size_t numBytes) throw();
  2002. void swapWith (MemoryBlock& other) throw();
  2003. void copyFrom (const void* srcData,
  2004. int destinationOffset,
  2005. size_t numBytes) throw();
  2006. void copyTo (void* destData,
  2007. int sourceOffset,
  2008. size_t numBytes) const throw();
  2009. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2010. const String toString() const throw();
  2011. void loadFromHexString (const String& sourceHexString) throw();
  2012. void setBitRange (size_t bitRangeStart,
  2013. size_t numBits,
  2014. int binaryNumberToApply) throw();
  2015. int getBitRange (size_t bitRangeStart,
  2016. size_t numBitsToRead) const throw();
  2017. const String toBase64Encoding() const throw();
  2018. bool fromBase64Encoding (const String& encodedString) throw();
  2019. juce_UseDebuggingNewOperator
  2020. private:
  2021. HeapBlock <char> data;
  2022. size_t size;
  2023. };
  2024. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2025. /*** End of inlined file: juce_MemoryBlock.h ***/
  2026. class JUCE_API InputStream
  2027. {
  2028. public:
  2029. virtual ~InputStream() {}
  2030. virtual int64 getTotalLength() = 0;
  2031. virtual bool isExhausted() = 0;
  2032. virtual int read (void* destBuffer, int maxBytesToRead) = 0;
  2033. virtual char readByte();
  2034. virtual bool readBool();
  2035. virtual short readShort();
  2036. virtual short readShortBigEndian();
  2037. virtual int readInt();
  2038. virtual int readIntBigEndian();
  2039. virtual int64 readInt64();
  2040. virtual int64 readInt64BigEndian();
  2041. virtual float readFloat();
  2042. virtual float readFloatBigEndian();
  2043. virtual double readDouble();
  2044. virtual double readDoubleBigEndian();
  2045. virtual int readCompressedInt();
  2046. virtual const String readNextLine();
  2047. virtual const String readString();
  2048. virtual const String readEntireStreamAsString();
  2049. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2050. int maxNumBytesToRead = -1);
  2051. virtual int64 getPosition() = 0;
  2052. virtual bool setPosition (int64 newPosition) = 0;
  2053. virtual void skipNextBytes (int64 numBytesToSkip);
  2054. juce_UseDebuggingNewOperator
  2055. protected:
  2056. InputStream() throw() {}
  2057. };
  2058. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2059. /*** End of inlined file: juce_InputStream.h ***/
  2060. class JUCE_API OutputStream
  2061. {
  2062. protected:
  2063. OutputStream();
  2064. public:
  2065. virtual ~OutputStream();
  2066. virtual void flush() = 0;
  2067. virtual bool setPosition (int64 newPosition) = 0;
  2068. virtual int64 getPosition() = 0;
  2069. virtual bool write (const void* dataToWrite,
  2070. int howManyBytes) = 0;
  2071. virtual void writeByte (char byte);
  2072. virtual void writeBool (bool boolValue);
  2073. virtual void writeShort (short value);
  2074. virtual void writeShortBigEndian (short value);
  2075. virtual void writeInt (int value);
  2076. virtual void writeIntBigEndian (int value);
  2077. virtual void writeInt64 (int64 value);
  2078. virtual void writeInt64BigEndian (int64 value);
  2079. virtual void writeFloat (float value);
  2080. virtual void writeFloatBigEndian (float value);
  2081. virtual void writeDouble (double value);
  2082. virtual void writeDoubleBigEndian (double value);
  2083. virtual void writeCompressedInt (int value);
  2084. virtual void writeString (const String& text);
  2085. virtual void writeText (const String& text,
  2086. bool asUnicode,
  2087. bool writeUnicodeHeaderBytes);
  2088. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2089. juce_UseDebuggingNewOperator
  2090. };
  2091. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
  2092. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
  2093. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
  2094. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
  2095. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2096. /*** End of inlined file: juce_OutputStream.h ***/
  2097. class JUCE_API DynamicObject;
  2098. class JUCE_API var
  2099. {
  2100. public:
  2101. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2102. var() throw();
  2103. ~var() throw();
  2104. static const var null;
  2105. var (const var& valueToCopy);
  2106. var (int value) throw();
  2107. var (bool value) throw();
  2108. var (double value) throw();
  2109. var (const char* value);
  2110. var (const juce_wchar* value);
  2111. var (const String& value);
  2112. var (DynamicObject* object);
  2113. var (MethodFunction method) throw();
  2114. var& operator= (const var& valueToCopy);
  2115. var& operator= (int value);
  2116. var& operator= (bool value);
  2117. var& operator= (double value);
  2118. var& operator= (const char* value);
  2119. var& operator= (const juce_wchar* value);
  2120. var& operator= (const String& value);
  2121. var& operator= (DynamicObject* object);
  2122. var& operator= (MethodFunction method);
  2123. void swapWith (var& other) throw();
  2124. operator int() const;
  2125. operator bool() const;
  2126. operator float() const;
  2127. operator double() const;
  2128. operator const String() const;
  2129. const String toString() const;
  2130. DynamicObject* getObject() const;
  2131. bool isVoid() const throw() { return type == voidType; }
  2132. bool isInt() const throw() { return type == intType; }
  2133. bool isBool() const throw() { return type == boolType; }
  2134. bool isDouble() const throw() { return type == doubleType; }
  2135. bool isString() const throw() { return type == stringType; }
  2136. bool isObject() const throw() { return type == objectType; }
  2137. bool isMethod() const throw() { return type == methodType; }
  2138. void writeToStream (OutputStream& output) const;
  2139. static const var readFromStream (InputStream& input);
  2140. class JUCE_API identifier
  2141. {
  2142. public:
  2143. identifier() throw();
  2144. identifier (const char* name);
  2145. identifier (const String& name);
  2146. ~identifier();
  2147. bool operator== (const identifier& other) const throw()
  2148. {
  2149. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2150. return hashCode == other.hashCode;
  2151. }
  2152. String name;
  2153. int hashCode;
  2154. };
  2155. const var operator[] (const identifier& propertyName) const;
  2156. const var call (const identifier& method) const;
  2157. const var call (const identifier& method, const var& arg1) const;
  2158. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2159. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2160. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2161. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2162. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2163. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2164. juce_UseDebuggingNewOperator
  2165. bool equals (const var& other) const throw();
  2166. private:
  2167. enum Type
  2168. {
  2169. voidType = 0,
  2170. intType,
  2171. boolType,
  2172. doubleType,
  2173. stringType,
  2174. objectType,
  2175. methodType
  2176. };
  2177. union ValueUnion
  2178. {
  2179. int intValue;
  2180. bool boolValue;
  2181. double doubleValue;
  2182. String* stringValue;
  2183. DynamicObject* objectValue;
  2184. MethodFunction methodValue;
  2185. };
  2186. Type type;
  2187. ValueUnion value;
  2188. };
  2189. bool operator== (const var& v1, const var& v2) throw();
  2190. bool operator!= (const var& v1, const var& v2) throw();
  2191. bool operator== (const var& v1, const String& v2) throw();
  2192. bool operator!= (const var& v1, const String& v2) throw();
  2193. #endif // __JUCE_VARIANT_JUCEHEADER__
  2194. /*** End of inlined file: juce_Variant.h ***/
  2195. class JUCE_API NamedValueSet
  2196. {
  2197. public:
  2198. NamedValueSet() throw();
  2199. NamedValueSet (const NamedValueSet& other);
  2200. NamedValueSet& operator= (const NamedValueSet& other);
  2201. ~NamedValueSet();
  2202. int size() const throw();
  2203. const var& operator[] (const var::identifier& name) const;
  2204. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2205. var* getItem (const var::identifier& name) const;
  2206. bool set (const var::identifier& name, const var& newValue);
  2207. bool contains (const var::identifier& name) const;
  2208. bool remove (const var::identifier& name);
  2209. const var::identifier getName (int index) const;
  2210. void clear();
  2211. juce_UseDebuggingNewOperator
  2212. private:
  2213. struct NamedValue
  2214. {
  2215. NamedValue() throw();
  2216. NamedValue (const var::identifier& name, const var& value);
  2217. var::identifier name;
  2218. var value;
  2219. };
  2220. Array <NamedValue> values;
  2221. };
  2222. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2223. /*** End of inlined file: juce_NamedValueSet.h ***/
  2224. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2225. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2226. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2227. /*** Start of inlined file: juce_Atomic.h ***/
  2228. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2229. #define __JUCE_ATOMIC_JUCEHEADER__
  2230. class JUCE_API Atomic
  2231. {
  2232. public:
  2233. static void increment (int32& variable);
  2234. static int32 incrementAndReturn (int32& variable);
  2235. static void decrement (int32& variable);
  2236. static int32 decrementAndReturn (int32& variable);
  2237. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2238. static void* swapPointers (void* volatile* value1, void* value2);
  2239. private:
  2240. Atomic();
  2241. Atomic (const Atomic&);
  2242. Atomic& operator= (const Atomic&);
  2243. };
  2244. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2245. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2246. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2247. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2248. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2249. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2250. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2251. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2252. {
  2253. void* currentVal = *value1;
  2254. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2255. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2256. #else
  2257. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2258. #endif
  2259. return currentVal;
  2260. }
  2261. #elif JUCE_LINUX // Linux...
  2262. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2263. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2264. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2265. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2266. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2267. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2268. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2269. {
  2270. void* currentVal = *value1;
  2271. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2272. return currentVal;
  2273. }
  2274. #elif JUCE_USE_INTRINSICS // Windows...
  2275. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2276. // declared in juce_win32_Threads.cpp)
  2277. #pragma intrinsic (_InterlockedIncrement)
  2278. #pragma intrinsic (_InterlockedDecrement)
  2279. #pragma intrinsic (_InterlockedCompareExchange)
  2280. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2281. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2282. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2283. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2284. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2285. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2286. #endif
  2287. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2288. /*** End of inlined file: juce_Atomic.h ***/
  2289. class JUCE_API ReferenceCountedObject
  2290. {
  2291. public:
  2292. inline void incReferenceCount() throw()
  2293. {
  2294. Atomic::increment (refCounts);
  2295. jassert (refCounts > 0);
  2296. }
  2297. inline void decReferenceCount() throw()
  2298. {
  2299. jassert (refCounts > 0);
  2300. if (Atomic::decrementAndReturn (refCounts) == 0)
  2301. delete this;
  2302. }
  2303. inline int getReferenceCount() const throw()
  2304. {
  2305. return refCounts;
  2306. }
  2307. protected:
  2308. ReferenceCountedObject()
  2309. : refCounts (0)
  2310. {
  2311. }
  2312. virtual ~ReferenceCountedObject()
  2313. {
  2314. // it's dangerous to delete an object that's still referenced by something else!
  2315. jassert (refCounts == 0);
  2316. }
  2317. private:
  2318. int refCounts;
  2319. };
  2320. template <class ReferenceCountedObjectClass>
  2321. class ReferenceCountedObjectPtr
  2322. {
  2323. public:
  2324. inline ReferenceCountedObjectPtr() throw()
  2325. : referencedObject (0)
  2326. {
  2327. }
  2328. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2329. : referencedObject (refCountedObject)
  2330. {
  2331. if (refCountedObject != 0)
  2332. refCountedObject->incReferenceCount();
  2333. }
  2334. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2335. : referencedObject (other.referencedObject)
  2336. {
  2337. if (referencedObject != 0)
  2338. referencedObject->incReferenceCount();
  2339. }
  2340. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2341. {
  2342. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2343. if (newObject != referencedObject)
  2344. {
  2345. if (newObject != 0)
  2346. newObject->incReferenceCount();
  2347. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2348. referencedObject = newObject;
  2349. if (oldObject != 0)
  2350. oldObject->decReferenceCount();
  2351. }
  2352. return *this;
  2353. }
  2354. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2355. {
  2356. if (referencedObject != newObject)
  2357. {
  2358. if (newObject != 0)
  2359. newObject->incReferenceCount();
  2360. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2361. referencedObject = newObject;
  2362. if (oldObject != 0)
  2363. oldObject->decReferenceCount();
  2364. }
  2365. return *this;
  2366. }
  2367. inline ~ReferenceCountedObjectPtr()
  2368. {
  2369. if (referencedObject != 0)
  2370. referencedObject->decReferenceCount();
  2371. }
  2372. inline operator ReferenceCountedObjectClass*() const throw()
  2373. {
  2374. return referencedObject;
  2375. }
  2376. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2377. {
  2378. return referencedObject == object;
  2379. }
  2380. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2381. {
  2382. return referencedObject != object;
  2383. }
  2384. // the -> operator is called on the referenced object
  2385. inline ReferenceCountedObjectClass* operator->() const throw()
  2386. {
  2387. return referencedObject;
  2388. }
  2389. private:
  2390. ReferenceCountedObjectClass* referencedObject;
  2391. };
  2392. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2393. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2394. class JUCE_API DynamicObject : public ReferenceCountedObject
  2395. {
  2396. public:
  2397. DynamicObject();
  2398. virtual ~DynamicObject();
  2399. virtual bool hasProperty (const var::identifier& propertyName) const;
  2400. virtual const var getProperty (const var::identifier& propertyName) const;
  2401. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2402. virtual void removeProperty (const var::identifier& propertyName);
  2403. virtual bool hasMethod (const var::identifier& methodName) const;
  2404. virtual const var invokeMethod (const var::identifier& methodName,
  2405. const var* parameters,
  2406. int numParameters);
  2407. void setMethod (const var::identifier& methodName,
  2408. var::MethodFunction methodFunction);
  2409. void clear();
  2410. juce_UseDebuggingNewOperator
  2411. private:
  2412. NamedValueSet properties;
  2413. };
  2414. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2415. /*** End of inlined file: juce_DynamicObject.h ***/
  2416. #endif
  2417. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2418. #endif
  2419. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2420. #endif
  2421. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2422. #endif
  2423. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2424. #endif
  2425. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2426. /*** Start of inlined file: juce_OwnedArray.h ***/
  2427. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2428. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2429. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2430. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2431. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2432. template <class ObjectType>
  2433. class JUCE_API ScopedPointer
  2434. {
  2435. public:
  2436. inline ScopedPointer() throw() : object (0)
  2437. {
  2438. }
  2439. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2440. : object (objectToTakePossessionOf)
  2441. {
  2442. }
  2443. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2444. : object (objectToTransferFrom.object)
  2445. {
  2446. objectToTransferFrom.object = 0;
  2447. }
  2448. inline ~ScopedPointer() { delete object; }
  2449. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2450. {
  2451. if (this != objectToTransferFrom.getAddress())
  2452. {
  2453. // Two ScopedPointers should never be able to refer to the same object - if
  2454. // this happens, you must have done something dodgy!
  2455. jassert (object == 0 || object != objectToTransferFrom.object);
  2456. ObjectType* const oldObject = object;
  2457. object = objectToTransferFrom.object;
  2458. objectToTransferFrom.object = 0;
  2459. delete oldObject;
  2460. }
  2461. return *this;
  2462. }
  2463. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2464. {
  2465. if (object != newObjectToTakePossessionOf)
  2466. {
  2467. ObjectType* const oldObject = object;
  2468. object = newObjectToTakePossessionOf;
  2469. delete oldObject;
  2470. }
  2471. return *this;
  2472. }
  2473. inline operator ObjectType*() const throw() { return object; }
  2474. inline ObjectType& operator*() const throw() { return *object; }
  2475. inline ObjectType* operator->() const throw() { return object; }
  2476. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2477. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2478. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2479. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2480. {
  2481. // Two ScopedPointers should never be able to refer to the same object - if
  2482. // this happens, you must have done something dodgy!
  2483. jassert (object != other.object);
  2484. swapVariables (object, other.object);
  2485. }
  2486. private:
  2487. ObjectType* object;
  2488. // (Required as an alternative to the overloaded & operator).
  2489. const ScopedPointer* getAddress() const throw() { return this; }
  2490. };
  2491. template <class ObjectType>
  2492. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2493. {
  2494. return static_cast <ObjectType*> (pointer1) == pointer2;
  2495. }
  2496. template <class ObjectType>
  2497. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2498. {
  2499. return static_cast <ObjectType*> (pointer1) != pointer2;
  2500. }
  2501. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2502. /*** End of inlined file: juce_ScopedPointer.h ***/
  2503. template <class ObjectClass,
  2504. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2505. class OwnedArray
  2506. {
  2507. public:
  2508. OwnedArray() throw()
  2509. : numUsed (0)
  2510. {
  2511. }
  2512. ~OwnedArray()
  2513. {
  2514. clear (true);
  2515. }
  2516. void clear (const bool deleteObjects = true)
  2517. {
  2518. const ScopedLockType lock (getLock());
  2519. if (deleteObjects)
  2520. {
  2521. while (numUsed > 0)
  2522. delete data.elements [--numUsed];
  2523. }
  2524. data.setAllocatedSize (0);
  2525. numUsed = 0;
  2526. }
  2527. inline int size() const throw()
  2528. {
  2529. return numUsed;
  2530. }
  2531. inline ObjectClass* operator[] (const int index) const throw()
  2532. {
  2533. const ScopedLockType lock (getLock());
  2534. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2535. : static_cast <ObjectClass*> (0);
  2536. }
  2537. inline ObjectClass* getUnchecked (const int index) const throw()
  2538. {
  2539. const ScopedLockType lock (getLock());
  2540. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2541. return data.elements [index];
  2542. }
  2543. inline ObjectClass* getFirst() const throw()
  2544. {
  2545. const ScopedLockType lock (getLock());
  2546. return numUsed > 0 ? data.elements [0]
  2547. : static_cast <ObjectClass*> (0);
  2548. }
  2549. inline ObjectClass* getLast() const throw()
  2550. {
  2551. const ScopedLockType lock (getLock());
  2552. return numUsed > 0 ? data.elements [numUsed - 1]
  2553. : static_cast <ObjectClass*> (0);
  2554. }
  2555. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2556. {
  2557. const ScopedLockType lock (getLock());
  2558. ObjectClass* const* e = data.elements.getData();
  2559. ObjectClass* const* const end = e + numUsed;
  2560. while (e != end)
  2561. {
  2562. if (objectToLookFor == *e)
  2563. return static_cast <int> (e - data.elements.getData());
  2564. ++e;
  2565. }
  2566. return -1;
  2567. }
  2568. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2569. {
  2570. const ScopedLockType lock (getLock());
  2571. ObjectClass* const* e = data.elements.getData();
  2572. ObjectClass* const* const end = e + numUsed;
  2573. while (e != end)
  2574. {
  2575. if (objectToLookFor == *e)
  2576. return true;
  2577. ++e;
  2578. }
  2579. return false;
  2580. }
  2581. void add (const ObjectClass* const newObject) throw()
  2582. {
  2583. const ScopedLockType lock (getLock());
  2584. data.ensureAllocatedSize (numUsed + 1);
  2585. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2586. }
  2587. void insert (int indexToInsertAt,
  2588. const ObjectClass* const newObject) throw()
  2589. {
  2590. if (indexToInsertAt >= 0)
  2591. {
  2592. const ScopedLockType lock (getLock());
  2593. if (indexToInsertAt > numUsed)
  2594. indexToInsertAt = numUsed;
  2595. data.ensureAllocatedSize (numUsed + 1);
  2596. ObjectClass** const e = data.elements + indexToInsertAt;
  2597. const int numToMove = numUsed - indexToInsertAt;
  2598. if (numToMove > 0)
  2599. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2600. *e = const_cast <ObjectClass*> (newObject);
  2601. ++numUsed;
  2602. }
  2603. else
  2604. {
  2605. add (newObject);
  2606. }
  2607. }
  2608. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2609. {
  2610. const ScopedLockType lock (getLock());
  2611. if (! contains (newObject))
  2612. add (newObject);
  2613. }
  2614. void set (const int indexToChange,
  2615. const ObjectClass* const newObject,
  2616. const bool deleteOldElement = true)
  2617. {
  2618. if (indexToChange >= 0)
  2619. {
  2620. ScopedPointer <ObjectClass> toDelete;
  2621. const ScopedLockType lock (getLock());
  2622. if (indexToChange < numUsed)
  2623. {
  2624. if (deleteOldElement)
  2625. {
  2626. toDelete = data.elements [indexToChange];
  2627. if (toDelete == newObject)
  2628. toDelete = 0;
  2629. }
  2630. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2631. }
  2632. else
  2633. {
  2634. data.ensureAllocatedSize (numUsed + 1);
  2635. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2636. }
  2637. }
  2638. }
  2639. template <class OtherArrayType>
  2640. void addArray (const OtherArrayType& arrayToAddFrom,
  2641. int startIndex = 0,
  2642. int numElementsToAdd = -1)
  2643. {
  2644. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2645. const ScopedLockType lock2 (getLock());
  2646. if (startIndex < 0)
  2647. {
  2648. jassertfalse
  2649. startIndex = 0;
  2650. }
  2651. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2652. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2653. while (--numElementsToAdd >= 0)
  2654. add (arrayToAddFrom.getUnchecked (startIndex++));
  2655. }
  2656. template <class ElementComparator>
  2657. void addSorted (ElementComparator& comparator,
  2658. ObjectClass* const newObject) throw()
  2659. {
  2660. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2661. // avoids getting warning messages about the parameter being unused
  2662. const ScopedLockType lock (getLock());
  2663. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2664. }
  2665. template <class ElementComparator>
  2666. int indexOfSorted (ElementComparator& comparator,
  2667. const ObjectClass* const objectToLookFor) const throw()
  2668. {
  2669. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2670. // avoids getting warning messages about the parameter being unused
  2671. const ScopedLockType lock (getLock());
  2672. int start = 0;
  2673. int end = numUsed;
  2674. for (;;)
  2675. {
  2676. if (start >= end)
  2677. {
  2678. return -1;
  2679. }
  2680. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2681. {
  2682. return start;
  2683. }
  2684. else
  2685. {
  2686. const int halfway = (start + end) >> 1;
  2687. if (halfway == start)
  2688. return -1;
  2689. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2690. start = halfway;
  2691. else
  2692. end = halfway;
  2693. }
  2694. }
  2695. }
  2696. void remove (const int indexToRemove,
  2697. const bool deleteObject = true)
  2698. {
  2699. ScopedPointer <ObjectClass> toDelete;
  2700. const ScopedLockType lock (getLock());
  2701. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2702. {
  2703. ObjectClass** const e = data.elements + indexToRemove;
  2704. if (deleteObject)
  2705. toDelete = *e;
  2706. --numUsed;
  2707. const int numToShift = numUsed - indexToRemove;
  2708. if (numToShift > 0)
  2709. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2710. if ((numUsed << 1) < data.numAllocated)
  2711. minimiseStorageOverheads();
  2712. }
  2713. }
  2714. void removeObject (const ObjectClass* const objectToRemove,
  2715. const bool deleteObject = true)
  2716. {
  2717. const ScopedLockType lock (getLock());
  2718. ObjectClass** e = data.elements.getData();
  2719. for (int i = numUsed; --i >= 0;)
  2720. {
  2721. if (objectToRemove == *e)
  2722. {
  2723. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2724. break;
  2725. }
  2726. ++e;
  2727. }
  2728. }
  2729. void removeRange (int startIndex,
  2730. const int numberToRemove,
  2731. const bool deleteObjects = true)
  2732. {
  2733. const ScopedLockType lock (getLock());
  2734. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2735. startIndex = jlimit (0, numUsed, startIndex);
  2736. if (endIndex > startIndex)
  2737. {
  2738. if (deleteObjects)
  2739. {
  2740. for (int i = startIndex; i < endIndex; ++i)
  2741. {
  2742. delete data.elements [i];
  2743. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2744. }
  2745. }
  2746. const int rangeSize = endIndex - startIndex;
  2747. ObjectClass** e = data.elements + startIndex;
  2748. int numToShift = numUsed - endIndex;
  2749. numUsed -= rangeSize;
  2750. while (--numToShift >= 0)
  2751. {
  2752. *e = e [rangeSize];
  2753. ++e;
  2754. }
  2755. if ((numUsed << 1) < data.numAllocated)
  2756. minimiseStorageOverheads();
  2757. }
  2758. }
  2759. void removeLast (int howManyToRemove = 1,
  2760. const bool deleteObjects = true)
  2761. {
  2762. const ScopedLockType lock (getLock());
  2763. if (howManyToRemove >= numUsed)
  2764. {
  2765. clear (deleteObjects);
  2766. }
  2767. else
  2768. {
  2769. while (--howManyToRemove >= 0)
  2770. remove (numUsed - 1, deleteObjects);
  2771. }
  2772. }
  2773. void swap (const int index1,
  2774. const int index2) throw()
  2775. {
  2776. const ScopedLockType lock (getLock());
  2777. if (((unsigned int) index1) < (unsigned int) numUsed
  2778. && ((unsigned int) index2) < (unsigned int) numUsed)
  2779. {
  2780. swapVariables (data.elements [index1],
  2781. data.elements [index2]);
  2782. }
  2783. }
  2784. void move (const int currentIndex,
  2785. int newIndex) throw()
  2786. {
  2787. if (currentIndex != newIndex)
  2788. {
  2789. const ScopedLockType lock (getLock());
  2790. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2791. {
  2792. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2793. newIndex = numUsed - 1;
  2794. ObjectClass* const value = data.elements [currentIndex];
  2795. if (newIndex > currentIndex)
  2796. {
  2797. memmove (data.elements + currentIndex,
  2798. data.elements + currentIndex + 1,
  2799. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2800. }
  2801. else
  2802. {
  2803. memmove (data.elements + newIndex + 1,
  2804. data.elements + newIndex,
  2805. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2806. }
  2807. data.elements [newIndex] = value;
  2808. }
  2809. }
  2810. }
  2811. void swapWithArray (OwnedArray& otherArray) throw()
  2812. {
  2813. const ScopedLockType lock1 (getLock());
  2814. const ScopedLockType lock2 (otherArray.getLock());
  2815. data.swapWith (otherArray.data);
  2816. swapVariables (numUsed, otherArray.numUsed);
  2817. }
  2818. void minimiseStorageOverheads() throw()
  2819. {
  2820. const ScopedLockType lock (getLock());
  2821. data.shrinkToNoMoreThan (numUsed);
  2822. }
  2823. void ensureStorageAllocated (const int minNumElements) throw()
  2824. {
  2825. const ScopedLockType lock (getLock());
  2826. data.ensureAllocatedSize (minNumElements);
  2827. }
  2828. template <class ElementComparator>
  2829. void sort (ElementComparator& comparator,
  2830. const bool retainOrderOfEquivalentItems = false) const throw()
  2831. {
  2832. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2833. // avoids getting warning messages about the parameter being unused
  2834. const ScopedLockType lock (getLock());
  2835. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2836. }
  2837. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2838. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2839. juce_UseDebuggingNewOperator
  2840. private:
  2841. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2842. int numUsed;
  2843. // disallow copy constructor and assignment
  2844. OwnedArray (const OwnedArray&);
  2845. OwnedArray& operator= (const OwnedArray&);
  2846. };
  2847. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2848. /*** End of inlined file: juce_OwnedArray.h ***/
  2849. #endif
  2850. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2851. /*** Start of inlined file: juce_PropertySet.h ***/
  2852. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2853. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2854. /*** Start of inlined file: juce_StringPairArray.h ***/
  2855. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2856. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2857. /*** Start of inlined file: juce_StringArray.h ***/
  2858. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2859. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2860. class JUCE_API StringArray
  2861. {
  2862. public:
  2863. StringArray() throw();
  2864. StringArray (const StringArray& other);
  2865. explicit StringArray (const String& firstValue);
  2866. StringArray (const juce_wchar** strings, int numberOfStrings);
  2867. StringArray (const char** strings, int numberOfStrings);
  2868. explicit StringArray (const juce_wchar** strings);
  2869. explicit StringArray (const char** strings);
  2870. ~StringArray();
  2871. StringArray& operator= (const StringArray& other);
  2872. bool operator== (const StringArray& other) const throw();
  2873. bool operator!= (const StringArray& other) const throw();
  2874. inline int size() const throw() { return strings.size(); };
  2875. const String& operator[] (int index) const throw();
  2876. bool contains (const String& stringToLookFor,
  2877. bool ignoreCase = false) const;
  2878. int indexOf (const String& stringToLookFor,
  2879. bool ignoreCase = false,
  2880. int startIndex = 0) const;
  2881. void add (const String& stringToAdd);
  2882. void insert (int index, const String& stringToAdd);
  2883. void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
  2884. void set (int index, const String& newString);
  2885. void addArray (const StringArray& other,
  2886. int startIndex = 0,
  2887. int numElementsToAdd = -1);
  2888. int addTokens (const String& stringToTokenise,
  2889. bool preserveQuotedStrings);
  2890. int addTokens (const String& stringToTokenise,
  2891. const String& breakCharacters,
  2892. const String& quoteCharacters);
  2893. int addLines (const String& stringToBreakUp);
  2894. void clear();
  2895. void remove (int index);
  2896. void removeString (const String& stringToRemove,
  2897. bool ignoreCase = false);
  2898. void removeDuplicates (bool ignoreCase);
  2899. void removeEmptyStrings (bool removeWhitespaceStrings = true);
  2900. void move (int currentIndex, int newIndex) throw();
  2901. void trim();
  2902. void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
  2903. bool appendNumberToFirstInstance,
  2904. const juce_wchar* preNumberString = 0,
  2905. const juce_wchar* postNumberString = 0);
  2906. const String joinIntoString (const String& separatorString,
  2907. int startIndex = 0,
  2908. int numberOfElements = -1) const;
  2909. void sort (bool ignoreCase);
  2910. void minimiseStorageOverheads();
  2911. juce_UseDebuggingNewOperator
  2912. private:
  2913. Array <String> strings;
  2914. };
  2915. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2916. /*** End of inlined file: juce_StringArray.h ***/
  2917. class JUCE_API StringPairArray
  2918. {
  2919. public:
  2920. StringPairArray (bool ignoreCaseWhenComparingKeys = true);
  2921. StringPairArray (const StringPairArray& other);
  2922. ~StringPairArray();
  2923. StringPairArray& operator= (const StringPairArray& other);
  2924. bool operator== (const StringPairArray& other) const;
  2925. bool operator!= (const StringPairArray& other) const;
  2926. const String& operator[] (const String& key) const;
  2927. const String getValue (const String& key, const String& defaultReturnValue) const;
  2928. const StringArray& getAllKeys() const throw() { return keys; }
  2929. const StringArray& getAllValues() const throw() { return values; }
  2930. inline int size() const throw() { return keys.size(); };
  2931. void set (const String& key, const String& value);
  2932. void addArray (const StringPairArray& other);
  2933. void clear();
  2934. void remove (const String& key);
  2935. void remove (int index);
  2936. void setIgnoresCase (bool shouldIgnoreCase);
  2937. const String getDescription() const;
  2938. void minimiseStorageOverheads();
  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 = "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 (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 (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 (bool shouldBeReadOnly,
  3103. 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. int whatToLookFor,
  3130. bool searchRecursively,
  3131. const String& wildCardPattern = "*") const;
  3132. int getNumberOfChildFiles (int whatToLookFor,
  3133. const String& wildCardPattern = "*") const;
  3134. bool containsSubDirectories() const;
  3135. FileInputStream* createInputStream() const;
  3136. FileOutputStream* createOutputStream (int bufferSize = 0x8000) const;
  3137. bool loadFileAsData (MemoryBlock& result) const;
  3138. const String loadFileAsString() const;
  3139. bool appendData (const void* dataToAppend,
  3140. int numberOfBytes) const;
  3141. bool replaceWithData (const void* dataToWrite,
  3142. int numberOfBytes) const;
  3143. bool appendText (const String& textToAppend,
  3144. bool asUnicode = false,
  3145. bool writeUnicodeHeaderBytes = false) const;
  3146. bool replaceWithText (const String& textToWrite,
  3147. bool asUnicode = false,
  3148. 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 juce_wchar separator;
  3179. static const juce_wchar* 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* other,
  3213. bool ignoreOrderOfAttributes) const throw();
  3214. const String createDocument (const String& dtdToUse,
  3215. bool allOnOneLine = false,
  3216. bool includeXmlHeader = true,
  3217. const String& encodingType = "UTF-8",
  3218. int lineWrapLength = 60) const;
  3219. void writeToStream (OutputStream& output,
  3220. const String& dtdToUse,
  3221. bool allOnOneLine = false,
  3222. bool includeXmlHeader = true,
  3223. const String& encodingType = "UTF-8",
  3224. int lineWrapLength = 60) const;
  3225. bool writeToFile (const File& destinationFile,
  3226. const String& dtdToUse,
  3227. const String& encodingType = "UTF-8",
  3228. 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 (int attributeIndex) const throw();
  3233. const String& getAttributeValue (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. bool ignoreCase = false) const throw();
  3242. int getIntAttribute (const String& attributeName,
  3243. int defaultReturnValue = 0) const;
  3244. double getDoubleAttribute (const String& attributeName,
  3245. double defaultReturnValue = 0.0) const;
  3246. bool getBoolAttribute (const String& attributeName,
  3247. bool defaultReturnValue = false) const;
  3248. void setAttribute (const String& attributeName,
  3249. const String& newValue);
  3250. void setAttribute (const String& attributeName,
  3251. int newValue);
  3252. void setAttribute (const String& attributeName,
  3253. 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 (int index) const throw();
  3262. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3263. void addChildElement (XmlElement* const newChildElement) throw();
  3264. void insertChildElement (XmlElement* newChildNode,
  3265. int indexToInsertAt) throw();
  3266. XmlElement* createNewChildElement (const String& tagName);
  3267. bool replaceChildElement (XmlElement* currentChildElement,
  3268. XmlElement* newChildNode) throw();
  3269. void removeChildElement (XmlElement* childToRemove,
  3270. 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* 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();
  3314. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3315. void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
  3316. void getChildElementsAsArray (XmlElement**) const throw();
  3317. void reorderChildElements (XmlElement** const, const int) throw();
  3318. };
  3319. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3320. /*** End of inlined file: juce_XmlElement.h ***/
  3321. class JUCE_API PropertySet
  3322. {
  3323. public:
  3324. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3325. PropertySet (const PropertySet& other) throw();
  3326. PropertySet& operator= (const PropertySet& other) throw();
  3327. virtual ~PropertySet();
  3328. const String getValue (const String& keyName,
  3329. const String& defaultReturnValue = String::empty) const throw();
  3330. int getIntValue (const String& keyName,
  3331. const int defaultReturnValue = 0) const throw();
  3332. double getDoubleValue (const String& keyName,
  3333. const double defaultReturnValue = 0.0) const throw();
  3334. bool getBoolValue (const String& keyName,
  3335. const bool defaultReturnValue = false) const throw();
  3336. XmlElement* getXmlValue (const String& keyName) const;
  3337. void setValue (const String& keyName, const String& value) throw();
  3338. void setValue (const String& keyName, const tchar* const value) throw();
  3339. void setValue (const String& keyName, const int value) throw();
  3340. void setValue (const String& keyName, const double value) throw();
  3341. void setValue (const String& keyName, const bool value) throw();
  3342. void setValue (const String& keyName, const XmlElement* const xml);
  3343. void removeValue (const String& keyName) throw();
  3344. bool containsKey (const String& keyName) const throw();
  3345. void clear();
  3346. StringPairArray& getAllProperties() throw() { return properties; }
  3347. const CriticalSection& getLock() const throw() { return lock; }
  3348. XmlElement* createXml (const String& nodeName) const throw();
  3349. void restoreFromXml (const XmlElement& xml) throw();
  3350. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3351. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3352. juce_UseDebuggingNewOperator
  3353. protected:
  3354. virtual void propertyChanged();
  3355. private:
  3356. StringPairArray properties;
  3357. PropertySet* fallbackProperties;
  3358. CriticalSection lock;
  3359. bool ignoreCaseOfKeys;
  3360. };
  3361. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3362. /*** End of inlined file: juce_PropertySet.h ***/
  3363. #endif
  3364. #ifndef __JUCE_RANGE_JUCEHEADER__
  3365. /*** Start of inlined file: juce_Range.h ***/
  3366. #ifndef __JUCE_RANGE_JUCEHEADER__
  3367. #define __JUCE_RANGE_JUCEHEADER__
  3368. template <typename ValueType>
  3369. class Range
  3370. {
  3371. public:
  3372. Range() throw()
  3373. : start (ValueType()), end (ValueType())
  3374. {
  3375. }
  3376. Range (const ValueType start_, const ValueType end_) throw()
  3377. : start (start_), end (jmax (start_, end_))
  3378. {
  3379. }
  3380. Range (const Range& other) throw()
  3381. : start (other.start), end (other.end)
  3382. {
  3383. }
  3384. Range& operator= (const Range& other) throw()
  3385. {
  3386. start = other.start;
  3387. end = other.end;
  3388. return *this;
  3389. }
  3390. ~Range() throw()
  3391. {
  3392. }
  3393. static const Range between (const ValueType position1, const ValueType position2) throw()
  3394. {
  3395. return (position1 < position2) ? Range (position1, position2)
  3396. : Range (position2, position1);
  3397. }
  3398. static const Range emptyRange (const ValueType start) throw()
  3399. {
  3400. return Range (start, start);
  3401. }
  3402. inline ValueType getStart() const throw() { return start; }
  3403. inline ValueType getLength() const throw() { return end - start; }
  3404. inline ValueType getEnd() const throw() { return end; }
  3405. inline bool isEmpty() const throw() { return start == end; }
  3406. void setStart (const ValueType newStart) throw()
  3407. {
  3408. start = newStart;
  3409. if (newStart > end)
  3410. end = newStart;
  3411. }
  3412. const Range withStart (const ValueType newStart) const throw()
  3413. {
  3414. return Range (newStart, jmax (newStart, end));
  3415. }
  3416. void setEnd (const ValueType newEnd) throw()
  3417. {
  3418. end = newEnd;
  3419. if (newEnd < start)
  3420. start = newEnd;
  3421. }
  3422. const Range withEnd (const ValueType newEnd) const throw()
  3423. {
  3424. return Range (jmin (start, newEnd), newEnd);
  3425. }
  3426. void setLength (const ValueType newLength) throw()
  3427. {
  3428. end = start + jmax (ValueType(), newLength);
  3429. }
  3430. const Range withLength (const ValueType newLength) const throw()
  3431. {
  3432. return Range (start, start + newLength);
  3433. }
  3434. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3435. {
  3436. start += amountToAdd;
  3437. end += amountToAdd;
  3438. return *this;
  3439. }
  3440. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3441. {
  3442. start -= amountToSubtract;
  3443. end -= amountToSubtract;
  3444. return *this;
  3445. }
  3446. const Range operator+ (const ValueType amountToAdd) const throw()
  3447. {
  3448. return Range (start + amountToAdd, end + amountToAdd);
  3449. }
  3450. const Range operator- (const ValueType amountToSubtract) const throw()
  3451. {
  3452. return Range (start - amountToSubtract, end - amountToSubtract);
  3453. }
  3454. bool contains (const ValueType position) const throw()
  3455. {
  3456. return position >= start && position < end;
  3457. }
  3458. ValueType clipValue (const ValueType value) const throw()
  3459. {
  3460. return jlimit (start, end, value);
  3461. }
  3462. bool intersects (const Range& other) const throw()
  3463. {
  3464. return other.start < end && other.end > start;
  3465. }
  3466. const Range getIntersectionWith (const Range& other) const throw()
  3467. {
  3468. return Range (jmax (start, other.start),
  3469. jmin (end, other.end));
  3470. }
  3471. const Range getUnionWith (const Range& other) const throw()
  3472. {
  3473. return Range (jmin (start, other.start),
  3474. jmax (end, other.end));
  3475. }
  3476. juce_UseDebuggingNewOperator
  3477. private:
  3478. ValueType start, end;
  3479. };
  3480. #endif // __JUCE_RANGE_JUCEHEADER__
  3481. /*** End of inlined file: juce_Range.h ***/
  3482. #endif
  3483. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3484. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3485. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3486. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3487. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3488. class ReferenceCountedArray
  3489. {
  3490. public:
  3491. ReferenceCountedArray() throw()
  3492. : numUsed (0)
  3493. {
  3494. }
  3495. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3496. {
  3497. const ScopedLockType lock (other.getLock());
  3498. numUsed = other.numUsed;
  3499. data.setAllocatedSize (numUsed);
  3500. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3501. for (int i = numUsed; --i >= 0;)
  3502. if (data.elements[i] != 0)
  3503. data.elements[i]->incReferenceCount();
  3504. }
  3505. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3506. {
  3507. if (this != &other)
  3508. {
  3509. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3510. swapWithArray (other);
  3511. }
  3512. return *this;
  3513. }
  3514. ~ReferenceCountedArray()
  3515. {
  3516. clear();
  3517. }
  3518. void clear()
  3519. {
  3520. const ScopedLockType lock (getLock());
  3521. while (numUsed > 0)
  3522. if (data.elements [--numUsed] != 0)
  3523. data.elements [numUsed]->decReferenceCount();
  3524. jassert (numUsed == 0);
  3525. data.setAllocatedSize (0);
  3526. }
  3527. inline int size() const throw()
  3528. {
  3529. return numUsed;
  3530. }
  3531. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3532. {
  3533. const ScopedLockType lock (getLock());
  3534. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3535. : static_cast <ObjectClass*> (0);
  3536. }
  3537. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3538. {
  3539. const ScopedLockType lock (getLock());
  3540. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3541. return data.elements [index];
  3542. }
  3543. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3544. {
  3545. const ScopedLockType lock (getLock());
  3546. return numUsed > 0 ? data.elements [0]
  3547. : static_cast <ObjectClass*> (0);
  3548. }
  3549. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3550. {
  3551. const ScopedLockType lock (getLock());
  3552. return numUsed > 0 ? data.elements [numUsed - 1]
  3553. : static_cast <ObjectClass*> (0);
  3554. }
  3555. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3556. {
  3557. const ScopedLockType lock (getLock());
  3558. ObjectClass** e = data.elements.getData();
  3559. ObjectClass** const end = e + numUsed;
  3560. while (e != end)
  3561. {
  3562. if (objectToLookFor == *e)
  3563. return static_cast <int> (e - data.elements.getData());
  3564. ++e;
  3565. }
  3566. return -1;
  3567. }
  3568. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3569. {
  3570. const ScopedLockType lock (getLock());
  3571. ObjectClass** e = data.elements.getData();
  3572. ObjectClass** const end = e + numUsed;
  3573. while (e != end)
  3574. {
  3575. if (objectToLookFor == *e)
  3576. return true;
  3577. ++e;
  3578. }
  3579. return false;
  3580. }
  3581. void add (ObjectClass* const newObject) throw()
  3582. {
  3583. const ScopedLockType lock (getLock());
  3584. data.ensureAllocatedSize (numUsed + 1);
  3585. data.elements [numUsed++] = newObject;
  3586. if (newObject != 0)
  3587. newObject->incReferenceCount();
  3588. }
  3589. void insert (int indexToInsertAt,
  3590. ObjectClass* const newObject) throw()
  3591. {
  3592. if (indexToInsertAt >= 0)
  3593. {
  3594. const ScopedLockType lock (getLock());
  3595. if (indexToInsertAt > numUsed)
  3596. indexToInsertAt = numUsed;
  3597. data.ensureAllocatedSize (numUsed + 1);
  3598. ObjectClass** const e = data.elements + indexToInsertAt;
  3599. const int numToMove = numUsed - indexToInsertAt;
  3600. if (numToMove > 0)
  3601. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3602. *e = newObject;
  3603. if (newObject != 0)
  3604. newObject->incReferenceCount();
  3605. ++numUsed;
  3606. }
  3607. else
  3608. {
  3609. add (newObject);
  3610. }
  3611. }
  3612. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3613. {
  3614. const ScopedLockType lock (getLock());
  3615. if (! contains (newObject))
  3616. add (newObject);
  3617. }
  3618. void set (const int indexToChange,
  3619. ObjectClass* const newObject)
  3620. {
  3621. if (indexToChange >= 0)
  3622. {
  3623. const ScopedLockType lock (getLock());
  3624. if (newObject != 0)
  3625. newObject->incReferenceCount();
  3626. if (indexToChange < numUsed)
  3627. {
  3628. if (data.elements [indexToChange] != 0)
  3629. data.elements [indexToChange]->decReferenceCount();
  3630. data.elements [indexToChange] = newObject;
  3631. }
  3632. else
  3633. {
  3634. data.ensureAllocatedSize (numUsed + 1);
  3635. data.elements [numUsed++] = newObject;
  3636. }
  3637. }
  3638. }
  3639. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3640. int startIndex = 0,
  3641. int numElementsToAdd = -1) throw()
  3642. {
  3643. arrayToAddFrom.lockArray();
  3644. const ScopedLockType lock (getLock());
  3645. if (startIndex < 0)
  3646. {
  3647. jassertfalse
  3648. startIndex = 0;
  3649. }
  3650. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3651. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3652. if (numElementsToAdd > 0)
  3653. {
  3654. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3655. while (--numElementsToAdd >= 0)
  3656. add (arrayToAddFrom.getUnchecked (startIndex++));
  3657. }
  3658. arrayToAddFrom.unlockArray();
  3659. }
  3660. template <class ElementComparator>
  3661. void addSorted (ElementComparator& comparator,
  3662. ObjectClass* newObject) throw()
  3663. {
  3664. const ScopedLockType lock (getLock());
  3665. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3666. }
  3667. template <class ElementComparator>
  3668. void addOrReplaceSorted (ElementComparator& comparator,
  3669. ObjectClass* newObject) throw()
  3670. {
  3671. const ScopedLockType lock (getLock());
  3672. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3673. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3674. set (index - 1, newObject); // replace an existing object that matches
  3675. else
  3676. insert (index, newObject); // no match, so insert the new one
  3677. }
  3678. void remove (const int indexToRemove)
  3679. {
  3680. const ScopedLockType lock (getLock());
  3681. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3682. {
  3683. ObjectClass** const e = data.elements + indexToRemove;
  3684. if (*e != 0)
  3685. (*e)->decReferenceCount();
  3686. --numUsed;
  3687. const int numberToShift = numUsed - indexToRemove;
  3688. if (numberToShift > 0)
  3689. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3690. if ((numUsed << 1) < data.numAllocated)
  3691. minimiseStorageOverheads();
  3692. }
  3693. }
  3694. void removeObject (ObjectClass* const objectToRemove)
  3695. {
  3696. const ScopedLockType lock (getLock());
  3697. remove (indexOf (objectToRemove));
  3698. }
  3699. void removeRange (const int startIndex,
  3700. const int numberToRemove)
  3701. {
  3702. const ScopedLockType lock (getLock());
  3703. const int start = jlimit (0, numUsed, startIndex);
  3704. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3705. if (end > start)
  3706. {
  3707. int i;
  3708. for (i = start; i < end; ++i)
  3709. {
  3710. if (data.elements[i] != 0)
  3711. {
  3712. data.elements[i]->decReferenceCount();
  3713. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3714. }
  3715. }
  3716. const int rangeSize = end - start;
  3717. ObjectClass** e = data.elements + start;
  3718. i = numUsed - end;
  3719. numUsed -= rangeSize;
  3720. while (--i >= 0)
  3721. {
  3722. *e = e [rangeSize];
  3723. ++e;
  3724. }
  3725. if ((numUsed << 1) < data.numAllocated)
  3726. minimiseStorageOverheads();
  3727. }
  3728. }
  3729. void removeLast (int howManyToRemove = 1)
  3730. {
  3731. const ScopedLockType lock (getLock());
  3732. if (howManyToRemove > numUsed)
  3733. howManyToRemove = numUsed;
  3734. while (--howManyToRemove >= 0)
  3735. remove (numUsed - 1);
  3736. }
  3737. void swap (const int index1,
  3738. const int index2) throw()
  3739. {
  3740. const ScopedLockType lock (getLock());
  3741. if (((unsigned int) index1) < (unsigned int) numUsed
  3742. && ((unsigned int) index2) < (unsigned int) numUsed)
  3743. {
  3744. swapVariables (data.elements [index1],
  3745. data.elements [index2]);
  3746. }
  3747. }
  3748. void move (const int currentIndex,
  3749. int newIndex) throw()
  3750. {
  3751. if (currentIndex != newIndex)
  3752. {
  3753. const ScopedLockType lock (getLock());
  3754. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3755. {
  3756. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3757. newIndex = numUsed - 1;
  3758. ObjectClass* const value = data.elements [currentIndex];
  3759. if (newIndex > currentIndex)
  3760. {
  3761. memmove (data.elements + currentIndex,
  3762. data.elements + currentIndex + 1,
  3763. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3764. }
  3765. else
  3766. {
  3767. memmove (data.elements + newIndex + 1,
  3768. data.elements + newIndex,
  3769. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3770. }
  3771. data.elements [newIndex] = value;
  3772. }
  3773. }
  3774. }
  3775. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3776. {
  3777. const ScopedLockType lock1 (getLock());
  3778. const ScopedLockType lock2 (otherArray.getLock());
  3779. data.swapWith (otherArray.data);
  3780. swapVariables (numUsed, otherArray.numUsed);
  3781. }
  3782. bool operator== (const ReferenceCountedArray& other) const throw()
  3783. {
  3784. const ScopedLockType lock2 (other.getLock());
  3785. const ScopedLockType lock1 (getLock());
  3786. if (numUsed != other.numUsed)
  3787. return false;
  3788. for (int i = numUsed; --i >= 0;)
  3789. if (data.elements [i] != other.data.elements [i])
  3790. return false;
  3791. return true;
  3792. }
  3793. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3794. {
  3795. return ! operator== (other);
  3796. }
  3797. template <class ElementComparator>
  3798. void sort (ElementComparator& comparator,
  3799. const bool retainOrderOfEquivalentItems = false) const throw()
  3800. {
  3801. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3802. // avoids getting warning messages about the parameter being unused
  3803. const ScopedLockType lock (getLock());
  3804. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3805. }
  3806. void minimiseStorageOverheads() throw()
  3807. {
  3808. const ScopedLockType lock (getLock());
  3809. data.shrinkToNoMoreThan (numUsed);
  3810. }
  3811. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3812. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3813. juce_UseDebuggingNewOperator
  3814. private:
  3815. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3816. int numUsed;
  3817. };
  3818. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3819. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3820. #endif
  3821. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3822. #endif
  3823. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3824. #endif
  3825. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3826. /*** Start of inlined file: juce_SortedSet.h ***/
  3827. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3828. #define __JUCE_SORTEDSET_JUCEHEADER__
  3829. #if JUCE_MSVC
  3830. #pragma warning (push)
  3831. #pragma warning (disable: 4512)
  3832. #endif
  3833. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3834. class SortedSet
  3835. {
  3836. public:
  3837. SortedSet() throw()
  3838. : numUsed (0)
  3839. {
  3840. }
  3841. SortedSet (const SortedSet& other) throw()
  3842. {
  3843. const ScopedLockType lock (other.getLock());
  3844. numUsed = other.numUsed;
  3845. data.setAllocatedSize (other.numUsed);
  3846. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3847. }
  3848. ~SortedSet() throw()
  3849. {
  3850. }
  3851. SortedSet& operator= (const SortedSet& other) throw()
  3852. {
  3853. if (this != &other)
  3854. {
  3855. const ScopedLockType lock1 (other.getLock());
  3856. const ScopedLockType lock2 (getLock());
  3857. data.ensureAllocatedSize (other.size());
  3858. numUsed = other.numUsed;
  3859. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3860. minimiseStorageOverheads();
  3861. }
  3862. return *this;
  3863. }
  3864. bool operator== (const SortedSet<ElementType>& other) const throw()
  3865. {
  3866. const ScopedLockType lock (getLock());
  3867. if (numUsed != other.numUsed)
  3868. return false;
  3869. for (int i = numUsed; --i >= 0;)
  3870. if (data.elements[i] != other.data.elements[i])
  3871. return false;
  3872. return true;
  3873. }
  3874. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3875. {
  3876. return ! operator== (other);
  3877. }
  3878. void clear() throw()
  3879. {
  3880. const ScopedLockType lock (getLock());
  3881. data.setAllocatedSize (0);
  3882. numUsed = 0;
  3883. }
  3884. void clearQuick() throw()
  3885. {
  3886. const ScopedLockType lock (getLock());
  3887. numUsed = 0;
  3888. }
  3889. inline int size() const throw()
  3890. {
  3891. return numUsed;
  3892. }
  3893. inline ElementType operator[] (const int index) const throw()
  3894. {
  3895. const ScopedLockType lock (getLock());
  3896. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3897. : ElementType();
  3898. }
  3899. inline ElementType getUnchecked (const int index) const throw()
  3900. {
  3901. const ScopedLockType lock (getLock());
  3902. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3903. return data.elements [index];
  3904. }
  3905. inline ElementType getFirst() const throw()
  3906. {
  3907. const ScopedLockType lock (getLock());
  3908. return numUsed > 0 ? data.elements [0] : ElementType();
  3909. }
  3910. inline ElementType getLast() const throw()
  3911. {
  3912. const ScopedLockType lock (getLock());
  3913. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3914. }
  3915. int indexOf (const ElementType elementToLookFor) const throw()
  3916. {
  3917. const ScopedLockType lock (getLock());
  3918. int start = 0;
  3919. int end = numUsed;
  3920. for (;;)
  3921. {
  3922. if (start >= end)
  3923. {
  3924. return -1;
  3925. }
  3926. else if (elementToLookFor == data.elements [start])
  3927. {
  3928. return start;
  3929. }
  3930. else
  3931. {
  3932. const int halfway = (start + end) >> 1;
  3933. if (halfway == start)
  3934. return -1;
  3935. else if (elementToLookFor >= data.elements [halfway])
  3936. start = halfway;
  3937. else
  3938. end = halfway;
  3939. }
  3940. }
  3941. }
  3942. bool contains (const ElementType elementToLookFor) const throw()
  3943. {
  3944. const ScopedLockType lock (getLock());
  3945. int start = 0;
  3946. int end = numUsed;
  3947. for (;;)
  3948. {
  3949. if (start >= end)
  3950. {
  3951. return false;
  3952. }
  3953. else if (elementToLookFor == data.elements [start])
  3954. {
  3955. return true;
  3956. }
  3957. else
  3958. {
  3959. const int halfway = (start + end) >> 1;
  3960. if (halfway == start)
  3961. return false;
  3962. else if (elementToLookFor >= data.elements [halfway])
  3963. start = halfway;
  3964. else
  3965. end = halfway;
  3966. }
  3967. }
  3968. }
  3969. void add (const ElementType newElement) throw()
  3970. {
  3971. const ScopedLockType lock (getLock());
  3972. int start = 0;
  3973. int end = numUsed;
  3974. for (;;)
  3975. {
  3976. if (start >= end)
  3977. {
  3978. jassert (start <= end);
  3979. insertInternal (start, newElement);
  3980. break;
  3981. }
  3982. else if (newElement == data.elements [start])
  3983. {
  3984. break;
  3985. }
  3986. else
  3987. {
  3988. const int halfway = (start + end) >> 1;
  3989. if (halfway == start)
  3990. {
  3991. if (newElement >= data.elements [halfway])
  3992. insertInternal (start + 1, newElement);
  3993. else
  3994. insertInternal (start, newElement);
  3995. break;
  3996. }
  3997. else if (newElement >= data.elements [halfway])
  3998. start = halfway;
  3999. else
  4000. end = halfway;
  4001. }
  4002. }
  4003. }
  4004. void addArray (const ElementType* elementsToAdd,
  4005. int numElementsToAdd) throw()
  4006. {
  4007. const ScopedLockType lock (getLock());
  4008. while (--numElementsToAdd >= 0)
  4009. add (*elementsToAdd++);
  4010. }
  4011. template <class OtherSetType>
  4012. void addSet (const OtherSetType& setToAddFrom,
  4013. int startIndex = 0,
  4014. int numElementsToAdd = -1) throw()
  4015. {
  4016. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4017. const ScopedLockType lock2 (getLock());
  4018. jassert (this != &setToAddFrom);
  4019. if (this != &setToAddFrom)
  4020. {
  4021. if (startIndex < 0)
  4022. {
  4023. jassertfalse
  4024. startIndex = 0;
  4025. }
  4026. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4027. numElementsToAdd = setToAddFrom.size() - startIndex;
  4028. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4029. }
  4030. }
  4031. ElementType remove (const int indexToRemove) throw()
  4032. {
  4033. const ScopedLockType lock (getLock());
  4034. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4035. {
  4036. --numUsed;
  4037. ElementType* const e = data.elements + indexToRemove;
  4038. ElementType const removed = *e;
  4039. const int numberToShift = numUsed - indexToRemove;
  4040. if (numberToShift > 0)
  4041. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4042. if ((numUsed << 1) < data.numAllocated)
  4043. minimiseStorageOverheads();
  4044. return removed;
  4045. }
  4046. return 0;
  4047. }
  4048. void removeValue (const ElementType valueToRemove) throw()
  4049. {
  4050. const ScopedLockType lock (getLock());
  4051. remove (indexOf (valueToRemove));
  4052. }
  4053. template <class OtherSetType>
  4054. void removeValuesIn (const OtherSetType& otherSet) throw()
  4055. {
  4056. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4057. const ScopedLockType lock2 (getLock());
  4058. if (this == &otherSet)
  4059. {
  4060. clear();
  4061. }
  4062. else
  4063. {
  4064. if (otherSet.size() > 0)
  4065. {
  4066. for (int i = numUsed; --i >= 0;)
  4067. if (otherSet.contains (data.elements [i]))
  4068. remove (i);
  4069. }
  4070. }
  4071. }
  4072. template <class OtherSetType>
  4073. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4074. {
  4075. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4076. const ScopedLockType lock2 (getLock());
  4077. if (this != &otherSet)
  4078. {
  4079. if (otherSet.size() <= 0)
  4080. {
  4081. clear();
  4082. }
  4083. else
  4084. {
  4085. for (int i = numUsed; --i >= 0;)
  4086. if (! otherSet.contains (data.elements [i]))
  4087. remove (i);
  4088. }
  4089. }
  4090. }
  4091. void minimiseStorageOverheads() throw()
  4092. {
  4093. const ScopedLockType lock (getLock());
  4094. data.shrinkToNoMoreThan (numUsed);
  4095. }
  4096. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4097. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4098. juce_UseDebuggingNewOperator
  4099. private:
  4100. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4101. int numUsed;
  4102. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4103. {
  4104. data.ensureAllocatedSize (numUsed + 1);
  4105. ElementType* const insertPos = data.elements + indexToInsertAt;
  4106. const int numberToMove = numUsed - indexToInsertAt;
  4107. if (numberToMove > 0)
  4108. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4109. *insertPos = newElement;
  4110. ++numUsed;
  4111. }
  4112. };
  4113. #if JUCE_MSVC
  4114. #pragma warning (pop)
  4115. #endif
  4116. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4117. /*** End of inlined file: juce_SortedSet.h ***/
  4118. #endif
  4119. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4120. /*** Start of inlined file: juce_SparseSet.h ***/
  4121. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4122. #define __JUCE_SPARSESET_JUCEHEADER__
  4123. template <class Type>
  4124. class SparseSet
  4125. {
  4126. public:
  4127. SparseSet() throw()
  4128. {
  4129. }
  4130. SparseSet (const SparseSet<Type>& other) throw()
  4131. : values (other.values)
  4132. {
  4133. }
  4134. ~SparseSet() throw()
  4135. {
  4136. }
  4137. void clear() throw()
  4138. {
  4139. values.clear();
  4140. }
  4141. bool isEmpty() const throw()
  4142. {
  4143. return values.size() == 0;
  4144. }
  4145. Type size() const throw()
  4146. {
  4147. Type num = 0;
  4148. for (int i = 0; i < values.size(); i += 2)
  4149. num += values[i + 1] - values[i];
  4150. return num;
  4151. }
  4152. Type operator[] (int index) const throw()
  4153. {
  4154. for (int i = 0; i < values.size(); i += 2)
  4155. {
  4156. const Type s = values.getUnchecked(i);
  4157. const Type e = values.getUnchecked(i + 1);
  4158. if (index < e - s)
  4159. return s + index;
  4160. index -= e - s;
  4161. }
  4162. return (Type) 0;
  4163. }
  4164. bool contains (const Type valueToLookFor) const throw()
  4165. {
  4166. bool on = false;
  4167. for (int i = 0; i < values.size(); ++i)
  4168. {
  4169. if (values.getUnchecked(i) > valueToLookFor)
  4170. return on;
  4171. on = ! on;
  4172. }
  4173. return false;
  4174. }
  4175. int getNumRanges() const throw()
  4176. {
  4177. return values.size() >> 1;
  4178. }
  4179. bool getRange (const int rangeIndex,
  4180. Type& startValue,
  4181. Type& numValues) const throw()
  4182. {
  4183. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4184. {
  4185. startValue = values [rangeIndex << 1];
  4186. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4187. return true;
  4188. }
  4189. return false;
  4190. }
  4191. bool getTotalRange (Type& lowestValue,
  4192. Type& highestValue) const throw()
  4193. {
  4194. if (values.size() > 0)
  4195. {
  4196. lowestValue = values.getUnchecked (0);
  4197. highestValue = values.getUnchecked (values.size() - 1);
  4198. return true;
  4199. }
  4200. return false;
  4201. }
  4202. void addRange (const Type firstValue,
  4203. const Type numValuesToAdd) throw()
  4204. {
  4205. jassert (numValuesToAdd >= 0);
  4206. if (numValuesToAdd > 0)
  4207. {
  4208. removeRange (firstValue, numValuesToAdd);
  4209. IntegerElementComparator<Type> sorter;
  4210. values.addSorted (sorter, firstValue);
  4211. values.addSorted (sorter, firstValue + numValuesToAdd);
  4212. simplify();
  4213. }
  4214. }
  4215. void removeRange (const Type firstValue,
  4216. const Type numValuesToRemove) throw()
  4217. {
  4218. jassert (numValuesToRemove >= 0);
  4219. if (numValuesToRemove >= 0
  4220. && firstValue < values.getLast())
  4221. {
  4222. const bool onAtStart = contains (firstValue - 1);
  4223. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4224. const bool onAtEnd = contains (lastValue);
  4225. for (int i = values.size(); --i >= 0;)
  4226. {
  4227. if (values.getUnchecked(i) <= lastValue)
  4228. {
  4229. while (values.getUnchecked(i) >= firstValue)
  4230. {
  4231. values.remove (i);
  4232. if (--i < 0)
  4233. break;
  4234. }
  4235. break;
  4236. }
  4237. }
  4238. IntegerElementComparator<Type> sorter;
  4239. if (onAtStart)
  4240. values.addSorted (sorter, firstValue);
  4241. if (onAtEnd)
  4242. values.addSorted (sorter, lastValue);
  4243. simplify();
  4244. }
  4245. }
  4246. void invertRange (const Type firstValue,
  4247. const Type numValues)
  4248. {
  4249. SparseSet newItems;
  4250. newItems.addRange (firstValue, numValues);
  4251. int i;
  4252. for (i = getNumRanges(); --i >= 0;)
  4253. {
  4254. const int start = values [i << 1];
  4255. const int end = values [(i << 1) + 1];
  4256. newItems.removeRange (start, end);
  4257. }
  4258. removeRange (firstValue, numValues);
  4259. for (i = newItems.getNumRanges(); --i >= 0;)
  4260. {
  4261. const int start = newItems.values [i << 1];
  4262. const int end = newItems.values [(i << 1) + 1];
  4263. addRange (start, end);
  4264. }
  4265. }
  4266. bool overlapsRange (const Type firstValue,
  4267. const Type numValues) throw()
  4268. {
  4269. jassert (numValues >= 0);
  4270. if (numValues > 0)
  4271. {
  4272. for (int i = getNumRanges(); --i >= 0;)
  4273. {
  4274. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4275. return false;
  4276. if (firstValue + numValues > values.getUnchecked (i << 1))
  4277. return true;
  4278. }
  4279. }
  4280. return false;
  4281. }
  4282. bool containsRange (const Type firstValue,
  4283. const Type numValues) throw()
  4284. {
  4285. jassert (numValues >= 0);
  4286. if (numValues > 0)
  4287. {
  4288. for (int i = getNumRanges(); --i >= 0;)
  4289. {
  4290. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4291. return false;
  4292. if (firstValue >= values.getUnchecked (i << 1)
  4293. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4294. return true;
  4295. }
  4296. }
  4297. return false;
  4298. }
  4299. bool operator== (const SparseSet<Type>& other) throw()
  4300. {
  4301. return values == other.values;
  4302. }
  4303. bool operator!= (const SparseSet<Type>& other) throw()
  4304. {
  4305. return values != other.values;
  4306. }
  4307. juce_UseDebuggingNewOperator
  4308. private:
  4309. // alternating start/end values of ranges of values that are present.
  4310. Array<Type, DummyCriticalSection> values;
  4311. void simplify() throw()
  4312. {
  4313. jassert ((values.size() & 1) == 0);
  4314. for (int i = values.size(); --i > 0;)
  4315. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4316. values.removeRange (i - 1, 2);
  4317. }
  4318. };
  4319. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4320. /*** End of inlined file: juce_SparseSet.h ***/
  4321. #endif
  4322. #ifndef __JUCE_VALUE_JUCEHEADER__
  4323. /*** Start of inlined file: juce_Value.h ***/
  4324. #ifndef __JUCE_VALUE_JUCEHEADER__
  4325. #define __JUCE_VALUE_JUCEHEADER__
  4326. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4327. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4328. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4329. /*** Start of inlined file: juce_MessageListener.h ***/
  4330. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4331. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4332. /*** Start of inlined file: juce_Message.h ***/
  4333. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4334. #define __JUCE_MESSAGE_JUCEHEADER__
  4335. class MessageListener;
  4336. class MessageManager;
  4337. class JUCE_API Message
  4338. {
  4339. public:
  4340. Message() throw();
  4341. Message (int intParameter1,
  4342. int intParameter2,
  4343. int intParameter3,
  4344. void* pointerParameter) throw();
  4345. virtual ~Message() throw();
  4346. // These values can be used for carrying simple data that the application needs to
  4347. // pass around. For more complex messages, just create a subclass.
  4348. int intParameter1; /**< user-defined integer value. */
  4349. int intParameter2; /**< user-defined integer value. */
  4350. int intParameter3; /**< user-defined integer value. */
  4351. void* pointerParameter; /**< user-defined pointer value. */
  4352. juce_UseDebuggingNewOperator
  4353. private:
  4354. friend class MessageListener;
  4355. friend class MessageManager;
  4356. MessageListener* messageRecipient;
  4357. Message (const Message&);
  4358. Message& operator= (const Message&);
  4359. };
  4360. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4361. /*** End of inlined file: juce_Message.h ***/
  4362. class JUCE_API MessageListener
  4363. {
  4364. protected:
  4365. MessageListener() throw();
  4366. public:
  4367. virtual ~MessageListener();
  4368. virtual void handleMessage (const Message& message) = 0;
  4369. void postMessage (Message* message) const throw();
  4370. bool isValidMessageListener() const throw();
  4371. };
  4372. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4373. /*** End of inlined file: juce_MessageListener.h ***/
  4374. class JUCE_API AsyncUpdater
  4375. {
  4376. public:
  4377. AsyncUpdater() throw();
  4378. virtual ~AsyncUpdater();
  4379. void triggerAsyncUpdate() throw();
  4380. void cancelPendingUpdate() throw();
  4381. void handleUpdateNowIfNeeded();
  4382. virtual void handleAsyncUpdate() = 0;
  4383. private:
  4384. class AsyncUpdaterInternal : public MessageListener
  4385. {
  4386. public:
  4387. AsyncUpdaterInternal() throw() {}
  4388. ~AsyncUpdaterInternal() {}
  4389. void handleMessage (const Message&);
  4390. AsyncUpdater* owner;
  4391. private:
  4392. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4393. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4394. };
  4395. AsyncUpdaterInternal internalAsyncHandler;
  4396. bool asyncMessagePending;
  4397. };
  4398. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4399. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4400. /*** Start of inlined file: juce_ListenerList.h ***/
  4401. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4402. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4403. template <class ListenerClass,
  4404. class ArrayType = Array <ListenerClass*> >
  4405. class ListenerList
  4406. {
  4407. public:
  4408. ListenerList()
  4409. {
  4410. }
  4411. ~ListenerList()
  4412. {
  4413. }
  4414. void add (ListenerClass* const listenerToAdd)
  4415. {
  4416. // Listeners can't be null pointers!
  4417. jassert (listenerToAdd != 0);
  4418. if (listenerToAdd != 0)
  4419. listeners.add (listenerToAdd);
  4420. }
  4421. void remove (ListenerClass* const listenerToRemove)
  4422. {
  4423. // Listeners can't be null pointers!
  4424. jassert (listenerToRemove != 0);
  4425. listeners.removeValue (listenerToRemove);
  4426. }
  4427. int size() const throw()
  4428. {
  4429. return listeners.size();
  4430. }
  4431. bool isEmpty() const throw()
  4432. {
  4433. return listeners.size() == 0;
  4434. }
  4435. bool contains (ListenerClass* const listener) const throw()
  4436. {
  4437. return listeners.contains (listener);
  4438. }
  4439. void call (void (ListenerClass::*callbackFunction) ())
  4440. {
  4441. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4442. }
  4443. template <class BailOutCheckerType>
  4444. void callChecked (const BailOutCheckerType& bailOutChecker,
  4445. void (ListenerClass::*callbackFunction) ())
  4446. {
  4447. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4448. (iter.getListener()->*callbackFunction) ();
  4449. }
  4450. template <typename P1, typename P2>
  4451. void call (void (ListenerClass::*callbackFunction) (P1),
  4452. P2& param1)
  4453. {
  4454. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4455. (iter.getListener()->*callbackFunction) (param1);
  4456. }
  4457. template <class BailOutCheckerType, typename P1, typename P2>
  4458. void callChecked (const BailOutCheckerType& bailOutChecker,
  4459. void (ListenerClass::*callbackFunction) (P1),
  4460. P2& param1)
  4461. {
  4462. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4463. (iter.getListener()->*callbackFunction) (param1);
  4464. }
  4465. template <typename P1, typename P2, typename P3, typename P4>
  4466. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4467. P3& param1, P4& param2)
  4468. {
  4469. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4470. (iter.getListener()->*callbackFunction) (param1, param2);
  4471. }
  4472. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4>
  4473. void callChecked (const BailOutCheckerType& bailOutChecker,
  4474. void (ListenerClass::*callbackFunction) (P1, P2),
  4475. P3& param1, P4& param2)
  4476. {
  4477. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4478. (iter.getListener()->*callbackFunction) (param1, param2);
  4479. }
  4480. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4481. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4482. P4& param1, P5& param2, P6& param3)
  4483. {
  4484. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4485. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4486. }
  4487. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
  4488. void callChecked (const BailOutCheckerType& bailOutChecker,
  4489. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4490. P4& param1, P5& param2, P6& param3)
  4491. {
  4492. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4493. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4494. }
  4495. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4496. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4497. P5& param1, P6& param2, P7& param3, P8& param4)
  4498. {
  4499. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4500. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4501. }
  4502. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
  4503. void callChecked (const BailOutCheckerType& bailOutChecker,
  4504. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4505. P5& param1, P6& param2, P7& param3, P8& param4)
  4506. {
  4507. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4508. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4509. }
  4510. template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4511. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4512. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4513. {
  4514. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4515. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4516. }
  4517. template <class BailOutCheckerType, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
  4518. void callChecked (const BailOutCheckerType& bailOutChecker,
  4519. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4520. P6& param1, P7& param2, P8& param3, P9& param4, P10& param5)
  4521. {
  4522. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4523. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4524. }
  4525. class DummyBailOutChecker
  4526. {
  4527. public:
  4528. inline bool shouldBailOut() const throw() { return false; }
  4529. };
  4530. template <class BailOutCheckerType, class ListType>
  4531. class Iterator
  4532. {
  4533. public:
  4534. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4535. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4536. {}
  4537. ~Iterator() {}
  4538. bool next()
  4539. {
  4540. if (index <= 0 || bailOutChecker.shouldBailOut())
  4541. return false;
  4542. const int listSize = list.size();
  4543. if (--index < listSize)
  4544. return true;
  4545. index = listSize - 1;
  4546. return index >= 0;
  4547. }
  4548. typename ListType::ListenerType* getListener() const throw()
  4549. {
  4550. return list.getListeners().getUnchecked (index);
  4551. }
  4552. private:
  4553. const ListType& list;
  4554. const BailOutCheckerType& bailOutChecker;
  4555. int index;
  4556. Iterator (const Iterator&);
  4557. Iterator& operator= (const Iterator&);
  4558. };
  4559. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4560. typedef ListenerClass ListenerType;
  4561. const ArrayType& getListeners() const throw() { return listeners; }
  4562. private:
  4563. ArrayType listeners;
  4564. ListenerList (const ListenerList&);
  4565. ListenerList& operator= (const ListenerList&);
  4566. };
  4567. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4568. /*** End of inlined file: juce_ListenerList.h ***/
  4569. class JUCE_API Value
  4570. {
  4571. public:
  4572. Value();
  4573. Value (const Value& other);
  4574. Value (const var& initialValue);
  4575. ~Value();
  4576. const var getValue() const;
  4577. operator const var() const;
  4578. const String toString() const;
  4579. void setValue (const var& newValue);
  4580. Value& operator= (const var& newValue);
  4581. void referTo (const Value& valueToReferTo);
  4582. bool refersToSameSourceAs (const Value& other) const;
  4583. bool operator== (const Value& other) const;
  4584. bool operator!= (const Value& other) const;
  4585. class JUCE_API Listener
  4586. {
  4587. public:
  4588. Listener() {}
  4589. virtual ~Listener() {}
  4590. virtual void valueChanged (Value& value) = 0;
  4591. };
  4592. void addListener (Listener* const listener);
  4593. void removeListener (Listener* const listener);
  4594. class JUCE_API ValueSource : public ReferenceCountedObject,
  4595. public AsyncUpdater
  4596. {
  4597. public:
  4598. ValueSource();
  4599. virtual ~ValueSource();
  4600. virtual const var getValue() const = 0;
  4601. virtual void setValue (const var& newValue) = 0;
  4602. void sendChangeMessage (const bool dispatchSynchronously);
  4603. juce_UseDebuggingNewOperator
  4604. protected:
  4605. friend class Value;
  4606. SortedSet <Value*> valuesWithListeners;
  4607. void handleAsyncUpdate();
  4608. ValueSource (const ValueSource&);
  4609. ValueSource& operator= (const ValueSource&);
  4610. };
  4611. explicit Value (ValueSource* const valueSource);
  4612. ValueSource& getValueSource() { return *value; }
  4613. juce_UseDebuggingNewOperator
  4614. private:
  4615. friend class ValueSource;
  4616. ReferenceCountedObjectPtr <ValueSource> value;
  4617. ListenerList <Listener> listeners;
  4618. void callListeners();
  4619. // This is disallowed to avoid confusion about whether it should
  4620. // do a by-value or by-reference copy.
  4621. Value& operator= (const Value& other);
  4622. };
  4623. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4624. #endif // __JUCE_VALUE_JUCEHEADER__
  4625. /*** End of inlined file: juce_Value.h ***/
  4626. #endif
  4627. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4628. /*** Start of inlined file: juce_ValueTree.h ***/
  4629. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4630. #define __JUCE_VALUETREE_JUCEHEADER__
  4631. /*** Start of inlined file: juce_UndoManager.h ***/
  4632. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4633. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4634. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4635. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4636. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4637. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4638. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4639. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4640. /*** Start of inlined file: juce_ChangeListener.h ***/
  4641. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4642. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4643. class JUCE_API ChangeListener
  4644. {
  4645. public:
  4646. virtual ~ChangeListener() {}
  4647. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4648. };
  4649. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4650. /*** End of inlined file: juce_ChangeListener.h ***/
  4651. /*** Start of inlined file: juce_ScopedLock.h ***/
  4652. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4653. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4654. class JUCE_API ScopedLock
  4655. {
  4656. public:
  4657. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4658. inline ~ScopedLock() throw() { lock_.exit(); }
  4659. private:
  4660. const CriticalSection& lock_;
  4661. ScopedLock (const ScopedLock&);
  4662. ScopedLock& operator= (const ScopedLock&);
  4663. };
  4664. class ScopedUnlock
  4665. {
  4666. public:
  4667. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4668. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4669. private:
  4670. const CriticalSection& lock_;
  4671. ScopedUnlock (const ScopedLock&);
  4672. ScopedUnlock& operator= (const ScopedUnlock&);
  4673. };
  4674. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4675. /*** End of inlined file: juce_ScopedLock.h ***/
  4676. class JUCE_API ChangeListenerList : public MessageListener
  4677. {
  4678. public:
  4679. ChangeListenerList() throw();
  4680. ~ChangeListenerList() throw();
  4681. void addChangeListener (ChangeListener* listener) throw();
  4682. void removeChangeListener (ChangeListener* listener) throw();
  4683. void removeAllChangeListeners() throw();
  4684. void sendChangeMessage (void* objectThatHasChanged) throw();
  4685. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4686. void dispatchPendingMessages();
  4687. void handleMessage (const Message&);
  4688. juce_UseDebuggingNewOperator
  4689. private:
  4690. SortedSet <void*> listeners;
  4691. CriticalSection lock;
  4692. void* lastChangedObject;
  4693. bool messagePending;
  4694. ChangeListenerList (const ChangeListenerList&);
  4695. ChangeListenerList& operator= (const ChangeListenerList&);
  4696. };
  4697. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4698. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4699. class JUCE_API ChangeBroadcaster
  4700. {
  4701. public:
  4702. ChangeBroadcaster() throw();
  4703. virtual ~ChangeBroadcaster();
  4704. void addChangeListener (ChangeListener* listener) throw();
  4705. void removeChangeListener (ChangeListener* listener) throw();
  4706. void removeAllChangeListeners() throw();
  4707. void sendChangeMessage (void* objectThatHasChanged) throw();
  4708. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4709. void dispatchPendingMessages();
  4710. private:
  4711. ChangeListenerList changeListenerList;
  4712. ChangeBroadcaster (const ChangeBroadcaster&);
  4713. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4714. };
  4715. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4716. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4717. /*** Start of inlined file: juce_UndoableAction.h ***/
  4718. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4719. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4720. class JUCE_API UndoableAction
  4721. {
  4722. protected:
  4723. UndoableAction() throw() {}
  4724. public:
  4725. virtual ~UndoableAction() {}
  4726. virtual bool perform() = 0;
  4727. virtual bool undo() = 0;
  4728. virtual int getSizeInUnits() { return 10; }
  4729. };
  4730. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4731. /*** End of inlined file: juce_UndoableAction.h ***/
  4732. class JUCE_API UndoManager : public ChangeBroadcaster
  4733. {
  4734. public:
  4735. UndoManager (int maxNumberOfUnitsToKeep = 30000,
  4736. int minimumTransactionsToKeep = 30);
  4737. ~UndoManager();
  4738. void clearUndoHistory();
  4739. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4740. void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
  4741. int minimumTransactionsToKeep);
  4742. bool perform (UndoableAction* action,
  4743. const String& actionName = String::empty);
  4744. void beginNewTransaction (const String& actionName = String::empty);
  4745. void setCurrentTransactionName (const String& newName);
  4746. bool canUndo() const;
  4747. const String getUndoDescription() const;
  4748. bool undo();
  4749. bool undoCurrentTransactionOnly();
  4750. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4751. int getNumActionsInCurrentTransaction() const;
  4752. bool canRedo() const;
  4753. const String getRedoDescription() const;
  4754. bool redo();
  4755. juce_UseDebuggingNewOperator
  4756. private:
  4757. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4758. StringArray transactionNames;
  4759. String currentTransactionName;
  4760. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4761. bool newTransaction, reentrancyCheck;
  4762. // disallow copy constructor
  4763. UndoManager (const UndoManager&);
  4764. UndoManager& operator= (const UndoManager&);
  4765. };
  4766. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4767. /*** End of inlined file: juce_UndoManager.h ***/
  4768. class JUCE_API ValueTree
  4769. {
  4770. public:
  4771. ValueTree (const String& type);
  4772. ValueTree (const ValueTree& other);
  4773. ValueTree& operator= (const ValueTree& other);
  4774. ~ValueTree();
  4775. bool operator== (const ValueTree& other) const;
  4776. bool operator!= (const ValueTree& other) const;
  4777. bool isValid() const { return object != 0; }
  4778. ValueTree createCopy() const;
  4779. const String getType() const;
  4780. bool hasType (const String& typeName) const;
  4781. const var& getProperty (const var::identifier& name) const;
  4782. const var& operator[] (const var::identifier& name) const;
  4783. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4784. bool hasProperty (const var::identifier& name) const;
  4785. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4786. void removeAllProperties (UndoManager* const undoManager);
  4787. int getNumProperties() const;
  4788. const var::identifier getPropertyName (int index) const;
  4789. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4790. int getNumChildren() const;
  4791. ValueTree getChild (int index) const;
  4792. ValueTree getChildWithName (const String& type) const;
  4793. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4794. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4795. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4796. void removeChild (const int childIndex, UndoManager* const undoManager);
  4797. void removeAllChildren (UndoManager* const undoManager);
  4798. bool isAChildOf (const ValueTree& possibleParent) const;
  4799. ValueTree getParent() const;
  4800. XmlElement* createXml() const;
  4801. static ValueTree fromXml (const XmlElement& xml);
  4802. void writeToStream (OutputStream& output);
  4803. static ValueTree readFromStream (InputStream& input);
  4804. class JUCE_API Listener
  4805. {
  4806. public:
  4807. virtual ~Listener() {}
  4808. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4809. const var::identifier& property) = 0;
  4810. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4811. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4812. };
  4813. void addListener (Listener* listener);
  4814. void removeListener (Listener* listener);
  4815. template <typename ElementComparator>
  4816. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4817. {
  4818. if (object != 0)
  4819. {
  4820. ComparatorAdapter <ElementComparator> adapter (comparator);
  4821. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4822. object->sendChildChangeMessage();
  4823. }
  4824. }
  4825. juce_UseDebuggingNewOperator
  4826. private:
  4827. friend class ValueTreeSetPropertyAction;
  4828. friend class ValueTreeChildChangeAction;
  4829. class JUCE_API SharedObject : public ReferenceCountedObject
  4830. {
  4831. public:
  4832. SharedObject (const String& type);
  4833. SharedObject (const SharedObject& other);
  4834. ~SharedObject();
  4835. const String type;
  4836. NamedValueSet properties;
  4837. ReferenceCountedArray <SharedObject> children;
  4838. SortedSet <ValueTree*> valueTreesWithListeners;
  4839. SharedObject* parent;
  4840. void sendPropertyChangeMessage (const var::identifier& property);
  4841. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4842. void sendChildChangeMessage();
  4843. void sendChildChangeMessage (ValueTree& tree);
  4844. void sendParentChangeMessage();
  4845. const var& getProperty (const var::identifier& name) const;
  4846. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4847. bool hasProperty (const var::identifier& name) const;
  4848. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4849. void removeAllProperties (UndoManager* const undoManager);
  4850. bool isAChildOf (const SharedObject* const possibleParent) const;
  4851. ValueTree getChildWithName (const String& type) const;
  4852. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4853. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4854. void removeChild (const int childIndex, UndoManager* const undoManager);
  4855. void removeAllChildren (UndoManager* const undoManager);
  4856. XmlElement* createXml() const;
  4857. juce_UseDebuggingNewOperator
  4858. private:
  4859. SharedObject& operator= (const SharedObject&);
  4860. };
  4861. template <typename ElementComparator>
  4862. class ComparatorAdapter
  4863. {
  4864. public:
  4865. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4866. int compareElements (SharedObject* const first, SharedObject* const second)
  4867. {
  4868. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4869. }
  4870. private:
  4871. ElementComparator& comparator;
  4872. };
  4873. friend class SharedObject;
  4874. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4875. ReferenceCountedObjectPtr <SharedObject> object;
  4876. ListenerList <Listener> listeners;
  4877. public:
  4878. ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
  4879. };
  4880. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4881. /*** End of inlined file: juce_ValueTree.h ***/
  4882. #endif
  4883. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4884. #endif
  4885. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4886. /*** Start of inlined file: juce_VoidArray.h ***/
  4887. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4888. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4889. typedef Array <void*> VoidArray;
  4890. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4891. /*** End of inlined file: juce_VoidArray.h ***/
  4892. #endif
  4893. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4894. #endif
  4895. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4896. #endif
  4897. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4898. /*** Start of inlined file: juce_FileLogger.h ***/
  4899. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4900. #define __JUCE_FILELOGGER_JUCEHEADER__
  4901. class JUCE_API FileLogger : public Logger
  4902. {
  4903. public:
  4904. FileLogger (const File& fileToWriteTo,
  4905. const String& welcomeMessage,
  4906. const int maxInitialFileSizeBytes = 128 * 1024);
  4907. ~FileLogger();
  4908. void logMessage (const String& message);
  4909. const File getLogFile() const { return logFile; }
  4910. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4911. const String& logFileName,
  4912. const String& welcomeMessage,
  4913. const int maxInitialFileSizeBytes = 128 * 1024);
  4914. juce_UseDebuggingNewOperator
  4915. private:
  4916. File logFile;
  4917. CriticalSection logLock;
  4918. ScopedPointer <FileOutputStream> logStream;
  4919. void trimFileSize (int maxFileSizeBytes) const;
  4920. FileLogger (const FileLogger&);
  4921. FileLogger& operator= (const FileLogger&);
  4922. };
  4923. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4924. /*** End of inlined file: juce_FileLogger.h ***/
  4925. #endif
  4926. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4927. /*** Start of inlined file: juce_Initialisation.h ***/
  4928. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4929. #define __JUCE_INITIALISATION_JUCEHEADER__
  4930. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4931. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4932. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4933. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4934. class ScopedJuceInitialiser_NonGUI
  4935. {
  4936. public:
  4937. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4938. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4939. };
  4940. class ScopedJuceInitialiser_GUI
  4941. {
  4942. public:
  4943. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4944. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4945. };
  4946. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4947. /*** End of inlined file: juce_Initialisation.h ***/
  4948. #endif
  4949. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4950. #endif
  4951. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4952. #endif
  4953. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4954. #endif
  4955. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4956. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4957. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4958. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4959. class JUCE_API PerformanceCounter
  4960. {
  4961. public:
  4962. PerformanceCounter (const String& counterName,
  4963. int runsPerPrintout = 100,
  4964. const File& loggingFile = File::nonexistent);
  4965. ~PerformanceCounter();
  4966. void start();
  4967. void stop();
  4968. void printStatistics();
  4969. juce_UseDebuggingNewOperator
  4970. private:
  4971. String name;
  4972. int numRuns, runsPerPrint;
  4973. double totalTime;
  4974. int64 started;
  4975. File outputFile;
  4976. };
  4977. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4978. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4979. #endif
  4980. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4981. #endif
  4982. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4983. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4984. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4985. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4986. class JUCE_API PlatformUtilities
  4987. {
  4988. public:
  4989. static void beep();
  4990. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4991. const String& emailSubject,
  4992. const String& bodyText,
  4993. const StringArray& filesToAttach);
  4994. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4995. static const String cfStringToJuceString (CFStringRef cfString);
  4996. static CFStringRef juceStringToCFString (const String& s);
  4997. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4998. static const String makePathFromFSRef (FSRef* file);
  4999. static const String convertToPrecomposedUnicode (const String& s);
  5000. static OSType getTypeOfFile (const String& filename);
  5001. static bool isBundle (const String& filename);
  5002. static void addItemToDock (const File& file);
  5003. static int getOSXMinorVersionNumber();
  5004. #endif
  5005. #if JUCE_WINDOWS || DOXYGEN
  5006. // Some registry helper functions:
  5007. static const String getRegistryValue (const String& regValuePath,
  5008. const String& defaultValue = String::empty);
  5009. static void setRegistryValue (const String& regValuePath,
  5010. const String& value);
  5011. static bool registryValueExists (const String& regValuePath);
  5012. static void deleteRegistryValue (const String& regValuePath);
  5013. static void deleteRegistryKey (const String& regKeyPath);
  5014. static void registerFileAssociation (const String& fileExtension,
  5015. const String& symbolicDescription,
  5016. const String& fullDescription,
  5017. const File& targetExecutable,
  5018. int iconResourceNumber);
  5019. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5020. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5021. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5022. #endif
  5023. static void fpuReset();
  5024. #if JUCE_LINUX || JUCE_WINDOWS
  5025. static void* loadDynamicLibrary (const String& pathOrFilename);
  5026. static void freeDynamicLibrary (void* libraryHandle);
  5027. static void* getProcedureEntryPoint (void* libraryHandle,
  5028. const String& procedureName);
  5029. #endif
  5030. #if JUCE_LINUX || DOXYGEN
  5031. #endif
  5032. private:
  5033. PlatformUtilities();
  5034. PlatformUtilities (const PlatformUtilities&);
  5035. PlatformUtilities& operator= (const PlatformUtilities&);
  5036. };
  5037. #if JUCE_MAC || JUCE_IPHONE
  5038. class ScopedAutoReleasePool
  5039. {
  5040. public:
  5041. ScopedAutoReleasePool();
  5042. ~ScopedAutoReleasePool();
  5043. private:
  5044. void* pool;
  5045. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5046. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5047. };
  5048. #endif
  5049. #if JUCE_LINUX
  5050. class ScopedXLock
  5051. {
  5052. public:
  5053. ScopedXLock();
  5054. ~ScopedXLock();
  5055. };
  5056. #endif
  5057. #if JUCE_MAC
  5058. class JUCE_API AppleRemoteDevice
  5059. {
  5060. public:
  5061. AppleRemoteDevice();
  5062. virtual ~AppleRemoteDevice();
  5063. enum ButtonType
  5064. {
  5065. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5066. playButton, /**< The play button. */
  5067. plusButton, /**< The plus or volume-up button. */
  5068. minusButton, /**< The minus or volume-down button. */
  5069. rightButton, /**< The right button (if it's held for a short time). */
  5070. leftButton, /**< The left button (if it's held for a short time). */
  5071. rightButton_Long, /**< The right button (if it's held for a long time). */
  5072. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5073. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5074. playButtonSleepMode,
  5075. switched
  5076. };
  5077. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5078. bool start (const bool inExclusiveMode);
  5079. void stop();
  5080. bool isActive() const;
  5081. int getRemoteId() const { return remoteId; }
  5082. juce_UseDebuggingNewOperator
  5083. void handleCallbackInternal();
  5084. private:
  5085. void* device;
  5086. void* queue;
  5087. int remoteId;
  5088. bool open (const bool openInExclusiveMode);
  5089. AppleRemoteDevice (const AppleRemoteDevice&);
  5090. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5091. };
  5092. #endif
  5093. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5094. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5095. #endif
  5096. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5097. /*** Start of inlined file: juce_Random.h ***/
  5098. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5099. #define __JUCE_RANDOM_JUCEHEADER__
  5100. class JUCE_API Random
  5101. {
  5102. public:
  5103. Random (int64 seedValue) throw();
  5104. ~Random() throw();
  5105. int nextInt() throw();
  5106. int nextInt (int maxValue) throw();
  5107. int64 nextInt64() throw();
  5108. float nextFloat() throw();
  5109. double nextDouble() throw();
  5110. bool nextBool() throw();
  5111. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5112. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5113. static Random& getSystemRandom() throw();
  5114. void setSeed (int64 newSeed) throw();
  5115. void combineSeed (int64 seedValue) throw();
  5116. void setSeedRandomly();
  5117. juce_UseDebuggingNewOperator
  5118. private:
  5119. int64 seed;
  5120. };
  5121. #endif // __JUCE_RANDOM_JUCEHEADER__
  5122. /*** End of inlined file: juce_Random.h ***/
  5123. #endif
  5124. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5125. #endif
  5126. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5127. /*** Start of inlined file: juce_Singleton.h ***/
  5128. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5129. #define __JUCE_SINGLETON_JUCEHEADER__
  5130. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5131. \
  5132. static classname* _singletonInstance; \
  5133. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5134. \
  5135. static classname* getInstance() \
  5136. { \
  5137. if (_singletonInstance == 0) \
  5138. {\
  5139. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5140. \
  5141. if (_singletonInstance == 0) \
  5142. { \
  5143. static bool alreadyInside = false; \
  5144. static bool createdOnceAlready = false; \
  5145. \
  5146. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5147. jassert (! problem); \
  5148. if (! problem) \
  5149. { \
  5150. createdOnceAlready = true; \
  5151. alreadyInside = true; \
  5152. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5153. alreadyInside = false; \
  5154. \
  5155. _singletonInstance = newObject; \
  5156. } \
  5157. } \
  5158. } \
  5159. \
  5160. return _singletonInstance; \
  5161. } \
  5162. \
  5163. static inline classname* getInstanceWithoutCreating() throw() \
  5164. { \
  5165. return _singletonInstance; \
  5166. } \
  5167. \
  5168. static void deleteInstance() \
  5169. { \
  5170. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5171. if (_singletonInstance != 0) \
  5172. { \
  5173. classname* const old = _singletonInstance; \
  5174. _singletonInstance = 0; \
  5175. delete old; \
  5176. } \
  5177. } \
  5178. \
  5179. void clearSingletonInstance() throw() \
  5180. { \
  5181. if (_singletonInstance == this) \
  5182. _singletonInstance = 0; \
  5183. }
  5184. #define juce_ImplementSingleton(classname) \
  5185. \
  5186. classname* classname::_singletonInstance = 0; \
  5187. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5188. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5189. \
  5190. static classname* _singletonInstance; \
  5191. \
  5192. static classname* getInstance() \
  5193. { \
  5194. if (_singletonInstance == 0) \
  5195. { \
  5196. static bool alreadyInside = false; \
  5197. static bool createdOnceAlready = false; \
  5198. \
  5199. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5200. jassert (! problem); \
  5201. if (! problem) \
  5202. { \
  5203. createdOnceAlready = true; \
  5204. alreadyInside = true; \
  5205. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5206. alreadyInside = false; \
  5207. \
  5208. _singletonInstance = newObject; \
  5209. } \
  5210. } \
  5211. \
  5212. return _singletonInstance; \
  5213. } \
  5214. \
  5215. static inline classname* getInstanceWithoutCreating() throw() \
  5216. { \
  5217. return _singletonInstance; \
  5218. } \
  5219. \
  5220. static void deleteInstance() \
  5221. { \
  5222. if (_singletonInstance != 0) \
  5223. { \
  5224. classname* const old = _singletonInstance; \
  5225. _singletonInstance = 0; \
  5226. delete old; \
  5227. } \
  5228. } \
  5229. \
  5230. void clearSingletonInstance() throw() \
  5231. { \
  5232. if (_singletonInstance == this) \
  5233. _singletonInstance = 0; \
  5234. }
  5235. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5236. \
  5237. static classname* _singletonInstance; \
  5238. \
  5239. static classname* getInstance() \
  5240. { \
  5241. if (_singletonInstance == 0) \
  5242. _singletonInstance = new classname(); \
  5243. \
  5244. return _singletonInstance; \
  5245. } \
  5246. \
  5247. static inline classname* getInstanceWithoutCreating() throw() \
  5248. { \
  5249. return _singletonInstance; \
  5250. } \
  5251. \
  5252. static void deleteInstance() \
  5253. { \
  5254. if (_singletonInstance != 0) \
  5255. { \
  5256. classname* const old = _singletonInstance; \
  5257. _singletonInstance = 0; \
  5258. delete old; \
  5259. } \
  5260. } \
  5261. \
  5262. void clearSingletonInstance() throw() \
  5263. { \
  5264. if (_singletonInstance == this) \
  5265. _singletonInstance = 0; \
  5266. }
  5267. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5268. \
  5269. classname* classname::_singletonInstance = 0;
  5270. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5271. /*** End of inlined file: juce_Singleton.h ***/
  5272. #endif
  5273. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5274. #endif
  5275. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5276. /*** Start of inlined file: juce_SystemStats.h ***/
  5277. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5278. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5279. class JUCE_API SystemStats
  5280. {
  5281. public:
  5282. static const String getJUCEVersion() throw();
  5283. enum OperatingSystemType
  5284. {
  5285. UnknownOS = 0,
  5286. MacOSX = 0x1000,
  5287. Linux = 0x2000,
  5288. Win95 = 0x4001,
  5289. Win98 = 0x4002,
  5290. WinNT351 = 0x4103,
  5291. WinNT40 = 0x4104,
  5292. Win2000 = 0x4105,
  5293. WinXP = 0x4106,
  5294. WinVista = 0x4107,
  5295. Windows7 = 0x4108,
  5296. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5297. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5298. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5299. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5300. };
  5301. static OperatingSystemType getOperatingSystemType() throw();
  5302. static const String getOperatingSystemName() throw();
  5303. static bool isOperatingSystem64Bit() throw();
  5304. static const String getLogonName();
  5305. static const String getFullUserName();
  5306. // CPU and memory information..
  5307. static int getCpuSpeedInMegaherz() throw();
  5308. static const String getCpuVendor() throw();
  5309. static bool hasMMX() throw();
  5310. static bool hasSSE() throw();
  5311. static bool hasSSE2() throw();
  5312. static bool has3DNow() throw();
  5313. static int getNumCpus() throw();
  5314. static int64 getClockCycleCounter() throw();
  5315. static int getMemorySizeInMegabytes() throw();
  5316. static int getPageSize() throw();
  5317. static int getMACAddresses (int64* addresses, int maxNum,
  5318. #if JUCE_MAC
  5319. const bool littleEndian = true);
  5320. #else
  5321. const bool littleEndian = false);
  5322. #endif
  5323. static const StringArray getMACAddressStrings();
  5324. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5325. static void initialiseStats() throw();
  5326. private:
  5327. SystemStats();
  5328. SystemStats (const SystemStats&);
  5329. SystemStats& operator= (const SystemStats&);
  5330. };
  5331. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5332. /*** End of inlined file: juce_SystemStats.h ***/
  5333. #endif
  5334. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5335. #endif
  5336. #ifndef __JUCE_TIME_JUCEHEADER__
  5337. #endif
  5338. #ifndef __JUCE_UUID_JUCEHEADER__
  5339. /*** Start of inlined file: juce_Uuid.h ***/
  5340. #ifndef __JUCE_UUID_JUCEHEADER__
  5341. #define __JUCE_UUID_JUCEHEADER__
  5342. class JUCE_API Uuid
  5343. {
  5344. public:
  5345. Uuid();
  5346. ~Uuid() throw();
  5347. Uuid (const Uuid& other);
  5348. Uuid& operator= (const Uuid& other);
  5349. bool isNull() const throw();
  5350. bool operator== (const Uuid& other) const;
  5351. bool operator!= (const Uuid& other) const;
  5352. const String toString() const;
  5353. Uuid (const String& uuidString);
  5354. Uuid& operator= (const String& uuidString);
  5355. const uint8* getRawData() const throw() { return value.asBytes; }
  5356. Uuid (const uint8* const rawData);
  5357. Uuid& operator= (const uint8* const rawData);
  5358. juce_UseDebuggingNewOperator
  5359. private:
  5360. union
  5361. {
  5362. uint8 asBytes [16];
  5363. int asInt[4];
  5364. int64 asInt64[2];
  5365. } value;
  5366. };
  5367. #endif // __JUCE_UUID_JUCEHEADER__
  5368. /*** End of inlined file: juce_Uuid.h ***/
  5369. #endif
  5370. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5371. /*** Start of inlined file: juce_BlowFish.h ***/
  5372. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5373. #define __JUCE_BLOWFISH_JUCEHEADER__
  5374. class JUCE_API BlowFish
  5375. {
  5376. public:
  5377. BlowFish (const void* keyData, int keyBytes);
  5378. BlowFish (const BlowFish& other);
  5379. BlowFish& operator= (const BlowFish& other);
  5380. ~BlowFish();
  5381. void encrypt (uint32& data1, uint32& data2) const throw();
  5382. void decrypt (uint32& data1, uint32& data2) const throw();
  5383. juce_UseDebuggingNewOperator
  5384. private:
  5385. uint32 p[18];
  5386. HeapBlock <uint32> s[4];
  5387. uint32 F (uint32 x) const throw();
  5388. };
  5389. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5390. /*** End of inlined file: juce_BlowFish.h ***/
  5391. #endif
  5392. #ifndef __JUCE_MD5_JUCEHEADER__
  5393. /*** Start of inlined file: juce_MD5.h ***/
  5394. #ifndef __JUCE_MD5_JUCEHEADER__
  5395. #define __JUCE_MD5_JUCEHEADER__
  5396. class JUCE_API MD5
  5397. {
  5398. public:
  5399. MD5();
  5400. MD5 (const MD5& other);
  5401. MD5& operator= (const MD5& other);
  5402. MD5 (const MemoryBlock& data);
  5403. MD5 (const char* data, const size_t numBytes);
  5404. MD5 (const String& text);
  5405. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5406. MD5 (const File& file);
  5407. ~MD5();
  5408. const MemoryBlock getRawChecksumData() const;
  5409. const String toHexString() const;
  5410. bool operator== (const MD5& other) const;
  5411. bool operator!= (const MD5& other) const;
  5412. juce_UseDebuggingNewOperator
  5413. private:
  5414. uint8 result [16];
  5415. struct ProcessContext
  5416. {
  5417. uint8 buffer [64];
  5418. uint32 state [4];
  5419. uint32 count [2];
  5420. ProcessContext();
  5421. void processBlock (const uint8* const data, size_t dataSize);
  5422. void transform (const uint8* const buffer);
  5423. void finish (uint8* const result);
  5424. };
  5425. void processStream (InputStream& input, int64 numBytesToRead);
  5426. };
  5427. #endif // __JUCE_MD5_JUCEHEADER__
  5428. /*** End of inlined file: juce_MD5.h ***/
  5429. #endif
  5430. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5431. /*** Start of inlined file: juce_Primes.h ***/
  5432. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5433. #define __JUCE_PRIMES_JUCEHEADER__
  5434. class JUCE_API Primes
  5435. {
  5436. public:
  5437. static const BigInteger createProbablePrime (int bitLength,
  5438. int certainty,
  5439. const int* randomSeeds = 0,
  5440. int numRandomSeeds = 0);
  5441. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5442. };
  5443. #endif // __JUCE_PRIMES_JUCEHEADER__
  5444. /*** End of inlined file: juce_Primes.h ***/
  5445. #endif
  5446. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5447. /*** Start of inlined file: juce_RSAKey.h ***/
  5448. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5449. #define __JUCE_RSAKEY_JUCEHEADER__
  5450. class JUCE_API RSAKey
  5451. {
  5452. public:
  5453. RSAKey();
  5454. RSAKey (const String& stringRepresentation);
  5455. ~RSAKey();
  5456. const String toString() const;
  5457. bool applyToValue (BigInteger& value) const;
  5458. static void createKeyPair (RSAKey& publicKey,
  5459. RSAKey& privateKey,
  5460. int numBits,
  5461. const int* randomSeeds = 0,
  5462. int numRandomSeeds = 0);
  5463. juce_UseDebuggingNewOperator
  5464. protected:
  5465. BigInteger part1, part2;
  5466. };
  5467. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5468. /*** End of inlined file: juce_RSAKey.h ***/
  5469. #endif
  5470. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5471. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5472. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5473. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5474. class JUCE_API DirectoryIterator
  5475. {
  5476. public:
  5477. DirectoryIterator (const File& directory,
  5478. bool isRecursive,
  5479. const String& wildCard = "*",
  5480. int whatToLookFor = File::findFiles);
  5481. ~DirectoryIterator();
  5482. bool next();
  5483. const File getFile() const;
  5484. float getEstimatedProgress() const;
  5485. juce_UseDebuggingNewOperator
  5486. private:
  5487. Array <File> filesFound;
  5488. Array <File> dirsFound;
  5489. String wildCard;
  5490. int index;
  5491. const int whatToLookFor;
  5492. ScopedPointer <DirectoryIterator> subIterator;
  5493. DirectoryIterator (const DirectoryIterator&);
  5494. DirectoryIterator& operator= (const DirectoryIterator&);
  5495. };
  5496. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5497. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5498. #endif
  5499. #ifndef __JUCE_FILE_JUCEHEADER__
  5500. #endif
  5501. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5502. /*** Start of inlined file: juce_FileInputStream.h ***/
  5503. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5504. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5505. class JUCE_API FileInputStream : public InputStream
  5506. {
  5507. public:
  5508. FileInputStream (const File& fileToRead);
  5509. ~FileInputStream();
  5510. const File& getFile() const throw() { return file; }
  5511. int64 getTotalLength();
  5512. int read (void* destBuffer, int maxBytesToRead);
  5513. bool isExhausted();
  5514. int64 getPosition();
  5515. bool setPosition (int64 pos);
  5516. juce_UseDebuggingNewOperator
  5517. private:
  5518. File file;
  5519. void* fileHandle;
  5520. int64 currentPosition, totalSize;
  5521. bool needToSeek;
  5522. FileInputStream (const FileInputStream&);
  5523. FileInputStream& operator= (const FileInputStream&);
  5524. };
  5525. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5526. /*** End of inlined file: juce_FileInputStream.h ***/
  5527. #endif
  5528. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5529. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5530. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5531. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5532. class JUCE_API FileOutputStream : public OutputStream
  5533. {
  5534. public:
  5535. FileOutputStream (const File& fileToWriteTo,
  5536. int bufferSizeToUse = 16384);
  5537. ~FileOutputStream();
  5538. const File& getFile() const { return file; }
  5539. bool failedToOpen() const { return fileHandle == 0; }
  5540. void flush();
  5541. int64 getPosition();
  5542. bool setPosition (int64 pos);
  5543. bool write (const void* data, int numBytes);
  5544. juce_UseDebuggingNewOperator
  5545. private:
  5546. File file;
  5547. void* fileHandle;
  5548. int64 currentPosition;
  5549. int bufferSize, bytesInBuffer;
  5550. HeapBlock <char> buffer;
  5551. FileOutputStream (const FileOutputStream&);
  5552. FileOutputStream& operator= (const FileOutputStream&);
  5553. };
  5554. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5555. /*** End of inlined file: juce_FileOutputStream.h ***/
  5556. #endif
  5557. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5558. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5559. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5560. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5561. class JUCE_API FileSearchPath
  5562. {
  5563. public:
  5564. FileSearchPath();
  5565. FileSearchPath (const String& path);
  5566. FileSearchPath (const FileSearchPath& other);
  5567. ~FileSearchPath();
  5568. FileSearchPath& operator= (const String& path);
  5569. int getNumPaths() const;
  5570. const File operator[] (int index) const;
  5571. const String toString() const;
  5572. void add (const File& directoryToAdd,
  5573. int insertIndex = -1);
  5574. void addIfNotAlreadyThere (const File& directoryToAdd);
  5575. void remove (int indexToRemove);
  5576. void addPath (const FileSearchPath& other);
  5577. void removeRedundantPaths();
  5578. void removeNonExistentPaths();
  5579. int findChildFiles (Array<File>& results,
  5580. int whatToLookFor,
  5581. bool searchRecursively,
  5582. const String& wildCardPattern = "*") const;
  5583. bool isFileInPath (const File& fileToCheck,
  5584. bool checkRecursively) const;
  5585. juce_UseDebuggingNewOperator
  5586. private:
  5587. StringArray directories;
  5588. void init (const String& path);
  5589. };
  5590. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5591. /*** End of inlined file: juce_FileSearchPath.h ***/
  5592. #endif
  5593. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5594. /*** Start of inlined file: juce_NamedPipe.h ***/
  5595. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5596. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5597. class JUCE_API NamedPipe
  5598. {
  5599. public:
  5600. NamedPipe();
  5601. ~NamedPipe();
  5602. bool openExisting (const String& pipeName);
  5603. bool createNewPipe (const String& pipeName);
  5604. void close();
  5605. bool isOpen() const;
  5606. const String getName() const;
  5607. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5608. int write (const void* sourceBuffer, int numBytesToWrite,
  5609. int timeOutMilliseconds = 2000);
  5610. void cancelPendingReads();
  5611. juce_UseDebuggingNewOperator
  5612. private:
  5613. void* internal;
  5614. String currentPipeName;
  5615. CriticalSection lock;
  5616. NamedPipe (const NamedPipe&);
  5617. NamedPipe& operator= (const NamedPipe&);
  5618. bool openInternal (const String& pipeName, const bool createPipe);
  5619. };
  5620. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5621. /*** End of inlined file: juce_NamedPipe.h ***/
  5622. #endif
  5623. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5624. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5625. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5626. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5627. class JUCE_API TemporaryFile
  5628. {
  5629. public:
  5630. enum OptionFlags
  5631. {
  5632. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5633. i.e. its name should start with a dot. */
  5634. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5635. the file is unique, they should go in brackets rather
  5636. than just being appended (see File::getNonexistentSibling() )*/
  5637. };
  5638. TemporaryFile (const String& suffix = String::empty,
  5639. int optionFlags = 0);
  5640. TemporaryFile (const File& targetFile,
  5641. int optionFlags = 0);
  5642. ~TemporaryFile();
  5643. const File getFile() const { return temporaryFile; }
  5644. const File getTargetFile() const { return targetFile; }
  5645. bool overwriteTargetFileWithTemporary() const;
  5646. juce_UseDebuggingNewOperator
  5647. private:
  5648. File temporaryFile, targetFile;
  5649. void createTempFile (const File& parentDirectory, String name, const String& suffix, int optionFlags);
  5650. TemporaryFile (const TemporaryFile&);
  5651. TemporaryFile& operator= (const TemporaryFile&);
  5652. };
  5653. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5654. /*** End of inlined file: juce_TemporaryFile.h ***/
  5655. #endif
  5656. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5657. /*** Start of inlined file: juce_ZipFile.h ***/
  5658. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5659. #define __JUCE_ZIPFILE_JUCEHEADER__
  5660. /*** Start of inlined file: juce_InputSource.h ***/
  5661. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5662. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5663. class JUCE_API InputSource
  5664. {
  5665. public:
  5666. InputSource() throw() {}
  5667. virtual ~InputSource() {}
  5668. virtual InputStream* createInputStream() = 0;
  5669. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5670. virtual int64 hashCode() const = 0;
  5671. juce_UseDebuggingNewOperator
  5672. };
  5673. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5674. /*** End of inlined file: juce_InputSource.h ***/
  5675. class JUCE_API ZipFile
  5676. {
  5677. public:
  5678. ZipFile (InputStream* inputStream,
  5679. bool deleteStreamWhenDestroyed) throw();
  5680. ZipFile (const File& file);
  5681. ZipFile (InputSource* inputSource);
  5682. ~ZipFile() throw();
  5683. struct ZipEntry
  5684. {
  5685. String filename;
  5686. unsigned int uncompressedSize;
  5687. Time fileTime;
  5688. };
  5689. int getNumEntries() const throw();
  5690. const ZipEntry* getEntry (int index) const throw();
  5691. int getIndexOfFileName (const String& fileName) const throw();
  5692. const ZipEntry* getEntry (const String& fileName) const throw();
  5693. void sortEntriesByFilename();
  5694. InputStream* createStreamForEntry (int index);
  5695. void uncompressTo (const File& targetDirectory,
  5696. bool shouldOverwriteFiles = true);
  5697. juce_UseDebuggingNewOperator
  5698. private:
  5699. class ZipInputStream;
  5700. class ZipFilenameComparator;
  5701. class ZipEntryInfo;
  5702. friend class ZipInputStream;
  5703. friend class ZipFilenameComparator;
  5704. friend class ZipEntryInfo;
  5705. OwnedArray <ZipEntryInfo> entries;
  5706. CriticalSection lock;
  5707. InputStream* inputStream;
  5708. ScopedPointer <InputStream> streamToDelete;
  5709. ScopedPointer <InputSource> inputSource;
  5710. #ifdef JUCE_DEBUG
  5711. int numOpenStreams;
  5712. #endif
  5713. void init();
  5714. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5715. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5716. ZipFile (const ZipFile&);
  5717. ZipFile& operator= (const ZipFile&);
  5718. };
  5719. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5720. /*** End of inlined file: juce_ZipFile.h ***/
  5721. #endif
  5722. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5723. /*** Start of inlined file: juce_Socket.h ***/
  5724. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5725. #define __JUCE_SOCKET_JUCEHEADER__
  5726. class JUCE_API StreamingSocket
  5727. {
  5728. public:
  5729. StreamingSocket();
  5730. ~StreamingSocket();
  5731. bool bindToPort (int localPortNumber);
  5732. bool connect (const String& remoteHostname,
  5733. int remotePortNumber,
  5734. int timeOutMillisecs = 3000);
  5735. bool isConnected() const throw() { return connected; }
  5736. void close();
  5737. const String& getHostName() const throw() { return hostName; }
  5738. int getPort() const throw() { return portNumber; }
  5739. bool isLocal() const throw();
  5740. int waitUntilReady (bool readyForReading,
  5741. int timeoutMsecs) const;
  5742. int read (void* destBuffer, int maxBytesToRead,
  5743. bool blockUntilSpecifiedAmountHasArrived);
  5744. int write (const void* sourceBuffer, int numBytesToWrite);
  5745. bool createListener (int portNumber, const String& localHostName = String::empty);
  5746. StreamingSocket* waitForNextConnection() const;
  5747. juce_UseDebuggingNewOperator
  5748. private:
  5749. String hostName;
  5750. int volatile portNumber, handle;
  5751. bool connected, isListener;
  5752. StreamingSocket (const String& hostname, int portNumber, int handle);
  5753. StreamingSocket (const StreamingSocket&);
  5754. StreamingSocket& operator= (const StreamingSocket&);
  5755. };
  5756. class JUCE_API DatagramSocket
  5757. {
  5758. public:
  5759. DatagramSocket (int localPortNumber,
  5760. bool enableBroadcasting = false);
  5761. ~DatagramSocket();
  5762. bool bindToPort (int localPortNumber);
  5763. bool connect (const String& remoteHostname,
  5764. int remotePortNumber,
  5765. int timeOutMillisecs = 3000);
  5766. bool isConnected() const throw() { return connected; }
  5767. void close();
  5768. const String& getHostName() const throw() { return hostName; }
  5769. int getPort() const throw() { return portNumber; }
  5770. bool isLocal() const throw();
  5771. int waitUntilReady (bool readyForReading,
  5772. int timeoutMsecs) const;
  5773. int read (void* destBuffer, int maxBytesToRead,
  5774. bool blockUntilSpecifiedAmountHasArrived);
  5775. int write (const void* sourceBuffer, int numBytesToWrite);
  5776. DatagramSocket* waitForNextConnection() const;
  5777. juce_UseDebuggingNewOperator
  5778. private:
  5779. String hostName;
  5780. int volatile portNumber, handle;
  5781. bool connected, allowBroadcast;
  5782. void* serverAddress;
  5783. DatagramSocket (const String& hostname, int portNumber, int handle, int localPortNumber);
  5784. DatagramSocket (const DatagramSocket&);
  5785. DatagramSocket& operator= (const DatagramSocket&);
  5786. };
  5787. #endif // __JUCE_SOCKET_JUCEHEADER__
  5788. /*** End of inlined file: juce_Socket.h ***/
  5789. #endif
  5790. #ifndef __JUCE_URL_JUCEHEADER__
  5791. /*** Start of inlined file: juce_URL.h ***/
  5792. #ifndef __JUCE_URL_JUCEHEADER__
  5793. #define __JUCE_URL_JUCEHEADER__
  5794. class JUCE_API URL
  5795. {
  5796. public:
  5797. URL();
  5798. URL (const String& url);
  5799. URL (const URL& other);
  5800. ~URL();
  5801. URL& operator= (const URL& other);
  5802. const String toString (bool includeGetParameters) const;
  5803. bool isWellFormed() const;
  5804. const String getDomain() const;
  5805. const String getSubPath() const;
  5806. const String getScheme() const;
  5807. const URL withNewSubPath (const String& newPath) const;
  5808. const URL withParameter (const String& parameterName,
  5809. const String& parameterValue) const;
  5810. const URL withFileToUpload (const String& parameterName,
  5811. const File& fileToUpload,
  5812. const String& mimeType) const;
  5813. const StringPairArray& getParameters() const;
  5814. const StringPairArray& getFilesToUpload() const;
  5815. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5816. const URL withPOSTData (const String& postData) const;
  5817. const String getPostData() const { return postData; }
  5818. bool launchInDefaultBrowser() const;
  5819. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5820. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5821. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5822. InputStream* createInputStream (bool usePostCommand,
  5823. OpenStreamProgressCallback* progressCallback = 0,
  5824. void* progressCallbackContext = 0,
  5825. const String& extraHeaders = String::empty,
  5826. int connectionTimeOutMs = 0) const;
  5827. bool readEntireBinaryStream (MemoryBlock& destData,
  5828. bool usePostCommand = false) const;
  5829. const String readEntireTextStream (bool usePostCommand = false) const;
  5830. XmlElement* readEntireXmlStream (bool usePostCommand = false) const;
  5831. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5832. bool isParameter);
  5833. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5834. juce_UseDebuggingNewOperator
  5835. private:
  5836. String url, postData;
  5837. StringPairArray parameters, filesToUpload, mimeTypes;
  5838. };
  5839. #endif // __JUCE_URL_JUCEHEADER__
  5840. /*** End of inlined file: juce_URL.h ***/
  5841. #endif
  5842. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5843. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5844. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5845. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5846. class JUCE_API BufferedInputStream : public InputStream
  5847. {
  5848. public:
  5849. BufferedInputStream (InputStream* sourceStream,
  5850. int bufferSize,
  5851. bool deleteSourceWhenDestroyed);
  5852. ~BufferedInputStream();
  5853. int64 getTotalLength();
  5854. int64 getPosition();
  5855. bool setPosition (int64 newPosition);
  5856. int read (void* destBuffer, int maxBytesToRead);
  5857. const String readString();
  5858. bool isExhausted();
  5859. juce_UseDebuggingNewOperator
  5860. private:
  5861. InputStream* const source;
  5862. ScopedPointer <InputStream> sourceToDelete;
  5863. int bufferSize;
  5864. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5865. HeapBlock <char> buffer;
  5866. void ensureBuffered();
  5867. BufferedInputStream (const BufferedInputStream&);
  5868. BufferedInputStream& operator= (const BufferedInputStream&);
  5869. };
  5870. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5871. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5872. #endif
  5873. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5874. /*** Start of inlined file: juce_FileInputSource.h ***/
  5875. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5876. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5877. class JUCE_API FileInputSource : public InputSource
  5878. {
  5879. public:
  5880. FileInputSource (const File& file);
  5881. ~FileInputSource();
  5882. InputStream* createInputStream();
  5883. InputStream* createInputStreamFor (const String& relatedItemPath);
  5884. int64 hashCode() const;
  5885. juce_UseDebuggingNewOperator
  5886. private:
  5887. const File file;
  5888. FileInputSource (const FileInputSource&);
  5889. FileInputSource& operator= (const FileInputSource&);
  5890. };
  5891. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5892. /*** End of inlined file: juce_FileInputSource.h ***/
  5893. #endif
  5894. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5895. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5896. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5897. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5898. class GZIPCompressorHelper;
  5899. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5900. {
  5901. public:
  5902. GZIPCompressorOutputStream (OutputStream* destStream,
  5903. int compressionLevel = 0,
  5904. bool deleteDestStreamWhenDestroyed = false,
  5905. bool noWrap = false);
  5906. ~GZIPCompressorOutputStream();
  5907. void flush();
  5908. int64 getPosition();
  5909. bool setPosition (int64 newPosition);
  5910. bool write (const void* destBuffer, int howMany);
  5911. juce_UseDebuggingNewOperator
  5912. private:
  5913. OutputStream* const destStream;
  5914. ScopedPointer <OutputStream> streamToDelete;
  5915. HeapBlock <uint8> buffer;
  5916. ScopedPointer <GZIPCompressorHelper> helper;
  5917. bool doNextBlock();
  5918. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5919. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5920. };
  5921. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5922. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5923. #endif
  5924. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5925. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5926. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5927. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5928. class GZIPDecompressHelper;
  5929. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5930. {
  5931. public:
  5932. GZIPDecompressorInputStream (InputStream* sourceStream,
  5933. bool deleteSourceWhenDestroyed,
  5934. bool noWrap = false,
  5935. int64 uncompressedStreamLength = -1);
  5936. ~GZIPDecompressorInputStream();
  5937. int64 getPosition();
  5938. bool setPosition (int64 pos);
  5939. int64 getTotalLength();
  5940. bool isExhausted();
  5941. int read (void* destBuffer, int maxBytesToRead);
  5942. juce_UseDebuggingNewOperator
  5943. private:
  5944. InputStream* const sourceStream;
  5945. ScopedPointer <InputStream> streamToDelete;
  5946. const int64 uncompressedStreamLength;
  5947. const bool noWrap;
  5948. bool isEof;
  5949. int activeBufferSize;
  5950. int64 originalSourcePos, currentPos;
  5951. HeapBlock <uint8> buffer;
  5952. ScopedPointer <GZIPDecompressHelper> helper;
  5953. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5954. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5955. };
  5956. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5957. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5958. #endif
  5959. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5960. #endif
  5961. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5962. #endif
  5963. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5964. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5965. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5966. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5967. class JUCE_API MemoryInputStream : public InputStream
  5968. {
  5969. public:
  5970. MemoryInputStream (const void* sourceData,
  5971. size_t sourceDataSize,
  5972. bool keepInternalCopyOfData);
  5973. MemoryInputStream (const MemoryBlock& data,
  5974. bool keepInternalCopyOfData);
  5975. ~MemoryInputStream();
  5976. int64 getPosition();
  5977. bool setPosition (int64 pos);
  5978. int64 getTotalLength();
  5979. bool isExhausted();
  5980. int read (void* destBuffer, int maxBytesToRead);
  5981. juce_UseDebuggingNewOperator
  5982. private:
  5983. const char* data;
  5984. size_t dataSize, position;
  5985. MemoryBlock internalCopy;
  5986. MemoryInputStream (const MemoryInputStream&);
  5987. MemoryInputStream& operator= (const MemoryInputStream&);
  5988. };
  5989. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5990. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5991. #endif
  5992. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5993. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5994. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5995. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5996. class JUCE_API MemoryOutputStream : public OutputStream
  5997. {
  5998. public:
  5999. MemoryOutputStream (size_t initialSize = 256,
  6000. size_t granularity = 256,
  6001. MemoryBlock* memoryBlockToWriteTo = 0);
  6002. ~MemoryOutputStream();
  6003. const char* getData() const throw();
  6004. size_t getDataSize() const throw();
  6005. void reset() throw();
  6006. void flush();
  6007. bool write (const void* buffer, int howMany);
  6008. int64 getPosition();
  6009. bool setPosition (int64 newPosition);
  6010. juce_UseDebuggingNewOperator
  6011. private:
  6012. MemoryBlock* data;
  6013. ScopedPointer <MemoryBlock> dataToDelete;
  6014. size_t position, size, blockSize;
  6015. MemoryOutputStream (const MemoryOutputStream&);
  6016. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6017. };
  6018. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6019. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6020. #endif
  6021. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6022. #endif
  6023. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6024. /*** Start of inlined file: juce_SubregionStream.h ***/
  6025. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6026. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6027. class JUCE_API SubregionStream : public InputStream
  6028. {
  6029. public:
  6030. SubregionStream (InputStream* sourceStream,
  6031. int64 startPositionInSourceStream,
  6032. int64 lengthOfSourceStream,
  6033. bool deleteSourceWhenDestroyed) throw();
  6034. ~SubregionStream() throw();
  6035. int64 getTotalLength();
  6036. int64 getPosition();
  6037. bool setPosition (int64 newPosition);
  6038. int read (void* destBuffer, int maxBytesToRead);
  6039. bool isExhausted();
  6040. juce_UseDebuggingNewOperator
  6041. private:
  6042. InputStream* const source;
  6043. ScopedPointer <InputStream> sourceToDelete;
  6044. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6045. SubregionStream (const SubregionStream&);
  6046. SubregionStream& operator= (const SubregionStream&);
  6047. };
  6048. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6049. /*** End of inlined file: juce_SubregionStream.h ***/
  6050. #endif
  6051. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6052. #endif
  6053. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6054. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6055. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6056. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6057. #define TRANS(stringLiteral) \
  6058. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6059. class JUCE_API LocalisedStrings
  6060. {
  6061. public:
  6062. LocalisedStrings (const String& fileContents);
  6063. LocalisedStrings (const File& fileToLoad);
  6064. ~LocalisedStrings();
  6065. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6066. static LocalisedStrings* getCurrentMappings();
  6067. static const String translateWithCurrentMappings (const String& text);
  6068. static const String translateWithCurrentMappings (const char* text);
  6069. const String translate (const String& text) const;
  6070. const String getLanguageName() const { return languageName; }
  6071. const StringArray getCountryCodes() const { return countryCodes; }
  6072. void setIgnoresCase (const bool shouldIgnoreCase);
  6073. juce_UseDebuggingNewOperator
  6074. private:
  6075. String languageName;
  6076. StringArray countryCodes;
  6077. StringPairArray translations;
  6078. void loadFromText (const String& fileContents);
  6079. };
  6080. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6081. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6082. #endif
  6083. #ifndef __JUCE_STRING_JUCEHEADER__
  6084. #endif
  6085. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6086. #endif
  6087. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6088. #endif
  6089. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6090. /*** Start of inlined file: juce_XmlDocument.h ***/
  6091. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6092. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6093. class JUCE_API XmlDocument
  6094. {
  6095. public:
  6096. XmlDocument (const String& documentText);
  6097. XmlDocument (const File& file);
  6098. ~XmlDocument();
  6099. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6100. const String& getLastParseError() const throw();
  6101. void setInputSource (InputSource* const newSource) throw();
  6102. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6103. juce_UseDebuggingNewOperator
  6104. private:
  6105. String originalText;
  6106. const juce_wchar* input;
  6107. bool outOfData, errorOccurred;
  6108. bool identifierLookupTable [128];
  6109. String lastError, dtdText;
  6110. StringArray tokenisedDTD;
  6111. bool needToLoadDTD, ignoreEmptyTextElements;
  6112. ScopedPointer <InputSource> inputSource;
  6113. void setLastError (const String& desc, const bool carryOn);
  6114. void skipHeader();
  6115. void skipNextWhiteSpace();
  6116. juce_wchar readNextChar() throw();
  6117. XmlElement* readNextElement (const bool alsoParseSubElements);
  6118. void readChildElements (XmlElement* parent);
  6119. int findNextTokenLength() throw();
  6120. void readQuotedString (String& result);
  6121. void readEntity (String& result);
  6122. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6123. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6124. const String getFileContents (const String& filename) const;
  6125. const String expandEntity (const String& entity);
  6126. const String expandExternalEntity (const String& entity);
  6127. const String getParameterEntity (const String& entity);
  6128. XmlDocument (const XmlDocument&);
  6129. XmlDocument& operator= (const XmlDocument&);
  6130. };
  6131. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6132. /*** End of inlined file: juce_XmlDocument.h ***/
  6133. #endif
  6134. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6135. #endif
  6136. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6137. #endif
  6138. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6139. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6140. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6141. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6142. class JUCE_API InterProcessLock
  6143. {
  6144. public:
  6145. InterProcessLock (const String& name);
  6146. ~InterProcessLock();
  6147. bool enter (int timeOutMillisecs = -1);
  6148. void exit();
  6149. juce_UseDebuggingNewOperator
  6150. private:
  6151. #if JUCE_WINDOWS
  6152. void* internal;
  6153. // #elif JUCE_64BIT
  6154. // long long internal;
  6155. #else
  6156. int internal;
  6157. #endif
  6158. String name;
  6159. int reentrancyLevel;
  6160. InterProcessLock (const InterProcessLock&);
  6161. InterProcessLock& operator= (const InterProcessLock&);
  6162. };
  6163. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6164. /*** End of inlined file: juce_InterProcessLock.h ***/
  6165. #endif
  6166. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6167. /*** Start of inlined file: juce_Process.h ***/
  6168. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6169. #define __JUCE_PROCESS_JUCEHEADER__
  6170. class JUCE_API Process
  6171. {
  6172. public:
  6173. enum ProcessPriority
  6174. {
  6175. LowPriority = 0,
  6176. NormalPriority = 1,
  6177. HighPriority = 2,
  6178. RealtimePriority = 3
  6179. };
  6180. static void setPriority (const ProcessPriority priority);
  6181. static void terminate();
  6182. static bool isForegroundProcess();
  6183. static void raisePrivilege();
  6184. static void lowerPrivilege();
  6185. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6186. };
  6187. #endif // __JUCE_PROCESS_JUCEHEADER__
  6188. /*** End of inlined file: juce_Process.h ***/
  6189. #endif
  6190. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6191. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6192. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6193. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6194. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6195. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6196. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6197. class JUCE_API WaitableEvent
  6198. {
  6199. public:
  6200. WaitableEvent() throw();
  6201. ~WaitableEvent() throw();
  6202. bool wait (int timeOutMilliseconds = -1) const throw();
  6203. void signal() const throw();
  6204. void reset() const throw();
  6205. juce_UseDebuggingNewOperator
  6206. private:
  6207. void* internal;
  6208. WaitableEvent (const WaitableEvent&);
  6209. WaitableEvent& operator= (const WaitableEvent&);
  6210. };
  6211. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6212. /*** End of inlined file: juce_WaitableEvent.h ***/
  6213. /*** Start of inlined file: juce_Thread.h ***/
  6214. #ifndef __JUCE_THREAD_JUCEHEADER__
  6215. #define __JUCE_THREAD_JUCEHEADER__
  6216. class JUCE_API Thread
  6217. {
  6218. public:
  6219. Thread (const String& threadName);
  6220. virtual ~Thread();
  6221. virtual void run() = 0;
  6222. // Thread control functions..
  6223. void startThread();
  6224. void startThread (int priority);
  6225. void stopThread (int timeOutMilliseconds);
  6226. bool isThreadRunning() const;
  6227. void signalThreadShouldExit();
  6228. inline bool threadShouldExit() const { return threadShouldExit_; }
  6229. bool waitForThreadToExit (int timeOutMilliseconds) const;
  6230. bool setPriority (int priority);
  6231. static bool setCurrentThreadPriority (int priority);
  6232. void setAffinityMask (uint32 affinityMask);
  6233. static void setCurrentThreadAffinityMask (uint32 affinityMask);
  6234. // this can be called from any thread that needs to pause..
  6235. static void JUCE_CALLTYPE sleep (int milliseconds);
  6236. static void JUCE_CALLTYPE yield();
  6237. bool wait (int timeOutMilliseconds) const;
  6238. void notify() const;
  6239. typedef void* ThreadID;
  6240. static ThreadID getCurrentThreadId();
  6241. static Thread* getCurrentThread();
  6242. ThreadID getThreadId() const throw() { return threadId_; }
  6243. const String getThreadName() const { return threadName_; }
  6244. static int getNumRunningThreads();
  6245. static void stopAllThreads (int timeoutInMillisecs);
  6246. juce_UseDebuggingNewOperator
  6247. private:
  6248. const String threadName_;
  6249. void* volatile threadHandle_;
  6250. CriticalSection startStopLock;
  6251. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6252. int threadPriority_;
  6253. ThreadID threadId_;
  6254. uint32 affinityMask_;
  6255. bool volatile threadShouldExit_;
  6256. friend void JUCE_API juce_threadEntryPoint (void*);
  6257. static void threadEntryPoint (Thread* thread);
  6258. static Array<Thread*> runningThreads;
  6259. static CriticalSection runningThreadsLock;
  6260. Thread (const Thread&);
  6261. Thread& operator= (const Thread&);
  6262. };
  6263. #endif // __JUCE_THREAD_JUCEHEADER__
  6264. /*** End of inlined file: juce_Thread.h ***/
  6265. class JUCE_API ReadWriteLock
  6266. {
  6267. public:
  6268. ReadWriteLock() throw();
  6269. ~ReadWriteLock() throw();
  6270. void enterRead() const throw();
  6271. void exitRead() const throw();
  6272. void enterWrite() const throw();
  6273. bool tryEnterWrite() const throw();
  6274. void exitWrite() const throw();
  6275. juce_UseDebuggingNewOperator
  6276. private:
  6277. CriticalSection accessLock;
  6278. WaitableEvent waitEvent;
  6279. mutable int numWaitingWriters, numWriters;
  6280. mutable Thread::ThreadID writerThreadId;
  6281. mutable Array <Thread::ThreadID> readerThreads;
  6282. ReadWriteLock (const ReadWriteLock&);
  6283. ReadWriteLock& operator= (const ReadWriteLock&);
  6284. };
  6285. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6286. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6287. #endif
  6288. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6289. #endif
  6290. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6291. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6292. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6293. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6294. class JUCE_API ScopedReadLock
  6295. {
  6296. public:
  6297. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6298. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6299. private:
  6300. const ReadWriteLock& lock_;
  6301. ScopedReadLock (const ScopedReadLock&);
  6302. ScopedReadLock& operator= (const ScopedReadLock&);
  6303. };
  6304. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6305. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6306. #endif
  6307. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6308. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6309. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6310. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6311. class JUCE_API ScopedTryLock
  6312. {
  6313. public:
  6314. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6315. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6316. bool isLocked() const throw() { return lockWasSuccessful; }
  6317. private:
  6318. const CriticalSection& lock_;
  6319. const bool lockWasSuccessful;
  6320. ScopedTryLock (const ScopedTryLock&);
  6321. ScopedTryLock& operator= (const ScopedTryLock&);
  6322. };
  6323. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6324. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6325. #endif
  6326. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6327. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6328. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6329. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6330. class JUCE_API ScopedWriteLock
  6331. {
  6332. public:
  6333. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6334. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6335. private:
  6336. const ReadWriteLock& lock_;
  6337. ScopedWriteLock (const ScopedWriteLock&);
  6338. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6339. };
  6340. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6341. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6342. #endif
  6343. #ifndef __JUCE_THREAD_JUCEHEADER__
  6344. #endif
  6345. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6346. /*** Start of inlined file: juce_ThreadPool.h ***/
  6347. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6348. #define __JUCE_THREADPOOL_JUCEHEADER__
  6349. class ThreadPool;
  6350. class ThreadPoolThread;
  6351. class JUCE_API ThreadPoolJob
  6352. {
  6353. public:
  6354. ThreadPoolJob (const String& name);
  6355. virtual ~ThreadPoolJob();
  6356. const String getJobName() const;
  6357. void setJobName (const String& newName);
  6358. enum JobStatus
  6359. {
  6360. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6361. removed from the pool. */
  6362. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6363. should be automatically deleted by the pool. */
  6364. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6365. again when a thread is free. */
  6366. };
  6367. virtual JobStatus runJob() = 0;
  6368. bool isRunning() const { return isActive; }
  6369. bool shouldExit() const { return shouldStop; }
  6370. void signalJobShouldExit();
  6371. juce_UseDebuggingNewOperator
  6372. private:
  6373. friend class ThreadPool;
  6374. friend class ThreadPoolThread;
  6375. String jobName;
  6376. ThreadPool* pool;
  6377. bool shouldStop, isActive, shouldBeDeleted;
  6378. ThreadPoolJob (const ThreadPoolJob&);
  6379. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6380. };
  6381. class JUCE_API ThreadPool
  6382. {
  6383. public:
  6384. ThreadPool (int numberOfThreads,
  6385. bool startThreadsOnlyWhenNeeded = true,
  6386. int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6387. ~ThreadPool();
  6388. class JUCE_API JobSelector
  6389. {
  6390. public:
  6391. virtual ~JobSelector() {}
  6392. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6393. };
  6394. void addJob (ThreadPoolJob* job);
  6395. bool removeJob (ThreadPoolJob* job,
  6396. bool interruptIfRunning,
  6397. int timeOutMilliseconds);
  6398. bool removeAllJobs (bool interruptRunningJobs,
  6399. int timeOutMilliseconds,
  6400. bool deleteInactiveJobs = false,
  6401. JobSelector* selectedJobsToRemove = 0);
  6402. int getNumJobs() const;
  6403. ThreadPoolJob* getJob (int index) const;
  6404. bool contains (const ThreadPoolJob* job) const;
  6405. bool isJobRunning (const ThreadPoolJob* job) const;
  6406. bool waitForJobToFinish (const ThreadPoolJob* job,
  6407. int timeOutMilliseconds) const;
  6408. const StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const;
  6409. bool setThreadPriorities (int newPriority);
  6410. juce_UseDebuggingNewOperator
  6411. private:
  6412. const int threadStopTimeout;
  6413. int priority;
  6414. class ThreadPoolThread;
  6415. OwnedArray <ThreadPoolThread> threads;
  6416. Array <ThreadPoolJob*> jobs;
  6417. CriticalSection lock;
  6418. uint32 lastJobEndTime;
  6419. WaitableEvent jobFinishedSignal;
  6420. friend class ThreadPoolThread;
  6421. bool runNextJob();
  6422. ThreadPool (const ThreadPool&);
  6423. ThreadPool& operator= (const ThreadPool&);
  6424. };
  6425. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6426. /*** End of inlined file: juce_ThreadPool.h ***/
  6427. #endif
  6428. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6429. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6430. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6431. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6432. class JUCE_API TimeSliceClient
  6433. {
  6434. public:
  6435. virtual ~TimeSliceClient() {}
  6436. virtual bool useTimeSlice() = 0;
  6437. };
  6438. class JUCE_API TimeSliceThread : public Thread
  6439. {
  6440. public:
  6441. TimeSliceThread (const String& threadName);
  6442. ~TimeSliceThread();
  6443. void addTimeSliceClient (TimeSliceClient* client);
  6444. void removeTimeSliceClient (TimeSliceClient* client);
  6445. int getNumClients() const;
  6446. TimeSliceClient* getClient (int index) const;
  6447. void run();
  6448. juce_UseDebuggingNewOperator
  6449. private:
  6450. CriticalSection callbackLock, listLock;
  6451. Array <TimeSliceClient*> clients;
  6452. int index;
  6453. TimeSliceClient* clientBeingCalled;
  6454. bool clientsChanged;
  6455. TimeSliceThread (const TimeSliceThread&);
  6456. TimeSliceThread& operator= (const TimeSliceThread&);
  6457. };
  6458. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6459. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6460. #endif
  6461. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6462. #endif
  6463. #endif
  6464. /*** End of inlined file: juce_core_includes.h ***/
  6465. // if you're compiling a command-line app, you might want to just include the core headers,
  6466. // so you can set this macro before including juce.h
  6467. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6468. /*** Start of inlined file: juce_app_includes.h ***/
  6469. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6470. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6471. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6472. /*** Start of inlined file: juce_Application.h ***/
  6473. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6474. #define __JUCE_APPLICATION_JUCEHEADER__
  6475. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6476. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6477. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6478. /*** Start of inlined file: juce_Component.h ***/
  6479. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6480. #define __JUCE_COMPONENT_JUCEHEADER__
  6481. /*** Start of inlined file: juce_MouseCursor.h ***/
  6482. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6483. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6484. class Image;
  6485. class SharedMouseCursorInternal;
  6486. class ComponentPeer;
  6487. class Component;
  6488. class JUCE_API MouseCursor
  6489. {
  6490. public:
  6491. enum StandardCursorType
  6492. {
  6493. NoCursor = 0, /**< An invisible cursor. */
  6494. NormalCursor, /**< The stardard arrow cursor. */
  6495. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6496. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6497. CrosshairCursor, /**< A pair of crosshairs. */
  6498. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6499. that you're dragging a copy of something. */
  6500. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6501. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6502. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6503. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6504. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6505. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6506. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6507. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6508. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6509. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6510. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6511. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6512. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6513. };
  6514. MouseCursor() throw();
  6515. MouseCursor (StandardCursorType type) throw();
  6516. MouseCursor (const Image& image, int hotSpotX, int hotSpotY) throw();
  6517. MouseCursor (const MouseCursor& other) throw();
  6518. MouseCursor& operator= (const MouseCursor& other) throw();
  6519. ~MouseCursor() throw();
  6520. bool operator== (const MouseCursor& other) const throw();
  6521. bool operator!= (const MouseCursor& other) const throw();
  6522. static void showWaitCursor() throw();
  6523. static void hideWaitCursor() throw();
  6524. juce_UseDebuggingNewOperator
  6525. private:
  6526. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6527. friend class MouseInputSourceInternal;
  6528. void showInWindow (ComponentPeer* window) const throw();
  6529. void showInAllWindows() const throw();
  6530. void* getHandle() const throw();
  6531. };
  6532. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6533. /*** End of inlined file: juce_MouseCursor.h ***/
  6534. /*** Start of inlined file: juce_MouseListener.h ***/
  6535. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6536. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6537. class MouseEvent;
  6538. class JUCE_API MouseListener
  6539. {
  6540. public:
  6541. virtual ~MouseListener() {}
  6542. virtual void mouseMove (const MouseEvent& e);
  6543. virtual void mouseEnter (const MouseEvent& e);
  6544. virtual void mouseExit (const MouseEvent& e);
  6545. virtual void mouseDown (const MouseEvent& e);
  6546. virtual void mouseDrag (const MouseEvent& e);
  6547. virtual void mouseUp (const MouseEvent& e);
  6548. virtual void mouseDoubleClick (const MouseEvent& e);
  6549. virtual void mouseWheelMove (const MouseEvent& e,
  6550. float wheelIncrementX,
  6551. float wheelIncrementY);
  6552. };
  6553. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6554. /*** End of inlined file: juce_MouseListener.h ***/
  6555. /*** Start of inlined file: juce_MouseEvent.h ***/
  6556. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6557. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6558. class Component;
  6559. class MouseInputSource;
  6560. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6561. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6562. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6563. class JUCE_API ModifierKeys
  6564. {
  6565. public:
  6566. ModifierKeys (int flags = 0) throw();
  6567. ModifierKeys (const ModifierKeys& other) throw();
  6568. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6569. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6570. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6571. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6572. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6573. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6574. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6575. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6576. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6577. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6578. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6579. enum Flags
  6580. {
  6581. shiftModifier = 1,
  6582. ctrlModifier = 2,
  6583. altModifier = 4,
  6584. leftButtonModifier = 16,
  6585. rightButtonModifier = 32,
  6586. middleButtonModifier = 64,
  6587. #if JUCE_MAC
  6588. commandModifier = 8,
  6589. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6590. #else
  6591. commandModifier = ctrlModifier,
  6592. popupMenuClickModifier = rightButtonModifier,
  6593. #endif
  6594. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6595. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6596. };
  6597. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6598. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6599. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6600. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6601. inline int getRawFlags() const throw() { return flags; }
  6602. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6603. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6604. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6605. int getNumMouseButtonsDown() const throw();
  6606. static const ModifierKeys getCurrentModifiers() throw();
  6607. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6608. private:
  6609. int flags;
  6610. static ModifierKeys currentModifiers;
  6611. friend class ComponentPeer;
  6612. friend class MouseInputSource;
  6613. friend class MouseInputSourceInternal;
  6614. static void updateCurrentModifiers() throw();
  6615. };
  6616. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6617. /*** End of inlined file: juce_ModifierKeys.h ***/
  6618. /*** Start of inlined file: juce_Point.h ***/
  6619. #ifndef __JUCE_POINT_JUCEHEADER__
  6620. #define __JUCE_POINT_JUCEHEADER__
  6621. /*** Start of inlined file: juce_AffineTransform.h ***/
  6622. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6623. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6624. class JUCE_API AffineTransform
  6625. {
  6626. public:
  6627. AffineTransform() throw();
  6628. AffineTransform (const AffineTransform& other) throw();
  6629. AffineTransform (const float mat00, const float mat01, const float mat02,
  6630. const float mat10, const float mat11, const float mat12) throw();
  6631. AffineTransform& operator= (const AffineTransform& other) throw();
  6632. bool operator== (const AffineTransform& other) const throw();
  6633. bool operator!= (const AffineTransform& other) const throw();
  6634. static const AffineTransform identity;
  6635. void transformPoint (float& x,
  6636. float& y) const throw();
  6637. void transformPoint (double& x,
  6638. double& y) const throw();
  6639. const AffineTransform translated (const float deltaX,
  6640. const float deltaY) const throw();
  6641. static const AffineTransform translation (const float deltaX,
  6642. const float deltaY) throw();
  6643. const AffineTransform rotated (const float angleInRadians) const throw();
  6644. const AffineTransform rotated (const float angleInRadians,
  6645. const float pivotX,
  6646. const float pivotY) const throw();
  6647. static const AffineTransform rotation (const float angleInRadians) throw();
  6648. static const AffineTransform rotation (const float angleInRadians,
  6649. const float pivotX,
  6650. const float pivotY) throw();
  6651. const AffineTransform scaled (const float factorX,
  6652. const float factorY) const throw();
  6653. static const AffineTransform scale (const float factorX,
  6654. const float factorY) throw();
  6655. const AffineTransform sheared (const float shearX,
  6656. const float shearY) const throw();
  6657. const AffineTransform inverted() const throw();
  6658. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6659. bool isIdentity() const throw();
  6660. bool isSingularity() const throw();
  6661. bool isOnlyTranslation() const throw();
  6662. float getTranslationX() const throw() { return mat02; }
  6663. float getTranslationY() const throw() { return mat12; }
  6664. juce_UseDebuggingNewOperator
  6665. float mat00, mat01, mat02;
  6666. float mat10, mat11, mat12;
  6667. private:
  6668. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6669. const float mat10, const float mat11, const float mat12) const throw();
  6670. };
  6671. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6672. /*** End of inlined file: juce_AffineTransform.h ***/
  6673. template <typename ValueType>
  6674. class Point
  6675. {
  6676. public:
  6677. Point() throw() : x (0), y (0) {}
  6678. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6679. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6680. ~Point() throw() {}
  6681. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6682. inline ValueType getX() const throw() { return x; }
  6683. inline ValueType getY() const throw() { return y; }
  6684. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6685. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6686. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6687. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6688. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6689. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6690. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6691. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6692. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6693. const Point operator-() const throw() { return Point (-x, -y); }
  6694. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6695. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6696. const String toString() const { return String (x) + ", " + String (y); }
  6697. juce_UseDebuggingNewOperator
  6698. private:
  6699. ValueType x, y;
  6700. };
  6701. #endif // __JUCE_POINT_JUCEHEADER__
  6702. /*** End of inlined file: juce_Point.h ***/
  6703. class JUCE_API MouseEvent
  6704. {
  6705. public:
  6706. MouseEvent (MouseInputSource& source,
  6707. const Point<int>& position,
  6708. const ModifierKeys& modifiers,
  6709. Component* originator,
  6710. const Time& eventTime,
  6711. const Point<int> mouseDownPos,
  6712. const Time& mouseDownTime,
  6713. int numberOfClicks,
  6714. bool mouseWasDragged) throw();
  6715. ~MouseEvent() throw();
  6716. const int x;
  6717. const int y;
  6718. const ModifierKeys mods;
  6719. Component* const eventComponent;
  6720. Component* const originalComponent;
  6721. const Time eventTime;
  6722. MouseInputSource& source;
  6723. int getMouseDownX() const throw();
  6724. int getMouseDownY() const throw();
  6725. const Point<int> getMouseDownPosition() const throw();
  6726. int getDistanceFromDragStart() const throw();
  6727. int getDistanceFromDragStartX() const throw();
  6728. int getDistanceFromDragStartY() const throw();
  6729. const Point<int> getOffsetFromDragStart() const throw();
  6730. bool mouseWasClicked() const throw();
  6731. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6732. int getLengthOfMousePress() const throw();
  6733. const Point<int> getPosition() const throw();
  6734. int getScreenX() const;
  6735. int getScreenY() const;
  6736. const Point<int> getScreenPosition() const;
  6737. int getMouseDownScreenX() const;
  6738. int getMouseDownScreenY() const;
  6739. const Point<int> getMouseDownScreenPosition() const;
  6740. const MouseEvent getEventRelativeTo (Component* otherComponent) const throw();
  6741. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6742. static void setDoubleClickTimeout (int timeOutMilliseconds) throw();
  6743. static int getDoubleClickTimeout() throw();
  6744. juce_UseDebuggingNewOperator
  6745. private:
  6746. const Point<int> mouseDownPos;
  6747. const Time mouseDownTime;
  6748. const int numberOfClicks;
  6749. const bool wasMovedSinceMouseDown;
  6750. MouseEvent& operator= (const MouseEvent&);
  6751. };
  6752. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6753. /*** End of inlined file: juce_MouseEvent.h ***/
  6754. /*** Start of inlined file: juce_ComponentListener.h ***/
  6755. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6756. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6757. class Component;
  6758. class JUCE_API ComponentListener
  6759. {
  6760. public:
  6761. virtual ~ComponentListener() {}
  6762. virtual void componentMovedOrResized (Component& component,
  6763. bool wasMoved,
  6764. bool wasResized);
  6765. virtual void componentBroughtToFront (Component& component);
  6766. virtual void componentVisibilityChanged (Component& component);
  6767. virtual void componentChildrenChanged (Component& component);
  6768. virtual void componentParentHierarchyChanged (Component& component);
  6769. virtual void componentNameChanged (Component& component);
  6770. virtual void componentBeingDeleted (Component& component);
  6771. };
  6772. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6773. /*** End of inlined file: juce_ComponentListener.h ***/
  6774. /*** Start of inlined file: juce_KeyListener.h ***/
  6775. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6776. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6777. /*** Start of inlined file: juce_KeyPress.h ***/
  6778. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6779. #define __JUCE_KEYPRESS_JUCEHEADER__
  6780. class JUCE_API KeyPress
  6781. {
  6782. public:
  6783. KeyPress() throw();
  6784. KeyPress (int keyCode,
  6785. const ModifierKeys& modifiers,
  6786. juce_wchar textCharacter) throw();
  6787. KeyPress (int keyCode) throw();
  6788. KeyPress (const KeyPress& other) throw();
  6789. KeyPress& operator= (const KeyPress& other) throw();
  6790. bool operator== (const KeyPress& other) const throw();
  6791. bool operator!= (const KeyPress& other) const throw();
  6792. bool isValid() const throw() { return keyCode != 0; }
  6793. int getKeyCode() const throw() { return keyCode; }
  6794. const ModifierKeys getModifiers() const throw() { return mods; }
  6795. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6796. bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6797. static const KeyPress createFromDescription (const String& textVersion) throw();
  6798. const String getTextDescription() const throw();
  6799. bool isCurrentlyDown() const throw();
  6800. static bool isKeyCurrentlyDown (int keyCode) throw();
  6801. // Key codes
  6802. //
  6803. // Note that the actual values of these are platform-specific and may change
  6804. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6805. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6806. //
  6807. static const int spaceKey; /**< key-code for the space bar */
  6808. static const int escapeKey; /**< key-code for the escape key */
  6809. static const int returnKey; /**< key-code for the return key*/
  6810. static const int tabKey; /**< key-code for the tab key*/
  6811. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6812. static const int backspaceKey; /**< key-code for the backspace key */
  6813. static const int insertKey; /**< key-code for the insert key */
  6814. static const int upKey; /**< key-code for the cursor-up key */
  6815. static const int downKey; /**< key-code for the cursor-down key */
  6816. static const int leftKey; /**< key-code for the cursor-left key */
  6817. static const int rightKey; /**< key-code for the cursor-right key */
  6818. static const int pageUpKey; /**< key-code for the page-up key */
  6819. static const int pageDownKey; /**< key-code for the page-down key */
  6820. static const int homeKey; /**< key-code for the home key */
  6821. static const int endKey; /**< key-code for the end key */
  6822. static const int F1Key; /**< key-code for the F1 key */
  6823. static const int F2Key; /**< key-code for the F2 key */
  6824. static const int F3Key; /**< key-code for the F3 key */
  6825. static const int F4Key; /**< key-code for the F4 key */
  6826. static const int F5Key; /**< key-code for the F5 key */
  6827. static const int F6Key; /**< key-code for the F6 key */
  6828. static const int F7Key; /**< key-code for the F7 key */
  6829. static const int F8Key; /**< key-code for the F8 key */
  6830. static const int F9Key; /**< key-code for the F9 key */
  6831. static const int F10Key; /**< key-code for the F10 key */
  6832. static const int F11Key; /**< key-code for the F11 key */
  6833. static const int F12Key; /**< key-code for the F12 key */
  6834. static const int F13Key; /**< key-code for the F13 key */
  6835. static const int F14Key; /**< key-code for the F14 key */
  6836. static const int F15Key; /**< key-code for the F15 key */
  6837. static const int F16Key; /**< key-code for the F16 key */
  6838. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6839. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6840. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6841. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6842. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6843. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6844. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6845. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6846. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6847. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6848. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6849. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6850. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6851. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6852. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6853. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6854. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6855. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6856. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6857. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6858. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6859. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6860. juce_UseDebuggingNewOperator
  6861. private:
  6862. int keyCode;
  6863. ModifierKeys mods;
  6864. juce_wchar textCharacter;
  6865. };
  6866. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6867. /*** End of inlined file: juce_KeyPress.h ***/
  6868. class Component;
  6869. class JUCE_API KeyListener
  6870. {
  6871. public:
  6872. virtual ~KeyListener() {}
  6873. virtual bool keyPressed (const KeyPress& key,
  6874. Component* originatingComponent) = 0;
  6875. virtual bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  6876. };
  6877. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6878. /*** End of inlined file: juce_KeyListener.h ***/
  6879. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6880. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6881. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6882. class Component;
  6883. class JUCE_API KeyboardFocusTraverser
  6884. {
  6885. public:
  6886. KeyboardFocusTraverser();
  6887. virtual ~KeyboardFocusTraverser();
  6888. virtual Component* getNextComponent (Component* current);
  6889. virtual Component* getPreviousComponent (Component* current);
  6890. virtual Component* getDefaultComponent (Component* parentComponent);
  6891. };
  6892. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6893. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6894. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6895. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6896. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6897. /*** Start of inlined file: juce_Graphics.h ***/
  6898. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6899. #define __JUCE_GRAPHICS_JUCEHEADER__
  6900. /*** Start of inlined file: juce_Font.h ***/
  6901. #ifndef __JUCE_FONT_JUCEHEADER__
  6902. #define __JUCE_FONT_JUCEHEADER__
  6903. /*** Start of inlined file: juce_Typeface.h ***/
  6904. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6905. #define __JUCE_TYPEFACE_JUCEHEADER__
  6906. /*** Start of inlined file: juce_Path.h ***/
  6907. #ifndef __JUCE_PATH_JUCEHEADER__
  6908. #define __JUCE_PATH_JUCEHEADER__
  6909. /*** Start of inlined file: juce_Rectangle.h ***/
  6910. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6911. #define __JUCE_RECTANGLE_JUCEHEADER__
  6912. class RectangleList;
  6913. template <typename ValueType>
  6914. class Rectangle
  6915. {
  6916. public:
  6917. Rectangle() throw()
  6918. : x (0), y (0), w (0), h (0)
  6919. {
  6920. }
  6921. Rectangle (const Rectangle& other) throw()
  6922. : x (other.x), y (other.y),
  6923. w (other.w), h (other.h)
  6924. {
  6925. }
  6926. Rectangle (const ValueType initialX, const ValueType initialY,
  6927. const ValueType width, const ValueType height) throw()
  6928. : x (initialX), y (initialY),
  6929. w (width), h (height)
  6930. {
  6931. }
  6932. Rectangle (const ValueType width, const ValueType height) throw()
  6933. : x (0), y (0), w (width), h (height)
  6934. {
  6935. }
  6936. Rectangle& operator= (const Rectangle& other) throw()
  6937. {
  6938. x = other.x; y = other.y;
  6939. w = other.w; h = other.h;
  6940. return *this;
  6941. }
  6942. ~Rectangle() throw() {}
  6943. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6944. inline ValueType getX() const throw() { return x; }
  6945. inline ValueType getY() const throw() { return y; }
  6946. inline ValueType getWidth() const throw() { return w; }
  6947. inline ValueType getHeight() const throw() { return h; }
  6948. inline ValueType getRight() const throw() { return x + w; }
  6949. inline ValueType getBottom() const throw() { return y + h; }
  6950. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6951. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6952. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6953. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  6954. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6955. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6956. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6957. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  6958. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6959. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  6960. void setBounds (const ValueType newX, const ValueType newY,
  6961. const ValueType newWidth, const ValueType newHeight) throw()
  6962. {
  6963. x = newX; y = newY; w = newWidth; h = newHeight;
  6964. }
  6965. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6966. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6967. void setLeft (const ValueType newLeft) throw()
  6968. {
  6969. w = jmax (ValueType(), x + w - newLeft);
  6970. x = newLeft;
  6971. }
  6972. void setTop (const ValueType newTop) throw()
  6973. {
  6974. h = jmax (ValueType(), y + h - newTop);
  6975. y = newTop;
  6976. }
  6977. void setRight (const ValueType newRight) throw()
  6978. {
  6979. x = jmin (x, newRight);
  6980. w = newRight - x;
  6981. }
  6982. void setBottom (const ValueType newBottom) throw()
  6983. {
  6984. y = jmin (y, newBottom);
  6985. h = newBottom - y;
  6986. }
  6987. void translate (const ValueType deltaX,
  6988. const ValueType deltaY) throw()
  6989. {
  6990. x += deltaX;
  6991. y += deltaY;
  6992. }
  6993. const Rectangle translated (const ValueType deltaX,
  6994. const ValueType deltaY) const throw()
  6995. {
  6996. return Rectangle (x + deltaX, y + deltaY, w, h);
  6997. }
  6998. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  6999. {
  7000. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  7001. }
  7002. void expand (const ValueType deltaX,
  7003. const ValueType deltaY) throw()
  7004. {
  7005. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7006. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7007. setBounds (x - deltaX, y - deltaY, nw, nh);
  7008. }
  7009. const Rectangle expanded (const ValueType deltaX,
  7010. const ValueType deltaY) const throw()
  7011. {
  7012. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7013. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7014. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7015. }
  7016. void reduce (const ValueType deltaX,
  7017. const ValueType deltaY) throw()
  7018. {
  7019. expand (-deltaX, -deltaY);
  7020. }
  7021. const Rectangle reduced (const ValueType deltaX,
  7022. const ValueType deltaY) const throw()
  7023. {
  7024. return expanded (-deltaX, -deltaY);
  7025. }
  7026. bool operator== (const Rectangle& other) const throw()
  7027. {
  7028. return x == other.x && y == other.y
  7029. && w == other.w && h == other.h;
  7030. }
  7031. bool operator!= (const Rectangle& other) const throw()
  7032. {
  7033. return x != other.x || y != other.y
  7034. || w != other.w || h != other.h;
  7035. }
  7036. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7037. {
  7038. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7039. }
  7040. bool contains (const Point<ValueType>& point) const throw()
  7041. {
  7042. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7043. }
  7044. bool contains (const Rectangle& other) const throw()
  7045. {
  7046. return x <= other.x && y <= other.y
  7047. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7048. }
  7049. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7050. {
  7051. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7052. jlimit (y, y + h, point.getY()));
  7053. }
  7054. bool intersects (const Rectangle& other) const throw()
  7055. {
  7056. return x + w > other.x
  7057. && y + h > other.y
  7058. && x < other.x + other.w
  7059. && y < other.y + other.h
  7060. && w > ValueType() && h > ValueType();
  7061. }
  7062. const Rectangle getIntersection (const Rectangle& other) const throw()
  7063. {
  7064. const ValueType nx = jmax (x, other.x);
  7065. const ValueType ny = jmax (y, other.y);
  7066. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7067. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7068. if (nw >= ValueType() && nh >= ValueType())
  7069. return Rectangle (nx, ny, nw, nh);
  7070. return Rectangle();
  7071. }
  7072. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7073. {
  7074. const int maxX = jmax (otherX, x);
  7075. otherW = jmin (otherX + otherW, x + w) - maxX;
  7076. if (otherW > 0)
  7077. {
  7078. const int maxY = jmax (otherY, y);
  7079. otherH = jmin (otherY + otherH, y + h) - maxY;
  7080. if (otherH > 0)
  7081. {
  7082. otherX = maxX; otherY = maxY;
  7083. return true;
  7084. }
  7085. }
  7086. return false;
  7087. }
  7088. const Rectangle getUnion (const Rectangle& other) const throw()
  7089. {
  7090. const ValueType newX = jmin (x, other.x);
  7091. const ValueType newY = jmin (y, other.y);
  7092. return Rectangle (newX, newY,
  7093. jmax (x + w, other.x + other.w) - newX,
  7094. jmax (y + h, other.y + other.h) - newY);
  7095. }
  7096. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7097. {
  7098. if (x == other.x && getRight() == other.getRight()
  7099. && (other.getBottom() >= y && other.y <= getBottom()))
  7100. {
  7101. const ValueType newY = jmin (y, other.y);
  7102. h = jmax (getBottom(), other.getBottom()) - newY;
  7103. y = newY;
  7104. return true;
  7105. }
  7106. else if (y == other.y && getBottom() == other.getBottom()
  7107. && (other.getRight() >= x && other.x <= getRight()))
  7108. {
  7109. const ValueType newX = jmin (x, other.x);
  7110. w = jmax (getRight(), other.getRight()) - newX;
  7111. x = newX;
  7112. return true;
  7113. }
  7114. return false;
  7115. }
  7116. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7117. {
  7118. int inside = 0;
  7119. const int otherR = other.getRight();
  7120. if (x >= other.x && x < otherR) inside = 1;
  7121. const int otherB = other.getBottom();
  7122. if (y >= other.y && y < otherB) inside |= 2;
  7123. const int r = x + w;
  7124. if (r >= other.x && r < otherR) inside |= 4;
  7125. const int b = y + h;
  7126. if (b >= other.y && b < otherB) inside |= 8;
  7127. switch (inside)
  7128. {
  7129. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7130. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7131. case 2 + 4 + 8: w = other.x - x; return true;
  7132. case 1 + 4 + 8: h = other.y - y; return true;
  7133. }
  7134. return false;
  7135. }
  7136. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7137. {
  7138. float x1 = x, y1 = y;
  7139. float x2 = x + w, y2 = y;
  7140. float x3 = x, y3 = y + h;
  7141. float x4 = x2, y4 = y3;
  7142. transform.transformPoint (x1, y1);
  7143. transform.transformPoint (x2, y2);
  7144. transform.transformPoint (x3, y3);
  7145. transform.transformPoint (x4, y4);
  7146. const float x = jmin (x1, x2, x3, x4);
  7147. const float y = jmin (y1, y2, y3, y4);
  7148. return Rectangle (x, y,
  7149. jmax (x1, x2, x3, x4) - x,
  7150. jmax (y1, y2, y3, y4) - y);
  7151. }
  7152. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7153. {
  7154. const int x1 = (int) floorf ((float) x);
  7155. const int y1 = (int) floorf ((float) y);
  7156. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7157. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7158. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7159. }
  7160. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7161. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7162. {
  7163. const ValueType x = jmax (x1, x2);
  7164. w1 = jmin (x1 + w1, x2 + w2) - x;
  7165. if (w1 > 0)
  7166. {
  7167. const ValueType y = jmax (y1, y2);
  7168. h1 = jmin (y1 + h1, y2 + h2) - y;
  7169. if (h1 > 0)
  7170. {
  7171. x1 = x; y1 = y;
  7172. return true;
  7173. }
  7174. }
  7175. return false;
  7176. }
  7177. const String toString() const
  7178. {
  7179. String s;
  7180. s.preallocateStorage (16);
  7181. s << x << ' ' << y << ' ' << w << ' ' << h;
  7182. return s;
  7183. }
  7184. static const Rectangle fromString (const String& stringVersion)
  7185. {
  7186. StringArray toks;
  7187. toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
  7188. return Rectangle (toks[0].trim().getIntValue(),
  7189. toks[1].trim().getIntValue(),
  7190. toks[2].trim().getIntValue(),
  7191. toks[3].trim().getIntValue());
  7192. }
  7193. juce_UseDebuggingNewOperator
  7194. private:
  7195. friend class RectangleList;
  7196. ValueType x, y, w, h;
  7197. };
  7198. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7199. /*** End of inlined file: juce_Rectangle.h ***/
  7200. /*** Start of inlined file: juce_Justification.h ***/
  7201. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7202. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7203. class JUCE_API Justification
  7204. {
  7205. public:
  7206. inline Justification (int flags_) throw() : flags (flags_) {}
  7207. Justification (const Justification& other) throw();
  7208. Justification& operator= (const Justification& other) throw();
  7209. inline int getFlags() const throw() { return flags; }
  7210. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7211. int getOnlyVerticalFlags() const throw();
  7212. int getOnlyHorizontalFlags() const throw();
  7213. void applyToRectangle (int& x, int& y, int w, int h,
  7214. int spaceX, int spaceY, int spaceW, int spaceH) const throw();
  7215. enum
  7216. {
  7217. left = 1,
  7218. right = 2,
  7219. horizontallyCentred = 4,
  7220. top = 8,
  7221. bottom = 16,
  7222. verticallyCentred = 32,
  7223. horizontallyJustified = 64,
  7224. centred = 36,
  7225. centredLeft = 33,
  7226. centredRight = 34,
  7227. centredTop = 12,
  7228. centredBottom = 20,
  7229. topLeft = 9,
  7230. topRight = 10,
  7231. bottomLeft = 17,
  7232. bottomRight = 18
  7233. };
  7234. private:
  7235. int flags;
  7236. };
  7237. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7238. /*** End of inlined file: juce_Justification.h ***/
  7239. /*** Start of inlined file: juce_EdgeTable.h ***/
  7240. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7241. #define __JUCE_EDGETABLE_JUCEHEADER__
  7242. class Path;
  7243. class RectangleList;
  7244. class Image;
  7245. class JUCE_API EdgeTable
  7246. {
  7247. public:
  7248. EdgeTable (const Rectangle<int>& clipLimits,
  7249. const Path& pathToAdd,
  7250. const AffineTransform& transform);
  7251. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7252. EdgeTable (const RectangleList& rectanglesToAdd);
  7253. EdgeTable (float x, float y, float w, float h);
  7254. EdgeTable (const EdgeTable& other);
  7255. EdgeTable& operator= (const EdgeTable& other);
  7256. ~EdgeTable();
  7257. void clipToRectangle (const Rectangle<int>& r) throw();
  7258. void excludeRectangle (const Rectangle<int>& r) throw();
  7259. void clipToEdgeTable (const EdgeTable& other);
  7260. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7261. bool isEmpty() throw();
  7262. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7263. void translate (float dx, int dy) throw();
  7264. void optimiseTable() throw();
  7265. template <class EdgeTableIterationCallback>
  7266. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7267. {
  7268. const int* lineStart = table;
  7269. for (int y = 0; y < bounds.getHeight(); ++y)
  7270. {
  7271. const int* line = lineStart;
  7272. lineStart += lineStrideElements;
  7273. int numPoints = line[0];
  7274. if (--numPoints > 0)
  7275. {
  7276. int x = *++line;
  7277. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7278. int levelAccumulator = 0;
  7279. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7280. while (--numPoints >= 0)
  7281. {
  7282. const int level = *++line;
  7283. jassert (((unsigned int) level) < (unsigned int) 256);
  7284. const int endX = *++line;
  7285. jassert (endX >= x);
  7286. const int endOfRun = (endX >> 8);
  7287. if (endOfRun == (x >> 8))
  7288. {
  7289. // small segment within the same pixel, so just save it for the next
  7290. // time round..
  7291. levelAccumulator += (endX - x) * level;
  7292. }
  7293. else
  7294. {
  7295. // plot the fist pixel of this segment, including any accumulated
  7296. // levels from smaller segments that haven't been drawn yet
  7297. levelAccumulator += (0xff - (x & 0xff)) * level;
  7298. levelAccumulator >>= 8;
  7299. x >>= 8;
  7300. if (levelAccumulator > 0)
  7301. {
  7302. if (levelAccumulator >> 8)
  7303. levelAccumulator = 0xff;
  7304. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7305. }
  7306. // if there's a run of similar pixels, do it all in one go..
  7307. if (level > 0)
  7308. {
  7309. jassert (endOfRun <= bounds.getRight());
  7310. const int numPix = endOfRun - ++x;
  7311. if (numPix > 0)
  7312. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7313. }
  7314. // save the bit at the end to be drawn next time round the loop.
  7315. levelAccumulator = (endX & 0xff) * level;
  7316. }
  7317. x = endX;
  7318. }
  7319. if (levelAccumulator > 0)
  7320. {
  7321. levelAccumulator >>= 8;
  7322. if (levelAccumulator >> 8)
  7323. levelAccumulator = 0xff;
  7324. x >>= 8;
  7325. jassert (x >= bounds.getX() && x < bounds.getRight());
  7326. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7327. }
  7328. }
  7329. }
  7330. }
  7331. juce_UseDebuggingNewOperator
  7332. private:
  7333. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7334. HeapBlock<int> table;
  7335. Rectangle<int> bounds;
  7336. int maxEdgesPerLine, lineStrideElements;
  7337. bool needToCheckEmptinesss;
  7338. void addEdgePoint (int x, int y, int winding) throw();
  7339. void remapTableForNumEdges (int newNumEdgesPerLine) throw();
  7340. void intersectWithEdgeTableLine (int y, const int* otherLine) throw();
  7341. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7342. void sanitiseLevels (bool useNonZeroWinding) throw();
  7343. static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw();
  7344. };
  7345. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7346. /*** End of inlined file: juce_EdgeTable.h ***/
  7347. class Image;
  7348. class JUCE_API Path
  7349. {
  7350. public:
  7351. Path();
  7352. Path (const Path& other);
  7353. ~Path();
  7354. Path& operator= (const Path& other);
  7355. bool isEmpty() const throw();
  7356. const Rectangle<float> getBounds() const throw();
  7357. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7358. bool contains (float x, float y,
  7359. float tolerence = 10.0f) const;
  7360. bool intersectsLine (float x1, float y1,
  7361. float x2, float y2,
  7362. float tolerence = 10.0f);
  7363. void clear() throw();
  7364. void startNewSubPath (float startX, float startY);
  7365. void closeSubPath();
  7366. void lineTo (float endX, float endY);
  7367. void quadraticTo (float controlPointX,
  7368. float controlPointY,
  7369. float endPointX,
  7370. float endPointY);
  7371. void cubicTo (float controlPoint1X,
  7372. float controlPoint1Y,
  7373. float controlPoint2X,
  7374. float controlPoint2Y,
  7375. float endPointX,
  7376. float endPointY);
  7377. const Point<float> getCurrentPosition() const;
  7378. void addRectangle (float x, float y, float width, float height);
  7379. void addRectangle (const Rectangle<int>& rectangle);
  7380. void addRoundedRectangle (float x, float y, float width, float height,
  7381. float cornerSize);
  7382. void addRoundedRectangle (float x, float y, float width, float height,
  7383. float cornerSizeX,
  7384. float cornerSizeY);
  7385. void addTriangle (float x1, float y1,
  7386. float x2, float y2,
  7387. float x3, float y3);
  7388. void addQuadrilateral (float x1, float y1,
  7389. float x2, float y2,
  7390. float x3, float y3,
  7391. float x4, float y4);
  7392. void addEllipse (float x, float y, float width, float height);
  7393. void addArc (float x, float y, float width, float height,
  7394. float fromRadians,
  7395. float toRadians,
  7396. bool startAsNewSubPath = false);
  7397. void addCentredArc (float centreX, float centreY,
  7398. float radiusX, float radiusY,
  7399. float rotationOfEllipse,
  7400. float fromRadians,
  7401. float toRadians,
  7402. bool startAsNewSubPath = false);
  7403. void addPieSegment (float x, float y,
  7404. float width, float height,
  7405. float fromRadians,
  7406. float toRadians,
  7407. float innerCircleProportionalSize);
  7408. void addLineSegment (float startX, float startY,
  7409. float endX, float endY,
  7410. float lineThickness);
  7411. void addArrow (float startX, float startY,
  7412. float endX, float endY,
  7413. float lineThickness,
  7414. float arrowheadWidth,
  7415. float arrowheadLength);
  7416. void addStar (float centreX,
  7417. float centreY,
  7418. int numberOfPoints,
  7419. float innerRadius,
  7420. float outerRadius,
  7421. float startAngle = 0.0f);
  7422. void addBubble (float bodyX, float bodyY,
  7423. float bodyW, float bodyH,
  7424. float cornerSize,
  7425. float arrowTipX,
  7426. float arrowTipY,
  7427. int whichSide,
  7428. float arrowPositionAlongEdgeProportional,
  7429. float arrowWidth);
  7430. void addPath (const Path& pathToAppend);
  7431. void addPath (const Path& pathToAppend,
  7432. const AffineTransform& transformToApply);
  7433. void swapWithPath (Path& other);
  7434. void applyTransform (const AffineTransform& transform) throw();
  7435. void scaleToFit (float x, float y, float width, float height,
  7436. bool preserveProportions) throw();
  7437. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7438. bool preserveProportions,
  7439. const Justification& justificationType = Justification::centred) const;
  7440. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7441. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7442. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7443. class JUCE_API Iterator
  7444. {
  7445. public:
  7446. Iterator (const Path& path);
  7447. ~Iterator();
  7448. bool next();
  7449. enum PathElementType
  7450. {
  7451. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7452. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7453. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7454. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7455. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7456. };
  7457. PathElementType elementType;
  7458. float x1, y1, x2, y2, x3, y3;
  7459. private:
  7460. const Path& path;
  7461. size_t index;
  7462. Iterator (const Iterator&);
  7463. Iterator& operator= (const Iterator&);
  7464. };
  7465. void loadPathFromStream (InputStream& source);
  7466. void loadPathFromData (const void* data, int numberOfBytes);
  7467. void writePathToStream (OutputStream& destination) const;
  7468. const String toString() const;
  7469. void restoreFromString (const String& stringVersion);
  7470. juce_UseDebuggingNewOperator
  7471. private:
  7472. friend class PathFlatteningIterator;
  7473. friend class Path::Iterator;
  7474. ArrayAllocationBase <float, DummyCriticalSection> data;
  7475. size_t numElements;
  7476. float pathXMin, pathXMax, pathYMin, pathYMax;
  7477. bool useNonZeroWinding;
  7478. static const float lineMarker;
  7479. static const float moveMarker;
  7480. static const float quadMarker;
  7481. static const float cubicMarker;
  7482. static const float closeSubPathMarker;
  7483. };
  7484. #endif // __JUCE_PATH_JUCEHEADER__
  7485. /*** End of inlined file: juce_Path.h ***/
  7486. class Font;
  7487. class JUCE_API Typeface : public ReferenceCountedObject
  7488. {
  7489. public:
  7490. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7491. const String getName() const throw() { return name; }
  7492. static const Ptr createSystemTypefaceFor (const Font& font);
  7493. virtual ~Typeface();
  7494. virtual float getAscent() const = 0;
  7495. virtual float getDescent() const = 0;
  7496. virtual float getStringWidth (const String& text) = 0;
  7497. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7498. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7499. juce_UseDebuggingNewOperator
  7500. protected:
  7501. String name;
  7502. Typeface (const String& name) throw();
  7503. private:
  7504. Typeface (const Typeface&);
  7505. Typeface& operator= (const Typeface&);
  7506. };
  7507. class JUCE_API CustomTypeface : public Typeface
  7508. {
  7509. public:
  7510. CustomTypeface();
  7511. CustomTypeface (InputStream& serialisedTypefaceStream);
  7512. ~CustomTypeface();
  7513. void clear();
  7514. void setCharacteristics (const String& name, float ascent,
  7515. bool isBold, bool isItalic,
  7516. juce_wchar defaultCharacter) throw();
  7517. void addGlyph (juce_wchar character, const Path& path, float width) throw();
  7518. void addKerningPair (juce_wchar char1, juce_wchar char2, float extraAmount) throw();
  7519. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7520. bool writeToStream (OutputStream& outputStream);
  7521. // The following methods implement the basic Typeface behaviour.
  7522. float getAscent() const;
  7523. float getDescent() const;
  7524. float getStringWidth (const String& text);
  7525. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7526. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7527. int getGlyphForCharacter (juce_wchar character);
  7528. juce_UseDebuggingNewOperator
  7529. protected:
  7530. juce_wchar defaultCharacter;
  7531. float ascent;
  7532. bool isBold, isItalic;
  7533. virtual bool loadGlyphIfPossible (juce_wchar characterNeeded);
  7534. private:
  7535. class GlyphInfo;
  7536. friend class OwnedArray<GlyphInfo>;
  7537. OwnedArray <GlyphInfo> glyphs;
  7538. short lookupTable [128];
  7539. CustomTypeface (const CustomTypeface&);
  7540. CustomTypeface& operator= (const CustomTypeface&);
  7541. GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) throw();
  7542. GlyphInfo* findGlyphSubstituting (juce_wchar character) throw();
  7543. };
  7544. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7545. /*** End of inlined file: juce_Typeface.h ***/
  7546. class LowLevelGraphicsContext;
  7547. class JUCE_API Font
  7548. {
  7549. public:
  7550. enum FontStyleFlags
  7551. {
  7552. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7553. bold = 1, /**< boldens the font. @see setStyleFlags */
  7554. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7555. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7556. };
  7557. Font (float fontHeight,
  7558. int styleFlags = plain) throw();
  7559. Font (const String& typefaceName,
  7560. float fontHeight,
  7561. int styleFlags) throw();
  7562. Font (const Font& other) throw();
  7563. Font (const Typeface::Ptr& typeface) throw();
  7564. Font() throw();
  7565. Font& operator= (const Font& other) throw();
  7566. bool operator== (const Font& other) const throw();
  7567. bool operator!= (const Font& other) const throw();
  7568. ~Font() throw();
  7569. void setTypefaceName (const String& faceName) throw();
  7570. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7571. static const String getDefaultSansSerifFontName() throw();
  7572. static const String getDefaultSerifFontName() throw();
  7573. static const String getDefaultMonospacedFontName() throw();
  7574. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
  7575. float getHeight() const throw() { return font->height; }
  7576. void setHeight (float newHeight) throw();
  7577. void setHeightWithoutChangingWidth (float newHeight) throw();
  7578. float getAscent() const throw();
  7579. float getDescent() const throw();
  7580. int getStyleFlags() const throw() { return font->styleFlags; }
  7581. void setStyleFlags (const int newFlags) throw();
  7582. void setBold (bool shouldBeBold) throw();
  7583. bool isBold() const throw();
  7584. void setItalic (bool shouldBeItalic) throw();
  7585. bool isItalic() const throw();
  7586. void setUnderline (bool shouldBeUnderlined) throw();
  7587. bool isUnderlined() const throw();
  7588. void setHorizontalScale (float scaleFactor) throw();
  7589. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7590. void setExtraKerningFactor (float extraKerning) throw();
  7591. float getExtraKerningFactor() const throw() { return font->kerning; }
  7592. void setSizeAndStyle (float newHeight,
  7593. int newStyleFlags,
  7594. float newHorizontalScale,
  7595. float newKerningAmount) throw();
  7596. int getStringWidth (const String& text) const throw();
  7597. float getStringWidthFloat (const String& text) const throw();
  7598. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7599. Typeface* getTypeface() const throw();
  7600. static void findFonts (Array<Font>& results) throw();
  7601. static const StringArray findAllTypefaceNames();
  7602. static const String getFallbackFontName() throw();
  7603. static void setFallbackFontName (const String& name) throw();
  7604. juce_UseDebuggingNewOperator
  7605. private:
  7606. friend class FontGlyphAlphaMap;
  7607. friend class TypefaceCache;
  7608. class SharedFontInternal : public ReferenceCountedObject
  7609. {
  7610. public:
  7611. SharedFontInternal (const String& typefaceName, float height, float horizontalScale,
  7612. float kerning, float ascent, int styleFlags,
  7613. Typeface* typeface) throw();
  7614. SharedFontInternal (const SharedFontInternal& other) throw();
  7615. String typefaceName;
  7616. float height, horizontalScale, kerning, ascent;
  7617. int styleFlags;
  7618. Typeface::Ptr typeface;
  7619. };
  7620. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7621. void dupeInternalIfShared() throw();
  7622. };
  7623. #endif // __JUCE_FONT_JUCEHEADER__
  7624. /*** End of inlined file: juce_Font.h ***/
  7625. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7626. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7627. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7628. class JUCE_API PathStrokeType
  7629. {
  7630. public:
  7631. enum JointStyle
  7632. {
  7633. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7634. Note that for angles that curve back on themselves, drawing a
  7635. mitre could require extending the point too far away from the
  7636. path, so a mitre limit is imposed and any corners that exceed it
  7637. are drawn as bevelled instead. */
  7638. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7639. beveled /**< Indicates that corners should be drawn with a line flattening their
  7640. outside edge. */
  7641. };
  7642. enum EndCapStyle
  7643. {
  7644. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7645. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7646. the thickness of the stroke. */
  7647. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7648. };
  7649. PathStrokeType (float strokeThickness,
  7650. JointStyle jointStyle = mitered,
  7651. EndCapStyle endStyle = butt) throw();
  7652. PathStrokeType (const PathStrokeType& other) throw();
  7653. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7654. ~PathStrokeType() throw();
  7655. void createStrokedPath (Path& destPath,
  7656. const Path& sourcePath,
  7657. const AffineTransform& transform = AffineTransform::identity,
  7658. float extraAccuracy = 1.0f) const;
  7659. void createDashedStroke (Path& destPath,
  7660. const Path& sourcePath,
  7661. const float* dashLengths,
  7662. int numDashLengths,
  7663. const AffineTransform& transform = AffineTransform::identity,
  7664. float extraAccuracy = 1.0f) const;
  7665. float getStrokeThickness() const throw() { return thickness; }
  7666. JointStyle getJointStyle() const throw() { return jointStyle; }
  7667. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7668. juce_UseDebuggingNewOperator
  7669. bool operator== (const PathStrokeType& other) const throw();
  7670. bool operator!= (const PathStrokeType& other) const throw();
  7671. private:
  7672. float thickness;
  7673. JointStyle jointStyle;
  7674. EndCapStyle endStyle;
  7675. };
  7676. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7677. /*** End of inlined file: juce_PathStrokeType.h ***/
  7678. /*** Start of inlined file: juce_Line.h ***/
  7679. #ifndef __JUCE_LINE_JUCEHEADER__
  7680. #define __JUCE_LINE_JUCEHEADER__
  7681. class JUCE_API Line
  7682. {
  7683. public:
  7684. Line() throw();
  7685. Line (const Line& other) throw();
  7686. Line (float startX,
  7687. float startY,
  7688. float endX,
  7689. float endY) throw();
  7690. Line (const Point<float>& start,
  7691. const Point<float>& end) throw();
  7692. Line& operator= (const Line& other) throw();
  7693. ~Line() throw();
  7694. inline float getStartX() const throw() { return startX; }
  7695. inline float getStartY() const throw() { return startY; }
  7696. inline float getEndX() const throw() { return endX; }
  7697. inline float getEndY() const throw() { return endY; }
  7698. const Point<float> getStart() const throw();
  7699. const Point<float> getEnd() const throw();
  7700. void setStart (float newStartX,
  7701. float newStartY) throw();
  7702. void setEnd (float newEndX,
  7703. float newEndY) throw();
  7704. void setStart (const Point<float>& newStart) throw();
  7705. void setEnd (const Point<float>& newEnd) throw();
  7706. void applyTransform (const AffineTransform& transform) throw();
  7707. float getLength() const throw();
  7708. bool isVertical() const throw();
  7709. bool isHorizontal() const throw();
  7710. float getAngle() const throw();
  7711. bool operator== (const Line& other) const throw();
  7712. bool operator!= (const Line& other) const throw();
  7713. bool intersects (const Line& line,
  7714. float& intersectionX,
  7715. float& intersectionY) const throw();
  7716. const Point<float> getPointAlongLine (float distanceFromStart) const throw();
  7717. const Point<float> getPointAlongLine (float distanceFromStart,
  7718. float perpendicularDistance) const throw();
  7719. const Point<float> getPointAlongLineProportionally (float proportionOfLength) const throw();
  7720. float getDistanceFromLine (float x, float y) const throw();
  7721. float findNearestPointTo (float x, float y) const throw();
  7722. bool isPointAbove (float x, float y) const throw();
  7723. const Line withShortenedStart (float distanceToShortenBy) const throw();
  7724. const Line withShortenedEnd (float distanceToShortenBy) const throw();
  7725. bool clipToPath (const Path& path, bool keepSectionOutsidePath) throw();
  7726. juce_UseDebuggingNewOperator
  7727. private:
  7728. float startX, startY, endX, endY;
  7729. };
  7730. #endif // __JUCE_LINE_JUCEHEADER__
  7731. /*** End of inlined file: juce_Line.h ***/
  7732. /*** Start of inlined file: juce_Colours.h ***/
  7733. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7734. #define __JUCE_COLOURS_JUCEHEADER__
  7735. /*** Start of inlined file: juce_Colour.h ***/
  7736. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7737. #define __JUCE_COLOUR_JUCEHEADER__
  7738. /*** Start of inlined file: juce_PixelFormats.h ***/
  7739. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7740. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7741. #if JUCE_MSVC
  7742. #pragma pack (push, 1)
  7743. #define PACKED
  7744. #elif JUCE_GCC
  7745. #define PACKED __attribute__((packed))
  7746. #else
  7747. #define PACKED
  7748. #endif
  7749. class PixelRGB;
  7750. class PixelAlpha;
  7751. class JUCE_API PixelARGB
  7752. {
  7753. public:
  7754. PixelARGB() throw() {}
  7755. ~PixelARGB() throw() {}
  7756. PixelARGB (const uint32 argb_) throw()
  7757. : argb (argb_)
  7758. {
  7759. }
  7760. forcedinline uint32 getARGB() const throw() { return argb; }
  7761. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7762. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7763. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7764. forcedinline uint8 getRed() const throw() { return components.r; }
  7765. forcedinline uint8 getGreen() const throw() { return components.g; }
  7766. forcedinline uint8 getBlue() const throw() { return components.b; }
  7767. forcedinline void blend (const PixelARGB& src) throw()
  7768. {
  7769. uint32 sargb = src.getARGB();
  7770. const uint32 alpha = 0x100 - (sargb >> 24);
  7771. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7772. sargb += 0xff00ff00 & (getAG() * alpha);
  7773. argb = sargb;
  7774. }
  7775. forcedinline void blend (const PixelAlpha& src) throw();
  7776. forcedinline void blend (const PixelRGB& src) throw();
  7777. template <class Pixel>
  7778. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7779. {
  7780. ++extraAlpha;
  7781. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7782. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7783. const uint32 alpha = 0x100 - (sargb >> 24);
  7784. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7785. sargb += 0xff00ff00 & (getAG() * alpha);
  7786. argb = sargb;
  7787. }
  7788. template <class Pixel>
  7789. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7790. {
  7791. uint32 drb = getRB();
  7792. drb += (((src.getRB() - drb) * amount) >> 8);
  7793. drb &= 0x00ff00ff;
  7794. uint32 dag = getAG();
  7795. dag += (((src.getAG() - dag) * amount) >> 8);
  7796. dag &= 0x00ff00ff;
  7797. dag <<= 8;
  7798. dag |= drb;
  7799. argb = dag;
  7800. }
  7801. template <class Pixel>
  7802. forcedinline void set (const Pixel& src) throw()
  7803. {
  7804. argb = src.getARGB();
  7805. }
  7806. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7807. {
  7808. components.a = newAlpha;
  7809. }
  7810. forcedinline void multiplyAlpha (int multiplier) throw()
  7811. {
  7812. ++multiplier;
  7813. argb = ((multiplier * getAG()) & 0xff00ff00)
  7814. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7815. }
  7816. forcedinline void multiplyAlpha (const float multiplier) throw()
  7817. {
  7818. multiplyAlpha ((int) (multiplier * 256.0f));
  7819. }
  7820. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7821. {
  7822. components.b = b;
  7823. components.g = g;
  7824. components.r = r;
  7825. components.a = a;
  7826. }
  7827. forcedinline void premultiply() throw()
  7828. {
  7829. const uint32 alpha = components.a;
  7830. if (alpha < 0xff)
  7831. {
  7832. if (alpha == 0)
  7833. {
  7834. components.b = 0;
  7835. components.g = 0;
  7836. components.r = 0;
  7837. }
  7838. else
  7839. {
  7840. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7841. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7842. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7843. }
  7844. }
  7845. }
  7846. forcedinline void unpremultiply() throw()
  7847. {
  7848. const uint32 alpha = components.a;
  7849. if (alpha < 0xff)
  7850. {
  7851. if (alpha == 0)
  7852. {
  7853. components.b = 0;
  7854. components.g = 0;
  7855. components.r = 0;
  7856. }
  7857. else
  7858. {
  7859. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7860. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7861. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7862. }
  7863. }
  7864. }
  7865. forcedinline void desaturate() throw()
  7866. {
  7867. if (components.a < 0xff && components.a > 0)
  7868. {
  7869. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7870. components.r = components.g = components.b
  7871. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7872. }
  7873. else
  7874. {
  7875. components.r = components.g = components.b
  7876. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7877. }
  7878. }
  7879. #if JUCE_BIG_ENDIAN
  7880. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7881. #else
  7882. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7883. #endif
  7884. private:
  7885. union
  7886. {
  7887. uint32 argb;
  7888. struct
  7889. {
  7890. #if JUCE_BIG_ENDIAN
  7891. uint8 a : 8, r : 8, g : 8, b : 8;
  7892. #else
  7893. uint8 b, g, r, a;
  7894. #endif
  7895. } PACKED components;
  7896. };
  7897. } PACKED;
  7898. class JUCE_API PixelRGB
  7899. {
  7900. public:
  7901. PixelRGB() throw() {}
  7902. ~PixelRGB() throw() {}
  7903. PixelRGB (const uint32 argb) throw()
  7904. {
  7905. r = (uint8) (argb >> 16);
  7906. g = (uint8) (argb >> 8);
  7907. b = (uint8) (argb);
  7908. }
  7909. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7910. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7911. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7912. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7913. forcedinline uint8 getRed() const throw() { return r; }
  7914. forcedinline uint8 getGreen() const throw() { return g; }
  7915. forcedinline uint8 getBlue() const throw() { return b; }
  7916. forcedinline void blend (const PixelARGB& src) throw()
  7917. {
  7918. uint32 sargb = src.getARGB();
  7919. const uint32 alpha = 0x100 - (sargb >> 24);
  7920. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7921. sargb += 0x0000ff00 & (g * alpha);
  7922. r = (uint8) (sargb >> 16);
  7923. g = (uint8) (sargb >> 8);
  7924. b = (uint8) sargb;
  7925. }
  7926. forcedinline void blend (const PixelRGB& src) throw()
  7927. {
  7928. set (src);
  7929. }
  7930. forcedinline void blend (const PixelAlpha& src) throw();
  7931. template <class Pixel>
  7932. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7933. {
  7934. ++extraAlpha;
  7935. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7936. const uint32 sag = extraAlpha * src.getAG();
  7937. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7938. const uint32 alpha = 0x100 - (sargb >> 24);
  7939. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7940. sargb += 0x0000ff00 & (g * alpha);
  7941. b = (uint8) sargb;
  7942. g = (uint8) (sargb >> 8);
  7943. r = (uint8) (sargb >> 16);
  7944. }
  7945. template <class Pixel>
  7946. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7947. {
  7948. uint32 drb = getRB();
  7949. drb += (((src.getRB() - drb) * amount) >> 8);
  7950. uint32 dag = getAG();
  7951. dag += (((src.getAG() - dag) * amount) >> 8);
  7952. b = (uint8) drb;
  7953. g = (uint8) dag;
  7954. r = (uint8) (drb >> 16);
  7955. }
  7956. template <class Pixel>
  7957. forcedinline void set (const Pixel& src) throw()
  7958. {
  7959. b = src.getBlue();
  7960. g = src.getGreen();
  7961. r = src.getRed();
  7962. }
  7963. forcedinline void setAlpha (const uint8) throw() {}
  7964. forcedinline void multiplyAlpha (int) throw() {}
  7965. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7966. {
  7967. r = r_;
  7968. g = g_;
  7969. b = b_;
  7970. }
  7971. forcedinline void premultiply() throw() {}
  7972. forcedinline void unpremultiply() throw() {}
  7973. forcedinline void desaturate() throw()
  7974. {
  7975. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7976. }
  7977. #if JUCE_MAC
  7978. enum { indexR = 0, indexG = 1, indexB = 2 };
  7979. #else
  7980. enum { indexR = 2, indexG = 1, indexB = 0 };
  7981. #endif
  7982. private:
  7983. #if JUCE_MAC
  7984. uint8 r, g, b;
  7985. #else
  7986. uint8 b, g, r;
  7987. #endif
  7988. } PACKED;
  7989. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7990. {
  7991. set (src);
  7992. }
  7993. class JUCE_API PixelAlpha
  7994. {
  7995. public:
  7996. PixelAlpha() throw() {}
  7997. ~PixelAlpha() throw() {}
  7998. PixelAlpha (const uint32 argb) throw()
  7999. {
  8000. a = (uint8) (argb >> 24);
  8001. }
  8002. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8003. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8004. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8005. forcedinline uint8 getAlpha() const throw() { return a; }
  8006. forcedinline uint8 getRed() const throw() { return 0; }
  8007. forcedinline uint8 getGreen() const throw() { return 0; }
  8008. forcedinline uint8 getBlue() const throw() { return 0; }
  8009. template <class Pixel>
  8010. forcedinline void blend (const Pixel& src) throw()
  8011. {
  8012. const int srcA = src.getAlpha();
  8013. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8014. }
  8015. template <class Pixel>
  8016. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8017. {
  8018. ++extraAlpha;
  8019. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8020. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8021. }
  8022. template <class Pixel>
  8023. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8024. {
  8025. a += ((src,getAlpha() - a) * amount) >> 8;
  8026. }
  8027. template <class Pixel>
  8028. forcedinline void set (const Pixel& src) throw()
  8029. {
  8030. a = src.getAlpha();
  8031. }
  8032. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8033. {
  8034. a = newAlpha;
  8035. }
  8036. forcedinline void multiplyAlpha (int multiplier) throw()
  8037. {
  8038. ++multiplier;
  8039. a = (uint8) ((a * multiplier) >> 8);
  8040. }
  8041. forcedinline void multiplyAlpha (const float multiplier) throw()
  8042. {
  8043. a = (uint8) (a * multiplier);
  8044. }
  8045. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8046. {
  8047. a = a_;
  8048. }
  8049. forcedinline void premultiply() throw()
  8050. {
  8051. }
  8052. forcedinline void unpremultiply() throw()
  8053. {
  8054. }
  8055. forcedinline void desaturate() throw()
  8056. {
  8057. }
  8058. private:
  8059. uint8 a : 8;
  8060. } PACKED;
  8061. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8062. {
  8063. blend (PixelARGB (src.getARGB()));
  8064. }
  8065. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8066. {
  8067. uint32 sargb = src.getARGB();
  8068. const uint32 alpha = 0x100 - (sargb >> 24);
  8069. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8070. sargb += 0xff00ff00 & (getAG() * alpha);
  8071. argb = sargb;
  8072. }
  8073. #if JUCE_MSVC
  8074. #pragma pack (pop)
  8075. #endif
  8076. #undef PACKED
  8077. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8078. /*** End of inlined file: juce_PixelFormats.h ***/
  8079. class JUCE_API Colour
  8080. {
  8081. public:
  8082. Colour() throw();
  8083. Colour (const Colour& other) throw();
  8084. explicit Colour (uint32 argb) throw();
  8085. Colour (uint8 red,
  8086. uint8 green,
  8087. uint8 blue) throw();
  8088. static const Colour fromRGB (uint8 red,
  8089. uint8 green,
  8090. uint8 blue) throw();
  8091. Colour (uint8 red,
  8092. uint8 green,
  8093. uint8 blue,
  8094. uint8 alpha) throw();
  8095. static const Colour fromRGBA (uint8 red,
  8096. uint8 green,
  8097. uint8 blue,
  8098. uint8 alpha) throw();
  8099. Colour (uint8 red,
  8100. uint8 green,
  8101. uint8 blue,
  8102. float alpha) throw();
  8103. static const Colour fromRGBAFloat (uint8 red,
  8104. uint8 green,
  8105. uint8 blue,
  8106. float alpha) throw();
  8107. Colour (float hue,
  8108. float saturation,
  8109. float brightness,
  8110. uint8 alpha) throw();
  8111. Colour (float hue,
  8112. float saturation,
  8113. float brightness,
  8114. float alpha) throw();
  8115. static const Colour fromHSV (float hue,
  8116. float saturation,
  8117. float brightness,
  8118. float alpha) throw();
  8119. ~Colour() throw();
  8120. Colour& operator= (const Colour& other) throw();
  8121. bool operator== (const Colour& other) const throw();
  8122. bool operator!= (const Colour& other) const throw();
  8123. uint8 getRed() const throw() { return argb.getRed(); }
  8124. uint8 getGreen() const throw() { return argb.getGreen(); }
  8125. uint8 getBlue() const throw() { return argb.getBlue(); }
  8126. float getFloatRed() const throw();
  8127. float getFloatGreen() const throw();
  8128. float getFloatBlue() const throw();
  8129. const PixelARGB getPixelARGB() const throw();
  8130. uint32 getARGB() const throw();
  8131. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8132. float getFloatAlpha() const throw();
  8133. bool isOpaque() const throw();
  8134. bool isTransparent() const throw();
  8135. const Colour withAlpha (uint8 newAlpha) const throw();
  8136. const Colour withAlpha (float newAlpha) const throw();
  8137. const Colour withMultipliedAlpha (float alphaMultiplier) const throw();
  8138. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8139. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8140. float getHue() const throw();
  8141. float getSaturation() const throw();
  8142. float getBrightness() const throw();
  8143. void getHSB (float& hue,
  8144. float& saturation,
  8145. float& brightness) const throw();
  8146. const Colour withHue (float newHue) const throw();
  8147. const Colour withSaturation (float newSaturation) const throw();
  8148. const Colour withBrightness (float newBrightness) const throw();
  8149. const Colour withRotatedHue (float amountToRotate) const throw();
  8150. const Colour withMultipliedSaturation (float multiplier) const throw();
  8151. const Colour withMultipliedBrightness (float amount) const throw();
  8152. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8153. const Colour darker (float amountDarker = 0.4f) const throw();
  8154. const Colour contrasting (float amount = 1.0f) const throw();
  8155. static const Colour contrasting (const Colour& colour1,
  8156. const Colour& colour2) throw();
  8157. static const Colour greyLevel (float brightness) throw();
  8158. const String toString() const;
  8159. static const Colour fromString (const String& encodedColourString);
  8160. const String toDisplayString (bool includeAlphaValue) const;
  8161. juce_UseDebuggingNewOperator
  8162. private:
  8163. PixelARGB argb;
  8164. };
  8165. #endif // __JUCE_COLOUR_JUCEHEADER__
  8166. /*** End of inlined file: juce_Colour.h ***/
  8167. class Colours
  8168. {
  8169. public:
  8170. static JUCE_API const Colour
  8171. transparentBlack, /**< ARGB = 0x00000000 */
  8172. transparentWhite, /**< ARGB = 0x00ffffff */
  8173. black, /**< ARGB = 0xff000000 */
  8174. white, /**< ARGB = 0xffffffff */
  8175. blue, /**< ARGB = 0xff0000ff */
  8176. grey, /**< ARGB = 0xff808080 */
  8177. green, /**< ARGB = 0xff008000 */
  8178. red, /**< ARGB = 0xffff0000 */
  8179. yellow, /**< ARGB = 0xffffff00 */
  8180. aliceblue, antiquewhite, aqua, aquamarine,
  8181. azure, beige, bisque, blanchedalmond,
  8182. blueviolet, brown, burlywood, cadetblue,
  8183. chartreuse, chocolate, coral, cornflowerblue,
  8184. cornsilk, crimson, cyan, darkblue,
  8185. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8186. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8187. darkorchid, darkred, darksalmon, darkseagreen,
  8188. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8189. deeppink, deepskyblue, dimgrey, dodgerblue,
  8190. firebrick, floralwhite, forestgreen, fuchsia,
  8191. gainsboro, gold, goldenrod, greenyellow,
  8192. honeydew, hotpink, indianred, indigo,
  8193. ivory, khaki, lavender, lavenderblush,
  8194. lemonchiffon, lightblue, lightcoral, lightcyan,
  8195. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8196. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8197. lightsteelblue, lightyellow, lime, limegreen,
  8198. linen, magenta, maroon, mediumaquamarine,
  8199. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8200. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8201. midnightblue, mintcream, mistyrose, navajowhite,
  8202. navy, oldlace, olive, olivedrab,
  8203. orange, orangered, orchid, palegoldenrod,
  8204. palegreen, paleturquoise, palevioletred, papayawhip,
  8205. peachpuff, peru, pink, plum,
  8206. powderblue, purple, rosybrown, royalblue,
  8207. saddlebrown, salmon, sandybrown, seagreen,
  8208. seashell, sienna, silver, skyblue,
  8209. slateblue, slategrey, snow, springgreen,
  8210. steelblue, tan, teal, thistle,
  8211. tomato, turquoise, violet, wheat,
  8212. whitesmoke, yellowgreen;
  8213. static JUCE_API const Colour findColourForName (const String& colourName,
  8214. const Colour& defaultColour);
  8215. private:
  8216. // this isn't a class you should ever instantiate - it's just here for the
  8217. // static values in it.
  8218. Colours();
  8219. };
  8220. #endif // __JUCE_COLOURS_JUCEHEADER__
  8221. /*** End of inlined file: juce_Colours.h ***/
  8222. /*** Start of inlined file: juce_FillType.h ***/
  8223. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8224. #define __JUCE_FILLTYPE_JUCEHEADER__
  8225. /*** Start of inlined file: juce_ColourGradient.h ***/
  8226. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8227. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8228. class JUCE_API ColourGradient
  8229. {
  8230. public:
  8231. ColourGradient (const Colour& colour1, float x1, float y1,
  8232. const Colour& colour2, float x2, float y2,
  8233. bool isRadial) throw();
  8234. ColourGradient() throw();
  8235. ~ColourGradient() throw();
  8236. void clearColours() throw();
  8237. void addColour (double proportionAlongGradient,
  8238. const Colour& colour) throw();
  8239. void multiplyOpacity (float multiplier) throw();
  8240. int getNumColours() const throw();
  8241. double getColourPosition (int index) const throw();
  8242. const Colour getColour (int index) const throw();
  8243. const Colour getColourAtPosition (float position) const throw();
  8244. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8245. bool isOpaque() const throw();
  8246. bool isInvisible() const throw();
  8247. float x1;
  8248. float y1;
  8249. float x2;
  8250. float y2;
  8251. bool isRadial;
  8252. juce_UseDebuggingNewOperator
  8253. private:
  8254. Array <uint32> colours;
  8255. };
  8256. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8257. /*** End of inlined file: juce_ColourGradient.h ***/
  8258. class Image;
  8259. class JUCE_API FillType
  8260. {
  8261. public:
  8262. FillType() throw();
  8263. FillType (const Colour& colour) throw();
  8264. FillType (const ColourGradient& gradient) throw();
  8265. FillType (const Image& image, const AffineTransform& transform) throw();
  8266. FillType (const FillType& other) throw();
  8267. FillType& operator= (const FillType& other) throw();
  8268. ~FillType() throw();
  8269. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8270. bool isGradient() const throw() { return gradient != 0; }
  8271. bool isTiledImage() const throw() { return image != 0; }
  8272. void setColour (const Colour& newColour) throw();
  8273. void setGradient (const ColourGradient& newGradient) throw();
  8274. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8275. void setOpacity (float newOpacity) throw();
  8276. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8277. Colour colour;
  8278. ScopedPointer <ColourGradient> gradient;
  8279. const Image* image;
  8280. AffineTransform transform;
  8281. juce_UseDebuggingNewOperator
  8282. };
  8283. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8284. /*** End of inlined file: juce_FillType.h ***/
  8285. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8286. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8287. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8288. class JUCE_API RectanglePlacement
  8289. {
  8290. public:
  8291. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8292. RectanglePlacement (const RectanglePlacement& other) throw();
  8293. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8294. enum
  8295. {
  8296. xLeft = 1,
  8297. xRight = 2,
  8298. xMid = 4,
  8299. yTop = 8,
  8300. yBottom = 16,
  8301. yMid = 32,
  8302. stretchToFit = 64,
  8303. fillDestination = 128,
  8304. onlyReduceInSize = 256,
  8305. onlyIncreaseInSize = 512,
  8306. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8307. centred = 4 + 32
  8308. };
  8309. inline int getFlags() const throw() { return flags; }
  8310. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8311. void applyTo (double& sourceX,
  8312. double& sourceY,
  8313. double& sourceW,
  8314. double& sourceH,
  8315. double destinationX,
  8316. double destinationY,
  8317. double destinationW,
  8318. double destinationH) const throw();
  8319. const AffineTransform getTransformToFit (float sourceX,
  8320. float sourceY,
  8321. float sourceW,
  8322. float sourceH,
  8323. float destinationX,
  8324. float destinationY,
  8325. float destinationW,
  8326. float destinationH) const throw();
  8327. private:
  8328. int flags;
  8329. };
  8330. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8331. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8332. class LowLevelGraphicsContext;
  8333. class Image;
  8334. class RectangleList;
  8335. class JUCE_API Graphics
  8336. {
  8337. public:
  8338. Graphics (Image& imageToDrawOnto) throw();
  8339. ~Graphics() throw();
  8340. void setColour (const Colour& newColour) throw();
  8341. void setOpacity (const float newOpacity) throw();
  8342. void setGradientFill (const ColourGradient& gradient) throw();
  8343. void setTiledImageFill (const Image& imageToUse,
  8344. int anchorX,
  8345. int anchorY,
  8346. float opacity) throw();
  8347. void setFillType (const FillType& newFill) throw();
  8348. void setFont (const Font& newFont) throw();
  8349. void setFont (float newFontHeight,
  8350. int fontStyleFlags = Font::plain) throw();
  8351. void drawSingleLineText (const String& text,
  8352. int startX, int baselineY) const throw();
  8353. void drawMultiLineText (const String& text,
  8354. int startX, int baselineY,
  8355. int maximumLineWidth) const throw();
  8356. void drawTextAsPath (const String& text,
  8357. const AffineTransform& transform) const throw();
  8358. void drawText (const String& text,
  8359. int x, int y, int width, int height,
  8360. const Justification& justificationType,
  8361. bool useEllipsesIfTooBig) const throw();
  8362. void drawFittedText (const String& text,
  8363. int x, int y, int width, int height,
  8364. const Justification& justificationFlags,
  8365. int maximumNumberOfLines,
  8366. float minimumHorizontalScale = 0.7f) const throw();
  8367. void fillAll() const throw();
  8368. void fillAll (const Colour& colourToUse) const throw();
  8369. void fillRect (int x, int y, int width, int height) const throw();
  8370. void fillRect (const Rectangle<int>& rectangle) const throw();
  8371. void fillRect (float x, float y, float width, float height) const throw();
  8372. void fillRoundedRectangle (float x, float y, float width, float height,
  8373. float cornerSize) const throw();
  8374. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8375. float cornerSize) const throw();
  8376. void fillCheckerBoard (int x, int y, int width, int height,
  8377. int checkWidth, int checkHeight,
  8378. const Colour& colour1, const Colour& colour2) const throw();
  8379. void drawRect (int x, int y, int width, int height,
  8380. int lineThickness = 1) const throw();
  8381. void drawRect (float x, float y, float width, float height,
  8382. float lineThickness = 1.0f) const throw();
  8383. void drawRect (const Rectangle<int>& rectangle,
  8384. int lineThickness = 1) const throw();
  8385. void drawRoundedRectangle (float x, float y, float width, float height,
  8386. float cornerSize, float lineThickness) const throw();
  8387. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8388. float cornerSize, float lineThickness) const throw();
  8389. void drawBevel (int x, int y, int width, int height,
  8390. int bevelThickness,
  8391. const Colour& topLeftColour = Colours::white,
  8392. const Colour& bottomRightColour = Colours::black,
  8393. bool useGradient = true,
  8394. bool sharpEdgeOnOutside = true) const throw();
  8395. void setPixel (int x, int y) const throw();
  8396. void fillEllipse (float x, float y, float width, float height) const throw();
  8397. void drawEllipse (float x, float y, float width, float height,
  8398. float lineThickness) const throw();
  8399. void drawLine (float startX,
  8400. float startY,
  8401. float endX,
  8402. float endY) const throw();
  8403. void drawLine (float startX,
  8404. float startY,
  8405. float endX,
  8406. float endY,
  8407. float lineThickness) const throw();
  8408. void drawLine (const Line& line) const throw();
  8409. void drawLine (const Line& line,
  8410. float lineThickness) const throw();
  8411. void drawDashedLine (float startX,
  8412. float startY,
  8413. float endX,
  8414. float endY,
  8415. const float* dashLengths,
  8416. int numDashLengths,
  8417. float lineThickness = 1.0f) const throw();
  8418. void drawVerticalLine (int x, float top, float bottom) const throw();
  8419. void drawHorizontalLine (int y, float left, float right) const throw();
  8420. void fillPath (const Path& path,
  8421. const AffineTransform& transform = AffineTransform::identity) const throw();
  8422. void strokePath (const Path& path,
  8423. const PathStrokeType& strokeType,
  8424. const AffineTransform& transform = AffineTransform::identity) const throw();
  8425. void drawArrow (float startX,
  8426. float startY,
  8427. float endX,
  8428. float endY,
  8429. float lineThickness,
  8430. float arrowheadWidth,
  8431. float arrowheadLength) const throw();
  8432. enum ResamplingQuality
  8433. {
  8434. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8435. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8436. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8437. };
  8438. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8439. void drawImageAt (const Image* const imageToDraw,
  8440. int topLeftX, int topLeftY,
  8441. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8442. void drawImage (const Image* const imageToDraw,
  8443. int destX,
  8444. int destY,
  8445. int destWidth,
  8446. int destHeight,
  8447. int sourceX,
  8448. int sourceY,
  8449. int sourceWidth,
  8450. int sourceHeight,
  8451. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8452. void drawImageTransformed (const Image* imageToDraw,
  8453. const Rectangle<int>& imageSubRegion,
  8454. const AffineTransform& transform,
  8455. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8456. void drawImageWithin (const Image* imageToDraw,
  8457. int destX, int destY, int destWidth, int destHeight,
  8458. const RectanglePlacement& placementWithinTarget,
  8459. bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8460. const Rectangle<int> getClipBounds() const throw();
  8461. bool clipRegionIntersects (int x, int y, int width, int height) const throw();
  8462. bool reduceClipRegion (int x, int y, int width, int height) throw();
  8463. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8464. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8465. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8466. const AffineTransform& transform) throw();
  8467. void excludeClipRegion (const Rectangle<int>& rectangleToExclude) throw();
  8468. bool isClipEmpty() const throw();
  8469. void saveState() throw();
  8470. void restoreState() throw();
  8471. void setOrigin (int newOriginX, int newOriginY) throw();
  8472. void resetToDefaultState() throw();
  8473. bool isVectorDevice() const throw();
  8474. juce_UseDebuggingNewOperator
  8475. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8476. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8477. private:
  8478. LowLevelGraphicsContext* const context;
  8479. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8480. bool saveStatePending;
  8481. void saveStateIfPending() throw();
  8482. Graphics (const Graphics&);
  8483. Graphics& operator= (const Graphics& other);
  8484. };
  8485. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8486. /*** End of inlined file: juce_Graphics.h ***/
  8487. class JUCE_API ImageEffectFilter
  8488. {
  8489. public:
  8490. virtual void applyEffect (Image& sourceImage,
  8491. Graphics& destContext) = 0;
  8492. virtual ~ImageEffectFilter() {}
  8493. };
  8494. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8495. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8496. /*** Start of inlined file: juce_RectangleList.h ***/
  8497. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8498. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8499. class JUCE_API RectangleList
  8500. {
  8501. public:
  8502. RectangleList() throw();
  8503. RectangleList (const RectangleList& other) throw();
  8504. RectangleList (const Rectangle<int>& rect) throw();
  8505. RectangleList& operator= (const RectangleList& other) throw();
  8506. ~RectangleList() throw();
  8507. bool isEmpty() const throw();
  8508. int getNumRectangles() const throw() { return rects.size(); }
  8509. const Rectangle<int> getRectangle (const int index) const throw();
  8510. void clear() throw();
  8511. void add (int x, int y, int width, int height) throw();
  8512. void add (const Rectangle<int>& rect) throw();
  8513. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8514. void add (const RectangleList& other) throw();
  8515. void subtract (const Rectangle<int>& rect) throw();
  8516. void subtract (const RectangleList& otherList) throw();
  8517. bool clipTo (const Rectangle<int>& rect) throw();
  8518. bool clipTo (const RectangleList& other) throw();
  8519. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8520. void swapWith (RectangleList& otherList) throw();
  8521. bool containsPoint (int x, int y) const throw();
  8522. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8523. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8524. bool intersects (const RectangleList& other) const throw();
  8525. const Rectangle<int> getBounds() const throw();
  8526. void consolidate() throw();
  8527. void offsetAll (int dx, int dy) throw();
  8528. const Path toPath() const throw();
  8529. class Iterator
  8530. {
  8531. public:
  8532. Iterator (const RectangleList& list) throw();
  8533. ~Iterator() throw();
  8534. bool next() throw();
  8535. const Rectangle<int>* getRectangle() const throw() { return current; }
  8536. juce_UseDebuggingNewOperator
  8537. private:
  8538. const Rectangle<int>* current;
  8539. const RectangleList& owner;
  8540. int index;
  8541. Iterator (const Iterator&);
  8542. Iterator& operator= (const Iterator&);
  8543. };
  8544. juce_UseDebuggingNewOperator
  8545. private:
  8546. friend class Iterator;
  8547. Array <Rectangle<int> > rects;
  8548. };
  8549. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8550. /*** End of inlined file: juce_RectangleList.h ***/
  8551. /*** Start of inlined file: juce_BorderSize.h ***/
  8552. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8553. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8554. class JUCE_API BorderSize
  8555. {
  8556. public:
  8557. BorderSize() throw();
  8558. BorderSize (const BorderSize& other) throw();
  8559. BorderSize (int topGap,
  8560. int leftGap,
  8561. int bottomGap,
  8562. int rightGap) throw();
  8563. BorderSize (int allGaps) throw();
  8564. ~BorderSize() throw();
  8565. int getTop() const throw() { return top; }
  8566. int getLeft() const throw() { return left; }
  8567. int getBottom() const throw() { return bottom; }
  8568. int getRight() const throw() { return right; }
  8569. int getTopAndBottom() const throw() { return top + bottom; }
  8570. int getLeftAndRight() const throw() { return left + right; }
  8571. void setTop (int newTopGap) throw();
  8572. void setLeft (int newLeftGap) throw();
  8573. void setBottom (int newBottomGap) throw();
  8574. void setRight (int newRightGap) throw();
  8575. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8576. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8577. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8578. void addTo (Rectangle<int>& original) const throw();
  8579. bool operator== (const BorderSize& other) const throw();
  8580. bool operator!= (const BorderSize& other) const throw();
  8581. juce_UseDebuggingNewOperator
  8582. private:
  8583. int top, left, bottom, right;
  8584. };
  8585. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8586. /*** End of inlined file: juce_BorderSize.h ***/
  8587. class LookAndFeel;
  8588. class MouseInputSource;
  8589. class MouseInputSourceInternal;
  8590. class ComponentPeer;
  8591. class JUCE_API Component : public MouseListener,
  8592. protected MessageListener
  8593. {
  8594. public:
  8595. Component();
  8596. virtual ~Component();
  8597. Component (const String& componentName);
  8598. const String& getName() const throw() { return componentName_; }
  8599. virtual void setName (const String& newName);
  8600. bool isValidComponent() const;
  8601. virtual void setVisible (bool shouldBeVisible);
  8602. bool isVisible() const throw() { return flags.visibleFlag; }
  8603. virtual void visibilityChanged();
  8604. bool isShowing() const;
  8605. void fadeOutComponent (int lengthOfFadeOutInMilliseconds,
  8606. int deltaXToMove = 0,
  8607. int deltaYToMove = 0,
  8608. float scaleFactorAtEnd = 1.0f);
  8609. virtual void addToDesktop (int windowStyleFlags,
  8610. void* nativeWindowToAttachTo = 0);
  8611. void removeFromDesktop();
  8612. bool isOnDesktop() const throw();
  8613. ComponentPeer* getPeer() const;
  8614. virtual void userTriedToCloseWindow();
  8615. virtual void minimisationStateChanged (bool isNowMinimised);
  8616. void toFront (bool shouldAlsoGainFocus);
  8617. void toBack();
  8618. void toBehind (Component* other);
  8619. void setAlwaysOnTop (bool shouldStayOnTop);
  8620. bool isAlwaysOnTop() const throw();
  8621. inline int getX() const throw() { return bounds_.getX(); }
  8622. inline int getY() const throw() { return bounds_.getY(); }
  8623. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8624. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8625. int getRight() const throw() { return bounds_.getRight(); }
  8626. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8627. int getBottom() const throw() { return bounds_.getBottom(); }
  8628. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8629. void getVisibleArea (RectangleList& result,
  8630. bool includeSiblings) const;
  8631. int getScreenX() const;
  8632. int getScreenY() const;
  8633. const Point<int> getScreenPosition() const;
  8634. const Rectangle<int> getScreenBounds() const;
  8635. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8636. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8637. const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
  8638. const Point<int>& positionRelativeToThis) const;
  8639. void setTopLeftPosition (int x, int y);
  8640. void setTopRightPosition (int x, int y);
  8641. void setSize (int newWidth, int newHeight);
  8642. void setBounds (int x, int y, int width, int height);
  8643. void setBounds (const Rectangle<int>& newBounds);
  8644. void setBoundsRelative (float proportionalX, float proportionalY,
  8645. float proportionalWidth, float proportionalHeight);
  8646. void setBoundsInset (const BorderSize& borders);
  8647. void setBoundsToFit (int x, int y, int width, int height,
  8648. const Justification& justification,
  8649. bool onlyReduceInSize);
  8650. void setCentrePosition (int x, int y);
  8651. void setCentreRelative (float x, float y);
  8652. void centreWithSize (int width, int height);
  8653. int proportionOfWidth (float proportion) const throw();
  8654. int proportionOfHeight (float proportion) const throw();
  8655. int getParentWidth() const throw();
  8656. int getParentHeight() const throw();
  8657. const Rectangle<int> getParentMonitorArea() const;
  8658. int getNumChildComponents() const throw();
  8659. Component* getChildComponent (int index) const throw();
  8660. int getIndexOfChildComponent (const Component* child) const throw();
  8661. void addChildComponent (Component* child, int zOrder = -1);
  8662. void addAndMakeVisible (Component* child, int zOrder = -1);
  8663. void removeChildComponent (Component* childToRemove);
  8664. Component* removeChildComponent (int childIndexToRemove);
  8665. void removeAllChildren();
  8666. void deleteAllChildren();
  8667. Component* getParentComponent() const throw() { return parentComponent_; }
  8668. template <class TargetClass>
  8669. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8670. {
  8671. (void) dummyParameter;
  8672. Component* p = parentComponent_;
  8673. while (p != 0)
  8674. {
  8675. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8676. if (target != 0)
  8677. return target;
  8678. p = p->parentComponent_;
  8679. }
  8680. return 0;
  8681. }
  8682. Component* getTopLevelComponent() const throw();
  8683. bool isParentOf (const Component* possibleChild) const throw();
  8684. virtual void parentHierarchyChanged();
  8685. virtual void childrenChanged();
  8686. virtual bool hitTest (int x, int y);
  8687. void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
  8688. bool allowClicksOnChildComponents) throw();
  8689. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8690. bool& allowsClicksOnChildComponents) const throw();
  8691. virtual bool contains (int x, int y);
  8692. bool reallyContains (int x, int y, bool returnTrueIfWithinAChild);
  8693. Component* getComponentAt (int x, int y);
  8694. Component* getComponentAt (const Point<int>& position);
  8695. void repaint();
  8696. void repaint (int x, int y, int width, int height);
  8697. void setBufferedToImage (bool shouldBeBuffered);
  8698. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8699. bool clipImageToComponentBounds = true);
  8700. void paintEntireComponent (Graphics& context);
  8701. void setComponentEffect (ImageEffectFilter* newEffect);
  8702. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8703. LookAndFeel& getLookAndFeel() const throw();
  8704. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  8705. virtual void lookAndFeelChanged();
  8706. void sendLookAndFeelChange();
  8707. void setOpaque (bool shouldBeOpaque);
  8708. bool isOpaque() const throw();
  8709. void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) throw();
  8710. bool isBroughtToFrontOnMouseClick() const throw();
  8711. // Keyboard focus methods
  8712. void setWantsKeyboardFocus (bool wantsFocus) throw();
  8713. bool getWantsKeyboardFocus() const throw();
  8714. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8715. bool getMouseClickGrabsKeyboardFocus() const throw();
  8716. void grabKeyboardFocus();
  8717. bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
  8718. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8719. void moveKeyboardFocusToSibling (bool moveToNext);
  8720. virtual KeyboardFocusTraverser* createFocusTraverser();
  8721. int getExplicitFocusOrder() const;
  8722. void setExplicitFocusOrder (int newFocusOrderIndex);
  8723. void setFocusContainer (bool shouldBeFocusContainer) throw();
  8724. bool isFocusContainer() const throw();
  8725. bool isEnabled() const throw();
  8726. void setEnabled (bool shouldBeEnabled);
  8727. virtual void enablementChanged();
  8728. void setMouseCursor (const MouseCursor& cursorType);
  8729. virtual const MouseCursor getMouseCursor();
  8730. void updateMouseCursor() const;
  8731. virtual void paint (Graphics& g);
  8732. virtual void paintOverChildren (Graphics& g);
  8733. virtual void mouseMove (const MouseEvent& e);
  8734. virtual void mouseEnter (const MouseEvent& e);
  8735. virtual void mouseExit (const MouseEvent& e);
  8736. virtual void mouseDown (const MouseEvent& e);
  8737. virtual void mouseDrag (const MouseEvent& e);
  8738. virtual void mouseUp (const MouseEvent& e);
  8739. virtual void mouseDoubleClick (const MouseEvent& e);
  8740. virtual void mouseWheelMove (const MouseEvent& e,
  8741. float wheelIncrementX,
  8742. float wheelIncrementY);
  8743. static void beginDragAutoRepeat (int millisecondIntervalBetweenCallbacks);
  8744. void setRepaintsOnMouseActivity (bool shouldRepaint) throw();
  8745. void addMouseListener (MouseListener* newListener,
  8746. bool wantsEventsForAllNestedChildComponents);
  8747. void removeMouseListener (MouseListener* listenerToRemove);
  8748. void addKeyListener (KeyListener* newListener);
  8749. void removeKeyListener (KeyListener* listenerToRemove);
  8750. virtual bool keyPressed (const KeyPress& key);
  8751. virtual bool keyStateChanged (bool isKeyDown);
  8752. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8753. enum FocusChangeType
  8754. {
  8755. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8756. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8757. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8758. };
  8759. virtual void focusGained (FocusChangeType cause);
  8760. virtual void focusLost (FocusChangeType cause);
  8761. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8762. bool isMouseOver() const throw();
  8763. bool isMouseButtonDown() const throw();
  8764. bool isMouseOverOrDragging() const throw();
  8765. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8766. const Point<int> getMouseXYRelative() const;
  8767. virtual void resized();
  8768. virtual void moved();
  8769. virtual void childBoundsChanged (Component* child);
  8770. virtual void parentSizeChanged();
  8771. virtual void broughtToFront();
  8772. void addComponentListener (ComponentListener* newListener);
  8773. void removeComponentListener (ComponentListener* listenerToRemove);
  8774. void postCommandMessage (int commandId);
  8775. virtual void handleCommandMessage (int commandId);
  8776. int runModalLoop();
  8777. void enterModalState (bool takeKeyboardFocus = true);
  8778. void exitModalState (int returnValue);
  8779. bool isCurrentlyModal() const throw();
  8780. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8781. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8782. bool isCurrentlyBlockedByAnotherModalComponent() const;
  8783. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8784. virtual void inputAttemptWhenModal();
  8785. NamedValueSet& getProperties() throw() { return properties; }
  8786. const NamedValueSet& getProperties() const throw() { return properties; }
  8787. const Colour findColour (int colourId, bool inheritFromParent = false) const;
  8788. void setColour (int colourId, const Colour& colour);
  8789. void removeColour (int colourId);
  8790. bool isColourSpecified (int colourId) const;
  8791. void copyAllExplicitColoursTo (Component& target) const;
  8792. virtual void colourChanged();
  8793. void* getWindowHandle() const;
  8794. uint32 getComponentUID() const throw() { return componentUID; }
  8795. template <class ComponentType>
  8796. class SafePointer : private ComponentListener
  8797. {
  8798. public:
  8799. SafePointer() : comp (0) {}
  8800. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8801. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8802. ~SafePointer() { detach(); }
  8803. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8804. SafePointer& operator= (ComponentType* const newComponent)
  8805. {
  8806. detach();
  8807. comp = newComponent;
  8808. attach();
  8809. return *this;
  8810. }
  8811. operator ComponentType*() const throw() { return comp; }
  8812. ComponentType* getComponent() const throw() { return comp; }
  8813. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8814. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8815. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8816. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8817. juce_UseDebuggingNewOperator
  8818. private:
  8819. ComponentType* comp;
  8820. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8821. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8822. void componentBeingDeleted (Component&) { comp = 0; }
  8823. };
  8824. class BailOutChecker
  8825. {
  8826. public:
  8827. BailOutChecker (Component* component1,
  8828. Component* component2 = 0);
  8829. bool shouldBailOut() const throw();
  8830. private:
  8831. typedef SafePointer<Component> SafeComponentPtr;
  8832. SafeComponentPtr safePointer1, safePointer2;
  8833. Component* const component2;
  8834. BailOutChecker (const BailOutChecker&);
  8835. BailOutChecker& operator= (const BailOutChecker&);
  8836. };
  8837. juce_UseDebuggingNewOperator
  8838. private:
  8839. friend class ComponentPeer;
  8840. friend class InternalDragRepeater;
  8841. friend class MouseInputSource;
  8842. friend class MouseInputSourceInternal;
  8843. static Component* currentlyFocusedComponent;
  8844. String componentName_;
  8845. Component* parentComponent_;
  8846. uint32 componentUID;
  8847. Rectangle<int> bounds_;
  8848. int numDeepMouseListeners;
  8849. Array <Component*> childComponentList_;
  8850. LookAndFeel* lookAndFeel_;
  8851. MouseCursor cursor_;
  8852. ImageEffectFilter* effect_;
  8853. Image* bufferedImage_;
  8854. VoidArray* mouseListeners_;
  8855. VoidArray* keyListeners_;
  8856. ListenerList <ComponentListener> componentListeners;
  8857. NamedValueSet properties;
  8858. struct ComponentFlags
  8859. {
  8860. bool hasHeavyweightPeerFlag : 1;
  8861. bool visibleFlag : 1;
  8862. bool opaqueFlag : 1;
  8863. bool ignoresMouseClicksFlag : 1;
  8864. bool allowChildMouseClicksFlag : 1;
  8865. bool wantsFocusFlag : 1;
  8866. bool isFocusContainerFlag : 1;
  8867. bool dontFocusOnMouseClickFlag : 1;
  8868. bool alwaysOnTopFlag : 1;
  8869. bool bufferToImageFlag : 1;
  8870. bool bringToFrontOnClickFlag : 1;
  8871. bool repaintOnMouseActivityFlag : 1;
  8872. bool draggingFlag : 1;
  8873. bool mouseOverFlag : 1;
  8874. bool mouseInsideFlag : 1;
  8875. bool currentlyModalFlag : 1;
  8876. bool isDisabledFlag : 1;
  8877. bool childCompFocusedFlag : 1;
  8878. #ifdef JUCE_DEBUG
  8879. bool isInsidePaintCall : 1;
  8880. #endif
  8881. };
  8882. union
  8883. {
  8884. uint32 componentFlags_;
  8885. ComponentFlags flags;
  8886. };
  8887. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8888. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8889. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8890. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8891. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8892. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8893. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, float amountX, float amountY);
  8894. void internalBroughtToFront();
  8895. void internalFocusGain (const FocusChangeType cause);
  8896. void internalFocusLoss (const FocusChangeType cause);
  8897. void internalChildFocusChange (FocusChangeType cause);
  8898. void internalModalInputAttempt();
  8899. void internalModifierKeysChanged();
  8900. void internalChildrenChanged();
  8901. void internalHierarchyChanged();
  8902. void renderComponent (Graphics& context);
  8903. void sendMovedResizedMessages (bool wasMoved, bool wasResized);
  8904. void repaintParent();
  8905. void sendFakeMouseMove() const;
  8906. void takeKeyboardFocus (const FocusChangeType cause);
  8907. void grabFocusInternal (const FocusChangeType cause, bool canTryParent = true);
  8908. static void giveAwayFocus();
  8909. void sendEnablementChangeMessage();
  8910. static void* runModalLoopCallback (void*);
  8911. static void bringModalComponentToFront();
  8912. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  8913. const Rectangle<int>& clipRect,
  8914. const Component* const compToAvoid) const;
  8915. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8916. int deltaX, int deltaY) const;
  8917. // how much of the component is not off the edges of its parents
  8918. const Rectangle<int> getUnclippedArea() const;
  8919. void sendVisibilityChangeMessage();
  8920. // This is included here just to cause a compile error if your code is still handling
  8921. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8922. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8923. // implement its methods instead of this Component method).
  8924. virtual void filesDropped (const StringArray&, int, int) {}
  8925. // components aren't allowed to have copy constructors, as this would mess up parent
  8926. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8927. // this one to avoid compiler warnings.
  8928. Component (const Component&);
  8929. Component& operator= (const Component&);
  8930. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8931. // subclass to use the new parameters to keyStateChanged)
  8932. virtual void keyStateChanged() {};
  8933. protected:
  8934. virtual void internalRepaint (int x, int y, int w, int h);
  8935. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8936. void handleMessage (const Message&);
  8937. };
  8938. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8939. /*** End of inlined file: juce_Component.h ***/
  8940. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8941. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8942. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8943. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  8944. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8945. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8946. typedef int CommandID;
  8947. namespace StandardApplicationCommandIDs
  8948. {
  8949. static const CommandID quit = 0x1001;
  8950. static const CommandID del = 0x1002;
  8951. static const CommandID cut = 0x1003;
  8952. static const CommandID copy = 0x1004;
  8953. static const CommandID paste = 0x1005;
  8954. static const CommandID selectAll = 0x1006;
  8955. static const CommandID deselectAll = 0x1007;
  8956. }
  8957. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8958. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  8959. struct JUCE_API ApplicationCommandInfo
  8960. {
  8961. ApplicationCommandInfo (CommandID commandID) throw();
  8962. void setInfo (const String& shortName,
  8963. const String& description,
  8964. const String& categoryName,
  8965. int flags) throw();
  8966. void setActive (bool isActive) throw();
  8967. void setTicked (bool isTicked) throw();
  8968. void addDefaultKeypress (int keyCode,
  8969. const ModifierKeys& modifiers) throw();
  8970. CommandID commandID;
  8971. String shortName;
  8972. String description;
  8973. String categoryName;
  8974. Array <KeyPress> defaultKeypresses;
  8975. enum CommandFlags
  8976. {
  8977. isDisabled = 1 << 0,
  8978. isTicked = 1 << 1,
  8979. wantsKeyUpDownCallbacks = 1 << 2,
  8980. hiddenFromKeyEditor = 1 << 3,
  8981. readOnlyInKeyEditor = 1 << 4,
  8982. dontTriggerVisualFeedback = 1 << 5
  8983. };
  8984. int flags;
  8985. };
  8986. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8987. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  8988. class JUCE_API ApplicationCommandTarget
  8989. {
  8990. public:
  8991. ApplicationCommandTarget();
  8992. virtual ~ApplicationCommandTarget();
  8993. struct JUCE_API InvocationInfo
  8994. {
  8995. InvocationInfo (const CommandID commandID) throw();
  8996. CommandID commandID;
  8997. int commandFlags;
  8998. enum InvocationMethod
  8999. {
  9000. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9001. fromKeyPress, /**< The command is being invoked by a key-press. */
  9002. fromMenu, /**< The command is being invoked by a menu selection. */
  9003. fromButton /**< The command is being invoked by a button click. */
  9004. };
  9005. InvocationMethod invocationMethod;
  9006. Component* originatingComponent;
  9007. KeyPress keyPress;
  9008. bool isKeyDown;
  9009. int millisecsSinceKeyPressed;
  9010. };
  9011. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9012. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9013. virtual void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) = 0;
  9014. virtual bool perform (const InvocationInfo& info) = 0;
  9015. bool invoke (const InvocationInfo& invocationInfo,
  9016. const bool asynchronously);
  9017. bool invokeDirectly (const CommandID commandID,
  9018. const bool asynchronously);
  9019. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9020. bool isCommandActive (const CommandID commandID);
  9021. ApplicationCommandTarget* findFirstTargetParentComponent();
  9022. juce_UseDebuggingNewOperator
  9023. private:
  9024. // (for async invocation of commands)
  9025. class CommandTargetMessageInvoker : public MessageListener
  9026. {
  9027. public:
  9028. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9029. ~CommandTargetMessageInvoker();
  9030. void handleMessage (const Message& message);
  9031. private:
  9032. ApplicationCommandTarget* const owner;
  9033. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9034. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9035. };
  9036. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9037. friend class CommandTargetMessageInvoker;
  9038. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9039. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9040. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9041. };
  9042. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9043. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9044. /*** Start of inlined file: juce_ActionListener.h ***/
  9045. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9046. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9047. class JUCE_API ActionListener
  9048. {
  9049. public:
  9050. virtual ~ActionListener() {}
  9051. virtual void actionListenerCallback (const String& message) = 0;
  9052. };
  9053. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9054. /*** End of inlined file: juce_ActionListener.h ***/
  9055. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9056. private ActionListener
  9057. {
  9058. protected:
  9059. JUCEApplication();
  9060. public:
  9061. virtual ~JUCEApplication();
  9062. static JUCEApplication* getInstance() throw();
  9063. virtual void initialise (const String& commandLineParameters) = 0;
  9064. bool isInitialising() const throw();
  9065. virtual void shutdown() = 0;
  9066. virtual const String getApplicationName() = 0;
  9067. virtual const String getApplicationVersion();
  9068. virtual bool moreThanOneInstanceAllowed();
  9069. virtual void anotherInstanceStarted (const String& commandLine);
  9070. virtual void systemRequestedQuit();
  9071. virtual void unhandledException (const std::exception* e,
  9072. const String& sourceFilename,
  9073. int lineNumber);
  9074. static void quit();
  9075. void setApplicationReturnValue (int newReturnValue) throw();
  9076. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9077. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9078. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9079. static int main (String& commandLine, JUCEApplication* newApp);
  9080. static int main (int argc, const char* argv[], JUCEApplication* newApp);
  9081. static void sendUnhandledException (const std::exception* e,
  9082. const char* sourceFile,
  9083. int lineNumber);
  9084. ApplicationCommandTarget* getNextCommandTarget();
  9085. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  9086. void getAllCommands (Array <CommandID>& commands);
  9087. bool perform (const InvocationInfo& info);
  9088. void actionListenerCallback (const String& message);
  9089. private:
  9090. String commandLineParameters;
  9091. int appReturnValue;
  9092. bool stillInitialising;
  9093. ScopedPointer<InterProcessLock> appLock;
  9094. JUCEApplication (const JUCEApplication&);
  9095. JUCEApplication& operator= (const JUCEApplication&);
  9096. public:
  9097. bool initialiseApp (String& commandLine);
  9098. static int shutdownAppAndClearUp();
  9099. };
  9100. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9101. /*** End of inlined file: juce_Application.h ***/
  9102. #endif
  9103. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9104. #endif
  9105. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9106. #endif
  9107. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9108. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9109. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9110. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9111. /*** Start of inlined file: juce_Desktop.h ***/
  9112. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9113. #define __JUCE_DESKTOP_JUCEHEADER__
  9114. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9115. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9116. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9117. class JUCE_API DeletedAtShutdown
  9118. {
  9119. protected:
  9120. DeletedAtShutdown();
  9121. virtual ~DeletedAtShutdown();
  9122. public:
  9123. static void deleteAll();
  9124. private:
  9125. DeletedAtShutdown (const DeletedAtShutdown&);
  9126. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9127. };
  9128. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9129. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9130. /*** Start of inlined file: juce_Timer.h ***/
  9131. #ifndef __JUCE_TIMER_JUCEHEADER__
  9132. #define __JUCE_TIMER_JUCEHEADER__
  9133. class InternalTimerThread;
  9134. class JUCE_API Timer
  9135. {
  9136. protected:
  9137. Timer() throw();
  9138. Timer (const Timer& other) throw();
  9139. public:
  9140. virtual ~Timer();
  9141. virtual void timerCallback() = 0;
  9142. void startTimer (int intervalInMilliseconds) throw();
  9143. void stopTimer() throw();
  9144. bool isTimerRunning() const throw() { return periodMs > 0; }
  9145. int getTimerInterval() const throw() { return periodMs; }
  9146. private:
  9147. friend class InternalTimerThread;
  9148. int countdownMs, periodMs;
  9149. Timer* previous;
  9150. Timer* next;
  9151. Timer& operator= (const Timer&);
  9152. };
  9153. #endif // __JUCE_TIMER_JUCEHEADER__
  9154. /*** End of inlined file: juce_Timer.h ***/
  9155. class MouseInputSource;
  9156. class MouseInputSourceInternal;
  9157. class MouseListener;
  9158. class JUCE_API FocusChangeListener
  9159. {
  9160. public:
  9161. virtual ~FocusChangeListener() {}
  9162. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9163. };
  9164. class JUCE_API Desktop : private DeletedAtShutdown,
  9165. private Timer,
  9166. private AsyncUpdater
  9167. {
  9168. public:
  9169. static Desktop& JUCE_CALLTYPE getInstance();
  9170. const RectangleList getAllMonitorDisplayAreas (bool clippedToWorkArea = true) const throw();
  9171. const Rectangle<int> getMainMonitorArea (bool clippedToWorkArea = true) const throw();
  9172. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, bool clippedToWorkArea = true) const;
  9173. static const Point<int> getMousePosition();
  9174. static void setMousePosition (const Point<int>& newPosition);
  9175. static const Point<int> getLastMouseDownPosition() throw();
  9176. static int getMouseButtonClickCounter() throw();
  9177. static void setScreenSaverEnabled (bool isEnabled) throw();
  9178. static bool isScreenSaverEnabled() throw();
  9179. void addGlobalMouseListener (MouseListener* listener);
  9180. void removeGlobalMouseListener (MouseListener* listener);
  9181. void addFocusChangeListener (FocusChangeListener* listener);
  9182. void removeFocusChangeListener (FocusChangeListener* listener);
  9183. void setKioskModeComponent (Component* componentToUse,
  9184. bool allowMenusAndBars = true);
  9185. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9186. int getNumComponents() const throw();
  9187. Component* getComponent (int index) const throw();
  9188. Component* findComponentAt (const Point<int>& screenPosition) const;
  9189. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9190. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9191. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9192. int getNumDraggingMouseSources() const throw();
  9193. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9194. juce_UseDebuggingNewOperator
  9195. void refreshMonitorSizes();
  9196. static bool canUseSemiTransparentWindows() throw();
  9197. private:
  9198. static Desktop* instance;
  9199. friend class Component;
  9200. friend class ComponentPeer;
  9201. friend class MouseInputSource;
  9202. friend class MouseInputSourceInternal;
  9203. friend class DeletedAtShutdown;
  9204. friend class TopLevelWindowManager;
  9205. OwnedArray <MouseInputSource> mouseSources;
  9206. void createMouseInputSources();
  9207. ListenerList <MouseListener> mouseListeners;
  9208. ListenerList <FocusChangeListener> focusListeners;
  9209. Array <Component*> desktopComponents;
  9210. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9211. Point<int> lastFakeMouseMove;
  9212. void sendMouseMove();
  9213. int mouseClickCounter;
  9214. void incrementMouseClickCounter() throw();
  9215. Component* kioskModeComponent;
  9216. Rectangle<int> kioskComponentOriginalBounds;
  9217. void timerCallback();
  9218. void resetTimer();
  9219. int getNumDisplayMonitors() const throw();
  9220. const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const throw();
  9221. void addDesktopComponent (Component* c);
  9222. void removeDesktopComponent (Component* c);
  9223. void componentBroughtToFront (Component* c);
  9224. void triggerFocusCallback();
  9225. void handleAsyncUpdate();
  9226. Desktop();
  9227. ~Desktop();
  9228. Desktop (const Desktop&);
  9229. Desktop& operator= (const Desktop&);
  9230. };
  9231. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9232. /*** End of inlined file: juce_Desktop.h ***/
  9233. class KeyPressMappingSet;
  9234. class ApplicationCommandManagerListener;
  9235. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9236. private FocusChangeListener
  9237. {
  9238. public:
  9239. ApplicationCommandManager();
  9240. virtual ~ApplicationCommandManager();
  9241. void clearCommands();
  9242. void registerCommand (const ApplicationCommandInfo& newCommand);
  9243. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9244. void removeCommand (CommandID commandID);
  9245. void commandStatusChanged();
  9246. int getNumCommands() const throw() { return commands.size(); }
  9247. const ApplicationCommandInfo* getCommandForIndex (int index) const throw() { return commands [index]; }
  9248. const ApplicationCommandInfo* getCommandForID (CommandID commandID) const throw();
  9249. const String getNameOfCommand (CommandID commandID) const throw();
  9250. const String getDescriptionOfCommand (CommandID commandID) const throw();
  9251. const StringArray getCommandCategories() const throw();
  9252. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9253. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9254. bool invokeDirectly (CommandID commandID, bool asynchronously);
  9255. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9256. bool asynchronously);
  9257. virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
  9258. void setFirstCommandTarget (ApplicationCommandTarget* newTarget) throw();
  9259. ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
  9260. ApplicationCommandInfo& upToDateInfo);
  9261. void addListener (ApplicationCommandManagerListener* listener) throw();
  9262. void removeListener (ApplicationCommandManagerListener* listener) throw();
  9263. static ApplicationCommandTarget* findDefaultComponentTarget();
  9264. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9265. juce_UseDebuggingNewOperator
  9266. private:
  9267. OwnedArray <ApplicationCommandInfo> commands;
  9268. ListenerList <ApplicationCommandManagerListener> listeners;
  9269. ScopedPointer <KeyPressMappingSet> keyMappings;
  9270. ApplicationCommandTarget* firstTarget;
  9271. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9272. void handleAsyncUpdate();
  9273. void globalFocusChanged (Component*);
  9274. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9275. // version of this method.
  9276. virtual short getFirstCommandTarget() { return 0; }
  9277. ApplicationCommandManager (const ApplicationCommandManager&);
  9278. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9279. };
  9280. class JUCE_API ApplicationCommandManagerListener
  9281. {
  9282. public:
  9283. virtual ~ApplicationCommandManagerListener() {}
  9284. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9285. virtual void applicationCommandListChanged() = 0;
  9286. };
  9287. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9288. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9289. #endif
  9290. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9291. #endif
  9292. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9293. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9294. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9295. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9296. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9297. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9298. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9299. class JUCE_API PropertiesFile : public PropertySet,
  9300. public ChangeBroadcaster,
  9301. private Timer
  9302. {
  9303. public:
  9304. enum FileFormatOptions
  9305. {
  9306. ignoreCaseOfKeyNames = 1,
  9307. storeAsBinary = 2,
  9308. storeAsCompressedBinary = 4,
  9309. storeAsXML = 8
  9310. };
  9311. PropertiesFile (const File& file,
  9312. int millisecondsBeforeSaving,
  9313. int optionFlags);
  9314. ~PropertiesFile();
  9315. bool isValidFile() const throw() { return loadedOk; }
  9316. bool saveIfNeeded();
  9317. bool save();
  9318. bool needsToBeSaved() const;
  9319. void setNeedsToBeSaved (bool needsToBeSaved);
  9320. const File getFile() const { return file; }
  9321. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9322. const String& fileNameSuffix,
  9323. const String& folderName,
  9324. bool commonToAllUsers,
  9325. int millisecondsBeforeSaving,
  9326. int propertiesFileOptions);
  9327. static const File getDefaultAppSettingsFile (const String& applicationName,
  9328. const String& fileNameSuffix,
  9329. const String& folderName,
  9330. bool commonToAllUsers);
  9331. juce_UseDebuggingNewOperator
  9332. protected:
  9333. virtual void propertyChanged();
  9334. private:
  9335. File file;
  9336. int timerInterval;
  9337. const int options;
  9338. bool loadedOk, needsWriting;
  9339. void timerCallback();
  9340. PropertiesFile (const PropertiesFile&);
  9341. PropertiesFile& operator= (const PropertiesFile&);
  9342. };
  9343. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9344. /*** End of inlined file: juce_PropertiesFile.h ***/
  9345. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9346. {
  9347. public:
  9348. ApplicationProperties() throw();
  9349. ~ApplicationProperties();
  9350. juce_DeclareSingleton (ApplicationProperties, false)
  9351. void setStorageParameters (const String& applicationName,
  9352. const String& fileNameSuffix,
  9353. const String& folderName,
  9354. int millisecondsBeforeSaving,
  9355. int propertiesFileOptions) throw();
  9356. bool testWriteAccess (bool testUserSettings,
  9357. bool testCommonSettings,
  9358. bool showWarningDialogOnFailure);
  9359. PropertiesFile* getUserSettings() throw();
  9360. PropertiesFile* getCommonSettings (bool returnUserPropsIfReadOnly) throw();
  9361. bool saveIfNeeded();
  9362. void closeFiles();
  9363. juce_UseDebuggingNewOperator
  9364. private:
  9365. ScopedPointer <PropertiesFile> userProps, commonProps;
  9366. String appName, fileSuffix, folderName;
  9367. int msBeforeSaving, options;
  9368. int commonSettingsAreReadOnly;
  9369. ApplicationProperties (const ApplicationProperties&);
  9370. ApplicationProperties& operator= (const ApplicationProperties&);
  9371. void openFiles() throw();
  9372. };
  9373. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9374. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9375. #endif
  9376. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9377. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9378. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9379. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9380. /*** Start of inlined file: juce_AudioFormat.h ***/
  9381. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9382. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9383. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9384. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9385. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9386. class AudioFormat;
  9387. class JUCE_API AudioFormatReader
  9388. {
  9389. protected:
  9390. AudioFormatReader (InputStream* const sourceStream,
  9391. const String& formatName);
  9392. public:
  9393. virtual ~AudioFormatReader();
  9394. const String getFormatName() const throw() { return formatName; }
  9395. bool read (int** destSamples,
  9396. int numDestChannels,
  9397. int64 startSampleInSource,
  9398. int numSamplesToRead,
  9399. const bool fillLeftoverChannelsWithCopies);
  9400. virtual void readMaxLevels (int64 startSample,
  9401. int64 numSamples,
  9402. float& lowestLeft,
  9403. float& highestLeft,
  9404. float& lowestRight,
  9405. float& highestRight);
  9406. int64 searchForLevel (int64 startSample,
  9407. int64 numSamplesToSearch,
  9408. const double magnitudeRangeMinimum,
  9409. const double magnitudeRangeMaximum,
  9410. const int minimumConsecutiveSamples);
  9411. double sampleRate;
  9412. unsigned int bitsPerSample;
  9413. int64 lengthInSamples;
  9414. unsigned int numChannels;
  9415. bool usesFloatingPointData;
  9416. StringPairArray metadataValues;
  9417. InputStream* input;
  9418. virtual bool readSamples (int** destSamples,
  9419. int numDestChannels,
  9420. int startOffsetInDestBuffer,
  9421. int64 startSampleInFile,
  9422. int numSamples) = 0;
  9423. juce_UseDebuggingNewOperator
  9424. private:
  9425. String formatName;
  9426. AudioFormatReader (const AudioFormatReader&);
  9427. AudioFormatReader& operator= (const AudioFormatReader&);
  9428. };
  9429. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9430. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9431. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9432. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9433. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9434. /*** Start of inlined file: juce_AudioSource.h ***/
  9435. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9436. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9437. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9438. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9439. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9440. class AudioFormatReader;
  9441. class AudioFormatWriter;
  9442. class JUCE_API AudioSampleBuffer
  9443. {
  9444. public:
  9445. AudioSampleBuffer (const int numChannels,
  9446. const int numSamples) throw();
  9447. AudioSampleBuffer (float** dataToReferTo,
  9448. const int numChannels,
  9449. const int numSamples) throw();
  9450. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9451. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9452. virtual ~AudioSampleBuffer() throw();
  9453. int getNumChannels() const throw() { return numChannels; }
  9454. int getNumSamples() const throw() { return size; }
  9455. float* getSampleData (const int channelNumber) const throw()
  9456. {
  9457. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9458. return channels [channelNumber];
  9459. }
  9460. float* getSampleData (const int channelNumber,
  9461. const int sampleOffset) const throw()
  9462. {
  9463. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9464. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9465. return channels [channelNumber] + sampleOffset;
  9466. }
  9467. float** getArrayOfChannels() const throw() { return channels; }
  9468. void setSize (const int newNumChannels,
  9469. const int newNumSamples,
  9470. const bool keepExistingContent = false,
  9471. const bool clearExtraSpace = false,
  9472. const bool avoidReallocating = false) throw();
  9473. void setDataToReferTo (float** dataToReferTo,
  9474. const int numChannels,
  9475. const int numSamples) throw();
  9476. void clear() throw();
  9477. void clear (const int startSample,
  9478. const int numSamples) throw();
  9479. void clear (const int channel,
  9480. const int startSample,
  9481. const int numSamples) throw();
  9482. void applyGain (const int channel,
  9483. const int startSample,
  9484. int numSamples,
  9485. const float gain) throw();
  9486. void applyGain (const int startSample,
  9487. const int numSamples,
  9488. const float gain) throw();
  9489. void applyGainRamp (const int channel,
  9490. const int startSample,
  9491. int numSamples,
  9492. float startGain,
  9493. float endGain) throw();
  9494. void addFrom (const int destChannel,
  9495. const int destStartSample,
  9496. const AudioSampleBuffer& source,
  9497. const int sourceChannel,
  9498. const int sourceStartSample,
  9499. int numSamples,
  9500. const float gainToApplyToSource = 1.0f) throw();
  9501. void addFrom (const int destChannel,
  9502. const int destStartSample,
  9503. const float* source,
  9504. int numSamples,
  9505. const float gainToApplyToSource = 1.0f) throw();
  9506. void addFromWithRamp (const int destChannel,
  9507. const int destStartSample,
  9508. const float* source,
  9509. int numSamples,
  9510. float startGain,
  9511. float endGain) throw();
  9512. void copyFrom (const int destChannel,
  9513. const int destStartSample,
  9514. const AudioSampleBuffer& source,
  9515. const int sourceChannel,
  9516. const int sourceStartSample,
  9517. int numSamples) throw();
  9518. void copyFrom (const int destChannel,
  9519. const int destStartSample,
  9520. const float* source,
  9521. int numSamples) throw();
  9522. void copyFrom (const int destChannel,
  9523. const int destStartSample,
  9524. const float* source,
  9525. int numSamples,
  9526. const float gain) throw();
  9527. void copyFromWithRamp (const int destChannel,
  9528. const int destStartSample,
  9529. const float* source,
  9530. int numSamples,
  9531. float startGain,
  9532. float endGain) throw();
  9533. void findMinMax (const int channel,
  9534. const int startSample,
  9535. int numSamples,
  9536. float& minVal,
  9537. float& maxVal) const throw();
  9538. float getMagnitude (const int channel,
  9539. const int startSample,
  9540. const int numSamples) const throw();
  9541. float getMagnitude (const int startSample,
  9542. const int numSamples) const throw();
  9543. float getRMSLevel (const int channel,
  9544. const int startSample,
  9545. const int numSamples) const throw();
  9546. void readFromAudioReader (AudioFormatReader* reader,
  9547. const int startSample,
  9548. const int numSamples,
  9549. const int readerStartSample,
  9550. const bool useReaderLeftChan,
  9551. const bool useReaderRightChan) throw();
  9552. void writeToAudioWriter (AudioFormatWriter* writer,
  9553. const int startSample,
  9554. const int numSamples) const throw();
  9555. juce_UseDebuggingNewOperator
  9556. private:
  9557. int numChannels, size;
  9558. size_t allocatedBytes;
  9559. float** channels;
  9560. HeapBlock <char> allocatedData;
  9561. float* preallocatedChannelSpace [32];
  9562. void allocateData();
  9563. void allocateChannels (float** const dataToReferTo);
  9564. };
  9565. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9566. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9567. struct JUCE_API AudioSourceChannelInfo
  9568. {
  9569. AudioSampleBuffer* buffer;
  9570. int startSample;
  9571. int numSamples;
  9572. void clearActiveBufferRegion() const
  9573. {
  9574. if (buffer != 0)
  9575. buffer->clear (startSample, numSamples);
  9576. }
  9577. };
  9578. class JUCE_API AudioSource
  9579. {
  9580. protected:
  9581. AudioSource() throw() {}
  9582. public:
  9583. virtual ~AudioSource() {}
  9584. virtual void prepareToPlay (int samplesPerBlockExpected,
  9585. double sampleRate) = 0;
  9586. virtual void releaseResources() = 0;
  9587. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9588. };
  9589. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9590. /*** End of inlined file: juce_AudioSource.h ***/
  9591. class JUCE_API AudioFormatWriter
  9592. {
  9593. protected:
  9594. AudioFormatWriter (OutputStream* const destStream,
  9595. const String& formatName,
  9596. const double sampleRate,
  9597. const unsigned int numberOfChannels,
  9598. const unsigned int bitsPerSample);
  9599. public:
  9600. virtual ~AudioFormatWriter();
  9601. const String getFormatName() const throw() { return formatName; }
  9602. virtual bool write (const int** samplesToWrite,
  9603. int numSamples) = 0;
  9604. bool writeFromAudioReader (AudioFormatReader& reader,
  9605. int64 startSample,
  9606. int64 numSamplesToRead);
  9607. bool writeFromAudioSource (AudioSource& source,
  9608. int numSamplesToRead,
  9609. const int samplesPerBlock = 2048);
  9610. double getSampleRate() const throw() { return sampleRate; }
  9611. int getNumChannels() const throw() { return numChannels; }
  9612. int getBitsPerSample() const throw() { return bitsPerSample; }
  9613. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9614. juce_UseDebuggingNewOperator
  9615. protected:
  9616. double sampleRate;
  9617. unsigned int numChannels;
  9618. unsigned int bitsPerSample;
  9619. bool usesFloatingPointData;
  9620. OutputStream* output;
  9621. private:
  9622. String formatName;
  9623. AudioFormatWriter (const AudioFormatWriter&);
  9624. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9625. };
  9626. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9627. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9628. class JUCE_API AudioFormat
  9629. {
  9630. public:
  9631. virtual ~AudioFormat();
  9632. const String& getFormatName() const;
  9633. const StringArray& getFileExtensions() const;
  9634. virtual bool canHandleFile (const File& fileToTest);
  9635. virtual const Array <int> getPossibleSampleRates() = 0;
  9636. virtual const Array <int> getPossibleBitDepths() = 0;
  9637. virtual bool canDoStereo() = 0;
  9638. virtual bool canDoMono() = 0;
  9639. virtual bool isCompressed();
  9640. virtual const StringArray getQualityOptions();
  9641. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9642. const bool deleteStreamIfOpeningFails) = 0;
  9643. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9644. double sampleRateToUse,
  9645. unsigned int numberOfChannels,
  9646. int bitsPerSample,
  9647. const StringPairArray& metadataValues,
  9648. int qualityOptionIndex) = 0;
  9649. protected:
  9650. AudioFormat (const String& formatName,
  9651. const tchar** const fileExtensions);
  9652. private:
  9653. String formatName;
  9654. StringArray fileExtensions;
  9655. };
  9656. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9657. /*** End of inlined file: juce_AudioFormat.h ***/
  9658. class JUCE_API AiffAudioFormat : public AudioFormat
  9659. {
  9660. public:
  9661. AiffAudioFormat();
  9662. ~AiffAudioFormat();
  9663. const Array <int> getPossibleSampleRates();
  9664. const Array <int> getPossibleBitDepths();
  9665. bool canDoStereo();
  9666. bool canDoMono();
  9667. #if JUCE_MAC
  9668. bool canHandleFile (const File& fileToTest);
  9669. #endif
  9670. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9671. const bool deleteStreamIfOpeningFails);
  9672. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9673. double sampleRateToUse,
  9674. unsigned int numberOfChannels,
  9675. int bitsPerSample,
  9676. const StringPairArray& metadataValues,
  9677. int qualityOptionIndex);
  9678. juce_UseDebuggingNewOperator
  9679. };
  9680. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9681. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9682. #endif
  9683. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9684. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9685. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9686. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9687. #if JUCE_USE_CDBURNER
  9688. class AudioCDBurner : public ChangeBroadcaster
  9689. {
  9690. public:
  9691. static const StringArray findAvailableDevices();
  9692. static AudioCDBurner* openDevice (const int deviceIndex);
  9693. ~AudioCDBurner();
  9694. enum DiskState
  9695. {
  9696. unknown, /**< An error condition, if the device isn't responding. */
  9697. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9698. may seem to be permanently open. */
  9699. noDisc, /**< The drive has no disk in it. */
  9700. writableDiskPresent, /**< The drive contains a writeable disk. */
  9701. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9702. };
  9703. DiskState getDiskState() const;
  9704. bool isDiskPresent() const;
  9705. bool openTray();
  9706. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9707. const Array<int> getAvailableWriteSpeeds() const;
  9708. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9709. int getNumAvailableAudioBlocks() const;
  9710. bool addAudioTrack (AudioSource* source, int numSamples);
  9711. class BurnProgressListener
  9712. {
  9713. public:
  9714. BurnProgressListener() throw() {}
  9715. virtual ~BurnProgressListener() {}
  9716. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9717. };
  9718. const String burn (BurnProgressListener* listener,
  9719. bool ejectDiscAfterwards,
  9720. bool performFakeBurnForTesting,
  9721. int writeSpeed);
  9722. void abortBurn();
  9723. juce_UseDebuggingNewOperator
  9724. private:
  9725. AudioCDBurner (const int deviceIndex);
  9726. class Pimpl;
  9727. friend class ScopedPointer<Pimpl>;
  9728. ScopedPointer<Pimpl> pimpl;
  9729. };
  9730. #endif
  9731. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9732. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9733. #endif
  9734. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9735. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9736. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9737. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9738. #if JUCE_USE_CDREADER
  9739. #if JUCE_MAC
  9740. #endif
  9741. class JUCE_API AudioCDReader : public AudioFormatReader
  9742. {
  9743. public:
  9744. static const StringArray getAvailableCDNames();
  9745. static AudioCDReader* createReaderForCD (const int index);
  9746. ~AudioCDReader();
  9747. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9748. int64 startSampleInFile, int numSamples);
  9749. bool isCDStillPresent() const;
  9750. int getNumTracks() const;
  9751. int getPositionOfTrackStart (int trackNum) const;
  9752. bool isTrackAudio (int trackNum) const;
  9753. void refreshTrackLengths();
  9754. void enableIndexScanning (bool enabled);
  9755. int getLastIndex() const;
  9756. const Array <int> findIndexesInTrack (const int trackNumber);
  9757. int getCDDBId();
  9758. void ejectDisk();
  9759. juce_UseDebuggingNewOperator
  9760. private:
  9761. #if JUCE_MAC
  9762. File volumeDir;
  9763. Array<File> tracks;
  9764. Array<int> trackStartSamples;
  9765. int currentReaderTrack;
  9766. ScopedPointer <AudioFormatReader> reader;
  9767. AudioCDReader (const File& volume);
  9768. public:
  9769. static int compareElements (const File&, const File&);
  9770. private:
  9771. #elif JUCE_WINDOWS
  9772. int numTracks;
  9773. int trackStarts[100];
  9774. bool audioTracks [100];
  9775. void* handle;
  9776. bool indexingEnabled;
  9777. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9778. MemoryBlock buffer;
  9779. AudioCDReader (void* handle);
  9780. int getIndexAt (int samplePos);
  9781. #elif JUCE_LINUX
  9782. AudioCDReader();
  9783. #endif
  9784. AudioCDReader (const AudioCDReader&);
  9785. AudioCDReader& operator= (const AudioCDReader&);
  9786. };
  9787. #endif
  9788. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9789. /*** End of inlined file: juce_AudioCDReader.h ***/
  9790. #endif
  9791. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9792. #endif
  9793. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9794. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9795. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9796. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9797. class JUCE_API AudioFormatManager
  9798. {
  9799. public:
  9800. AudioFormatManager();
  9801. ~AudioFormatManager();
  9802. juce_DeclareSingleton (AudioFormatManager, false);
  9803. void registerFormat (AudioFormat* newFormat,
  9804. const bool makeThisTheDefaultFormat);
  9805. void registerBasicFormats();
  9806. void clearFormats();
  9807. int getNumKnownFormats() const;
  9808. AudioFormat* getKnownFormat (const int index) const;
  9809. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9810. AudioFormat* getDefaultFormat() const;
  9811. const String getWildcardForAllFormats() const;
  9812. AudioFormatReader* createReaderFor (const File& audioFile);
  9813. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9814. juce_UseDebuggingNewOperator
  9815. private:
  9816. VoidArray knownFormats;
  9817. int defaultFormatIndex;
  9818. };
  9819. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9820. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9821. #endif
  9822. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9823. #endif
  9824. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9825. #endif
  9826. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9827. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9828. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9829. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9830. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9831. {
  9832. public:
  9833. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9834. const int64 subsectionStartSample,
  9835. const int64 subsectionLength,
  9836. const bool deleteSourceWhenDeleted);
  9837. ~AudioSubsectionReader();
  9838. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9839. int64 startSampleInFile, int numSamples);
  9840. void readMaxLevels (int64 startSample,
  9841. int64 numSamples,
  9842. float& lowestLeft,
  9843. float& highestLeft,
  9844. float& lowestRight,
  9845. float& highestRight);
  9846. juce_UseDebuggingNewOperator
  9847. private:
  9848. AudioFormatReader* const source;
  9849. int64 startSample, length;
  9850. const bool deleteSourceWhenDeleted;
  9851. AudioSubsectionReader (const AudioSubsectionReader&);
  9852. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9853. };
  9854. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9855. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9856. #endif
  9857. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9858. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9859. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9860. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9861. class AudioThumbnailCache;
  9862. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9863. public TimeSliceClient,
  9864. private Timer
  9865. {
  9866. public:
  9867. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9868. AudioFormatManager& formatManagerToUse,
  9869. AudioThumbnailCache& cacheToUse);
  9870. ~AudioThumbnail();
  9871. void setSource (InputSource* const newSource);
  9872. void loadFrom (InputStream& input);
  9873. void saveTo (OutputStream& output) const;
  9874. int getNumChannels() const throw();
  9875. double getTotalLength() const throw();
  9876. void drawChannel (Graphics& g,
  9877. int x, int y, int w, int h,
  9878. double startTimeSeconds,
  9879. double endTimeSeconds,
  9880. int channelNum,
  9881. const float verticalZoomFactor);
  9882. bool isFullyLoaded() const throw();
  9883. bool useTimeSlice();
  9884. void timerCallback();
  9885. juce_UseDebuggingNewOperator
  9886. private:
  9887. AudioFormatManager& formatManagerToUse;
  9888. AudioThumbnailCache& cache;
  9889. ScopedPointer <InputSource> source;
  9890. CriticalSection readerLock;
  9891. ScopedPointer <AudioFormatReader> reader;
  9892. MemoryBlock data, cachedLevels;
  9893. int orginalSamplesPerThumbnailSample;
  9894. int numChannelsCached, numSamplesCached;
  9895. double cachedStart, cachedTimePerPixel;
  9896. bool cacheNeedsRefilling;
  9897. void clear();
  9898. AudioFormatReader* createReader() const;
  9899. void generateSection (AudioFormatReader& reader,
  9900. int64 startSample,
  9901. int numSamples);
  9902. char* getChannelData (int channel) const;
  9903. void refillCache (const int numSamples,
  9904. double startTime,
  9905. const double timePerPixel);
  9906. friend class AudioThumbnailCache;
  9907. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9908. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9909. // returns true if more needs to be read
  9910. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9911. };
  9912. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9913. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9914. #endif
  9915. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9916. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9917. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9918. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9919. struct ThumbnailCacheEntry;
  9920. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9921. {
  9922. public:
  9923. AudioThumbnailCache (const int maxNumThumbsToStore);
  9924. ~AudioThumbnailCache();
  9925. void clear();
  9926. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9927. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9928. juce_UseDebuggingNewOperator
  9929. private:
  9930. OwnedArray <ThumbnailCacheEntry> thumbs;
  9931. int maxNumThumbsToStore;
  9932. friend class AudioThumbnail;
  9933. void addThumbnail (AudioThumbnail* const thumb);
  9934. void removeThumbnail (AudioThumbnail* const thumb);
  9935. };
  9936. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9937. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9938. #endif
  9939. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9940. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  9941. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9942. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9943. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9944. class JUCE_API FlacAudioFormat : public AudioFormat
  9945. {
  9946. public:
  9947. FlacAudioFormat();
  9948. ~FlacAudioFormat();
  9949. const Array <int> getPossibleSampleRates();
  9950. const Array <int> getPossibleBitDepths();
  9951. bool canDoStereo();
  9952. bool canDoMono();
  9953. bool isCompressed();
  9954. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9955. const bool deleteStreamIfOpeningFails);
  9956. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9957. double sampleRateToUse,
  9958. unsigned int numberOfChannels,
  9959. int bitsPerSample,
  9960. const StringPairArray& metadataValues,
  9961. int qualityOptionIndex);
  9962. juce_UseDebuggingNewOperator
  9963. };
  9964. #endif
  9965. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9966. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  9967. #endif
  9968. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9969. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  9970. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9971. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9972. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9973. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9974. {
  9975. public:
  9976. OggVorbisAudioFormat();
  9977. ~OggVorbisAudioFormat();
  9978. const Array <int> getPossibleSampleRates();
  9979. const Array <int> getPossibleBitDepths();
  9980. bool canDoStereo();
  9981. bool canDoMono();
  9982. bool isCompressed();
  9983. const StringArray getQualityOptions();
  9984. int estimateOggFileQuality (const File& source);
  9985. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9986. const bool deleteStreamIfOpeningFails);
  9987. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9988. double sampleRateToUse,
  9989. unsigned int numberOfChannels,
  9990. int bitsPerSample,
  9991. const StringPairArray& metadataValues,
  9992. int qualityOptionIndex);
  9993. juce_UseDebuggingNewOperator
  9994. };
  9995. #endif
  9996. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9997. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  9998. #endif
  9999. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10000. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10001. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10002. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10003. #if JUCE_QUICKTIME
  10004. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10005. {
  10006. public:
  10007. QuickTimeAudioFormat();
  10008. ~QuickTimeAudioFormat();
  10009. const Array <int> getPossibleSampleRates();
  10010. const Array <int> getPossibleBitDepths();
  10011. bool canDoStereo();
  10012. bool canDoMono();
  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_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10025. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10026. #endif
  10027. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10028. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10029. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10030. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10031. class JUCE_API WavAudioFormat : public AudioFormat
  10032. {
  10033. public:
  10034. WavAudioFormat();
  10035. ~WavAudioFormat();
  10036. static const tchar* const bwavDescription;
  10037. static const tchar* const bwavOriginator;
  10038. static const tchar* const bwavOriginatorRef;
  10039. static const tchar* const bwavOriginationDate;
  10040. static const tchar* const bwavOriginationTime;
  10041. static const tchar* const bwavTimeReference;
  10042. static const tchar* const bwavCodingHistory;
  10043. static const StringPairArray createBWAVMetadata (const String& description,
  10044. const String& originator,
  10045. const String& originatorRef,
  10046. const Time& dateAndTime,
  10047. const int64 timeReferenceSamples,
  10048. const String& codingHistory);
  10049. const Array <int> getPossibleSampleRates();
  10050. const Array <int> getPossibleBitDepths();
  10051. bool canDoStereo();
  10052. bool canDoMono();
  10053. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10054. const bool deleteStreamIfOpeningFails);
  10055. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10056. double sampleRateToUse,
  10057. unsigned int numberOfChannels,
  10058. int bitsPerSample,
  10059. const StringPairArray& metadataValues,
  10060. int qualityOptionIndex);
  10061. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10062. juce_UseDebuggingNewOperator
  10063. };
  10064. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10065. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10066. #endif
  10067. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10068. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10069. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10070. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10071. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10072. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10073. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10074. class JUCE_API PositionableAudioSource : public AudioSource
  10075. {
  10076. protected:
  10077. PositionableAudioSource() throw() {}
  10078. public:
  10079. ~PositionableAudioSource() {}
  10080. virtual void setNextReadPosition (int newPosition) = 0;
  10081. virtual int getNextReadPosition() const = 0;
  10082. virtual int getTotalLength() const = 0;
  10083. virtual bool isLooping() const = 0;
  10084. };
  10085. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10086. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10087. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10088. {
  10089. public:
  10090. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10091. const bool deleteReaderWhenThisIsDeleted);
  10092. ~AudioFormatReaderSource();
  10093. void setLooping (const bool shouldLoop) throw();
  10094. bool isLooping() const { return looping; }
  10095. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10096. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10097. void releaseResources();
  10098. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10099. void setNextReadPosition (int newPosition);
  10100. int getNextReadPosition() const;
  10101. int getTotalLength() const;
  10102. juce_UseDebuggingNewOperator
  10103. private:
  10104. AudioFormatReader* reader;
  10105. bool deleteReader;
  10106. int volatile nextPlayPos;
  10107. bool volatile looping;
  10108. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10109. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10110. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10111. };
  10112. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10113. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10114. #endif
  10115. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10116. #endif
  10117. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10118. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10119. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10120. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10121. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10122. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10123. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10124. class AudioIODevice;
  10125. class JUCE_API AudioIODeviceCallback
  10126. {
  10127. public:
  10128. virtual ~AudioIODeviceCallback() {}
  10129. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10130. int numInputChannels,
  10131. float** outputChannelData,
  10132. int numOutputChannels,
  10133. int numSamples) = 0;
  10134. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10135. virtual void audioDeviceStopped() = 0;
  10136. };
  10137. class JUCE_API AudioIODevice
  10138. {
  10139. public:
  10140. virtual ~AudioIODevice();
  10141. const String& getName() const throw() { return name; }
  10142. const String& getTypeName() const throw() { return typeName; }
  10143. virtual const StringArray getOutputChannelNames() = 0;
  10144. virtual const StringArray getInputChannelNames() = 0;
  10145. virtual int getNumSampleRates() = 0;
  10146. virtual double getSampleRate (int index) = 0;
  10147. virtual int getNumBufferSizesAvailable() = 0;
  10148. virtual int getBufferSizeSamples (int index) = 0;
  10149. virtual int getDefaultBufferSize() = 0;
  10150. virtual const String open (const BigInteger& inputChannels,
  10151. const BigInteger& outputChannels,
  10152. double sampleRate,
  10153. int bufferSizeSamples) = 0;
  10154. virtual void close() = 0;
  10155. virtual bool isOpen() = 0;
  10156. virtual void start (AudioIODeviceCallback* callback) = 0;
  10157. virtual void stop() = 0;
  10158. virtual bool isPlaying() = 0;
  10159. virtual const String getLastError() = 0;
  10160. virtual int getCurrentBufferSizeSamples() = 0;
  10161. virtual double getCurrentSampleRate() = 0;
  10162. virtual int getCurrentBitDepth() = 0;
  10163. virtual const BigInteger getActiveOutputChannels() const = 0;
  10164. virtual const BigInteger getActiveInputChannels() const = 0;
  10165. virtual int getOutputLatencyInSamples() = 0;
  10166. virtual int getInputLatencyInSamples() = 0;
  10167. virtual bool hasControlPanel() const;
  10168. virtual bool showControlPanel();
  10169. protected:
  10170. AudioIODevice (const String& deviceName,
  10171. const String& typeName);
  10172. String name, typeName;
  10173. };
  10174. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10175. /*** End of inlined file: juce_AudioIODevice.h ***/
  10176. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10177. {
  10178. public:
  10179. AudioSourcePlayer();
  10180. virtual ~AudioSourcePlayer();
  10181. void setSource (AudioSource* newSource);
  10182. AudioSource* getCurrentSource() const throw() { return source; }
  10183. void setGain (const float newGain) throw();
  10184. void audioDeviceIOCallback (const float** inputChannelData,
  10185. int totalNumInputChannels,
  10186. float** outputChannelData,
  10187. int totalNumOutputChannels,
  10188. int numSamples);
  10189. void audioDeviceAboutToStart (AudioIODevice* device);
  10190. void audioDeviceStopped();
  10191. juce_UseDebuggingNewOperator
  10192. private:
  10193. CriticalSection readLock;
  10194. AudioSource* source;
  10195. double sampleRate;
  10196. int bufferSize;
  10197. float* channels [128];
  10198. float* outputChans [128];
  10199. const float* inputChans [128];
  10200. AudioSampleBuffer tempBuffer;
  10201. float lastGain, gain;
  10202. AudioSourcePlayer (const AudioSourcePlayer&);
  10203. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10204. };
  10205. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10206. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10207. #endif
  10208. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10209. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10210. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10211. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10212. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10213. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10214. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10215. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10216. {
  10217. public:
  10218. BufferingAudioSource (PositionableAudioSource* source,
  10219. const bool deleteSourceWhenDeleted,
  10220. int numberOfSamplesToBuffer);
  10221. ~BufferingAudioSource();
  10222. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10223. void releaseResources();
  10224. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10225. void setNextReadPosition (int newPosition);
  10226. int getNextReadPosition() const;
  10227. int getTotalLength() const { return source->getTotalLength(); }
  10228. bool isLooping() const { return source->isLooping(); }
  10229. juce_UseDebuggingNewOperator
  10230. private:
  10231. PositionableAudioSource* source;
  10232. bool deleteSourceWhenDeleted;
  10233. int numberOfSamplesToBuffer;
  10234. AudioSampleBuffer buffer;
  10235. CriticalSection bufferStartPosLock;
  10236. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10237. bool wasSourceLooping;
  10238. double volatile sampleRate;
  10239. friend class SharedBufferingAudioSourceThread;
  10240. bool readNextBufferChunk();
  10241. void readBufferSection (int start, int length, int bufferOffset);
  10242. BufferingAudioSource (const BufferingAudioSource&);
  10243. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10244. };
  10245. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10246. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10247. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10248. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10249. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10250. class JUCE_API ResamplingAudioSource : public AudioSource
  10251. {
  10252. public:
  10253. ResamplingAudioSource (AudioSource* const inputSource,
  10254. const bool deleteInputWhenDeleted);
  10255. ~ResamplingAudioSource();
  10256. void setResamplingRatio (const double samplesInPerOutputSample);
  10257. double getResamplingRatio() const throw() { return ratio; }
  10258. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10259. void releaseResources();
  10260. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10261. juce_UseDebuggingNewOperator
  10262. private:
  10263. AudioSource* const input;
  10264. const bool deleteInputWhenDeleted;
  10265. double ratio, lastRatio;
  10266. AudioSampleBuffer buffer;
  10267. int bufferPos, sampsInBuffer;
  10268. double subSampleOffset;
  10269. double coefficients[6];
  10270. CriticalSection ratioLock;
  10271. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10272. void createLowPass (const double proportionalRate);
  10273. struct FilterState
  10274. {
  10275. double x1, x2, y1, y2;
  10276. };
  10277. FilterState filterStates[2];
  10278. void resetFilters();
  10279. void applyFilter (float* samples, int num, FilterState& fs);
  10280. ResamplingAudioSource (const ResamplingAudioSource&);
  10281. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10282. };
  10283. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10284. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10285. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10286. public ChangeBroadcaster
  10287. {
  10288. public:
  10289. AudioTransportSource();
  10290. ~AudioTransportSource();
  10291. void setSource (PositionableAudioSource* const newSource,
  10292. int readAheadBufferSize = 0,
  10293. double sourceSampleRateToCorrectFor = 0.0);
  10294. void setPosition (double newPosition);
  10295. double getCurrentPosition() const;
  10296. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10297. void start();
  10298. void stop();
  10299. bool isPlaying() const throw() { return playing; }
  10300. void setGain (const float newGain) throw();
  10301. float getGain() const throw() { return gain; }
  10302. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10303. void releaseResources();
  10304. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10305. void setNextReadPosition (int newPosition);
  10306. int getNextReadPosition() const;
  10307. int getTotalLength() const;
  10308. bool isLooping() const;
  10309. juce_UseDebuggingNewOperator
  10310. private:
  10311. PositionableAudioSource* source;
  10312. ResamplingAudioSource* resamplerSource;
  10313. BufferingAudioSource* bufferingSource;
  10314. PositionableAudioSource* positionableSource;
  10315. AudioSource* masterSource;
  10316. CriticalSection callbackLock;
  10317. float volatile gain, lastGain;
  10318. bool volatile playing, stopped;
  10319. double sampleRate, sourceSampleRate;
  10320. int blockSize, readAheadBufferSize;
  10321. bool isPrepared, inputStreamEOF;
  10322. AudioTransportSource (const AudioTransportSource&);
  10323. AudioTransportSource& operator= (const AudioTransportSource&);
  10324. };
  10325. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10326. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10327. #endif
  10328. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10329. #endif
  10330. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10331. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10332. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10333. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10334. class ChannelRemappingAudioSource : public AudioSource
  10335. {
  10336. public:
  10337. ChannelRemappingAudioSource (AudioSource* const source,
  10338. const bool deleteSourceWhenDeleted);
  10339. ~ChannelRemappingAudioSource();
  10340. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10341. void clearAllMappings() throw();
  10342. void setInputChannelMapping (const int destChannelIndex,
  10343. const int sourceChannelIndex) throw();
  10344. void setOutputChannelMapping (const int sourceChannelIndex,
  10345. const int destChannelIndex) throw();
  10346. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10347. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10348. XmlElement* createXml() const throw();
  10349. void restoreFromXml (const XmlElement& e) throw();
  10350. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10351. void releaseResources();
  10352. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10353. juce_UseDebuggingNewOperator
  10354. private:
  10355. int requiredNumberOfChannels;
  10356. Array <int> remappedInputs, remappedOutputs;
  10357. AudioSource* const source;
  10358. const bool deleteSourceWhenDeleted;
  10359. AudioSampleBuffer buffer;
  10360. AudioSourceChannelInfo remappedInfo;
  10361. CriticalSection lock;
  10362. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10363. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10364. };
  10365. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10366. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10367. #endif
  10368. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10369. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10370. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10371. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10372. /*** Start of inlined file: juce_IIRFilter.h ***/
  10373. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10374. #define __JUCE_IIRFILTER_JUCEHEADER__
  10375. class JUCE_API IIRFilter
  10376. {
  10377. public:
  10378. IIRFilter();
  10379. IIRFilter (const IIRFilter& other);
  10380. ~IIRFilter();
  10381. void reset() throw();
  10382. void processSamples (float* const samples,
  10383. const int numSamples) throw();
  10384. float processSingleSampleRaw (const float sample) throw();
  10385. void makeLowPass (const double sampleRate,
  10386. const double frequency) throw();
  10387. void makeHighPass (const double sampleRate,
  10388. const double frequency) throw();
  10389. void makeLowShelf (const double sampleRate,
  10390. const double cutOffFrequency,
  10391. const double Q,
  10392. const float gainFactor) throw();
  10393. void makeHighShelf (const double sampleRate,
  10394. const double cutOffFrequency,
  10395. const double Q,
  10396. const float gainFactor) throw();
  10397. void makeBandPass (const double sampleRate,
  10398. const double centreFrequency,
  10399. const double Q,
  10400. const float gainFactor) throw();
  10401. void makeInactive() throw();
  10402. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10403. juce_UseDebuggingNewOperator
  10404. protected:
  10405. CriticalSection processLock;
  10406. void setCoefficients (double c1, double c2, double c3,
  10407. double c4, double c5, double c6) throw();
  10408. bool active;
  10409. float coefficients[6];
  10410. float x1, x2, y1, y2;
  10411. // (use the copyCoefficientsFrom() method instead of this operator)
  10412. IIRFilter& operator= (const IIRFilter&);
  10413. };
  10414. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10415. /*** End of inlined file: juce_IIRFilter.h ***/
  10416. class JUCE_API IIRFilterAudioSource : public AudioSource
  10417. {
  10418. public:
  10419. IIRFilterAudioSource (AudioSource* const inputSource,
  10420. const bool deleteInputWhenDeleted);
  10421. ~IIRFilterAudioSource();
  10422. void setFilterParameters (const IIRFilter& newSettings);
  10423. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10424. void releaseResources();
  10425. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10426. juce_UseDebuggingNewOperator
  10427. private:
  10428. AudioSource* const input;
  10429. const bool deleteInputWhenDeleted;
  10430. OwnedArray <IIRFilter> iirFilters;
  10431. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10432. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10433. };
  10434. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10435. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10436. #endif
  10437. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10438. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10439. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10440. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10441. class JUCE_API MixerAudioSource : public AudioSource
  10442. {
  10443. public:
  10444. MixerAudioSource();
  10445. ~MixerAudioSource();
  10446. void addInputSource (AudioSource* newInput,
  10447. const bool deleteWhenRemoved);
  10448. void removeInputSource (AudioSource* input,
  10449. const bool deleteSource);
  10450. void removeAllInputs();
  10451. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10452. void releaseResources();
  10453. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10454. juce_UseDebuggingNewOperator
  10455. private:
  10456. VoidArray inputs;
  10457. BigInteger inputsToDelete;
  10458. CriticalSection lock;
  10459. AudioSampleBuffer tempBuffer;
  10460. double currentSampleRate;
  10461. int bufferSizeExpected;
  10462. MixerAudioSource (const MixerAudioSource&);
  10463. MixerAudioSource& operator= (const MixerAudioSource&);
  10464. };
  10465. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10466. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10467. #endif
  10468. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10469. #endif
  10470. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10471. #endif
  10472. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10473. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10474. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10475. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10476. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10477. {
  10478. public:
  10479. ToneGeneratorAudioSource();
  10480. ~ToneGeneratorAudioSource();
  10481. void setAmplitude (const float newAmplitude);
  10482. void setFrequency (const double newFrequencyHz);
  10483. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10484. void releaseResources();
  10485. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10486. juce_UseDebuggingNewOperator
  10487. private:
  10488. double frequency, sampleRate;
  10489. double currentPhase, phasePerSample;
  10490. float amplitude;
  10491. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10492. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10493. };
  10494. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10495. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10496. #endif
  10497. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10498. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10499. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10500. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10501. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10502. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10503. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10504. class AudioDeviceManager;
  10505. class Component;
  10506. class JUCE_API AudioIODeviceType
  10507. {
  10508. public:
  10509. const String& getTypeName() const throw() { return typeName; }
  10510. virtual void scanForDevices() = 0;
  10511. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10512. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10513. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10514. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10515. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10516. const String& inputDeviceName) = 0;
  10517. struct DeviceSetupDetails
  10518. {
  10519. AudioDeviceManager* manager;
  10520. int minNumInputChannels, maxNumInputChannels;
  10521. int minNumOutputChannels, maxNumOutputChannels;
  10522. bool useStereoPairs;
  10523. };
  10524. virtual ~AudioIODeviceType();
  10525. protected:
  10526. AudioIODeviceType (const String& typeName);
  10527. private:
  10528. String typeName;
  10529. AudioIODeviceType (const AudioIODeviceType&);
  10530. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10531. };
  10532. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10533. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10534. /*** Start of inlined file: juce_MidiInput.h ***/
  10535. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10536. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10537. /*** Start of inlined file: juce_MidiMessage.h ***/
  10538. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10539. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10540. class JUCE_API MidiMessage
  10541. {
  10542. public:
  10543. MidiMessage (const int byte1,
  10544. const int byte2,
  10545. const int byte3,
  10546. const double timeStamp = 0) throw();
  10547. MidiMessage (const int byte1,
  10548. const int byte2,
  10549. const double timeStamp = 0) throw();
  10550. MidiMessage (const int byte1,
  10551. const double timeStamp = 0) throw();
  10552. MidiMessage (const uint8* const data,
  10553. const int dataSize,
  10554. const double timeStamp = 0) throw();
  10555. MidiMessage (const uint8* data,
  10556. int size,
  10557. int& numBytesUsed,
  10558. uint8 lastStatusByte,
  10559. double timeStamp = 0) throw();
  10560. MidiMessage (const MidiMessage& other) throw();
  10561. MidiMessage (const MidiMessage& other,
  10562. const double newTimeStamp) throw();
  10563. ~MidiMessage() throw();
  10564. MidiMessage& operator= (const MidiMessage& other) throw();
  10565. uint8* getRawData() const throw() { return data; }
  10566. int getRawDataSize() const throw() { return size; }
  10567. double getTimeStamp() const throw() { return timeStamp; }
  10568. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10569. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10570. int getChannel() const throw();
  10571. bool isForChannel (const int channelNumber) const throw();
  10572. void setChannel (const int newChannelNumber) throw();
  10573. bool isSysEx() const throw();
  10574. const uint8* getSysExData() const throw();
  10575. int getSysExDataSize() const throw();
  10576. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10577. static const MidiMessage noteOn (const int channel,
  10578. const int noteNumber,
  10579. const float velocity) throw();
  10580. static const MidiMessage noteOn (const int channel,
  10581. const int noteNumber,
  10582. const uint8 velocity) throw();
  10583. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10584. static const MidiMessage noteOff (const int channel,
  10585. const int noteNumber) throw();
  10586. bool isNoteOnOrOff() const throw();
  10587. int getNoteNumber() const throw();
  10588. void setNoteNumber (const int newNoteNumber) throw();
  10589. uint8 getVelocity() const throw();
  10590. float getFloatVelocity() const throw();
  10591. void setVelocity (const float newVelocity) throw();
  10592. void multiplyVelocity (const float scaleFactor) throw();
  10593. bool isProgramChange() const throw();
  10594. int getProgramChangeNumber() const throw();
  10595. static const MidiMessage programChange (const int channel,
  10596. const int programNumber) throw();
  10597. bool isPitchWheel() const throw();
  10598. int getPitchWheelValue() const throw();
  10599. static const MidiMessage pitchWheel (const int channel,
  10600. const int position) throw();
  10601. bool isAftertouch() const throw();
  10602. int getAfterTouchValue() const throw();
  10603. static const MidiMessage aftertouchChange (const int channel,
  10604. const int noteNumber,
  10605. const int aftertouchAmount) throw();
  10606. bool isChannelPressure() const throw();
  10607. int getChannelPressureValue() const throw();
  10608. static const MidiMessage channelPressureChange (const int channel,
  10609. const int pressure) throw();
  10610. bool isController() const throw();
  10611. int getControllerNumber() const throw();
  10612. int getControllerValue() const throw();
  10613. static const MidiMessage controllerEvent (const int channel,
  10614. const int controllerType,
  10615. const int value) throw();
  10616. bool isAllNotesOff() const throw();
  10617. bool isAllSoundOff() const throw();
  10618. static const MidiMessage allNotesOff (const int channel) throw();
  10619. static const MidiMessage allSoundOff (const int channel) throw();
  10620. static const MidiMessage allControllersOff (const int channel) throw();
  10621. bool isMetaEvent() const throw();
  10622. int getMetaEventType() const throw();
  10623. const uint8* getMetaEventData() const throw();
  10624. int getMetaEventLength() const throw();
  10625. bool isTrackMetaEvent() const throw();
  10626. bool isEndOfTrackMetaEvent() const throw();
  10627. static const MidiMessage endOfTrack() throw();
  10628. bool isTrackNameEvent() const throw();
  10629. bool isTextMetaEvent() const throw();
  10630. const String getTextFromTextMetaEvent() const throw();
  10631. bool isTempoMetaEvent() const throw();
  10632. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10633. double getTempoSecondsPerQuarterNote() const throw();
  10634. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10635. bool isTimeSignatureMetaEvent() const throw();
  10636. void getTimeSignatureInfo (int& numerator,
  10637. int& denominator) const throw();
  10638. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10639. const int denominator) throw();
  10640. bool isKeySignatureMetaEvent() const throw();
  10641. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10642. bool isMidiChannelMetaEvent() const throw();
  10643. int getMidiChannelMetaEventChannel() const throw();
  10644. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10645. bool isActiveSense() const throw();
  10646. bool isMidiStart() const throw();
  10647. static const MidiMessage midiStart() throw();
  10648. bool isMidiContinue() const throw();
  10649. static const MidiMessage midiContinue() throw();
  10650. bool isMidiStop() const throw();
  10651. static const MidiMessage midiStop() throw();
  10652. bool isMidiClock() const throw();
  10653. static const MidiMessage midiClock() throw();
  10654. bool isSongPositionPointer() const throw();
  10655. int getSongPositionPointerMidiBeat() const throw();
  10656. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10657. bool isQuarterFrame() const throw();
  10658. int getQuarterFrameSequenceNumber() const throw();
  10659. int getQuarterFrameValue() const throw();
  10660. static const MidiMessage quarterFrame (const int sequenceNumber,
  10661. const int value) throw();
  10662. enum SmpteTimecodeType
  10663. {
  10664. fps24 = 0,
  10665. fps25 = 1,
  10666. fps30drop = 2,
  10667. fps30 = 3
  10668. };
  10669. bool isFullFrame() const throw();
  10670. void getFullFrameParameters (int& hours,
  10671. int& minutes,
  10672. int& seconds,
  10673. int& frames,
  10674. SmpteTimecodeType& timecodeType) const throw();
  10675. static const MidiMessage fullFrame (const int hours,
  10676. const int minutes,
  10677. const int seconds,
  10678. const int frames,
  10679. SmpteTimecodeType timecodeType);
  10680. enum MidiMachineControlCommand
  10681. {
  10682. mmc_stop = 1,
  10683. mmc_play = 2,
  10684. mmc_deferredplay = 3,
  10685. mmc_fastforward = 4,
  10686. mmc_rewind = 5,
  10687. mmc_recordStart = 6,
  10688. mmc_recordStop = 7,
  10689. mmc_pause = 9
  10690. };
  10691. bool isMidiMachineControlMessage() const throw();
  10692. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10693. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10694. bool isMidiMachineControlGoto (int& hours,
  10695. int& minutes,
  10696. int& seconds,
  10697. int& frames) const throw();
  10698. static const MidiMessage midiMachineControlGoto (int hours,
  10699. int minutes,
  10700. int seconds,
  10701. int frames);
  10702. static const MidiMessage masterVolume (const float volume) throw();
  10703. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10704. const int dataSize) throw();
  10705. static int readVariableLengthVal (const uint8* data,
  10706. int& numBytesUsed) throw();
  10707. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10708. static const String getMidiNoteName (int noteNumber,
  10709. bool useSharps,
  10710. bool includeOctaveNumber,
  10711. int octaveNumForMiddleC) throw();
  10712. static const double getMidiNoteInHertz (int noteNumber) throw();
  10713. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10714. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10715. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10716. static const String getControllerName (int controllerNumber) throw();
  10717. juce_UseDebuggingNewOperator
  10718. private:
  10719. double timeStamp;
  10720. uint8* data;
  10721. int message, size;
  10722. };
  10723. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10724. /*** End of inlined file: juce_MidiMessage.h ***/
  10725. class MidiInput;
  10726. class JUCE_API MidiInputCallback
  10727. {
  10728. public:
  10729. virtual ~MidiInputCallback() {}
  10730. virtual void handleIncomingMidiMessage (MidiInput* source,
  10731. const MidiMessage& message) = 0;
  10732. virtual void handlePartialSysexMessage (MidiInput* source,
  10733. const uint8* messageData,
  10734. const int numBytesSoFar,
  10735. const double timestamp)
  10736. {
  10737. // (this bit is just to avoid compiler warnings about unused variables)
  10738. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10739. }
  10740. };
  10741. class JUCE_API MidiInput
  10742. {
  10743. public:
  10744. static const StringArray getDevices();
  10745. static int getDefaultDeviceIndex();
  10746. static MidiInput* openDevice (int deviceIndex,
  10747. MidiInputCallback* callback);
  10748. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10749. static MidiInput* createNewDevice (const String& deviceName,
  10750. MidiInputCallback* callback);
  10751. #endif
  10752. virtual ~MidiInput();
  10753. virtual const String getName() const throw() { return name; }
  10754. virtual void setName (const String& newName) throw() { name = newName; }
  10755. virtual void start();
  10756. virtual void stop();
  10757. juce_UseDebuggingNewOperator
  10758. protected:
  10759. String name;
  10760. void* internal;
  10761. MidiInput (const String& name);
  10762. private:
  10763. MidiInput (const MidiInput&);
  10764. MidiInput& operator= (const MidiInput&);
  10765. };
  10766. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10767. /*** End of inlined file: juce_MidiInput.h ***/
  10768. /*** Start of inlined file: juce_MidiOutput.h ***/
  10769. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10770. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10771. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10772. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10773. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10774. class JUCE_API MidiBuffer
  10775. {
  10776. public:
  10777. MidiBuffer() throw();
  10778. MidiBuffer (const MidiMessage& message) throw();
  10779. MidiBuffer (const MidiBuffer& other) throw();
  10780. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10781. ~MidiBuffer() throw();
  10782. void clear() throw();
  10783. void clear (const int start,
  10784. const int numSamples) throw();
  10785. bool isEmpty() const throw();
  10786. int getNumEvents() const throw();
  10787. void addEvent (const MidiMessage& midiMessage,
  10788. const int sampleNumber) throw();
  10789. void addEvent (const uint8* const rawMidiData,
  10790. const int maxBytesOfMidiData,
  10791. const int sampleNumber) throw();
  10792. void addEvents (const MidiBuffer& otherBuffer,
  10793. const int startSample,
  10794. const int numSamples,
  10795. const int sampleDeltaToAdd) throw();
  10796. int getFirstEventTime() const throw();
  10797. int getLastEventTime() const throw();
  10798. void swap (MidiBuffer& other);
  10799. class Iterator
  10800. {
  10801. public:
  10802. Iterator (const MidiBuffer& buffer) throw();
  10803. ~Iterator() throw();
  10804. void setNextSamplePosition (const int samplePosition) throw();
  10805. bool getNextEvent (MidiMessage& result,
  10806. int& samplePosition) throw();
  10807. bool getNextEvent (const uint8* &midiData,
  10808. int& numBytesOfMidiData,
  10809. int& samplePosition) throw();
  10810. juce_UseDebuggingNewOperator
  10811. private:
  10812. const MidiBuffer& buffer;
  10813. const uint8* data;
  10814. Iterator (const Iterator&);
  10815. Iterator& operator= (const Iterator&);
  10816. };
  10817. juce_UseDebuggingNewOperator
  10818. private:
  10819. friend class MidiBuffer::Iterator;
  10820. MemoryBlock data;
  10821. int bytesUsed;
  10822. uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
  10823. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10824. };
  10825. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10826. /*** End of inlined file: juce_MidiBuffer.h ***/
  10827. class JUCE_API MidiOutput : private Thread
  10828. {
  10829. public:
  10830. static const StringArray getDevices();
  10831. static int getDefaultDeviceIndex();
  10832. static MidiOutput* openDevice (int deviceIndex);
  10833. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10834. static MidiOutput* createNewDevice (const String& deviceName);
  10835. #endif
  10836. virtual ~MidiOutput();
  10837. virtual void sendMessageNow (const MidiMessage& message);
  10838. virtual void reset();
  10839. virtual bool getVolume (float& leftVol,
  10840. float& rightVol);
  10841. virtual void setVolume (float leftVol,
  10842. float rightVol);
  10843. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10844. const double millisecondCounterToStartAt,
  10845. double samplesPerSecondForBuffer);
  10846. virtual void clearAllPendingMessages();
  10847. virtual void startBackgroundThread();
  10848. virtual void stopBackgroundThread();
  10849. juce_UseDebuggingNewOperator
  10850. protected:
  10851. void* internal;
  10852. struct PendingMessage
  10853. {
  10854. PendingMessage (const uint8* data, int len, double sampleNumber);
  10855. MidiMessage message;
  10856. PendingMessage* next;
  10857. juce_UseDebuggingNewOperator
  10858. };
  10859. CriticalSection lock;
  10860. PendingMessage* firstMessage;
  10861. MidiOutput();
  10862. void run();
  10863. private:
  10864. MidiOutput (const MidiOutput&);
  10865. MidiOutput& operator= (const MidiOutput&);
  10866. };
  10867. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10868. /*** End of inlined file: juce_MidiOutput.h ***/
  10869. /*** Start of inlined file: juce_ComboBox.h ***/
  10870. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10871. #define __JUCE_COMBOBOX_JUCEHEADER__
  10872. /*** Start of inlined file: juce_Label.h ***/
  10873. #ifndef __JUCE_LABEL_JUCEHEADER__
  10874. #define __JUCE_LABEL_JUCEHEADER__
  10875. /*** Start of inlined file: juce_TextEditor.h ***/
  10876. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10877. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10878. /*** Start of inlined file: juce_Viewport.h ***/
  10879. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10880. #define __JUCE_VIEWPORT_JUCEHEADER__
  10881. /*** Start of inlined file: juce_ScrollBar.h ***/
  10882. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10883. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10884. /*** Start of inlined file: juce_Button.h ***/
  10885. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10886. #define __JUCE_BUTTON_JUCEHEADER__
  10887. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10888. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10889. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10890. /*** Start of inlined file: juce_TooltipClient.h ***/
  10891. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10892. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10893. class JUCE_API TooltipClient
  10894. {
  10895. public:
  10896. virtual ~TooltipClient() {}
  10897. virtual const String getTooltip() = 0;
  10898. };
  10899. class JUCE_API SettableTooltipClient : public TooltipClient
  10900. {
  10901. public:
  10902. virtual ~SettableTooltipClient() {}
  10903. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10904. virtual const String getTooltip() { return tooltipString; }
  10905. juce_UseDebuggingNewOperator
  10906. protected:
  10907. String tooltipString;
  10908. };
  10909. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10910. /*** End of inlined file: juce_TooltipClient.h ***/
  10911. class JUCE_API TooltipWindow : public Component,
  10912. private Timer
  10913. {
  10914. public:
  10915. TooltipWindow (Component* parentComponent = 0,
  10916. int millisecondsBeforeTipAppears = 700);
  10917. ~TooltipWindow();
  10918. void setMillisecondsBeforeTipAppears (int newTimeMs = 700) throw();
  10919. enum ColourIds
  10920. {
  10921. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10922. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10923. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10924. };
  10925. juce_UseDebuggingNewOperator
  10926. private:
  10927. int millisecondsBeforeTipAppears;
  10928. Point<int> lastMousePos;
  10929. int mouseClicks;
  10930. unsigned int lastCompChangeTime, lastHideTime;
  10931. Component* lastComponentUnderMouse;
  10932. bool changedCompsSinceShown;
  10933. String tipShowing, lastTipUnderMouse;
  10934. void paint (Graphics& g);
  10935. void mouseEnter (const MouseEvent& e);
  10936. void timerCallback();
  10937. static const String getTipFor (Component* c);
  10938. void showFor (const String& tip);
  10939. void hide();
  10940. TooltipWindow (const TooltipWindow&);
  10941. TooltipWindow& operator= (const TooltipWindow&);
  10942. };
  10943. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10944. /*** End of inlined file: juce_TooltipWindow.h ***/
  10945. class Button;
  10946. class JUCE_API ButtonListener
  10947. {
  10948. public:
  10949. virtual ~ButtonListener() {}
  10950. virtual void buttonClicked (Button* button) = 0;
  10951. virtual void buttonStateChanged (Button*) {}
  10952. };
  10953. class JUCE_API Button : public Component,
  10954. public SettableTooltipClient,
  10955. public ApplicationCommandManagerListener,
  10956. public Value::Listener,
  10957. private KeyListener
  10958. {
  10959. protected:
  10960. Button (const String& buttonName);
  10961. public:
  10962. virtual ~Button();
  10963. void setButtonText (const String& newText);
  10964. const String getButtonText() const { return text; }
  10965. bool isDown() const throw();
  10966. bool isOver() const throw();
  10967. void setToggleState (bool shouldBeOn,
  10968. bool sendChangeNotification);
  10969. bool getToggleState() const throw() { return isOn.getValue(); }
  10970. Value& getToggleStateValue() { return isOn; }
  10971. void setClickingTogglesState (bool shouldToggle) throw();
  10972. bool getClickingTogglesState() const throw();
  10973. void setRadioGroupId (int newGroupId);
  10974. int getRadioGroupId() const throw() { return radioGroupId; }
  10975. void addButtonListener (ButtonListener* newListener);
  10976. void removeButtonListener (ButtonListener* listener);
  10977. virtual void triggerClick();
  10978. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10979. int commandID,
  10980. bool generateTooltip);
  10981. int getCommandID() const throw() { return commandID; }
  10982. void addShortcut (const KeyPress& key);
  10983. void clearShortcuts();
  10984. bool isRegisteredForShortcut (const KeyPress& key) const;
  10985. void setRepeatSpeed (int initialDelayInMillisecs,
  10986. int repeatDelayInMillisecs,
  10987. int minimumDelayInMillisecs = -1) throw();
  10988. void setTriggeredOnMouseDown (bool isTriggeredOnMouseDown) throw();
  10989. uint32 getMillisecondsSinceButtonDown() const throw();
  10990. void setVisible (bool shouldBeVisible);
  10991. void setTooltip (const String& newTooltip);
  10992. // (implementation of the TooltipClient method)
  10993. const String getTooltip();
  10994. enum ConnectedEdgeFlags
  10995. {
  10996. ConnectedOnLeft = 1,
  10997. ConnectedOnRight = 2,
  10998. ConnectedOnTop = 4,
  10999. ConnectedOnBottom = 8
  11000. };
  11001. void setConnectedEdges (int connectedEdgeFlags);
  11002. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11003. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11004. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11005. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11006. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11007. enum ButtonState
  11008. {
  11009. buttonNormal,
  11010. buttonOver,
  11011. buttonDown
  11012. };
  11013. void setState (const ButtonState newState);
  11014. juce_UseDebuggingNewOperator
  11015. protected:
  11016. virtual void clicked();
  11017. virtual void clicked (const ModifierKeys& modifiers);
  11018. virtual void paintButton (Graphics& g,
  11019. bool isMouseOverButton,
  11020. bool isButtonDown) = 0;
  11021. virtual void buttonStateChanged();
  11022. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11023. void handleCommandMessage (int commandId);
  11024. void mouseEnter (const MouseEvent& e);
  11025. void mouseExit (const MouseEvent& e);
  11026. void mouseDown (const MouseEvent& e);
  11027. void mouseDrag (const MouseEvent& e);
  11028. void mouseUp (const MouseEvent& e);
  11029. bool keyPressed (const KeyPress& key);
  11030. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11031. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  11032. void paint (Graphics& g);
  11033. void parentHierarchyChanged();
  11034. void focusGained (FocusChangeType cause);
  11035. void focusLost (FocusChangeType cause);
  11036. void enablementChanged();
  11037. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11038. void applicationCommandListChanged();
  11039. void valueChanged (Value& value);
  11040. private:
  11041. Array <KeyPress> shortcuts;
  11042. Component::SafePointer<Component> keySource;
  11043. String text;
  11044. ListenerList <ButtonListener> buttonListeners;
  11045. class RepeatTimer;
  11046. friend class RepeatTimer;
  11047. friend class ScopedPointer <RepeatTimer>;
  11048. ScopedPointer <RepeatTimer> repeatTimer;
  11049. uint32 buttonPressTime, lastTimeCallbackTime;
  11050. ApplicationCommandManager* commandManagerToUse;
  11051. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11052. int radioGroupId, commandID, connectedEdgeFlags;
  11053. ButtonState buttonState;
  11054. Value isOn;
  11055. bool lastToggleState : 1;
  11056. bool clickTogglesState : 1;
  11057. bool needsToRelease : 1;
  11058. bool needsRepainting : 1;
  11059. bool isKeyDown : 1;
  11060. bool triggerOnMouseDown : 1;
  11061. bool generateTooltip : 1;
  11062. void repeatTimerCallback();
  11063. RepeatTimer& getRepeatTimer();
  11064. ButtonState updateState (const MouseEvent* const e);
  11065. bool isShortcutPressed() const;
  11066. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11067. void flashButtonState();
  11068. void sendClickMessage (const ModifierKeys& modifiers);
  11069. void sendStateMessage();
  11070. Button (const Button&);
  11071. Button& operator= (const Button&);
  11072. };
  11073. #endif // __JUCE_BUTTON_JUCEHEADER__
  11074. /*** End of inlined file: juce_Button.h ***/
  11075. class ScrollBar;
  11076. class JUCE_API ScrollBarListener
  11077. {
  11078. public:
  11079. virtual ~ScrollBarListener() {}
  11080. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11081. double newRangeStart) = 0;
  11082. };
  11083. class JUCE_API ScrollBar : public Component,
  11084. public AsyncUpdater,
  11085. private Timer
  11086. {
  11087. public:
  11088. ScrollBar (bool isVertical,
  11089. bool buttonsAreVisible = true);
  11090. ~ScrollBar();
  11091. bool isVertical() const throw() { return vertical; }
  11092. void setOrientation (bool shouldBeVertical) throw();
  11093. void setButtonVisibility (bool buttonsAreVisible);
  11094. void setAutoHide (bool shouldHideWhenFullRange);
  11095. void setRangeLimits (double minimum,
  11096. double maximum) throw();
  11097. double getMinimumRangeLimit() const throw() { return minimum; }
  11098. double getMaximumRangeLimit() const throw() { return maximum; }
  11099. void setCurrentRange (double newStart,
  11100. double newSize) throw();
  11101. void setCurrentRangeStart (double newStart) throw();
  11102. double getCurrentRangeStart() const throw() { return rangeStart; }
  11103. double getCurrentRangeSize() const throw() { return rangeSize; }
  11104. void setSingleStepSize (double newSingleStepSize) throw();
  11105. void moveScrollbarInSteps (int howManySteps) throw();
  11106. void moveScrollbarInPages (int howManyPages) throw();
  11107. void scrollToTop() throw();
  11108. void scrollToBottom() throw();
  11109. void setButtonRepeatSpeed (int initialDelayInMillisecs,
  11110. int repeatDelayInMillisecs,
  11111. int minimumDelayInMillisecs = -1) throw();
  11112. enum ColourIds
  11113. {
  11114. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11115. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11116. 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. */
  11117. };
  11118. void addListener (ScrollBarListener* listener) throw();
  11119. void removeListener (ScrollBarListener* listener) throw();
  11120. bool keyPressed (const KeyPress& key);
  11121. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11122. void lookAndFeelChanged();
  11123. void handleAsyncUpdate();
  11124. void mouseDown (const MouseEvent& e);
  11125. void mouseDrag (const MouseEvent& e);
  11126. void mouseUp (const MouseEvent& e);
  11127. void paint (Graphics& g);
  11128. void resized();
  11129. juce_UseDebuggingNewOperator
  11130. private:
  11131. double minimum, maximum;
  11132. double rangeStart, rangeSize;
  11133. double singleStepSize, dragStartRange;
  11134. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11135. int dragStartMousePos, lastMousePos;
  11136. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11137. bool vertical, isDraggingThumb, alwaysVisible;
  11138. Button* upButton;
  11139. Button* downButton;
  11140. ListenerList <ScrollBarListener> listeners;
  11141. void updateThumbPosition() throw();
  11142. void timerCallback();
  11143. ScrollBar (const ScrollBar&);
  11144. ScrollBar& operator= (const ScrollBar&);
  11145. };
  11146. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11147. /*** End of inlined file: juce_ScrollBar.h ***/
  11148. class JUCE_API Viewport : public Component,
  11149. private ComponentListener,
  11150. private ScrollBarListener
  11151. {
  11152. public:
  11153. Viewport (const String& componentName = String::empty);
  11154. ~Viewport();
  11155. void setViewedComponent (Component* const newViewedComponent);
  11156. Component* getViewedComponent() const throw() { return contentComp; }
  11157. void setViewPosition (const int xPixelsOffset,
  11158. const int yPixelsOffset);
  11159. void setViewPositionProportionately (const double proportionX,
  11160. const double proportionY);
  11161. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11162. int getViewPositionX() const throw() { return lastVX; }
  11163. int getViewPositionY() const throw() { return lastVY; }
  11164. int getViewWidth() const throw() { return lastVW; }
  11165. int getViewHeight() const throw() { return lastVH; }
  11166. int getMaximumVisibleWidth() const throw();
  11167. int getMaximumVisibleHeight() const throw();
  11168. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11169. int visibleW, int visibleH);
  11170. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11171. const bool showHorizontalScrollbarIfNeeded);
  11172. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11173. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11174. void setScrollBarThickness (const int thickness);
  11175. int getScrollBarThickness() const throw();
  11176. void setSingleStepSizes (const int stepX, const int stepY);
  11177. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11178. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11179. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11180. juce_UseDebuggingNewOperator
  11181. void resized();
  11182. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11183. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11184. bool keyPressed (const KeyPress& key);
  11185. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11186. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11187. private:
  11188. Component::SafePointer<Component> contentComp;
  11189. int lastVX, lastVY, lastVW, lastVH;
  11190. int scrollBarThickness;
  11191. int singleStepX, singleStepY;
  11192. bool showHScrollbar, showVScrollbar;
  11193. Component* contentHolder;
  11194. ScrollBar* verticalScrollBar;
  11195. ScrollBar* horizontalScrollBar;
  11196. void updateVisibleRegion();
  11197. Viewport (const Viewport&);
  11198. Viewport& operator= (const Viewport&);
  11199. };
  11200. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11201. /*** End of inlined file: juce_Viewport.h ***/
  11202. /*** Start of inlined file: juce_PopupMenu.h ***/
  11203. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11204. #define __JUCE_POPUPMENU_JUCEHEADER__
  11205. class PopupMenuCustomComponent;
  11206. class JUCE_API PopupMenu
  11207. {
  11208. public:
  11209. PopupMenu();
  11210. PopupMenu (const PopupMenu& other);
  11211. ~PopupMenu();
  11212. PopupMenu& operator= (const PopupMenu& other);
  11213. void clear();
  11214. void addItem (int itemResultId,
  11215. const String& itemText,
  11216. bool isActive = true,
  11217. bool isTicked = false,
  11218. const Image* iconToUse = 0);
  11219. void addCommandItem (ApplicationCommandManager* commandManager,
  11220. int commandID,
  11221. const String& displayName = String::empty);
  11222. void addColouredItem (int itemResultId,
  11223. const String& itemText,
  11224. const Colour& itemTextColour,
  11225. bool isActive = true,
  11226. bool isTicked = false,
  11227. const Image* iconToUse = 0);
  11228. void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent);
  11229. void addCustomItem (int itemResultId,
  11230. Component* customComponent,
  11231. int idealWidth, int idealHeight,
  11232. bool triggerMenuItemAutomaticallyWhenClicked);
  11233. void addSubMenu (const String& subMenuName,
  11234. const PopupMenu& subMenu,
  11235. bool isActive = true,
  11236. Image* iconToUse = 0,
  11237. bool isTicked = false);
  11238. void addSeparator();
  11239. void addSectionHeader (const String& title);
  11240. int getNumItems() const throw();
  11241. bool containsCommandItem (int commandID) const;
  11242. bool containsAnyActiveItems() const throw();
  11243. int show (int itemIdThatMustBeVisible = 0,
  11244. int minimumWidth = 0,
  11245. int maximumNumColumns = 0,
  11246. int standardItemHeight = 0);
  11247. int showAt (int screenX,
  11248. int screenY,
  11249. int itemIdThatMustBeVisible = 0,
  11250. int minimumWidth = 0,
  11251. int maximumNumColumns = 0,
  11252. int standardItemHeight = 0);
  11253. int showAt (Component* componentToAttachTo,
  11254. int itemIdThatMustBeVisible = 0,
  11255. int minimumWidth = 0,
  11256. int maximumNumColumns = 0,
  11257. int standardItemHeight = 0);
  11258. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11259. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  11260. enum ColourIds
  11261. {
  11262. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11263. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11264. colour is specified when the item is added). */
  11265. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11266. addSectionHeader() method). */
  11267. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11268. highlighted menu item. */
  11269. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11270. highlighted item. */
  11271. };
  11272. class JUCE_API MenuItemIterator
  11273. {
  11274. public:
  11275. MenuItemIterator (const PopupMenu& menu);
  11276. ~MenuItemIterator();
  11277. bool next();
  11278. String itemName;
  11279. const PopupMenu* subMenu;
  11280. int itemId;
  11281. bool isSeparator;
  11282. bool isTicked;
  11283. bool isEnabled;
  11284. bool isCustomComponent;
  11285. bool isSectionHeader;
  11286. const Colour* customColour;
  11287. const Image* customImage;
  11288. ApplicationCommandManager* commandManager;
  11289. juce_UseDebuggingNewOperator
  11290. private:
  11291. const PopupMenu& menu;
  11292. int index;
  11293. MenuItemIterator (const MenuItemIterator&);
  11294. MenuItemIterator& operator= (const MenuItemIterator&);
  11295. };
  11296. juce_UseDebuggingNewOperator
  11297. private:
  11298. class Item;
  11299. class ItemComponent;
  11300. class Window;
  11301. friend class MenuItemIterator;
  11302. friend class ItemComponent;
  11303. friend class Window;
  11304. friend class PopupMenuCustomComponent;
  11305. friend class OwnedArray <Item>;
  11306. friend class ScopedPointer <Window>;
  11307. OwnedArray <Item> items;
  11308. LookAndFeel* lookAndFeel;
  11309. bool separatorPending;
  11310. void addSeparatorIfPending();
  11311. int showMenu (int x, int y, int w, int h,
  11312. int itemIdThatMustBeVisible,
  11313. int minimumWidth,
  11314. int maximumNumColumns,
  11315. int standardItemHeight,
  11316. bool alignToRectangle,
  11317. Component* componentAttachedTo);
  11318. friend class MenuBarComponent;
  11319. Component* createMenuComponent (int x, int y, int w, int h,
  11320. int itemIdThatMustBeVisible,
  11321. int minimumWidth,
  11322. int maximumNumColumns,
  11323. int standardItemHeight,
  11324. bool alignToRectangle,
  11325. Component* menuBarComponent,
  11326. ApplicationCommandManager** managerOfChosenCommand,
  11327. Component* componentAttachedTo);
  11328. };
  11329. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11330. /*** End of inlined file: juce_PopupMenu.h ***/
  11331. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11332. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11333. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11334. class JUCE_API TextInputTarget
  11335. {
  11336. public:
  11337. TextInputTarget() {}
  11338. virtual ~TextInputTarget() {}
  11339. virtual const Range<int> getHighlightedRegion() const = 0;
  11340. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11341. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11342. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11343. };
  11344. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11345. /*** End of inlined file: juce_TextInputTarget.h ***/
  11346. class TextEditor;
  11347. class TextHolderComponent;
  11348. class JUCE_API TextEditorListener
  11349. {
  11350. public:
  11351. virtual ~TextEditorListener() {}
  11352. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11353. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11354. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11355. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11356. };
  11357. class JUCE_API TextEditor : public Component,
  11358. public TextInputTarget,
  11359. public SettableTooltipClient
  11360. {
  11361. public:
  11362. TextEditor (const String& componentName = String::empty,
  11363. tchar passwordCharacter = 0);
  11364. virtual ~TextEditor();
  11365. void setMultiLine (bool shouldBeMultiLine,
  11366. bool shouldWordWrap = true);
  11367. bool isMultiLine() const;
  11368. void setReturnKeyStartsNewLine (bool shouldStartNewLine);
  11369. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11370. void setTabKeyUsedAsCharacter (bool shouldTabKeyBeUsed);
  11371. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11372. void setReadOnly (bool shouldBeReadOnly);
  11373. bool isReadOnly() const;
  11374. void setCaretVisible (bool shouldBeVisible);
  11375. bool isCaretVisible() const { return caretVisible; }
  11376. void setScrollbarsShown (bool shouldBeEnabled);
  11377. bool areScrollbarsShown() const { return scrollbarVisible; }
  11378. void setPasswordCharacter (tchar passwordCharacter);
  11379. tchar getPasswordCharacter() const { return passwordCharacter; }
  11380. void setPopupMenuEnabled (bool menuEnabled);
  11381. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11382. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11383. enum ColourIds
  11384. {
  11385. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11386. transparent if necessary. */
  11387. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11388. that because the editor can contain multiple colours, calling this
  11389. method won't change the colour of existing text - to do that, call
  11390. applyFontToAllText() after calling this method.*/
  11391. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11392. the text - this can be transparent if you don't want to show any
  11393. highlighting.*/
  11394. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11395. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11396. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11397. the edge of the component. */
  11398. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11399. the edge of the component when it has focus. */
  11400. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11401. around the edge of the editor. */
  11402. };
  11403. void setFont (const Font& newFont);
  11404. void applyFontToAllText (const Font& newFont);
  11405. const Font getFont() const;
  11406. void setSelectAllWhenFocused (bool b);
  11407. void setInputRestrictions (int maxTextLength,
  11408. const String& allowedCharacters = String::empty);
  11409. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11410. void setScrollBarThickness (int newThicknessPixels);
  11411. void setScrollBarButtonVisibility (bool buttonsVisible);
  11412. void addListener (TextEditorListener* newListener);
  11413. void removeListener (TextEditorListener* listenerToRemove);
  11414. const String getText() const;
  11415. const String getTextInRange (const Range<int>& textRange) const;
  11416. bool isEmpty() const;
  11417. void setText (const String& newText,
  11418. bool sendTextChangeMessage = true);
  11419. Value& getTextValue();
  11420. void insertTextAtCaret (const String& textToInsert);
  11421. void clear();
  11422. void cut();
  11423. void copy();
  11424. void paste();
  11425. void setCaretPosition (int newIndex);
  11426. int getCaretPosition() const;
  11427. void scrollEditorToPositionCaret (int desiredCaretX, int desiredCaretY);
  11428. const Rectangle<int> getCaretRectangle();
  11429. void setHighlightedRegion (const Range<int>& newSelection);
  11430. const Range<int> getHighlightedRegion() const { return selection; }
  11431. const String getHighlightedText() const;
  11432. int getTextIndexAt (int x, int y);
  11433. int getTotalNumChars() const;
  11434. int getTextWidth() const;
  11435. int getTextHeight() const;
  11436. void setIndents (int newLeftIndent, int newTopIndent);
  11437. void setBorder (const BorderSize& border);
  11438. const BorderSize getBorder() const;
  11439. void setScrollToShowCursor (bool shouldScrollToShowCursor);
  11440. void paint (Graphics& g);
  11441. void paintOverChildren (Graphics& g);
  11442. void mouseDown (const MouseEvent& e);
  11443. void mouseUp (const MouseEvent& e);
  11444. void mouseDrag (const MouseEvent& e);
  11445. void mouseDoubleClick (const MouseEvent& e);
  11446. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11447. bool keyPressed (const KeyPress& key);
  11448. bool keyStateChanged (bool isKeyDown);
  11449. void focusGained (FocusChangeType cause);
  11450. void focusLost (FocusChangeType cause);
  11451. void resized();
  11452. void enablementChanged();
  11453. void colourChanged();
  11454. juce_UseDebuggingNewOperator
  11455. protected:
  11456. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11457. const MouseEvent* mouseClickEvent);
  11458. virtual void performPopupMenuAction (int menuItemID);
  11459. void scrollToMakeSureCursorIsVisible();
  11460. void moveCaret (int newCaretPos);
  11461. void moveCursorTo (int newPosition, bool isSelecting);
  11462. void textChanged();
  11463. void newTransaction();
  11464. void doUndoRedo (bool isRedo);
  11465. virtual void returnPressed();
  11466. virtual void escapePressed();
  11467. void handleCommandMessage (int commandId);
  11468. private:
  11469. ScopedPointer <Viewport> viewport;
  11470. TextHolderComponent* textHolder;
  11471. BorderSize borderSize;
  11472. bool readOnly : 1;
  11473. bool multiline : 1;
  11474. bool wordWrap : 1;
  11475. bool returnKeyStartsNewLine : 1;
  11476. bool caretVisible : 1;
  11477. bool popupMenuEnabled : 1;
  11478. bool selectAllTextWhenFocused : 1;
  11479. bool scrollbarVisible : 1;
  11480. bool wasFocused : 1;
  11481. bool caretFlashState : 1;
  11482. bool keepCursorOnScreen : 1;
  11483. bool tabKeyUsed : 1;
  11484. bool menuActive : 1;
  11485. bool valueTextNeedsUpdating : 1;
  11486. UndoManager undoManager;
  11487. float cursorX, cursorY, cursorHeight;
  11488. int maxTextLength;
  11489. Range<int> selection;
  11490. int leftIndent, topIndent;
  11491. unsigned int lastTransactionTime;
  11492. Font currentFont;
  11493. mutable int totalNumChars;
  11494. int caretPosition;
  11495. VoidArray sections;
  11496. String textToShowWhenEmpty;
  11497. Colour colourForTextWhenEmpty;
  11498. tchar passwordCharacter;
  11499. Value textValue;
  11500. enum
  11501. {
  11502. notDragging,
  11503. draggingSelectionStart,
  11504. draggingSelectionEnd
  11505. } dragType;
  11506. String allowedCharacters;
  11507. ListenerList <TextEditorListener> listeners;
  11508. friend class TextEditorInsertAction;
  11509. friend class TextEditorRemoveAction;
  11510. void coalesceSimilarSections();
  11511. void splitSection (int sectionIndex, int charToSplitAt);
  11512. void clearInternal (UndoManager* um);
  11513. void insert (const String& text, int insertIndex, const Font& font,
  11514. const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
  11515. void reinsert (int insertIndex, const VoidArray& sections);
  11516. void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
  11517. void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
  11518. void updateCaretPosition();
  11519. void textWasChangedByValue();
  11520. int indexAtPosition (float x, float y);
  11521. int findWordBreakAfter (int position) const;
  11522. int findWordBreakBefore (int position) const;
  11523. friend class TextHolderComponent;
  11524. friend class TextEditorViewport;
  11525. void drawContent (Graphics& g);
  11526. void updateTextHolderSize();
  11527. float getWordWrapWidth() const;
  11528. void timerCallbackInt();
  11529. void repaintCaret();
  11530. void repaintText (const Range<int>& range);
  11531. UndoManager* getUndoManager() throw();
  11532. TextEditor (const TextEditor&);
  11533. TextEditor& operator= (const TextEditor&);
  11534. };
  11535. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11536. /*** End of inlined file: juce_TextEditor.h ***/
  11537. class Label;
  11538. class JUCE_API LabelListener
  11539. {
  11540. public:
  11541. virtual ~LabelListener() {}
  11542. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11543. };
  11544. class JUCE_API Label : public Component,
  11545. public SettableTooltipClient,
  11546. protected TextEditorListener,
  11547. private ComponentListener,
  11548. private Value::Listener
  11549. {
  11550. public:
  11551. Label (const String& componentName,
  11552. const String& labelText);
  11553. ~Label();
  11554. void setText (const String& newText,
  11555. bool broadcastChangeMessage);
  11556. const String getText (bool returnActiveEditorContents = false) const throw();
  11557. Value& getTextValue() { return textValue; }
  11558. void setFont (const Font& newFont) throw();
  11559. const Font& getFont() const throw();
  11560. enum ColourIds
  11561. {
  11562. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11563. textColourId = 0x1000281, /**< The colour for the text. */
  11564. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11565. Leave this transparent to not have an outline. */
  11566. };
  11567. void setJustificationType (const Justification& justification) throw();
  11568. const Justification getJustificationType() const throw() { return justification; }
  11569. void setBorderSize (int horizontalBorder, int verticalBorder);
  11570. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11571. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11572. void attachToComponent (Component* owner, bool onLeft);
  11573. Component* getAttachedComponent() const;
  11574. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11575. void setMinimumHorizontalScale (float newScale);
  11576. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11577. void addListener (LabelListener* listener) throw();
  11578. void removeListener (LabelListener* listener) throw();
  11579. void setEditable (bool editOnSingleClick,
  11580. bool editOnDoubleClick = false,
  11581. bool lossOfFocusDiscardsChanges = false) throw();
  11582. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11583. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11584. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11585. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11586. void showEditor();
  11587. void hideEditor (bool discardCurrentEditorContents);
  11588. bool isBeingEdited() const throw();
  11589. juce_UseDebuggingNewOperator
  11590. protected:
  11591. virtual TextEditor* createEditorComponent();
  11592. virtual void textWasEdited();
  11593. virtual void textWasChanged();
  11594. virtual void editorShown (TextEditor* editorComponent);
  11595. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11596. void paint (Graphics& g);
  11597. void resized();
  11598. void mouseUp (const MouseEvent& e);
  11599. void mouseDoubleClick (const MouseEvent& e);
  11600. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11601. void componentParentHierarchyChanged (Component& component);
  11602. void componentVisibilityChanged (Component& component);
  11603. void inputAttemptWhenModal();
  11604. void focusGained (FocusChangeType);
  11605. void enablementChanged();
  11606. KeyboardFocusTraverser* createFocusTraverser();
  11607. void textEditorTextChanged (TextEditor& editor);
  11608. void textEditorReturnKeyPressed (TextEditor& editor);
  11609. void textEditorEscapeKeyPressed (TextEditor& editor);
  11610. void textEditorFocusLost (TextEditor& editor);
  11611. void colourChanged();
  11612. void valueChanged (Value&);
  11613. private:
  11614. Value textValue;
  11615. String lastTextValue;
  11616. Font font;
  11617. Justification justification;
  11618. ScopedPointer <TextEditor> editor;
  11619. ListenerList <LabelListener> listeners;
  11620. Component::SafePointer<Component> ownerComponent;
  11621. int horizontalBorderSize, verticalBorderSize;
  11622. float minimumHorizontalScale;
  11623. bool editSingleClick : 1;
  11624. bool editDoubleClick : 1;
  11625. bool lossOfFocusDiscardsChanges : 1;
  11626. bool leftOfOwnerComp : 1;
  11627. bool updateFromTextEditorContents();
  11628. void callChangeListeners();
  11629. Label (const Label&);
  11630. Label& operator= (const Label&);
  11631. };
  11632. #endif // __JUCE_LABEL_JUCEHEADER__
  11633. /*** End of inlined file: juce_Label.h ***/
  11634. class ComboBox;
  11635. class JUCE_API ComboBoxListener
  11636. {
  11637. public:
  11638. virtual ~ComboBoxListener() {}
  11639. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11640. };
  11641. class JUCE_API ComboBox : public Component,
  11642. public SettableTooltipClient,
  11643. private LabelListener,
  11644. private AsyncUpdater,
  11645. private Value::Listener
  11646. {
  11647. public:
  11648. ComboBox (const String& componentName);
  11649. ~ComboBox();
  11650. void setEditableText (bool isEditable);
  11651. bool isTextEditable() const throw();
  11652. void setJustificationType (const Justification& justification) throw();
  11653. const Justification getJustificationType() const throw();
  11654. void addItem (const String& newItemText,
  11655. int newItemId) throw();
  11656. void addSeparator() throw();
  11657. void addSectionHeading (const String& headingName) throw();
  11658. void setItemEnabled (int itemId,
  11659. bool shouldBeEnabled) throw();
  11660. void changeItemText (int itemId,
  11661. const String& newText) throw();
  11662. void clear (bool dontSendChangeMessage = false);
  11663. int getNumItems() const throw();
  11664. const String getItemText (int index) const throw();
  11665. int getItemId (int index) const throw();
  11666. int indexOfItemId (int itemId) const throw();
  11667. int getSelectedId() const throw();
  11668. Value& getSelectedIdAsValue() throw() { return currentId; }
  11669. void setSelectedId (int newItemId,
  11670. bool dontSendChangeMessage = false) throw();
  11671. int getSelectedItemIndex() const throw();
  11672. void setSelectedItemIndex (int newItemIndex,
  11673. bool dontSendChangeMessage = false) throw();
  11674. const String getText() const throw();
  11675. void setText (const String& newText,
  11676. bool dontSendChangeMessage = false) throw();
  11677. void showEditor();
  11678. void addListener (ComboBoxListener* listener) throw();
  11679. void removeListener (ComboBoxListener* listener) throw();
  11680. void setTextWhenNothingSelected (const String& newMessage) throw();
  11681. const String getTextWhenNothingSelected() const throw();
  11682. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11683. const String getTextWhenNoChoicesAvailable() const throw();
  11684. void setTooltip (const String& newTooltip);
  11685. enum ColourIds
  11686. {
  11687. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11688. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11689. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11690. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11691. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11692. };
  11693. void labelTextChanged (Label*);
  11694. void enablementChanged();
  11695. void colourChanged();
  11696. void focusGained (Component::FocusChangeType cause);
  11697. void focusLost (Component::FocusChangeType cause);
  11698. void handleAsyncUpdate();
  11699. const String getTooltip() { return label->getTooltip(); }
  11700. void mouseDown (const MouseEvent&);
  11701. void mouseDrag (const MouseEvent&);
  11702. void mouseUp (const MouseEvent&);
  11703. void lookAndFeelChanged();
  11704. void paint (Graphics&);
  11705. void resized();
  11706. bool keyStateChanged (bool isKeyDown);
  11707. bool keyPressed (const KeyPress&);
  11708. void valueChanged (Value&);
  11709. juce_UseDebuggingNewOperator
  11710. private:
  11711. struct ItemInfo
  11712. {
  11713. String name;
  11714. int itemId;
  11715. bool isEnabled : 1, isHeading : 1;
  11716. bool isSeparator() const throw();
  11717. bool isRealItem() const throw();
  11718. };
  11719. OwnedArray <ItemInfo> items;
  11720. Value currentId;
  11721. int lastCurrentId;
  11722. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11723. ListenerList <ComboBoxListener> listeners;
  11724. ScopedPointer<Label> label;
  11725. String textWhenNothingSelected, noChoicesMessage;
  11726. void showPopup();
  11727. ItemInfo* getItemForId (int itemId) const throw();
  11728. ItemInfo* getItemForIndex (int index) const throw();
  11729. ComboBox (const ComboBox&);
  11730. ComboBox& operator= (const ComboBox&);
  11731. };
  11732. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11733. /*** End of inlined file: juce_ComboBox.h ***/
  11734. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11735. {
  11736. public:
  11737. AudioDeviceManager();
  11738. ~AudioDeviceManager();
  11739. struct JUCE_API AudioDeviceSetup
  11740. {
  11741. AudioDeviceSetup();
  11742. bool operator== (const AudioDeviceSetup& other) const;
  11743. String outputDeviceName;
  11744. String inputDeviceName;
  11745. double sampleRate;
  11746. int bufferSize;
  11747. BigInteger inputChannels;
  11748. bool useDefaultInputChannels;
  11749. BigInteger outputChannels;
  11750. bool useDefaultOutputChannels;
  11751. };
  11752. const String initialise (const int numInputChannelsNeeded,
  11753. const int numOutputChannelsNeeded,
  11754. const XmlElement* const savedState,
  11755. const bool selectDefaultDeviceOnFailure,
  11756. const String& preferredDefaultDeviceName = String::empty,
  11757. const AudioDeviceSetup* preferredSetupOptions = 0);
  11758. XmlElement* createStateXml() const;
  11759. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11760. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11761. const bool treatAsChosenDevice);
  11762. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11763. const String getCurrentAudioDeviceType() const { return currentDeviceType; }
  11764. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11765. void setCurrentAudioDeviceType (const String& type,
  11766. const bool treatAsChosenDevice);
  11767. void closeAudioDevice();
  11768. void restartLastAudioDevice();
  11769. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11770. void removeAudioCallback (AudioIODeviceCallback* callback);
  11771. double getCpuUsage() const;
  11772. void setMidiInputEnabled (const String& midiInputDeviceName,
  11773. const bool enabled);
  11774. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11775. void addMidiInputCallback (const String& midiInputDeviceName,
  11776. MidiInputCallback* callback);
  11777. void removeMidiInputCallback (const String& midiInputDeviceName,
  11778. MidiInputCallback* callback);
  11779. void setDefaultMidiOutput (const String& deviceName);
  11780. const String getDefaultMidiOutputName() const { return defaultMidiOutputName; }
  11781. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11782. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11783. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11784. void playTestSound();
  11785. void enableInputLevelMeasurement (const bool enableMeasurement);
  11786. double getCurrentInputLevel() const;
  11787. juce_UseDebuggingNewOperator
  11788. private:
  11789. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11790. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11791. AudioDeviceSetup currentSetup;
  11792. ScopedPointer <AudioIODevice> currentAudioDevice;
  11793. SortedSet <AudioIODeviceCallback*> callbacks;
  11794. int numInputChansNeeded, numOutputChansNeeded;
  11795. String currentDeviceType;
  11796. BigInteger inputChannels, outputChannels;
  11797. ScopedPointer <XmlElement> lastExplicitSettings;
  11798. mutable bool listNeedsScanning;
  11799. bool useInputNames;
  11800. int inputLevelMeasurementEnabledCount;
  11801. double inputLevel;
  11802. ScopedPointer <AudioSampleBuffer> testSound;
  11803. int testSoundPosition;
  11804. AudioSampleBuffer tempBuffer;
  11805. StringArray midiInsFromXml;
  11806. OwnedArray <MidiInput> enabledMidiInputs;
  11807. Array <MidiInputCallback*> midiCallbacks;
  11808. Array <MidiInput*> midiCallbackDevices;
  11809. String defaultMidiOutputName;
  11810. ScopedPointer <MidiOutput> defaultMidiOutput;
  11811. CriticalSection audioCallbackLock, midiCallbackLock;
  11812. double cpuUsageMs, timeToCpuScale;
  11813. class CallbackHandler : public AudioIODeviceCallback,
  11814. public MidiInputCallback
  11815. {
  11816. public:
  11817. AudioDeviceManager* owner;
  11818. void audioDeviceIOCallback (const float** inputChannelData,
  11819. int totalNumInputChannels,
  11820. float** outputChannelData,
  11821. int totalNumOutputChannels,
  11822. int numSamples);
  11823. void audioDeviceAboutToStart (AudioIODevice*);
  11824. void audioDeviceStopped();
  11825. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11826. };
  11827. CallbackHandler callbackHandler;
  11828. friend class CallbackHandler;
  11829. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11830. int totalNumInputChannels,
  11831. float** outputChannelData,
  11832. int totalNumOutputChannels,
  11833. int numSamples);
  11834. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11835. void audioDeviceStoppedInt();
  11836. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11837. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11838. const BigInteger& ins, const BigInteger& outs);
  11839. void stopDevice();
  11840. void updateXml();
  11841. void createDeviceTypesIfNeeded();
  11842. void scanDevicesIfNeeded();
  11843. void deleteCurrentDevice();
  11844. double chooseBestSampleRate (double preferred) const;
  11845. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11846. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11847. AudioDeviceManager (const AudioDeviceManager&);
  11848. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11849. };
  11850. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11851. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11852. #endif
  11853. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11854. #endif
  11855. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11856. #endif
  11857. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11858. #endif
  11859. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11860. #endif
  11861. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11862. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11863. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11864. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11865. class JUCE_API AudioDataConverters
  11866. {
  11867. public:
  11868. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11869. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11870. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11871. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11872. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11873. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11874. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11875. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11876. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11877. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11878. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11879. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11880. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11881. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11882. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11883. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11884. enum DataFormat
  11885. {
  11886. int16LE,
  11887. int16BE,
  11888. int24LE,
  11889. int24BE,
  11890. int32LE,
  11891. int32BE,
  11892. float32LE,
  11893. float32BE,
  11894. };
  11895. static void convertFloatToFormat (const DataFormat destFormat,
  11896. const float* source, void* dest, int numSamples);
  11897. static void convertFormatToFloat (const DataFormat sourceFormat,
  11898. const void* source, float* dest, int numSamples);
  11899. static void interleaveSamples (const float** source, float* dest,
  11900. const int numSamples, const int numChannels);
  11901. static void deinterleaveSamples (const float* source, float** dest,
  11902. const int numSamples, const int numChannels);
  11903. };
  11904. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11905. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11906. #endif
  11907. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11908. #endif
  11909. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11910. #endif
  11911. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11912. #endif
  11913. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11914. /*** Start of inlined file: juce_MidiFile.h ***/
  11915. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11916. #define __JUCE_MIDIFILE_JUCEHEADER__
  11917. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11918. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11919. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11920. class JUCE_API MidiMessageSequence
  11921. {
  11922. public:
  11923. MidiMessageSequence();
  11924. MidiMessageSequence (const MidiMessageSequence& other);
  11925. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11926. ~MidiMessageSequence();
  11927. class MidiEventHolder
  11928. {
  11929. public:
  11930. ~MidiEventHolder();
  11931. MidiMessage message;
  11932. MidiEventHolder* noteOffObject;
  11933. juce_UseDebuggingNewOperator
  11934. private:
  11935. friend class MidiMessageSequence;
  11936. MidiEventHolder (const MidiMessage& message);
  11937. };
  11938. void clear();
  11939. int getNumEvents() const;
  11940. MidiEventHolder* getEventPointer (const int index) const;
  11941. double getTimeOfMatchingKeyUp (const int index) const;
  11942. int getIndexOfMatchingKeyUp (const int index) const;
  11943. int getIndexOf (MidiEventHolder* const event) const;
  11944. int getNextIndexAtTime (const double timeStamp) const;
  11945. double getStartTime() const;
  11946. double getEndTime() const;
  11947. double getEventTime (const int index) const;
  11948. void addEvent (const MidiMessage& newMessage,
  11949. double timeAdjustment = 0);
  11950. void deleteEvent (const int index,
  11951. const bool deleteMatchingNoteUp);
  11952. void addSequence (const MidiMessageSequence& other,
  11953. double timeAdjustmentDelta,
  11954. double firstAllowableDestTime,
  11955. double endOfAllowableDestTimes);
  11956. void updateMatchedPairs();
  11957. void extractMidiChannelMessages (const int channelNumberToExtract,
  11958. MidiMessageSequence& destSequence,
  11959. const bool alsoIncludeMetaEvents) const;
  11960. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11961. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11962. void deleteSysExMessages();
  11963. void addTimeToMessages (const double deltaTime);
  11964. void createControllerUpdatesForTime (const int channelNumber,
  11965. const double time,
  11966. OwnedArray<MidiMessage>& resultMessages);
  11967. void swapWith (MidiMessageSequence& other) throw();
  11968. juce_UseDebuggingNewOperator
  11969. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11970. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11971. private:
  11972. friend class MidiFile;
  11973. OwnedArray <MidiEventHolder> list;
  11974. void sort();
  11975. };
  11976. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11977. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  11978. class JUCE_API MidiFile
  11979. {
  11980. public:
  11981. MidiFile() throw();
  11982. ~MidiFile() throw();
  11983. int getNumTracks() const throw();
  11984. const MidiMessageSequence* getTrack (const int index) const throw();
  11985. void addTrack (const MidiMessageSequence& trackSequence) throw();
  11986. void clear() throw();
  11987. short getTimeFormat() const throw();
  11988. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  11989. void setSmpteTimeFormat (const int framesPerSecond,
  11990. const int subframeResolution) throw();
  11991. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  11992. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  11993. double getLastTimestamp() const;
  11994. bool readFrom (InputStream& sourceStream);
  11995. bool writeTo (OutputStream& destStream);
  11996. void convertTimestampTicksToSeconds();
  11997. juce_UseDebuggingNewOperator
  11998. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11999. const MidiMessageSequence::MidiEventHolder* const second) throw();
  12000. private:
  12001. OwnedArray <MidiMessageSequence> tracks;
  12002. short timeFormat;
  12003. MidiFile (const MidiFile&);
  12004. MidiFile& operator= (const MidiFile&);
  12005. void readNextTrack (const char* data, int size);
  12006. void writeTrack (OutputStream& mainOut, const int trackNum);
  12007. };
  12008. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12009. /*** End of inlined file: juce_MidiFile.h ***/
  12010. #endif
  12011. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12012. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12013. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12014. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12015. class MidiKeyboardState;
  12016. class JUCE_API MidiKeyboardStateListener
  12017. {
  12018. public:
  12019. MidiKeyboardStateListener() throw() {}
  12020. virtual ~MidiKeyboardStateListener() {}
  12021. virtual void handleNoteOn (MidiKeyboardState* source,
  12022. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12023. virtual void handleNoteOff (MidiKeyboardState* source,
  12024. int midiChannel, int midiNoteNumber) = 0;
  12025. };
  12026. class JUCE_API MidiKeyboardState
  12027. {
  12028. public:
  12029. MidiKeyboardState();
  12030. ~MidiKeyboardState();
  12031. void reset();
  12032. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12033. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12034. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12035. void noteOff (const int midiChannel, const int midiNoteNumber);
  12036. void allNotesOff (const int midiChannel);
  12037. void processNextMidiEvent (const MidiMessage& message);
  12038. void processNextMidiBuffer (MidiBuffer& buffer,
  12039. const int startSample,
  12040. const int numSamples,
  12041. const bool injectIndirectEvents);
  12042. void addListener (MidiKeyboardStateListener* const listener) throw();
  12043. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12044. juce_UseDebuggingNewOperator
  12045. private:
  12046. CriticalSection lock;
  12047. uint16 noteStates [128];
  12048. MidiBuffer eventsToAdd;
  12049. VoidArray listeners;
  12050. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12051. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12052. MidiKeyboardState (const MidiKeyboardState&);
  12053. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12054. };
  12055. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12056. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12057. #endif
  12058. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12059. #endif
  12060. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12061. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12062. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12063. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12064. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12065. public MidiInputCallback
  12066. {
  12067. public:
  12068. MidiMessageCollector();
  12069. ~MidiMessageCollector();
  12070. void reset (const double sampleRate);
  12071. void addMessageToQueue (const MidiMessage& message);
  12072. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12073. const int numSamples);
  12074. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12075. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12076. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12077. juce_UseDebuggingNewOperator
  12078. private:
  12079. double lastCallbackTime;
  12080. CriticalSection midiCallbackLock;
  12081. MidiBuffer incomingMessages;
  12082. double sampleRate;
  12083. MidiMessageCollector (const MidiMessageCollector&);
  12084. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12085. };
  12086. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12087. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12088. #endif
  12089. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12090. #endif
  12091. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12092. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12093. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12094. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12095. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12096. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12097. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12098. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12099. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12100. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12101. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12102. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12103. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12104. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12105. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12106. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12107. class AudioProcessor;
  12108. class JUCE_API AudioProcessorEditor : public Component
  12109. {
  12110. protected:
  12111. AudioProcessorEditor (AudioProcessor* const owner);
  12112. public:
  12113. ~AudioProcessorEditor();
  12114. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12115. private:
  12116. AudioProcessor* const owner;
  12117. AudioProcessorEditor (const AudioProcessorEditor&);
  12118. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12119. };
  12120. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12121. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12122. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12123. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12124. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12125. class AudioProcessor;
  12126. class JUCE_API AudioProcessorListener
  12127. {
  12128. public:
  12129. virtual ~AudioProcessorListener() {}
  12130. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12131. int parameterIndex,
  12132. float newValue) = 0;
  12133. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12134. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12135. int parameterIndex);
  12136. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12137. int parameterIndex);
  12138. };
  12139. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12140. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12141. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12142. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12143. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12144. class JUCE_API AudioPlayHead
  12145. {
  12146. protected:
  12147. AudioPlayHead() {}
  12148. public:
  12149. virtual ~AudioPlayHead() {}
  12150. enum FrameRateType
  12151. {
  12152. fps24 = 0,
  12153. fps25 = 1,
  12154. fps2997 = 2,
  12155. fps30 = 3,
  12156. fps2997drop = 4,
  12157. fps30drop = 5,
  12158. fpsUnknown = 99
  12159. };
  12160. struct CurrentPositionInfo
  12161. {
  12162. double bpm;
  12163. int timeSigNumerator;
  12164. int timeSigDenominator;
  12165. double timeInSeconds;
  12166. double editOriginTime;
  12167. double ppqPosition;
  12168. double ppqPositionOfLastBarStart;
  12169. FrameRateType frameRate;
  12170. bool isPlaying;
  12171. bool isRecording;
  12172. };
  12173. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12174. };
  12175. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12176. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12177. class JUCE_API AudioProcessor
  12178. {
  12179. protected:
  12180. AudioProcessor();
  12181. public:
  12182. virtual ~AudioProcessor();
  12183. virtual const String getName() const = 0;
  12184. virtual void prepareToPlay (double sampleRate,
  12185. int estimatedSamplesPerBlock) = 0;
  12186. virtual void releaseResources() = 0;
  12187. virtual void processBlock (AudioSampleBuffer& buffer,
  12188. MidiBuffer& midiMessages) = 0;
  12189. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12190. double getSampleRate() const throw() { return sampleRate; }
  12191. int getBlockSize() const throw() { return blockSize; }
  12192. int getNumInputChannels() const throw() { return numInputChannels; }
  12193. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12194. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12195. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12196. virtual bool isInputChannelStereoPair (int index) const = 0;
  12197. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12198. int getLatencySamples() const throw() { return latencySamples; }
  12199. void setLatencySamples (const int newLatency);
  12200. virtual bool acceptsMidi() const = 0;
  12201. virtual bool producesMidi() const = 0;
  12202. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12203. void suspendProcessing (const bool shouldBeSuspended);
  12204. bool isSuspended() const throw() { return suspended; }
  12205. virtual void reset();
  12206. bool isNonRealtime() const throw() { return nonRealtime; }
  12207. void setNonRealtime (const bool isNonRealtime) throw();
  12208. virtual AudioProcessorEditor* createEditor() = 0;
  12209. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12210. AudioProcessorEditor* createEditorIfNeeded();
  12211. virtual int getNumParameters() = 0;
  12212. virtual const String getParameterName (int parameterIndex) = 0;
  12213. virtual float getParameter (int parameterIndex) = 0;
  12214. virtual const String getParameterText (int parameterIndex) = 0;
  12215. virtual void setParameter (int parameterIndex,
  12216. float newValue) = 0;
  12217. void setParameterNotifyingHost (int parameterIndex,
  12218. float newValue);
  12219. virtual bool isParameterAutomatable (int parameterIndex) const;
  12220. virtual bool isMetaParameter (int parameterIndex) const;
  12221. void beginParameterChangeGesture (int parameterIndex);
  12222. void endParameterChangeGesture (int parameterIndex);
  12223. void updateHostDisplay();
  12224. virtual int getNumPrograms() = 0;
  12225. virtual int getCurrentProgram() = 0;
  12226. virtual void setCurrentProgram (int index) = 0;
  12227. virtual const String getProgramName (int index) = 0;
  12228. virtual void changeProgramName (int index, const String& newName) = 0;
  12229. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12230. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12231. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12232. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12233. void addListener (AudioProcessorListener* const newListener) throw();
  12234. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12235. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12236. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12237. void setPlayConfigDetails (const int numIns, const int numOuts,
  12238. const double sampleRate,
  12239. const int blockSize) throw();
  12240. juce_UseDebuggingNewOperator
  12241. protected:
  12242. static void copyXmlToBinary (const XmlElement& xml,
  12243. JUCE_NAMESPACE::MemoryBlock& destData);
  12244. static XmlElement* getXmlFromBinary (const void* data,
  12245. const int sizeInBytes);
  12246. AudioPlayHead* playHead;
  12247. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12248. private:
  12249. VoidArray listeners;
  12250. AudioProcessorEditor* activeEditor;
  12251. double sampleRate;
  12252. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12253. bool suspended, nonRealtime;
  12254. CriticalSection callbackLock, listenerLock;
  12255. #ifdef JUCE_DEBUG
  12256. BigInteger changingParams;
  12257. #endif
  12258. AudioProcessor (const AudioProcessor&);
  12259. AudioProcessor& operator= (const AudioProcessor&);
  12260. };
  12261. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12262. /*** End of inlined file: juce_AudioProcessor.h ***/
  12263. /*** Start of inlined file: juce_PluginDescription.h ***/
  12264. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12265. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12266. class JUCE_API PluginDescription
  12267. {
  12268. public:
  12269. PluginDescription() throw();
  12270. PluginDescription (const PluginDescription& other) throw();
  12271. PluginDescription& operator= (const PluginDescription& other) throw();
  12272. ~PluginDescription() throw();
  12273. String name;
  12274. String pluginFormatName;
  12275. String category;
  12276. String manufacturerName;
  12277. String version;
  12278. String fileOrIdentifier;
  12279. Time lastFileModTime;
  12280. int uid;
  12281. bool isInstrument;
  12282. int numInputChannels;
  12283. int numOutputChannels;
  12284. bool isDuplicateOf (const PluginDescription& other) const;
  12285. const String createIdentifierString() const throw();
  12286. XmlElement* createXml() const;
  12287. bool loadFromXml (const XmlElement& xml);
  12288. juce_UseDebuggingNewOperator
  12289. };
  12290. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12291. /*** End of inlined file: juce_PluginDescription.h ***/
  12292. class JUCE_API AudioPluginInstance : public AudioProcessor
  12293. {
  12294. public:
  12295. virtual ~AudioPluginInstance();
  12296. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12297. juce_UseDebuggingNewOperator
  12298. protected:
  12299. AudioPluginInstance();
  12300. AudioPluginInstance (const AudioPluginInstance&);
  12301. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12302. };
  12303. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12304. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12305. class PluginDescription;
  12306. class JUCE_API AudioPluginFormat
  12307. {
  12308. public:
  12309. virtual ~AudioPluginFormat();
  12310. virtual const String getName() const = 0;
  12311. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12312. const String& fileOrIdentifier) = 0;
  12313. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12314. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12315. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12316. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12317. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12318. const bool recursive) = 0;
  12319. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12320. juce_UseDebuggingNewOperator
  12321. protected:
  12322. AudioPluginFormat() throw();
  12323. AudioPluginFormat (const AudioPluginFormat&);
  12324. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12325. };
  12326. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12327. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12328. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12329. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12330. {
  12331. public:
  12332. AudioUnitPluginFormat();
  12333. ~AudioUnitPluginFormat();
  12334. const String getName() const { return "AudioUnit"; }
  12335. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12336. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12337. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12338. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12339. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12340. bool doesPluginStillExist (const PluginDescription& desc);
  12341. const FileSearchPath getDefaultLocationsToSearch();
  12342. juce_UseDebuggingNewOperator
  12343. private:
  12344. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12345. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12346. };
  12347. #endif
  12348. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12349. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12350. #endif
  12351. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12352. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12353. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12354. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12355. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12356. // Sorry, this file is just a placeholder at the moment!...
  12357. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12358. {
  12359. public:
  12360. DirectXPluginFormat();
  12361. ~DirectXPluginFormat();
  12362. const String getName() const { return "DirectX"; }
  12363. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12364. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12365. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12366. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12367. const FileSearchPath getDefaultLocationsToSearch();
  12368. juce_UseDebuggingNewOperator
  12369. private:
  12370. DirectXPluginFormat (const DirectXPluginFormat&);
  12371. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12372. };
  12373. #endif
  12374. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12375. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12376. #endif
  12377. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12378. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12379. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12380. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12381. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12382. // Sorry, this file is just a placeholder at the moment!...
  12383. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12384. {
  12385. public:
  12386. LADSPAPluginFormat();
  12387. ~LADSPAPluginFormat();
  12388. const String getName() const { return "LADSPA"; }
  12389. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12390. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12391. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12392. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12393. const FileSearchPath getDefaultLocationsToSearch();
  12394. juce_UseDebuggingNewOperator
  12395. private:
  12396. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12397. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12398. };
  12399. #endif
  12400. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12401. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12402. #endif
  12403. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12404. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12405. #ifdef __aeffect__
  12406. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12407. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12408. class VSTMidiEventList
  12409. {
  12410. public:
  12411. VSTMidiEventList()
  12412. : numEventsUsed (0), numEventsAllocated (0)
  12413. {
  12414. }
  12415. ~VSTMidiEventList()
  12416. {
  12417. freeEvents();
  12418. }
  12419. void clear()
  12420. {
  12421. numEventsUsed = 0;
  12422. if (events != 0)
  12423. events->numEvents = 0;
  12424. }
  12425. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12426. {
  12427. ensureSize (numEventsUsed + 1);
  12428. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12429. events->numEvents = ++numEventsUsed;
  12430. if (numBytes <= 4)
  12431. {
  12432. if (e->type == kVstSysExType)
  12433. {
  12434. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12435. e->type = kVstMidiType;
  12436. e->byteSize = sizeof (VstMidiEvent);
  12437. e->noteLength = 0;
  12438. e->noteOffset = 0;
  12439. e->detune = 0;
  12440. e->noteOffVelocity = 0;
  12441. }
  12442. e->deltaFrames = frameOffset;
  12443. memcpy (e->midiData, midiData, numBytes);
  12444. }
  12445. else
  12446. {
  12447. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12448. if (se->type == kVstSysExType)
  12449. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12450. else
  12451. se->sysexDump = (char*) juce_malloc (numBytes);
  12452. memcpy (se->sysexDump, midiData, numBytes);
  12453. se->type = kVstSysExType;
  12454. se->byteSize = sizeof (VstMidiSysexEvent);
  12455. se->deltaFrames = frameOffset;
  12456. se->flags = 0;
  12457. se->dumpBytes = numBytes;
  12458. se->resvd1 = 0;
  12459. se->resvd2 = 0;
  12460. }
  12461. }
  12462. // Handy method to pull the events out of an event buffer supplied by the host
  12463. // or plugin.
  12464. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12465. {
  12466. for (int i = 0; i < events->numEvents; ++i)
  12467. {
  12468. const VstEvent* const e = events->events[i];
  12469. if (e != 0)
  12470. {
  12471. if (e->type == kVstMidiType)
  12472. {
  12473. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12474. 4, e->deltaFrames);
  12475. }
  12476. else if (e->type == kVstSysExType)
  12477. {
  12478. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12479. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12480. e->deltaFrames);
  12481. }
  12482. }
  12483. }
  12484. }
  12485. void ensureSize (int numEventsNeeded)
  12486. {
  12487. if (numEventsNeeded > numEventsAllocated)
  12488. {
  12489. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12490. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12491. if (events == 0)
  12492. events.calloc (size, 1);
  12493. else
  12494. events.realloc (size, 1);
  12495. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12496. {
  12497. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12498. (int) sizeof (VstMidiSysexEvent)));
  12499. e->type = kVstMidiType;
  12500. e->byteSize = sizeof (VstMidiEvent);
  12501. events->events[i] = (VstEvent*) e;
  12502. }
  12503. numEventsAllocated = numEventsNeeded;
  12504. }
  12505. }
  12506. void freeEvents()
  12507. {
  12508. if (events != 0)
  12509. {
  12510. for (int i = numEventsAllocated; --i >= 0;)
  12511. {
  12512. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12513. if (e->type == kVstSysExType)
  12514. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12515. juce_free (e);
  12516. }
  12517. events.free();
  12518. numEventsUsed = 0;
  12519. numEventsAllocated = 0;
  12520. }
  12521. }
  12522. HeapBlock <VstEvents> events;
  12523. private:
  12524. int numEventsUsed, numEventsAllocated;
  12525. };
  12526. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12527. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12528. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12529. #endif
  12530. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12531. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12532. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12533. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12534. #if JUCE_PLUGINHOST_VST
  12535. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12536. {
  12537. public:
  12538. VSTPluginFormat();
  12539. ~VSTPluginFormat();
  12540. const String getName() const { return "VST"; }
  12541. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12542. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12543. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12544. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12545. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12546. bool doesPluginStillExist (const PluginDescription& desc);
  12547. const FileSearchPath getDefaultLocationsToSearch();
  12548. juce_UseDebuggingNewOperator
  12549. private:
  12550. VSTPluginFormat (const VSTPluginFormat&);
  12551. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12552. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12553. };
  12554. #endif
  12555. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12556. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12557. #endif
  12558. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12559. #endif
  12560. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12561. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12562. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12563. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12564. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12565. {
  12566. public:
  12567. AudioPluginFormatManager() throw();
  12568. ~AudioPluginFormatManager() throw();
  12569. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12570. void addDefaultFormats();
  12571. int getNumFormats() throw();
  12572. AudioPluginFormat* getFormat (const int index) throw();
  12573. void addFormat (AudioPluginFormat* const format) throw();
  12574. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12575. String& errorMessage) const;
  12576. bool doesPluginStillExist (const PluginDescription& description) const;
  12577. juce_UseDebuggingNewOperator
  12578. private:
  12579. OwnedArray <AudioPluginFormat> formats;
  12580. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12581. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12582. };
  12583. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12584. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12585. #endif
  12586. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12587. #endif
  12588. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12589. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12590. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12591. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12592. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12593. {
  12594. public:
  12595. KnownPluginList();
  12596. ~KnownPluginList();
  12597. void clear();
  12598. int getNumTypes() const throw() { return types.size(); }
  12599. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12600. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12601. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12602. bool addType (const PluginDescription& type);
  12603. void removeType (const int index) throw();
  12604. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12605. const bool dontRescanIfAlreadyInList,
  12606. OwnedArray <PluginDescription>& typesFound,
  12607. AudioPluginFormat& formatToUse);
  12608. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12609. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12610. OwnedArray <PluginDescription>& typesFound);
  12611. enum SortMethod
  12612. {
  12613. defaultOrder = 0,
  12614. sortAlphabetically,
  12615. sortByCategory,
  12616. sortByManufacturer,
  12617. sortByFileSystemLocation
  12618. };
  12619. void addToMenu (PopupMenu& menu,
  12620. const SortMethod sortMethod) const;
  12621. int getIndexChosenByMenu (const int menuResultCode) const;
  12622. void sort (const SortMethod method);
  12623. XmlElement* createXml() const;
  12624. void recreateFromXml (const XmlElement& xml);
  12625. juce_UseDebuggingNewOperator
  12626. private:
  12627. OwnedArray <PluginDescription> types;
  12628. KnownPluginList (const KnownPluginList&);
  12629. KnownPluginList& operator= (const KnownPluginList&);
  12630. };
  12631. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12632. /*** End of inlined file: juce_KnownPluginList.h ***/
  12633. #endif
  12634. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12635. #endif
  12636. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12637. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12638. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12639. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12640. class JUCE_API PluginDirectoryScanner
  12641. {
  12642. public:
  12643. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12644. AudioPluginFormat& formatToLookFor,
  12645. FileSearchPath directoriesToSearch,
  12646. const bool searchRecursively,
  12647. const File& deadMansPedalFile);
  12648. ~PluginDirectoryScanner();
  12649. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12650. const String getNextPluginFileThatWillBeScanned() const throw();
  12651. float getProgress() const { return progress; }
  12652. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12653. juce_UseDebuggingNewOperator
  12654. private:
  12655. KnownPluginList& list;
  12656. AudioPluginFormat& format;
  12657. StringArray filesOrIdentifiersToScan;
  12658. File deadMansPedalFile;
  12659. StringArray failedFiles;
  12660. int nextIndex;
  12661. float progress;
  12662. const StringArray getDeadMansPedalFile() throw();
  12663. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12664. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12665. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12666. };
  12667. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12668. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12669. #endif
  12670. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12671. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12672. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12673. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12674. /*** Start of inlined file: juce_ListBox.h ***/
  12675. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12676. #define __JUCE_LISTBOX_JUCEHEADER__
  12677. class ListViewport;
  12678. class JUCE_API ListBoxModel
  12679. {
  12680. public:
  12681. virtual ~ListBoxModel() {}
  12682. virtual int getNumRows() = 0;
  12683. virtual void paintListBoxItem (int rowNumber,
  12684. Graphics& g,
  12685. int width, int height,
  12686. bool rowIsSelected) = 0;
  12687. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12688. Component* existingComponentToUpdate);
  12689. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12690. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12691. virtual void backgroundClicked();
  12692. virtual void selectedRowsChanged (int lastRowSelected);
  12693. virtual void deleteKeyPressed (int lastRowSelected);
  12694. virtual void returnKeyPressed (int lastRowSelected);
  12695. virtual void listWasScrolled();
  12696. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12697. virtual const String getTooltipForRow (int row);
  12698. };
  12699. class JUCE_API ListBox : public Component,
  12700. public SettableTooltipClient
  12701. {
  12702. public:
  12703. ListBox (const String& componentName,
  12704. ListBoxModel* model);
  12705. ~ListBox();
  12706. void setModel (ListBoxModel* newModel);
  12707. ListBoxModel* getModel() const throw() { return model; }
  12708. void updateContent();
  12709. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12710. void setMouseMoveSelectsRows (bool shouldSelect);
  12711. void selectRow (int rowNumber,
  12712. bool dontScrollToShowThisRow = false,
  12713. bool deselectOthersFirst = true);
  12714. void selectRangeOfRows (int firstRow,
  12715. int lastRow);
  12716. void deselectRow (int rowNumber);
  12717. void deselectAllRows();
  12718. void flipRowSelection (int rowNumber);
  12719. const SparseSet<int> getSelectedRows() const;
  12720. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12721. bool sendNotificationEventToModel = true);
  12722. bool isRowSelected (int rowNumber) const;
  12723. int getNumSelectedRows() const;
  12724. int getSelectedRow (int index = 0) const;
  12725. int getLastRowSelected() const;
  12726. void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn,
  12727. const ModifierKeys& modifiers);
  12728. void setVerticalPosition (double newProportion);
  12729. double getVerticalPosition() const;
  12730. void scrollToEnsureRowIsOnscreen (int row);
  12731. ScrollBar* getVerticalScrollBar() const throw();
  12732. ScrollBar* getHorizontalScrollBar() const throw();
  12733. int getRowContainingPosition (int x, int y) const throw();
  12734. int getInsertionIndexForPosition (int x, int y) const throw();
  12735. const Rectangle<int> getRowPosition (int rowNumber,
  12736. bool relativeToComponentTopLeft) const throw();
  12737. Component* getComponentForRowNumber (int rowNumber) const throw();
  12738. int getRowNumberOfComponent (Component* rowComponent) const throw();
  12739. int getVisibleRowWidth() const throw();
  12740. void setRowHeight (int newHeight);
  12741. int getRowHeight() const throw() { return rowHeight; }
  12742. int getNumRowsOnScreen() const throw();
  12743. enum ColourIds
  12744. {
  12745. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12746. Make this transparent if you don't want the background to be filled. */
  12747. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12748. Make this transparent to not have an outline. */
  12749. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12750. };
  12751. void setOutlineThickness (int outlineThickness);
  12752. int getOutlineThickness() const throw() { return outlineThickness; }
  12753. void setHeaderComponent (Component* newHeaderComponent);
  12754. void setMinimumContentWidth (int newMinimumWidth);
  12755. int getVisibleContentWidth() const throw();
  12756. void repaintRow (int rowNumber) throw();
  12757. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12758. Viewport* getViewport() const throw();
  12759. bool keyPressed (const KeyPress& key);
  12760. bool keyStateChanged (bool isKeyDown);
  12761. void paint (Graphics& g);
  12762. void paintOverChildren (Graphics& g);
  12763. void resized();
  12764. void visibilityChanged();
  12765. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12766. void mouseMove (const MouseEvent&);
  12767. void mouseExit (const MouseEvent&);
  12768. void mouseUp (const MouseEvent&);
  12769. void colourChanged();
  12770. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12771. juce_UseDebuggingNewOperator
  12772. private:
  12773. friend class ListViewport;
  12774. friend class TableListBox;
  12775. ListBoxModel* model;
  12776. ListViewport* viewport;
  12777. Component* headerComponent;
  12778. int totalItems, rowHeight, minimumRowWidth;
  12779. int outlineThickness;
  12780. int lastRowSelected;
  12781. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12782. SparseSet <int> selected;
  12783. void selectRowInternal (int rowNumber,
  12784. bool dontScrollToShowThisRow,
  12785. bool deselectOthersFirst,
  12786. bool isMouseClick);
  12787. ListBox (const ListBox&);
  12788. ListBox& operator= (const ListBox&);
  12789. };
  12790. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12791. /*** End of inlined file: juce_ListBox.h ***/
  12792. /*** Start of inlined file: juce_TextButton.h ***/
  12793. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12794. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12795. class JUCE_API TextButton : public Button
  12796. {
  12797. public:
  12798. TextButton (const String& buttonName,
  12799. const String& toolTip = String::empty);
  12800. ~TextButton();
  12801. enum ColourIds
  12802. {
  12803. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12804. 'off'). The look-and-feel class might re-interpret this to add
  12805. effects, etc. */
  12806. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12807. 'on'). The look-and-feel class might re-interpret this to add
  12808. effects, etc. */
  12809. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12810. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12811. };
  12812. void changeWidthToFitText (int newHeight = -1);
  12813. virtual const Font getFont();
  12814. juce_UseDebuggingNewOperator
  12815. protected:
  12816. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12817. void colourChanged();
  12818. private:
  12819. TextButton (const TextButton&);
  12820. TextButton& operator= (const TextButton&);
  12821. };
  12822. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12823. /*** End of inlined file: juce_TextButton.h ***/
  12824. class JUCE_API PluginListComponent : public Component,
  12825. public ListBoxModel,
  12826. public ChangeListener,
  12827. public ButtonListener,
  12828. public Timer
  12829. {
  12830. public:
  12831. PluginListComponent (KnownPluginList& listToRepresent,
  12832. const File& deadMansPedalFile,
  12833. PropertiesFile* const propertiesToUse);
  12834. ~PluginListComponent();
  12835. void resized();
  12836. bool isInterestedInFileDrag (const StringArray& files);
  12837. void filesDropped (const StringArray& files, int, int);
  12838. int getNumRows();
  12839. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12840. void deleteKeyPressed (int lastRowSelected);
  12841. void buttonClicked (Button* b);
  12842. void changeListenerCallback (void*);
  12843. void timerCallback();
  12844. juce_UseDebuggingNewOperator
  12845. private:
  12846. KnownPluginList& list;
  12847. File deadMansPedalFile;
  12848. ListBox* listBox;
  12849. TextButton* optionsButton;
  12850. PropertiesFile* propertiesToUse;
  12851. int typeToScan;
  12852. void scanFor (AudioPluginFormat* format);
  12853. PluginListComponent (const PluginListComponent&);
  12854. PluginListComponent& operator= (const PluginListComponent&);
  12855. };
  12856. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12857. /*** End of inlined file: juce_PluginListComponent.h ***/
  12858. #endif
  12859. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12860. #endif
  12861. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12862. #endif
  12863. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12864. #endif
  12865. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12866. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12867. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12868. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12869. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12870. public AsyncUpdater
  12871. {
  12872. public:
  12873. AudioProcessorGraph();
  12874. ~AudioProcessorGraph();
  12875. class JUCE_API Node : public ReferenceCountedObject
  12876. {
  12877. public:
  12878. ~Node();
  12879. const uint32 id;
  12880. AudioProcessor* const processor;
  12881. NamedValueSet properties;
  12882. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12883. juce_UseDebuggingNewOperator
  12884. private:
  12885. friend class AudioProcessorGraph;
  12886. bool isPrepared;
  12887. Node (const uint32 id, AudioProcessor* const processor);
  12888. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12889. void unprepare();
  12890. Node (const Node&);
  12891. Node& operator= (const Node&);
  12892. };
  12893. struct JUCE_API Connection
  12894. {
  12895. public:
  12896. uint32 sourceNodeId;
  12897. int sourceChannelIndex;
  12898. uint32 destNodeId;
  12899. int destChannelIndex;
  12900. juce_UseDebuggingNewOperator
  12901. private:
  12902. };
  12903. void clear();
  12904. int getNumNodes() const { return nodes.size(); }
  12905. Node* getNode (const int index) const { return nodes [index]; }
  12906. Node* getNodeForId (const uint32 nodeId) const;
  12907. Node* addNode (AudioProcessor* const newProcessor,
  12908. uint32 nodeId = 0);
  12909. bool removeNode (const uint32 nodeId);
  12910. int getNumConnections() const { return connections.size(); }
  12911. const Connection* getConnection (const int index) const { return connections [index]; }
  12912. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12913. const int sourceChannelIndex,
  12914. const uint32 destNodeId,
  12915. const int destChannelIndex) const;
  12916. bool isConnected (const uint32 possibleSourceNodeId,
  12917. const uint32 possibleDestNodeId) const;
  12918. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12919. const uint32 destNodeId, const int destChannelIndex) const;
  12920. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12921. const uint32 destNodeId, const int destChannelIndex);
  12922. void removeConnection (const int index);
  12923. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12924. const uint32 destNodeId, const int destChannelIndex);
  12925. bool disconnectNode (const uint32 nodeId);
  12926. bool removeIllegalConnections();
  12927. static const int midiChannelIndex;
  12928. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12929. {
  12930. public:
  12931. enum IODeviceType
  12932. {
  12933. audioInputNode, /**< In this mode, the processor has output channels
  12934. representing all the audio input channels that are
  12935. coming into its parent audio graph. */
  12936. audioOutputNode, /**< In this mode, the processor has input channels
  12937. representing all the audio output channels that are
  12938. going out of its parent audio graph. */
  12939. midiInputNode, /**< In this mode, the processor has a midi output which
  12940. delivers the same midi data that is arriving at its
  12941. parent graph. */
  12942. midiOutputNode /**< In this mode, the processor has a midi input and
  12943. any data sent to it will be passed out of the parent
  12944. graph. */
  12945. };
  12946. IODeviceType getType() const { return type; }
  12947. AudioProcessorGraph* getParentGraph() const { return graph; }
  12948. bool isInput() const;
  12949. bool isOutput() const;
  12950. AudioGraphIOProcessor (const IODeviceType type);
  12951. ~AudioGraphIOProcessor();
  12952. const String getName() const;
  12953. void fillInPluginDescription (PluginDescription& d) const;
  12954. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12955. void releaseResources();
  12956. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12957. const String getInputChannelName (const int channelIndex) const;
  12958. const String getOutputChannelName (const int channelIndex) const;
  12959. bool isInputChannelStereoPair (int index) const;
  12960. bool isOutputChannelStereoPair (int index) const;
  12961. bool acceptsMidi() const;
  12962. bool producesMidi() const;
  12963. AudioProcessorEditor* createEditor();
  12964. int getNumParameters();
  12965. const String getParameterName (int);
  12966. float getParameter (int);
  12967. const String getParameterText (int);
  12968. void setParameter (int, float);
  12969. int getNumPrograms();
  12970. int getCurrentProgram();
  12971. void setCurrentProgram (int);
  12972. const String getProgramName (int);
  12973. void changeProgramName (int, const String&);
  12974. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12975. void setStateInformation (const void* data, int sizeInBytes);
  12976. void setParentGraph (AudioProcessorGraph* const graph);
  12977. juce_UseDebuggingNewOperator
  12978. private:
  12979. const IODeviceType type;
  12980. AudioProcessorGraph* graph;
  12981. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  12982. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  12983. };
  12984. // AudioProcessor methods:
  12985. const String getName() const;
  12986. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12987. void releaseResources();
  12988. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12989. const String getInputChannelName (const int channelIndex) const;
  12990. const String getOutputChannelName (const int channelIndex) const;
  12991. bool isInputChannelStereoPair (int index) const;
  12992. bool isOutputChannelStereoPair (int index) const;
  12993. bool acceptsMidi() const;
  12994. bool producesMidi() const;
  12995. AudioProcessorEditor* createEditor() { return 0; }
  12996. int getNumParameters() { return 0; }
  12997. const String getParameterName (int) { return String::empty; }
  12998. float getParameter (int) { return 0; }
  12999. const String getParameterText (int) { return String::empty; }
  13000. void setParameter (int, float) { }
  13001. int getNumPrograms() { return 0; }
  13002. int getCurrentProgram() { return 0; }
  13003. void setCurrentProgram (int) { }
  13004. const String getProgramName (int) { return String::empty; }
  13005. void changeProgramName (int, const String&) { }
  13006. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13007. void setStateInformation (const void* data, int sizeInBytes);
  13008. void handleAsyncUpdate();
  13009. juce_UseDebuggingNewOperator
  13010. private:
  13011. ReferenceCountedArray <Node> nodes;
  13012. OwnedArray <Connection> connections;
  13013. int lastNodeId;
  13014. AudioSampleBuffer renderingBuffers;
  13015. OwnedArray <MidiBuffer> midiBuffers;
  13016. CriticalSection renderLock;
  13017. VoidArray renderingOps;
  13018. friend class AudioGraphIOProcessor;
  13019. AudioSampleBuffer* currentAudioInputBuffer;
  13020. AudioSampleBuffer currentAudioOutputBuffer;
  13021. MidiBuffer* currentMidiInputBuffer;
  13022. MidiBuffer currentMidiOutputBuffer;
  13023. void clearRenderingSequence();
  13024. void buildRenderingSequence();
  13025. bool isAnInputTo (const uint32 possibleInputId,
  13026. const uint32 possibleDestinationId,
  13027. const int recursionCheck) const;
  13028. AudioProcessorGraph (const AudioProcessorGraph&);
  13029. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13030. };
  13031. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13032. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13033. #endif
  13034. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13035. #endif
  13036. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13037. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13038. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13039. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13040. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13041. public MidiInputCallback
  13042. {
  13043. public:
  13044. AudioProcessorPlayer();
  13045. virtual ~AudioProcessorPlayer();
  13046. void setProcessor (AudioProcessor* const processorToPlay);
  13047. AudioProcessor* getCurrentProcessor() const { return processor; }
  13048. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13049. void audioDeviceIOCallback (const float** inputChannelData,
  13050. int totalNumInputChannels,
  13051. float** outputChannelData,
  13052. int totalNumOutputChannels,
  13053. int numSamples);
  13054. void audioDeviceAboutToStart (AudioIODevice* device);
  13055. void audioDeviceStopped();
  13056. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13057. juce_UseDebuggingNewOperator
  13058. private:
  13059. AudioProcessor* processor;
  13060. CriticalSection lock;
  13061. double sampleRate;
  13062. int blockSize;
  13063. bool isPrepared;
  13064. int numInputChans, numOutputChans;
  13065. float* channels [128];
  13066. AudioSampleBuffer tempBuffer;
  13067. MidiBuffer incomingMidi;
  13068. MidiMessageCollector messageCollector;
  13069. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13070. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13071. };
  13072. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13073. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13074. #endif
  13075. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13076. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13077. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13078. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13079. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13080. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13081. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13082. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13083. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13084. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13085. class EditableProperty;
  13086. class JUCE_API PropertyComponent : public Component,
  13087. public SettableTooltipClient
  13088. {
  13089. public:
  13090. PropertyComponent (const String& propertyName,
  13091. int preferredHeight = 25);
  13092. ~PropertyComponent();
  13093. int getPreferredHeight() const throw() { return preferredHeight; }
  13094. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13095. virtual void refresh() = 0;
  13096. void paint (Graphics& g);
  13097. void resized();
  13098. void enablementChanged();
  13099. juce_UseDebuggingNewOperator
  13100. protected:
  13101. int preferredHeight;
  13102. };
  13103. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13104. /*** End of inlined file: juce_PropertyComponent.h ***/
  13105. class JUCE_API PropertyPanel : public Component
  13106. {
  13107. public:
  13108. PropertyPanel();
  13109. ~PropertyPanel();
  13110. void clear();
  13111. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13112. void addSection (const String& sectionTitle,
  13113. const Array <PropertyComponent*>& newPropertyComponents,
  13114. bool shouldSectionInitiallyBeOpen = true);
  13115. void refreshAll() const;
  13116. const StringArray getSectionNames() const;
  13117. bool isSectionOpen (int sectionIndex) const;
  13118. void setSectionOpen (int sectionIndex, bool shouldBeOpen);
  13119. void setSectionEnabled (int sectionIndex, bool shouldBeEnabled);
  13120. XmlElement* getOpennessState() const;
  13121. void restoreOpennessState (const XmlElement& newState);
  13122. void setMessageWhenEmpty (const String& newMessage);
  13123. const String& getMessageWhenEmpty() const;
  13124. void paint (Graphics& g);
  13125. void resized();
  13126. juce_UseDebuggingNewOperator
  13127. private:
  13128. Viewport* viewport;
  13129. Component* propertyHolderComponent;
  13130. String messageWhenEmpty;
  13131. void updatePropHolderLayout() const;
  13132. void updatePropHolderLayout (int width) const;
  13133. };
  13134. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13135. /*** End of inlined file: juce_PropertyPanel.h ***/
  13136. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13137. {
  13138. public:
  13139. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13140. ~GenericAudioProcessorEditor();
  13141. void paint (Graphics& g);
  13142. void resized();
  13143. juce_UseDebuggingNewOperator
  13144. private:
  13145. PropertyPanel* panel;
  13146. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13147. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13148. };
  13149. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13150. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13151. #endif
  13152. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13153. /*** Start of inlined file: juce_Sampler.h ***/
  13154. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13155. #define __JUCE_SAMPLER_JUCEHEADER__
  13156. /*** Start of inlined file: juce_Synthesiser.h ***/
  13157. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13158. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13159. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13160. {
  13161. protected:
  13162. SynthesiserSound();
  13163. public:
  13164. virtual ~SynthesiserSound();
  13165. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13166. virtual bool appliesToChannel (const int midiChannel) = 0;
  13167. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13168. juce_UseDebuggingNewOperator
  13169. };
  13170. class JUCE_API SynthesiserVoice
  13171. {
  13172. public:
  13173. SynthesiserVoice();
  13174. virtual ~SynthesiserVoice();
  13175. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13176. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13177. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13178. virtual void startNote (const int midiNoteNumber,
  13179. const float velocity,
  13180. SynthesiserSound* sound,
  13181. const int currentPitchWheelPosition) = 0;
  13182. virtual void stopNote (const bool allowTailOff) = 0;
  13183. virtual void pitchWheelMoved (const int newValue) = 0;
  13184. virtual void controllerMoved (const int controllerNumber,
  13185. const int newValue) = 0;
  13186. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13187. int startSample,
  13188. int numSamples) = 0;
  13189. bool isPlayingChannel (const int midiChannel) const;
  13190. void setCurrentPlaybackSampleRate (const double newRate);
  13191. juce_UseDebuggingNewOperator
  13192. protected:
  13193. double getSampleRate() const { return currentSampleRate; }
  13194. void clearCurrentNote();
  13195. private:
  13196. friend class Synthesiser;
  13197. double currentSampleRate;
  13198. int currentlyPlayingNote;
  13199. uint32 noteOnTime;
  13200. SynthesiserSound::Ptr currentlyPlayingSound;
  13201. };
  13202. class JUCE_API Synthesiser
  13203. {
  13204. public:
  13205. Synthesiser();
  13206. virtual ~Synthesiser();
  13207. void clearVoices();
  13208. int getNumVoices() const { return voices.size(); }
  13209. SynthesiserVoice* getVoice (const int index) const;
  13210. void addVoice (SynthesiserVoice* const newVoice);
  13211. void removeVoice (const int index);
  13212. void clearSounds();
  13213. int getNumSounds() const { return sounds.size(); }
  13214. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13215. void addSound (const SynthesiserSound::Ptr& newSound);
  13216. void removeSound (const int index);
  13217. void setNoteStealingEnabled (const bool shouldStealNotes);
  13218. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13219. virtual void noteOn (const int midiChannel,
  13220. const int midiNoteNumber,
  13221. const float velocity);
  13222. virtual void noteOff (const int midiChannel,
  13223. const int midiNoteNumber,
  13224. const bool allowTailOff);
  13225. virtual void allNotesOff (const int midiChannel,
  13226. const bool allowTailOff);
  13227. virtual void handlePitchWheel (const int midiChannel,
  13228. const int wheelValue);
  13229. virtual void handleController (const int midiChannel,
  13230. const int controllerNumber,
  13231. const int controllerValue);
  13232. void setCurrentPlaybackSampleRate (const double sampleRate);
  13233. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13234. const MidiBuffer& inputMidi,
  13235. int startSample,
  13236. int numSamples);
  13237. juce_UseDebuggingNewOperator
  13238. protected:
  13239. CriticalSection lock;
  13240. OwnedArray <SynthesiserVoice> voices;
  13241. ReferenceCountedArray <SynthesiserSound> sounds;
  13242. int lastPitchWheelValues [16];
  13243. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13244. const bool stealIfNoneAvailable) const;
  13245. void startVoice (SynthesiserVoice* const voice,
  13246. SynthesiserSound* const sound,
  13247. const int midiChannel,
  13248. const int midiNoteNumber,
  13249. const float velocity);
  13250. int findFreeVoice (const bool) const { return 0; }
  13251. private:
  13252. double sampleRate;
  13253. uint32 lastNoteOnCounter;
  13254. bool shouldStealNotes;
  13255. Synthesiser (const Synthesiser&);
  13256. Synthesiser& operator= (const Synthesiser&);
  13257. };
  13258. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13259. /*** End of inlined file: juce_Synthesiser.h ***/
  13260. class JUCE_API SamplerSound : public SynthesiserSound
  13261. {
  13262. public:
  13263. SamplerSound (const String& name,
  13264. AudioFormatReader& source,
  13265. const BigInteger& midiNotes,
  13266. const int midiNoteForNormalPitch,
  13267. const double attackTimeSecs,
  13268. const double releaseTimeSecs,
  13269. const double maxSampleLengthSeconds);
  13270. ~SamplerSound();
  13271. const String& getName() const { return name; }
  13272. AudioSampleBuffer* getAudioData() const { return data; }
  13273. bool appliesToNote (const int midiNoteNumber);
  13274. bool appliesToChannel (const int midiChannel);
  13275. juce_UseDebuggingNewOperator
  13276. private:
  13277. friend class SamplerVoice;
  13278. String name;
  13279. ScopedPointer <AudioSampleBuffer> data;
  13280. double sourceSampleRate;
  13281. BigInteger midiNotes;
  13282. int length, attackSamples, releaseSamples;
  13283. int midiRootNote;
  13284. };
  13285. class JUCE_API SamplerVoice : public SynthesiserVoice
  13286. {
  13287. public:
  13288. SamplerVoice();
  13289. ~SamplerVoice();
  13290. bool canPlaySound (SynthesiserSound* sound);
  13291. void startNote (const int midiNoteNumber,
  13292. const float velocity,
  13293. SynthesiserSound* sound,
  13294. const int currentPitchWheelPosition);
  13295. void stopNote (const bool allowTailOff);
  13296. void pitchWheelMoved (const int newValue);
  13297. void controllerMoved (const int controllerNumber,
  13298. const int newValue);
  13299. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13300. juce_UseDebuggingNewOperator
  13301. private:
  13302. double pitchRatio;
  13303. double sourceSamplePosition;
  13304. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13305. bool isInAttack, isInRelease;
  13306. };
  13307. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13308. /*** End of inlined file: juce_Sampler.h ***/
  13309. #endif
  13310. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13311. #endif
  13312. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13313. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13314. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13315. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13316. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13317. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13318. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13319. class JUCE_API ActionListenerList : public MessageListener
  13320. {
  13321. public:
  13322. ActionListenerList() throw();
  13323. ~ActionListenerList() throw();
  13324. void addActionListener (ActionListener* listener) throw();
  13325. void removeActionListener (ActionListener* listener) throw();
  13326. void removeAllActionListeners() throw();
  13327. void sendActionMessage (const String& message) const;
  13328. void handleMessage (const Message&);
  13329. juce_UseDebuggingNewOperator
  13330. private:
  13331. SortedSet <void*> actionListeners_;
  13332. CriticalSection actionListenerLock_;
  13333. ActionListenerList (const ActionListenerList&);
  13334. ActionListenerList& operator= (const ActionListenerList&);
  13335. };
  13336. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13337. /*** End of inlined file: juce_ActionListenerList.h ***/
  13338. class JUCE_API ActionBroadcaster
  13339. {
  13340. public:
  13341. ActionBroadcaster() throw();
  13342. virtual ~ActionBroadcaster();
  13343. void addActionListener (ActionListener* listener);
  13344. void removeActionListener (ActionListener* listener);
  13345. void removeAllActionListeners();
  13346. void sendActionMessage (const String& message) const;
  13347. private:
  13348. ActionListenerList actionListenerList;
  13349. ActionBroadcaster (const ActionBroadcaster&);
  13350. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13351. };
  13352. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13353. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13354. #endif
  13355. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13356. #endif
  13357. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13358. #endif
  13359. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13360. #endif
  13361. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13362. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13363. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13364. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13365. class JUCE_API CallbackMessage : public Message
  13366. {
  13367. public:
  13368. CallbackMessage() throw();
  13369. ~CallbackMessage() throw();
  13370. virtual void messageCallback() = 0;
  13371. void post();
  13372. juce_UseDebuggingNewOperator
  13373. private:
  13374. CallbackMessage (const CallbackMessage&);
  13375. CallbackMessage& operator= (const CallbackMessage&);
  13376. };
  13377. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13378. /*** End of inlined file: juce_CallbackMessage.h ***/
  13379. #endif
  13380. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13381. #endif
  13382. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13383. #endif
  13384. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13385. #endif
  13386. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13387. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13388. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13389. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13390. class InterprocessConnectionServer;
  13391. class JUCE_API InterprocessConnection : public Thread,
  13392. private MessageListener
  13393. {
  13394. public:
  13395. InterprocessConnection (bool callbacksOnMessageThread = true,
  13396. uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13397. ~InterprocessConnection();
  13398. bool connectToSocket (const String& hostName,
  13399. int portNumber,
  13400. int timeOutMillisecs);
  13401. bool connectToPipe (const String& pipeName,
  13402. int pipeReceiveMessageTimeoutMs = -1);
  13403. bool createPipe (const String& pipeName,
  13404. int pipeReceiveMessageTimeoutMs = -1);
  13405. void disconnect();
  13406. bool isConnected() const;
  13407. StreamingSocket* getSocket() const throw() { return socket; }
  13408. NamedPipe* getPipe() const throw() { return pipe; }
  13409. const String getConnectedHostName() const;
  13410. bool sendMessage (const MemoryBlock& message);
  13411. virtual void connectionMade() = 0;
  13412. virtual void connectionLost() = 0;
  13413. virtual void messageReceived (const MemoryBlock& message) = 0;
  13414. juce_UseDebuggingNewOperator
  13415. private:
  13416. CriticalSection pipeAndSocketLock;
  13417. ScopedPointer <StreamingSocket> socket;
  13418. ScopedPointer <NamedPipe> pipe;
  13419. bool callbackConnectionState;
  13420. const bool useMessageThread;
  13421. const uint32 magicMessageHeader;
  13422. int pipeReceiveMessageTimeout;
  13423. friend class InterprocessConnectionServer;
  13424. void initialiseWithSocket (StreamingSocket* socket_);
  13425. void initialiseWithPipe (NamedPipe* pipe_);
  13426. void handleMessage (const Message& message);
  13427. void connectionMadeInt();
  13428. void connectionLostInt();
  13429. void deliverDataInt (const MemoryBlock& data);
  13430. bool readNextMessageInt();
  13431. void run();
  13432. InterprocessConnection (const InterprocessConnection&);
  13433. InterprocessConnection& operator= (const InterprocessConnection&);
  13434. };
  13435. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13436. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13437. #endif
  13438. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13439. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13440. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13441. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13442. class JUCE_API InterprocessConnectionServer : private Thread
  13443. {
  13444. public:
  13445. InterprocessConnectionServer();
  13446. ~InterprocessConnectionServer();
  13447. bool beginWaitingForSocket (int portNumber);
  13448. void stop();
  13449. protected:
  13450. virtual InterprocessConnection* createConnectionObject() = 0;
  13451. public:
  13452. juce_UseDebuggingNewOperator
  13453. private:
  13454. ScopedPointer <StreamingSocket> socket;
  13455. void run();
  13456. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13457. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13458. };
  13459. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13460. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13461. #endif
  13462. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13463. #endif
  13464. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13465. #endif
  13466. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13467. #endif
  13468. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13469. /*** Start of inlined file: juce_MessageManager.h ***/
  13470. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13471. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13472. class Component;
  13473. class MessageManagerLock;
  13474. typedef void* (MessageCallbackFunction) (void* userData);
  13475. class JUCE_API MessageManager
  13476. {
  13477. public:
  13478. static MessageManager* getInstance() throw();
  13479. void runDispatchLoop();
  13480. void stopDispatchLoop();
  13481. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13482. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13483. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13484. void* userData);
  13485. bool isThisTheMessageThread() const throw();
  13486. void setCurrentThreadAsMessageThread();
  13487. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13488. bool currentThreadHasLockedMessageManager() const throw();
  13489. static void broadcastMessage (const String& messageText) throw();
  13490. void registerBroadcastListener (ActionListener* listener) throw();
  13491. void deregisterBroadcastListener (ActionListener* listener) throw();
  13492. void deliverMessage (void*);
  13493. void deliverBroadcastMessage (const String&);
  13494. ~MessageManager() throw();
  13495. juce_UseDebuggingNewOperator
  13496. private:
  13497. MessageManager() throw();
  13498. friend class MessageListener;
  13499. friend class ChangeBroadcaster;
  13500. friend class ActionBroadcaster;
  13501. friend class CallbackMessage;
  13502. static MessageManager* instance;
  13503. SortedSet <const MessageListener*> messageListeners;
  13504. ScopedPointer <ActionListenerList> broadcastListeners;
  13505. friend class JUCEApplication;
  13506. bool quitMessagePosted, quitMessageReceived;
  13507. Thread::ThreadID messageThreadId;
  13508. VoidArray modalComponents;
  13509. static void* exitModalLoopCallback (void*);
  13510. void postMessageToQueue (Message* message);
  13511. void postCallbackMessage (Message* message);
  13512. static void doPlatformSpecificInitialisation();
  13513. static void doPlatformSpecificShutdown();
  13514. friend class MessageManagerLock;
  13515. Thread::ThreadID volatile threadWithLock;
  13516. CriticalSection lockingLock;
  13517. MessageManager (const MessageManager&);
  13518. MessageManager& operator= (const MessageManager&);
  13519. };
  13520. class JUCE_API MessageManagerLock
  13521. {
  13522. public:
  13523. MessageManagerLock (Thread* threadToCheckForExitSignal = 0) throw();
  13524. MessageManagerLock (ThreadPoolJob* jobToCheckForExitSignal) throw();
  13525. ~MessageManagerLock() throw();
  13526. bool lockWasGained() const throw() { return locked; }
  13527. private:
  13528. class SharedEvents;
  13529. class BlockingMessage;
  13530. friend class SharedEvents;
  13531. friend class BlockingMessage;
  13532. SharedEvents* sharedEvents;
  13533. bool locked;
  13534. void init (Thread* thread, ThreadPoolJob* job) throw();
  13535. MessageManagerLock (const MessageManagerLock&);
  13536. MessageManagerLock& operator= (const MessageManagerLock&);
  13537. };
  13538. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13539. /*** End of inlined file: juce_MessageManager.h ***/
  13540. #endif
  13541. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13542. /*** Start of inlined file: juce_MultiTimer.h ***/
  13543. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13544. #define __JUCE_MULTITIMER_JUCEHEADER__
  13545. class JUCE_API MultiTimer
  13546. {
  13547. protected:
  13548. MultiTimer() throw();
  13549. MultiTimer (const MultiTimer& other) throw();
  13550. public:
  13551. virtual ~MultiTimer();
  13552. virtual void timerCallback (int timerId) = 0;
  13553. void startTimer (int timerId, int intervalInMilliseconds) throw();
  13554. void stopTimer (int timerId) throw();
  13555. bool isTimerRunning (int timerId) const throw();
  13556. int getTimerInterval (int timerId) const throw();
  13557. private:
  13558. class MultiTimerCallback;
  13559. CriticalSection timerListLock;
  13560. OwnedArray <MultiTimerCallback> timers;
  13561. MultiTimer& operator= (const MultiTimer&);
  13562. };
  13563. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13564. /*** End of inlined file: juce_MultiTimer.h ***/
  13565. #endif
  13566. #ifndef __JUCE_TIMER_JUCEHEADER__
  13567. #endif
  13568. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13569. /*** Start of inlined file: juce_ArrowButton.h ***/
  13570. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13571. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13572. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13573. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13574. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13575. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13576. {
  13577. public:
  13578. DropShadowEffect();
  13579. ~DropShadowEffect();
  13580. void setShadowProperties (const float newRadius,
  13581. const float newOpacity,
  13582. const int newShadowOffsetX,
  13583. const int newShadowOffsetY);
  13584. void applyEffect (Image& sourceImage, Graphics& destContext);
  13585. juce_UseDebuggingNewOperator
  13586. private:
  13587. int offsetX, offsetY;
  13588. float radius, opacity;
  13589. };
  13590. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13591. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13592. class JUCE_API ArrowButton : public Button
  13593. {
  13594. public:
  13595. ArrowButton (const String& buttonName,
  13596. float arrowDirection,
  13597. const Colour& arrowColour);
  13598. ~ArrowButton();
  13599. juce_UseDebuggingNewOperator
  13600. protected:
  13601. void paintButton (Graphics& g,
  13602. bool isMouseOverButton,
  13603. bool isButtonDown);
  13604. void buttonStateChanged();
  13605. private:
  13606. Colour colour;
  13607. DropShadowEffect shadow;
  13608. Path path;
  13609. int offset;
  13610. ArrowButton (const ArrowButton&);
  13611. ArrowButton& operator= (const ArrowButton&);
  13612. };
  13613. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13614. /*** End of inlined file: juce_ArrowButton.h ***/
  13615. #endif
  13616. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13617. #endif
  13618. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13619. /*** Start of inlined file: juce_DrawableButton.h ***/
  13620. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13621. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13622. /*** Start of inlined file: juce_Drawable.h ***/
  13623. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13624. #define __JUCE_DRAWABLE_JUCEHEADER__
  13625. class JUCE_API Drawable
  13626. {
  13627. protected:
  13628. Drawable();
  13629. public:
  13630. virtual ~Drawable();
  13631. virtual Drawable* createCopy() const = 0;
  13632. void draw (Graphics& g, float opacity,
  13633. const AffineTransform& transform = AffineTransform::identity) const;
  13634. void drawAt (Graphics& g,
  13635. float x, float y,
  13636. float opacity) const;
  13637. void drawWithin (Graphics& g,
  13638. int destX,
  13639. int destY,
  13640. int destWidth,
  13641. int destHeight,
  13642. const RectanglePlacement& placement,
  13643. float opacity) const;
  13644. class RenderingContext
  13645. {
  13646. public:
  13647. RenderingContext (Graphics& g, const AffineTransform& transform, float opacity) throw();
  13648. Graphics& g;
  13649. AffineTransform transform;
  13650. float opacity;
  13651. private:
  13652. RenderingContext& operator= (const RenderingContext&);
  13653. };
  13654. virtual void render (const RenderingContext& context) const = 0;
  13655. virtual const Rectangle<float> getBounds() const = 0;
  13656. virtual bool hitTest (float x, float y) const = 0;
  13657. const String& getName() const throw() { return name; }
  13658. void setName (const String& newName) throw() { name = newName; }
  13659. static Drawable* createFromImageData (const void* data, size_t numBytes);
  13660. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13661. static Drawable* createFromImageFile (const File& file);
  13662. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13663. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13664. virtual ValueTree createValueTree() const throw() = 0;
  13665. juce_UseDebuggingNewOperator
  13666. private:
  13667. Drawable (const Drawable&);
  13668. Drawable& operator= (const Drawable&);
  13669. String name;
  13670. };
  13671. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13672. /*** End of inlined file: juce_Drawable.h ***/
  13673. class JUCE_API DrawableButton : public Button
  13674. {
  13675. public:
  13676. enum ButtonStyle
  13677. {
  13678. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13679. ImageRaw, /**< The button will just display the images in their normal size and position.
  13680. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13681. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13682. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13683. };
  13684. DrawableButton (const String& buttonName,
  13685. ButtonStyle buttonStyle);
  13686. ~DrawableButton();
  13687. void setImages (const Drawable* normalImage,
  13688. const Drawable* overImage = 0,
  13689. const Drawable* downImage = 0,
  13690. const Drawable* disabledImage = 0,
  13691. const Drawable* normalImageOn = 0,
  13692. const Drawable* overImageOn = 0,
  13693. const Drawable* downImageOn = 0,
  13694. const Drawable* disabledImageOn = 0);
  13695. void setButtonStyle (ButtonStyle newStyle);
  13696. void setBackgroundColours (const Colour& toggledOffColour,
  13697. const Colour& toggledOnColour);
  13698. const Colour& getBackgroundColour() const throw();
  13699. void setEdgeIndent (int numPixelsIndent);
  13700. const Drawable* getCurrentImage() const throw();
  13701. const Drawable* getNormalImage() const throw();
  13702. const Drawable* getOverImage() const throw();
  13703. const Drawable* getDownImage() const throw();
  13704. juce_UseDebuggingNewOperator
  13705. protected:
  13706. void paintButton (Graphics& g,
  13707. bool isMouseOverButton,
  13708. bool isButtonDown);
  13709. private:
  13710. ButtonStyle style;
  13711. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13712. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13713. Colour backgroundOff, backgroundOn;
  13714. int edgeIndent;
  13715. void deleteImages();
  13716. DrawableButton (const DrawableButton&);
  13717. DrawableButton& operator= (const DrawableButton&);
  13718. };
  13719. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13720. /*** End of inlined file: juce_DrawableButton.h ***/
  13721. #endif
  13722. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13723. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13724. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13725. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13726. class JUCE_API HyperlinkButton : public Button
  13727. {
  13728. public:
  13729. HyperlinkButton (const String& linkText,
  13730. const URL& linkURL);
  13731. ~HyperlinkButton();
  13732. void setFont (const Font& newFont,
  13733. bool resizeToMatchComponentHeight,
  13734. const Justification& justificationType = Justification::horizontallyCentred);
  13735. enum ColourIds
  13736. {
  13737. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13738. };
  13739. void setURL (const URL& newURL) throw();
  13740. const URL& getURL() const throw() { return url; }
  13741. void changeWidthToFitText();
  13742. juce_UseDebuggingNewOperator
  13743. protected:
  13744. void clicked();
  13745. void colourChanged();
  13746. void paintButton (Graphics& g,
  13747. bool isMouseOverButton,
  13748. bool isButtonDown);
  13749. private:
  13750. URL url;
  13751. Font font;
  13752. bool resizeFont;
  13753. Justification justification;
  13754. const Font getFontToUse() const;
  13755. HyperlinkButton (const HyperlinkButton&);
  13756. HyperlinkButton& operator= (const HyperlinkButton&);
  13757. };
  13758. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13759. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13760. #endif
  13761. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13762. /*** Start of inlined file: juce_ImageButton.h ***/
  13763. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13764. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13765. class JUCE_API ImageButton : public Button
  13766. {
  13767. public:
  13768. ImageButton (const String& name);
  13769. ~ImageButton();
  13770. void setImages (bool resizeButtonNowToFitThisImage,
  13771. bool rescaleImagesWhenButtonSizeChanges,
  13772. bool preserveImageProportions,
  13773. Image* normalImage,
  13774. float imageOpacityWhenNormal,
  13775. const Colour& overlayColourWhenNormal,
  13776. Image* overImage,
  13777. float imageOpacityWhenOver,
  13778. const Colour& overlayColourWhenOver,
  13779. Image* downImage,
  13780. float imageOpacityWhenDown,
  13781. const Colour& overlayColourWhenDown,
  13782. float hitTestAlphaThreshold = 0.0f);
  13783. Image* getNormalImage() const throw();
  13784. Image* getOverImage() const throw();
  13785. Image* getDownImage() const throw();
  13786. juce_UseDebuggingNewOperator
  13787. protected:
  13788. bool hitTest (int x, int y);
  13789. void paintButton (Graphics& g,
  13790. bool isMouseOverButton,
  13791. bool isButtonDown);
  13792. private:
  13793. bool scaleImageToFit, preserveProportions;
  13794. unsigned char alphaThreshold;
  13795. int imageX, imageY, imageW, imageH;
  13796. Image* normalImage;
  13797. Image* overImage;
  13798. Image* downImage;
  13799. float normalOpacity, overOpacity, downOpacity;
  13800. Colour normalOverlay, overOverlay, downOverlay;
  13801. Image* getCurrentImage() const;
  13802. void deleteImages();
  13803. ImageButton (const ImageButton&);
  13804. ImageButton& operator= (const ImageButton&);
  13805. };
  13806. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13807. /*** End of inlined file: juce_ImageButton.h ***/
  13808. #endif
  13809. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13810. /*** Start of inlined file: juce_ShapeButton.h ***/
  13811. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13812. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13813. class JUCE_API ShapeButton : public Button
  13814. {
  13815. public:
  13816. ShapeButton (const String& name,
  13817. const Colour& normalColour,
  13818. const Colour& overColour,
  13819. const Colour& downColour);
  13820. ~ShapeButton();
  13821. void setShape (const Path& newShape,
  13822. bool resizeNowToFitThisShape,
  13823. bool maintainShapeProportions,
  13824. bool hasDropShadow);
  13825. void setColours (const Colour& normalColour,
  13826. const Colour& overColour,
  13827. const Colour& downColour);
  13828. void setOutline (const Colour& outlineColour,
  13829. float outlineStrokeWidth);
  13830. juce_UseDebuggingNewOperator
  13831. protected:
  13832. void paintButton (Graphics& g,
  13833. bool isMouseOverButton,
  13834. bool isButtonDown);
  13835. private:
  13836. Colour normalColour, overColour, downColour, outlineColour;
  13837. DropShadowEffect shadow;
  13838. Path shape;
  13839. bool maintainShapeProportions;
  13840. float outlineWidth;
  13841. ShapeButton (const ShapeButton&);
  13842. ShapeButton& operator= (const ShapeButton&);
  13843. };
  13844. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13845. /*** End of inlined file: juce_ShapeButton.h ***/
  13846. #endif
  13847. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13848. #endif
  13849. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13850. /*** Start of inlined file: juce_ToggleButton.h ***/
  13851. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13852. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13853. class JUCE_API ToggleButton : public Button
  13854. {
  13855. public:
  13856. ToggleButton (const String& buttonText);
  13857. ~ToggleButton();
  13858. void changeWidthToFitText();
  13859. enum ColourIds
  13860. {
  13861. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13862. };
  13863. juce_UseDebuggingNewOperator
  13864. protected:
  13865. void paintButton (Graphics& g,
  13866. bool isMouseOverButton,
  13867. bool isButtonDown);
  13868. void colourChanged();
  13869. private:
  13870. ToggleButton (const ToggleButton&);
  13871. ToggleButton& operator= (const ToggleButton&);
  13872. };
  13873. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13874. /*** End of inlined file: juce_ToggleButton.h ***/
  13875. #endif
  13876. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13877. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13878. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13879. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13880. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13881. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13882. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13883. /*** Start of inlined file: juce_Toolbar.h ***/
  13884. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13885. #define __JUCE_TOOLBAR_JUCEHEADER__
  13886. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13887. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13888. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13889. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13890. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13891. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13892. class JUCE_API DragAndDropTarget
  13893. {
  13894. public:
  13895. virtual ~DragAndDropTarget() {}
  13896. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13897. Component* sourceComponent) = 0;
  13898. virtual void itemDragEnter (const String& sourceDescription,
  13899. Component* sourceComponent,
  13900. int x, int y);
  13901. virtual void itemDragMove (const String& sourceDescription,
  13902. Component* sourceComponent,
  13903. int x, int y);
  13904. virtual void itemDragExit (const String& sourceDescription,
  13905. Component* sourceComponent);
  13906. virtual void itemDropped (const String& sourceDescription,
  13907. Component* sourceComponent,
  13908. int x, int y) = 0;
  13909. virtual bool shouldDrawDragImageWhenOver();
  13910. };
  13911. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13912. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13913. class JUCE_API DragAndDropContainer
  13914. {
  13915. public:
  13916. DragAndDropContainer();
  13917. virtual ~DragAndDropContainer();
  13918. void startDragging (const String& sourceDescription,
  13919. Component* sourceComponent,
  13920. Image* dragImage = 0,
  13921. bool allowDraggingToOtherJuceWindows = false,
  13922. const Point<int>* imageOffsetFromMouse = 0);
  13923. bool isDragAndDropActive() const;
  13924. const String getCurrentDragDescription() const;
  13925. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13926. static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles);
  13927. static bool performExternalDragDropOfText (const String& text);
  13928. juce_UseDebuggingNewOperator
  13929. protected:
  13930. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13931. Component* dragSourceComponent,
  13932. StringArray& files,
  13933. bool& canMoveFiles);
  13934. private:
  13935. friend class DragImageComponent;
  13936. ScopedPointer <Component> dragImageComponent;
  13937. String currentDragDesc;
  13938. };
  13939. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13940. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  13941. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  13942. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13943. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13944. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13945. private Timer
  13946. {
  13947. public:
  13948. ComponentAnimator();
  13949. ~ComponentAnimator();
  13950. void animateComponent (Component* const component,
  13951. const Rectangle<int>& finalPosition,
  13952. const int millisecondsToSpendMoving,
  13953. const double startSpeed = 1.0,
  13954. const double endSpeed = 1.0);
  13955. void cancelAnimation (Component* const component,
  13956. const bool moveComponentToItsFinalPosition);
  13957. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13958. const Rectangle<int> getComponentDestination (Component* const component);
  13959. bool isAnimating (Component* component) const;
  13960. juce_UseDebuggingNewOperator
  13961. private:
  13962. VoidArray tasks;
  13963. uint32 lastTime;
  13964. void* findTaskFor (Component* const component) const;
  13965. void timerCallback();
  13966. };
  13967. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13968. /*** End of inlined file: juce_ComponentAnimator.h ***/
  13969. class ToolbarItemComponent;
  13970. class ToolbarItemFactory;
  13971. class MissingItemsComponent;
  13972. class JUCE_API Toolbar : public Component,
  13973. public DragAndDropContainer,
  13974. public DragAndDropTarget,
  13975. private ButtonListener
  13976. {
  13977. public:
  13978. Toolbar();
  13979. ~Toolbar();
  13980. void setVertical (bool shouldBeVertical);
  13981. bool isVertical() const throw() { return vertical; }
  13982. int getThickness() const throw();
  13983. int getLength() const throw();
  13984. void clear();
  13985. void addItem (ToolbarItemFactory& factory,
  13986. int itemId,
  13987. int insertIndex = -1);
  13988. void removeToolbarItem (int itemIndex);
  13989. int getNumItems() const throw();
  13990. int getItemId (int itemIndex) const throw();
  13991. ToolbarItemComponent* getItemComponent (int itemIndex) const throw();
  13992. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  13993. enum ToolbarItemStyle
  13994. {
  13995. iconsOnly, /**< Means that the toolbar should just contain icons. */
  13996. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  13997. textOnly /**< Means that the toolbar only display text labels for each item. */
  13998. };
  13999. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14000. void setStyle (const ToolbarItemStyle& newStyle);
  14001. enum CustomisationFlags
  14002. {
  14003. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14004. show the "icons only" option on its choice of toolbar styles. */
  14005. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14006. show the "icons with text" option on its choice of toolbar styles. */
  14007. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14008. show the "text only" option on its choice of toolbar styles. */
  14009. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14010. show a button to reset the toolbar to its default set of items. */
  14011. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14012. };
  14013. void showCustomisationDialog (ToolbarItemFactory& factory,
  14014. int optionFlags = allCustomisationOptionsEnabled);
  14015. void setEditingActive (bool editingEnabled);
  14016. enum ColourIds
  14017. {
  14018. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14019. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14020. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14021. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14022. over them. */
  14023. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14024. held down on them. */
  14025. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14026. when the style is set to iconsWithText or textOnly. */
  14027. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14028. the customisation dialog is active and the mouse moves over them. */
  14029. };
  14030. const String toString() const;
  14031. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14032. const String& savedVersion);
  14033. void paint (Graphics& g);
  14034. void resized();
  14035. void buttonClicked (Button*);
  14036. void mouseDown (const MouseEvent&);
  14037. bool isInterestedInDragSource (const String&, Component*);
  14038. void itemDragMove (const String&, Component*, int, int);
  14039. void itemDragExit (const String&, Component*);
  14040. void itemDropped (const String&, Component*, int, int);
  14041. void updateAllItemPositions (const bool animate);
  14042. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14043. juce_UseDebuggingNewOperator
  14044. private:
  14045. Button* missingItemsButton;
  14046. bool vertical, isEditingActive;
  14047. ToolbarItemStyle toolbarStyle;
  14048. ComponentAnimator animator;
  14049. friend class MissingItemsComponent;
  14050. Array <ToolbarItemComponent*> items;
  14051. friend class ItemDragAndDropOverlayComponent;
  14052. static const tchar* const toolbarDragDescriptor;
  14053. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14054. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14055. Toolbar (const Toolbar&);
  14056. Toolbar& operator= (const Toolbar&);
  14057. };
  14058. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14059. /*** End of inlined file: juce_Toolbar.h ***/
  14060. class ItemDragAndDropOverlayComponent;
  14061. class JUCE_API ToolbarItemComponent : public Button
  14062. {
  14063. public:
  14064. ToolbarItemComponent (int itemId,
  14065. const String& labelText,
  14066. bool isBeingUsedAsAButton);
  14067. ~ToolbarItemComponent();
  14068. int getItemId() const throw() { return itemId; }
  14069. Toolbar* getToolbar() const;
  14070. bool isToolbarVertical() const;
  14071. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14072. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14073. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14074. virtual bool getToolbarItemSizes (int toolbarThickness,
  14075. bool isToolbarVertical,
  14076. int& preferredSize,
  14077. int& minSize,
  14078. int& maxSize) = 0;
  14079. virtual void paintButtonArea (Graphics& g,
  14080. int width, int height,
  14081. bool isMouseOver, bool isMouseDown) = 0;
  14082. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14083. enum ToolbarEditingMode
  14084. {
  14085. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14086. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14087. customisation mode, and the items can be dragged around. */
  14088. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14089. dragged onto a toolbar to add it to that bar.*/
  14090. };
  14091. void setEditingMode (const ToolbarEditingMode newMode);
  14092. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14093. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14094. void resized();
  14095. juce_UseDebuggingNewOperator
  14096. private:
  14097. friend class Toolbar;
  14098. friend class ItemDragAndDropOverlayComponent;
  14099. const int itemId;
  14100. ToolbarEditingMode mode;
  14101. Toolbar::ToolbarItemStyle toolbarStyle;
  14102. ScopedPointer <Component> overlayComp;
  14103. int dragOffsetX, dragOffsetY;
  14104. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14105. Rectangle<int> contentArea;
  14106. ToolbarItemComponent (const ToolbarItemComponent&);
  14107. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14108. };
  14109. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14110. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14111. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14112. {
  14113. public:
  14114. ToolbarButton (int itemId,
  14115. const String& labelText,
  14116. Drawable* normalImage,
  14117. Drawable* toggledOnImage);
  14118. ~ToolbarButton();
  14119. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14120. int& minSize, int& maxSize);
  14121. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14122. void contentAreaChanged (const Rectangle<int>& newBounds);
  14123. juce_UseDebuggingNewOperator
  14124. private:
  14125. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14126. ToolbarButton (const ToolbarButton&);
  14127. ToolbarButton& operator= (const ToolbarButton&);
  14128. };
  14129. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14130. /*** End of inlined file: juce_ToolbarButton.h ***/
  14131. #endif
  14132. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14133. /*** Start of inlined file: juce_CodeDocument.h ***/
  14134. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14135. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14136. class CodeDocumentLine;
  14137. class JUCE_API CodeDocument
  14138. {
  14139. public:
  14140. CodeDocument();
  14141. ~CodeDocument();
  14142. class JUCE_API Position
  14143. {
  14144. public:
  14145. Position() throw();
  14146. Position (const CodeDocument* ownerDocument,
  14147. int line, int indexInLine) throw();
  14148. Position (const CodeDocument* ownerDocument,
  14149. int charactersFromStartOfDocument) throw();
  14150. Position (const Position& other) throw();
  14151. ~Position() throw();
  14152. Position& operator= (const Position& other) throw();
  14153. bool operator== (const Position& other) const throw();
  14154. bool operator!= (const Position& other) const throw();
  14155. void setPosition (int charactersFromStartOfDocument) throw();
  14156. int getPosition() const throw() { return characterPos; }
  14157. void setLineAndIndex (int newLine, int newIndexInLine) throw();
  14158. int getLineNumber() const throw() { return line; }
  14159. int getIndexInLine() const throw() { return indexInLine; }
  14160. void setPositionMaintained (bool isMaintained) throw();
  14161. void moveBy (int characterDelta) throw();
  14162. const Position movedBy (int characterDelta) const throw();
  14163. const Position movedByLines (int deltaLines) const throw();
  14164. const tchar getCharacter() const throw();
  14165. const String getLineText() const throw();
  14166. private:
  14167. CodeDocument* owner;
  14168. int characterPos, line, indexInLine;
  14169. bool positionMaintained;
  14170. };
  14171. const String getAllContent() const throw();
  14172. const String getTextBetween (const Position& start, const Position& end) const throw();
  14173. const String getLine (int lineIndex) const throw();
  14174. int getNumCharacters() const throw();
  14175. int getNumLines() const throw() { return lines.size(); }
  14176. int getMaximumLineLength() throw();
  14177. void deleteSection (const Position& startPosition, const Position& endPosition);
  14178. void insertText (const Position& position, const String& text);
  14179. void replaceAllContent (const String& newContent);
  14180. bool loadFromStream (InputStream& stream);
  14181. bool writeToStream (OutputStream& stream);
  14182. const String getNewLineCharacters() const throw() { return newLineChars; }
  14183. void setNewLineCharacters (const String& newLine) throw();
  14184. void newTransaction();
  14185. void undo();
  14186. void redo();
  14187. void clearUndoHistory();
  14188. UndoManager& getUndoManager() throw() { return undoManager; }
  14189. void setSavePoint() throw();
  14190. bool hasChangedSinceSavePoint() const throw();
  14191. const Position findWordBreakAfter (const Position& position) const throw();
  14192. const Position findWordBreakBefore (const Position& position) const throw();
  14193. class JUCE_API Listener
  14194. {
  14195. public:
  14196. Listener() {}
  14197. virtual ~Listener() {}
  14198. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14199. const Position& affectedTextEnd) = 0;
  14200. };
  14201. void addListener (Listener* listener) throw();
  14202. void removeListener (Listener* listener) throw();
  14203. class Iterator
  14204. {
  14205. public:
  14206. Iterator (CodeDocument* document);
  14207. Iterator (const Iterator& other);
  14208. Iterator& operator= (const Iterator& other) throw();
  14209. ~Iterator() throw();
  14210. juce_wchar nextChar();
  14211. juce_wchar peekNextChar() const;
  14212. void skip();
  14213. int getPosition() const throw() { return position; }
  14214. void skipWhitespace();
  14215. void skipToEndOfLine();
  14216. int getLine() const throw() { return line; }
  14217. bool isEOF() const throw();
  14218. private:
  14219. CodeDocument* document;
  14220. CodeDocumentLine* currentLine;
  14221. int line, position;
  14222. };
  14223. juce_UseDebuggingNewOperator
  14224. private:
  14225. friend class CodeDocumentInsertAction;
  14226. friend class CodeDocumentDeleteAction;
  14227. friend class Iterator;
  14228. friend class Position;
  14229. OwnedArray <CodeDocumentLine> lines;
  14230. Array <Position*> positionsToMaintain;
  14231. UndoManager undoManager;
  14232. int currentActionIndex, indexOfSavedState;
  14233. int maximumLineLength;
  14234. VoidArray listeners;
  14235. String newLineChars;
  14236. void sendListenerChangeMessage (int startLine, int endLine);
  14237. void insert (const String& text, int insertPos, bool undoable);
  14238. void remove (int startPos, int endPos, bool undoable);
  14239. void checkLastLineStatus();
  14240. CodeDocument (const CodeDocument&);
  14241. CodeDocument& operator= (const CodeDocument&);
  14242. };
  14243. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14244. /*** End of inlined file: juce_CodeDocument.h ***/
  14245. #endif
  14246. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14247. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14248. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14249. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14250. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14251. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14252. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14253. class JUCE_API CodeTokeniser
  14254. {
  14255. public:
  14256. CodeTokeniser() {}
  14257. virtual ~CodeTokeniser() {}
  14258. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14259. virtual const StringArray getTokenTypes() = 0;
  14260. virtual const Colour getDefaultColour (int tokenType) = 0;
  14261. juce_UseDebuggingNewOperator
  14262. };
  14263. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14264. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14265. class JUCE_API CodeEditorComponent : public Component,
  14266. public TextInputTarget,
  14267. public Timer,
  14268. public ScrollBarListener,
  14269. public CodeDocument::Listener,
  14270. public AsyncUpdater
  14271. {
  14272. public:
  14273. CodeEditorComponent (CodeDocument& document,
  14274. CodeTokeniser* codeTokeniser);
  14275. ~CodeEditorComponent();
  14276. CodeDocument& getDocument() const throw() { return document; }
  14277. void loadContent (const String& newContent);
  14278. float getCharWidth() const throw() { return charWidth; }
  14279. int getLineHeight() const throw() { return lineHeight; }
  14280. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14281. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14282. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14283. void moveCaretTo (const CodeDocument::Position& newPos, bool selecting);
  14284. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14285. const CodeDocument::Position getPositionAt (int x, int y);
  14286. void cursorLeft (bool moveInWholeWordSteps, bool selecting);
  14287. void cursorRight (bool moveInWholeWordSteps, bool selecting);
  14288. void cursorDown (bool selecting);
  14289. void cursorUp (bool selecting);
  14290. void pageDown (bool selecting);
  14291. void pageUp (bool selecting);
  14292. void scrollDown();
  14293. void scrollUp();
  14294. void scrollToLine (int newFirstLineOnScreen);
  14295. void scrollBy (int deltaLines);
  14296. void scrollToColumn (int newFirstColumnOnScreen);
  14297. void scrollToKeepCaretOnScreen();
  14298. void goToStartOfDocument (bool selecting);
  14299. void goToStartOfLine (bool selecting);
  14300. void goToEndOfDocument (bool selecting);
  14301. void goToEndOfLine (bool selecting);
  14302. void deselectAll();
  14303. void selectAll();
  14304. void insertTextAtCaret (const String& textToInsert);
  14305. void insertTabAtCaret();
  14306. void cut();
  14307. void copy();
  14308. void copyThenCut();
  14309. void paste();
  14310. void backspace (bool moveInWholeWordSteps);
  14311. void deleteForward (bool moveInWholeWordSteps);
  14312. void undo();
  14313. void redo();
  14314. const Range<int> getHighlightedRegion() const;
  14315. void setHighlightedRegion (const Range<int>& newRange);
  14316. const String getTextInRange (const Range<int>& range) const;
  14317. void setTabSize (int numSpacesPerTab,
  14318. bool insertSpacesInsteadOfTabCharacters) throw();
  14319. int getTabSize() const throw() { return spacesPerTab; }
  14320. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14321. void setFont (const Font& newFont);
  14322. void resetToDefaultColours();
  14323. void setColourForTokenType (int tokenType, const Colour& colour);
  14324. const Colour getColourForTokenType (int tokenType) const throw();
  14325. enum ColourIds
  14326. {
  14327. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14328. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14329. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14330. selected text. */
  14331. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14332. enabled. */
  14333. };
  14334. void setScrollbarThickness (int thickness) throw();
  14335. void resized();
  14336. void paint (Graphics& g);
  14337. bool keyPressed (const KeyPress& key);
  14338. void mouseDown (const MouseEvent& e);
  14339. void mouseDrag (const MouseEvent& e);
  14340. void mouseUp (const MouseEvent& e);
  14341. void mouseDoubleClick (const MouseEvent& e);
  14342. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14343. void timerCallback();
  14344. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14345. void handleAsyncUpdate();
  14346. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14347. const CodeDocument::Position& affectedTextEnd);
  14348. juce_UseDebuggingNewOperator
  14349. private:
  14350. CodeDocument& document;
  14351. Font font;
  14352. int firstLineOnScreen, gutter, spacesPerTab;
  14353. float charWidth;
  14354. int lineHeight, linesOnScreen, columnsOnScreen;
  14355. int scrollbarThickness, columnToTryToMaintain;
  14356. bool useSpacesForTabs;
  14357. double xOffset;
  14358. CodeDocument::Position caretPos;
  14359. CodeDocument::Position selectionStart, selectionEnd;
  14360. Component* caret;
  14361. ScrollBar* verticalScrollBar;
  14362. ScrollBar* horizontalScrollBar;
  14363. enum DragType
  14364. {
  14365. notDragging,
  14366. draggingSelectionStart,
  14367. draggingSelectionEnd
  14368. };
  14369. DragType dragType;
  14370. CodeTokeniser* codeTokeniser;
  14371. Array <Colour> coloursForTokenCategories;
  14372. class CodeEditorLine;
  14373. OwnedArray <CodeEditorLine> lines;
  14374. void rebuildLineTokens();
  14375. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14376. void clearCachedIterators (int firstLineToBeInvalid) throw();
  14377. void updateCachedIterators (int maxLineNum);
  14378. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14379. void moveLineDelta (int delta, bool selecting);
  14380. void updateScrollBars();
  14381. void scrollToLineInternal (int line);
  14382. void scrollToColumnInternal (double column);
  14383. void newTransaction();
  14384. int indexToColumn (int line, int index) const throw();
  14385. int columnToIndex (int line, int column) const throw();
  14386. CodeEditorComponent (const CodeEditorComponent&);
  14387. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14388. };
  14389. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14390. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14391. #endif
  14392. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14393. #endif
  14394. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14395. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14396. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14397. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14398. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14399. {
  14400. public:
  14401. CPlusPlusCodeTokeniser();
  14402. ~CPlusPlusCodeTokeniser();
  14403. enum TokenType
  14404. {
  14405. tokenType_error = 0,
  14406. tokenType_comment,
  14407. tokenType_builtInKeyword,
  14408. tokenType_identifier,
  14409. tokenType_integerLiteral,
  14410. tokenType_floatLiteral,
  14411. tokenType_stringLiteral,
  14412. tokenType_operator,
  14413. tokenType_bracket,
  14414. tokenType_punctuation,
  14415. tokenType_preprocessor
  14416. };
  14417. int readNextToken (CodeDocument::Iterator& source);
  14418. const StringArray getTokenTypes();
  14419. const Colour getDefaultColour (int tokenType);
  14420. juce_UseDebuggingNewOperator
  14421. };
  14422. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14423. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14424. #endif
  14425. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14426. #endif
  14427. #ifndef __JUCE_LABEL_JUCEHEADER__
  14428. #endif
  14429. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14430. #endif
  14431. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14432. /*** Start of inlined file: juce_ProgressBar.h ***/
  14433. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14434. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14435. class JUCE_API ProgressBar : public Component,
  14436. public SettableTooltipClient,
  14437. private Timer
  14438. {
  14439. public:
  14440. ProgressBar (double& progress);
  14441. ~ProgressBar();
  14442. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14443. void setTextToDisplay (const String& text);
  14444. enum ColourIds
  14445. {
  14446. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14447. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14448. classes will probably use variations on this colour. */
  14449. };
  14450. juce_UseDebuggingNewOperator
  14451. protected:
  14452. void paint (Graphics& g);
  14453. void lookAndFeelChanged();
  14454. void visibilityChanged();
  14455. void colourChanged();
  14456. private:
  14457. double& progress;
  14458. double currentValue;
  14459. bool displayPercentage;
  14460. String displayedMessage, currentMessage;
  14461. uint32 lastCallbackTime;
  14462. void timerCallback();
  14463. ProgressBar (const ProgressBar&);
  14464. ProgressBar& operator= (const ProgressBar&);
  14465. };
  14466. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14467. /*** End of inlined file: juce_ProgressBar.h ***/
  14468. #endif
  14469. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14470. /*** Start of inlined file: juce_Slider.h ***/
  14471. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14472. #define __JUCE_SLIDER_JUCEHEADER__
  14473. /*** Start of inlined file: juce_SliderListener.h ***/
  14474. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14475. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14476. class Slider;
  14477. class JUCE_API SliderListener
  14478. {
  14479. public:
  14480. virtual ~SliderListener() {}
  14481. virtual void sliderValueChanged (Slider* slider) = 0;
  14482. virtual void sliderDragStarted (Slider* slider);
  14483. virtual void sliderDragEnded (Slider* slider);
  14484. };
  14485. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14486. /*** End of inlined file: juce_SliderListener.h ***/
  14487. class JUCE_API Slider : public Component,
  14488. public SettableTooltipClient,
  14489. private AsyncUpdater,
  14490. private ButtonListener,
  14491. private LabelListener,
  14492. private Value::Listener
  14493. {
  14494. public:
  14495. Slider (const String& componentName);
  14496. ~Slider();
  14497. enum SliderStyle
  14498. {
  14499. LinearHorizontal, /**< A traditional horizontal slider. */
  14500. LinearVertical, /**< A traditional vertical slider. */
  14501. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14502. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14503. @see setRotaryParameters */
  14504. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14505. @see setRotaryParameters */
  14506. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14507. @see setRotaryParameters */
  14508. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14509. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14510. @see setMinValue, setMaxValue */
  14511. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14512. @see setMinValue, setMaxValue */
  14513. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14514. value, with the current value being somewhere between them.
  14515. @see setMinValue, setMaxValue */
  14516. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14517. value, with the current value being somewhere between them.
  14518. @see setMinValue, setMaxValue */
  14519. };
  14520. void setSliderStyle (SliderStyle newStyle);
  14521. SliderStyle getSliderStyle() const { return style; }
  14522. void setRotaryParameters (float startAngleRadians,
  14523. float endAngleRadians,
  14524. bool stopAtEnd);
  14525. void setMouseDragSensitivity (int distanceForFullScaleDrag);
  14526. void setVelocityBasedMode (bool isVelocityBased);
  14527. bool getVelocityBasedMode() const { return isVelocityBased; }
  14528. void setVelocityModeParameters (double sensitivity = 1.0,
  14529. int threshold = 1,
  14530. double offset = 0.0,
  14531. bool userCanPressKeyToSwapMode = true);
  14532. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14533. int getVelocityThreshold() const { return velocityModeThreshold; }
  14534. double getVelocityOffset() const { return velocityModeOffset; }
  14535. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14536. void setSkewFactor (double factor);
  14537. void setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint);
  14538. double getSkewFactor() const { return skewFactor; }
  14539. enum IncDecButtonMode
  14540. {
  14541. incDecButtonsNotDraggable,
  14542. incDecButtonsDraggable_AutoDirection,
  14543. incDecButtonsDraggable_Horizontal,
  14544. incDecButtonsDraggable_Vertical
  14545. };
  14546. void setIncDecButtonsMode (IncDecButtonMode mode);
  14547. enum TextEntryBoxPosition
  14548. {
  14549. NoTextBox, /**< Doesn't display a text box. */
  14550. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14551. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14552. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14553. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14554. };
  14555. void setTextBoxStyle (TextEntryBoxPosition newPosition,
  14556. bool isReadOnly,
  14557. int textEntryBoxWidth,
  14558. int textEntryBoxHeight);
  14559. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14560. int getTextBoxWidth() const { return textBoxWidth; }
  14561. int getTextBoxHeight() const { return textBoxHeight; }
  14562. void setTextBoxIsEditable (bool shouldBeEditable);
  14563. bool isTextBoxEditable() const { return editableText; }
  14564. void showTextBox();
  14565. void hideTextBox (bool discardCurrentEditorContents);
  14566. void setValue (double newValue,
  14567. bool sendUpdateMessage = true,
  14568. bool sendMessageSynchronously = false);
  14569. double getValue() const;
  14570. Value& getValueObject() { return currentValue; }
  14571. void setRange (double newMinimum,
  14572. double newMaximum,
  14573. double newInterval = 0);
  14574. double getMaximum() const { return maximum; }
  14575. double getMinimum() const { return minimum; }
  14576. double getInterval() const { return interval; }
  14577. double getMinValue() const;
  14578. Value& getMinValueObject() { return valueMin; }
  14579. void setMinValue (double newValue,
  14580. bool sendUpdateMessage = true,
  14581. bool sendMessageSynchronously = false,
  14582. bool allowNudgingOfOtherValues = false);
  14583. double getMaxValue() const;
  14584. Value& getMaxValueObject() { return valueMax; }
  14585. void setMaxValue (double newValue,
  14586. bool sendUpdateMessage = true,
  14587. bool sendMessageSynchronously = false,
  14588. bool allowNudgingOfOtherValues = false);
  14589. void addListener (SliderListener* listener);
  14590. void removeListener (SliderListener* listener);
  14591. void setDoubleClickReturnValue (bool isDoubleClickEnabled,
  14592. double valueToSetOnDoubleClick);
  14593. double getDoubleClickReturnValue (bool& isEnabled) const;
  14594. void setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease);
  14595. void setSliderSnapsToMousePosition (bool shouldSnapToMouse);
  14596. void setPopupDisplayEnabled (bool isEnabled,
  14597. Component* parentComponentToUse);
  14598. void setPopupMenuEnabled (bool menuEnabled);
  14599. void setScrollWheelEnabled (bool enabled);
  14600. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14601. virtual void startedDragging();
  14602. virtual void stoppedDragging();
  14603. virtual void valueChanged();
  14604. /** Callback to indicate that the user has just moved the slider.
  14605. Note - the valueChanged() method has changed its format and now no longer has
  14606. any parameters. Update your code to use the new version.
  14607. This version has been left here with an int as its return value to cause
  14608. a syntax error if you've got existing code that uses the old version.
  14609. */
  14610. virtual int valueChanged (double) { jassertfalse; return 0; }
  14611. virtual double getValueFromText (const String& text);
  14612. virtual const String getTextFromValue (double value);
  14613. void setTextValueSuffix (const String& suffix);
  14614. virtual double proportionOfLengthToValue (double proportion);
  14615. virtual double valueToProportionOfLength (double value);
  14616. float getPositionOfValue (double value);
  14617. virtual double snapValue (double attemptedValue, bool userIsDragging);
  14618. void updateText();
  14619. bool isHorizontal() const;
  14620. bool isVertical() const;
  14621. enum ColourIds
  14622. {
  14623. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14624. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14625. and feel class how this is used. */
  14626. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14627. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14628. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14629. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14630. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14631. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14632. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14633. };
  14634. juce_UseDebuggingNewOperator
  14635. protected:
  14636. void labelTextChanged (Label*);
  14637. void paint (Graphics& g);
  14638. void resized();
  14639. void mouseDown (const MouseEvent& e);
  14640. void mouseUp (const MouseEvent& e);
  14641. void mouseDrag (const MouseEvent& e);
  14642. void mouseDoubleClick (const MouseEvent& e);
  14643. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14644. void modifierKeysChanged (const ModifierKeys& modifiers);
  14645. void buttonClicked (Button* button);
  14646. void lookAndFeelChanged();
  14647. void enablementChanged();
  14648. void focusOfChildComponentChanged (FocusChangeType cause);
  14649. void handleAsyncUpdate();
  14650. void colourChanged();
  14651. void valueChanged (Value& value);
  14652. private:
  14653. ListenerList <SliderListener> listeners;
  14654. Value currentValue, valueMin, valueMax;
  14655. double lastCurrentValue, lastValueMin, lastValueMax;
  14656. double minimum, maximum, interval, doubleClickReturnValue;
  14657. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14658. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14659. int velocityModeThreshold;
  14660. float rotaryStart, rotaryEnd;
  14661. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14662. int mouseDragStartX, mouseDragStartY;
  14663. int sliderRegionStart, sliderRegionSize;
  14664. int sliderBeingDragged;
  14665. int pixelsForFullDragExtent;
  14666. Rectangle<int> sliderRect;
  14667. String textSuffix;
  14668. SliderStyle style;
  14669. TextEntryBoxPosition textBoxPos;
  14670. int textBoxWidth, textBoxHeight;
  14671. IncDecButtonMode incDecButtonMode;
  14672. bool editableText : 1, doubleClickToValue : 1;
  14673. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14674. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14675. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14676. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14677. Font font;
  14678. Label* valueBox;
  14679. Button* incButton;
  14680. Button* decButton;
  14681. ScopedPointer <Component> popupDisplay;
  14682. Component* parentForPopupDisplay;
  14683. float getLinearSliderPos (double value);
  14684. void restoreMouseIfHidden();
  14685. void sendDragStart();
  14686. void sendDragEnd();
  14687. double constrainedValue (double value) const;
  14688. void triggerChangeMessage (bool synchronous);
  14689. bool incDecDragDirectionIsHorizontal() const;
  14690. Slider (const Slider&);
  14691. Slider& operator= (const Slider&);
  14692. };
  14693. #endif // __JUCE_SLIDER_JUCEHEADER__
  14694. /*** End of inlined file: juce_Slider.h ***/
  14695. #endif
  14696. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14697. #endif
  14698. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14699. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14700. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14701. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14702. class TableHeaderComponent;
  14703. class JUCE_API TableHeaderListener
  14704. {
  14705. public:
  14706. TableHeaderListener() {}
  14707. virtual ~TableHeaderListener() {}
  14708. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14709. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14710. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14711. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14712. int columnIdNowBeingDragged);
  14713. };
  14714. class JUCE_API TableHeaderComponent : public Component,
  14715. private AsyncUpdater
  14716. {
  14717. public:
  14718. TableHeaderComponent();
  14719. ~TableHeaderComponent();
  14720. enum ColumnPropertyFlags
  14721. {
  14722. 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. */
  14723. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14724. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14725. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14726. 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. */
  14727. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14728. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14729. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14730. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14731. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14732. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14733. };
  14734. void addColumn (const String& columnName,
  14735. int columnId,
  14736. int width,
  14737. int minimumWidth = 30,
  14738. int maximumWidth = -1,
  14739. int propertyFlags = defaultFlags,
  14740. int insertIndex = -1);
  14741. void removeColumn (int columnIdToRemove);
  14742. void removeAllColumns();
  14743. int getNumColumns (bool onlyCountVisibleColumns) const;
  14744. const String getColumnName (int columnId) const;
  14745. void setColumnName (int columnId, const String& newName);
  14746. void moveColumn (int columnId, int newVisibleIndex);
  14747. int getColumnWidth (int columnId) const;
  14748. void setColumnWidth (int columnId, int newWidth);
  14749. void setColumnVisible (int columnId, bool shouldBeVisible);
  14750. bool isColumnVisible (int columnId) const;
  14751. void setSortColumnId (int columnId, bool sortForwards);
  14752. int getSortColumnId() const;
  14753. bool isSortedForwards() const;
  14754. void reSortTable();
  14755. int getTotalWidth() const;
  14756. int getIndexOfColumnId (int columnId, bool onlyCountVisibleColumns) const;
  14757. int getColumnIdOfIndex (int index, bool onlyCountVisibleColumns) const;
  14758. const Rectangle<int> getColumnPosition (int index) const;
  14759. int getColumnIdAtX (int xToFind) const;
  14760. void setStretchToFitActive (bool shouldStretchToFit);
  14761. bool isStretchToFitActive() const;
  14762. void resizeAllColumnsToFit (int targetTotalWidth);
  14763. void setPopupMenuActive (bool hasMenu);
  14764. bool isPopupMenuActive() const;
  14765. const String toString() const;
  14766. void restoreFromString (const String& storedVersion);
  14767. void addListener (TableHeaderListener* newListener);
  14768. void removeListener (TableHeaderListener* listenerToRemove);
  14769. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14770. virtual void addMenuItems (PopupMenu& menu, int columnIdClicked);
  14771. virtual void reactToMenuItem (int menuReturnId, int columnIdClicked);
  14772. void paint (Graphics& g);
  14773. void resized();
  14774. void mouseMove (const MouseEvent&);
  14775. void mouseEnter (const MouseEvent&);
  14776. void mouseExit (const MouseEvent&);
  14777. void mouseDown (const MouseEvent&);
  14778. void mouseDrag (const MouseEvent&);
  14779. void mouseUp (const MouseEvent&);
  14780. const MouseCursor getMouseCursor();
  14781. virtual void showColumnChooserMenu (int columnIdClicked);
  14782. juce_UseDebuggingNewOperator
  14783. private:
  14784. struct ColumnInfo
  14785. {
  14786. String name;
  14787. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14788. double lastDeliberateWidth;
  14789. bool isVisible() const;
  14790. };
  14791. OwnedArray <ColumnInfo> columns;
  14792. Array <TableHeaderListener*> listeners;
  14793. ScopedPointer <Component> dragOverlayComp;
  14794. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14795. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14796. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14797. ColumnInfo* getInfoForId (int columnId) const;
  14798. int visibleIndexToTotalIndex (int visibleIndex) const;
  14799. void sendColumnsChanged();
  14800. void handleAsyncUpdate();
  14801. void beginDrag (const MouseEvent&);
  14802. void endDrag (int finalIndex);
  14803. int getResizeDraggerAt (int mouseX) const;
  14804. void updateColumnUnderMouse (int x, int y);
  14805. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14806. TableHeaderComponent (const TableHeaderComponent&);
  14807. TableHeaderComponent operator= (const TableHeaderComponent&);
  14808. };
  14809. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14810. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14811. #endif
  14812. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14813. /*** Start of inlined file: juce_TableListBox.h ***/
  14814. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14815. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14816. class JUCE_API TableListBoxModel
  14817. {
  14818. public:
  14819. TableListBoxModel() {}
  14820. virtual ~TableListBoxModel() {}
  14821. virtual int getNumRows() = 0;
  14822. virtual void paintRowBackground (Graphics& g,
  14823. int rowNumber,
  14824. int width, int height,
  14825. bool rowIsSelected) = 0;
  14826. virtual void paintCell (Graphics& g,
  14827. int rowNumber,
  14828. int columnId,
  14829. int width, int height,
  14830. bool rowIsSelected) = 0;
  14831. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14832. Component* existingComponentToUpdate);
  14833. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14834. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14835. virtual void backgroundClicked();
  14836. virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
  14837. virtual int getColumnAutoSizeWidth (int columnId);
  14838. virtual const String getCellTooltip (int rowNumber, int columnId);
  14839. virtual void selectedRowsChanged (int lastRowSelected);
  14840. virtual void deleteKeyPressed (int lastRowSelected);
  14841. virtual void returnKeyPressed (int lastRowSelected);
  14842. virtual void listWasScrolled();
  14843. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14844. };
  14845. class JUCE_API TableListBox : public ListBox,
  14846. private ListBoxModel,
  14847. private TableHeaderListener
  14848. {
  14849. public:
  14850. TableListBox (const String& componentName,
  14851. TableListBoxModel* model);
  14852. ~TableListBox();
  14853. void setModel (TableListBoxModel* newModel);
  14854. TableListBoxModel* getModel() const { return model; }
  14855. TableHeaderComponent* getHeader() const { return header; }
  14856. void setHeaderHeight (int newHeight);
  14857. int getHeaderHeight() const;
  14858. void autoSizeColumn (int columnId);
  14859. void autoSizeAllColumns();
  14860. void setAutoSizeMenuOptionShown (bool shouldBeShown);
  14861. bool isAutoSizeMenuOptionShown() const;
  14862. const Rectangle<int> getCellPosition (int columnId,
  14863. int rowNumber,
  14864. bool relativeToComponentTopLeft) const;
  14865. void scrollToEnsureColumnIsOnscreen (int columnId);
  14866. int getNumRows();
  14867. void paintListBoxItem (int, Graphics&, int, int, bool);
  14868. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14869. void selectedRowsChanged (int lastRowSelected);
  14870. void deleteKeyPressed (int currentSelectedRow);
  14871. void returnKeyPressed (int currentSelectedRow);
  14872. void backgroundClicked();
  14873. void listWasScrolled();
  14874. void tableColumnsChanged (TableHeaderComponent*);
  14875. void tableColumnsResized (TableHeaderComponent*);
  14876. void tableSortOrderChanged (TableHeaderComponent*);
  14877. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14878. void resized();
  14879. juce_UseDebuggingNewOperator
  14880. private:
  14881. TableHeaderComponent* header;
  14882. TableListBoxModel* model;
  14883. int columnIdNowBeingDragged;
  14884. bool autoSizeOptionsShown;
  14885. void updateColumnComponents() const;
  14886. TableListBox (const TableListBox&);
  14887. TableListBox& operator= (const TableListBox&);
  14888. };
  14889. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14890. /*** End of inlined file: juce_TableListBox.h ***/
  14891. #endif
  14892. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14893. #endif
  14894. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14895. #endif
  14896. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14897. #endif
  14898. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14899. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14900. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14901. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14902. class JUCE_API ToolbarItemFactory
  14903. {
  14904. public:
  14905. ToolbarItemFactory();
  14906. virtual ~ToolbarItemFactory();
  14907. enum SpecialItemIds
  14908. {
  14909. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14910. can be placed between sets of items to break them into groups. */
  14911. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14912. items.*/
  14913. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14914. either side of it, filling any available space. */
  14915. };
  14916. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14917. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14918. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  14919. };
  14920. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14921. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14922. #endif
  14923. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14924. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  14925. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14926. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14927. class JUCE_API ToolbarItemPalette : public Component,
  14928. public DragAndDropContainer
  14929. {
  14930. public:
  14931. ToolbarItemPalette (ToolbarItemFactory& factory,
  14932. Toolbar* toolbar);
  14933. ~ToolbarItemPalette();
  14934. void resized();
  14935. juce_UseDebuggingNewOperator
  14936. private:
  14937. ToolbarItemFactory& factory;
  14938. Toolbar* toolbar;
  14939. Viewport* viewport;
  14940. friend class Toolbar;
  14941. void replaceComponent (ToolbarItemComponent* comp);
  14942. ToolbarItemPalette (const ToolbarItemPalette&);
  14943. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14944. };
  14945. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14946. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  14947. #endif
  14948. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14949. /*** Start of inlined file: juce_TreeView.h ***/
  14950. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14951. #define __JUCE_TREEVIEW_JUCEHEADER__
  14952. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  14953. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14954. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14955. class JUCE_API FileDragAndDropTarget
  14956. {
  14957. public:
  14958. virtual ~FileDragAndDropTarget() {}
  14959. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14960. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14961. virtual void fileDragMove (const StringArray& files, int x, int y);
  14962. virtual void fileDragExit (const StringArray& files);
  14963. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14964. };
  14965. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14966. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  14967. class TreeView;
  14968. class JUCE_API TreeViewItem
  14969. {
  14970. public:
  14971. TreeViewItem();
  14972. virtual ~TreeViewItem();
  14973. int getNumSubItems() const throw();
  14974. TreeViewItem* getSubItem (int index) const throw();
  14975. void clearSubItems();
  14976. void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
  14977. void removeSubItem (int index, bool deleteItem = true);
  14978. TreeView* getOwnerView() const throw() { return ownerView; }
  14979. TreeViewItem* getParentItem() const throw() { return parentItem; }
  14980. bool isOpen() const throw();
  14981. void setOpen (bool shouldBeOpen);
  14982. bool isSelected() const throw();
  14983. void setSelected (bool shouldBeSelected,
  14984. bool deselectOtherItemsFirst);
  14985. const Rectangle<int> getItemPosition (bool relativeToTreeViewTopLeft) const throw();
  14986. void treeHasChanged() const throw();
  14987. void repaintItem() const;
  14988. int getRowNumberInTree() const throw();
  14989. bool areAllParentsOpen() const throw();
  14990. void setLinesDrawnForSubItems (bool shouldDrawLines) throw();
  14991. virtual bool mightContainSubItems() = 0;
  14992. virtual const String getUniqueName() const;
  14993. virtual void itemOpennessChanged (bool isNowOpen);
  14994. virtual int getItemWidth() const { return -1; }
  14995. virtual int getItemHeight() const { return 20; }
  14996. virtual bool canBeSelected() const { return true; }
  14997. virtual Component* createItemComponent() { return 0; }
  14998. virtual void paintItem (Graphics& g, int width, int height);
  14999. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15000. virtual void itemClicked (const MouseEvent& e);
  15001. virtual void itemDoubleClicked (const MouseEvent& e);
  15002. virtual void itemSelectionChanged (bool isNowSelected);
  15003. virtual const String getTooltip();
  15004. virtual const String getDragSourceDescription();
  15005. virtual bool isInterestedInFileDrag (const StringArray& files);
  15006. virtual void filesDropped (const StringArray& files, int insertIndex);
  15007. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15008. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15009. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15010. XmlElement* getOpennessState() const throw();
  15011. void restoreOpennessState (const XmlElement& xml) throw();
  15012. int getIndexInParent() const throw();
  15013. bool isLastOfSiblings() const throw();
  15014. const String getItemIdentifierString() const;
  15015. juce_UseDebuggingNewOperator
  15016. private:
  15017. TreeView* ownerView;
  15018. TreeViewItem* parentItem;
  15019. OwnedArray <TreeViewItem> subItems;
  15020. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15021. int uid;
  15022. bool selected : 1;
  15023. bool redrawNeeded : 1;
  15024. bool drawLinesInside : 1;
  15025. bool drawsInLeftMargin : 1;
  15026. unsigned int openness : 2;
  15027. friend class TreeView;
  15028. friend class TreeViewContentComponent;
  15029. void updatePositions (int newY);
  15030. int getIndentX() const throw();
  15031. void setOwnerView (TreeView* newOwner) throw();
  15032. void paintRecursively (Graphics& g, int width);
  15033. TreeViewItem* getTopLevelItem() throw();
  15034. TreeViewItem* findItemRecursively (int y) throw();
  15035. TreeViewItem* getDeepestOpenParentItem() throw();
  15036. int getNumRows() const throw();
  15037. TreeViewItem* getItemOnRow (int index) throw();
  15038. void deselectAllRecursively();
  15039. int countSelectedItemsRecursively() const throw();
  15040. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15041. TreeViewItem* getNextVisibleItem (bool recurse) const throw();
  15042. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15043. TreeViewItem (const TreeViewItem&);
  15044. TreeViewItem& operator= (const TreeViewItem&);
  15045. };
  15046. class JUCE_API TreeView : public Component,
  15047. public SettableTooltipClient,
  15048. public FileDragAndDropTarget,
  15049. public DragAndDropTarget,
  15050. private AsyncUpdater
  15051. {
  15052. public:
  15053. TreeView (const String& componentName = String::empty);
  15054. ~TreeView();
  15055. void setRootItem (TreeViewItem* newRootItem);
  15056. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15057. void deleteRootItem();
  15058. void setRootItemVisible (bool shouldBeVisible);
  15059. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15060. void setDefaultOpenness (bool isOpenByDefault);
  15061. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15062. void setMultiSelectEnabled (bool canMultiSelect);
  15063. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15064. void setOpenCloseButtonsVisible (bool shouldBeVisible);
  15065. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15066. void clearSelectedItems();
  15067. int getNumSelectedItems() const throw();
  15068. TreeViewItem* getSelectedItem (int index) const throw();
  15069. int getNumRowsInTree() const;
  15070. TreeViewItem* getItemOnRow (int index) const;
  15071. TreeViewItem* getItemAt (int yPosition) const throw();
  15072. void scrollToKeepItemVisible (TreeViewItem* item);
  15073. Viewport* getViewport() const throw() { return viewport; }
  15074. int getIndentSize() const throw() { return indentSize; }
  15075. void setIndentSize (int newIndentSize);
  15076. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15077. XmlElement* getOpennessState (bool alsoIncludeScrollPosition) const;
  15078. void restoreOpennessState (const XmlElement& newState);
  15079. enum ColourIds
  15080. {
  15081. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15082. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15083. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15084. };
  15085. void paint (Graphics& g);
  15086. void resized();
  15087. bool keyPressed (const KeyPress& key);
  15088. void colourChanged();
  15089. void enablementChanged();
  15090. bool isInterestedInFileDrag (const StringArray& files);
  15091. void fileDragEnter (const StringArray& files, int x, int y);
  15092. void fileDragMove (const StringArray& files, int x, int y);
  15093. void fileDragExit (const StringArray& files);
  15094. void filesDropped (const StringArray& files, int x, int y);
  15095. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15096. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15097. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15098. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15099. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15100. juce_UseDebuggingNewOperator
  15101. private:
  15102. friend class TreeViewItem;
  15103. friend class TreeViewContentComponent;
  15104. Viewport* viewport;
  15105. CriticalSection nodeAlterationLock;
  15106. TreeViewItem* rootItem;
  15107. Component* dragInsertPointHighlight;
  15108. Component* dragTargetGroupHighlight;
  15109. int indentSize;
  15110. bool defaultOpenness : 1;
  15111. bool needsRecalculating : 1;
  15112. bool rootItemVisible : 1;
  15113. bool multiSelectEnabled : 1;
  15114. bool openCloseButtonsVisible : 1;
  15115. void itemsChanged() throw();
  15116. void handleAsyncUpdate();
  15117. void moveSelectedRow (int delta);
  15118. void updateButtonUnderMouse (const MouseEvent& e);
  15119. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15120. void hideDragHighlight() throw();
  15121. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15122. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15123. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15124. const StringArray& files, const String& sourceDescription,
  15125. Component* sourceComponent) const throw();
  15126. TreeView (const TreeView&);
  15127. TreeView& operator= (const TreeView&);
  15128. };
  15129. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15130. /*** End of inlined file: juce_TreeView.h ***/
  15131. #endif
  15132. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15133. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15134. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15135. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15136. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15137. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15138. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15139. /*** Start of inlined file: juce_FileFilter.h ***/
  15140. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15141. #define __JUCE_FILEFILTER_JUCEHEADER__
  15142. class JUCE_API FileFilter
  15143. {
  15144. public:
  15145. FileFilter (const String& filterDescription);
  15146. virtual ~FileFilter();
  15147. const String& getDescription() const throw();
  15148. virtual bool isFileSuitable (const File& file) const = 0;
  15149. virtual bool isDirectorySuitable (const File& file) const = 0;
  15150. protected:
  15151. String description;
  15152. };
  15153. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15154. /*** End of inlined file: juce_FileFilter.h ***/
  15155. /*** Start of inlined file: juce_Image.h ***/
  15156. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15157. #define __JUCE_IMAGE_JUCEHEADER__
  15158. class JUCE_API Image
  15159. {
  15160. public:
  15161. enum PixelFormat
  15162. {
  15163. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15164. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15165. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15166. };
  15167. Image (PixelFormat format,
  15168. int imageWidth,
  15169. int imageHeight,
  15170. bool clearImage);
  15171. Image (const Image& other);
  15172. virtual ~Image();
  15173. static Image* createNativeImage (PixelFormat format,
  15174. int imageWidth,
  15175. int imageHeight,
  15176. bool clearImage);
  15177. int getWidth() const throw() { return imageWidth; }
  15178. int getHeight() const throw() { return imageHeight; }
  15179. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15180. PixelFormat getFormat() const throw() { return format; }
  15181. bool isARGB() const throw() { return format == ARGB; }
  15182. bool isRGB() const throw() { return format == RGB; }
  15183. bool hasAlphaChannel() const throw() { return format != RGB; }
  15184. virtual void clear (int x, int y, int w, int h,
  15185. const Colour& colourToClearTo = Colour (0x00000000));
  15186. virtual Image* createCopy (int newWidth = -1,
  15187. int newHeight = -1,
  15188. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15189. virtual Image* createCopyOfAlphaChannel() const;
  15190. virtual const Colour getPixelAt (int x, int y) const;
  15191. virtual void setPixelAt (int x, int y, const Colour& colour);
  15192. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15193. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15194. virtual void desaturate();
  15195. class BitmapData
  15196. {
  15197. public:
  15198. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15199. BitmapData (const Image& image, int x, int y, int w, int h);
  15200. ~BitmapData();
  15201. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15202. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15203. uint8* data;
  15204. int lineStride, pixelStride, width, height;
  15205. private:
  15206. BitmapData (const BitmapData&);
  15207. BitmapData& operator= (const BitmapData&);
  15208. };
  15209. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15210. const uint8* sourcePixelData, int sourceLineStride);
  15211. virtual void moveImageSection (int destX, int destY,
  15212. int sourceX, int sourceY,
  15213. int width, int height);
  15214. void createSolidAreaMask (RectangleList& result,
  15215. float alphaThreshold = 0.5f) const;
  15216. juce_UseDebuggingNewOperator
  15217. virtual LowLevelGraphicsContext* createLowLevelContext();
  15218. protected:
  15219. friend class BitmapData;
  15220. const PixelFormat format;
  15221. const int imageWidth, imageHeight;
  15222. Image (PixelFormat format,
  15223. int imageWidth,
  15224. int imageHeight);
  15225. int pixelStride, lineStride;
  15226. HeapBlock <uint8> imageDataAllocated;
  15227. uint8* imageData;
  15228. private:
  15229. Image& operator= (const Image&);
  15230. };
  15231. #endif // __JUCE_IMAGE_JUCEHEADER__
  15232. /*** End of inlined file: juce_Image.h ***/
  15233. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15234. public TimeSliceClient
  15235. {
  15236. public:
  15237. DirectoryContentsList (const FileFilter* const fileFilter,
  15238. TimeSliceThread& threadToUse);
  15239. ~DirectoryContentsList();
  15240. void setDirectory (const File& directory,
  15241. const bool includeDirectories,
  15242. const bool includeFiles);
  15243. const File& getDirectory() const;
  15244. void clear();
  15245. void refresh();
  15246. bool isStillLoading() const;
  15247. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15248. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15249. struct FileInfo
  15250. {
  15251. String filename;
  15252. int64 fileSize;
  15253. Time modificationTime;
  15254. Time creationTime;
  15255. bool isDirectory;
  15256. bool isReadOnly;
  15257. };
  15258. int getNumFiles() const;
  15259. bool getFileInfo (const int index,
  15260. FileInfo& resultInfo) const;
  15261. const File getFile (const int index) const;
  15262. const FileFilter* getFilter() const { return fileFilter; }
  15263. bool useTimeSlice();
  15264. TimeSliceThread& getTimeSliceThread() { return thread; }
  15265. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15266. const DirectoryContentsList::FileInfo* const second);
  15267. juce_UseDebuggingNewOperator
  15268. private:
  15269. File root;
  15270. const FileFilter* fileFilter;
  15271. TimeSliceThread& thread;
  15272. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15273. CriticalSection fileListLock;
  15274. OwnedArray <FileInfo> files;
  15275. void* volatile fileFindHandle;
  15276. bool volatile shouldStop;
  15277. void changed();
  15278. bool checkNextFile (bool& hasChanged);
  15279. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15280. const int64 fileSize, const Time& modTime,
  15281. const Time& creationTime, const bool isReadOnly);
  15282. DirectoryContentsList (const DirectoryContentsList&);
  15283. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15284. };
  15285. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15286. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15287. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15288. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15289. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15290. class JUCE_API FileBrowserListener
  15291. {
  15292. public:
  15293. virtual ~FileBrowserListener();
  15294. virtual void selectionChanged() = 0;
  15295. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15296. virtual void fileDoubleClicked (const File& file) = 0;
  15297. };
  15298. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15299. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15300. class JUCE_API DirectoryContentsDisplayComponent
  15301. {
  15302. public:
  15303. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15304. virtual ~DirectoryContentsDisplayComponent();
  15305. virtual int getNumSelectedFiles() const = 0;
  15306. virtual const File getSelectedFile (int index) const = 0;
  15307. virtual void scrollToTop() = 0;
  15308. void addListener (FileBrowserListener* const listener) throw();
  15309. void removeListener (FileBrowserListener* const listener) throw();
  15310. enum ColourIds
  15311. {
  15312. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15313. textColourId = 0x1000541, /**< The colour for the text. */
  15314. };
  15315. void sendSelectionChangeMessage();
  15316. void sendDoubleClickMessage (const File& file);
  15317. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15318. juce_UseDebuggingNewOperator
  15319. protected:
  15320. DirectoryContentsList& fileList;
  15321. ListenerList <FileBrowserListener> listeners;
  15322. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15323. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15324. };
  15325. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15326. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15327. #endif
  15328. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15329. #endif
  15330. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15331. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15332. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15333. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15334. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15335. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15336. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15337. class JUCE_API FilePreviewComponent : public Component
  15338. {
  15339. public:
  15340. FilePreviewComponent();
  15341. ~FilePreviewComponent();
  15342. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15343. juce_UseDebuggingNewOperator
  15344. private:
  15345. FilePreviewComponent (const FilePreviewComponent&);
  15346. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15347. };
  15348. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15349. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15350. class JUCE_API FileBrowserComponent : public Component,
  15351. public ChangeBroadcaster,
  15352. private FileBrowserListener,
  15353. private TextEditorListener,
  15354. private ButtonListener,
  15355. private ComboBoxListener,
  15356. private FileFilter
  15357. {
  15358. public:
  15359. enum FileChooserFlags
  15360. {
  15361. openMode = 1, /**< specifies that the component should allow the user to
  15362. choose an existing file with the intention of opening it. */
  15363. saveMode = 2, /**< specifies that the component should allow the user to specify
  15364. the name of a file that will be used to save something. */
  15365. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15366. conjunction with canSelectDirectories). */
  15367. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15368. conjuction with canSelectFiles). */
  15369. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15370. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15371. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15372. };
  15373. FileBrowserComponent (int flags,
  15374. const File& initialFileOrDirectory,
  15375. const FileFilter* fileFilter,
  15376. FilePreviewComponent* previewComp);
  15377. ~FileBrowserComponent();
  15378. int getNumSelectedFiles() const throw();
  15379. const File getSelectedFile (int index) const throw();
  15380. bool currentFileIsValid() const;
  15381. const File getHighlightedFile() const throw();
  15382. const File getRoot() const;
  15383. void setRoot (const File& newRootDirectory);
  15384. void goUp();
  15385. void refresh();
  15386. virtual const String getActionVerb() const;
  15387. bool isSaveMode() const throw();
  15388. void addListener (FileBrowserListener* const listener) throw();
  15389. void removeListener (FileBrowserListener* const listener) throw();
  15390. void resized();
  15391. void buttonClicked (Button* b);
  15392. void comboBoxChanged (ComboBox*);
  15393. void textEditorTextChanged (TextEditor& editor);
  15394. void textEditorReturnKeyPressed (TextEditor& editor);
  15395. void textEditorEscapeKeyPressed (TextEditor& editor);
  15396. void textEditorFocusLost (TextEditor& editor);
  15397. bool keyPressed (const KeyPress& key);
  15398. void selectionChanged();
  15399. void fileClicked (const File& f, const MouseEvent& e);
  15400. void fileDoubleClicked (const File& f);
  15401. bool isFileSuitable (const File& file) const;
  15402. bool isDirectorySuitable (const File&) const;
  15403. FilePreviewComponent* getPreviewComponent() const throw();
  15404. juce_UseDebuggingNewOperator
  15405. protected:
  15406. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15407. private:
  15408. ScopedPointer <DirectoryContentsList> fileList;
  15409. const FileFilter* fileFilter;
  15410. int flags;
  15411. File currentRoot;
  15412. Array<File> chosenFiles;
  15413. ListenerList <FileBrowserListener> listeners;
  15414. DirectoryContentsDisplayComponent* fileListComponent;
  15415. FilePreviewComponent* previewComp;
  15416. ComboBox* currentPathBox;
  15417. TextEditor* filenameBox;
  15418. Button* goUpButton;
  15419. TimeSliceThread thread;
  15420. void sendListenerChangeMessage();
  15421. bool isFileOrDirSuitable (const File& f) const;
  15422. FileBrowserComponent (const FileBrowserComponent&);
  15423. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15424. };
  15425. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15426. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15427. #endif
  15428. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15429. #endif
  15430. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15431. /*** Start of inlined file: juce_FileChooser.h ***/
  15432. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15433. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15434. class JUCE_API FileChooser
  15435. {
  15436. public:
  15437. FileChooser (const String& dialogBoxTitle,
  15438. const File& initialFileOrDirectory = File::nonexistent,
  15439. const String& filePatternsAllowed = String::empty,
  15440. const bool useOSNativeDialogBox = true);
  15441. ~FileChooser();
  15442. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15443. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15444. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15445. bool browseForDirectory();
  15446. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15447. const File getResult() const;
  15448. const Array<File>& getResults() const;
  15449. juce_UseDebuggingNewOperator
  15450. private:
  15451. String title, filters;
  15452. File startingFile;
  15453. Array<File> results;
  15454. bool useNativeDialogBox;
  15455. bool showDialog (const bool selectsDirectories,
  15456. const bool selectsFiles,
  15457. const bool isSave,
  15458. const bool warnAboutOverwritingExistingFiles,
  15459. const bool selectMultipleFiles,
  15460. FilePreviewComponent* const previewComponent);
  15461. static void showPlatformDialog (Array<File>& results,
  15462. const String& title,
  15463. const File& file,
  15464. const String& filters,
  15465. bool selectsDirectories,
  15466. bool selectsFiles,
  15467. bool isSave,
  15468. bool warnAboutOverwritingExistingFiles,
  15469. bool selectMultipleFiles,
  15470. FilePreviewComponent* previewComponent);
  15471. };
  15472. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15473. /*** End of inlined file: juce_FileChooser.h ***/
  15474. #endif
  15475. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15476. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15477. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15478. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15479. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15480. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15481. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15482. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15483. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15484. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15485. /*** Start of inlined file: juce_DropShadower.h ***/
  15486. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15487. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15488. class JUCE_API DropShadower : public ComponentListener
  15489. {
  15490. public:
  15491. DropShadower (float alpha = 0.5f,
  15492. int xOffset = 1,
  15493. int yOffset = 5,
  15494. float blurRadius = 10.0f);
  15495. virtual ~DropShadower();
  15496. void setOwner (Component* componentToFollow);
  15497. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15498. void componentBroughtToFront (Component& component);
  15499. void componentChildrenChanged (Component& component);
  15500. void componentParentHierarchyChanged (Component& component);
  15501. void componentVisibilityChanged (Component& component);
  15502. juce_UseDebuggingNewOperator
  15503. private:
  15504. Component* owner;
  15505. int numShadows;
  15506. Component* shadowWindows[4];
  15507. Image* shadowImageSections[12];
  15508. const int shadowEdge, xOffset, yOffset;
  15509. const float alpha, blurRadius;
  15510. bool inDestructor, reentrant;
  15511. void updateShadows();
  15512. void setShadowImage (Image* const src,
  15513. const int num,
  15514. const int w, const int h,
  15515. const int sx, const int sy);
  15516. void bringShadowWindowsToFront();
  15517. void deleteShadowWindows();
  15518. DropShadower (const DropShadower&);
  15519. DropShadower& operator= (const DropShadower&);
  15520. };
  15521. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15522. /*** End of inlined file: juce_DropShadower.h ***/
  15523. class JUCE_API TopLevelWindow : public Component
  15524. {
  15525. public:
  15526. TopLevelWindow (const String& name, bool addToDesktop);
  15527. ~TopLevelWindow();
  15528. bool isActiveWindow() const throw() { return windowIsActive_; }
  15529. void centreAroundComponent (Component* componentToCentreAround,
  15530. int width, int height);
  15531. void setDropShadowEnabled (bool useShadow);
  15532. void setUsingNativeTitleBar (bool useNativeTitleBar);
  15533. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15534. static int getNumTopLevelWindows() throw();
  15535. static TopLevelWindow* getTopLevelWindow (int index) throw();
  15536. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15537. juce_UseDebuggingNewOperator
  15538. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15539. protected:
  15540. virtual void activeWindowStatusChanged();
  15541. void focusOfChildComponentChanged (FocusChangeType cause);
  15542. void parentHierarchyChanged();
  15543. void visibilityChanged();
  15544. virtual int getDesktopWindowStyleFlags() const;
  15545. void recreateDesktopWindow();
  15546. private:
  15547. friend class TopLevelWindowManager;
  15548. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15549. ScopedPointer <DropShadower> shadower;
  15550. void setWindowActive (bool isNowActive) throw();
  15551. TopLevelWindow (const TopLevelWindow&);
  15552. TopLevelWindow& operator= (const TopLevelWindow&);
  15553. };
  15554. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15555. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15556. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15557. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15558. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15559. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15560. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15561. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15562. class JUCE_API ComponentBoundsConstrainer
  15563. {
  15564. public:
  15565. ComponentBoundsConstrainer() throw();
  15566. virtual ~ComponentBoundsConstrainer();
  15567. void setMinimumWidth (int minimumWidth) throw();
  15568. int getMinimumWidth() const throw() { return minW; }
  15569. void setMaximumWidth (int maximumWidth) throw();
  15570. int getMaximumWidth() const throw() { return maxW; }
  15571. void setMinimumHeight (int minimumHeight) throw();
  15572. int getMinimumHeight() const throw() { return minH; }
  15573. void setMaximumHeight (int maximumHeight) throw();
  15574. int getMaximumHeight() const throw() { return maxH; }
  15575. void setMinimumSize (int minimumWidth,
  15576. int minimumHeight) throw();
  15577. void setMaximumSize (int maximumWidth,
  15578. int maximumHeight) throw();
  15579. void setSizeLimits (int minimumWidth,
  15580. int minimumHeight,
  15581. int maximumWidth,
  15582. int maximumHeight) throw();
  15583. void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
  15584. int minimumWhenOffTheLeft,
  15585. int minimumWhenOffTheBottom,
  15586. int minimumWhenOffTheRight) throw();
  15587. void setFixedAspectRatio (double widthOverHeight) throw();
  15588. double getFixedAspectRatio() const throw();
  15589. virtual void checkBounds (Rectangle<int>& bounds,
  15590. const Rectangle<int>& previousBounds,
  15591. const Rectangle<int>& limits,
  15592. bool isStretchingTop,
  15593. bool isStretchingLeft,
  15594. bool isStretchingBottom,
  15595. bool isStretchingRight);
  15596. virtual void resizeStart();
  15597. virtual void resizeEnd();
  15598. void setBoundsForComponent (Component* const component,
  15599. const Rectangle<int>& bounds,
  15600. bool isStretchingTop,
  15601. bool isStretchingLeft,
  15602. bool isStretchingBottom,
  15603. bool isStretchingRight);
  15604. void checkComponentBounds (Component* component);
  15605. virtual void applyBoundsToComponent (Component* component,
  15606. const Rectangle<int>& bounds);
  15607. juce_UseDebuggingNewOperator
  15608. private:
  15609. int minW, maxW, minH, maxH;
  15610. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15611. double aspectRatio;
  15612. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15613. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15614. };
  15615. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15616. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15617. class JUCE_API ComponentDragger
  15618. {
  15619. public:
  15620. ComponentDragger();
  15621. virtual ~ComponentDragger();
  15622. void startDraggingComponent (Component* const componentToDrag,
  15623. ComponentBoundsConstrainer* constrainer);
  15624. void dragComponent (Component* const componentToDrag,
  15625. const MouseEvent& e);
  15626. juce_UseDebuggingNewOperator
  15627. private:
  15628. ComponentBoundsConstrainer* constrainer;
  15629. Point<int> originalPos;
  15630. ComponentDragger (const ComponentDragger&);
  15631. ComponentDragger& operator= (const ComponentDragger&);
  15632. };
  15633. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15634. /*** End of inlined file: juce_ComponentDragger.h ***/
  15635. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15636. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15637. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15638. class JUCE_API ResizableBorderComponent : public Component
  15639. {
  15640. public:
  15641. ResizableBorderComponent (Component* const componentToResize,
  15642. ComponentBoundsConstrainer* const constrainer);
  15643. ~ResizableBorderComponent();
  15644. void setBorderThickness (const BorderSize& newBorderSize);
  15645. const BorderSize getBorderThickness() const;
  15646. juce_UseDebuggingNewOperator
  15647. protected:
  15648. void paint (Graphics& g);
  15649. void mouseEnter (const MouseEvent& e);
  15650. void mouseMove (const MouseEvent& e);
  15651. void mouseDown (const MouseEvent& e);
  15652. void mouseDrag (const MouseEvent& e);
  15653. void mouseUp (const MouseEvent& e);
  15654. bool hitTest (int x, int y);
  15655. private:
  15656. Component::SafePointer<Component> component;
  15657. ComponentBoundsConstrainer* constrainer;
  15658. BorderSize borderSize;
  15659. Rectangle<int> originalBounds;
  15660. int mouseZone;
  15661. void updateMouseZone (const MouseEvent& e);
  15662. ResizableBorderComponent (const ResizableBorderComponent&);
  15663. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15664. };
  15665. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15666. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15667. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15668. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15669. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15670. class JUCE_API ResizableCornerComponent : public Component
  15671. {
  15672. public:
  15673. ResizableCornerComponent (Component* const componentToResize,
  15674. ComponentBoundsConstrainer* const constrainer);
  15675. ~ResizableCornerComponent();
  15676. juce_UseDebuggingNewOperator
  15677. protected:
  15678. void paint (Graphics& g);
  15679. void mouseDown (const MouseEvent& e);
  15680. void mouseDrag (const MouseEvent& e);
  15681. void mouseUp (const MouseEvent& e);
  15682. bool hitTest (int x, int y);
  15683. private:
  15684. Component::SafePointer<Component> component;
  15685. ComponentBoundsConstrainer* constrainer;
  15686. Rectangle<int> originalBounds;
  15687. ResizableCornerComponent (const ResizableCornerComponent&);
  15688. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15689. };
  15690. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15691. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15692. class JUCE_API ResizableWindow : public TopLevelWindow
  15693. {
  15694. public:
  15695. ResizableWindow (const String& name,
  15696. bool addToDesktop);
  15697. ResizableWindow (const String& name,
  15698. const Colour& backgroundColour,
  15699. bool addToDesktop);
  15700. ~ResizableWindow();
  15701. const Colour getBackgroundColour() const throw();
  15702. void setBackgroundColour (const Colour& newColour);
  15703. void setResizable (bool shouldBeResizable,
  15704. bool useBottomRightCornerResizer);
  15705. bool isResizable() const throw();
  15706. void setResizeLimits (int newMinimumWidth,
  15707. int newMinimumHeight,
  15708. int newMaximumWidth,
  15709. int newMaximumHeight) throw();
  15710. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15711. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15712. void setBoundsConstrained (const Rectangle<int>& bounds);
  15713. bool isFullScreen() const;
  15714. void setFullScreen (bool shouldBeFullScreen);
  15715. bool isMinimised() const;
  15716. void setMinimised (bool shouldMinimise);
  15717. const String getWindowStateAsString();
  15718. bool restoreWindowStateFromString (const String& previousState);
  15719. Component* getContentComponent() const throw() { return contentComponent; }
  15720. void setContentComponent (Component* newContentComponent,
  15721. bool deleteOldOne = true,
  15722. bool resizeToFit = false);
  15723. void setContentComponentSize (int width, int height);
  15724. enum ColourIds
  15725. {
  15726. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15727. };
  15728. juce_UseDebuggingNewOperator
  15729. protected:
  15730. void paint (Graphics& g);
  15731. void moved();
  15732. void resized();
  15733. void mouseDown (const MouseEvent& e);
  15734. void mouseDrag (const MouseEvent& e);
  15735. void lookAndFeelChanged();
  15736. void childBoundsChanged (Component* child);
  15737. void parentSizeChanged();
  15738. void visibilityChanged();
  15739. void activeWindowStatusChanged();
  15740. int getDesktopWindowStyleFlags() const;
  15741. virtual const BorderSize getBorderThickness();
  15742. virtual const BorderSize getContentComponentBorder();
  15743. #ifdef JUCE_DEBUG
  15744. void addChildComponent (Component* child, int zOrder = -1);
  15745. void addAndMakeVisible (Component* child, int zOrder = -1);
  15746. #endif
  15747. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15748. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15749. private:
  15750. ScopedPointer <Component> contentComponent;
  15751. bool resizeToFitContent, fullscreen;
  15752. ComponentDragger dragger;
  15753. Rectangle<int> lastNonFullScreenPos;
  15754. ComponentBoundsConstrainer defaultConstrainer;
  15755. ComponentBoundsConstrainer* constrainer;
  15756. #ifdef JUCE_DEBUG
  15757. bool hasBeenResized;
  15758. #endif
  15759. void updateLastPos();
  15760. ResizableWindow (const ResizableWindow&);
  15761. ResizableWindow& operator= (const ResizableWindow&);
  15762. // (xxx remove these eventually)
  15763. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15764. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15765. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15766. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15767. };
  15768. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15769. /*** End of inlined file: juce_ResizableWindow.h ***/
  15770. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15771. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15772. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15773. class JUCE_API PositionedGlyph
  15774. {
  15775. public:
  15776. juce_wchar getCharacter() const { return character; }
  15777. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15778. float getLeft() const { return x; }
  15779. float getRight() const { return x + w; }
  15780. float getBaselineY() const { return y; }
  15781. float getTop() const { return y - font.getAscent(); }
  15782. float getBottom() const { return y + font.getDescent(); }
  15783. void moveBy (const float deltaX,
  15784. const float deltaY);
  15785. void draw (const Graphics& g) const;
  15786. void draw (const Graphics& g, const AffineTransform& transform) const;
  15787. void createPath (Path& path) const;
  15788. bool hitTest (float x, float y) const;
  15789. juce_UseDebuggingNewOperator
  15790. private:
  15791. friend class GlyphArrangement;
  15792. float x, y, w;
  15793. Font font;
  15794. juce_wchar character;
  15795. int glyph;
  15796. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  15797. PositionedGlyph (const PositionedGlyph& other);
  15798. };
  15799. class JUCE_API GlyphArrangement
  15800. {
  15801. public:
  15802. GlyphArrangement();
  15803. GlyphArrangement (const GlyphArrangement& other);
  15804. GlyphArrangement& operator= (const GlyphArrangement& other);
  15805. ~GlyphArrangement();
  15806. int getNumGlyphs() const { return glyphs.size(); }
  15807. PositionedGlyph& getGlyph (const int index) const;
  15808. void clear();
  15809. void addLineOfText (const Font& font,
  15810. const String& text,
  15811. const float x,
  15812. const float y);
  15813. void addCurtailedLineOfText (const Font& font,
  15814. const String& text,
  15815. float x,
  15816. const float y,
  15817. const float maxWidthPixels,
  15818. const bool useEllipsis);
  15819. void addJustifiedText (const Font& font,
  15820. const String& text,
  15821. float x, float y,
  15822. const float maxLineWidth,
  15823. const Justification& horizontalLayout);
  15824. void addFittedText (const Font& font,
  15825. const String& text,
  15826. const float x, const float y,
  15827. const float width, const float height,
  15828. const Justification& layout,
  15829. int maximumLinesToUse,
  15830. const float minimumHorizontalScale = 0.7f);
  15831. void addGlyphArrangement (const GlyphArrangement& other);
  15832. void draw (const Graphics& g) const;
  15833. void draw (const Graphics& g, const AffineTransform& transform) const;
  15834. void createPath (Path& path) const;
  15835. int findGlyphIndexAt (float x, float y) const;
  15836. void getBoundingBox (int startIndex,
  15837. int numGlyphs,
  15838. float& left,
  15839. float& top,
  15840. float& right,
  15841. float& bottom,
  15842. const bool includeWhitespace) const;
  15843. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15844. const float deltaX,
  15845. const float deltaY);
  15846. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15847. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15848. const float horizontalScaleFactor);
  15849. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15850. const float x,
  15851. const float y,
  15852. const float width,
  15853. const float height,
  15854. const Justification& justification);
  15855. juce_UseDebuggingNewOperator
  15856. private:
  15857. OwnedArray <PositionedGlyph> glyphs;
  15858. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15859. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15860. const Justification& justification, float minimumHorizontalScale);
  15861. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15862. };
  15863. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15864. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15865. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15866. public ButtonListener,
  15867. public FileBrowserListener
  15868. {
  15869. public:
  15870. FileChooserDialogBox (const String& title,
  15871. const String& instructions,
  15872. FileBrowserComponent& browserComponent,
  15873. const bool warnAboutOverwritingExistingFiles,
  15874. const Colour& backgroundColour);
  15875. ~FileChooserDialogBox();
  15876. bool show (int width = 0,int height = 0);
  15877. enum ColourIds
  15878. {
  15879. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15880. };
  15881. void buttonClicked (Button* button);
  15882. void closeButtonPressed();
  15883. void selectionChanged();
  15884. void fileClicked (const File& file, const MouseEvent& e);
  15885. void fileDoubleClicked (const File& file);
  15886. juce_UseDebuggingNewOperator
  15887. private:
  15888. class ContentComponent : public Component
  15889. {
  15890. public:
  15891. ContentComponent();
  15892. ~ContentComponent();
  15893. void paint (Graphics& g);
  15894. void resized();
  15895. String instructions;
  15896. GlyphArrangement text;
  15897. FileBrowserComponent* chooserComponent;
  15898. FilePreviewComponent* previewComponent;
  15899. TextButton* okButton;
  15900. TextButton* cancelButton;
  15901. };
  15902. ContentComponent* content;
  15903. const bool warnAboutOverwritingExistingFiles;
  15904. FileChooserDialogBox (const FileChooserDialogBox&);
  15905. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15906. };
  15907. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15908. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15909. #endif
  15910. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15911. #endif
  15912. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15913. /*** Start of inlined file: juce_FileListComponent.h ***/
  15914. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15915. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15916. class JUCE_API FileListComponent : public ListBox,
  15917. public DirectoryContentsDisplayComponent,
  15918. private ListBoxModel,
  15919. private ChangeListener
  15920. {
  15921. public:
  15922. FileListComponent (DirectoryContentsList& listToShow);
  15923. ~FileListComponent();
  15924. int getNumSelectedFiles() const;
  15925. const File getSelectedFile (int index = 0) const;
  15926. void scrollToTop();
  15927. void changeListenerCallback (void*);
  15928. int getNumRows();
  15929. void paintListBoxItem (int, Graphics&, int, int, bool);
  15930. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15931. void selectedRowsChanged (int lastRowSelected);
  15932. void deleteKeyPressed (int currentSelectedRow);
  15933. void returnKeyPressed (int currentSelectedRow);
  15934. juce_UseDebuggingNewOperator
  15935. private:
  15936. FileListComponent (const FileListComponent&);
  15937. FileListComponent& operator= (const FileListComponent&);
  15938. File lastDirectory;
  15939. };
  15940. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15941. /*** End of inlined file: juce_FileListComponent.h ***/
  15942. #endif
  15943. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15944. /*** Start of inlined file: juce_FilenameComponent.h ***/
  15945. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15946. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15947. class FilenameComponent;
  15948. class JUCE_API FilenameComponentListener
  15949. {
  15950. public:
  15951. virtual ~FilenameComponentListener() {}
  15952. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15953. };
  15954. class JUCE_API FilenameComponent : public Component,
  15955. public SettableTooltipClient,
  15956. public FileDragAndDropTarget,
  15957. private AsyncUpdater,
  15958. private ButtonListener,
  15959. private ComboBoxListener
  15960. {
  15961. public:
  15962. FilenameComponent (const String& name,
  15963. const File& currentFile,
  15964. const bool canEditFilename,
  15965. const bool isDirectory,
  15966. const bool isForSaving,
  15967. const String& fileBrowserWildcard,
  15968. const String& enforcedSuffix,
  15969. const String& textWhenNothingSelected);
  15970. ~FilenameComponent();
  15971. const File getCurrentFile() const;
  15972. void setCurrentFile (File newFile,
  15973. const bool addToRecentlyUsedList,
  15974. const bool sendChangeNotification = true);
  15975. void setFilenameIsEditable (const bool shouldBeEditable);
  15976. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15977. const StringArray getRecentlyUsedFilenames() const;
  15978. void setRecentlyUsedFilenames (const StringArray& filenames);
  15979. void addRecentlyUsedFile (const File& file);
  15980. void setMaxNumberOfRecentFiles (const int newMaximum);
  15981. void setBrowseButtonText (const String& browseButtonText);
  15982. void addListener (FilenameComponentListener* const listener) throw();
  15983. void removeListener (FilenameComponentListener* const listener) throw();
  15984. void setTooltip (const String& newTooltip);
  15985. void paintOverChildren (Graphics& g);
  15986. void resized();
  15987. void lookAndFeelChanged();
  15988. bool isInterestedInFileDrag (const StringArray& files);
  15989. void filesDropped (const StringArray& files, int, int);
  15990. void fileDragEnter (const StringArray& files, int, int);
  15991. void fileDragExit (const StringArray& files);
  15992. juce_UseDebuggingNewOperator
  15993. private:
  15994. ComboBox* filenameBox;
  15995. String lastFilename;
  15996. Button* browseButton;
  15997. int maxRecentFiles;
  15998. bool isDir, isSaving, isFileDragOver;
  15999. String wildcard, enforcedSuffix, browseButtonText;
  16000. ListenerList <FilenameComponentListener> listeners;
  16001. File defaultBrowseFile;
  16002. void comboBoxChanged (ComboBox*);
  16003. void buttonClicked (Button* button);
  16004. void handleAsyncUpdate();
  16005. FilenameComponent (const FilenameComponent&);
  16006. FilenameComponent& operator= (const FilenameComponent&);
  16007. };
  16008. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16009. /*** End of inlined file: juce_FilenameComponent.h ***/
  16010. #endif
  16011. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16012. #endif
  16013. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16014. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16015. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16016. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16017. class JUCE_API FileSearchPathListComponent : public Component,
  16018. public SettableTooltipClient,
  16019. public FileDragAndDropTarget,
  16020. private ButtonListener,
  16021. private ListBoxModel
  16022. {
  16023. public:
  16024. FileSearchPathListComponent();
  16025. ~FileSearchPathListComponent();
  16026. const FileSearchPath& getPath() const throw() { return path; }
  16027. void setPath (const FileSearchPath& newPath);
  16028. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  16029. enum ColourIds
  16030. {
  16031. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16032. Make this transparent if you don't want the background to be filled. */
  16033. };
  16034. int getNumRows();
  16035. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16036. void deleteKeyPressed (int lastRowSelected);
  16037. void returnKeyPressed (int lastRowSelected);
  16038. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16039. void selectedRowsChanged (int lastRowSelected);
  16040. void resized();
  16041. void paint (Graphics& g);
  16042. bool isInterestedInFileDrag (const StringArray& files);
  16043. void filesDropped (const StringArray& files, int, int);
  16044. void buttonClicked (Button* button);
  16045. juce_UseDebuggingNewOperator
  16046. private:
  16047. FileSearchPath path;
  16048. File defaultBrowseTarget;
  16049. ListBox* listBox;
  16050. Button* addButton;
  16051. Button* removeButton;
  16052. Button* changeButton;
  16053. Button* upButton;
  16054. Button* downButton;
  16055. void changed() throw();
  16056. void updateButtons() throw();
  16057. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16058. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16059. };
  16060. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16061. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16062. #endif
  16063. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16064. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16065. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16066. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16067. class JUCE_API FileTreeComponent : public TreeView,
  16068. public DirectoryContentsDisplayComponent
  16069. {
  16070. public:
  16071. FileTreeComponent (DirectoryContentsList& listToShow);
  16072. ~FileTreeComponent();
  16073. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16074. const File getSelectedFile (int index = 0) const;
  16075. void scrollToTop();
  16076. void setDragAndDropDescription (const String& description) throw();
  16077. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16078. juce_UseDebuggingNewOperator
  16079. private:
  16080. String dragAndDropDescription;
  16081. FileTreeComponent (const FileTreeComponent&);
  16082. FileTreeComponent& operator= (const FileTreeComponent&);
  16083. };
  16084. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16085. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16086. #endif
  16087. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16088. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16089. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16090. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16091. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16092. private Timer
  16093. {
  16094. public:
  16095. ImagePreviewComponent();
  16096. ~ImagePreviewComponent();
  16097. void selectedFileChanged (const File& newSelectedFile);
  16098. void paint (Graphics& g);
  16099. void timerCallback();
  16100. juce_UseDebuggingNewOperator
  16101. private:
  16102. File fileToLoad;
  16103. ScopedPointer <Image> currentThumbnail;
  16104. String currentDetails;
  16105. void getThumbSize (int& w, int& h) const;
  16106. ImagePreviewComponent (const ImagePreviewComponent&);
  16107. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16108. };
  16109. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16110. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16111. #endif
  16112. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16113. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16114. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16115. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16116. class JUCE_API WildcardFileFilter : public FileFilter
  16117. {
  16118. public:
  16119. WildcardFileFilter (const String& fileWildcardPatterns,
  16120. const String& directoryWildcardPatterns,
  16121. const String& description);
  16122. ~WildcardFileFilter();
  16123. bool isFileSuitable (const File& file) const;
  16124. bool isDirectorySuitable (const File& file) const;
  16125. juce_UseDebuggingNewOperator
  16126. private:
  16127. StringArray fileWildcards, directoryWildcards;
  16128. static void parse (const String& pattern, StringArray& result) throw();
  16129. static bool match (const File& file, const StringArray& wildcards) throw();
  16130. };
  16131. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16132. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16133. #endif
  16134. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16135. #endif
  16136. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16137. #endif
  16138. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16139. #endif
  16140. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16141. #endif
  16142. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16143. #endif
  16144. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16145. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16146. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16147. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16148. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16149. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16150. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16151. class JUCE_API KeyPressMappingSet : public KeyListener,
  16152. public ChangeBroadcaster,
  16153. public FocusChangeListener
  16154. {
  16155. public:
  16156. KeyPressMappingSet (ApplicationCommandManager* commandManager) throw();
  16157. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16158. ~KeyPressMappingSet();
  16159. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16160. const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const throw();
  16161. void addKeyPress (CommandID commandID,
  16162. const KeyPress& newKeyPress,
  16163. int insertIndex = -1) throw();
  16164. void resetToDefaultMappings() throw();
  16165. void resetToDefaultMapping (CommandID commandID) throw();
  16166. void clearAllKeyPresses() throw();
  16167. void clearAllKeyPresses (CommandID commandID) throw();
  16168. void removeKeyPress (CommandID commandID,
  16169. int keyPressIndex) throw();
  16170. void removeKeyPress (const KeyPress& keypress) throw();
  16171. bool containsMapping (CommandID commandID,
  16172. const KeyPress& keyPress) const throw();
  16173. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16174. bool restoreFromXml (const XmlElement& xmlVersion);
  16175. XmlElement* createXml (bool saveDifferencesFromDefaultSet) const;
  16176. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16177. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  16178. void globalFocusChanged (Component* focusedComponent);
  16179. juce_UseDebuggingNewOperator
  16180. private:
  16181. ApplicationCommandManager* commandManager;
  16182. struct CommandMapping
  16183. {
  16184. CommandID commandID;
  16185. Array <KeyPress> keypresses;
  16186. bool wantsKeyUpDownCallbacks;
  16187. };
  16188. OwnedArray <CommandMapping> mappings;
  16189. struct KeyPressTime
  16190. {
  16191. KeyPress key;
  16192. uint32 timeWhenPressed;
  16193. };
  16194. OwnedArray <KeyPressTime> keysDown;
  16195. void handleMessage (const Message& message);
  16196. void invokeCommand (const CommandID commandID,
  16197. const KeyPress& keyPress,
  16198. const bool isKeyDown,
  16199. const int millisecsSinceKeyPressed,
  16200. Component* const originatingComponent) const;
  16201. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16202. };
  16203. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16204. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16205. class JUCE_API KeyMappingEditorComponent : public Component,
  16206. public TreeViewItem,
  16207. public ChangeListener,
  16208. private ButtonListener
  16209. {
  16210. public:
  16211. KeyMappingEditorComponent (KeyPressMappingSet* mappingSet,
  16212. bool showResetToDefaultButton);
  16213. virtual ~KeyMappingEditorComponent();
  16214. void setColours (const Colour& mainBackground,
  16215. const Colour& textColour);
  16216. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16217. virtual bool shouldCommandBeIncluded (CommandID commandID);
  16218. virtual bool isCommandReadOnly (CommandID commandID);
  16219. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16220. enum ColourIds
  16221. {
  16222. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16223. textColourId = 0x100ad01, /**< The colour for the text. */
  16224. };
  16225. void parentHierarchyChanged();
  16226. void resized();
  16227. void changeListenerCallback (void*);
  16228. bool mightContainSubItems();
  16229. const String getUniqueName() const;
  16230. void buttonClicked (Button* button);
  16231. juce_UseDebuggingNewOperator
  16232. private:
  16233. KeyPressMappingSet* mappings;
  16234. TreeView* tree;
  16235. friend class KeyMappingTreeViewItem;
  16236. friend class KeyCategoryTreeViewItem;
  16237. friend class KeyMappingItemComponent;
  16238. friend class KeyMappingChangeButton;
  16239. TextButton* resetButton;
  16240. void assignNewKey (CommandID commandID, int index);
  16241. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16242. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16243. };
  16244. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16245. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16246. #endif
  16247. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16248. #endif
  16249. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16250. #endif
  16251. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16252. #endif
  16253. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16254. #endif
  16255. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16256. #endif
  16257. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16258. #endif
  16259. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16260. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16261. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16262. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16263. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16264. {
  16265. public:
  16266. ComponentMovementWatcher (Component* component);
  16267. ~ComponentMovementWatcher();
  16268. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16269. virtual void componentPeerChanged() = 0;
  16270. juce_UseDebuggingNewOperator
  16271. void componentParentHierarchyChanged (Component& component);
  16272. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16273. private:
  16274. Component::SafePointer<Component> component;
  16275. ComponentPeer* lastPeer;
  16276. VoidArray registeredParentComps;
  16277. bool reentrant;
  16278. Rectangle<int> lastBounds;
  16279. void unregister() throw();
  16280. void registerWithParentComps() throw();
  16281. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16282. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16283. };
  16284. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16285. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16286. #endif
  16287. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16288. /*** Start of inlined file: juce_GroupComponent.h ***/
  16289. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16290. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16291. class JUCE_API GroupComponent : public Component
  16292. {
  16293. public:
  16294. GroupComponent (const String& componentName,
  16295. const String& labelText);
  16296. ~GroupComponent();
  16297. void setText (const String& newText) throw();
  16298. const String getText() const throw();
  16299. void setTextLabelPosition (const Justification& justification);
  16300. const Justification getTextLabelPosition() const throw() { return justification; }
  16301. enum ColourIds
  16302. {
  16303. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16304. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16305. };
  16306. void paint (Graphics& g);
  16307. void enablementChanged();
  16308. void colourChanged();
  16309. private:
  16310. String text;
  16311. Justification justification;
  16312. GroupComponent (const GroupComponent&);
  16313. GroupComponent& operator= (const GroupComponent&);
  16314. };
  16315. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16316. /*** End of inlined file: juce_GroupComponent.h ***/
  16317. #endif
  16318. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16319. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16320. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16321. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16322. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16323. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16324. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16325. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16326. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16327. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16328. class TabbedButtonBar;
  16329. class JUCE_API TabBarButton : public Button
  16330. {
  16331. public:
  16332. TabBarButton (const String& name,
  16333. TabbedButtonBar* const ownerBar,
  16334. const int tabIndex);
  16335. ~TabBarButton();
  16336. virtual int getBestTabLength (const int depth);
  16337. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16338. void clicked (const ModifierKeys& mods);
  16339. bool hitTest (int x, int y);
  16340. juce_UseDebuggingNewOperator
  16341. protected:
  16342. friend class TabbedButtonBar;
  16343. TabbedButtonBar* const owner;
  16344. int tabIndex, overlapPixels;
  16345. DropShadowEffect shadow;
  16346. void getActiveArea (int& x, int& y, int& w, int& h);
  16347. private:
  16348. TabBarButton (const TabBarButton&);
  16349. TabBarButton& operator= (const TabBarButton&);
  16350. };
  16351. class JUCE_API TabbedButtonBar : public Component,
  16352. public ChangeBroadcaster,
  16353. public ButtonListener
  16354. {
  16355. public:
  16356. enum Orientation
  16357. {
  16358. TabsAtTop,
  16359. TabsAtBottom,
  16360. TabsAtLeft,
  16361. TabsAtRight
  16362. };
  16363. TabbedButtonBar (const Orientation orientation);
  16364. ~TabbedButtonBar();
  16365. void setOrientation (const Orientation orientation);
  16366. Orientation getOrientation() const throw() { return orientation; }
  16367. void clearTabs();
  16368. void addTab (const String& tabName,
  16369. const Colour& tabBackgroundColour,
  16370. int insertIndex = -1);
  16371. void setTabName (const int tabIndex,
  16372. const String& newName);
  16373. void removeTab (const int tabIndex);
  16374. void moveTab (const int currentIndex,
  16375. const int newIndex);
  16376. int getNumTabs() const;
  16377. const StringArray getTabNames() const;
  16378. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16379. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16380. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16381. TabBarButton* getTabButton (const int index) const;
  16382. virtual void currentTabChanged (const int newCurrentTabIndex,
  16383. const String& newCurrentTabName);
  16384. virtual void popupMenuClickOnTab (const int tabIndex,
  16385. const String& tabName);
  16386. const Colour getTabBackgroundColour (const int tabIndex);
  16387. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16388. enum ColourIds
  16389. {
  16390. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16391. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16392. the look and feel will choose an appropriate colour. */
  16393. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16394. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16395. this isn't specified, the look and feel will choose an appropriate
  16396. colour. */
  16397. };
  16398. void resized();
  16399. void buttonClicked (Button* button);
  16400. void lookAndFeelChanged();
  16401. juce_UseDebuggingNewOperator
  16402. protected:
  16403. virtual TabBarButton* createTabButton (const String& tabName,
  16404. const int tabIndex);
  16405. private:
  16406. Orientation orientation;
  16407. StringArray tabs;
  16408. Array <Colour> tabColours;
  16409. int currentTabIndex;
  16410. Component* behindFrontTab;
  16411. Button* extraTabsButton;
  16412. TabbedButtonBar (const TabbedButtonBar&);
  16413. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16414. };
  16415. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16416. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16417. class JUCE_API TabbedComponent : public Component
  16418. {
  16419. public:
  16420. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16421. ~TabbedComponent();
  16422. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16423. TabbedButtonBar::Orientation getOrientation() const throw();
  16424. void setTabBarDepth (const int newDepth);
  16425. int getTabBarDepth() const throw() { return tabDepth; }
  16426. void setOutline (const int newThickness);
  16427. void setIndent (const int indentThickness);
  16428. void clearTabs();
  16429. void addTab (const String& tabName,
  16430. const Colour& tabBackgroundColour,
  16431. Component* const contentComponent,
  16432. const bool deleteComponentWhenNotNeeded,
  16433. const int insertIndex = -1);
  16434. void setTabName (const int tabIndex,
  16435. const String& newName);
  16436. void removeTab (const int tabIndex);
  16437. int getNumTabs() const;
  16438. const StringArray getTabNames() const;
  16439. Component* getTabContentComponent (const int tabIndex) const throw();
  16440. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16441. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16442. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16443. int getCurrentTabIndex() const;
  16444. const String& getCurrentTabName() const;
  16445. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16446. virtual void currentTabChanged (const int newCurrentTabIndex,
  16447. const String& newCurrentTabName);
  16448. virtual void popupMenuClickOnTab (const int tabIndex,
  16449. const String& tabName);
  16450. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16451. enum ColourIds
  16452. {
  16453. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16454. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16455. (See setOutline) */
  16456. };
  16457. void paint (Graphics& g);
  16458. void resized();
  16459. void lookAndFeelChanged();
  16460. juce_UseDebuggingNewOperator
  16461. protected:
  16462. TabbedButtonBar* tabs;
  16463. virtual TabBarButton* createTabButton (const String& tabName,
  16464. const int tabIndex);
  16465. private:
  16466. Array <Component*> contentComponents;
  16467. Component* panelComponent;
  16468. int tabDepth;
  16469. int outlineThickness, edgeIndent;
  16470. friend class TabCompButtonBar;
  16471. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16472. TabbedComponent (const TabbedComponent&);
  16473. TabbedComponent& operator= (const TabbedComponent&);
  16474. };
  16475. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16476. /*** End of inlined file: juce_TabbedComponent.h ***/
  16477. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16478. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16479. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16480. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16481. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16482. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16483. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16484. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16485. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16486. class MenuBarModel;
  16487. class JUCE_API MenuBarModelListener
  16488. {
  16489. public:
  16490. virtual ~MenuBarModelListener() {}
  16491. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16492. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16493. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16494. };
  16495. class JUCE_API MenuBarModel : private AsyncUpdater,
  16496. private ApplicationCommandManagerListener
  16497. {
  16498. public:
  16499. MenuBarModel() throw();
  16500. virtual ~MenuBarModel();
  16501. void menuItemsChanged();
  16502. void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
  16503. void addListener (MenuBarModelListener* listenerToAdd) throw();
  16504. void removeListener (MenuBarModelListener* listenerToRemove) throw();
  16505. virtual const StringArray getMenuBarNames() = 0;
  16506. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16507. const String& menuName) = 0;
  16508. virtual void menuItemSelected (int menuItemID,
  16509. int topLevelMenuIndex) = 0;
  16510. #if JUCE_MAC || DOXYGEN
  16511. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16512. const PopupMenu* extraAppleMenuItems = 0);
  16513. static MenuBarModel* getMacMainMenu();
  16514. #endif
  16515. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16516. void applicationCommandListChanged();
  16517. void handleAsyncUpdate();
  16518. juce_UseDebuggingNewOperator
  16519. private:
  16520. ApplicationCommandManager* manager;
  16521. ListenerList <MenuBarModelListener> listeners;
  16522. MenuBarModel (const MenuBarModel&);
  16523. MenuBarModel& operator= (const MenuBarModel&);
  16524. };
  16525. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16526. /*** End of inlined file: juce_MenuBarModel.h ***/
  16527. class JUCE_API MenuBarComponent : public Component,
  16528. private MenuBarModelListener,
  16529. private Timer
  16530. {
  16531. public:
  16532. MenuBarComponent (MenuBarModel* model);
  16533. ~MenuBarComponent();
  16534. void setModel (MenuBarModel* newModel);
  16535. void showMenu (int menuIndex);
  16536. void paint (Graphics& g);
  16537. void resized();
  16538. void mouseEnter (const MouseEvent& e);
  16539. void mouseExit (const MouseEvent& e);
  16540. void mouseDown (const MouseEvent& e);
  16541. void mouseDrag (const MouseEvent& e);
  16542. void mouseUp (const MouseEvent& e);
  16543. void mouseMove (const MouseEvent& e);
  16544. void inputAttemptWhenModal();
  16545. void handleCommandMessage (int commandId);
  16546. bool keyPressed (const KeyPress& key);
  16547. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16548. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16549. const ApplicationCommandTarget::InvocationInfo& info);
  16550. juce_UseDebuggingNewOperator
  16551. private:
  16552. MenuBarModel* model;
  16553. StringArray menuNames;
  16554. Array <int> xPositions;
  16555. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16556. int lastMouseX, lastMouseY;
  16557. bool inModalState;
  16558. ScopedPointer <Component> currentPopup;
  16559. int getItemAt (int x, int y);
  16560. void updateItemUnderMouse (int x, int y);
  16561. void hideCurrentMenu();
  16562. void timerCallback();
  16563. void repaintMenuItem (int index);
  16564. MenuBarComponent (const MenuBarComponent&);
  16565. MenuBarComponent& operator= (const MenuBarComponent&);
  16566. };
  16567. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16568. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16569. class JUCE_API DocumentWindow : public ResizableWindow
  16570. {
  16571. public:
  16572. enum TitleBarButtons
  16573. {
  16574. minimiseButton = 1,
  16575. maximiseButton = 2,
  16576. closeButton = 4,
  16577. allButtons = 7
  16578. };
  16579. DocumentWindow (const String& name,
  16580. const Colour& backgroundColour,
  16581. int requiredButtons,
  16582. bool addToDesktop = true);
  16583. ~DocumentWindow();
  16584. void setName (const String& newName);
  16585. void setIcon (const Image* imageToUse);
  16586. void setTitleBarHeight (int newHeight);
  16587. int getTitleBarHeight() const;
  16588. void setTitleBarButtonsRequired (int requiredButtons,
  16589. bool positionTitleBarButtonsOnLeft);
  16590. void setTitleBarTextCentred (bool textShouldBeCentred);
  16591. void setMenuBar (MenuBarModel* menuBarModel,
  16592. int menuBarHeight = 0);
  16593. virtual void closeButtonPressed();
  16594. virtual void minimiseButtonPressed();
  16595. virtual void maximiseButtonPressed();
  16596. Button* getCloseButton() const throw();
  16597. Button* getMinimiseButton() const throw();
  16598. Button* getMaximiseButton() const throw();
  16599. enum ColourIds
  16600. {
  16601. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16602. and feel class how this is used. */
  16603. };
  16604. void paint (Graphics& g);
  16605. void resized();
  16606. void lookAndFeelChanged();
  16607. const BorderSize getBorderThickness();
  16608. const BorderSize getContentComponentBorder();
  16609. void mouseDoubleClick (const MouseEvent& e);
  16610. void userTriedToCloseWindow();
  16611. void activeWindowStatusChanged();
  16612. int getDesktopWindowStyleFlags() const;
  16613. void parentHierarchyChanged();
  16614. const Rectangle<int> getTitleBarArea();
  16615. juce_UseDebuggingNewOperator
  16616. private:
  16617. int titleBarHeight, menuBarHeight, requiredButtons;
  16618. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16619. ScopedPointer <Button> titleBarButtons [3];
  16620. ScopedPointer <Image> titleBarIcon;
  16621. ScopedPointer <MenuBarComponent> menuBar;
  16622. MenuBarModel* menuBarModel;
  16623. class ButtonListenerProxy;
  16624. friend class ScopedPointer <ButtonListenerProxy>;
  16625. ScopedPointer <ButtonListenerProxy> buttonListener;
  16626. void repaintTitleBar();
  16627. DocumentWindow (const DocumentWindow&);
  16628. DocumentWindow& operator= (const DocumentWindow&);
  16629. };
  16630. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16631. /*** End of inlined file: juce_DocumentWindow.h ***/
  16632. class MultiDocumentPanel;
  16633. class MDITabbedComponentInternal;
  16634. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16635. {
  16636. public:
  16637. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16638. ~MultiDocumentPanelWindow();
  16639. void maximiseButtonPressed();
  16640. void closeButtonPressed();
  16641. void activeWindowStatusChanged();
  16642. void broughtToFront();
  16643. juce_UseDebuggingNewOperator
  16644. private:
  16645. void updateOrder();
  16646. MultiDocumentPanel* getOwner() const throw();
  16647. };
  16648. class JUCE_API MultiDocumentPanel : public Component,
  16649. private ComponentListener
  16650. {
  16651. public:
  16652. MultiDocumentPanel();
  16653. ~MultiDocumentPanel();
  16654. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16655. bool addDocument (Component* const component,
  16656. const Colour& backgroundColour,
  16657. const bool deleteWhenRemoved);
  16658. bool closeDocument (Component* component,
  16659. const bool checkItsOkToCloseFirst);
  16660. int getNumDocuments() const throw();
  16661. Component* getDocument (const int index) const throw();
  16662. Component* getActiveDocument() const throw();
  16663. void setActiveDocument (Component* component);
  16664. virtual void activeDocumentChanged();
  16665. void setMaximumNumDocuments (const int maximumNumDocuments);
  16666. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16667. bool isFullscreenWhenOneDocument() const throw();
  16668. enum LayoutMode
  16669. {
  16670. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16671. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16672. };
  16673. void setLayoutMode (const LayoutMode newLayoutMode);
  16674. LayoutMode getLayoutMode() const throw() { return mode; }
  16675. void setBackgroundColour (const Colour& newBackgroundColour);
  16676. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16677. virtual bool tryToCloseDocument (Component* component) = 0;
  16678. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16679. void paint (Graphics& g);
  16680. void resized();
  16681. void componentNameChanged (Component&);
  16682. juce_UseDebuggingNewOperator
  16683. private:
  16684. LayoutMode mode;
  16685. Array <Component*> components;
  16686. TabbedComponent* tabComponent;
  16687. Colour backgroundColour;
  16688. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16689. friend class MultiDocumentPanelWindow;
  16690. friend class MDITabbedComponentInternal;
  16691. Component* getContainerComp (Component* c) const;
  16692. void updateOrder();
  16693. void addWindow (Component* component);
  16694. };
  16695. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16696. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16697. #endif
  16698. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16699. #endif
  16700. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16701. #endif
  16702. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16703. #endif
  16704. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16705. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16706. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16707. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16708. class JUCE_API StretchableLayoutManager
  16709. {
  16710. public:
  16711. StretchableLayoutManager();
  16712. ~StretchableLayoutManager();
  16713. void setItemLayout (const int itemIndex,
  16714. const double minimumSize,
  16715. const double maximumSize,
  16716. const double preferredSize);
  16717. bool getItemLayout (const int itemIndex,
  16718. double& minimumSize,
  16719. double& maximumSize,
  16720. double& preferredSize) const;
  16721. void clearAllItems();
  16722. void layOutComponents (Component** const components,
  16723. int numComponents,
  16724. int x, int y, int width, int height,
  16725. const bool vertically,
  16726. const bool resizeOtherDimension);
  16727. int getItemCurrentPosition (const int itemIndex) const;
  16728. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16729. double getItemCurrentRelativeSize (const int itemIndex) const;
  16730. void setItemPosition (const int itemIndex,
  16731. int newPosition);
  16732. juce_UseDebuggingNewOperator
  16733. private:
  16734. struct ItemLayoutProperties
  16735. {
  16736. int itemIndex;
  16737. int currentSize;
  16738. double minSize, maxSize, preferredSize;
  16739. };
  16740. OwnedArray <ItemLayoutProperties> items;
  16741. int totalSize;
  16742. static int sizeToRealSize (double size, int totalSpace);
  16743. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16744. void setTotalSize (const int newTotalSize);
  16745. int fitComponentsIntoSpace (const int startIndex,
  16746. const int endIndex,
  16747. const int availableSpace,
  16748. int startPos);
  16749. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16750. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16751. void updatePrefSizesToMatchCurrentPositions();
  16752. StretchableLayoutManager (const StretchableLayoutManager&);
  16753. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16754. };
  16755. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16756. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16757. #endif
  16758. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16759. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16760. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16761. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16762. class JUCE_API StretchableLayoutResizerBar : public Component
  16763. {
  16764. public:
  16765. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16766. const int itemIndexInLayout,
  16767. const bool isBarVertical);
  16768. ~StretchableLayoutResizerBar();
  16769. virtual void hasBeenMoved();
  16770. void paint (Graphics& g);
  16771. void mouseDown (const MouseEvent& e);
  16772. void mouseDrag (const MouseEvent& e);
  16773. juce_UseDebuggingNewOperator
  16774. private:
  16775. StretchableLayoutManager* layout;
  16776. int itemIndex, mouseDownPos;
  16777. bool isVertical;
  16778. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16779. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16780. };
  16781. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16782. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16783. #endif
  16784. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16785. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16786. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16787. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16788. class StretchableObjectResizer
  16789. {
  16790. public:
  16791. StretchableObjectResizer();
  16792. ~StretchableObjectResizer();
  16793. void addItem (const double currentSize,
  16794. const double minSize,
  16795. const double maxSize,
  16796. const int order = 0);
  16797. void resizeToFit (const double targetSize);
  16798. int getNumItems() const throw() { return items.size(); }
  16799. double getItemSize (const int index) const throw();
  16800. juce_UseDebuggingNewOperator
  16801. private:
  16802. struct Item
  16803. {
  16804. double size;
  16805. double minSize;
  16806. double maxSize;
  16807. int order;
  16808. };
  16809. OwnedArray <Item> items;
  16810. StretchableObjectResizer (const StretchableObjectResizer&);
  16811. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16812. };
  16813. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16814. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16815. #endif
  16816. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16817. #endif
  16818. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16819. #endif
  16820. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16821. #endif
  16822. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16823. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16824. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16825. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16826. /*** Start of inlined file: juce_AlertWindow.h ***/
  16827. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16828. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16829. /*** Start of inlined file: juce_TextLayout.h ***/
  16830. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16831. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16832. class Graphics;
  16833. class JUCE_API TextLayout
  16834. {
  16835. public:
  16836. TextLayout() throw();
  16837. TextLayout (const TextLayout& other) throw();
  16838. TextLayout (const String& text, const Font& font) throw();
  16839. ~TextLayout() throw();
  16840. TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16841. void clear() throw();
  16842. void appendText (const String& textToAppend,
  16843. const Font& fontToUse) throw();
  16844. void setText (const String& newText,
  16845. const Font& fontToUse) throw();
  16846. void layout (int maximumWidth,
  16847. const Justification& justification,
  16848. bool attemptToBalanceLineLengths) throw();
  16849. int getWidth() const throw();
  16850. int getHeight() const throw();
  16851. int getNumLines() const throw() { return totalLines; }
  16852. int getLineWidth (int lineNumber) const throw();
  16853. void draw (Graphics& g, int topLeftX, int topLeftY) const throw();
  16854. void drawWithin (Graphics& g,
  16855. int x, int y, int w, int h,
  16856. const Justification& layoutFlags) const throw();
  16857. juce_UseDebuggingNewOperator
  16858. private:
  16859. class Token;
  16860. friend class OwnedArray <Token>;
  16861. OwnedArray <Token> tokens;
  16862. int totalLines;
  16863. };
  16864. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16865. /*** End of inlined file: juce_TextLayout.h ***/
  16866. class JUCE_API AlertWindow : public TopLevelWindow,
  16867. private ButtonListener
  16868. {
  16869. public:
  16870. enum AlertIconType
  16871. {
  16872. NoIcon, /**< No icon will be shown on the dialog box. */
  16873. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16874. user to answer a question. */
  16875. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16876. warning about something and shouldn't be ignored. */
  16877. InfoIcon /**< An icon that indicates that the dialog box is just
  16878. giving the user some information, which doesn't require
  16879. a response from them. */
  16880. };
  16881. AlertWindow (const String& title,
  16882. const String& message,
  16883. AlertIconType iconType,
  16884. Component* associatedComponent = 0);
  16885. ~AlertWindow();
  16886. AlertIconType getAlertType() const throw() { return alertIconType; }
  16887. void setMessage (const String& message);
  16888. void addButton (const String& name,
  16889. int returnValue,
  16890. const KeyPress& shortcutKey1 = KeyPress(),
  16891. const KeyPress& shortcutKey2 = KeyPress());
  16892. int getNumButtons() const;
  16893. void addTextEditor (const String& name,
  16894. const String& initialContents,
  16895. const String& onScreenLabel = String::empty,
  16896. bool isPasswordBox = false);
  16897. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16898. void addComboBox (const String& name,
  16899. const StringArray& items,
  16900. const String& onScreenLabel = String::empty);
  16901. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16902. void addTextBlock (const String& text);
  16903. void addProgressBarComponent (double& progressValue);
  16904. void addCustomComponent (Component* component);
  16905. int getNumCustomComponents() const;
  16906. Component* getCustomComponent (int index) const;
  16907. Component* removeCustomComponent (int index);
  16908. bool containsAnyExtraComponents() const;
  16909. // easy-to-use message box functions:
  16910. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16911. const String& title,
  16912. const String& message,
  16913. const String& buttonText = String::empty,
  16914. Component* associatedComponent = 0);
  16915. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16916. const String& title,
  16917. const String& message,
  16918. const String& button1Text = String::empty,
  16919. const String& button2Text = String::empty,
  16920. Component* associatedComponent = 0);
  16921. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16922. const String& title,
  16923. const String& message,
  16924. const String& button1Text = String::empty,
  16925. const String& button2Text = String::empty,
  16926. const String& button3Text = String::empty,
  16927. Component* associatedComponent = 0);
  16928. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16929. const String& bodyText,
  16930. bool isOkCancel);
  16931. enum ColourIds
  16932. {
  16933. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16934. textColourId = 0x1001810, /**< The colour for the text. */
  16935. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16936. };
  16937. juce_UseDebuggingNewOperator
  16938. protected:
  16939. void paint (Graphics& g);
  16940. void mouseDown (const MouseEvent& e);
  16941. void mouseDrag (const MouseEvent& e);
  16942. bool keyPressed (const KeyPress& key);
  16943. void buttonClicked (Button* button);
  16944. void lookAndFeelChanged();
  16945. void userTriedToCloseWindow();
  16946. int getDesktopWindowStyleFlags() const;
  16947. private:
  16948. String text;
  16949. TextLayout textLayout;
  16950. AlertIconType alertIconType;
  16951. ComponentBoundsConstrainer constrainer;
  16952. ComponentDragger dragger;
  16953. Rectangle<int> textArea;
  16954. VoidArray buttons, textBoxes, comboBoxes;
  16955. VoidArray progressBars, customComps, textBlocks, allComps;
  16956. StringArray textboxNames, comboBoxNames;
  16957. Font font;
  16958. Component* associatedComponent;
  16959. void updateLayout (bool onlyIncreaseSize);
  16960. // disable copy constructor
  16961. AlertWindow (const AlertWindow&);
  16962. AlertWindow& operator= (const AlertWindow&);
  16963. };
  16964. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  16965. /*** End of inlined file: juce_AlertWindow.h ***/
  16966. class ToggleButton;
  16967. class TextButton;
  16968. class AlertWindow;
  16969. class TextLayout;
  16970. class ScrollBar;
  16971. class BubbleComponent;
  16972. class ComboBox;
  16973. class Button;
  16974. class FilenameComponent;
  16975. class DocumentWindow;
  16976. class ResizableWindow;
  16977. class GroupComponent;
  16978. class MenuBarComponent;
  16979. class DropShadower;
  16980. class GlyphArrangement;
  16981. class PropertyComponent;
  16982. class TableHeaderComponent;
  16983. class Toolbar;
  16984. class ToolbarItemComponent;
  16985. class PopupMenu;
  16986. class ProgressBar;
  16987. class FileBrowserComponent;
  16988. class DirectoryContentsDisplayComponent;
  16989. class FilePreviewComponent;
  16990. class ImageButton;
  16991. class JUCE_API LookAndFeel
  16992. {
  16993. public:
  16994. LookAndFeel();
  16995. virtual ~LookAndFeel();
  16996. static LookAndFeel& getDefaultLookAndFeel() throw();
  16997. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  16998. const Colour findColour (int colourId) const throw();
  16999. void setColour (int colourId, const Colour& colour) throw();
  17000. bool isColourSpecified (int colourId) const throw();
  17001. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17002. void setDefaultSansSerifTypefaceName (const String& newName);
  17003. virtual const MouseCursor getMouseCursorFor (Component& component);
  17004. virtual void drawButtonBackground (Graphics& g,
  17005. Button& button,
  17006. const Colour& backgroundColour,
  17007. bool isMouseOverButton,
  17008. bool isButtonDown);
  17009. virtual const Font getFontForTextButton (TextButton& button);
  17010. virtual void drawButtonText (Graphics& g,
  17011. TextButton& button,
  17012. bool isMouseOverButton,
  17013. bool isButtonDown);
  17014. virtual void drawToggleButton (Graphics& g,
  17015. ToggleButton& button,
  17016. bool isMouseOverButton,
  17017. bool isButtonDown);
  17018. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17019. virtual void drawTickBox (Graphics& g,
  17020. Component& component,
  17021. float x, float y, float w, float h,
  17022. bool ticked,
  17023. bool isEnabled,
  17024. bool isMouseOverButton,
  17025. bool isButtonDown);
  17026. virtual AlertWindow* createAlertWindow (const String& title,
  17027. const String& message,
  17028. const String& button1,
  17029. const String& button2,
  17030. const String& button3,
  17031. AlertWindow::AlertIconType iconType,
  17032. int numButtons,
  17033. Component* associatedComponent);
  17034. virtual void drawAlertBox (Graphics& g,
  17035. AlertWindow& alert,
  17036. const Rectangle<int>& textArea,
  17037. TextLayout& textLayout);
  17038. virtual int getAlertBoxWindowFlags();
  17039. virtual int getAlertWindowButtonHeight();
  17040. virtual const Font getAlertWindowFont();
  17041. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17042. int width, int height,
  17043. double progress, const String& textToShow);
  17044. // Draws a small image that spins to indicate that something's happening..
  17045. // This method should use the current time to animate itself, so just keep
  17046. // repainting it every so often.
  17047. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17048. int x, int y, int w, int h);
  17049. virtual void drawScrollbarButton (Graphics& g,
  17050. ScrollBar& scrollbar,
  17051. int width, int height,
  17052. int buttonDirection,
  17053. bool isScrollbarVertical,
  17054. bool isMouseOverButton,
  17055. bool isButtonDown);
  17056. virtual void drawScrollbar (Graphics& g,
  17057. ScrollBar& scrollbar,
  17058. int x, int y,
  17059. int width, int height,
  17060. bool isScrollbarVertical,
  17061. int thumbStartPosition,
  17062. int thumbSize,
  17063. bool isMouseOver,
  17064. bool isMouseDown);
  17065. virtual ImageEffectFilter* getScrollbarEffect();
  17066. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17067. virtual int getDefaultScrollbarWidth();
  17068. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17069. virtual const Path getTickShape (float height);
  17070. virtual const Path getCrossShape (float height);
  17071. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17072. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17073. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17074. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17075. virtual Image* getDefaultFolderImage();
  17076. virtual Image* getDefaultDocumentFileImage();
  17077. virtual void createFileChooserHeaderText (const String& title,
  17078. const String& instructions,
  17079. GlyphArrangement& destArrangement,
  17080. int width);
  17081. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17082. const String& filename, Image* icon,
  17083. const String& fileSizeDescription,
  17084. const String& fileTimeDescription,
  17085. bool isDirectory,
  17086. bool isItemSelected,
  17087. int itemIndex);
  17088. virtual Button* createFileBrowserGoUpButton();
  17089. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17090. DirectoryContentsDisplayComponent* fileListComponent,
  17091. FilePreviewComponent* previewComp,
  17092. ComboBox* currentPathBox,
  17093. TextEditor* filenameBox,
  17094. Button* goUpButton);
  17095. virtual void drawBubble (Graphics& g,
  17096. float tipX, float tipY,
  17097. float boxX, float boxY, float boxW, float boxH);
  17098. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17099. virtual void drawPopupMenuItem (Graphics& g,
  17100. int width, int height,
  17101. bool isSeparator,
  17102. bool isActive,
  17103. bool isHighlighted,
  17104. bool isTicked,
  17105. bool hasSubMenu,
  17106. const String& text,
  17107. const String& shortcutKeyText,
  17108. Image* image,
  17109. const Colour* const textColour);
  17110. virtual const Font getPopupMenuFont();
  17111. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17112. int width, int height,
  17113. bool isScrollUpArrow);
  17114. virtual void getIdealPopupMenuItemSize (const String& text,
  17115. bool isSeparator,
  17116. int standardMenuItemHeight,
  17117. int& idealWidth,
  17118. int& idealHeight);
  17119. virtual int getMenuWindowFlags();
  17120. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17121. bool isMouseOverBar,
  17122. MenuBarComponent& menuBar);
  17123. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17124. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17125. virtual void drawMenuBarItem (Graphics& g,
  17126. int width, int height,
  17127. int itemIndex,
  17128. const String& itemText,
  17129. bool isMouseOverItem,
  17130. bool isMenuOpen,
  17131. bool isMouseOverBar,
  17132. MenuBarComponent& menuBar);
  17133. virtual void drawComboBox (Graphics& g, int width, int height,
  17134. bool isButtonDown,
  17135. int buttonX, int buttonY,
  17136. int buttonW, int buttonH,
  17137. ComboBox& box);
  17138. virtual const Font getComboBoxFont (ComboBox& box);
  17139. virtual Label* createComboBoxTextBox (ComboBox& box);
  17140. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17141. virtual void drawLabel (Graphics& g, Label& label);
  17142. virtual void drawLinearSlider (Graphics& g,
  17143. int x, int y,
  17144. int width, int height,
  17145. float sliderPos,
  17146. float minSliderPos,
  17147. float maxSliderPos,
  17148. const Slider::SliderStyle style,
  17149. Slider& slider);
  17150. virtual void drawLinearSliderBackground (Graphics& g,
  17151. int x, int y,
  17152. int width, int height,
  17153. float sliderPos,
  17154. float minSliderPos,
  17155. float maxSliderPos,
  17156. const Slider::SliderStyle style,
  17157. Slider& slider);
  17158. virtual void drawLinearSliderThumb (Graphics& g,
  17159. int x, int y,
  17160. int width, int height,
  17161. float sliderPos,
  17162. float minSliderPos,
  17163. float maxSliderPos,
  17164. const Slider::SliderStyle style,
  17165. Slider& slider);
  17166. virtual int getSliderThumbRadius (Slider& slider);
  17167. virtual void drawRotarySlider (Graphics& g,
  17168. int x, int y,
  17169. int width, int height,
  17170. float sliderPosProportional,
  17171. float rotaryStartAngle,
  17172. float rotaryEndAngle,
  17173. Slider& slider);
  17174. virtual Button* createSliderButton (bool isIncrement);
  17175. virtual Label* createSliderTextBox (Slider& slider);
  17176. virtual ImageEffectFilter* getSliderEffect();
  17177. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17178. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17179. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17180. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17181. ComboBox* filenameBox, Button* browseButton);
  17182. virtual void drawCornerResizer (Graphics& g,
  17183. int w, int h,
  17184. bool isMouseOver,
  17185. bool isMouseDragging);
  17186. virtual void drawResizableFrame (Graphics& g,
  17187. int w, int h,
  17188. const BorderSize& borders);
  17189. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17190. const BorderSize& border,
  17191. ResizableWindow& window);
  17192. virtual void drawResizableWindowBorder (Graphics& g,
  17193. int w, int h,
  17194. const BorderSize& border,
  17195. ResizableWindow& window);
  17196. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17197. Graphics& g, int w, int h,
  17198. int titleSpaceX, int titleSpaceW,
  17199. const Image* icon,
  17200. bool drawTitleTextOnLeft);
  17201. virtual Button* createDocumentWindowButton (int buttonType);
  17202. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17203. int titleBarX, int titleBarY,
  17204. int titleBarW, int titleBarH,
  17205. Button* minimiseButton,
  17206. Button* maximiseButton,
  17207. Button* closeButton,
  17208. bool positionTitleBarButtonsOnLeft);
  17209. virtual int getDefaultMenuBarHeight();
  17210. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17211. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17212. int w, int h,
  17213. bool isVerticalBar,
  17214. bool isMouseOver,
  17215. bool isMouseDragging);
  17216. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17217. const String& text,
  17218. const Justification& position,
  17219. GroupComponent& group);
  17220. virtual void createTabButtonShape (Path& p,
  17221. int width, int height,
  17222. int tabIndex,
  17223. const String& text,
  17224. Button& button,
  17225. TabbedButtonBar::Orientation orientation,
  17226. bool isMouseOver,
  17227. bool isMouseDown,
  17228. bool isFrontTab);
  17229. virtual void fillTabButtonShape (Graphics& g,
  17230. const Path& path,
  17231. const Colour& preferredBackgroundColour,
  17232. int tabIndex,
  17233. const String& text,
  17234. Button& button,
  17235. TabbedButtonBar::Orientation orientation,
  17236. bool isMouseOver,
  17237. bool isMouseDown,
  17238. bool isFrontTab);
  17239. virtual void drawTabButtonText (Graphics& g,
  17240. int x, int y, int w, int h,
  17241. const Colour& preferredBackgroundColour,
  17242. int tabIndex,
  17243. const String& text,
  17244. Button& button,
  17245. TabbedButtonBar::Orientation orientation,
  17246. bool isMouseOver,
  17247. bool isMouseDown,
  17248. bool isFrontTab);
  17249. virtual int getTabButtonOverlap (int tabDepth);
  17250. virtual int getTabButtonSpaceAroundImage();
  17251. virtual int getTabButtonBestWidth (int tabIndex,
  17252. const String& text,
  17253. int tabDepth,
  17254. Button& button);
  17255. virtual void drawTabButton (Graphics& g,
  17256. int w, int h,
  17257. const Colour& preferredColour,
  17258. int tabIndex,
  17259. const String& text,
  17260. Button& button,
  17261. TabbedButtonBar::Orientation orientation,
  17262. bool isMouseOver,
  17263. bool isMouseDown,
  17264. bool isFrontTab);
  17265. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17266. int w, int h,
  17267. TabbedButtonBar& tabBar,
  17268. TabbedButtonBar::Orientation orientation);
  17269. virtual Button* createTabBarExtrasButton();
  17270. virtual void drawImageButton (Graphics& g, Image* image,
  17271. int imageX, int imageY, int imageW, int imageH,
  17272. const Colour& overlayColour,
  17273. float imageOpacity,
  17274. ImageButton& button);
  17275. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17276. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17277. int width, int height,
  17278. bool isMouseOver, bool isMouseDown,
  17279. int columnFlags);
  17280. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17281. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17282. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17283. bool isMouseOver, bool isMouseDown,
  17284. ToolbarItemComponent& component);
  17285. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17286. const String& text, ToolbarItemComponent& component);
  17287. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17288. bool isOpen, int width, int height);
  17289. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17290. PropertyComponent& component);
  17291. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17292. PropertyComponent& component);
  17293. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17294. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17295. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17296. virtual void playAlertSound();
  17297. static void drawGlassSphere (Graphics& g,
  17298. float x, float y,
  17299. float diameter,
  17300. const Colour& colour,
  17301. float outlineThickness) throw();
  17302. static void drawGlassPointer (Graphics& g,
  17303. float x, float y,
  17304. float diameter,
  17305. const Colour& colour, float outlineThickness,
  17306. int direction) throw();
  17307. static void drawGlassLozenge (Graphics& g,
  17308. float x, float y,
  17309. float width, float height,
  17310. const Colour& colour,
  17311. float outlineThickness,
  17312. float cornerSize,
  17313. bool flatOnLeft, bool flatOnRight,
  17314. bool flatOnTop, bool flatOnBottom) throw();
  17315. juce_UseDebuggingNewOperator
  17316. private:
  17317. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17318. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17319. Array <int> colourIds;
  17320. Array <Colour> colours;
  17321. // default typeface names
  17322. String defaultSans, defaultSerif, defaultFixed;
  17323. void drawShinyButtonShape (Graphics& g,
  17324. float x, float y, float w, float h, float maxCornerSize,
  17325. const Colour& baseColour,
  17326. float strokeWidth,
  17327. bool flatOnLeft,
  17328. bool flatOnRight,
  17329. bool flatOnTop,
  17330. bool flatOnBottom) throw();
  17331. LookAndFeel (const LookAndFeel&);
  17332. LookAndFeel& operator= (const LookAndFeel&);
  17333. };
  17334. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17335. /*** End of inlined file: juce_LookAndFeel.h ***/
  17336. #endif
  17337. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17338. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17339. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17340. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17341. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17342. {
  17343. public:
  17344. OldSchoolLookAndFeel();
  17345. virtual ~OldSchoolLookAndFeel();
  17346. virtual void drawButtonBackground (Graphics& g,
  17347. Button& button,
  17348. const Colour& backgroundColour,
  17349. bool isMouseOverButton,
  17350. bool isButtonDown);
  17351. virtual void drawToggleButton (Graphics& g,
  17352. ToggleButton& button,
  17353. bool isMouseOverButton,
  17354. bool isButtonDown);
  17355. virtual void drawTickBox (Graphics& g,
  17356. Component& component,
  17357. float x, float y, float w, float h,
  17358. bool ticked,
  17359. bool isEnabled,
  17360. bool isMouseOverButton,
  17361. bool isButtonDown);
  17362. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17363. int width, int height,
  17364. double progress, const String& textToShow);
  17365. virtual void drawScrollbarButton (Graphics& g,
  17366. ScrollBar& scrollbar,
  17367. int width, int height,
  17368. int buttonDirection,
  17369. bool isScrollbarVertical,
  17370. bool isMouseOverButton,
  17371. bool isButtonDown);
  17372. virtual void drawScrollbar (Graphics& g,
  17373. ScrollBar& scrollbar,
  17374. int x, int y,
  17375. int width, int height,
  17376. bool isScrollbarVertical,
  17377. int thumbStartPosition,
  17378. int thumbSize,
  17379. bool isMouseOver,
  17380. bool isMouseDown);
  17381. virtual ImageEffectFilter* getScrollbarEffect();
  17382. virtual void drawTextEditorOutline (Graphics& g,
  17383. int width, int height,
  17384. TextEditor& textEditor);
  17385. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17386. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17387. bool isMouseOverBar,
  17388. MenuBarComponent& menuBar);
  17389. virtual void drawComboBox (Graphics& g, int width, int height,
  17390. bool isButtonDown,
  17391. int buttonX, int buttonY,
  17392. int buttonW, int buttonH,
  17393. ComboBox& box);
  17394. virtual const Font getComboBoxFont (ComboBox& box);
  17395. virtual void drawLinearSlider (Graphics& g,
  17396. int x, int y,
  17397. int width, int height,
  17398. float sliderPos,
  17399. float minSliderPos,
  17400. float maxSliderPos,
  17401. const Slider::SliderStyle style,
  17402. Slider& slider);
  17403. virtual int getSliderThumbRadius (Slider& slider);
  17404. virtual Button* createSliderButton (bool isIncrement);
  17405. virtual ImageEffectFilter* getSliderEffect();
  17406. virtual void drawCornerResizer (Graphics& g,
  17407. int w, int h,
  17408. bool isMouseOver,
  17409. bool isMouseDragging);
  17410. virtual Button* createDocumentWindowButton (int buttonType);
  17411. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17412. int titleBarX, int titleBarY,
  17413. int titleBarW, int titleBarH,
  17414. Button* minimiseButton,
  17415. Button* maximiseButton,
  17416. Button* closeButton,
  17417. bool positionTitleBarButtonsOnLeft);
  17418. juce_UseDebuggingNewOperator
  17419. private:
  17420. DropShadowEffect scrollbarShadow;
  17421. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17422. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17423. };
  17424. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17425. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17426. #endif
  17427. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17428. #endif
  17429. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17430. #endif
  17431. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17432. #endif
  17433. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17434. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17435. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17436. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17437. class JUCE_API PopupMenuCustomComponent : public Component,
  17438. public ReferenceCountedObject
  17439. {
  17440. public:
  17441. ~PopupMenuCustomComponent();
  17442. virtual void getIdealSize (int& idealWidth,
  17443. int& idealHeight) = 0;
  17444. void triggerMenuItem();
  17445. bool isItemHighlighted() const throw() { return isHighlighted; }
  17446. protected:
  17447. PopupMenuCustomComponent (bool isTriggeredAutomatically = true);
  17448. private:
  17449. friend class PopupMenu;
  17450. friend class PopupMenu::ItemComponent;
  17451. friend class PopupMenu::Window;
  17452. bool isHighlighted, isTriggeredAutomatically;
  17453. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17454. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17455. };
  17456. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17457. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17458. #endif
  17459. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17460. #endif
  17461. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17462. #endif
  17463. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17464. #endif
  17465. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17466. #endif
  17467. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17468. /*** Start of inlined file: juce_LassoComponent.h ***/
  17469. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17470. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17471. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17472. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17473. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17474. template <class SelectableItemType>
  17475. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17476. {
  17477. public:
  17478. SelectedItemSet()
  17479. {
  17480. }
  17481. SelectedItemSet (const Array <SelectableItemType>& items)
  17482. : selectedItems (items)
  17483. {
  17484. }
  17485. SelectedItemSet (const SelectedItemSet& other)
  17486. : selectedItems (other.selectedItems)
  17487. {
  17488. }
  17489. SelectedItemSet& operator= (const SelectedItemSet& other)
  17490. {
  17491. if (selectedItems != other.selectedItems)
  17492. {
  17493. selectedItems = other.selectedItems;
  17494. changed();
  17495. }
  17496. return *this;
  17497. }
  17498. ~SelectedItemSet()
  17499. {
  17500. }
  17501. void selectOnly (SelectableItemType item)
  17502. {
  17503. if (isSelected (item))
  17504. {
  17505. for (int i = selectedItems.size(); --i >= 0;)
  17506. {
  17507. if (selectedItems.getUnchecked(i) != item)
  17508. {
  17509. deselect (selectedItems.getUnchecked(i));
  17510. i = jmin (i, selectedItems.size());
  17511. }
  17512. }
  17513. }
  17514. else
  17515. {
  17516. deselectAll();
  17517. changed();
  17518. selectedItems.add (item);
  17519. itemSelected (item);
  17520. }
  17521. }
  17522. void addToSelection (SelectableItemType item)
  17523. {
  17524. if (! isSelected (item))
  17525. {
  17526. changed();
  17527. selectedItems.add (item);
  17528. itemSelected (item);
  17529. }
  17530. }
  17531. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17532. const ModifierKeys& modifiers)
  17533. {
  17534. if (modifiers.isShiftDown())
  17535. {
  17536. addToSelection (item);
  17537. }
  17538. else if (modifiers.isCommandDown())
  17539. {
  17540. if (isSelected (item))
  17541. deselect (item);
  17542. else
  17543. addToSelection (item);
  17544. }
  17545. else
  17546. {
  17547. selectOnly (item);
  17548. }
  17549. }
  17550. bool addToSelectionOnMouseDown (SelectableItemType item,
  17551. const ModifierKeys& modifiers)
  17552. {
  17553. if (isSelected (item))
  17554. {
  17555. return ! modifiers.isPopupMenu();
  17556. }
  17557. else
  17558. {
  17559. addToSelectionBasedOnModifiers (item, modifiers);
  17560. return false;
  17561. }
  17562. }
  17563. void addToSelectionOnMouseUp (SelectableItemType item,
  17564. const ModifierKeys& modifiers,
  17565. const bool wasItemDragged,
  17566. const bool resultOfMouseDownSelectMethod)
  17567. {
  17568. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17569. addToSelectionBasedOnModifiers (item, modifiers);
  17570. }
  17571. void deselect (SelectableItemType item)
  17572. {
  17573. const int i = selectedItems.indexOf (item);
  17574. if (i >= 0)
  17575. {
  17576. changed();
  17577. itemDeselected (selectedItems.remove (i));
  17578. }
  17579. }
  17580. void deselectAll()
  17581. {
  17582. if (selectedItems.size() > 0)
  17583. {
  17584. changed();
  17585. for (int i = selectedItems.size(); --i >= 0;)
  17586. {
  17587. itemDeselected (selectedItems.remove (i));
  17588. i = jmin (i, selectedItems.size());
  17589. }
  17590. }
  17591. }
  17592. int getNumSelected() const throw()
  17593. {
  17594. return selectedItems.size();
  17595. }
  17596. SelectableItemType getSelectedItem (const int index) const throw()
  17597. {
  17598. return selectedItems [index];
  17599. }
  17600. bool isSelected (const SelectableItemType item) const throw()
  17601. {
  17602. return selectedItems.contains (item);
  17603. }
  17604. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17605. virtual void itemSelected (SelectableItemType item) {}
  17606. virtual void itemDeselected (SelectableItemType item) {}
  17607. void changed (const bool synchronous = false)
  17608. {
  17609. if (synchronous)
  17610. sendSynchronousChangeMessage (this);
  17611. else
  17612. sendChangeMessage (this);
  17613. }
  17614. juce_UseDebuggingNewOperator
  17615. private:
  17616. Array <SelectableItemType> selectedItems;
  17617. };
  17618. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17619. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17620. template <class SelectableItemType>
  17621. class LassoSource
  17622. {
  17623. public:
  17624. virtual ~LassoSource() {}
  17625. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17626. int x, int y, int width, int height) = 0;
  17627. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17628. };
  17629. template <class SelectableItemType>
  17630. class LassoComponent : public Component
  17631. {
  17632. public:
  17633. LassoComponent (const int outlineThickness_ = 1)
  17634. : source (0),
  17635. outlineThickness (outlineThickness_)
  17636. {
  17637. }
  17638. ~LassoComponent()
  17639. {
  17640. }
  17641. void beginLasso (const MouseEvent& e,
  17642. LassoSource <SelectableItemType>* const lassoSource)
  17643. {
  17644. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17645. jassert (lassoSource != 0); // the source can't be null!
  17646. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17647. source = lassoSource;
  17648. if (lassoSource != 0)
  17649. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17650. setSize (0, 0);
  17651. }
  17652. void dragLasso (const MouseEvent& e)
  17653. {
  17654. if (source != 0)
  17655. {
  17656. const int x1 = e.getMouseDownX();
  17657. const int y1 = e.getMouseDownY();
  17658. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17659. setVisible (true);
  17660. Array <SelectableItemType> itemsInLasso;
  17661. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17662. if (e.mods.isShiftDown())
  17663. {
  17664. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17665. itemsInLasso.addArray (originalSelection);
  17666. }
  17667. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17668. {
  17669. Array <SelectableItemType> originalMinusNew (originalSelection);
  17670. originalMinusNew.removeValuesIn (itemsInLasso);
  17671. itemsInLasso.removeValuesIn (originalSelection);
  17672. itemsInLasso.addArray (originalMinusNew);
  17673. }
  17674. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17675. }
  17676. }
  17677. void endLasso()
  17678. {
  17679. source = 0;
  17680. originalSelection.clear();
  17681. setVisible (false);
  17682. }
  17683. enum ColourIds
  17684. {
  17685. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17686. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17687. };
  17688. void paint (Graphics& g)
  17689. {
  17690. g.fillAll (findColour (lassoFillColourId));
  17691. g.setColour (findColour (lassoOutlineColourId));
  17692. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17693. // this suggests that you've left a lasso comp lying around after the
  17694. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17695. // mouse-up event.
  17696. jassert (isMouseButtonDownAnywhere());
  17697. }
  17698. bool hitTest (int x, int y) { return false; }
  17699. juce_UseDebuggingNewOperator
  17700. private:
  17701. Array <SelectableItemType> originalSelection;
  17702. LassoSource <SelectableItemType>* source;
  17703. int outlineThickness;
  17704. };
  17705. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17706. /*** End of inlined file: juce_LassoComponent.h ***/
  17707. #endif
  17708. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17709. #endif
  17710. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17711. #endif
  17712. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17713. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17714. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17715. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17716. class JUCE_API MouseHoverDetector
  17717. {
  17718. public:
  17719. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17720. virtual ~MouseHoverDetector();
  17721. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17722. void setHoverComponent (Component* const newSourceComponent);
  17723. protected:
  17724. virtual void mouseHovered (int mouseX,
  17725. int mouseY) = 0;
  17726. virtual void mouseMovedAfterHover() = 0;
  17727. private:
  17728. class JUCE_API HoverDetectorInternal : public MouseListener,
  17729. public Timer
  17730. {
  17731. public:
  17732. MouseHoverDetector* owner;
  17733. int lastX, lastY;
  17734. void timerCallback();
  17735. void mouseEnter (const MouseEvent&);
  17736. void mouseExit (const MouseEvent&);
  17737. void mouseDown (const MouseEvent&);
  17738. void mouseUp (const MouseEvent&);
  17739. void mouseMove (const MouseEvent&);
  17740. void mouseWheelMove (const MouseEvent&, float, float);
  17741. } internalTimer;
  17742. friend class HoverDetectorInternal;
  17743. Component* source;
  17744. int hoverTimeMillisecs;
  17745. bool hasJustHovered;
  17746. void hoverTimerCallback();
  17747. void checkJustHoveredCallback();
  17748. MouseHoverDetector (const MouseHoverDetector&);
  17749. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17750. };
  17751. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17752. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17753. #endif
  17754. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17755. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17756. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17757. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17758. class Component;
  17759. class ComponentPeer;
  17760. class MouseInputSourceInternal;
  17761. class JUCE_API MouseInputSource
  17762. {
  17763. public:
  17764. MouseInputSource (int index, bool isMouseDevice);
  17765. ~MouseInputSource();
  17766. bool isMouse() const;
  17767. bool isTouch() const;
  17768. bool canHover() const;
  17769. bool hasMouseWheel() const;
  17770. int getIndex() const;
  17771. bool isDragging() const;
  17772. const Point<int> getScreenPosition() const;
  17773. const ModifierKeys getCurrentModifiers() const;
  17774. Component* getComponentUnderMouse() const;
  17775. void triggerFakeMove() const;
  17776. int getNumberOfMultipleClicks() const throw();
  17777. const Time getLastMouseDownTime() const throw();
  17778. const Point<int> getLastMouseDownPosition() const throw();
  17779. bool hasMouseMovedSignificantlySincePressed() const throw();
  17780. bool hasMouseCursor() const throw();
  17781. void showMouseCursor (const MouseCursor& cursor);
  17782. void hideCursor();
  17783. void revealCursor();
  17784. void forceMouseCursorUpdate();
  17785. bool canDoUnboundedMovement() const throw();
  17786. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17787. juce_UseDebuggingNewOperator
  17788. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17789. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17790. private:
  17791. friend class Desktop;
  17792. friend class ComponentPeer;
  17793. friend class MouseInputSourceInternal;
  17794. ScopedPointer<MouseInputSourceInternal> pimpl;
  17795. MouseInputSource (const MouseInputSource&);
  17796. MouseInputSource& operator= (const MouseInputSource&);
  17797. };
  17798. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17799. /*** End of inlined file: juce_MouseInputSource.h ***/
  17800. #endif
  17801. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17802. #endif
  17803. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17804. #endif
  17805. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17806. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17807. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17808. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17809. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17810. private ButtonListener
  17811. {
  17812. protected:
  17813. BooleanPropertyComponent (const String& propertyName,
  17814. const String& buttonTextWhenTrue,
  17815. const String& buttonTextWhenFalse);
  17816. public:
  17817. BooleanPropertyComponent (const Value& valueToControl,
  17818. const String& propertyName,
  17819. const String& buttonText);
  17820. ~BooleanPropertyComponent();
  17821. virtual void setState (bool newState);
  17822. virtual bool getState() const;
  17823. void paint (Graphics& g);
  17824. void refresh();
  17825. void buttonClicked (Button*);
  17826. juce_UseDebuggingNewOperator
  17827. private:
  17828. ToggleButton* button;
  17829. String onText, offText;
  17830. void createButton();
  17831. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17832. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17833. };
  17834. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17835. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17836. #endif
  17837. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17838. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17839. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17840. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17841. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17842. private ButtonListener
  17843. {
  17844. public:
  17845. ButtonPropertyComponent (const String& propertyName,
  17846. bool triggerOnMouseDown);
  17847. ~ButtonPropertyComponent();
  17848. virtual void buttonClicked() = 0;
  17849. virtual const String getButtonText() const = 0;
  17850. void refresh();
  17851. void buttonClicked (Button*);
  17852. juce_UseDebuggingNewOperator
  17853. private:
  17854. TextButton* button;
  17855. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17856. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17857. };
  17858. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17859. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17860. #endif
  17861. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17862. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17863. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17864. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17865. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17866. private ComboBoxListener
  17867. {
  17868. protected:
  17869. ChoicePropertyComponent (const String& propertyName);
  17870. public:
  17871. ChoicePropertyComponent (const Value& valueToControl,
  17872. const String& propertyName,
  17873. const StringArray& choices,
  17874. const Array <int>* choiceIDs = 0);
  17875. ~ChoicePropertyComponent();
  17876. virtual void setIndex (int newIndex);
  17877. virtual int getIndex() const;
  17878. const StringArray& getChoices() const;
  17879. void refresh();
  17880. void comboBoxChanged (ComboBox*);
  17881. juce_UseDebuggingNewOperator
  17882. protected:
  17883. StringArray choices;
  17884. private:
  17885. ComboBox* comboBox;
  17886. void createComboBox (const Array <int>* choiceIDs);
  17887. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17888. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17889. };
  17890. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17891. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17892. #endif
  17893. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17894. #endif
  17895. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17896. #endif
  17897. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17898. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17899. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17900. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17901. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17902. private SliderListener
  17903. {
  17904. protected:
  17905. SliderPropertyComponent (const String& propertyName,
  17906. double rangeMin,
  17907. double rangeMax,
  17908. double interval,
  17909. double skewFactor = 1.0);
  17910. public:
  17911. SliderPropertyComponent (Value& valueToControl,
  17912. const String& propertyName,
  17913. double rangeMin,
  17914. double rangeMax,
  17915. double interval,
  17916. double skewFactor = 1.0);
  17917. ~SliderPropertyComponent();
  17918. virtual void setValue (double newValue);
  17919. virtual double getValue() const;
  17920. void refresh();
  17921. void changeListenerCallback (void*);
  17922. void sliderValueChanged (Slider*);
  17923. juce_UseDebuggingNewOperator
  17924. protected:
  17925. Slider* slider;
  17926. SliderPropertyComponent (const SliderPropertyComponent&);
  17927. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17928. };
  17929. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17930. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  17931. #endif
  17932. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17933. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  17934. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17935. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17936. class JUCE_API TextPropertyComponent : public PropertyComponent
  17937. {
  17938. protected:
  17939. TextPropertyComponent (const String& propertyName,
  17940. int maxNumChars,
  17941. bool isMultiLine);
  17942. public:
  17943. TextPropertyComponent (const Value& valueToControl,
  17944. const String& propertyName,
  17945. int maxNumChars,
  17946. bool isMultiLine);
  17947. ~TextPropertyComponent();
  17948. virtual void setText (const String& newText);
  17949. virtual const String getText() const;
  17950. void refresh();
  17951. void textWasEdited();
  17952. juce_UseDebuggingNewOperator
  17953. private:
  17954. Label* textEditor;
  17955. void createEditor (int maxNumChars, bool isMultiLine);
  17956. TextPropertyComponent (const TextPropertyComponent&);
  17957. TextPropertyComponent& operator= (const TextPropertyComponent&);
  17958. };
  17959. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17960. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  17961. #endif
  17962. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17963. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  17964. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17965. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17966. #if JUCE_WINDOWS || DOXYGEN
  17967. class JUCE_API ActiveXControlComponent : public Component
  17968. {
  17969. public:
  17970. ActiveXControlComponent();
  17971. ~ActiveXControlComponent();
  17972. bool createControl (const void* controlIID);
  17973. void deleteControl();
  17974. bool isControlOpen() const throw() { return control != 0; }
  17975. void* queryInterface (const void* iid) const;
  17976. void setMouseEventsAllowed (bool eventsCanReachControl);
  17977. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  17978. void paint (Graphics& g);
  17979. void* originalWndProc;
  17980. juce_UseDebuggingNewOperator
  17981. private:
  17982. class ActiveXControlData;
  17983. friend class ActiveXControlData;
  17984. void* control;
  17985. bool mouseEventsAllowed;
  17986. ActiveXControlComponent (const ActiveXControlComponent&);
  17987. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  17988. void setControlBounds (const Rectangle<int>& bounds) const;
  17989. void setControlVisible (bool b) const;
  17990. };
  17991. #endif
  17992. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17993. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  17994. #endif
  17995. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17996. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  17997. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17998. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17999. class MidiInputSelectorComponentListBox;
  18000. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18001. public ComboBoxListener,
  18002. public ButtonListener,
  18003. public ChangeListener
  18004. {
  18005. public:
  18006. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18007. const int minAudioInputChannels,
  18008. const int maxAudioInputChannels,
  18009. const int minAudioOutputChannels,
  18010. const int maxAudioOutputChannels,
  18011. const bool showMidiInputOptions,
  18012. const bool showMidiOutputSelector,
  18013. const bool showChannelsAsStereoPairs,
  18014. const bool hideAdvancedOptionsWithButton);
  18015. ~AudioDeviceSelectorComponent();
  18016. void resized();
  18017. void comboBoxChanged (ComboBox*);
  18018. void buttonClicked (Button*);
  18019. void changeListenerCallback (void*);
  18020. void childBoundsChanged (Component*);
  18021. juce_UseDebuggingNewOperator
  18022. private:
  18023. AudioDeviceManager& deviceManager;
  18024. ComboBox* deviceTypeDropDown;
  18025. Label* deviceTypeDropDownLabel;
  18026. Component* audioDeviceSettingsComp;
  18027. String audioDeviceSettingsCompType;
  18028. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18029. const bool showChannelsAsStereoPairs;
  18030. const bool hideAdvancedOptionsWithButton;
  18031. MidiInputSelectorComponentListBox* midiInputsList;
  18032. Label* midiInputsLabel;
  18033. ComboBox* midiOutputSelector;
  18034. Label* midiOutputLabel;
  18035. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18036. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18037. };
  18038. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18039. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18040. #endif
  18041. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18042. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18043. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18044. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18045. class JUCE_API BubbleComponent : public Component
  18046. {
  18047. protected:
  18048. BubbleComponent();
  18049. public:
  18050. ~BubbleComponent();
  18051. enum BubblePlacement
  18052. {
  18053. above = 1,
  18054. below = 2,
  18055. left = 4,
  18056. right = 8
  18057. };
  18058. void setAllowedPlacement (int newPlacement);
  18059. void setPosition (Component* componentToPointTo);
  18060. void setPosition (int arrowTipX,
  18061. int arrowTipY);
  18062. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18063. protected:
  18064. virtual void getContentSize (int& width, int& height) = 0;
  18065. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18066. public:
  18067. void paint (Graphics& g);
  18068. juce_UseDebuggingNewOperator
  18069. private:
  18070. Rectangle<int> content;
  18071. int side, allowablePlacements;
  18072. float arrowTipX, arrowTipY;
  18073. DropShadowEffect shadow;
  18074. BubbleComponent (const BubbleComponent&);
  18075. BubbleComponent& operator= (const BubbleComponent&);
  18076. };
  18077. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18078. /*** End of inlined file: juce_BubbleComponent.h ***/
  18079. #endif
  18080. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18081. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18082. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18083. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18084. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18085. private Timer
  18086. {
  18087. public:
  18088. BubbleMessageComponent (int fadeOutLengthMs = 150);
  18089. ~BubbleMessageComponent();
  18090. void showAt (int x, int y,
  18091. const String& message,
  18092. int numMillisecondsBeforeRemoving,
  18093. bool removeWhenMouseClicked = true,
  18094. bool deleteSelfAfterUse = false);
  18095. void showAt (Component* component,
  18096. const String& message,
  18097. int numMillisecondsBeforeRemoving,
  18098. bool removeWhenMouseClicked = true,
  18099. bool deleteSelfAfterUse = false);
  18100. void getContentSize (int& w, int& h);
  18101. void paintContent (Graphics& g, int w, int h);
  18102. void timerCallback();
  18103. juce_UseDebuggingNewOperator
  18104. private:
  18105. int fadeOutLength, mouseClickCounter;
  18106. TextLayout textLayout;
  18107. int64 expiryTime;
  18108. bool deleteAfterUse;
  18109. void init (int numMillisecondsBeforeRemoving,
  18110. bool removeWhenMouseClicked,
  18111. bool deleteSelfAfterUse);
  18112. BubbleMessageComponent (const BubbleMessageComponent&);
  18113. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18114. };
  18115. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18116. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18117. #endif
  18118. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18119. /*** Start of inlined file: juce_ColourSelector.h ***/
  18120. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18121. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18122. class JUCE_API ColourSelector : public Component,
  18123. public ChangeBroadcaster,
  18124. protected SliderListener
  18125. {
  18126. public:
  18127. enum ColourSelectorOptions
  18128. {
  18129. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18130. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18131. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18132. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18133. };
  18134. ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18135. int edgeGap = 4,
  18136. int gapAroundColourSpaceComponent = 7);
  18137. ~ColourSelector();
  18138. const Colour getCurrentColour() const;
  18139. void setCurrentColour (const Colour& newColour);
  18140. virtual int getNumSwatches() const;
  18141. virtual const Colour getSwatchColour (int index) const;
  18142. virtual void setSwatchColour (int index, const Colour& newColour) const;
  18143. enum ColourIds
  18144. {
  18145. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18146. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18147. };
  18148. juce_UseDebuggingNewOperator
  18149. private:
  18150. friend class ColourSpaceView;
  18151. friend class HueSelectorComp;
  18152. Colour colour;
  18153. float h, s, v;
  18154. Slider* sliders[4];
  18155. Component* colourSpace;
  18156. Component* hueSelector;
  18157. class SwatchComponent;
  18158. OwnedArray <SwatchComponent> swatchComponents;
  18159. const int flags;
  18160. int topSpace, edgeGap;
  18161. void setHue (float newH);
  18162. void setSV (float newS, float newV);
  18163. void updateHSV();
  18164. void update();
  18165. void sliderValueChanged (Slider*);
  18166. void paint (Graphics& g);
  18167. void resized();
  18168. ColourSelector (const ColourSelector&);
  18169. ColourSelector& operator= (const ColourSelector&);
  18170. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18171. // have changed - if you get an error here, update your code to use the new constructor instead..
  18172. // (xxx - note to self: remember to remove this at some point in the future)
  18173. ColourSelector (bool);
  18174. };
  18175. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18176. /*** End of inlined file: juce_ColourSelector.h ***/
  18177. #endif
  18178. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18179. #endif
  18180. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18181. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18182. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18183. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18184. class JUCE_API MagnifierComponent : public Component
  18185. {
  18186. public:
  18187. MagnifierComponent (Component* contentComponent,
  18188. bool deleteContentCompWhenNoLongerNeeded);
  18189. ~MagnifierComponent();
  18190. Component* getContentComponent() const { return content; }
  18191. void setScaleFactor (double newScaleFactor);
  18192. double getScaleFactor() const { return scaleFactor; }
  18193. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18194. juce_UseDebuggingNewOperator
  18195. void childBoundsChanged (Component*);
  18196. private:
  18197. Component* content;
  18198. Component* holderComp;
  18199. double scaleFactor;
  18200. ComponentPeer* peer;
  18201. bool deleteContent;
  18202. Graphics::ResamplingQuality quality;
  18203. MouseInputSource mouseSource;
  18204. void paint (Graphics& g);
  18205. void mouseDown (const MouseEvent& e);
  18206. void mouseUp (const MouseEvent& e);
  18207. void mouseDrag (const MouseEvent& e);
  18208. void mouseMove (const MouseEvent& e);
  18209. void mouseEnter (const MouseEvent& e);
  18210. void mouseExit (const MouseEvent& e);
  18211. void mouseWheelMove (const MouseEvent& e, float, float);
  18212. void passOnMouseEventToPeer (const MouseEvent& e);
  18213. int scaleInt (int n) const;
  18214. MagnifierComponent (const MagnifierComponent&);
  18215. MagnifierComponent& operator= (const MagnifierComponent&);
  18216. };
  18217. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18218. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18219. #endif
  18220. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18221. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18222. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18223. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18224. class JUCE_API MidiKeyboardComponent : public Component,
  18225. public MidiKeyboardStateListener,
  18226. public ChangeBroadcaster,
  18227. private Timer,
  18228. private AsyncUpdater
  18229. {
  18230. public:
  18231. enum Orientation
  18232. {
  18233. horizontalKeyboard,
  18234. verticalKeyboardFacingLeft,
  18235. verticalKeyboardFacingRight,
  18236. };
  18237. MidiKeyboardComponent (MidiKeyboardState& state,
  18238. Orientation orientation);
  18239. ~MidiKeyboardComponent();
  18240. void setVelocity (float velocity, bool useMousePositionForVelocity);
  18241. void setMidiChannel (int midiChannelNumber);
  18242. int getMidiChannel() const throw() { return midiChannel; }
  18243. void setMidiChannelsToDisplay (int midiChannelMask);
  18244. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18245. void setKeyWidth (float widthInPixels);
  18246. float getKeyWidth() const throw() { return keyWidth; }
  18247. void setOrientation (Orientation newOrientation);
  18248. const Orientation getOrientation() const throw() { return orientation; }
  18249. void setAvailableRange (int lowestNote,
  18250. int highestNote);
  18251. int getRangeStart() const throw() { return rangeStart; }
  18252. int getRangeEnd() const throw() { return rangeEnd; }
  18253. void setLowestVisibleKey (int noteNumber);
  18254. int getLowestVisibleKey() const throw() { return firstKey; }
  18255. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18256. void setScrollButtonsVisible (bool canScroll);
  18257. enum ColourIds
  18258. {
  18259. whiteNoteColourId = 0x1005000,
  18260. blackNoteColourId = 0x1005001,
  18261. keySeparatorLineColourId = 0x1005002,
  18262. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18263. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18264. textLabelColourId = 0x1005005,
  18265. upDownButtonBackgroundColourId = 0x1005006,
  18266. upDownButtonArrowColourId = 0x1005007
  18267. };
  18268. int getKeyStartPosition (const int midiNoteNumber) const;
  18269. void clearKeyMappings();
  18270. void setKeyPressForNote (const KeyPress& key,
  18271. int midiNoteOffsetFromC);
  18272. void removeKeyPressForNote (int midiNoteOffsetFromC);
  18273. void setKeyPressBaseOctave (int newOctaveNumber);
  18274. void setOctaveForMiddleC (int octaveNumForMiddleC) throw();
  18275. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18276. void paint (Graphics& g);
  18277. void resized();
  18278. void mouseMove (const MouseEvent& e);
  18279. void mouseDrag (const MouseEvent& e);
  18280. void mouseDown (const MouseEvent& e);
  18281. void mouseUp (const MouseEvent& e);
  18282. void mouseEnter (const MouseEvent& e);
  18283. void mouseExit (const MouseEvent& e);
  18284. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18285. void timerCallback();
  18286. bool keyStateChanged (bool isKeyDown);
  18287. void focusLost (FocusChangeType cause);
  18288. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18289. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18290. void handleAsyncUpdate();
  18291. void colourChanged();
  18292. juce_UseDebuggingNewOperator
  18293. protected:
  18294. friend class MidiKeyboardUpDownButton;
  18295. virtual void drawWhiteNote (int midiNoteNumber,
  18296. Graphics& g,
  18297. int x, int y, int w, int h,
  18298. bool isDown, bool isOver,
  18299. const Colour& lineColour,
  18300. const Colour& textColour);
  18301. virtual void drawBlackNote (int midiNoteNumber,
  18302. Graphics& g,
  18303. int x, int y, int w, int h,
  18304. bool isDown, bool isOver,
  18305. const Colour& noteFillColour);
  18306. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18307. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18308. const bool isMouseOver,
  18309. const bool isButtonPressed,
  18310. const bool movesOctavesUp);
  18311. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18312. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18313. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18314. int& x, int& w) const;
  18315. private:
  18316. MidiKeyboardState& state;
  18317. int xOffset, blackNoteLength;
  18318. float keyWidth;
  18319. Orientation orientation;
  18320. int midiChannel, midiInChannelMask;
  18321. float velocity;
  18322. int noteUnderMouse, mouseDownNote;
  18323. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18324. int rangeStart, rangeEnd, firstKey;
  18325. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18326. Button* scrollDown;
  18327. Button* scrollUp;
  18328. Array <KeyPress> keyPresses;
  18329. Array <int> keyPressNotes;
  18330. int keyMappingOctave;
  18331. int octaveNumForMiddleC;
  18332. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18333. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18334. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18335. void resetAnyKeysInUse();
  18336. void updateNoteUnderMouse (const Point<int>& pos);
  18337. void repaintNote (const int midiNoteNumber);
  18338. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18339. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18340. };
  18341. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18342. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18343. #endif
  18344. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18345. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18346. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18347. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18348. #if ! DOXYGEN
  18349. class NSViewComponentInternal;
  18350. #endif
  18351. #if JUCE_MAC || DOXYGEN
  18352. class JUCE_API NSViewComponent : public Component
  18353. {
  18354. public:
  18355. NSViewComponent();
  18356. ~NSViewComponent();
  18357. void setView (void* nsView);
  18358. void* getView() const;
  18359. void paint (Graphics& g);
  18360. juce_UseDebuggingNewOperator
  18361. private:
  18362. friend class NSViewComponentInternal;
  18363. ScopedPointer <NSViewComponentInternal> info;
  18364. NSViewComponent (const NSViewComponent&);
  18365. NSViewComponent& operator= (const NSViewComponent&);
  18366. };
  18367. #endif
  18368. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18369. /*** End of inlined file: juce_NSViewComponent.h ***/
  18370. #endif
  18371. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18372. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18373. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18374. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18375. // this is used to disable OpenGL, and is defined in juce_Config.h
  18376. #if JUCE_OPENGL || DOXYGEN
  18377. class JUCE_API OpenGLPixelFormat
  18378. {
  18379. public:
  18380. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18381. const int alphaBits = 8,
  18382. const int depthBufferBits = 16,
  18383. const int stencilBufferBits = 0);
  18384. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18385. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18386. bool operator== (const OpenGLPixelFormat&) const;
  18387. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18388. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18389. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18390. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18391. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18392. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18393. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18394. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18395. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18396. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18397. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18398. static void getAvailablePixelFormats (Component* component,
  18399. OwnedArray <OpenGLPixelFormat>& results);
  18400. juce_UseDebuggingNewOperator
  18401. };
  18402. class JUCE_API OpenGLContext
  18403. {
  18404. public:
  18405. virtual ~OpenGLContext();
  18406. virtual bool makeActive() const throw() = 0;
  18407. virtual bool makeInactive() const throw() = 0;
  18408. virtual bool isActive() const throw() = 0;
  18409. virtual void swapBuffers() = 0;
  18410. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18411. virtual int getSwapInterval() const = 0;
  18412. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18413. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18414. virtual void repaint() = 0;
  18415. virtual void* getRawContext() const throw() = 0;
  18416. static OpenGLContext* getCurrentContext();
  18417. juce_UseDebuggingNewOperator
  18418. protected:
  18419. OpenGLContext() throw();
  18420. };
  18421. class JUCE_API OpenGLComponent : public Component
  18422. {
  18423. public:
  18424. enum OpenGLType
  18425. {
  18426. openGLDefault = 0,
  18427. #if JUCE_IPHONE
  18428. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18429. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18430. #endif
  18431. };
  18432. OpenGLComponent (OpenGLType type = openGLDefault);
  18433. ~OpenGLComponent();
  18434. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18435. const OpenGLPixelFormat getPixelFormat() const;
  18436. void shareWith (OpenGLContext* contextToShareListsWith);
  18437. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18438. void swapBuffers();
  18439. virtual void renderOpenGL() = 0;
  18440. virtual void newOpenGLContextCreated() = 0;
  18441. OpenGLContext* getCurrentContext() const throw() { return context; }
  18442. bool makeCurrentContextActive();
  18443. void makeCurrentContextInactive();
  18444. bool isActiveContext() const throw();
  18445. virtual bool renderAndSwapBuffers();
  18446. CriticalSection& getContextLock() throw() { return contextLock; }
  18447. void paint (Graphics& g);
  18448. void* getNativeWindowHandle() const;
  18449. juce_UseDebuggingNewOperator
  18450. private:
  18451. const OpenGLType type;
  18452. class OpenGLComponentWatcher;
  18453. friend class OpenGLComponentWatcher;
  18454. friend class ScopedPointer <OpenGLComponentWatcher>;
  18455. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18456. ScopedPointer <OpenGLContext> context;
  18457. OpenGLContext* contextToShareListsWith;
  18458. CriticalSection contextLock;
  18459. OpenGLPixelFormat preferredPixelFormat;
  18460. bool needToUpdateViewport;
  18461. OpenGLContext* createContext();
  18462. void deleteContext();
  18463. void updateContextPosition();
  18464. void internalRepaint (int x, int y, int w, int h);
  18465. OpenGLComponent (const OpenGLComponent&);
  18466. OpenGLComponent& operator= (const OpenGLComponent&);
  18467. };
  18468. #endif
  18469. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18470. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18471. #endif
  18472. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18473. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18474. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18475. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18476. class JUCE_API PreferencesPanel : public Component,
  18477. private ButtonListener
  18478. {
  18479. public:
  18480. PreferencesPanel();
  18481. ~PreferencesPanel();
  18482. void addSettingsPage (const String& pageTitle,
  18483. const Drawable* normalIcon,
  18484. const Drawable* overIcon,
  18485. const Drawable* downIcon);
  18486. void addSettingsPage (const String& pageTitle,
  18487. const char* imageData,
  18488. int imageDataSize);
  18489. void showInDialogBox (const String& dialogtitle,
  18490. int dialogWidth,
  18491. int dialogHeight,
  18492. const Colour& backgroundColour = Colours::white);
  18493. virtual Component* createComponentForPage (const String& pageName) = 0;
  18494. void setCurrentPage (const String& pageName);
  18495. void resized();
  18496. void paint (Graphics& g);
  18497. void buttonClicked (Button* button);
  18498. juce_UseDebuggingNewOperator
  18499. private:
  18500. String currentPageName;
  18501. ScopedPointer <Component> currentPage;
  18502. int buttonSize;
  18503. PreferencesPanel (const PreferencesPanel&);
  18504. PreferencesPanel& operator= (const PreferencesPanel&);
  18505. };
  18506. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18507. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18508. #endif
  18509. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18510. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18511. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18512. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18513. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18514. // amalgamated build)
  18515. #if JUCE_WINDOWS
  18516. typedef ActiveXControlComponent QTCompBaseClass;
  18517. #elif JUCE_MAC
  18518. typedef NSViewComponent QTCompBaseClass;
  18519. #endif
  18520. // this is used to disable QuickTime, and is defined in juce_Config.h
  18521. #if JUCE_QUICKTIME || DOXYGEN
  18522. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18523. {
  18524. public:
  18525. QuickTimeMovieComponent();
  18526. ~QuickTimeMovieComponent();
  18527. static bool isQuickTimeAvailable() throw();
  18528. bool loadMovie (const File& movieFile,
  18529. bool isControllerVisible);
  18530. bool loadMovie (const URL& movieURL,
  18531. bool isControllerVisible);
  18532. bool loadMovie (InputStream* movieStream,
  18533. bool isControllerVisible);
  18534. void closeMovie();
  18535. const File getCurrentMovieFile() const;
  18536. bool isMovieOpen() const;
  18537. double getMovieDuration() const;
  18538. void getMovieNormalSize (int& width, int& height) const;
  18539. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18540. const RectanglePlacement& placement);
  18541. void play();
  18542. void stop();
  18543. bool isPlaying() const;
  18544. void goToStart();
  18545. void setPosition (double seconds);
  18546. double getPosition() const;
  18547. void setSpeed (float newSpeed);
  18548. void setMovieVolume (float newVolume);
  18549. float getMovieVolume() const;
  18550. void setLooping (bool shouldLoop);
  18551. bool isLooping() const;
  18552. bool isControllerVisible() const;
  18553. void paint (Graphics& g);
  18554. juce_UseDebuggingNewOperator
  18555. private:
  18556. File movieFile;
  18557. bool movieLoaded, controllerVisible, looping;
  18558. #if JUCE_WINDOWS
  18559. void parentHierarchyChanged();
  18560. void visibilityChanged();
  18561. void createControlIfNeeded();
  18562. bool isControlCreated() const;
  18563. class Pimpl;
  18564. friend class ScopedPointer <Pimpl>;
  18565. ScopedPointer <Pimpl> pimpl;
  18566. #else
  18567. void* movie;
  18568. #endif
  18569. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18570. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18571. };
  18572. #endif
  18573. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18574. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18575. #endif
  18576. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18577. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18578. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18579. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18580. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18581. class JUCE_API SystemTrayIconComponent : public Component
  18582. {
  18583. public:
  18584. SystemTrayIconComponent();
  18585. ~SystemTrayIconComponent();
  18586. void setIconImage (const Image& newImage);
  18587. void setIconTooltip (const String& tooltip);
  18588. #if JUCE_LINUX
  18589. void paint (Graphics& g);
  18590. #endif
  18591. juce_UseDebuggingNewOperator
  18592. private:
  18593. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18594. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18595. };
  18596. #endif
  18597. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18598. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18599. #endif
  18600. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18601. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18602. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18603. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18604. #if JUCE_WEB_BROWSER || DOXYGEN
  18605. #if ! DOXYGEN
  18606. class WebBrowserComponentInternal;
  18607. #endif
  18608. class JUCE_API WebBrowserComponent : public Component
  18609. {
  18610. public:
  18611. WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true);
  18612. ~WebBrowserComponent();
  18613. void goToURL (const String& url,
  18614. const StringArray* headers = 0,
  18615. const MemoryBlock* postData = 0);
  18616. void stop();
  18617. void goBack();
  18618. void goForward();
  18619. void refresh();
  18620. virtual bool pageAboutToLoad (const String& newURL);
  18621. void paint (Graphics& g);
  18622. void resized();
  18623. void parentHierarchyChanged();
  18624. void visibilityChanged();
  18625. juce_UseDebuggingNewOperator
  18626. private:
  18627. WebBrowserComponentInternal* browser;
  18628. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18629. String lastURL;
  18630. StringArray lastHeaders;
  18631. MemoryBlock lastPostData;
  18632. void reloadLastURL();
  18633. void checkWindowAssociation();
  18634. WebBrowserComponent (const WebBrowserComponent&);
  18635. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18636. };
  18637. #endif
  18638. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18639. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18640. #endif
  18641. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18642. #endif
  18643. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18644. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18645. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18646. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18647. class ComponentBoundsConstrainer;
  18648. class JUCE_API ComponentPeer
  18649. {
  18650. public:
  18651. enum StyleFlags
  18652. {
  18653. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18654. entry on the taskbar (ignored on MacOSX) */
  18655. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18656. tooltip, etc. */
  18657. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18658. through it (may not be possible on some platforms). */
  18659. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18660. title bar and frame\. if not specified, the window will be
  18661. borderless. */
  18662. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18663. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18664. minimise button on it. */
  18665. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18666. maximise button on it. */
  18667. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18668. close button on it. */
  18669. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18670. not be possible on all platforms). */
  18671. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18672. do its own repainting, but only to repaint when the
  18673. performAnyPendingRepaintsNow() method is called. */
  18674. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18675. be used for things like plugin windows, to stop them interfering
  18676. with the host's shortcut keys */
  18677. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18678. };
  18679. ComponentPeer (Component* component,
  18680. int styleFlags) throw();
  18681. virtual ~ComponentPeer();
  18682. Component* getComponent() const throw() { return component; }
  18683. int getStyleFlags() const throw() { return styleFlags; }
  18684. virtual void* getNativeHandle() const = 0;
  18685. virtual void setVisible (bool shouldBeVisible) = 0;
  18686. virtual void setTitle (const String& title) = 0;
  18687. virtual void setPosition (int x, int y) = 0;
  18688. virtual void setSize (int w, int h) = 0;
  18689. virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0;
  18690. virtual const Rectangle<int> getBounds() const = 0;
  18691. virtual const Point<int> getScreenPosition() const = 0;
  18692. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18693. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18694. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18695. virtual bool isMinimised() const = 0;
  18696. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18697. virtual bool isFullScreen() const = 0;
  18698. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18699. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18700. virtual void setIcon (const Image& newIcon) = 0;
  18701. void setConstrainer (ComponentBoundsConstrainer* newConstrainer) throw();
  18702. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18703. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18704. virtual const BorderSize getFrameSize() const = 0;
  18705. void handleMovedOrResized();
  18706. void handleScreenSizeChange();
  18707. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18708. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18709. virtual void toFront (bool makeActive) = 0;
  18710. virtual void toBehind (ComponentPeer* other) = 0;
  18711. void handleBroughtToFront();
  18712. virtual bool isFocused() const = 0;
  18713. virtual void grabFocus() = 0;
  18714. virtual void textInputRequired (const Point<int>& position) = 0;
  18715. void handleFocusGain();
  18716. void handleFocusLoss();
  18717. Component* getLastFocusedSubcomponent() const throw();
  18718. bool handleKeyPress (int keyCode,
  18719. juce_wchar textCharacter);
  18720. bool handleKeyUpOrDown (bool isKeyDown);
  18721. void handleModifierKeysChange();
  18722. TextInputTarget* findCurrentTextInputTarget();
  18723. virtual void repaint (int x, int y, int w, int h) = 0;
  18724. virtual void performAnyPendingRepaintsNow() = 0;
  18725. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
  18726. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18727. void handleUserClosingWindow();
  18728. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18729. void handleFileDragExit (const StringArray& files);
  18730. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18731. void clearMaskedRegion() throw();
  18732. void addMaskedRegion (int x, int y, int w, int h) throw();
  18733. static int getNumPeers() throw();
  18734. static ComponentPeer* getPeer (int index) throw();
  18735. static bool isValidPeer (const ComponentPeer* peer) throw();
  18736. static void bringModalComponentToFront();
  18737. virtual const StringArray getAvailableRenderingEngines() throw();
  18738. virtual int getCurrentRenderingEngine() throw();
  18739. virtual void setCurrentRenderingEngine (int index) throw();
  18740. juce_UseDebuggingNewOperator
  18741. protected:
  18742. Component* const component;
  18743. const int styleFlags;
  18744. RectangleList maskedRegion;
  18745. Rectangle<int> lastNonFullscreenBounds;
  18746. uint32 lastPaintTime;
  18747. ComponentBoundsConstrainer* constrainer;
  18748. static void updateCurrentModifiers() throw();
  18749. private:
  18750. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  18751. Component* lastDragAndDropCompUnderMouse;
  18752. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18753. friend class Component;
  18754. static ComponentPeer* getPeerFor (const Component* component) throw();
  18755. void setLastDragDropTarget (Component* comp);
  18756. ComponentPeer (const ComponentPeer&);
  18757. ComponentPeer& operator= (const ComponentPeer&);
  18758. };
  18759. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18760. /*** End of inlined file: juce_ComponentPeer.h ***/
  18761. #endif
  18762. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18763. /*** Start of inlined file: juce_DialogWindow.h ***/
  18764. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18765. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18766. class JUCE_API DialogWindow : public DocumentWindow
  18767. {
  18768. public:
  18769. DialogWindow (const String& name,
  18770. const Colour& backgroundColour,
  18771. bool escapeKeyTriggersCloseButton,
  18772. bool addToDesktop = true);
  18773. ~DialogWindow();
  18774. static int showModalDialog (const String& dialogTitle,
  18775. Component* contentComponent,
  18776. Component* componentToCentreAround,
  18777. const Colour& backgroundColour,
  18778. bool escapeKeyTriggersCloseButton,
  18779. bool shouldBeResizable = false,
  18780. bool useBottomRightCornerResizer = false);
  18781. juce_UseDebuggingNewOperator
  18782. protected:
  18783. void resized();
  18784. private:
  18785. bool escapeKeyTriggersCloseButton;
  18786. DialogWindow (const DialogWindow&);
  18787. DialogWindow& operator= (const DialogWindow&);
  18788. };
  18789. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18790. /*** End of inlined file: juce_DialogWindow.h ***/
  18791. #endif
  18792. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18793. #endif
  18794. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18795. #endif
  18796. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18797. /*** Start of inlined file: juce_SplashScreen.h ***/
  18798. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18799. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18800. class JUCE_API SplashScreen : public Component,
  18801. public Timer,
  18802. private DeletedAtShutdown
  18803. {
  18804. public:
  18805. SplashScreen();
  18806. ~SplashScreen();
  18807. void show (const String& title,
  18808. Image* backgroundImage,
  18809. int minimumTimeToDisplayFor,
  18810. bool useDropShadow,
  18811. bool removeOnMouseClick = true);
  18812. void show (const String& title,
  18813. int width,
  18814. int height,
  18815. int minimumTimeToDisplayFor,
  18816. bool useDropShadow,
  18817. bool removeOnMouseClick = true);
  18818. void paint (Graphics& g);
  18819. void timerCallback();
  18820. juce_UseDebuggingNewOperator
  18821. private:
  18822. Image* backgroundImage;
  18823. Time earliestTimeToDelete;
  18824. int originalClickCounter;
  18825. SplashScreen (const SplashScreen&);
  18826. SplashScreen& operator= (const SplashScreen&);
  18827. };
  18828. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18829. /*** End of inlined file: juce_SplashScreen.h ***/
  18830. #endif
  18831. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18832. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18833. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18834. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18835. class JUCE_API ThreadWithProgressWindow : public Thread,
  18836. private Timer
  18837. {
  18838. public:
  18839. ThreadWithProgressWindow (const String& windowTitle,
  18840. bool hasProgressBar,
  18841. bool hasCancelButton,
  18842. int timeOutMsWhenCancelling = 10000,
  18843. const String& cancelButtonText = "Cancel");
  18844. ~ThreadWithProgressWindow();
  18845. bool runThread (int threadPriority = 5);
  18846. void setProgress (double newProgress);
  18847. void setStatusMessage (const String& newStatusMessage);
  18848. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18849. juce_UseDebuggingNewOperator
  18850. private:
  18851. void timerCallback();
  18852. double progress;
  18853. ScopedPointer <AlertWindow> alertWindow;
  18854. String message;
  18855. CriticalSection messageLock;
  18856. const int timeOutMsWhenCancelling;
  18857. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18858. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18859. };
  18860. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18861. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18862. #endif
  18863. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18864. #endif
  18865. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18866. #endif
  18867. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18868. #endif
  18869. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18870. #endif
  18871. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18872. #endif
  18873. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18874. #endif
  18875. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18876. #endif
  18877. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18878. #endif
  18879. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18880. #endif
  18881. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18882. #endif
  18883. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18884. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18885. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18886. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18887. class JUCE_API LowLevelGraphicsContext
  18888. {
  18889. protected:
  18890. LowLevelGraphicsContext();
  18891. public:
  18892. virtual ~LowLevelGraphicsContext();
  18893. virtual bool isVectorDevice() const = 0;
  18894. virtual void setOrigin (int x, int y) = 0;
  18895. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18896. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18897. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18898. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18899. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18900. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18901. virtual const Rectangle<int> getClipBounds() const = 0;
  18902. virtual bool isClipEmpty() const = 0;
  18903. virtual void saveState() = 0;
  18904. virtual void restoreState() = 0;
  18905. virtual void setFill (const FillType& fillType) = 0;
  18906. virtual void setOpacity (float newOpacity) = 0;
  18907. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18908. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  18909. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18910. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18911. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  18912. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18913. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  18914. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  18915. virtual void setFont (const Font& newFont) = 0;
  18916. virtual const Font getFont() = 0;
  18917. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18918. };
  18919. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18920. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18921. #endif
  18922. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18923. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18924. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18925. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18926. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18927. {
  18928. public:
  18929. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18930. const String& documentTitle,
  18931. int totalWidth,
  18932. int totalHeight);
  18933. ~LowLevelGraphicsPostScriptRenderer();
  18934. bool isVectorDevice() const;
  18935. void setOrigin (int x, int y);
  18936. bool clipToRectangle (const Rectangle<int>& r);
  18937. bool clipToRectangleList (const RectangleList& clipRegion);
  18938. void excludeClipRectangle (const Rectangle<int>& r);
  18939. void clipToPath (const Path& path, const AffineTransform& transform);
  18940. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18941. void saveState();
  18942. void restoreState();
  18943. bool clipRegionIntersects (const Rectangle<int>& r);
  18944. const Rectangle<int> getClipBounds() const;
  18945. bool isClipEmpty() const;
  18946. void setFill (const FillType& fillType);
  18947. void setOpacity (float opacity);
  18948. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18949. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  18950. void fillPath (const Path& path, const AffineTransform& transform);
  18951. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18952. const AffineTransform& transform, bool fillEntireClipAsTiles);
  18953. void drawLine (double x1, double y1, double x2, double y2);
  18954. void drawVerticalLine (int x, double top, double bottom);
  18955. void drawHorizontalLine (int x, double top, double bottom);
  18956. const Font getFont();
  18957. void setFont (const Font& newFont);
  18958. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18959. juce_UseDebuggingNewOperator
  18960. protected:
  18961. OutputStream& out;
  18962. int totalWidth, totalHeight;
  18963. bool needToClip;
  18964. Colour lastColour;
  18965. struct SavedState
  18966. {
  18967. SavedState();
  18968. ~SavedState();
  18969. RectangleList clip;
  18970. int xOffset, yOffset;
  18971. FillType fillType;
  18972. Font font;
  18973. private:
  18974. SavedState& operator= (const SavedState&);
  18975. };
  18976. OwnedArray <SavedState> stateStack;
  18977. void writeClip();
  18978. void writeColour (const Colour& colour);
  18979. void writePath (const Path& path) const;
  18980. void writeXY (float x, float y) const;
  18981. void writeTransform (const AffineTransform& trans) const;
  18982. void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
  18983. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18984. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18985. };
  18986. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18987. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18988. #endif
  18989. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18990. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18991. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18992. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18993. class LLGCSavedState;
  18994. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18995. {
  18996. public:
  18997. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18998. ~LowLevelGraphicsSoftwareRenderer();
  18999. bool isVectorDevice() const;
  19000. void setOrigin (int x, int y);
  19001. bool clipToRectangle (const Rectangle<int>& r);
  19002. bool clipToRectangleList (const RectangleList& clipRegion);
  19003. void excludeClipRectangle (const Rectangle<int>& r);
  19004. void clipToPath (const Path& path, const AffineTransform& transform);
  19005. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19006. bool clipRegionIntersects (const Rectangle<int>& r);
  19007. const Rectangle<int> getClipBounds() const;
  19008. bool isClipEmpty() const;
  19009. void saveState();
  19010. void restoreState();
  19011. void setFill (const FillType& fillType);
  19012. void setOpacity (float opacity);
  19013. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19014. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19015. void fillPath (const Path& path, const AffineTransform& transform);
  19016. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19017. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19018. void drawLine (double x1, double y1, double x2, double y2);
  19019. void drawVerticalLine (int x, double top, double bottom);
  19020. void drawHorizontalLine (int x, double top, double bottom);
  19021. void setFont (const Font& newFont);
  19022. const Font getFont();
  19023. void drawGlyph (int glyphNumber, float x, float y);
  19024. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19025. juce_UseDebuggingNewOperator
  19026. protected:
  19027. Image& image;
  19028. ScopedPointer <LLGCSavedState> currentState;
  19029. OwnedArray <LLGCSavedState> stateStack;
  19030. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19031. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19032. };
  19033. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19034. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19035. #endif
  19036. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19037. #endif
  19038. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19039. #endif
  19040. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19041. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19042. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19043. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19044. class JUCE_API DrawableComposite : public Drawable
  19045. {
  19046. public:
  19047. DrawableComposite();
  19048. virtual ~DrawableComposite();
  19049. void insertDrawable (Drawable* drawable,
  19050. const AffineTransform& transform = AffineTransform::identity,
  19051. int index = -1);
  19052. void insertDrawable (const Drawable& drawable,
  19053. const AffineTransform& transform = AffineTransform::identity,
  19054. int index = -1);
  19055. void removeDrawable (int index, bool deleteDrawable = true);
  19056. int getNumDrawables() const throw() { return drawables.size(); }
  19057. Drawable* getDrawable (int index) const throw() { return drawables [index]; }
  19058. const AffineTransform* getDrawableTransform (int index) const throw() { return transforms [index]; }
  19059. void bringToFront (int index);
  19060. void render (const Drawable::RenderingContext& context) const;
  19061. const Rectangle<float> getBounds() const;
  19062. bool hitTest (float x, float y) const;
  19063. Drawable* createCopy() const;
  19064. ValueTree createValueTree() const throw();
  19065. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19066. juce_UseDebuggingNewOperator
  19067. private:
  19068. OwnedArray <Drawable> drawables;
  19069. OwnedArray <AffineTransform> transforms;
  19070. DrawableComposite (const DrawableComposite&);
  19071. DrawableComposite& operator= (const DrawableComposite&);
  19072. };
  19073. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19074. /*** End of inlined file: juce_DrawableComposite.h ***/
  19075. #endif
  19076. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19077. /*** Start of inlined file: juce_DrawableImage.h ***/
  19078. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19079. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19080. class JUCE_API DrawableImage : public Drawable
  19081. {
  19082. public:
  19083. DrawableImage();
  19084. virtual ~DrawableImage();
  19085. void setImage (const Image& imageToCopy);
  19086. void setImage (Image* imageToUse,
  19087. bool releaseWhenNotNeeded);
  19088. Image* getImage() const throw() { return image; }
  19089. void clearImage();
  19090. void setOpacity (float newOpacity);
  19091. float getOpacity() const throw() { return opacity; }
  19092. void setOverlayColour (const Colour& newOverlayColour);
  19093. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19094. void render (const Drawable::RenderingContext& context) const;
  19095. const Rectangle<float> getBounds() const;
  19096. bool hitTest (float x, float y) const;
  19097. Drawable* createCopy() const;
  19098. ValueTree createValueTree() const throw();
  19099. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19100. juce_UseDebuggingNewOperator
  19101. private:
  19102. Image* image;
  19103. bool canDeleteImage;
  19104. float opacity;
  19105. Colour overlayColour;
  19106. DrawableImage (const DrawableImage&);
  19107. DrawableImage& operator= (const DrawableImage&);
  19108. };
  19109. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19110. /*** End of inlined file: juce_DrawableImage.h ***/
  19111. #endif
  19112. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19113. /*** Start of inlined file: juce_DrawablePath.h ***/
  19114. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19115. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19116. class JUCE_API DrawablePath : public Drawable
  19117. {
  19118. public:
  19119. DrawablePath();
  19120. virtual ~DrawablePath();
  19121. void setPath (const Path& newPath) throw();
  19122. const Path& getPath() const throw() { return path; }
  19123. void setFill (const FillType& newFill) throw();
  19124. const FillType& getFill() const throw() { return mainFill; }
  19125. void setStrokeFill (const FillType& newStrokeFill) throw();
  19126. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19127. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19128. void setStrokeThickness (float newThickness) throw();
  19129. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19130. void render (const Drawable::RenderingContext& context) const;
  19131. const Rectangle<float> getBounds() const;
  19132. bool hitTest (float x, float y) const;
  19133. Drawable* createCopy() const;
  19134. ValueTree createValueTree() const throw();
  19135. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19136. juce_UseDebuggingNewOperator
  19137. private:
  19138. Path path, stroke;
  19139. FillType mainFill, strokeFill;
  19140. PathStrokeType strokeType;
  19141. void updateOutline();
  19142. DrawablePath (const DrawablePath&);
  19143. DrawablePath& operator= (const DrawablePath&);
  19144. };
  19145. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19146. /*** End of inlined file: juce_DrawablePath.h ***/
  19147. #endif
  19148. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19149. /*** Start of inlined file: juce_DrawableText.h ***/
  19150. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19151. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19152. class JUCE_API DrawableText : public Drawable
  19153. {
  19154. public:
  19155. DrawableText();
  19156. virtual ~DrawableText();
  19157. void setText (const GlyphArrangement& newText);
  19158. void setText (const String& newText, const Font& fontToUse);
  19159. const GlyphArrangement& getText() const throw() { return text; }
  19160. void setColour (const Colour& newColour);
  19161. const Colour& getColour() const throw() { return colour; }
  19162. void render (const Drawable::RenderingContext& context) const;
  19163. const Rectangle<float> getBounds() const;
  19164. bool hitTest (float x, float y) const;
  19165. Drawable* createCopy() const;
  19166. ValueTree createValueTree() const throw();
  19167. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19168. juce_UseDebuggingNewOperator
  19169. private:
  19170. GlyphArrangement text;
  19171. Colour colour;
  19172. DrawableText (const DrawableText&);
  19173. DrawableText& operator= (const DrawableText&);
  19174. };
  19175. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19176. /*** End of inlined file: juce_DrawableText.h ***/
  19177. #endif
  19178. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19179. #endif
  19180. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19181. /*** Start of inlined file: juce_GlowEffect.h ***/
  19182. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19183. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19184. class JUCE_API GlowEffect : public ImageEffectFilter
  19185. {
  19186. public:
  19187. GlowEffect();
  19188. ~GlowEffect();
  19189. void setGlowProperties (const float newRadius,
  19190. const Colour& newColour);
  19191. void applyEffect (Image& sourceImage, Graphics& destContext);
  19192. juce_UseDebuggingNewOperator
  19193. private:
  19194. float radius;
  19195. Colour colour;
  19196. };
  19197. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19198. /*** End of inlined file: juce_GlowEffect.h ***/
  19199. #endif
  19200. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19201. #endif
  19202. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19203. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19204. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19205. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19206. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19207. {
  19208. public:
  19209. ReduceOpacityEffect (const float opacity = 1.0f);
  19210. ~ReduceOpacityEffect();
  19211. void setOpacity (const float newOpacity);
  19212. void applyEffect (Image& sourceImage, Graphics& destContext);
  19213. juce_UseDebuggingNewOperator
  19214. private:
  19215. float opacity;
  19216. };
  19217. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19218. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19219. #endif
  19220. #ifndef __JUCE_FONT_JUCEHEADER__
  19221. #endif
  19222. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19223. #endif
  19224. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19225. #endif
  19226. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19227. #endif
  19228. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19229. #endif
  19230. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19231. #endif
  19232. #ifndef __JUCE_LINE_JUCEHEADER__
  19233. #endif
  19234. #ifndef __JUCE_PATH_JUCEHEADER__
  19235. #endif
  19236. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19237. /*** Start of inlined file: juce_PathIterator.h ***/
  19238. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19239. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19240. class JUCE_API PathFlatteningIterator
  19241. {
  19242. public:
  19243. PathFlatteningIterator (const Path& path,
  19244. const AffineTransform& transform = AffineTransform::identity,
  19245. float tolerence = 6.0f);
  19246. ~PathFlatteningIterator();
  19247. bool next();
  19248. float x1;
  19249. float y1;
  19250. float x2;
  19251. float y2;
  19252. bool closesSubPath;
  19253. int subPathIndex;
  19254. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19255. && (index >= path.numElements
  19256. || points [index] == Path::moveMarker); }
  19257. juce_UseDebuggingNewOperator
  19258. private:
  19259. const Path& path;
  19260. const AffineTransform transform;
  19261. float* points;
  19262. float tolerence, subPathCloseX, subPathCloseY;
  19263. const bool isIdentityTransform;
  19264. HeapBlock <float> stackBase;
  19265. float* stackPos;
  19266. size_t index, stackSize;
  19267. PathFlatteningIterator (const PathFlatteningIterator&);
  19268. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19269. };
  19270. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19271. /*** End of inlined file: juce_PathIterator.h ***/
  19272. #endif
  19273. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19274. #endif
  19275. #ifndef __JUCE_POINT_JUCEHEADER__
  19276. #endif
  19277. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19278. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19279. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19280. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19281. class JUCE_API PositionedRectangle
  19282. {
  19283. public:
  19284. PositionedRectangle() throw();
  19285. PositionedRectangle (const String& stringVersion) throw();
  19286. PositionedRectangle (const PositionedRectangle& other) throw();
  19287. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19288. ~PositionedRectangle() throw();
  19289. const String toString() const throw();
  19290. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19291. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19292. double& x,
  19293. double& y,
  19294. double& width,
  19295. double& height) const throw();
  19296. void applyToComponent (Component& comp) const throw();
  19297. void updateFrom (const Rectangle<int>& newPosition,
  19298. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19299. void updateFromDouble (double x, double y, double width, double height,
  19300. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19301. void updateFromComponent (const Component& comp) throw();
  19302. enum AnchorPoint
  19303. {
  19304. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19305. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19306. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19307. };
  19308. enum PositionMode
  19309. {
  19310. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19311. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19312. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19313. 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. */
  19314. };
  19315. enum SizeMode
  19316. {
  19317. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19318. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19319. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19320. };
  19321. void setModes (const AnchorPoint xAnchorMode,
  19322. const PositionMode xPositionMode,
  19323. const AnchorPoint yAnchorMode,
  19324. const PositionMode yPositionMode,
  19325. const SizeMode widthMode,
  19326. const SizeMode heightMode,
  19327. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19328. AnchorPoint getAnchorPointX() const throw();
  19329. PositionMode getPositionModeX() const throw();
  19330. double getX() const throw() { return x; }
  19331. void setX (const double newX) throw() { x = newX; }
  19332. AnchorPoint getAnchorPointY() const throw();
  19333. PositionMode getPositionModeY() const throw();
  19334. double getY() const throw() { return y; }
  19335. void setY (const double newY) throw() { y = newY; }
  19336. SizeMode getWidthMode() const throw();
  19337. double getWidth() const throw() { return w; }
  19338. void setWidth (const double newWidth) throw() { w = newWidth; }
  19339. SizeMode getHeightMode() const throw();
  19340. double getHeight() const throw() { return h; }
  19341. void setHeight (const double newHeight) throw() { h = newHeight; }
  19342. bool isPositionAbsolute() const throw();
  19343. bool operator== (const PositionedRectangle& other) const throw();
  19344. bool operator!= (const PositionedRectangle& other) const throw();
  19345. juce_UseDebuggingNewOperator
  19346. private:
  19347. double x, y, w, h;
  19348. uint8 xMode, yMode, wMode, hMode;
  19349. void addPosDescription (String& result, uint8 mode, double value) const throw();
  19350. void addSizeDescription (String& result, uint8 mode, double value) const throw();
  19351. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19352. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19353. void applyPosAndSize (double& xOut, double& wOut, double x, double w,
  19354. uint8 xMode, uint8 wMode,
  19355. int parentPos, int parentSize) const throw();
  19356. void updatePosAndSize (double& xOut, double& wOut, double x, double w,
  19357. uint8 xMode, uint8 wMode,
  19358. int parentPos, int parentSize) const throw();
  19359. };
  19360. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19361. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19362. #endif
  19363. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19364. #endif
  19365. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19366. #endif
  19367. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19368. /*** Start of inlined file: juce_CameraDevice.h ***/
  19369. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19370. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19371. #if JUCE_USE_CAMERA
  19372. class CameraImageListener
  19373. {
  19374. public:
  19375. CameraImageListener() {}
  19376. virtual ~CameraImageListener() {}
  19377. virtual void imageReceived (Image& image) = 0;
  19378. };
  19379. class JUCE_API CameraDevice
  19380. {
  19381. public:
  19382. virtual ~CameraDevice();
  19383. static const StringArray getAvailableDevices();
  19384. static CameraDevice* openDevice (int deviceIndex,
  19385. int minWidth = 128, int minHeight = 64,
  19386. int maxWidth = 1024, int maxHeight = 768);
  19387. const String getName() const { return name; }
  19388. Component* createViewerComponent();
  19389. void startRecordingToFile (const File& file, int quality = 2);
  19390. void stopRecording();
  19391. static const String getFileExtension();
  19392. const Time getTimeOfFirstRecordedFrame() const;
  19393. void addListener (CameraImageListener* listenerToAdd);
  19394. void removeListener (CameraImageListener* listenerToRemove);
  19395. juce_UseDebuggingNewOperator
  19396. protected:
  19397. CameraDevice (const String& name, int index);
  19398. private:
  19399. void* internal;
  19400. bool isRecording;
  19401. String name;
  19402. CameraDevice (const CameraDevice&);
  19403. CameraDevice& operator= (const CameraDevice&);
  19404. };
  19405. #endif
  19406. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19407. /*** End of inlined file: juce_CameraDevice.h ***/
  19408. #endif
  19409. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19410. #endif
  19411. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19412. /*** Start of inlined file: juce_ImageCache.h ***/
  19413. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19414. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19415. class JUCE_API ImageCache : private DeletedAtShutdown,
  19416. private Timer
  19417. {
  19418. public:
  19419. static Image* getFromFile (const File& file);
  19420. static Image* getFromMemory (const void* imageData, int dataSize);
  19421. static void release (Image* imageToRelease);
  19422. static void releaseOrDelete (Image* imageToRelease);
  19423. static bool isImageInCache (Image* imageToLookFor);
  19424. static void incReferenceCount (Image* image);
  19425. static Image* getFromHashCode (int64 hashCode);
  19426. static void addImageToCache (Image* image, int64 hashCode);
  19427. static void setCacheTimeout (int millisecs);
  19428. juce_UseDebuggingNewOperator
  19429. private:
  19430. CriticalSection lock;
  19431. struct Item;
  19432. friend class ScopedPointer<Item>;
  19433. friend class OwnedArray<Item>;
  19434. OwnedArray<Item> images;
  19435. static ImageCache* instance;
  19436. static int cacheTimeout;
  19437. ImageCache();
  19438. ImageCache (const ImageCache&);
  19439. ImageCache& operator= (const ImageCache&);
  19440. ~ImageCache();
  19441. void timerCallback();
  19442. };
  19443. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19444. /*** End of inlined file: juce_ImageCache.h ***/
  19445. #endif
  19446. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19447. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19448. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19449. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19450. class JUCE_API ImageConvolutionKernel
  19451. {
  19452. public:
  19453. ImageConvolutionKernel (const int size);
  19454. ~ImageConvolutionKernel();
  19455. void clear();
  19456. float getKernelValue (int x, int y) const throw();
  19457. void setKernelValue (int x, int y, float value) throw();
  19458. void setOverallSum (const float desiredTotalSum);
  19459. void rescaleAllValues (const float multiplier);
  19460. void createGaussianBlur (const float blurRadius);
  19461. int getKernelSize() const { return size; }
  19462. void applyToImage (Image& destImage,
  19463. const Image* sourceImage,
  19464. int x,
  19465. int y,
  19466. int width,
  19467. int height) const;
  19468. juce_UseDebuggingNewOperator
  19469. private:
  19470. HeapBlock <float> values;
  19471. const int size;
  19472. // no reason not to implement these one day..
  19473. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19474. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19475. };
  19476. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19477. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19478. #endif
  19479. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19480. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19481. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19482. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19483. class JUCE_API ImageFileFormat
  19484. {
  19485. protected:
  19486. ImageFileFormat() {}
  19487. public:
  19488. virtual ~ImageFileFormat() {}
  19489. virtual const String getFormatName() = 0;
  19490. virtual bool canUnderstand (InputStream& input) = 0;
  19491. virtual Image* decodeImage (InputStream& input) = 0;
  19492. virtual bool writeImageToStream (const Image& sourceImage,
  19493. OutputStream& destStream) = 0;
  19494. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19495. static Image* loadFrom (InputStream& input);
  19496. static Image* loadFrom (const File& file);
  19497. static Image* loadFrom (const void* rawData,
  19498. const int numBytesOfData);
  19499. };
  19500. class JUCE_API PNGImageFormat : public ImageFileFormat
  19501. {
  19502. public:
  19503. PNGImageFormat();
  19504. ~PNGImageFormat();
  19505. const String getFormatName();
  19506. bool canUnderstand (InputStream& input);
  19507. Image* decodeImage (InputStream& input);
  19508. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19509. };
  19510. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19511. {
  19512. public:
  19513. JPEGImageFormat();
  19514. ~JPEGImageFormat();
  19515. void setQuality (const float newQuality);
  19516. const String getFormatName();
  19517. bool canUnderstand (InputStream& input);
  19518. Image* decodeImage (InputStream& input);
  19519. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19520. private:
  19521. float quality;
  19522. };
  19523. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19524. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19525. #endif
  19526. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19527. #endif
  19528. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19529. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19530. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19531. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19532. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19533. {
  19534. public:
  19535. FileBasedDocument (const String& fileExtension,
  19536. const String& fileWildCard,
  19537. const String& openFileDialogTitle,
  19538. const String& saveFileDialogTitle);
  19539. virtual ~FileBasedDocument();
  19540. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19541. virtual void changed();
  19542. void setChangedFlag (bool hasChanged);
  19543. bool loadFrom (const File& fileToLoadFrom,
  19544. bool showMessageOnFailure);
  19545. bool loadFromUserSpecifiedFile (bool showMessageOnFailure);
  19546. enum SaveResult
  19547. {
  19548. savedOk = 0, /**< indicates that a file was saved successfully. */
  19549. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19550. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19551. };
  19552. SaveResult save (bool askUserForFileIfNotSpecified,
  19553. bool showMessageOnFailure);
  19554. SaveResult saveIfNeededAndUserAgrees();
  19555. SaveResult saveAs (const File& newFile,
  19556. bool warnAboutOverwritingExistingFiles,
  19557. bool askUserForFileIfNotSpecified,
  19558. bool showMessageOnFailure);
  19559. SaveResult saveAsInteractive (bool warnAboutOverwritingExistingFiles);
  19560. const File getFile() const { return documentFile; }
  19561. void setFile (const File& newFile);
  19562. protected:
  19563. virtual const String getDocumentTitle() = 0;
  19564. virtual const String loadDocument (const File& file) = 0;
  19565. virtual const String saveDocument (const File& file) = 0;
  19566. virtual const File getLastDocumentOpened() = 0;
  19567. virtual void setLastDocumentOpened (const File& file) = 0;
  19568. public:
  19569. juce_UseDebuggingNewOperator
  19570. private:
  19571. File documentFile;
  19572. bool changedSinceSave;
  19573. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19574. FileBasedDocument (const FileBasedDocument&);
  19575. FileBasedDocument& operator= (const FileBasedDocument&);
  19576. };
  19577. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19578. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19579. #endif
  19580. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19581. #endif
  19582. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19583. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19584. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19585. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19586. class JUCE_API RecentlyOpenedFilesList
  19587. {
  19588. public:
  19589. RecentlyOpenedFilesList();
  19590. ~RecentlyOpenedFilesList();
  19591. void setMaxNumberOfItems (int newMaxNumber);
  19592. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19593. int getNumFiles() const;
  19594. const File getFile (int index) const;
  19595. const StringArray& getAllFilenames() const throw() { return files; }
  19596. void clear();
  19597. void addFile (const File& file);
  19598. void removeNonExistentFiles();
  19599. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19600. int baseItemId,
  19601. bool showFullPaths,
  19602. bool dontAddNonExistentFiles,
  19603. const File** filesToAvoid = 0);
  19604. const String toString() const;
  19605. void restoreFromString (const String& stringifiedVersion);
  19606. juce_UseDebuggingNewOperator
  19607. private:
  19608. StringArray files;
  19609. int maxNumberOfItems;
  19610. };
  19611. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19612. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19613. #endif
  19614. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19615. #endif
  19616. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19617. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19618. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19619. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19620. class JUCE_API SystemClipboard
  19621. {
  19622. public:
  19623. static void copyTextToClipboard (const String& text);
  19624. static const String getTextFromClipboard();
  19625. };
  19626. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19627. /*** End of inlined file: juce_SystemClipboard.h ***/
  19628. #endif
  19629. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19630. #endif
  19631. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19632. #endif
  19633. #endif
  19634. /*** End of inlined file: juce_app_includes.h ***/
  19635. #endif
  19636. #if JUCE_MSVC
  19637. #pragma warning (pop)
  19638. #pragma pack (pop)
  19639. #endif
  19640. END_JUCE_NAMESPACE
  19641. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19642. #ifdef JUCE_NAMESPACE
  19643. // this will obviously save a lot of typing, but can be disabled by
  19644. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19645. using namespace JUCE_NAMESPACE;
  19646. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19647. #define Component JUCE_NAMESPACE::Component
  19648. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19649. #define Point JUCE_NAMESPACE::Point
  19650. #define Button JUCE_NAMESPACE::Button
  19651. #endif
  19652. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19653. #define Rectangle JUCE_NAMESPACE::Rectangle
  19654. #endif
  19655. #endif
  19656. #endif
  19657. #if JUCE_MSVC
  19658. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19659. #ifdef JUCE_DLL
  19660. #ifdef JUCE_DEBUG
  19661. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19662. #else
  19663. #define AUTOLINKEDLIB "JUCE.lib"
  19664. #endif
  19665. #else
  19666. #ifdef JUCE_DEBUG
  19667. #ifdef _WIN64
  19668. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19669. #else
  19670. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19671. #endif
  19672. #else
  19673. #ifdef _WIN64
  19674. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19675. #else
  19676. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19677. #endif
  19678. #endif
  19679. #endif
  19680. #pragma comment(lib, AUTOLINKEDLIB)
  19681. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19682. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19683. #endif
  19684. // Auto-link the other win32 libs that are needed by library calls..
  19685. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19686. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19687. // Auto-links to various win32 libs that are needed by library calls..
  19688. #pragma comment(lib, "kernel32.lib")
  19689. #pragma comment(lib, "user32.lib")
  19690. #pragma comment(lib, "shell32.lib")
  19691. #pragma comment(lib, "gdi32.lib")
  19692. #pragma comment(lib, "vfw32.lib")
  19693. #pragma comment(lib, "comdlg32.lib")
  19694. #pragma comment(lib, "winmm.lib")
  19695. #pragma comment(lib, "wininet.lib")
  19696. #pragma comment(lib, "ole32.lib")
  19697. #pragma comment(lib, "oleaut32.lib")
  19698. #pragma comment(lib, "advapi32.lib")
  19699. #pragma comment(lib, "ws2_32.lib")
  19700. #pragma comment(lib, "comsupp.lib")
  19701. #pragma comment(lib, "version.lib")
  19702. #if JUCE_OPENGL
  19703. #pragma comment(lib, "OpenGL32.Lib")
  19704. #pragma comment(lib, "GlU32.Lib")
  19705. #endif
  19706. #if JUCE_QUICKTIME
  19707. #pragma comment (lib, "QTMLClient.lib")
  19708. #endif
  19709. #if JUCE_USE_CAMERA
  19710. #pragma comment (lib, "Strmiids.lib")
  19711. #pragma comment (lib, "wmvcore.lib")
  19712. #endif
  19713. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19714. #endif
  19715. #endif
  19716. #endif
  19717. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19718. #define START_JUCE_APPLICATION(AppClass) \
  19719. int main (int argc, char* argv[]) \
  19720. { \
  19721. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19722. }
  19723. #elif JUCE_WINDOWS
  19724. #ifdef _CONSOLE
  19725. #define START_JUCE_APPLICATION(AppClass) \
  19726. int main (int, char* argv[]) \
  19727. { \
  19728. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19729. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19730. }
  19731. #elif ! defined (_AFXDLL)
  19732. #ifdef _WINDOWS_
  19733. #define START_JUCE_APPLICATION(AppClass) \
  19734. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19735. { \
  19736. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19737. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19738. }
  19739. #else
  19740. #define START_JUCE_APPLICATION(AppClass) \
  19741. int __stdcall WinMain (int, int, const char*, int) \
  19742. { \
  19743. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19744. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19745. }
  19746. #endif
  19747. #endif
  19748. #endif
  19749. #endif // __JUCE_JUCEHEADER__
  19750. /*** End of inlined file: juce.h ***/
  19751. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__