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.

29191 lines
750KB

  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 52
  31. #define JUCE_BUILDNUMBER 1
  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. #else
  80. #define JUCE_INTEL 1
  81. #endif
  82. #ifdef __LP64__
  83. #define JUCE_64BIT 1
  84. #else
  85. #define JUCE_32BIT 1
  86. #endif
  87. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  88. #error "Building for OSX 10.3 is no longer supported!"
  89. #endif
  90. #ifndef MAC_OS_X_VERSION_10_5
  91. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  92. #endif
  93. #endif
  94. #if JUCE_IPHONE
  95. #ifndef NDEBUG
  96. #define JUCE_DEBUG 1
  97. #endif
  98. #ifdef __LITTLE_ENDIAN__
  99. #define JUCE_LITTLE_ENDIAN 1
  100. #else
  101. #define JUCE_BIG_ENDIAN 1
  102. #endif
  103. #endif
  104. #if JUCE_LINUX
  105. #ifdef _DEBUG
  106. #define JUCE_DEBUG 1
  107. #endif
  108. // Allow override for big-endian Linux platforms
  109. #ifndef JUCE_BIG_ENDIAN
  110. #define JUCE_LITTLE_ENDIAN 1
  111. #endif
  112. #if defined (__LP64__) || defined (_LP64)
  113. #define JUCE_64BIT 1
  114. #else
  115. #define JUCE_32BIT 1
  116. #endif
  117. #define JUCE_INTEL 1
  118. #endif
  119. // Compiler type macros.
  120. #ifdef __GNUC__
  121. #define JUCE_GCC 1
  122. #elif defined (_MSC_VER)
  123. #define JUCE_MSVC 1
  124. #if _MSC_VER >= 1400
  125. #define JUCE_USE_INTRINSICS 1
  126. #endif
  127. #else
  128. #error unknown compiler
  129. #endif
  130. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  131. /*** End of inlined file: juce_TargetPlatform.h ***/
  132. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  133. /*** Start of inlined file: juce_Config.h ***/
  134. #ifndef __JUCE_CONFIG_JUCEHEADER__
  135. #define __JUCE_CONFIG_JUCEHEADER__
  136. #ifndef JUCE_NAMESPACE
  137. #define JUCE_NAMESPACE juce
  138. #endif
  139. #ifndef JUCE_FORCE_DEBUG
  140. //#define JUCE_FORCE_DEBUG 0
  141. #endif
  142. #ifndef JUCE_LOG_ASSERTIONS
  143. #define JUCE_LOG_ASSERTIONS 0
  144. #endif
  145. #ifndef JUCE_ASIO
  146. #define JUCE_ASIO 0
  147. #endif
  148. #ifndef JUCE_WASAPI
  149. #define JUCE_WASAPI 0
  150. #endif
  151. #ifndef JUCE_DIRECTSOUND
  152. #define JUCE_DIRECTSOUND 1
  153. #endif
  154. #ifndef JUCE_ALSA
  155. #define JUCE_ALSA 1
  156. #endif
  157. #ifndef JUCE_JACK
  158. #define JUCE_JACK 0
  159. #endif
  160. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  161. #define JUCE_QUICKTIME 0
  162. #endif
  163. #if (JUCE_IPHONE || JUCE_LINUX) && JUCE_QUICKTIME
  164. #undef JUCE_QUICKTIME
  165. #endif
  166. #ifndef JUCE_OPENGL
  167. #define JUCE_OPENGL 1
  168. #endif
  169. #ifndef JUCE_USE_FLAC
  170. #define JUCE_USE_FLAC 1
  171. #endif
  172. #ifndef JUCE_USE_OGGVORBIS
  173. #define JUCE_USE_OGGVORBIS 1
  174. #endif
  175. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  176. #define JUCE_USE_CDBURNER 0
  177. #endif
  178. #ifndef JUCE_USE_CDREADER
  179. #define JUCE_USE_CDREADER 0
  180. #endif
  181. #if (JUCE_QUICKTIME || JUCE_WINDOWS) && ! defined (JUCE_USE_CAMERA)
  182. #define JUCE_USE_CAMERA 0
  183. #endif
  184. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  185. #define JUCE_ENABLE_REPAINT_DEBUGGING 0
  186. #endif
  187. #ifndef JUCE_USE_XINERAMA
  188. #define JUCE_USE_XINERAMA 1
  189. #endif
  190. #ifndef JUCE_USE_XSHM
  191. #define JUCE_USE_XSHM 1
  192. #endif
  193. #ifndef JUCE_USE_XRENDER
  194. #define JUCE_USE_XRENDER 0
  195. #endif
  196. #ifndef JUCE_USE_XCURSOR
  197. #define JUCE_USE_XCURSOR 1
  198. #endif
  199. #ifndef JUCE_PLUGINHOST_VST
  200. #define JUCE_PLUGINHOST_VST 0
  201. #endif
  202. #ifndef JUCE_PLUGINHOST_AU
  203. #define JUCE_PLUGINHOST_AU 0
  204. #endif
  205. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  206. #define JUCE_ONLY_BUILD_CORE_LIBRARY 0
  207. #endif
  208. #ifndef JUCE_WEB_BROWSER
  209. #define JUCE_WEB_BROWSER 1
  210. #endif
  211. #ifndef JUCE_SUPPORT_CARBON
  212. #define JUCE_SUPPORT_CARBON 1
  213. #endif
  214. #ifndef JUCE_INCLUDE_ZLIB_CODE
  215. #define JUCE_INCLUDE_ZLIB_CODE 1
  216. #endif
  217. #ifndef JUCE_INCLUDE_FLAC_CODE
  218. #define JUCE_INCLUDE_FLAC_CODE 1
  219. #endif
  220. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  221. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  222. #endif
  223. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  224. #define JUCE_INCLUDE_PNGLIB_CODE 1
  225. #endif
  226. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  227. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  228. #endif
  229. #ifndef JUCE_CHECK_MEMORY_LEAKS
  230. #define JUCE_CHECK_MEMORY_LEAKS 1
  231. #endif
  232. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  233. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  234. #endif
  235. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  236. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  237. #undef JUCE_QUICKTIME
  238. #define JUCE_QUICKTIME 0
  239. #undef JUCE_OPENGL
  240. #define JUCE_OPENGL 0
  241. #undef JUCE_USE_CDBURNER
  242. #define JUCE_USE_CDBURNER 0
  243. #undef JUCE_USE_CDREADER
  244. #define JUCE_USE_CDREADER 0
  245. #undef JUCE_WEB_BROWSER
  246. #define JUCE_WEB_BROWSER 0
  247. #undef JUCE_PLUGINHOST_AU
  248. #define JUCE_PLUGINHOST_AU 0
  249. #undef JUCE_PLUGINHOST_VST
  250. #define JUCE_PLUGINHOST_VST 0
  251. #endif
  252. #endif
  253. /*** End of inlined file: juce_Config.h ***/
  254. #ifdef JUCE_NAMESPACE
  255. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  256. #define END_JUCE_NAMESPACE }
  257. #else
  258. #define BEGIN_JUCE_NAMESPACE
  259. #define END_JUCE_NAMESPACE
  260. #endif
  261. /*** Start of inlined file: juce_PlatformDefs.h ***/
  262. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  263. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  264. #ifdef JUCE_FORCE_DEBUG
  265. #undef JUCE_DEBUG
  266. #if JUCE_FORCE_DEBUG
  267. #define JUCE_DEBUG 1
  268. #endif
  269. #endif
  270. #if JUCE_MSVC
  271. #define JUCE_CALLTYPE __stdcall
  272. #else
  273. #define JUCE_CALLTYPE
  274. #endif
  275. // Debugging and assertion macros
  276. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  277. #if JUCE_LOG_ASSERTIONS
  278. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  279. #elif JUCE_DEBUG
  280. #define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
  281. #else
  282. #define juce_LogCurrentAssertion
  283. #endif
  284. #if JUCE_DEBUG
  285. // If debugging is enabled..
  286. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  287. // Assertions..
  288. #if JUCE_WINDOWS || DOXYGEN
  289. #if JUCE_USE_INTRINSICS
  290. #pragma intrinsic (__debugbreak)
  291. #define juce_breakDebugger __debugbreak();
  292. #elif JUCE_GCC
  293. #define juce_breakDebugger asm("int $3");
  294. #else
  295. #define juce_breakDebugger { __asm int 3 }
  296. #endif
  297. #elif JUCE_MAC
  298. #define juce_breakDebugger Debugger();
  299. #elif JUCE_IPHONE
  300. #define juce_breakDebugger kill (0, SIGTRAP);
  301. #elif JUCE_LINUX
  302. #define juce_breakDebugger kill (0, SIGTRAP);
  303. #endif
  304. /** This will always cause an assertion failure.
  305. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  306. in juce_Config.h).
  307. @see jassert()
  308. */
  309. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  310. /** Platform-independent assertion macro.
  311. This gets optimised out when not being built with debugging turned on.
  312. Be careful not to call any functions within its arguments that are vital to
  313. the behaviour of the program, because these won't get called in the release
  314. build.
  315. @see jassertfalse
  316. */
  317. #define jassert(expression) { if (! (expression)) jassertfalse }
  318. #else
  319. // If debugging is disabled, these dummy debug and assertion macros are used..
  320. #define DBG(dbgtext)
  321. #define jassertfalse { juce_LogCurrentAssertion }
  322. #if JUCE_LOG_ASSERTIONS
  323. #define jassert(expression) { if (! (expression)) jassertfalse }
  324. #else
  325. #define jassert(a) { }
  326. #endif
  327. #endif
  328. #ifndef DOXYGEN
  329. template <bool b> struct JuceStaticAssert;
  330. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  331. #endif
  332. /** A compile-time assertion macro.
  333. If the expression parameter is false, the macro will cause a compile error.
  334. */
  335. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  336. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  337. #define JUCE_TRY try
  338. #define JUCE_CATCH_EXCEPTION \
  339. catch (const std::exception& e) \
  340. { \
  341. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  342. } \
  343. catch (...) \
  344. { \
  345. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  346. }
  347. #define JUCE_CATCH_ALL catch (...) {}
  348. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  349. #else
  350. #define JUCE_TRY
  351. #define JUCE_CATCH_EXCEPTION
  352. #define JUCE_CATCH_ALL
  353. #define JUCE_CATCH_ALL_ASSERT
  354. #endif
  355. // Macros for inlining.
  356. #if JUCE_MSVC
  357. #ifndef JUCE_DEBUG
  358. #define forcedinline __forceinline
  359. #else
  360. #define forcedinline inline
  361. #endif
  362. #else
  363. #ifndef JUCE_DEBUG
  364. #define forcedinline inline __attribute__((always_inline))
  365. #else
  366. #define forcedinline inline
  367. #endif
  368. #endif
  369. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  370. /*** End of inlined file: juce_PlatformDefs.h ***/
  371. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  372. #if JUCE_MSVC
  373. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  374. #pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
  375. #endif
  376. #pragma warning (push)
  377. #pragma warning (disable: 4514 4245 4100)
  378. #endif
  379. #include <cstdlib>
  380. #include <cstdarg>
  381. #include <climits>
  382. #include <limits>
  383. #include <cmath>
  384. #include <cwchar>
  385. #include <stdexcept>
  386. #include <typeinfo>
  387. #include <cstring>
  388. #include <cstdio>
  389. #include <iostream>
  390. #if JUCE_USE_INTRINSICS
  391. #include <intrin.h>
  392. #endif
  393. #if JUCE_MAC || JUCE_IPHONE
  394. #include <libkern/OSAtomic.h>
  395. #endif
  396. #if JUCE_LINUX
  397. #include <signal.h>
  398. #if __INTEL_COMPILER
  399. #if __ia64__
  400. #include <ia64intrin.h>
  401. #else
  402. #include <ia32intrin.h>
  403. #endif
  404. #endif
  405. #endif
  406. #if JUCE_MSVC && JUCE_DEBUG
  407. #include <crtdbg.h>
  408. #endif
  409. #if JUCE_MSVC
  410. #include <malloc.h>
  411. #pragma warning (pop)
  412. #if ! JUCE_PUBLIC_INCLUDES
  413. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  414. #endif
  415. #endif
  416. // DLL building settings on Win32
  417. #if JUCE_MSVC
  418. #ifdef JUCE_DLL_BUILD
  419. #define JUCE_API __declspec (dllexport)
  420. #pragma warning (disable: 4251)
  421. #elif defined (JUCE_DLL)
  422. #define JUCE_API __declspec (dllimport)
  423. #pragma warning (disable: 4251)
  424. #endif
  425. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  426. #ifdef JUCE_DLL_BUILD
  427. #define JUCE_API __attribute__ ((visibility("default")))
  428. #endif
  429. #endif
  430. #ifndef JUCE_API
  431. #define JUCE_API
  432. #endif
  433. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  434. // Now include some basics that are needed by most of the Juce classes...
  435. BEGIN_JUCE_NAMESPACE
  436. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  437. #if JUCE_LOG_ASSERTIONS
  438. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  439. #endif
  440. /*** Start of inlined file: juce_Memory.h ***/
  441. #ifndef __JUCE_MEMORY_JUCEHEADER__
  442. #define __JUCE_MEMORY_JUCEHEADER__
  443. #if JUCE_DEBUG && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  444. #ifndef JUCE_DLL
  445. // Win32 debug non-DLL versions..
  446. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  447. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  448. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  449. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  450. #else
  451. // Win32 debug DLL versions..
  452. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  453. // way all juce calls in the DLL and in the host API will all use the same allocator.
  454. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  455. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  456. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  457. extern JUCE_API void juce_DebugFree (void* const block);
  458. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  459. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  460. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  461. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  462. #endif
  463. #if ! defined (_AFXDLL)
  464. #define juce_UseDebuggingNewOperator \
  465. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  466. static void* operator new (size_t, void* p) { return p; } \
  467. static void operator delete (void* p) { juce_free (p); } \
  468. static void operator delete (void*, void*) { }
  469. #endif
  470. #elif defined (JUCE_DLL)
  471. // Win32 DLL (release) versions..
  472. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  473. // way all juce calls in the DLL and in the host API will all use the same allocator.
  474. extern JUCE_API void* juce_Malloc (const int size);
  475. extern JUCE_API void* juce_Calloc (const int size);
  476. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  477. extern JUCE_API void juce_Free (void* const block);
  478. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  479. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  480. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  481. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  482. #define juce_UseDebuggingNewOperator \
  483. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  484. static void* operator new (size_t, void* p) { return p; } \
  485. static void operator delete (void* p) { juce_free (p); } \
  486. static void operator delete (void*, void*) { }
  487. #else
  488. // Mac, Linux and Win32 (release) versions..
  489. #define juce_malloc(numBytes) malloc (numBytes)
  490. #define juce_calloc(numBytes) calloc (1, numBytes)
  491. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  492. #define juce_free(location) free (location)
  493. #endif
  494. #ifndef juce_UseDebuggingNewOperator
  495. #define juce_UseDebuggingNewOperator
  496. #endif
  497. #if JUCE_MSVC
  498. #define juce_ThreadLocal __declspec(thread)
  499. #else
  500. #define juce_ThreadLocal __thread
  501. #endif
  502. #if JUCE_MINGW
  503. #define alloca __builtin_alloca
  504. #endif
  505. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  506. template <typename Type>
  507. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  508. template <typename Type>
  509. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  510. #endif // __JUCE_MEMORY_JUCEHEADER__
  511. /*** End of inlined file: juce_Memory.h ***/
  512. /*** Start of inlined file: juce_MathsFunctions.h ***/
  513. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  514. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  515. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  516. typedef signed char int8;
  517. typedef unsigned char uint8;
  518. typedef signed short int16;
  519. typedef unsigned short uint16;
  520. typedef signed int int32;
  521. typedef unsigned int uint32;
  522. #if JUCE_MSVC
  523. typedef __int64 int64;
  524. typedef unsigned __int64 uint64;
  525. #define literal64bit(longLiteral) ((__int64) longLiteral)
  526. #else
  527. typedef long long int64;
  528. typedef unsigned long long uint64;
  529. #define literal64bit(longLiteral) (longLiteral##LL)
  530. #endif
  531. #if JUCE_64BIT
  532. typedef int64 pointer_sized_int;
  533. typedef uint64 pointer_sized_uint;
  534. #elif _MSC_VER >= 1300
  535. typedef _W64 int pointer_sized_int;
  536. typedef _W64 unsigned int pointer_sized_uint;
  537. #else
  538. typedef int pointer_sized_int;
  539. typedef unsigned int pointer_sized_uint;
  540. #endif
  541. typedef wchar_t juce_wchar;
  542. // Some indispensible min/max functions
  543. template <typename Type>
  544. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  545. template <typename Type>
  546. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  547. template <typename Type>
  548. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  549. template <typename Type>
  550. inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
  551. template <typename Type>
  552. inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
  553. template <typename Type>
  554. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  555. template <typename Type>
  556. inline Type jlimit (const Type lowerLimit,
  557. const Type upperLimit,
  558. const Type valueToConstrain) throw()
  559. {
  560. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  561. return (valueToConstrain < lowerLimit) ? lowerLimit
  562. : ((upperLimit < valueToConstrain) ? upperLimit
  563. : valueToConstrain);
  564. }
  565. template <typename Type>
  566. inline void swapVariables (Type& variable1, Type& variable2)
  567. {
  568. const Type tempVal = variable1;
  569. variable1 = variable2;
  570. variable2 = tempVal;
  571. }
  572. template <typename Type>
  573. inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
  574. // Some useful maths functions that aren't always present with all compilers and build settings.
  575. inline double juce_hypot (double a, double b)
  576. {
  577. #if JUCE_WINDOWS
  578. return _hypot (a, b);
  579. #else
  580. return hypot (a, b);
  581. #endif
  582. }
  583. inline float juce_hypotf (float a, float b)
  584. {
  585. #if JUCE_WINDOWS
  586. return (float) _hypot (a, b);
  587. #else
  588. return hypotf (a, b);
  589. #endif
  590. }
  591. inline int64 abs64 (const int64 n)
  592. {
  593. return (n >= 0) ? n : -n;
  594. }
  595. const double double_Pi = 3.1415926535897932384626433832795;
  596. const float float_Pi = 3.14159265358979323846f;
  597. template <typename FloatingPointType>
  598. inline bool juce_isfinite (FloatingPointType value)
  599. {
  600. #if JUCE_WINDOWS
  601. return _finite (value);
  602. #else
  603. return std::isfinite (value);
  604. #endif
  605. }
  606. template <typename FloatType>
  607. inline int roundToInt (const FloatType value) throw()
  608. {
  609. union { int asInt[2]; double asDouble; } n;
  610. n.asDouble = ((double) value) + 6755399441055744.0;
  611. #if JUCE_BIG_ENDIAN
  612. return n.asInt [1];
  613. #else
  614. return n.asInt [0];
  615. #endif
  616. }
  617. inline int roundToIntAccurate (const double value) throw()
  618. {
  619. return roundToInt (value + 1.5e-8);
  620. }
  621. inline int roundDoubleToInt (const double value) throw()
  622. {
  623. return roundToInt (value);
  624. }
  625. inline int roundFloatToInt (const float value) throw()
  626. {
  627. return roundToInt (value);
  628. }
  629. namespace TypeHelpers
  630. {
  631. #if defined (_MSC_VER) && _MSC_VER <= 1400
  632. #define PARAMETER_TYPE(a) a
  633. #else
  634. template <typename Type> struct ParameterType { typedef const Type& type; };
  635. template <typename Type> struct ParameterType <Type&> { typedef Type& type; };
  636. template <typename Type> struct ParameterType <Type*> { typedef Type* type; };
  637. template <> struct ParameterType <char> { typedef char type; };
  638. template <> struct ParameterType <unsigned char> { typedef unsigned char type; };
  639. template <> struct ParameterType <short> { typedef short type; };
  640. template <> struct ParameterType <unsigned short> { typedef unsigned short type; };
  641. template <> struct ParameterType <int> { typedef int type; };
  642. template <> struct ParameterType <unsigned int> { typedef unsigned int type; };
  643. template <> struct ParameterType <long> { typedef long type; };
  644. template <> struct ParameterType <unsigned long> { typedef unsigned long type; };
  645. template <> struct ParameterType <int64> { typedef int64 type; };
  646. template <> struct ParameterType <uint64> { typedef uint64 type; };
  647. template <> struct ParameterType <bool> { typedef bool type; };
  648. template <> struct ParameterType <float> { typedef float type; };
  649. template <> struct ParameterType <double> { typedef double type; };
  650. #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type
  651. #endif
  652. }
  653. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  654. /*** End of inlined file: juce_MathsFunctions.h ***/
  655. /*** Start of inlined file: juce_ByteOrder.h ***/
  656. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  657. #define __JUCE_BYTEORDER_JUCEHEADER__
  658. class JUCE_API ByteOrder
  659. {
  660. public:
  661. static uint16 swap (uint16 value);
  662. static uint32 swap (uint32 value);
  663. static uint64 swap (uint64 value);
  664. static uint16 swapIfBigEndian (uint16 value);
  665. static uint32 swapIfBigEndian (uint32 value);
  666. static uint64 swapIfBigEndian (uint64 value);
  667. static uint16 swapIfLittleEndian (uint16 value);
  668. static uint32 swapIfLittleEndian (uint32 value);
  669. static uint64 swapIfLittleEndian (uint64 value);
  670. static uint32 littleEndianInt (const void* bytes);
  671. static uint16 littleEndianShort (const void* bytes);
  672. static uint32 bigEndianInt (const void* bytes);
  673. static uint16 bigEndianShort (const void* bytes);
  674. static int littleEndian24Bit (const char* bytes);
  675. static int bigEndian24Bit (const char* bytes);
  676. static void littleEndian24BitToChars (int value, char* destBytes);
  677. static void bigEndian24BitToChars (int value, char* destBytes);
  678. static bool isBigEndian();
  679. private:
  680. ByteOrder();
  681. ByteOrder (const ByteOrder&);
  682. ByteOrder& operator= (const ByteOrder&);
  683. };
  684. #if JUCE_USE_INTRINSICS
  685. #pragma intrinsic (_byteswap_ulong)
  686. #endif
  687. inline uint16 ByteOrder::swap (uint16 n)
  688. {
  689. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  690. return static_cast <uint16> (_byteswap_ushort (n));
  691. #else
  692. return static_cast <uint16> ((n << 8) | (n >> 8));
  693. #endif
  694. }
  695. inline uint32 ByteOrder::swap (uint32 n)
  696. {
  697. #if JUCE_MAC || JUCE_IPHONE
  698. return OSSwapInt32 (n);
  699. #elif JUCE_GCC
  700. asm("bswap %%eax" : "=a"(n) : "a"(n));
  701. return n;
  702. #elif JUCE_USE_INTRINSICS
  703. return _byteswap_ulong (n);
  704. #else
  705. __asm {
  706. mov eax, n
  707. bswap eax
  708. mov n, eax
  709. }
  710. return n;
  711. #endif
  712. }
  713. inline uint64 ByteOrder::swap (uint64 value)
  714. {
  715. #if JUCE_MAC || JUCE_IPHONE
  716. return OSSwapInt64 (value);
  717. #elif JUCE_USE_INTRINSICS
  718. return _byteswap_uint64 (value);
  719. #else
  720. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  721. #endif
  722. }
  723. #if JUCE_LITTLE_ENDIAN
  724. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  725. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  726. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  727. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  728. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  729. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  730. inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); }
  731. inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); }
  732. inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); }
  733. inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); }
  734. inline bool ByteOrder::isBigEndian() { return false; }
  735. #else
  736. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  737. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  738. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  739. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  740. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  741. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  742. inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); }
  743. inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); }
  744. inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); }
  745. inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); }
  746. inline bool ByteOrder::isBigEndian() { return true; }
  747. #endif
  748. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  749. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  750. 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); }
  751. 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); }
  752. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  753. /*** End of inlined file: juce_ByteOrder.h ***/
  754. /*** Start of inlined file: juce_Logger.h ***/
  755. #ifndef __JUCE_LOGGER_JUCEHEADER__
  756. #define __JUCE_LOGGER_JUCEHEADER__
  757. /*** Start of inlined file: juce_String.h ***/
  758. #ifndef __JUCE_STRING_JUCEHEADER__
  759. #define __JUCE_STRING_JUCEHEADER__
  760. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  761. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  762. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  763. #define JUCE_T(stringLiteral) (L##stringLiteral)
  764. typedef juce_wchar tchar;
  765. #if ! JUCE_DONT_DEFINE_MACROS
  766. #define T(stringLiteral) JUCE_T(stringLiteral)
  767. #endif
  768. class JUCE_API CharacterFunctions
  769. {
  770. public:
  771. static int length (const char* const s) throw();
  772. static int length (const juce_wchar* const s) throw();
  773. static void copy (char* dest, const char* src, const int maxBytes) throw();
  774. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  775. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  776. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  777. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  778. static void append (char* dest, const char* src) throw();
  779. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  780. static int compare (const char* const s1, const char* const s2) throw();
  781. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  782. static int compare (const juce_wchar* s1, const char* s2) throw();
  783. static int compare (const char* s1, const juce_wchar* s2) throw();
  784. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  785. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  786. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  787. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  788. static int compareIgnoreCase (const juce_wchar* s1, const char* s2) throw();
  789. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  790. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  791. static const char* find (const char* const haystack, const char* const needle) throw();
  792. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  793. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  794. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  795. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  796. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  797. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  798. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  799. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  800. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  801. static int getIntValue (const char* const s) throw();
  802. static int getIntValue (const juce_wchar* s) throw();
  803. static int64 getInt64Value (const char* s) throw();
  804. static int64 getInt64Value (const juce_wchar* s) throw();
  805. static double getDoubleValue (const char* const s) throw();
  806. static double getDoubleValue (const juce_wchar* const s) throw();
  807. static char toUpperCase (const char character) throw();
  808. static juce_wchar toUpperCase (const juce_wchar character) throw();
  809. static void toUpperCase (char* s) throw();
  810. static void toUpperCase (juce_wchar* s) throw();
  811. static bool isUpperCase (const char character) throw();
  812. static bool isUpperCase (const juce_wchar character) throw();
  813. static char toLowerCase (const char character) throw();
  814. static juce_wchar toLowerCase (const juce_wchar character) throw();
  815. static void toLowerCase (char* s) throw();
  816. static void toLowerCase (juce_wchar* s) throw();
  817. static bool isLowerCase (const char character) throw();
  818. static bool isLowerCase (const juce_wchar character) throw();
  819. static bool isWhitespace (const char character) throw();
  820. static bool isWhitespace (const juce_wchar character) throw();
  821. static bool isDigit (const char character) throw();
  822. static bool isDigit (const juce_wchar character) throw();
  823. static bool isLetter (const char character) throw();
  824. static bool isLetter (const juce_wchar character) throw();
  825. static bool isLetterOrDigit (const char character) throw();
  826. static bool isLetterOrDigit (const juce_wchar character) throw();
  827. static int getHexDigitValue (const juce_wchar digit) throw();
  828. };
  829. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  830. /*** End of inlined file: juce_CharacterFunctions.h ***/
  831. class OutputStream;
  832. class JUCE_API String
  833. {
  834. public:
  835. String() throw();
  836. String (const String& other) throw();
  837. String (const char* text);
  838. String (const char* text, size_t maxChars);
  839. String (const juce_wchar* unicodeText);
  840. String (const juce_wchar* unicodeText, size_t maxChars);
  841. static const String charToString (juce_wchar character);
  842. ~String() throw();
  843. //========================juce_wchar======================================================
  844. static const String empty;
  845. int hashCode() const throw();
  846. int64 hashCode64() const throw();
  847. int length() const throw();
  848. // Assignment and concatenation operators..
  849. String& operator= (const String& other) throw();
  850. String& operator+= (const juce_wchar* textToAppend);
  851. String& operator+= (const String& stringToAppend);
  852. String& operator+= (char characterToAppend);
  853. String& operator+= (juce_wchar characterToAppend);
  854. String& operator+= (int numberToAppend);
  855. String& operator+= (unsigned int numberToAppend);
  856. void append (const juce_wchar* textToAppend, int maxCharsToTake);
  857. // Comparison methods..
  858. inline bool isEmpty() const throw() { return text[0] == 0; }
  859. inline bool isNotEmpty() const throw() { return text[0] != 0; }
  860. bool equalsIgnoreCase (const String& other) const throw();
  861. bool equalsIgnoreCase (const juce_wchar* other) const throw();
  862. bool equalsIgnoreCase (const char* other) const throw();
  863. int compare (const String& other) const throw();
  864. int compare (const char* other) const throw();
  865. int compare (const juce_wchar* other) const throw();
  866. int compareIgnoreCase (const String& other) const throw();
  867. int compareLexicographically (const String& other) const throw();
  868. bool startsWith (const String& text) const throw();
  869. bool startsWithChar (juce_wchar character) const throw();
  870. bool startsWithIgnoreCase (const String& text) const throw();
  871. bool endsWith (const String& text) const throw();
  872. bool endsWithChar (juce_wchar character) const throw();
  873. bool endsWithIgnoreCase (const String& text) const throw();
  874. bool contains (const String& text) const throw();
  875. bool containsChar (juce_wchar character) const throw();
  876. bool containsIgnoreCase (const String& text) const throw();
  877. bool containsWholeWord (const String& wordToLookFor) const throw();
  878. bool containsWholeWordIgnoreCase (const String& wordToLookFor) const throw();
  879. int indexOfWholeWord (const String& wordToLookFor) const throw();
  880. int indexOfWholeWordIgnoreCase (const String& wordToLookFor) const throw();
  881. bool containsAnyOf (const String& charactersItMightContain) const throw();
  882. bool containsOnly (const String& charactersItMightContain) const throw();
  883. bool containsNonWhitespaceChars() const throw();
  884. bool matchesWildcard (const String& wildcard, bool ignoreCase) const throw();
  885. // Substring location methods..
  886. int indexOfChar (juce_wchar characterToLookFor) const throw();
  887. int indexOfChar (int startIndex, juce_wchar characterToLookFor) const throw();
  888. int indexOfAnyOf (const String& charactersToLookFor,
  889. int startIndex = 0,
  890. bool ignoreCase = false) const throw();
  891. int indexOf (const String& text) const throw();
  892. int indexOf (int startIndex,
  893. const String& textToLookFor) const throw();
  894. int indexOfIgnoreCase (const String& textToLookFor) const throw();
  895. int indexOfIgnoreCase (int startIndex,
  896. const String& textToLookFor) const throw();
  897. int lastIndexOfChar (juce_wchar character) const throw();
  898. int lastIndexOf (const String& textToLookFor) const throw();
  899. int lastIndexOfIgnoreCase (const String& textToLookFor) const throw();
  900. int lastIndexOfAnyOf (const String& charactersToLookFor,
  901. bool ignoreCase = false) const throw();
  902. // Substring extraction and manipulation methods..
  903. /** Returns the character at this index in the string.
  904. No checks are made to see if the index is within a valid range, so be careful!
  905. */
  906. inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; }
  907. juce_wchar& operator[] (int index);
  908. juce_wchar getLastCharacter() const throw();
  909. const String substring (int startIndex, int endIndex) const;
  910. const String substring (int startIndex) const;
  911. const String dropLastCharacters (int numberToDrop) const;
  912. const String getLastCharacters (int numCharacters) const;
  913. const String fromFirstOccurrenceOf (const String& substringToStartFrom,
  914. bool includeSubStringInResult,
  915. bool ignoreCase) const;
  916. const String fromLastOccurrenceOf (const String& substringToFind,
  917. bool includeSubStringInResult,
  918. bool ignoreCase) const;
  919. const String upToFirstOccurrenceOf (const String& substringToEndWith,
  920. bool includeSubStringInResult,
  921. bool ignoreCase) const;
  922. const String upToLastOccurrenceOf (const String& substringToFind,
  923. bool includeSubStringInResult,
  924. bool ignoreCase) const;
  925. const String trim() const;
  926. const String trimStart() const;
  927. const String trimEnd() const;
  928. const String trimCharactersAtStart (const String& charactersToTrim) const;
  929. const String trimCharactersAtEnd (const String& charactersToTrim) const;
  930. const String toUpperCase() const;
  931. const String toLowerCase() const;
  932. const String replaceSection (int startIndex,
  933. int numCharactersToReplace,
  934. const String& stringToInsert) const;
  935. const String replace (const String& stringToReplace,
  936. const String& stringToInsertInstead,
  937. bool ignoreCase = false) const;
  938. const String replaceCharacter (juce_wchar characterToReplace,
  939. juce_wchar characterToInsertInstead) const;
  940. const String replaceCharacters (const String& charactersToReplace,
  941. const String& charactersToInsertInstead) const;
  942. const String retainCharacters (const String& charactersToRetain) const;
  943. const String removeCharacters (const String& charactersToRemove) const;
  944. const String initialSectionContainingOnly (const String& permittedCharacters) const;
  945. const String initialSectionNotContaining (const String& charactersToStopAt) const;
  946. bool isQuotedString() const;
  947. const String unquoted() const;
  948. const String quoted (juce_wchar quoteCharacter = '"') const;
  949. static const String repeatedString (const String& stringToRepeat,
  950. int numberOfTimesToRepeat);
  951. const String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
  952. const String paddedRight (juce_wchar padCharacter, int minimumLength) const;
  953. static const String createStringFromData (const void* data, int size);
  954. static const String formatted (const juce_wchar* formatString, ... );
  955. // Numeric conversions..
  956. explicit String (int decimalInteger);
  957. explicit String (unsigned int decimalInteger);
  958. explicit String (short decimalInteger);
  959. explicit String (unsigned short decimalInteger);
  960. explicit String (int64 largeIntegerValue);
  961. explicit String (uint64 largeIntegerValue);
  962. explicit String (float floatValue,
  963. int numberOfDecimalPlaces = 0);
  964. explicit String (double doubleValue,
  965. int numberOfDecimalPlaces = 0);
  966. int getIntValue() const throw();
  967. int64 getLargeIntValue() const throw();
  968. int getTrailingIntValue() const throw();
  969. float getFloatValue() const throw();
  970. double getDoubleValue() const throw();
  971. int getHexValue32() const throw();
  972. int64 getHexValue64() const throw();
  973. static const String toHexString (int number);
  974. static const String toHexString (int64 number);
  975. static const String toHexString (short number);
  976. static const String toHexString (const unsigned char* data,
  977. int size,
  978. int groupSize = 1);
  979. inline operator const juce_wchar*() const throw() { return text; }
  980. inline operator juce_wchar*() throw() { return text; }
  981. const char* toUTF8() const;
  982. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  983. int getNumBytesAsUTF8() const throw();
  984. int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw();
  985. const char* toCString() const;
  986. int getNumBytesAsCString() const throw();
  987. int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw();
  988. void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
  989. void preallocateStorage (size_t numCharsNeeded);
  990. void swapWith (String& other) throw();
  991. class JUCE_API Concatenator
  992. {
  993. public:
  994. Concatenator (String& stringToAppendTo);
  995. ~Concatenator();
  996. void append (const String& s);
  997. private:
  998. String& result;
  999. int nextIndex;
  1000. Concatenator (const Concatenator&);
  1001. Concatenator& operator= (const Concatenator&);
  1002. };
  1003. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  1004. private:
  1005. juce_wchar* text;
  1006. // internal constructor that preallocates a certain amount of memory
  1007. String (size_t numChars, int dummyVariable);
  1008. String (const String& stringToCopy, size_t charsToAllocate);
  1009. void createInternal (const juce_wchar* text, size_t numChars);
  1010. void appendInternal (const juce_wchar* text, int numExtraChars);
  1011. };
  1012. const String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
  1013. const String JUCE_CALLTYPE operator+ (const juce_wchar* string1, const String& string2);
  1014. const String JUCE_CALLTYPE operator+ (char string1, const String& string2);
  1015. const String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
  1016. const String JUCE_CALLTYPE operator+ (String string1, const String& string2);
  1017. const String JUCE_CALLTYPE operator+ (String string1, const char* string2);
  1018. const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar* string2);
  1019. const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
  1020. const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
  1021. String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
  1022. String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
  1023. String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
  1024. String& JUCE_CALLTYPE operator<< (String& string1, const juce_wchar* string2);
  1025. String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
  1026. String& JUCE_CALLTYPE operator<< (String& string1, short number);
  1027. String& JUCE_CALLTYPE operator<< (String& string1, int number);
  1028. String& JUCE_CALLTYPE operator<< (String& string1, unsigned int number);
  1029. String& JUCE_CALLTYPE operator<< (String& string1, long number);
  1030. String& JUCE_CALLTYPE operator<< (String& string1, unsigned long number);
  1031. String& JUCE_CALLTYPE operator<< (String& string1, float number);
  1032. String& JUCE_CALLTYPE operator<< (String& string1, double number);
  1033. bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw();
  1034. bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw();
  1035. bool JUCE_CALLTYPE operator== (const String& string1, const juce_wchar* string2) throw();
  1036. bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw();
  1037. bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw();
  1038. bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* string2) throw();
  1039. bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw();
  1040. bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw();
  1041. bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw();
  1042. bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
  1043. template <class charT, class traits>
  1044. std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1045. {
  1046. return stream << stringToWrite.toUTF8();
  1047. }
  1048. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);
  1049. #endif // __JUCE_STRING_JUCEHEADER__
  1050. /*** End of inlined file: juce_String.h ***/
  1051. class JUCE_API Logger
  1052. {
  1053. public:
  1054. virtual ~Logger();
  1055. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1056. const bool deleteOldLogger = false);
  1057. static void JUCE_CALLTYPE writeToLog (const String& message);
  1058. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1059. protected:
  1060. Logger();
  1061. virtual void logMessage (const String& message) = 0;
  1062. };
  1063. #endif // __JUCE_LOGGER_JUCEHEADER__
  1064. /*** End of inlined file: juce_Logger.h ***/
  1065. END_JUCE_NAMESPACE
  1066. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1067. /*** End of inlined file: juce_StandardHeader.h ***/
  1068. BEGIN_JUCE_NAMESPACE
  1069. #if JUCE_MSVC
  1070. // this is set explicitly in case the app is using a different packing size.
  1071. #pragma pack (push, 8)
  1072. #pragma warning (push)
  1073. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1074. #endif
  1075. // this is where all the class header files get brought in..
  1076. /*** Start of inlined file: juce_core_includes.h ***/
  1077. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1078. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1079. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1080. /*** Start of inlined file: juce_Array.h ***/
  1081. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1082. #define __JUCE_ARRAY_JUCEHEADER__
  1083. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1084. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1085. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1086. /*** Start of inlined file: juce_HeapBlock.h ***/
  1087. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1088. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1089. template <class ElementType>
  1090. class HeapBlock
  1091. {
  1092. public:
  1093. HeapBlock() throw() : data (0)
  1094. {
  1095. }
  1096. explicit HeapBlock (const size_t numElements)
  1097. : data (static_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1098. {
  1099. }
  1100. ~HeapBlock()
  1101. {
  1102. ::juce_free (data);
  1103. }
  1104. inline operator ElementType*() const throw() { return data; }
  1105. inline ElementType* getData() const throw() { return data; }
  1106. inline operator void*() const throw() { return static_cast <void*> (data); }
  1107. inline ElementType* operator->() const throw() { return data; }
  1108. template <typename IndexType>
  1109. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1110. template <typename IndexType>
  1111. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1112. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1113. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1114. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1115. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1116. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1117. {
  1118. ::juce_free (data);
  1119. data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1120. }
  1121. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1122. {
  1123. ::juce_free (data);
  1124. data = static_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1125. }
  1126. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1127. {
  1128. ::juce_free (data);
  1129. if (initialiseToZero)
  1130. data = static_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1131. else
  1132. data = static_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1133. }
  1134. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1135. {
  1136. if (data == 0)
  1137. data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1138. else
  1139. data = static_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1140. }
  1141. void free()
  1142. {
  1143. ::juce_free (data);
  1144. data = 0;
  1145. }
  1146. void swapWith (HeapBlock <ElementType>& other) throw()
  1147. {
  1148. swapVariables (data, other.data);
  1149. }
  1150. private:
  1151. ElementType* data;
  1152. HeapBlock (const HeapBlock&);
  1153. HeapBlock& operator= (const HeapBlock&);
  1154. };
  1155. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1156. /*** End of inlined file: juce_HeapBlock.h ***/
  1157. template <class ElementType, class TypeOfCriticalSectionToUse>
  1158. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1159. {
  1160. public:
  1161. ArrayAllocationBase() throw()
  1162. : numAllocated (0)
  1163. {
  1164. }
  1165. ~ArrayAllocationBase()
  1166. {
  1167. }
  1168. void setAllocatedSize (const int numElements)
  1169. {
  1170. if (numAllocated != numElements)
  1171. {
  1172. if (numElements > 0)
  1173. elements.realloc (numElements);
  1174. else
  1175. elements.free();
  1176. numAllocated = numElements;
  1177. }
  1178. }
  1179. void ensureAllocatedSize (const int minNumElements)
  1180. {
  1181. if (minNumElements > numAllocated)
  1182. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1183. }
  1184. void shrinkToNoMoreThan (const int maxNumElements)
  1185. {
  1186. if (maxNumElements < numAllocated)
  1187. setAllocatedSize (maxNumElements);
  1188. }
  1189. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1190. {
  1191. elements.swapWith (other.elements);
  1192. swapVariables (numAllocated, other.numAllocated);
  1193. }
  1194. HeapBlock <ElementType> elements;
  1195. int numAllocated;
  1196. private:
  1197. ArrayAllocationBase (const ArrayAllocationBase&);
  1198. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1199. };
  1200. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1201. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1202. /*** Start of inlined file: juce_ElementComparator.h ***/
  1203. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1204. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1205. template <class ElementType, class ElementComparator>
  1206. static void sortArray (ElementComparator& comparator,
  1207. ElementType* const array,
  1208. int firstElement,
  1209. int lastElement,
  1210. const bool retainOrderOfEquivalentItems)
  1211. {
  1212. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1213. // avoids getting warning messages about the parameter being unused
  1214. if (lastElement > firstElement)
  1215. {
  1216. if (retainOrderOfEquivalentItems)
  1217. {
  1218. for (int i = firstElement; i < lastElement; ++i)
  1219. {
  1220. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1221. {
  1222. const ElementType temp = array [i];
  1223. array [i] = array[i + 1];
  1224. array [i + 1] = temp;
  1225. if (i > firstElement)
  1226. i -= 2;
  1227. }
  1228. }
  1229. }
  1230. else
  1231. {
  1232. int fromStack[30], toStack[30];
  1233. int stackIndex = 0;
  1234. for (;;)
  1235. {
  1236. const int size = (lastElement - firstElement) + 1;
  1237. if (size <= 8)
  1238. {
  1239. int j = lastElement;
  1240. int maxIndex;
  1241. while (j > firstElement)
  1242. {
  1243. maxIndex = firstElement;
  1244. for (int k = firstElement + 1; k <= j; ++k)
  1245. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1246. maxIndex = k;
  1247. const ElementType temp = array [maxIndex];
  1248. array [maxIndex] = array[j];
  1249. array [j] = temp;
  1250. --j;
  1251. }
  1252. }
  1253. else
  1254. {
  1255. const int mid = firstElement + (size >> 1);
  1256. ElementType temp = array [mid];
  1257. array [mid] = array [firstElement];
  1258. array [firstElement] = temp;
  1259. int i = firstElement;
  1260. int j = lastElement + 1;
  1261. for (;;)
  1262. {
  1263. while (++i <= lastElement
  1264. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1265. {}
  1266. while (--j > firstElement
  1267. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1268. {}
  1269. if (j < i)
  1270. break;
  1271. temp = array[i];
  1272. array[i] = array[j];
  1273. array[j] = temp;
  1274. }
  1275. temp = array [firstElement];
  1276. array [firstElement] = array[j];
  1277. array [j] = temp;
  1278. if (j - 1 - firstElement >= lastElement - i)
  1279. {
  1280. if (firstElement + 1 < j)
  1281. {
  1282. fromStack [stackIndex] = firstElement;
  1283. toStack [stackIndex] = j - 1;
  1284. ++stackIndex;
  1285. }
  1286. if (i < lastElement)
  1287. {
  1288. firstElement = i;
  1289. continue;
  1290. }
  1291. }
  1292. else
  1293. {
  1294. if (i < lastElement)
  1295. {
  1296. fromStack [stackIndex] = i;
  1297. toStack [stackIndex] = lastElement;
  1298. ++stackIndex;
  1299. }
  1300. if (firstElement + 1 < j)
  1301. {
  1302. lastElement = j - 1;
  1303. continue;
  1304. }
  1305. }
  1306. }
  1307. if (--stackIndex < 0)
  1308. break;
  1309. jassert (stackIndex < numElementsInArray (fromStack));
  1310. firstElement = fromStack [stackIndex];
  1311. lastElement = toStack [stackIndex];
  1312. }
  1313. }
  1314. }
  1315. }
  1316. template <class ElementType, class ElementComparator>
  1317. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1318. ElementType* const array,
  1319. const ElementType newElement,
  1320. int firstElement,
  1321. int lastElement)
  1322. {
  1323. jassert (firstElement <= lastElement);
  1324. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1325. // avoids getting warning messages about the parameter being unused
  1326. while (firstElement < lastElement)
  1327. {
  1328. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1329. {
  1330. ++firstElement;
  1331. break;
  1332. }
  1333. else
  1334. {
  1335. const int halfway = (firstElement + lastElement) >> 1;
  1336. if (halfway == firstElement)
  1337. {
  1338. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1339. ++firstElement;
  1340. break;
  1341. }
  1342. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1343. {
  1344. firstElement = halfway;
  1345. }
  1346. else
  1347. {
  1348. lastElement = halfway;
  1349. }
  1350. }
  1351. }
  1352. return firstElement;
  1353. }
  1354. template <class ElementType>
  1355. class DefaultElementComparator
  1356. {
  1357. private:
  1358. typedef PARAMETER_TYPE (ElementType) ParameterType;
  1359. public:
  1360. static int compareElements (ParameterType first, ParameterType second)
  1361. {
  1362. return (first < second) ? -1 : ((second < first) ? 1 : 0);
  1363. }
  1364. };
  1365. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1366. /*** End of inlined file: juce_ElementComparator.h ***/
  1367. /*** Start of inlined file: juce_CriticalSection.h ***/
  1368. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1369. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1370. class JUCE_API ScopedLock;
  1371. class JUCE_API ScopedUnlock;
  1372. class JUCE_API CriticalSection
  1373. {
  1374. public:
  1375. CriticalSection() throw();
  1376. ~CriticalSection() throw();
  1377. void enter() const throw();
  1378. bool tryEnter() const throw();
  1379. void exit() const throw();
  1380. typedef ScopedLock ScopedLockType;
  1381. typedef ScopedUnlock ScopedUnlockType;
  1382. juce_UseDebuggingNewOperator
  1383. private:
  1384. #if JUCE_WIN32
  1385. #if JUCE_64BIT
  1386. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1387. // block of memory here that's big enough to be used internally as a windows critical
  1388. // section object.
  1389. uint8 internal [44];
  1390. #else
  1391. uint8 internal [24];
  1392. #endif
  1393. #else
  1394. mutable pthread_mutex_t internal;
  1395. #endif
  1396. CriticalSection (const CriticalSection&);
  1397. CriticalSection& operator= (const CriticalSection&);
  1398. };
  1399. class JUCE_API DummyCriticalSection
  1400. {
  1401. public:
  1402. inline DummyCriticalSection() throw() {}
  1403. inline ~DummyCriticalSection() throw() {}
  1404. inline void enter() const throw() {}
  1405. inline void exit() const throw() {}
  1406. struct ScopedLockType
  1407. {
  1408. ScopedLockType (const DummyCriticalSection&) throw() {}
  1409. };
  1410. typedef ScopedLockType ScopedUnlockType;
  1411. private:
  1412. DummyCriticalSection (const DummyCriticalSection&);
  1413. DummyCriticalSection& operator= (const DummyCriticalSection&);
  1414. };
  1415. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1416. /*** End of inlined file: juce_CriticalSection.h ***/
  1417. template <typename ElementType,
  1418. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1419. class Array
  1420. {
  1421. private:
  1422. #if defined (_MSC_VER) && _MSC_VER <= 1400
  1423. typedef const ElementType& ParameterType;
  1424. #else
  1425. typedef PARAMETER_TYPE (ElementType) ParameterType;
  1426. #endif
  1427. public:
  1428. Array() throw()
  1429. : numUsed (0)
  1430. {
  1431. }
  1432. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1433. {
  1434. const ScopedLockType lock (other.getLock());
  1435. numUsed = other.numUsed;
  1436. data.setAllocatedSize (other.numUsed);
  1437. for (int i = 0; i < numUsed; ++i)
  1438. new (data.elements + i) ElementType (other.data.elements[i]);
  1439. }
  1440. explicit Array (const ElementType* values)
  1441. : numUsed (0)
  1442. {
  1443. while (*values != 0)
  1444. add (*values++);
  1445. }
  1446. Array (const ElementType* values, int numValues)
  1447. : numUsed (numValues)
  1448. {
  1449. data.setAllocatedSize (numValues);
  1450. for (int i = 0; i < numValues; ++i)
  1451. new (data.elements + i) ElementType (values[i]);
  1452. }
  1453. ~Array()
  1454. {
  1455. for (int i = 0; i < numUsed; ++i)
  1456. data.elements[i].~ElementType();
  1457. }
  1458. Array& operator= (const Array& other)
  1459. {
  1460. if (this != &other)
  1461. {
  1462. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1463. swapWithArray (otherCopy);
  1464. }
  1465. return *this;
  1466. }
  1467. template <class OtherArrayType>
  1468. bool operator== (const OtherArrayType& other) const
  1469. {
  1470. const ScopedLockType lock (getLock());
  1471. if (numUsed != other.numUsed)
  1472. return false;
  1473. for (int i = numUsed; --i >= 0;)
  1474. if (data.elements [i] != other.data.elements [i])
  1475. return false;
  1476. return true;
  1477. }
  1478. template <class OtherArrayType>
  1479. bool operator!= (const OtherArrayType& other) const
  1480. {
  1481. return ! operator== (other);
  1482. }
  1483. void clear()
  1484. {
  1485. const ScopedLockType lock (getLock());
  1486. for (int i = 0; i < numUsed; ++i)
  1487. data.elements[i].~ElementType();
  1488. data.setAllocatedSize (0);
  1489. numUsed = 0;
  1490. }
  1491. void clearQuick()
  1492. {
  1493. const ScopedLockType lock (getLock());
  1494. for (int i = 0; i < numUsed; ++i)
  1495. data.elements[i].~ElementType();
  1496. numUsed = 0;
  1497. }
  1498. inline int size() const throw()
  1499. {
  1500. return numUsed;
  1501. }
  1502. inline ElementType operator[] (const int index) const
  1503. {
  1504. const ScopedLockType lock (getLock());
  1505. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1506. : ElementType();
  1507. }
  1508. inline const ElementType getUnchecked (const int index) const
  1509. {
  1510. const ScopedLockType lock (getLock());
  1511. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1512. return data.elements [index];
  1513. }
  1514. inline ElementType& getReference (const int index) const throw()
  1515. {
  1516. const ScopedLockType lock (getLock());
  1517. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1518. return data.elements [index];
  1519. }
  1520. inline ElementType getFirst() const
  1521. {
  1522. const ScopedLockType lock (getLock());
  1523. return (numUsed > 0) ? data.elements [0]
  1524. : ElementType();
  1525. }
  1526. inline ElementType getLast() const
  1527. {
  1528. const ScopedLockType lock (getLock());
  1529. return (numUsed > 0) ? data.elements [numUsed - 1]
  1530. : ElementType();
  1531. }
  1532. inline ElementType* getRawDataPointer() throw()
  1533. {
  1534. return data.elements;
  1535. }
  1536. int indexOf (ParameterType elementToLookFor) const
  1537. {
  1538. const ScopedLockType lock (getLock());
  1539. const ElementType* e = data.elements.getData();
  1540. const ElementType* const end = e + numUsed;
  1541. while (e != end)
  1542. {
  1543. if (elementToLookFor == *e)
  1544. return static_cast <int> (e - data.elements.getData());
  1545. ++e;
  1546. }
  1547. return -1;
  1548. }
  1549. bool contains (ParameterType elementToLookFor) const
  1550. {
  1551. const ScopedLockType lock (getLock());
  1552. const ElementType* e = data.elements.getData();
  1553. const ElementType* const end = e + numUsed;
  1554. while (e != end)
  1555. {
  1556. if (elementToLookFor == *e)
  1557. return true;
  1558. ++e;
  1559. }
  1560. return false;
  1561. }
  1562. void add (ParameterType newElement)
  1563. {
  1564. const ScopedLockType lock (getLock());
  1565. data.ensureAllocatedSize (numUsed + 1);
  1566. new (data.elements + numUsed++) ElementType (newElement);
  1567. }
  1568. void insert (int indexToInsertAt, ParameterType newElement)
  1569. {
  1570. const ScopedLockType lock (getLock());
  1571. data.ensureAllocatedSize (numUsed + 1);
  1572. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1573. {
  1574. ElementType* const insertPos = data.elements + indexToInsertAt;
  1575. const int numberToMove = numUsed - indexToInsertAt;
  1576. if (numberToMove > 0)
  1577. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1578. new (insertPos) ElementType (newElement);
  1579. ++numUsed;
  1580. }
  1581. else
  1582. {
  1583. new (data.elements + numUsed++) ElementType (newElement);
  1584. }
  1585. }
  1586. void insertMultiple (int indexToInsertAt, ParameterType newElement,
  1587. int numberOfTimesToInsertIt)
  1588. {
  1589. if (numberOfTimesToInsertIt > 0)
  1590. {
  1591. const ScopedLockType lock (getLock());
  1592. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1593. ElementType* insertPos;
  1594. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1595. {
  1596. insertPos = data.elements + indexToInsertAt;
  1597. const int numberToMove = numUsed - indexToInsertAt;
  1598. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1599. }
  1600. else
  1601. {
  1602. insertPos = data.elements + numUsed;
  1603. }
  1604. numUsed += numberOfTimesToInsertIt;
  1605. while (--numberOfTimesToInsertIt >= 0)
  1606. new (insertPos++) ElementType (newElement);
  1607. }
  1608. }
  1609. void insertArray (int indexToInsertAt,
  1610. const ElementType* newElements,
  1611. int numberOfElements)
  1612. {
  1613. if (numberOfElements > 0)
  1614. {
  1615. const ScopedLockType lock (getLock());
  1616. data.ensureAllocatedSize (numUsed + numberOfElements);
  1617. ElementType* insertPos;
  1618. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1619. {
  1620. insertPos = data.elements + indexToInsertAt;
  1621. const int numberToMove = numUsed - indexToInsertAt;
  1622. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1623. }
  1624. else
  1625. {
  1626. insertPos = data.elements + numUsed;
  1627. }
  1628. numUsed += numberOfElements;
  1629. while (--numberOfElements >= 0)
  1630. new (insertPos++) ElementType (*newElements++);
  1631. }
  1632. }
  1633. void addIfNotAlreadyThere (ParameterType newElement)
  1634. {
  1635. const ScopedLockType lock (getLock());
  1636. if (! contains (newElement))
  1637. add (newElement);
  1638. }
  1639. void set (const int indexToChange, ParameterType newValue)
  1640. {
  1641. jassert (indexToChange >= 0);
  1642. const ScopedLockType lock (getLock());
  1643. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1644. {
  1645. data.elements [indexToChange] = newValue;
  1646. }
  1647. else if (indexToChange >= 0)
  1648. {
  1649. data.ensureAllocatedSize (numUsed + 1);
  1650. new (data.elements + numUsed++) ElementType (newValue);
  1651. }
  1652. }
  1653. void setUnchecked (const int indexToChange, ParameterType newValue)
  1654. {
  1655. const ScopedLockType lock (getLock());
  1656. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1657. data.elements [indexToChange] = newValue;
  1658. }
  1659. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1660. {
  1661. const ScopedLockType lock (getLock());
  1662. if (numElementsToAdd > 0)
  1663. {
  1664. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1665. while (--numElementsToAdd >= 0)
  1666. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1667. }
  1668. }
  1669. void swapWithArray (Array& otherArray) throw()
  1670. {
  1671. const ScopedLockType lock1 (getLock());
  1672. const ScopedLockType lock2 (otherArray.getLock());
  1673. data.swapWith (otherArray.data);
  1674. swapVariables (numUsed, otherArray.numUsed);
  1675. }
  1676. template <class OtherArrayType>
  1677. void addArray (const OtherArrayType& arrayToAddFrom,
  1678. int startIndex = 0,
  1679. int numElementsToAdd = -1)
  1680. {
  1681. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1682. const ScopedLockType lock2 (getLock());
  1683. if (startIndex < 0)
  1684. {
  1685. jassertfalse
  1686. startIndex = 0;
  1687. }
  1688. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1689. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1690. while (--numElementsToAdd >= 0)
  1691. add (arrayToAddFrom.getUnchecked (startIndex++));
  1692. }
  1693. template <class ElementComparator>
  1694. void addSorted (ElementComparator& comparator, ParameterType newElement)
  1695. {
  1696. const ScopedLockType lock (getLock());
  1697. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1698. }
  1699. void addUsingDefaultSort (ParameterType newElement)
  1700. {
  1701. DefaultElementComparator <ElementType> comparator;
  1702. addSorted (comparator, newElement);
  1703. }
  1704. template <class ElementComparator>
  1705. int indexOfSorted (ElementComparator& comparator, ParameterType elementToLookFor) const
  1706. {
  1707. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1708. // avoids getting warning messages about the parameter being unused
  1709. const ScopedLockType lock (getLock());
  1710. int start = 0;
  1711. int end = numUsed;
  1712. for (;;)
  1713. {
  1714. if (start >= end)
  1715. {
  1716. return -1;
  1717. }
  1718. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1719. {
  1720. return start;
  1721. }
  1722. else
  1723. {
  1724. const int halfway = (start + end) >> 1;
  1725. if (halfway == start)
  1726. return -1;
  1727. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1728. start = halfway;
  1729. else
  1730. end = halfway;
  1731. }
  1732. }
  1733. }
  1734. ElementType remove (const int indexToRemove)
  1735. {
  1736. const ScopedLockType lock (getLock());
  1737. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1738. {
  1739. --numUsed;
  1740. ElementType* const e = data.elements + indexToRemove;
  1741. ElementType removed (*e);
  1742. e->~ElementType();
  1743. const int numberToShift = numUsed - indexToRemove;
  1744. if (numberToShift > 0)
  1745. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1746. if ((numUsed << 1) < data.numAllocated)
  1747. minimiseStorageOverheads();
  1748. return removed;
  1749. }
  1750. else
  1751. {
  1752. return ElementType();
  1753. }
  1754. }
  1755. void removeValue (ParameterType valueToRemove)
  1756. {
  1757. const ScopedLockType lock (getLock());
  1758. ElementType* e = data.elements;
  1759. for (int i = numUsed; --i >= 0;)
  1760. {
  1761. if (valueToRemove == *e)
  1762. {
  1763. remove (static_cast <int> (e - data.elements.getData()));
  1764. break;
  1765. }
  1766. ++e;
  1767. }
  1768. }
  1769. void removeRange (int startIndex, int numberToRemove)
  1770. {
  1771. const ScopedLockType lock (getLock());
  1772. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1773. startIndex = jlimit (0, numUsed, startIndex);
  1774. if (endIndex > startIndex)
  1775. {
  1776. ElementType* const e = data.elements + startIndex;
  1777. numberToRemove = endIndex - startIndex;
  1778. for (int i = 0; i < numberToRemove; ++i)
  1779. e[i].~ElementType();
  1780. const int numToShift = numUsed - endIndex;
  1781. if (numToShift > 0)
  1782. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1783. numUsed -= numberToRemove;
  1784. if ((numUsed << 1) < data.numAllocated)
  1785. minimiseStorageOverheads();
  1786. }
  1787. }
  1788. void removeLast (int howManyToRemove = 1)
  1789. {
  1790. const ScopedLockType lock (getLock());
  1791. if (howManyToRemove > numUsed)
  1792. howManyToRemove = numUsed;
  1793. for (int i = 0; i < howManyToRemove; ++i)
  1794. data.elements [numUsed - i].~ElementType();
  1795. numUsed -= howManyToRemove;
  1796. if ((numUsed << 1) < data.numAllocated)
  1797. minimiseStorageOverheads();
  1798. }
  1799. template <class OtherArrayType>
  1800. void removeValuesIn (const OtherArrayType& otherArray)
  1801. {
  1802. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1803. const ScopedLockType lock2 (getLock());
  1804. if (this == &otherArray)
  1805. {
  1806. clear();
  1807. }
  1808. else
  1809. {
  1810. if (otherArray.size() > 0)
  1811. {
  1812. for (int i = numUsed; --i >= 0;)
  1813. if (otherArray.contains (data.elements [i]))
  1814. remove (i);
  1815. }
  1816. }
  1817. }
  1818. template <class OtherArrayType>
  1819. void removeValuesNotIn (const OtherArrayType& otherArray)
  1820. {
  1821. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1822. const ScopedLockType lock2 (getLock());
  1823. if (this != &otherArray)
  1824. {
  1825. if (otherArray.size() <= 0)
  1826. {
  1827. clear();
  1828. }
  1829. else
  1830. {
  1831. for (int i = numUsed; --i >= 0;)
  1832. if (! otherArray.contains (data.elements [i]))
  1833. remove (i);
  1834. }
  1835. }
  1836. }
  1837. void swap (const int index1,
  1838. const int index2)
  1839. {
  1840. const ScopedLockType lock (getLock());
  1841. if (((unsigned int) index1) < (unsigned int) numUsed
  1842. && ((unsigned int) index2) < (unsigned int) numUsed)
  1843. {
  1844. swapVariables (data.elements [index1],
  1845. data.elements [index2]);
  1846. }
  1847. }
  1848. void move (const int currentIndex, int newIndex) throw()
  1849. {
  1850. if (currentIndex != newIndex)
  1851. {
  1852. const ScopedLockType lock (getLock());
  1853. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1854. {
  1855. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1856. newIndex = numUsed - 1;
  1857. char tempCopy [sizeof (ElementType)];
  1858. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1859. if (newIndex > currentIndex)
  1860. {
  1861. memmove (data.elements + currentIndex,
  1862. data.elements + currentIndex + 1,
  1863. (newIndex - currentIndex) * sizeof (ElementType));
  1864. }
  1865. else
  1866. {
  1867. memmove (data.elements + newIndex + 1,
  1868. data.elements + newIndex,
  1869. (currentIndex - newIndex) * sizeof (ElementType));
  1870. }
  1871. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1872. }
  1873. }
  1874. }
  1875. void minimiseStorageOverheads()
  1876. {
  1877. const ScopedLockType lock (getLock());
  1878. data.shrinkToNoMoreThan (numUsed);
  1879. }
  1880. void ensureStorageAllocated (const int minNumElements)
  1881. {
  1882. const ScopedLockType lock (getLock());
  1883. data.ensureAllocatedSize (minNumElements);
  1884. }
  1885. template <class ElementComparator>
  1886. void sort (ElementComparator& comparator,
  1887. const bool retainOrderOfEquivalentItems = false) const
  1888. {
  1889. const ScopedLockType lock (getLock());
  1890. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1891. // avoids getting warning messages about the parameter being unused
  1892. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1893. }
  1894. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1895. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1896. juce_UseDebuggingNewOperator
  1897. private:
  1898. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1899. int numUsed;
  1900. };
  1901. #endif // __JUCE_ARRAY_JUCEHEADER__
  1902. /*** End of inlined file: juce_Array.h ***/
  1903. #endif
  1904. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1905. #endif
  1906. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1907. /*** Start of inlined file: juce_BitArray.h ***/
  1908. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1909. #define __JUCE_BITARRAY_JUCEHEADER__
  1910. class MemoryBlock;
  1911. class JUCE_API BigInteger
  1912. {
  1913. public:
  1914. BigInteger();
  1915. BigInteger (unsigned int value);
  1916. BigInteger (int value);
  1917. BigInteger (int64 value);
  1918. BigInteger (const BigInteger& other);
  1919. ~BigInteger();
  1920. BigInteger& operator= (const BigInteger& other);
  1921. void swapWith (BigInteger& other) throw();
  1922. bool operator[] (int bit) const throw();
  1923. bool isZero() const throw();
  1924. bool isOne() const throw();
  1925. int toInteger() const throw();
  1926. void clear();
  1927. void clearBit (int bitNumber) throw();
  1928. void setBit (int bitNumber);
  1929. void setBit (int bitNumber, bool shouldBeSet);
  1930. void setRange (int startBit, int numBits, bool shouldBeSet);
  1931. void insertBit (int bitNumber, bool shouldBeSet);
  1932. const BigInteger getBitRange (int startBit, int numBits) const;
  1933. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1934. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1935. void shiftBits (int howManyBitsLeft, int startBit);
  1936. int countNumberOfSetBits() const throw();
  1937. int findNextSetBit (int startIndex = 0) const throw();
  1938. int findNextClearBit (int startIndex = 0) const throw();
  1939. int getHighestBit() const throw();
  1940. // All the standard arithmetic ops...
  1941. BigInteger& operator+= (const BigInteger& other);
  1942. BigInteger& operator-= (const BigInteger& other);
  1943. BigInteger& operator*= (const BigInteger& other);
  1944. BigInteger& operator/= (const BigInteger& other);
  1945. BigInteger& operator|= (const BigInteger& other);
  1946. BigInteger& operator&= (const BigInteger& other);
  1947. BigInteger& operator^= (const BigInteger& other);
  1948. BigInteger& operator%= (const BigInteger& other);
  1949. BigInteger& operator<<= (int numBitsToShift);
  1950. BigInteger& operator>>= (int numBitsToShift);
  1951. BigInteger& operator++();
  1952. BigInteger& operator--();
  1953. const BigInteger operator++ (int);
  1954. const BigInteger operator-- (int);
  1955. const BigInteger operator-() const;
  1956. const BigInteger operator+ (const BigInteger& other) const;
  1957. const BigInteger operator- (const BigInteger& other) const;
  1958. const BigInteger operator* (const BigInteger& other) const;
  1959. const BigInteger operator/ (const BigInteger& other) const;
  1960. const BigInteger operator| (const BigInteger& other) const;
  1961. const BigInteger operator& (const BigInteger& other) const;
  1962. const BigInteger operator^ (const BigInteger& other) const;
  1963. const BigInteger operator% (const BigInteger& other) const;
  1964. const BigInteger operator<< (int numBitsToShift) const;
  1965. const BigInteger operator>> (int numBitsToShift) const;
  1966. bool operator== (const BigInteger& other) const throw();
  1967. bool operator!= (const BigInteger& other) const throw();
  1968. bool operator< (const BigInteger& other) const throw();
  1969. bool operator<= (const BigInteger& other) const throw();
  1970. bool operator> (const BigInteger& other) const throw();
  1971. bool operator>= (const BigInteger& other) const throw();
  1972. int compare (const BigInteger& other) const throw();
  1973. int compareAbsolute (const BigInteger& other) const throw();
  1974. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1975. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1976. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1977. void inverseModulo (const BigInteger& modulus);
  1978. bool isNegative() const throw();
  1979. void setNegative (const bool shouldBeNegative) throw();
  1980. void negate() throw();
  1981. const String toString (int base, int minimumNumCharacters = 1) const;
  1982. void parseString (const String& text, int base);
  1983. const MemoryBlock toMemoryBlock() const;
  1984. void loadFromMemoryBlock (const MemoryBlock& data);
  1985. juce_UseDebuggingNewOperator
  1986. private:
  1987. HeapBlock <unsigned int> values;
  1988. int numValues, highestBit;
  1989. bool negative;
  1990. void ensureSize (int numVals);
  1991. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1992. };
  1993. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1994. typedef BigInteger BitArray;
  1995. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1996. /*** End of inlined file: juce_BitArray.h ***/
  1997. #endif
  1998. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1999. /*** Start of inlined file: juce_DynamicObject.h ***/
  2000. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2001. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2002. /*** Start of inlined file: juce_NamedValueSet.h ***/
  2003. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2004. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  2005. /*** Start of inlined file: juce_Variant.h ***/
  2006. #ifndef __JUCE_VARIANT_JUCEHEADER__
  2007. #define __JUCE_VARIANT_JUCEHEADER__
  2008. /*** Start of inlined file: juce_OutputStream.h ***/
  2009. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2010. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2011. /*** Start of inlined file: juce_InputStream.h ***/
  2012. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2013. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2014. /*** Start of inlined file: juce_MemoryBlock.h ***/
  2015. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2016. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2017. class JUCE_API MemoryBlock
  2018. {
  2019. public:
  2020. MemoryBlock() throw();
  2021. MemoryBlock (const size_t initialSize,
  2022. const bool initialiseToZero = false) throw();
  2023. MemoryBlock (const MemoryBlock& other) throw();
  2024. MemoryBlock (const void* const dataToInitialiseFrom,
  2025. const size_t sizeInBytes) throw();
  2026. ~MemoryBlock() throw();
  2027. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2028. bool operator== (const MemoryBlock& other) const throw();
  2029. bool operator!= (const MemoryBlock& other) const throw();
  2030. bool matches (const void* data, size_t dataSize) const throw();
  2031. void* getData() const throw() { return data; }
  2032. template <typename Type>
  2033. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2034. size_t getSize() const throw() { return size; }
  2035. void setSize (const size_t newSize,
  2036. const bool initialiseNewSpaceToZero = false) throw();
  2037. void ensureSize (const size_t minimumSize,
  2038. const bool initialiseNewSpaceToZero = false) throw();
  2039. void fillWith (const uint8 valueToUse) throw();
  2040. void append (const void* const data,
  2041. const size_t numBytes) throw();
  2042. void swapWith (MemoryBlock& other) throw();
  2043. void copyFrom (const void* srcData,
  2044. int destinationOffset,
  2045. size_t numBytes) throw();
  2046. void copyTo (void* destData,
  2047. int sourceOffset,
  2048. size_t numBytes) const throw();
  2049. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2050. const String toString() const throw();
  2051. void loadFromHexString (const String& sourceHexString) throw();
  2052. void setBitRange (size_t bitRangeStart,
  2053. size_t numBits,
  2054. int binaryNumberToApply) throw();
  2055. int getBitRange (size_t bitRangeStart,
  2056. size_t numBitsToRead) const throw();
  2057. const String toBase64Encoding() const throw();
  2058. bool fromBase64Encoding (const String& encodedString) throw();
  2059. juce_UseDebuggingNewOperator
  2060. private:
  2061. HeapBlock <char> data;
  2062. size_t size;
  2063. };
  2064. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2065. /*** End of inlined file: juce_MemoryBlock.h ***/
  2066. class JUCE_API InputStream
  2067. {
  2068. public:
  2069. virtual ~InputStream() {}
  2070. virtual int64 getTotalLength() = 0;
  2071. virtual bool isExhausted() = 0;
  2072. virtual int read (void* destBuffer, int maxBytesToRead) = 0;
  2073. virtual char readByte();
  2074. virtual bool readBool();
  2075. virtual short readShort();
  2076. virtual short readShortBigEndian();
  2077. virtual int readInt();
  2078. virtual int readIntBigEndian();
  2079. virtual int64 readInt64();
  2080. virtual int64 readInt64BigEndian();
  2081. virtual float readFloat();
  2082. virtual float readFloatBigEndian();
  2083. virtual double readDouble();
  2084. virtual double readDoubleBigEndian();
  2085. virtual int readCompressedInt();
  2086. virtual const String readNextLine();
  2087. virtual const String readString();
  2088. virtual const String readEntireStreamAsString();
  2089. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2090. int maxNumBytesToRead = -1);
  2091. virtual int64 getPosition() = 0;
  2092. virtual bool setPosition (int64 newPosition) = 0;
  2093. virtual void skipNextBytes (int64 numBytesToSkip);
  2094. juce_UseDebuggingNewOperator
  2095. protected:
  2096. InputStream() throw() {}
  2097. };
  2098. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2099. /*** End of inlined file: juce_InputStream.h ***/
  2100. class File;
  2101. class JUCE_API OutputStream
  2102. {
  2103. protected:
  2104. OutputStream();
  2105. public:
  2106. virtual ~OutputStream();
  2107. virtual void flush() = 0;
  2108. virtual bool setPosition (int64 newPosition) = 0;
  2109. virtual int64 getPosition() = 0;
  2110. virtual bool write (const void* dataToWrite,
  2111. int howManyBytes) = 0;
  2112. virtual void writeByte (char byte);
  2113. virtual void writeBool (bool boolValue);
  2114. virtual void writeShort (short value);
  2115. virtual void writeShortBigEndian (short value);
  2116. virtual void writeInt (int value);
  2117. virtual void writeIntBigEndian (int value);
  2118. virtual void writeInt64 (int64 value);
  2119. virtual void writeInt64BigEndian (int64 value);
  2120. virtual void writeFloat (float value);
  2121. virtual void writeFloatBigEndian (float value);
  2122. virtual void writeDouble (double value);
  2123. virtual void writeDoubleBigEndian (double value);
  2124. virtual void writeCompressedInt (int value);
  2125. virtual void writeString (const String& text);
  2126. virtual void writeText (const String& text,
  2127. bool asUnicode,
  2128. bool writeUnicodeHeaderBytes);
  2129. virtual int writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite);
  2130. juce_UseDebuggingNewOperator
  2131. };
  2132. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
  2133. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
  2134. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
  2135. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
  2136. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data);
  2137. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileToRead);
  2138. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2139. /*** End of inlined file: juce_OutputStream.h ***/
  2140. class JUCE_API DynamicObject;
  2141. class JUCE_API var
  2142. {
  2143. public:
  2144. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2145. var() throw();
  2146. ~var() throw();
  2147. static const var null;
  2148. var (const var& valueToCopy);
  2149. var (int value) throw();
  2150. var (bool value) throw();
  2151. var (double value) throw();
  2152. var (const char* value);
  2153. var (const juce_wchar* value);
  2154. var (const String& value);
  2155. var (DynamicObject* object);
  2156. var (MethodFunction method) throw();
  2157. var& operator= (const var& valueToCopy);
  2158. var& operator= (int value);
  2159. var& operator= (bool value);
  2160. var& operator= (double value);
  2161. var& operator= (const char* value);
  2162. var& operator= (const juce_wchar* value);
  2163. var& operator= (const String& value);
  2164. var& operator= (DynamicObject* object);
  2165. var& operator= (MethodFunction method);
  2166. void swapWith (var& other) throw();
  2167. operator int() const;
  2168. operator bool() const;
  2169. operator float() const;
  2170. operator double() const;
  2171. operator const String() const;
  2172. const String toString() const;
  2173. DynamicObject* getObject() const;
  2174. bool isVoid() const throw() { return type == voidType; }
  2175. bool isInt() const throw() { return type == intType; }
  2176. bool isBool() const throw() { return type == boolType; }
  2177. bool isDouble() const throw() { return type == doubleType; }
  2178. bool isString() const throw() { return type == stringType; }
  2179. bool isObject() const throw() { return type == objectType; }
  2180. bool isMethod() const throw() { return type == methodType; }
  2181. void writeToStream (OutputStream& output) const;
  2182. static const var readFromStream (InputStream& input);
  2183. class JUCE_API identifier
  2184. {
  2185. public:
  2186. identifier() throw();
  2187. identifier (const char* name);
  2188. identifier (const String& name);
  2189. ~identifier();
  2190. bool operator== (const identifier& other) const throw()
  2191. {
  2192. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2193. return hashCode == other.hashCode;
  2194. }
  2195. String name;
  2196. int hashCode;
  2197. };
  2198. const var operator[] (const identifier& propertyName) const;
  2199. const var call (const identifier& method) const;
  2200. const var call (const identifier& method, const var& arg1) const;
  2201. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2202. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2203. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2204. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2205. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2206. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2207. juce_UseDebuggingNewOperator
  2208. bool equals (const var& other) const throw();
  2209. private:
  2210. enum Type
  2211. {
  2212. voidType = 0,
  2213. intType,
  2214. boolType,
  2215. doubleType,
  2216. stringType,
  2217. objectType,
  2218. methodType
  2219. };
  2220. union ValueUnion
  2221. {
  2222. int intValue;
  2223. bool boolValue;
  2224. double doubleValue;
  2225. String* stringValue;
  2226. DynamicObject* objectValue;
  2227. MethodFunction methodValue;
  2228. };
  2229. Type type;
  2230. ValueUnion value;
  2231. };
  2232. bool operator== (const var& v1, const var& v2) throw();
  2233. bool operator!= (const var& v1, const var& v2) throw();
  2234. bool operator== (const var& v1, const String& v2) throw();
  2235. bool operator!= (const var& v1, const String& v2) throw();
  2236. #endif // __JUCE_VARIANT_JUCEHEADER__
  2237. /*** End of inlined file: juce_Variant.h ***/
  2238. class JUCE_API NamedValueSet
  2239. {
  2240. public:
  2241. NamedValueSet() throw();
  2242. NamedValueSet (const NamedValueSet& other);
  2243. NamedValueSet& operator= (const NamedValueSet& other);
  2244. ~NamedValueSet();
  2245. int size() const throw();
  2246. const var& operator[] (const var::identifier& name) const;
  2247. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2248. var* getItem (const var::identifier& name) const;
  2249. bool set (const var::identifier& name, const var& newValue);
  2250. bool contains (const var::identifier& name) const;
  2251. bool remove (const var::identifier& name);
  2252. const var::identifier getName (int index) const;
  2253. void clear();
  2254. juce_UseDebuggingNewOperator
  2255. private:
  2256. struct NamedValue
  2257. {
  2258. NamedValue() throw();
  2259. NamedValue (const var::identifier& name, const var& value);
  2260. var::identifier name;
  2261. var value;
  2262. };
  2263. Array <NamedValue> values;
  2264. };
  2265. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2266. /*** End of inlined file: juce_NamedValueSet.h ***/
  2267. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2268. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2269. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2270. /*** Start of inlined file: juce_Atomic.h ***/
  2271. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2272. #define __JUCE_ATOMIC_JUCEHEADER__
  2273. template <typename Type>
  2274. class Atomic
  2275. {
  2276. public:
  2277. inline Atomic() throw()
  2278. : value (0)
  2279. {
  2280. }
  2281. inline Atomic (const Type initialValue) throw()
  2282. : value (initialValue)
  2283. {
  2284. }
  2285. inline Atomic (const Atomic& other) throw()
  2286. : value (other.get())
  2287. {
  2288. }
  2289. inline Atomic& operator= (const Atomic& other) throw()
  2290. {
  2291. set (other.get());
  2292. }
  2293. inline ~Atomic() throw()
  2294. {
  2295. // This class can only be used for types which are 32 or 64 bits in size.
  2296. static_jassert (sizeof (Type) == 4 || sizeof (Type) == 8);
  2297. }
  2298. Type get() const throw();
  2299. void set (Type newValue) throw();
  2300. Type exchange (Type value) throw();
  2301. Type operator+= (Type amountToAdd) throw();
  2302. Type operator-= (Type amountToSubtract) throw();
  2303. Type operator++() throw();
  2304. Type operator--() throw();
  2305. bool compareAndSetBool (Type newValue, Type valueToCompare) throw();
  2306. Type compareAndSetValue (Type newValue, Type valueToCompare) throw();
  2307. static void memoryBarrier() throw();
  2308. #if JUCE_MSVC
  2309. __declspec (align (8))
  2310. #else
  2311. __attribute__ ((aligned (8)))
  2312. #endif
  2313. Type value;
  2314. };
  2315. #if (JUCE_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \
  2316. || (JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)))
  2317. #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier
  2318. #elif JUCE_GCC
  2319. #define JUCE_ATOMICS_GCC 1 // GCC with intrinsics
  2320. #else
  2321. #define JUCE_ATOMICS_WINDOWS 1 // Windows with intrinsics
  2322. #if JUCE_USE_INTRINSICS
  2323. #pragma intrinsic (_InterlockedExchange, _InterlockedIncrement, _InterlockedDecrement, _InterlockedCompareExchange, \
  2324. _InterlockedCompareExchange64, _InterlockedExchangeAdd, _ReadWriteBarrier)
  2325. #define juce_InterlockedExchange(a, b) _InterlockedExchange(a, b)
  2326. #define juce_InterlockedIncrement(a) _InterlockedIncrement(a)
  2327. #define juce_InterlockedDecrement(a) _InterlockedDecrement(a)
  2328. #define juce_InterlockedExchangeAdd(a, b) _InterlockedExchangeAdd(a, b)
  2329. #define juce_InterlockedCompareExchange(a, b, c) _InterlockedCompareExchange(a, b, c)
  2330. #define juce_InterlockedCompareExchange64(a, b, c) _InterlockedCompareExchange64(a, b, c)
  2331. #define juce_MemoryBarrier MemoryBarrier
  2332. #else
  2333. // (these are defined in juce_win32_Threads.cpp)
  2334. long juce_InterlockedExchange (volatile long* a, long b) throw();
  2335. long juce_InterlockedIncrement (volatile long* a) throw();
  2336. long juce_InterlockedDecrement (volatile long* a) throw();
  2337. long juce_InterlockedExchangeAdd (volatile long* a, long b) throw();
  2338. long juce_InterlockedCompareExchange (volatile long* a, long b, long c) throw();
  2339. __int64 juce_InterlockedCompareExchange64 (volatile __int64* a, __int64 b, __int64 c) throw();
  2340. static void juce_MemoryBarrier() throw() { long x = 0; juce_InterlockedIncrement (&x); }
  2341. #endif
  2342. #if JUCE_64BIT
  2343. #pragma intrinsic (_InterlockedExchangeAdd64, _InterlockedExchange64, _InterlockedIncrement64, _InterlockedDecrement64)
  2344. #define juce_InterlockedExchangeAdd64(a, b) _InterlockedExchangeAdd64(a, b)
  2345. #define juce_InterlockedExchange64(a, b) _InterlockedExchange64(a, b)
  2346. #define juce_InterlockedIncrement64(a) _InterlockedIncrement64(a)
  2347. #define juce_InterlockedDecrement64(a) _InterlockedDecrement64(a)
  2348. #else
  2349. // None of these atomics are available in a 32-bit Windows build!!
  2350. static __int64 juce_InterlockedExchangeAdd64 (volatile __int64* a, __int64 b) throw() { jassertfalse; __int64 old = *a; *a += b; return old; }
  2351. static __int64 juce_InterlockedExchange64 (volatile __int64* a, __int64 b) throw() { jassertfalse; __int64 old = *a; *a = b; return old; }
  2352. static __int64 juce_InterlockedIncrement64 (volatile __int64* a) throw() { jassertfalse; return ++*a; }
  2353. static __int64 juce_InterlockedDecrement64 (volatile __int64* a) throw() { jassertfalse; return --*a; }
  2354. #endif
  2355. #endif
  2356. template <typename Type>
  2357. inline Type Atomic<Type>::get() const throw()
  2358. {
  2359. return const_cast <Atomic<Type>*> (this)->operator+= (0);
  2360. }
  2361. template <typename Type>
  2362. inline void Atomic<Type>::set (const Type newValue) throw()
  2363. {
  2364. exchange (newValue);
  2365. }
  2366. template <typename Type>
  2367. Type Atomic<Type>::exchange (const Type newValue) throw()
  2368. {
  2369. #if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC
  2370. Type currentVal = value;
  2371. while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; }
  2372. return currentVal;
  2373. #elif JUCE_ATOMICS_WINDOWS
  2374. return sizeof (Type) == 4 ? (Type) juce_InterlockedExchange ((volatile long*) &value, (long) newValue)
  2375. : (Type) juce_InterlockedExchange64 ((volatile __int64*) &value, (__int64) newValue);
  2376. #endif
  2377. }
  2378. template <typename Type>
  2379. inline Type Atomic<Type>::operator+= (const Type amountToAdd) throw()
  2380. {
  2381. #if JUCE_ATOMICS_MAC
  2382. return sizeof (Type) == 4 ? (Type) OSAtomicAdd32 ((int32_t) amountToAdd, (int32_t*) &value)
  2383. : (Type) OSAtomicAdd64 ((int64_t) amountToAdd, (int64_t*) &value);
  2384. #elif JUCE_ATOMICS_WINDOWS
  2385. return sizeof (Type) == 4 ? (Type) (juce_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
  2386. : (Type) (juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
  2387. #elif JUCE_ATOMICS_GCC
  2388. return (Type) __sync_add_and_fetch (&value, amountToAdd);
  2389. #endif
  2390. }
  2391. template <typename Type>
  2392. inline Type Atomic<Type>::operator-= (const Type amountToSubtract) throw()
  2393. {
  2394. return operator+= (sizeof (Type) == 4 ? (Type) (-(int32) amountToSubtract)
  2395. : (Type) (-(int64) amountToSubtract));
  2396. }
  2397. template <typename Type>
  2398. inline Type Atomic<Type>::operator++() throw()
  2399. {
  2400. #if JUCE_ATOMICS_MAC
  2401. return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32 ((int32_t*) &value)
  2402. : (Type) OSAtomicIncrement64 ((int64_t*) &value);
  2403. #elif JUCE_ATOMICS_WINDOWS
  2404. return sizeof (Type) == 4 ? (Type) juce_InterlockedIncrement ((volatile long*) &value)
  2405. : (Type) juce_InterlockedIncrement64 ((volatile __int64*) &value);
  2406. #elif JUCE_ATOMICS_GCC
  2407. return (Type) __sync_add_and_fetch (&value, 1);
  2408. #endif
  2409. }
  2410. template <typename Type>
  2411. inline Type Atomic<Type>::operator--() throw()
  2412. {
  2413. #if JUCE_ATOMICS_MAC
  2414. return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32 ((int32_t*) &value)
  2415. : (Type) OSAtomicDecrement64 ((int64_t*) &value);
  2416. #elif JUCE_ATOMICS_WINDOWS
  2417. return sizeof (Type) == 4 ? (Type) juce_InterlockedDecrement ((volatile long*) &value)
  2418. : (Type) juce_InterlockedDecrement64 ((volatile __int64*) &value);
  2419. #elif JUCE_ATOMICS_GCC
  2420. return (Type) __sync_add_and_fetch (&value, -1);
  2421. #endif
  2422. }
  2423. template <typename Type>
  2424. inline bool Atomic<Type>::compareAndSetBool (const Type newValue, const Type valueToCompare) throw()
  2425. {
  2426. #if JUCE_ATOMICS_MAC
  2427. return sizeof (Type) == 4 ? (Type) OSAtomicCompareAndSwap32Barrier ((int32_t) valueToCompare, (int32_t) newValue, (int32_t*) &value)
  2428. : (Type) OSAtomicCompareAndSwap64Barrier ((int64_t) valueToCompare, (int64_t) newValue, (int64_t*) &value);
  2429. #elif JUCE_ATOMICS_WINDOWS
  2430. return compareAndSetValue (newValue, valueToCompare) == valueToCompare;
  2431. #elif JUCE_ATOMICS_GCC
  2432. return __sync_bool_compare_and_swap (&value, valueToCompare, newValue);
  2433. #endif
  2434. }
  2435. template <typename Type>
  2436. inline Type Atomic<Type>::compareAndSetValue (const Type newValue, const Type valueToCompare) throw()
  2437. {
  2438. #if JUCE_ATOMICS_MAC
  2439. for (;;) // Annoying workaround for OSX only having a bool CAS operation..
  2440. {
  2441. if (compareAndSetBool (newValue, valueToCompare))
  2442. return valueToCompare;
  2443. const Type result = value;
  2444. if (result != valueToCompare)
  2445. return result;
  2446. }
  2447. #elif JUCE_ATOMICS_WINDOWS
  2448. return sizeof (Type) == 4 ? (Type) juce_InterlockedCompareExchange ((volatile long*) &value, (long) newValue, (long) valueToCompare)
  2449. : (Type) juce_InterlockedCompareExchange64 ((volatile __int64*) &value, (__int64) newValue, (__int64) valueToCompare);
  2450. #elif JUCE_ATOMICS_GCC
  2451. return __sync_val_compare_and_swap (&value, valueToCompare, newValue);
  2452. #endif
  2453. }
  2454. template <typename Type>
  2455. inline void Atomic<Type>::memoryBarrier() throw()
  2456. {
  2457. #if JUCE_ATOMICS_MAC
  2458. OSMemoryBarrier();
  2459. #elif JUCE_ATOMICS_GCC
  2460. __sync_synchronize();
  2461. #elif JUCE_ATOMICS_WINDOWS
  2462. juce_MemoryBarrier();
  2463. #endif
  2464. }
  2465. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2466. /*** End of inlined file: juce_Atomic.h ***/
  2467. class JUCE_API ReferenceCountedObject
  2468. {
  2469. public:
  2470. inline void incReferenceCount() throw()
  2471. {
  2472. ++refCount;
  2473. }
  2474. inline void decReferenceCount() throw()
  2475. {
  2476. jassert (getReferenceCount() > 0);
  2477. if (--refCount == 0)
  2478. delete this;
  2479. }
  2480. inline int getReferenceCount() const throw()
  2481. {
  2482. return refCount.get();
  2483. }
  2484. protected:
  2485. ReferenceCountedObject()
  2486. {
  2487. }
  2488. virtual ~ReferenceCountedObject()
  2489. {
  2490. // it's dangerous to delete an object that's still referenced by something else!
  2491. jassert (getReferenceCount() == 0);
  2492. }
  2493. private:
  2494. Atomic <int> refCount;
  2495. };
  2496. template <class ReferenceCountedObjectClass>
  2497. class ReferenceCountedObjectPtr
  2498. {
  2499. public:
  2500. inline ReferenceCountedObjectPtr() throw()
  2501. : referencedObject (0)
  2502. {
  2503. }
  2504. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2505. : referencedObject (refCountedObject)
  2506. {
  2507. if (refCountedObject != 0)
  2508. refCountedObject->incReferenceCount();
  2509. }
  2510. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2511. : referencedObject (other.referencedObject)
  2512. {
  2513. if (referencedObject != 0)
  2514. referencedObject->incReferenceCount();
  2515. }
  2516. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2517. {
  2518. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2519. if (newObject != referencedObject)
  2520. {
  2521. if (newObject != 0)
  2522. newObject->incReferenceCount();
  2523. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2524. referencedObject = newObject;
  2525. if (oldObject != 0)
  2526. oldObject->decReferenceCount();
  2527. }
  2528. return *this;
  2529. }
  2530. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2531. {
  2532. if (referencedObject != newObject)
  2533. {
  2534. if (newObject != 0)
  2535. newObject->incReferenceCount();
  2536. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2537. referencedObject = newObject;
  2538. if (oldObject != 0)
  2539. oldObject->decReferenceCount();
  2540. }
  2541. return *this;
  2542. }
  2543. inline ~ReferenceCountedObjectPtr()
  2544. {
  2545. if (referencedObject != 0)
  2546. referencedObject->decReferenceCount();
  2547. }
  2548. inline operator ReferenceCountedObjectClass*() const throw()
  2549. {
  2550. return referencedObject;
  2551. }
  2552. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2553. {
  2554. return referencedObject == object;
  2555. }
  2556. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2557. {
  2558. return referencedObject != object;
  2559. }
  2560. // the -> operator is called on the referenced object
  2561. inline ReferenceCountedObjectClass* operator->() const throw()
  2562. {
  2563. return referencedObject;
  2564. }
  2565. inline ReferenceCountedObjectClass* getObject() const throw()
  2566. {
  2567. return referencedObject;
  2568. }
  2569. private:
  2570. ReferenceCountedObjectClass* referencedObject;
  2571. };
  2572. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2573. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2574. class JUCE_API DynamicObject : public ReferenceCountedObject
  2575. {
  2576. public:
  2577. DynamicObject();
  2578. virtual ~DynamicObject();
  2579. virtual bool hasProperty (const var::identifier& propertyName) const;
  2580. virtual const var getProperty (const var::identifier& propertyName) const;
  2581. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2582. virtual void removeProperty (const var::identifier& propertyName);
  2583. virtual bool hasMethod (const var::identifier& methodName) const;
  2584. virtual const var invokeMethod (const var::identifier& methodName,
  2585. const var* parameters,
  2586. int numParameters);
  2587. void setMethod (const var::identifier& methodName,
  2588. var::MethodFunction methodFunction);
  2589. void clear();
  2590. juce_UseDebuggingNewOperator
  2591. private:
  2592. NamedValueSet properties;
  2593. };
  2594. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2595. /*** End of inlined file: juce_DynamicObject.h ***/
  2596. #endif
  2597. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2598. #endif
  2599. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2600. #endif
  2601. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2602. #endif
  2603. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2604. #endif
  2605. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2606. /*** Start of inlined file: juce_OwnedArray.h ***/
  2607. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2608. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2609. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2610. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2611. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2612. template <class ObjectType>
  2613. class ScopedPointer
  2614. {
  2615. public:
  2616. inline ScopedPointer() throw() : object (0)
  2617. {
  2618. }
  2619. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2620. : object (objectToTakePossessionOf)
  2621. {
  2622. }
  2623. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2624. : object (objectToTransferFrom.object)
  2625. {
  2626. objectToTransferFrom.object = 0;
  2627. }
  2628. inline ~ScopedPointer() { delete object; }
  2629. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2630. {
  2631. if (this != objectToTransferFrom.getAddress())
  2632. {
  2633. // Two ScopedPointers should never be able to refer to the same object - if
  2634. // this happens, you must have done something dodgy!
  2635. jassert (object == 0 || object != objectToTransferFrom.object);
  2636. ObjectType* const oldObject = object;
  2637. object = objectToTransferFrom.object;
  2638. objectToTransferFrom.object = 0;
  2639. delete oldObject;
  2640. }
  2641. return *this;
  2642. }
  2643. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2644. {
  2645. if (object != newObjectToTakePossessionOf)
  2646. {
  2647. ObjectType* const oldObject = object;
  2648. object = newObjectToTakePossessionOf;
  2649. delete oldObject;
  2650. }
  2651. return *this;
  2652. }
  2653. inline operator ObjectType*() const throw() { return object; }
  2654. inline ObjectType& operator*() const throw() { return *object; }
  2655. inline ObjectType* operator->() const throw() { return object; }
  2656. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2657. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2658. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2659. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2660. {
  2661. // Two ScopedPointers should never be able to refer to the same object - if
  2662. // this happens, you must have done something dodgy!
  2663. jassert (object != other.object);
  2664. swapVariables (object, other.object);
  2665. }
  2666. private:
  2667. ObjectType* object;
  2668. // (Required as an alternative to the overloaded & operator).
  2669. const ScopedPointer* getAddress() const throw() { return this; }
  2670. #if ! JUCE_MSVC // (MSVC can't deal with multiple copy constructors)
  2671. // This is private to stop people accidentally copying a const ScopedPointer (the compiler
  2672. // will let you do so by implicitly casting the source to its raw object pointer).
  2673. ScopedPointer (const ScopedPointer&);
  2674. #endif
  2675. };
  2676. template <class ObjectType>
  2677. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2678. {
  2679. return static_cast <ObjectType*> (pointer1) == pointer2;
  2680. }
  2681. template <class ObjectType>
  2682. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2683. {
  2684. return static_cast <ObjectType*> (pointer1) != pointer2;
  2685. }
  2686. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2687. /*** End of inlined file: juce_ScopedPointer.h ***/
  2688. template <class ObjectClass,
  2689. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2690. class OwnedArray
  2691. {
  2692. public:
  2693. OwnedArray() throw()
  2694. : numUsed (0)
  2695. {
  2696. }
  2697. ~OwnedArray()
  2698. {
  2699. clear (true);
  2700. }
  2701. void clear (const bool deleteObjects = true)
  2702. {
  2703. const ScopedLockType lock (getLock());
  2704. if (deleteObjects)
  2705. {
  2706. while (numUsed > 0)
  2707. delete data.elements [--numUsed];
  2708. }
  2709. data.setAllocatedSize (0);
  2710. numUsed = 0;
  2711. }
  2712. inline int size() const throw()
  2713. {
  2714. return numUsed;
  2715. }
  2716. inline ObjectClass* operator[] (const int index) const throw()
  2717. {
  2718. const ScopedLockType lock (getLock());
  2719. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2720. : static_cast <ObjectClass*> (0);
  2721. }
  2722. inline ObjectClass* getUnchecked (const int index) const throw()
  2723. {
  2724. const ScopedLockType lock (getLock());
  2725. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2726. return data.elements [index];
  2727. }
  2728. inline ObjectClass* getFirst() const throw()
  2729. {
  2730. const ScopedLockType lock (getLock());
  2731. return numUsed > 0 ? data.elements [0]
  2732. : static_cast <ObjectClass*> (0);
  2733. }
  2734. inline ObjectClass* getLast() const throw()
  2735. {
  2736. const ScopedLockType lock (getLock());
  2737. return numUsed > 0 ? data.elements [numUsed - 1]
  2738. : static_cast <ObjectClass*> (0);
  2739. }
  2740. inline ObjectClass** getRawDataPointer() throw()
  2741. {
  2742. return data.elements;
  2743. }
  2744. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2745. {
  2746. const ScopedLockType lock (getLock());
  2747. ObjectClass* const* e = data.elements.getData();
  2748. ObjectClass* const* const end = e + numUsed;
  2749. while (e != end)
  2750. {
  2751. if (objectToLookFor == *e)
  2752. return static_cast <int> (e - data.elements.getData());
  2753. ++e;
  2754. }
  2755. return -1;
  2756. }
  2757. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2758. {
  2759. const ScopedLockType lock (getLock());
  2760. ObjectClass* const* e = data.elements.getData();
  2761. ObjectClass* const* const end = e + numUsed;
  2762. while (e != end)
  2763. {
  2764. if (objectToLookFor == *e)
  2765. return true;
  2766. ++e;
  2767. }
  2768. return false;
  2769. }
  2770. void add (const ObjectClass* const newObject) throw()
  2771. {
  2772. const ScopedLockType lock (getLock());
  2773. data.ensureAllocatedSize (numUsed + 1);
  2774. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2775. }
  2776. void insert (int indexToInsertAt,
  2777. const ObjectClass* const newObject) throw()
  2778. {
  2779. if (indexToInsertAt >= 0)
  2780. {
  2781. const ScopedLockType lock (getLock());
  2782. if (indexToInsertAt > numUsed)
  2783. indexToInsertAt = numUsed;
  2784. data.ensureAllocatedSize (numUsed + 1);
  2785. ObjectClass** const e = data.elements + indexToInsertAt;
  2786. const int numToMove = numUsed - indexToInsertAt;
  2787. if (numToMove > 0)
  2788. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2789. *e = const_cast <ObjectClass*> (newObject);
  2790. ++numUsed;
  2791. }
  2792. else
  2793. {
  2794. add (newObject);
  2795. }
  2796. }
  2797. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2798. {
  2799. const ScopedLockType lock (getLock());
  2800. if (! contains (newObject))
  2801. add (newObject);
  2802. }
  2803. void set (const int indexToChange,
  2804. const ObjectClass* const newObject,
  2805. const bool deleteOldElement = true)
  2806. {
  2807. if (indexToChange >= 0)
  2808. {
  2809. ScopedPointer <ObjectClass> toDelete;
  2810. const ScopedLockType lock (getLock());
  2811. if (indexToChange < numUsed)
  2812. {
  2813. if (deleteOldElement)
  2814. {
  2815. toDelete = data.elements [indexToChange];
  2816. if (toDelete == newObject)
  2817. toDelete = 0;
  2818. }
  2819. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2820. }
  2821. else
  2822. {
  2823. data.ensureAllocatedSize (numUsed + 1);
  2824. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2825. }
  2826. }
  2827. }
  2828. template <class OtherArrayType>
  2829. void addArray (const OtherArrayType& arrayToAddFrom,
  2830. int startIndex = 0,
  2831. int numElementsToAdd = -1)
  2832. {
  2833. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2834. const ScopedLockType lock2 (getLock());
  2835. if (startIndex < 0)
  2836. {
  2837. jassertfalse
  2838. startIndex = 0;
  2839. }
  2840. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2841. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2842. while (--numElementsToAdd >= 0)
  2843. add (arrayToAddFrom.getUnchecked (startIndex++));
  2844. }
  2845. template <class ElementComparator>
  2846. void addSorted (ElementComparator& comparator,
  2847. ObjectClass* const newObject) throw()
  2848. {
  2849. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2850. // avoids getting warning messages about the parameter being unused
  2851. const ScopedLockType lock (getLock());
  2852. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2853. }
  2854. template <class ElementComparator>
  2855. int indexOfSorted (ElementComparator& comparator,
  2856. const ObjectClass* const objectToLookFor) const throw()
  2857. {
  2858. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2859. // avoids getting warning messages about the parameter being unused
  2860. const ScopedLockType lock (getLock());
  2861. int start = 0;
  2862. int end = numUsed;
  2863. for (;;)
  2864. {
  2865. if (start >= end)
  2866. {
  2867. return -1;
  2868. }
  2869. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2870. {
  2871. return start;
  2872. }
  2873. else
  2874. {
  2875. const int halfway = (start + end) >> 1;
  2876. if (halfway == start)
  2877. return -1;
  2878. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2879. start = halfway;
  2880. else
  2881. end = halfway;
  2882. }
  2883. }
  2884. }
  2885. void remove (const int indexToRemove,
  2886. const bool deleteObject = true)
  2887. {
  2888. ScopedPointer <ObjectClass> toDelete;
  2889. const ScopedLockType lock (getLock());
  2890. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2891. {
  2892. ObjectClass** const e = data.elements + indexToRemove;
  2893. if (deleteObject)
  2894. toDelete = *e;
  2895. --numUsed;
  2896. const int numToShift = numUsed - indexToRemove;
  2897. if (numToShift > 0)
  2898. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2899. if ((numUsed << 1) < data.numAllocated)
  2900. minimiseStorageOverheads();
  2901. }
  2902. }
  2903. void removeObject (const ObjectClass* const objectToRemove,
  2904. const bool deleteObject = true)
  2905. {
  2906. const ScopedLockType lock (getLock());
  2907. ObjectClass** e = data.elements.getData();
  2908. for (int i = numUsed; --i >= 0;)
  2909. {
  2910. if (objectToRemove == *e)
  2911. {
  2912. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2913. break;
  2914. }
  2915. ++e;
  2916. }
  2917. }
  2918. void removeRange (int startIndex,
  2919. const int numberToRemove,
  2920. const bool deleteObjects = true)
  2921. {
  2922. const ScopedLockType lock (getLock());
  2923. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2924. startIndex = jlimit (0, numUsed, startIndex);
  2925. if (endIndex > startIndex)
  2926. {
  2927. if (deleteObjects)
  2928. {
  2929. for (int i = startIndex; i < endIndex; ++i)
  2930. {
  2931. delete data.elements [i];
  2932. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2933. }
  2934. }
  2935. const int rangeSize = endIndex - startIndex;
  2936. ObjectClass** e = data.elements + startIndex;
  2937. int numToShift = numUsed - endIndex;
  2938. numUsed -= rangeSize;
  2939. while (--numToShift >= 0)
  2940. {
  2941. *e = e [rangeSize];
  2942. ++e;
  2943. }
  2944. if ((numUsed << 1) < data.numAllocated)
  2945. minimiseStorageOverheads();
  2946. }
  2947. }
  2948. void removeLast (int howManyToRemove = 1,
  2949. const bool deleteObjects = true)
  2950. {
  2951. const ScopedLockType lock (getLock());
  2952. if (howManyToRemove >= numUsed)
  2953. {
  2954. clear (deleteObjects);
  2955. }
  2956. else
  2957. {
  2958. while (--howManyToRemove >= 0)
  2959. remove (numUsed - 1, deleteObjects);
  2960. }
  2961. }
  2962. void swap (const int index1,
  2963. const int index2) throw()
  2964. {
  2965. const ScopedLockType lock (getLock());
  2966. if (((unsigned int) index1) < (unsigned int) numUsed
  2967. && ((unsigned int) index2) < (unsigned int) numUsed)
  2968. {
  2969. swapVariables (data.elements [index1],
  2970. data.elements [index2]);
  2971. }
  2972. }
  2973. void move (const int currentIndex,
  2974. int newIndex) throw()
  2975. {
  2976. if (currentIndex != newIndex)
  2977. {
  2978. const ScopedLockType lock (getLock());
  2979. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2980. {
  2981. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2982. newIndex = numUsed - 1;
  2983. ObjectClass* const value = data.elements [currentIndex];
  2984. if (newIndex > currentIndex)
  2985. {
  2986. memmove (data.elements + currentIndex,
  2987. data.elements + currentIndex + 1,
  2988. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2989. }
  2990. else
  2991. {
  2992. memmove (data.elements + newIndex + 1,
  2993. data.elements + newIndex,
  2994. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2995. }
  2996. data.elements [newIndex] = value;
  2997. }
  2998. }
  2999. }
  3000. void swapWithArray (OwnedArray& otherArray) throw()
  3001. {
  3002. const ScopedLockType lock1 (getLock());
  3003. const ScopedLockType lock2 (otherArray.getLock());
  3004. data.swapWith (otherArray.data);
  3005. swapVariables (numUsed, otherArray.numUsed);
  3006. }
  3007. void minimiseStorageOverheads() throw()
  3008. {
  3009. const ScopedLockType lock (getLock());
  3010. data.shrinkToNoMoreThan (numUsed);
  3011. }
  3012. void ensureStorageAllocated (const int minNumElements) throw()
  3013. {
  3014. const ScopedLockType lock (getLock());
  3015. data.ensureAllocatedSize (minNumElements);
  3016. }
  3017. template <class ElementComparator>
  3018. void sort (ElementComparator& comparator,
  3019. const bool retainOrderOfEquivalentItems = false) const throw()
  3020. {
  3021. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3022. // avoids getting warning messages about the parameter being unused
  3023. const ScopedLockType lock (getLock());
  3024. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3025. }
  3026. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3027. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3028. juce_UseDebuggingNewOperator
  3029. private:
  3030. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3031. int numUsed;
  3032. // disallow copy constructor and assignment
  3033. OwnedArray (const OwnedArray&);
  3034. OwnedArray& operator= (const OwnedArray&);
  3035. };
  3036. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  3037. /*** End of inlined file: juce_OwnedArray.h ***/
  3038. #endif
  3039. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  3040. /*** Start of inlined file: juce_PropertySet.h ***/
  3041. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  3042. #define __JUCE_PROPERTYSET_JUCEHEADER__
  3043. /*** Start of inlined file: juce_StringPairArray.h ***/
  3044. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3045. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3046. /*** Start of inlined file: juce_StringArray.h ***/
  3047. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  3048. #define __JUCE_STRINGARRAY_JUCEHEADER__
  3049. class JUCE_API StringArray
  3050. {
  3051. public:
  3052. StringArray() throw();
  3053. StringArray (const StringArray& other);
  3054. explicit StringArray (const String& firstValue);
  3055. StringArray (const juce_wchar** strings, int numberOfStrings);
  3056. StringArray (const char** strings, int numberOfStrings);
  3057. explicit StringArray (const juce_wchar** strings);
  3058. explicit StringArray (const char** strings);
  3059. ~StringArray();
  3060. StringArray& operator= (const StringArray& other);
  3061. bool operator== (const StringArray& other) const throw();
  3062. bool operator!= (const StringArray& other) const throw();
  3063. inline int size() const throw() { return strings.size(); };
  3064. const String& operator[] (int index) const throw();
  3065. String& getReference (int index) throw();
  3066. bool contains (const String& stringToLookFor,
  3067. bool ignoreCase = false) const;
  3068. int indexOf (const String& stringToLookFor,
  3069. bool ignoreCase = false,
  3070. int startIndex = 0) const;
  3071. void add (const String& stringToAdd);
  3072. void insert (int index, const String& stringToAdd);
  3073. void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
  3074. void set (int index, const String& newString);
  3075. void addArray (const StringArray& other,
  3076. int startIndex = 0,
  3077. int numElementsToAdd = -1);
  3078. int addTokens (const String& stringToTokenise,
  3079. bool preserveQuotedStrings);
  3080. int addTokens (const String& stringToTokenise,
  3081. const String& breakCharacters,
  3082. const String& quoteCharacters);
  3083. int addLines (const String& stringToBreakUp);
  3084. void clear();
  3085. void remove (int index);
  3086. void removeString (const String& stringToRemove,
  3087. bool ignoreCase = false);
  3088. void removeRange (int startIndex, int numberToRemove);
  3089. void removeDuplicates (bool ignoreCase);
  3090. void removeEmptyStrings (bool removeWhitespaceStrings = true);
  3091. void move (int currentIndex, int newIndex) throw();
  3092. void trim();
  3093. void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
  3094. bool appendNumberToFirstInstance,
  3095. const juce_wchar* preNumberString = 0,
  3096. const juce_wchar* postNumberString = 0);
  3097. const String joinIntoString (const String& separatorString,
  3098. int startIndex = 0,
  3099. int numberOfElements = -1) const;
  3100. void sort (bool ignoreCase);
  3101. void minimiseStorageOverheads();
  3102. juce_UseDebuggingNewOperator
  3103. private:
  3104. Array <String> strings;
  3105. };
  3106. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  3107. /*** End of inlined file: juce_StringArray.h ***/
  3108. class JUCE_API StringPairArray
  3109. {
  3110. public:
  3111. StringPairArray (bool ignoreCaseWhenComparingKeys = true);
  3112. StringPairArray (const StringPairArray& other);
  3113. ~StringPairArray();
  3114. StringPairArray& operator= (const StringPairArray& other);
  3115. bool operator== (const StringPairArray& other) const;
  3116. bool operator!= (const StringPairArray& other) const;
  3117. const String& operator[] (const String& key) const;
  3118. const String getValue (const String& key, const String& defaultReturnValue) const;
  3119. const StringArray& getAllKeys() const throw() { return keys; }
  3120. const StringArray& getAllValues() const throw() { return values; }
  3121. inline int size() const throw() { return keys.size(); };
  3122. void set (const String& key, const String& value);
  3123. void addArray (const StringPairArray& other);
  3124. void clear();
  3125. void remove (const String& key);
  3126. void remove (int index);
  3127. void setIgnoresCase (bool shouldIgnoreCase);
  3128. const String getDescription() const;
  3129. void minimiseStorageOverheads();
  3130. juce_UseDebuggingNewOperator
  3131. private:
  3132. StringArray keys, values;
  3133. bool ignoreCase;
  3134. };
  3135. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3136. /*** End of inlined file: juce_StringPairArray.h ***/
  3137. /*** Start of inlined file: juce_XmlElement.h ***/
  3138. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3139. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3140. /*** Start of inlined file: juce_File.h ***/
  3141. #ifndef __JUCE_FILE_JUCEHEADER__
  3142. #define __JUCE_FILE_JUCEHEADER__
  3143. /*** Start of inlined file: juce_Time.h ***/
  3144. #ifndef __JUCE_TIME_JUCEHEADER__
  3145. #define __JUCE_TIME_JUCEHEADER__
  3146. /*** Start of inlined file: juce_RelativeTime.h ***/
  3147. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3148. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3149. class JUCE_API RelativeTime
  3150. {
  3151. public:
  3152. explicit RelativeTime (double seconds = 0.0) throw();
  3153. RelativeTime (const RelativeTime& other) throw();
  3154. RelativeTime& operator= (const RelativeTime& other) throw();
  3155. ~RelativeTime() throw();
  3156. static const RelativeTime milliseconds (int milliseconds) throw();
  3157. static const RelativeTime milliseconds (int64 milliseconds) throw();
  3158. static const RelativeTime minutes (double numberOfMinutes) throw();
  3159. static const RelativeTime hours (double numberOfHours) throw();
  3160. static const RelativeTime days (double numberOfDays) throw();
  3161. static const RelativeTime weeks (double numberOfWeeks) throw();
  3162. int64 inMilliseconds() const throw();
  3163. double inSeconds() const throw() { return seconds; }
  3164. double inMinutes() const throw();
  3165. double inHours() const throw();
  3166. double inDays() const throw();
  3167. double inWeeks() const throw();
  3168. const String getDescription (const String& returnValueForZeroTime = "0") const throw();
  3169. bool operator== (const RelativeTime& other) const throw();
  3170. bool operator!= (const RelativeTime& other) const throw();
  3171. bool operator> (const RelativeTime& other) const throw();
  3172. bool operator< (const RelativeTime& other) const throw();
  3173. bool operator>= (const RelativeTime& other) const throw();
  3174. bool operator<= (const RelativeTime& other) const throw();
  3175. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3176. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3177. const RelativeTime operator+ (double secondsToAdd) const throw();
  3178. const RelativeTime operator- (double secondsToSubtract) const throw();
  3179. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3180. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3181. const RelativeTime& operator+= (double secondsToAdd) throw();
  3182. const RelativeTime& operator-= (double secondsToSubtract) throw();
  3183. juce_UseDebuggingNewOperator
  3184. private:
  3185. double seconds;
  3186. };
  3187. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3188. /*** End of inlined file: juce_RelativeTime.h ***/
  3189. class JUCE_API Time
  3190. {
  3191. public:
  3192. Time() throw();
  3193. Time (const Time& other) throw();
  3194. Time (int64 millisecondsSinceEpoch) throw();
  3195. Time (int year,
  3196. int month,
  3197. int day,
  3198. int hours,
  3199. int minutes,
  3200. int seconds = 0,
  3201. int milliseconds = 0,
  3202. bool useLocalTime = true) throw();
  3203. ~Time() throw();
  3204. Time& operator= (const Time& other) throw();
  3205. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3206. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3207. int getYear() const throw();
  3208. int getMonth() const throw();
  3209. const String getMonthName (bool threeLetterVersion) const throw();
  3210. int getDayOfMonth() const throw();
  3211. int getDayOfWeek() const throw();
  3212. const String getWeekdayName (bool threeLetterVersion) const throw();
  3213. int getHours() const throw();
  3214. bool isAfternoon() const throw();
  3215. int getHoursInAmPmFormat() const throw();
  3216. int getMinutes() const throw();
  3217. int getSeconds() const throw();
  3218. int getMilliseconds() const throw();
  3219. bool isDaylightSavingTime() const throw();
  3220. const String getTimeZone() const throw();
  3221. const String toString (bool includeDate,
  3222. bool includeTime,
  3223. bool includeSeconds = true,
  3224. bool use24HourClock = false) const throw();
  3225. const String formatted (const String& format) const throw();
  3226. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3227. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3228. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3229. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3230. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3231. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3232. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3233. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3234. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3235. bool setSystemTimeToThisTime() const throw();
  3236. static const String getWeekdayName (int dayNumber,
  3237. bool threeLetterVersion) throw();
  3238. static const String getMonthName (int monthNumber,
  3239. bool threeLetterVersion) throw();
  3240. // Static methods for getting system timers directly..
  3241. static int64 currentTimeMillis() throw();
  3242. static uint32 getMillisecondCounter() throw();
  3243. static double getMillisecondCounterHiRes() throw();
  3244. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3245. static uint32 getApproximateMillisecondCounter() throw();
  3246. // High-resolution timers..
  3247. static int64 getHighResolutionTicks() throw();
  3248. static int64 getHighResolutionTicksPerSecond() throw();
  3249. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3250. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3251. private:
  3252. int64 millisSinceEpoch;
  3253. };
  3254. #endif // __JUCE_TIME_JUCEHEADER__
  3255. /*** End of inlined file: juce_Time.h ***/
  3256. class FileInputStream;
  3257. class FileOutputStream;
  3258. class JUCE_API File
  3259. {
  3260. public:
  3261. File() {}
  3262. File (const String& path);
  3263. File (const File& other);
  3264. ~File() {}
  3265. File& operator= (const String& newFilePath);
  3266. File& operator= (const File& otherFile);
  3267. static const File nonexistent;
  3268. bool exists() const;
  3269. bool existsAsFile() const;
  3270. bool isDirectory() const;
  3271. int64 getSize() const;
  3272. static const String descriptionOfSizeInBytes (int64 bytes);
  3273. const String& getFullPathName() const throw() { return fullPath; }
  3274. const String getFileName() const;
  3275. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3276. const String getFileExtension() const;
  3277. bool hasFileExtension (const String& extensionToTest) const;
  3278. const File withFileExtension (const String& newExtension) const;
  3279. const String getFileNameWithoutExtension() const;
  3280. int hashCode() const;
  3281. int64 hashCode64() const;
  3282. const File getChildFile (String relativePath) const;
  3283. const File getSiblingFile (const String& siblingFileName) const;
  3284. const File getParentDirectory() const;
  3285. bool isAChildOf (const File& potentialParentDirectory) const;
  3286. const File getNonexistentChildFile (const String& prefix,
  3287. const String& suffix,
  3288. bool putNumbersInBrackets = true) const;
  3289. const File getNonexistentSibling (bool putNumbersInBrackets = true) const;
  3290. bool operator== (const File& otherFile) const;
  3291. bool operator!= (const File& otherFile) const;
  3292. bool operator< (const File& otherFile) const;
  3293. bool operator> (const File& otherFile) const;
  3294. bool hasWriteAccess() const;
  3295. bool setReadOnly (bool shouldBeReadOnly,
  3296. bool applyRecursively = false) const;
  3297. bool isHidden() const;
  3298. const File getLinkedTarget() const;
  3299. const Time getLastModificationTime() const;
  3300. const Time getLastAccessTime() const;
  3301. const Time getCreationTime() const;
  3302. bool setLastModificationTime (const Time& newTime) const;
  3303. bool setLastAccessTime (const Time& newTime) const;
  3304. bool setCreationTime (const Time& newTime) const;
  3305. const String getVersion() const;
  3306. bool create() const;
  3307. bool createDirectory() const;
  3308. bool deleteFile() const;
  3309. bool deleteRecursively() const;
  3310. bool moveToTrash() const;
  3311. bool moveFileTo (const File& targetLocation) const;
  3312. bool copyFileTo (const File& targetLocation) const;
  3313. bool copyDirectoryTo (const File& newDirectory) const;
  3314. enum TypesOfFileToFind
  3315. {
  3316. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3317. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3318. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3319. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3320. };
  3321. int findChildFiles (Array<File>& results,
  3322. int whatToLookFor,
  3323. bool searchRecursively,
  3324. const String& wildCardPattern = "*") const;
  3325. int getNumberOfChildFiles (int whatToLookFor,
  3326. const String& wildCardPattern = "*") const;
  3327. bool containsSubDirectories() const;
  3328. FileInputStream* createInputStream() const;
  3329. FileOutputStream* createOutputStream (int bufferSize = 0x8000) const;
  3330. bool loadFileAsData (MemoryBlock& result) const;
  3331. const String loadFileAsString() const;
  3332. bool appendData (const void* dataToAppend,
  3333. int numberOfBytes) const;
  3334. bool replaceWithData (const void* dataToWrite,
  3335. int numberOfBytes) const;
  3336. bool appendText (const String& textToAppend,
  3337. bool asUnicode = false,
  3338. bool writeUnicodeHeaderBytes = false) const;
  3339. bool replaceWithText (const String& textToWrite,
  3340. bool asUnicode = false,
  3341. bool writeUnicodeHeaderBytes = false) const;
  3342. static void findFileSystemRoots (Array<File>& results);
  3343. const String getVolumeLabel() const;
  3344. int getVolumeSerialNumber() const;
  3345. int64 getBytesFreeOnVolume() const;
  3346. int64 getVolumeTotalSize() const;
  3347. bool isOnCDRomDrive() const;
  3348. bool isOnHardDisk() const;
  3349. bool isOnRemovableDrive() const;
  3350. bool startAsProcess (const String& parameters = String::empty) const;
  3351. void revealToUser() const;
  3352. enum SpecialLocationType
  3353. {
  3354. userHomeDirectory,
  3355. userDocumentsDirectory,
  3356. userDesktopDirectory,
  3357. userApplicationDataDirectory,
  3358. commonApplicationDataDirectory,
  3359. tempDirectory,
  3360. currentExecutableFile,
  3361. currentApplicationFile,
  3362. invokedExecutableFile,
  3363. globalApplicationsDirectory,
  3364. userMusicDirectory,
  3365. userMoviesDirectory,
  3366. };
  3367. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3368. static const File createTempFile (const String& fileNameEnding);
  3369. static const File getCurrentWorkingDirectory();
  3370. bool setAsCurrentWorkingDirectory() const;
  3371. static const juce_wchar separator;
  3372. static const String separatorString;
  3373. static const String createLegalFileName (const String& fileNameToFix);
  3374. static const String createLegalPathName (const String& pathNameToFix);
  3375. static bool areFileNamesCaseSensitive();
  3376. static bool isAbsolutePath (const String& path);
  3377. static const File createFileWithoutCheckingPath (const String& path);
  3378. static const String addTrailingSeparator (const String& path);
  3379. juce_UseDebuggingNewOperator
  3380. private:
  3381. String fullPath;
  3382. // internal way of contructing a file without checking the path
  3383. friend class DirectoryIterator;
  3384. File (const String&, int);
  3385. const String getPathUpToLastSlash() const;
  3386. void createDirectoryInternal (const String& fileName) const;
  3387. bool copyInternal (const File& dest) const;
  3388. bool moveInternal (const File& dest) const;
  3389. bool setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 creationTime) const;
  3390. void getFileTimesInternal (int64& modificationTime, int64& accessTime, int64& creationTime) const;
  3391. bool setFileReadOnlyInternal (bool shouldBeReadOnly) const;
  3392. static const String parseAbsolutePath (const String& path);
  3393. static bool fileTypeMatches (int whatToLookFor, bool isDir, bool isHidden);
  3394. };
  3395. #endif // __JUCE_FILE_JUCEHEADER__
  3396. /*** End of inlined file: juce_File.h ***/
  3397. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3398. \
  3399. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3400. childElementVariableName != 0; \
  3401. childElementVariableName = childElementVariableName->getNextElement())
  3402. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3403. \
  3404. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3405. childElementVariableName != 0; \
  3406. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3407. class JUCE_API XmlElement
  3408. {
  3409. public:
  3410. explicit XmlElement (const String& tagName) throw();
  3411. XmlElement (const XmlElement& other) throw();
  3412. XmlElement& operator= (const XmlElement& other) throw();
  3413. ~XmlElement() throw();
  3414. bool isEquivalentTo (const XmlElement* other,
  3415. bool ignoreOrderOfAttributes) const throw();
  3416. const String createDocument (const String& dtdToUse,
  3417. bool allOnOneLine = false,
  3418. bool includeXmlHeader = true,
  3419. const String& encodingType = "UTF-8",
  3420. int lineWrapLength = 60) const;
  3421. void writeToStream (OutputStream& output,
  3422. const String& dtdToUse,
  3423. bool allOnOneLine = false,
  3424. bool includeXmlHeader = true,
  3425. const String& encodingType = "UTF-8",
  3426. int lineWrapLength = 60) const;
  3427. bool writeToFile (const File& destinationFile,
  3428. const String& dtdToUse,
  3429. const String& encodingType = "UTF-8",
  3430. int lineWrapLength = 60) const;
  3431. inline const String& getTagName() const throw() { return tagName; }
  3432. bool hasTagName (const String& possibleTagName) const throw();
  3433. int getNumAttributes() const throw();
  3434. const String& getAttributeName (int attributeIndex) const throw();
  3435. const String& getAttributeValue (int attributeIndex) const throw();
  3436. // Attribute-handling methods..
  3437. bool hasAttribute (const String& attributeName) const throw();
  3438. const String& getStringAttribute (const String& attributeName) const throw();
  3439. const String getStringAttribute (const String& attributeName,
  3440. const String& defaultReturnValue) const;
  3441. bool compareAttribute (const String& attributeName,
  3442. const String& stringToCompareAgainst,
  3443. bool ignoreCase = false) const throw();
  3444. int getIntAttribute (const String& attributeName,
  3445. int defaultReturnValue = 0) const;
  3446. double getDoubleAttribute (const String& attributeName,
  3447. double defaultReturnValue = 0.0) const;
  3448. bool getBoolAttribute (const String& attributeName,
  3449. bool defaultReturnValue = false) const;
  3450. void setAttribute (const String& attributeName,
  3451. const String& newValue);
  3452. void setAttribute (const String& attributeName,
  3453. int newValue);
  3454. void setAttribute (const String& attributeName,
  3455. double newValue);
  3456. void removeAttribute (const String& attributeName) throw();
  3457. void removeAllAttributes() throw();
  3458. // Child element methods..
  3459. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3460. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3461. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3462. int getNumChildElements() const throw();
  3463. XmlElement* getChildElement (int index) const throw();
  3464. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3465. void addChildElement (XmlElement* const newChildElement) throw();
  3466. void insertChildElement (XmlElement* newChildNode,
  3467. int indexToInsertAt) throw();
  3468. XmlElement* createNewChildElement (const String& tagName);
  3469. bool replaceChildElement (XmlElement* currentChildElement,
  3470. XmlElement* newChildNode) throw();
  3471. void removeChildElement (XmlElement* childToRemove,
  3472. bool shouldDeleteTheChild) throw();
  3473. void deleteAllChildElements() throw();
  3474. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3475. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3476. XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
  3477. template <class ElementComparator>
  3478. void sortChildElements (ElementComparator& comparator,
  3479. const bool retainOrderOfEquivalentItems = false) throw()
  3480. {
  3481. const int num = getNumChildElements();
  3482. if (num > 1)
  3483. {
  3484. HeapBlock <XmlElement*> elems (num);
  3485. getChildElementsAsArray (elems);
  3486. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3487. reorderChildElements (elems, num);
  3488. }
  3489. }
  3490. bool isTextElement() const throw();
  3491. const String getText() const throw();
  3492. void setText (const String& newText) throw();
  3493. const String getAllSubText() const throw();
  3494. const String getChildElementAllSubText (const String& childTagName,
  3495. const String& defaultReturnValue) const throw();
  3496. void addTextElement (const String& text) throw();
  3497. void deleteAllTextElements() throw();
  3498. static XmlElement* createTextElement (const String& text) throw();
  3499. juce_UseDebuggingNewOperator
  3500. private:
  3501. friend class XmlDocument;
  3502. String tagName;
  3503. XmlElement* firstChildElement;
  3504. XmlElement* nextElement;
  3505. struct XmlAttributeNode
  3506. {
  3507. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3508. XmlAttributeNode (const String& name, const String& value) throw();
  3509. String name, value;
  3510. XmlAttributeNode* next;
  3511. private:
  3512. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3513. };
  3514. XmlAttributeNode* attributes;
  3515. XmlElement (int) throw();
  3516. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3517. void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
  3518. void getChildElementsAsArray (XmlElement**) const throw();
  3519. void reorderChildElements (XmlElement** const, const int) throw();
  3520. };
  3521. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3522. /*** End of inlined file: juce_XmlElement.h ***/
  3523. class JUCE_API PropertySet
  3524. {
  3525. public:
  3526. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3527. PropertySet (const PropertySet& other) throw();
  3528. PropertySet& operator= (const PropertySet& other) throw();
  3529. virtual ~PropertySet();
  3530. const String getValue (const String& keyName,
  3531. const String& defaultReturnValue = String::empty) const throw();
  3532. int getIntValue (const String& keyName,
  3533. const int defaultReturnValue = 0) const throw();
  3534. double getDoubleValue (const String& keyName,
  3535. const double defaultReturnValue = 0.0) const throw();
  3536. bool getBoolValue (const String& keyName,
  3537. const bool defaultReturnValue = false) const throw();
  3538. XmlElement* getXmlValue (const String& keyName) const;
  3539. void setValue (const String& keyName, const String& value) throw();
  3540. void setValue (const String& keyName, const int value) throw();
  3541. void setValue (const String& keyName, const double value) throw();
  3542. void setValue (const String& keyName, const bool value) throw();
  3543. void setValue (const String& keyName, const XmlElement* const xml);
  3544. void removeValue (const String& keyName) throw();
  3545. bool containsKey (const String& keyName) const throw();
  3546. void clear();
  3547. StringPairArray& getAllProperties() throw() { return properties; }
  3548. const CriticalSection& getLock() const throw() { return lock; }
  3549. XmlElement* createXml (const String& nodeName) const throw();
  3550. void restoreFromXml (const XmlElement& xml) throw();
  3551. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3552. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3553. juce_UseDebuggingNewOperator
  3554. protected:
  3555. virtual void propertyChanged();
  3556. private:
  3557. StringPairArray properties;
  3558. PropertySet* fallbackProperties;
  3559. CriticalSection lock;
  3560. bool ignoreCaseOfKeys;
  3561. };
  3562. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3563. /*** End of inlined file: juce_PropertySet.h ***/
  3564. #endif
  3565. #ifndef __JUCE_RANGE_JUCEHEADER__
  3566. /*** Start of inlined file: juce_Range.h ***/
  3567. #ifndef __JUCE_RANGE_JUCEHEADER__
  3568. #define __JUCE_RANGE_JUCEHEADER__
  3569. template <typename ValueType>
  3570. class Range
  3571. {
  3572. public:
  3573. Range() throw()
  3574. : start (ValueType()), end (ValueType())
  3575. {
  3576. }
  3577. Range (const ValueType start_, const ValueType end_) throw()
  3578. : start (start_), end (jmax (start_, end_))
  3579. {
  3580. }
  3581. Range (const Range& other) throw()
  3582. : start (other.start), end (other.end)
  3583. {
  3584. }
  3585. Range& operator= (const Range& other) throw()
  3586. {
  3587. start = other.start;
  3588. end = other.end;
  3589. return *this;
  3590. }
  3591. ~Range() throw()
  3592. {
  3593. }
  3594. static const Range between (const ValueType position1, const ValueType position2) throw()
  3595. {
  3596. return (position1 < position2) ? Range (position1, position2)
  3597. : Range (position2, position1);
  3598. }
  3599. static const Range emptyRange (const ValueType start) throw()
  3600. {
  3601. return Range (start, start);
  3602. }
  3603. inline ValueType getStart() const throw() { return start; }
  3604. inline ValueType getLength() const throw() { return end - start; }
  3605. inline ValueType getEnd() const throw() { return end; }
  3606. inline bool isEmpty() const throw() { return start == end; }
  3607. void setStart (const ValueType newStart) throw()
  3608. {
  3609. start = newStart;
  3610. if (end < newStart)
  3611. end = newStart;
  3612. }
  3613. const Range withStart (const ValueType newStart) const throw()
  3614. {
  3615. return Range (newStart, jmax (newStart, end));
  3616. }
  3617. const Range movedToStartAt (const ValueType newStart) const throw()
  3618. {
  3619. return Range (newStart, newStart + getLength());
  3620. }
  3621. void setEnd (const ValueType newEnd) throw()
  3622. {
  3623. end = newEnd;
  3624. if (newEnd < start)
  3625. start = newEnd;
  3626. }
  3627. const Range withEnd (const ValueType newEnd) const throw()
  3628. {
  3629. return Range (jmin (start, newEnd), newEnd);
  3630. }
  3631. const Range movedToEndAt (const ValueType newEnd) const throw()
  3632. {
  3633. return Range (newEnd - getLength(), newEnd);
  3634. }
  3635. void setLength (const ValueType newLength) throw()
  3636. {
  3637. end = start + jmax (ValueType(), newLength);
  3638. }
  3639. const Range withLength (const ValueType newLength) const throw()
  3640. {
  3641. return Range (start, start + newLength);
  3642. }
  3643. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3644. {
  3645. start += amountToAdd;
  3646. end += amountToAdd;
  3647. return *this;
  3648. }
  3649. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3650. {
  3651. start -= amountToSubtract;
  3652. end -= amountToSubtract;
  3653. return *this;
  3654. }
  3655. const Range operator+ (const ValueType amountToAdd) const throw()
  3656. {
  3657. return Range (start + amountToAdd, end + amountToAdd);
  3658. }
  3659. const Range operator- (const ValueType amountToSubtract) const throw()
  3660. {
  3661. return Range (start - amountToSubtract, end - amountToSubtract);
  3662. }
  3663. bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
  3664. bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }
  3665. bool contains (const ValueType position) const throw()
  3666. {
  3667. return start <= position && position < end;
  3668. }
  3669. ValueType clipValue (const ValueType value) const throw()
  3670. {
  3671. return jlimit (start, end, value);
  3672. }
  3673. bool intersects (const Range& other) const throw()
  3674. {
  3675. return other.start < end && start < other.end;
  3676. }
  3677. const Range getIntersectionWith (const Range& other) const throw()
  3678. {
  3679. return Range (jmax (start, other.start),
  3680. jmin (end, other.end));
  3681. }
  3682. const Range getUnionWith (const Range& other) const throw()
  3683. {
  3684. return Range (jmin (start, other.start),
  3685. jmax (end, other.end));
  3686. }
  3687. const Range constrainRange (const Range& rangeToConstrain) const throw()
  3688. {
  3689. const ValueType otherLen = rangeToConstrain.getLength();
  3690. return getLength() <= otherLen
  3691. ? *this
  3692. : rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
  3693. }
  3694. juce_UseDebuggingNewOperator
  3695. private:
  3696. ValueType start, end;
  3697. };
  3698. #endif // __JUCE_RANGE_JUCEHEADER__
  3699. /*** End of inlined file: juce_Range.h ***/
  3700. #endif
  3701. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3702. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3703. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3704. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3705. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3706. class ReferenceCountedArray
  3707. {
  3708. public:
  3709. ReferenceCountedArray() throw()
  3710. : numUsed (0)
  3711. {
  3712. }
  3713. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3714. {
  3715. const ScopedLockType lock (other.getLock());
  3716. numUsed = other.numUsed;
  3717. data.setAllocatedSize (numUsed);
  3718. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3719. for (int i = numUsed; --i >= 0;)
  3720. if (data.elements[i] != 0)
  3721. data.elements[i]->incReferenceCount();
  3722. }
  3723. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3724. {
  3725. if (this != &other)
  3726. {
  3727. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3728. swapWithArray (otherCopy);
  3729. }
  3730. return *this;
  3731. }
  3732. ~ReferenceCountedArray()
  3733. {
  3734. clear();
  3735. }
  3736. void clear()
  3737. {
  3738. const ScopedLockType lock (getLock());
  3739. while (numUsed > 0)
  3740. if (data.elements [--numUsed] != 0)
  3741. data.elements [numUsed]->decReferenceCount();
  3742. jassert (numUsed == 0);
  3743. data.setAllocatedSize (0);
  3744. }
  3745. inline int size() const throw()
  3746. {
  3747. return numUsed;
  3748. }
  3749. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3750. {
  3751. const ScopedLockType lock (getLock());
  3752. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3753. : static_cast <ObjectClass*> (0);
  3754. }
  3755. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3756. {
  3757. const ScopedLockType lock (getLock());
  3758. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3759. return data.elements [index];
  3760. }
  3761. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3762. {
  3763. const ScopedLockType lock (getLock());
  3764. return numUsed > 0 ? data.elements [0]
  3765. : static_cast <ObjectClass*> (0);
  3766. }
  3767. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3768. {
  3769. const ScopedLockType lock (getLock());
  3770. return numUsed > 0 ? data.elements [numUsed - 1]
  3771. : static_cast <ObjectClass*> (0);
  3772. }
  3773. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3774. {
  3775. const ScopedLockType lock (getLock());
  3776. ObjectClass** e = data.elements.getData();
  3777. ObjectClass** const end = e + numUsed;
  3778. while (e != end)
  3779. {
  3780. if (objectToLookFor == *e)
  3781. return static_cast <int> (e - data.elements.getData());
  3782. ++e;
  3783. }
  3784. return -1;
  3785. }
  3786. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3787. {
  3788. const ScopedLockType lock (getLock());
  3789. ObjectClass** e = data.elements.getData();
  3790. ObjectClass** const end = e + numUsed;
  3791. while (e != end)
  3792. {
  3793. if (objectToLookFor == *e)
  3794. return true;
  3795. ++e;
  3796. }
  3797. return false;
  3798. }
  3799. void add (ObjectClass* const newObject) throw()
  3800. {
  3801. const ScopedLockType lock (getLock());
  3802. data.ensureAllocatedSize (numUsed + 1);
  3803. data.elements [numUsed++] = newObject;
  3804. if (newObject != 0)
  3805. newObject->incReferenceCount();
  3806. }
  3807. void insert (int indexToInsertAt,
  3808. ObjectClass* const newObject) throw()
  3809. {
  3810. if (indexToInsertAt >= 0)
  3811. {
  3812. const ScopedLockType lock (getLock());
  3813. if (indexToInsertAt > numUsed)
  3814. indexToInsertAt = numUsed;
  3815. data.ensureAllocatedSize (numUsed + 1);
  3816. ObjectClass** const e = data.elements + indexToInsertAt;
  3817. const int numToMove = numUsed - indexToInsertAt;
  3818. if (numToMove > 0)
  3819. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3820. *e = newObject;
  3821. if (newObject != 0)
  3822. newObject->incReferenceCount();
  3823. ++numUsed;
  3824. }
  3825. else
  3826. {
  3827. add (newObject);
  3828. }
  3829. }
  3830. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3831. {
  3832. const ScopedLockType lock (getLock());
  3833. if (! contains (newObject))
  3834. add (newObject);
  3835. }
  3836. void set (const int indexToChange,
  3837. ObjectClass* const newObject)
  3838. {
  3839. if (indexToChange >= 0)
  3840. {
  3841. const ScopedLockType lock (getLock());
  3842. if (newObject != 0)
  3843. newObject->incReferenceCount();
  3844. if (indexToChange < numUsed)
  3845. {
  3846. if (data.elements [indexToChange] != 0)
  3847. data.elements [indexToChange]->decReferenceCount();
  3848. data.elements [indexToChange] = newObject;
  3849. }
  3850. else
  3851. {
  3852. data.ensureAllocatedSize (numUsed + 1);
  3853. data.elements [numUsed++] = newObject;
  3854. }
  3855. }
  3856. }
  3857. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3858. int startIndex = 0,
  3859. int numElementsToAdd = -1) throw()
  3860. {
  3861. arrayToAddFrom.lockArray();
  3862. const ScopedLockType lock (getLock());
  3863. if (startIndex < 0)
  3864. {
  3865. jassertfalse
  3866. startIndex = 0;
  3867. }
  3868. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3869. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3870. if (numElementsToAdd > 0)
  3871. {
  3872. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3873. while (--numElementsToAdd >= 0)
  3874. add (arrayToAddFrom.getUnchecked (startIndex++));
  3875. }
  3876. arrayToAddFrom.unlockArray();
  3877. }
  3878. template <class ElementComparator>
  3879. void addSorted (ElementComparator& comparator,
  3880. ObjectClass* newObject) throw()
  3881. {
  3882. const ScopedLockType lock (getLock());
  3883. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3884. }
  3885. template <class ElementComparator>
  3886. void addOrReplaceSorted (ElementComparator& comparator,
  3887. ObjectClass* newObject) throw()
  3888. {
  3889. const ScopedLockType lock (getLock());
  3890. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3891. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3892. set (index - 1, newObject); // replace an existing object that matches
  3893. else
  3894. insert (index, newObject); // no match, so insert the new one
  3895. }
  3896. void remove (const int indexToRemove)
  3897. {
  3898. const ScopedLockType lock (getLock());
  3899. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3900. {
  3901. ObjectClass** const e = data.elements + indexToRemove;
  3902. if (*e != 0)
  3903. (*e)->decReferenceCount();
  3904. --numUsed;
  3905. const int numberToShift = numUsed - indexToRemove;
  3906. if (numberToShift > 0)
  3907. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3908. if ((numUsed << 1) < data.numAllocated)
  3909. minimiseStorageOverheads();
  3910. }
  3911. }
  3912. void removeObject (ObjectClass* const objectToRemove)
  3913. {
  3914. const ScopedLockType lock (getLock());
  3915. remove (indexOf (objectToRemove));
  3916. }
  3917. void removeRange (const int startIndex,
  3918. const int numberToRemove)
  3919. {
  3920. const ScopedLockType lock (getLock());
  3921. const int start = jlimit (0, numUsed, startIndex);
  3922. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3923. if (end > start)
  3924. {
  3925. int i;
  3926. for (i = start; i < end; ++i)
  3927. {
  3928. if (data.elements[i] != 0)
  3929. {
  3930. data.elements[i]->decReferenceCount();
  3931. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3932. }
  3933. }
  3934. const int rangeSize = end - start;
  3935. ObjectClass** e = data.elements + start;
  3936. i = numUsed - end;
  3937. numUsed -= rangeSize;
  3938. while (--i >= 0)
  3939. {
  3940. *e = e [rangeSize];
  3941. ++e;
  3942. }
  3943. if ((numUsed << 1) < data.numAllocated)
  3944. minimiseStorageOverheads();
  3945. }
  3946. }
  3947. void removeLast (int howManyToRemove = 1)
  3948. {
  3949. const ScopedLockType lock (getLock());
  3950. if (howManyToRemove > numUsed)
  3951. howManyToRemove = numUsed;
  3952. while (--howManyToRemove >= 0)
  3953. remove (numUsed - 1);
  3954. }
  3955. void swap (const int index1,
  3956. const int index2) throw()
  3957. {
  3958. const ScopedLockType lock (getLock());
  3959. if (((unsigned int) index1) < (unsigned int) numUsed
  3960. && ((unsigned int) index2) < (unsigned int) numUsed)
  3961. {
  3962. swapVariables (data.elements [index1],
  3963. data.elements [index2]);
  3964. }
  3965. }
  3966. void move (const int currentIndex,
  3967. int newIndex) throw()
  3968. {
  3969. if (currentIndex != newIndex)
  3970. {
  3971. const ScopedLockType lock (getLock());
  3972. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3973. {
  3974. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3975. newIndex = numUsed - 1;
  3976. ObjectClass* const value = data.elements [currentIndex];
  3977. if (newIndex > currentIndex)
  3978. {
  3979. memmove (data.elements + currentIndex,
  3980. data.elements + currentIndex + 1,
  3981. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3982. }
  3983. else
  3984. {
  3985. memmove (data.elements + newIndex + 1,
  3986. data.elements + newIndex,
  3987. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3988. }
  3989. data.elements [newIndex] = value;
  3990. }
  3991. }
  3992. }
  3993. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3994. {
  3995. const ScopedLockType lock1 (getLock());
  3996. const ScopedLockType lock2 (otherArray.getLock());
  3997. data.swapWith (otherArray.data);
  3998. swapVariables (numUsed, otherArray.numUsed);
  3999. }
  4000. bool operator== (const ReferenceCountedArray& other) const throw()
  4001. {
  4002. const ScopedLockType lock2 (other.getLock());
  4003. const ScopedLockType lock1 (getLock());
  4004. if (numUsed != other.numUsed)
  4005. return false;
  4006. for (int i = numUsed; --i >= 0;)
  4007. if (data.elements [i] != other.data.elements [i])
  4008. return false;
  4009. return true;
  4010. }
  4011. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  4012. {
  4013. return ! operator== (other);
  4014. }
  4015. template <class ElementComparator>
  4016. void sort (ElementComparator& comparator,
  4017. const bool retainOrderOfEquivalentItems = false) const throw()
  4018. {
  4019. (void) comparator; // if you pass in an object with a static compareElements() method, this
  4020. // avoids getting warning messages about the parameter being unused
  4021. const ScopedLockType lock (getLock());
  4022. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  4023. }
  4024. void minimiseStorageOverheads() throw()
  4025. {
  4026. const ScopedLockType lock (getLock());
  4027. data.shrinkToNoMoreThan (numUsed);
  4028. }
  4029. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4030. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4031. juce_UseDebuggingNewOperator
  4032. private:
  4033. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  4034. int numUsed;
  4035. };
  4036. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  4037. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  4038. #endif
  4039. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  4040. #endif
  4041. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  4042. #endif
  4043. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  4044. /*** Start of inlined file: juce_SortedSet.h ***/
  4045. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  4046. #define __JUCE_SORTEDSET_JUCEHEADER__
  4047. #if JUCE_MSVC
  4048. #pragma warning (push)
  4049. #pragma warning (disable: 4512)
  4050. #endif
  4051. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  4052. class SortedSet
  4053. {
  4054. public:
  4055. SortedSet() throw()
  4056. : numUsed (0)
  4057. {
  4058. }
  4059. SortedSet (const SortedSet& other) throw()
  4060. {
  4061. const ScopedLockType lock (other.getLock());
  4062. numUsed = other.numUsed;
  4063. data.setAllocatedSize (other.numUsed);
  4064. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  4065. }
  4066. ~SortedSet() throw()
  4067. {
  4068. }
  4069. SortedSet& operator= (const SortedSet& other) throw()
  4070. {
  4071. if (this != &other)
  4072. {
  4073. const ScopedLockType lock1 (other.getLock());
  4074. const ScopedLockType lock2 (getLock());
  4075. data.ensureAllocatedSize (other.size());
  4076. numUsed = other.numUsed;
  4077. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  4078. minimiseStorageOverheads();
  4079. }
  4080. return *this;
  4081. }
  4082. bool operator== (const SortedSet<ElementType>& other) const throw()
  4083. {
  4084. const ScopedLockType lock (getLock());
  4085. if (numUsed != other.numUsed)
  4086. return false;
  4087. for (int i = numUsed; --i >= 0;)
  4088. if (data.elements[i] != other.data.elements[i])
  4089. return false;
  4090. return true;
  4091. }
  4092. bool operator!= (const SortedSet<ElementType>& other) const throw()
  4093. {
  4094. return ! operator== (other);
  4095. }
  4096. void clear() throw()
  4097. {
  4098. const ScopedLockType lock (getLock());
  4099. data.setAllocatedSize (0);
  4100. numUsed = 0;
  4101. }
  4102. void clearQuick() throw()
  4103. {
  4104. const ScopedLockType lock (getLock());
  4105. numUsed = 0;
  4106. }
  4107. inline int size() const throw()
  4108. {
  4109. return numUsed;
  4110. }
  4111. inline ElementType operator[] (const int index) const throw()
  4112. {
  4113. const ScopedLockType lock (getLock());
  4114. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  4115. : ElementType();
  4116. }
  4117. inline ElementType getUnchecked (const int index) const throw()
  4118. {
  4119. const ScopedLockType lock (getLock());
  4120. jassert (((unsigned int) index) < (unsigned int) numUsed);
  4121. return data.elements [index];
  4122. }
  4123. inline ElementType getFirst() const throw()
  4124. {
  4125. const ScopedLockType lock (getLock());
  4126. return numUsed > 0 ? data.elements [0] : ElementType();
  4127. }
  4128. inline ElementType getLast() const throw()
  4129. {
  4130. const ScopedLockType lock (getLock());
  4131. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  4132. }
  4133. int indexOf (const ElementType elementToLookFor) const throw()
  4134. {
  4135. const ScopedLockType lock (getLock());
  4136. int start = 0;
  4137. int end = numUsed;
  4138. for (;;)
  4139. {
  4140. if (start >= end)
  4141. {
  4142. return -1;
  4143. }
  4144. else if (elementToLookFor == data.elements [start])
  4145. {
  4146. return start;
  4147. }
  4148. else
  4149. {
  4150. const int halfway = (start + end) >> 1;
  4151. if (halfway == start)
  4152. return -1;
  4153. else if (elementToLookFor >= data.elements [halfway])
  4154. start = halfway;
  4155. else
  4156. end = halfway;
  4157. }
  4158. }
  4159. }
  4160. bool contains (const ElementType elementToLookFor) const throw()
  4161. {
  4162. const ScopedLockType lock (getLock());
  4163. int start = 0;
  4164. int end = numUsed;
  4165. for (;;)
  4166. {
  4167. if (start >= end)
  4168. {
  4169. return false;
  4170. }
  4171. else if (elementToLookFor == data.elements [start])
  4172. {
  4173. return true;
  4174. }
  4175. else
  4176. {
  4177. const int halfway = (start + end) >> 1;
  4178. if (halfway == start)
  4179. return false;
  4180. else if (elementToLookFor >= data.elements [halfway])
  4181. start = halfway;
  4182. else
  4183. end = halfway;
  4184. }
  4185. }
  4186. }
  4187. void add (const ElementType newElement) throw()
  4188. {
  4189. const ScopedLockType lock (getLock());
  4190. int start = 0;
  4191. int end = numUsed;
  4192. for (;;)
  4193. {
  4194. if (start >= end)
  4195. {
  4196. jassert (start <= end);
  4197. insertInternal (start, newElement);
  4198. break;
  4199. }
  4200. else if (newElement == data.elements [start])
  4201. {
  4202. break;
  4203. }
  4204. else
  4205. {
  4206. const int halfway = (start + end) >> 1;
  4207. if (halfway == start)
  4208. {
  4209. if (newElement >= data.elements [halfway])
  4210. insertInternal (start + 1, newElement);
  4211. else
  4212. insertInternal (start, newElement);
  4213. break;
  4214. }
  4215. else if (newElement >= data.elements [halfway])
  4216. start = halfway;
  4217. else
  4218. end = halfway;
  4219. }
  4220. }
  4221. }
  4222. void addArray (const ElementType* elementsToAdd,
  4223. int numElementsToAdd) throw()
  4224. {
  4225. const ScopedLockType lock (getLock());
  4226. while (--numElementsToAdd >= 0)
  4227. add (*elementsToAdd++);
  4228. }
  4229. template <class OtherSetType>
  4230. void addSet (const OtherSetType& setToAddFrom,
  4231. int startIndex = 0,
  4232. int numElementsToAdd = -1) throw()
  4233. {
  4234. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4235. const ScopedLockType lock2 (getLock());
  4236. jassert (this != &setToAddFrom);
  4237. if (this != &setToAddFrom)
  4238. {
  4239. if (startIndex < 0)
  4240. {
  4241. jassertfalse
  4242. startIndex = 0;
  4243. }
  4244. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4245. numElementsToAdd = setToAddFrom.size() - startIndex;
  4246. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4247. }
  4248. }
  4249. ElementType remove (const int indexToRemove) throw()
  4250. {
  4251. const ScopedLockType lock (getLock());
  4252. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4253. {
  4254. --numUsed;
  4255. ElementType* const e = data.elements + indexToRemove;
  4256. ElementType const removed = *e;
  4257. const int numberToShift = numUsed - indexToRemove;
  4258. if (numberToShift > 0)
  4259. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4260. if ((numUsed << 1) < data.numAllocated)
  4261. minimiseStorageOverheads();
  4262. return removed;
  4263. }
  4264. return 0;
  4265. }
  4266. void removeValue (const ElementType valueToRemove) throw()
  4267. {
  4268. const ScopedLockType lock (getLock());
  4269. remove (indexOf (valueToRemove));
  4270. }
  4271. template <class OtherSetType>
  4272. void removeValuesIn (const OtherSetType& otherSet) throw()
  4273. {
  4274. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4275. const ScopedLockType lock2 (getLock());
  4276. if (this == &otherSet)
  4277. {
  4278. clear();
  4279. }
  4280. else
  4281. {
  4282. if (otherSet.size() > 0)
  4283. {
  4284. for (int i = numUsed; --i >= 0;)
  4285. if (otherSet.contains (data.elements [i]))
  4286. remove (i);
  4287. }
  4288. }
  4289. }
  4290. template <class OtherSetType>
  4291. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4292. {
  4293. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4294. const ScopedLockType lock2 (getLock());
  4295. if (this != &otherSet)
  4296. {
  4297. if (otherSet.size() <= 0)
  4298. {
  4299. clear();
  4300. }
  4301. else
  4302. {
  4303. for (int i = numUsed; --i >= 0;)
  4304. if (! otherSet.contains (data.elements [i]))
  4305. remove (i);
  4306. }
  4307. }
  4308. }
  4309. void minimiseStorageOverheads() throw()
  4310. {
  4311. const ScopedLockType lock (getLock());
  4312. data.shrinkToNoMoreThan (numUsed);
  4313. }
  4314. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4315. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4316. juce_UseDebuggingNewOperator
  4317. private:
  4318. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4319. int numUsed;
  4320. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4321. {
  4322. data.ensureAllocatedSize (numUsed + 1);
  4323. ElementType* const insertPos = data.elements + indexToInsertAt;
  4324. const int numberToMove = numUsed - indexToInsertAt;
  4325. if (numberToMove > 0)
  4326. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4327. *insertPos = newElement;
  4328. ++numUsed;
  4329. }
  4330. };
  4331. #if JUCE_MSVC
  4332. #pragma warning (pop)
  4333. #endif
  4334. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4335. /*** End of inlined file: juce_SortedSet.h ***/
  4336. #endif
  4337. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4338. /*** Start of inlined file: juce_SparseSet.h ***/
  4339. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4340. #define __JUCE_SPARSESET_JUCEHEADER__
  4341. template <class Type>
  4342. class SparseSet
  4343. {
  4344. public:
  4345. SparseSet()
  4346. {
  4347. }
  4348. SparseSet (const SparseSet<Type>& other)
  4349. : values (other.values)
  4350. {
  4351. }
  4352. ~SparseSet()
  4353. {
  4354. }
  4355. void clear()
  4356. {
  4357. values.clear();
  4358. }
  4359. bool isEmpty() const throw()
  4360. {
  4361. return values.size() == 0;
  4362. }
  4363. Type size() const
  4364. {
  4365. Type total (0);
  4366. for (int i = 0; i < values.size(); i += 2)
  4367. total += values.getUnchecked (i + 1) - values.getUnchecked (i);
  4368. return total;
  4369. }
  4370. Type operator[] (Type index) const
  4371. {
  4372. for (int i = 0; i < values.size(); i += 2)
  4373. {
  4374. const Type start (values.getUnchecked (i));
  4375. const Type len (values.getUnchecked (i + 1) - start);
  4376. if (index < len)
  4377. return start + index;
  4378. index -= len;
  4379. }
  4380. return Type (0);
  4381. }
  4382. bool contains (const Type valueToLookFor) const
  4383. {
  4384. for (int i = 0; i < values.size(); ++i)
  4385. if (valueToLookFor < values.getUnchecked(i))
  4386. return (i & 1) != 0;
  4387. return false;
  4388. }
  4389. int getNumRanges() const throw()
  4390. {
  4391. return values.size() >> 1;
  4392. }
  4393. const Range<Type> getRange (const int rangeIndex) const
  4394. {
  4395. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4396. return Range<Type> (values.getUnchecked (rangeIndex << 1),
  4397. values.getUnchecked ((rangeIndex << 1) + 1));
  4398. else
  4399. return Range<Type>();
  4400. }
  4401. const Range<Type> getTotalRange() const
  4402. {
  4403. if (values.size() > 0)
  4404. {
  4405. jassert ((values.size() & 1) == 0);
  4406. return Range<Type> (values.getUnchecked (0),
  4407. values.getUnchecked (values.size() - 1));
  4408. }
  4409. return Range<Type>();
  4410. }
  4411. void addRange (const Range<Type>& range)
  4412. {
  4413. jassert (range.getLength() >= 0);
  4414. if (range.getLength() > 0)
  4415. {
  4416. removeRange (range);
  4417. values.addUsingDefaultSort (range.getStart());
  4418. values.addUsingDefaultSort (range.getEnd());
  4419. simplify();
  4420. }
  4421. }
  4422. void removeRange (const Range<Type>& rangeToRemove)
  4423. {
  4424. jassert (rangeToRemove.getLength() >= 0);
  4425. if (rangeToRemove.getLength() > 0
  4426. && values.size() > 0
  4427. && rangeToRemove.getStart() < values.getUnchecked (values.size() - 1)
  4428. && values.getUnchecked(0) < rangeToRemove.getEnd())
  4429. {
  4430. const bool onAtStart = contains (rangeToRemove.getStart() - 1);
  4431. const Type lastValue (jmin (rangeToRemove.getEnd(), values.getLast()));
  4432. const bool onAtEnd = contains (lastValue);
  4433. for (int i = values.size(); --i >= 0;)
  4434. {
  4435. if (values.getUnchecked(i) <= lastValue)
  4436. {
  4437. while (values.getUnchecked(i) >= rangeToRemove.getStart())
  4438. {
  4439. values.remove (i);
  4440. if (--i < 0)
  4441. break;
  4442. }
  4443. break;
  4444. }
  4445. }
  4446. if (onAtStart) values.addUsingDefaultSort (rangeToRemove.getStart());
  4447. if (onAtEnd) values.addUsingDefaultSort (lastValue);
  4448. simplify();
  4449. }
  4450. }
  4451. void invertRange (const Range<Type>& range)
  4452. {
  4453. SparseSet newItems;
  4454. newItems.addRange (range);
  4455. int i;
  4456. for (i = getNumRanges(); --i >= 0;)
  4457. newItems.removeRange (getRange (i));
  4458. removeRange (range);
  4459. for (i = newItems.getNumRanges(); --i >= 0;)
  4460. addRange (newItems.getRange(i));
  4461. }
  4462. bool overlapsRange (const Range<Type>& range)
  4463. {
  4464. if (range.getLength() > 0)
  4465. {
  4466. for (int i = getNumRanges(); --i >= 0;)
  4467. {
  4468. if (values.getUnchecked ((i << 1) + 1) <= range.getStart())
  4469. return false;
  4470. if (values.getUnchecked (i << 1) < range.getEnd())
  4471. return true;
  4472. }
  4473. }
  4474. return false;
  4475. }
  4476. bool containsRange (const Range<Type>& range)
  4477. {
  4478. if (range.getLength() > 0)
  4479. {
  4480. for (int i = getNumRanges(); --i >= 0;)
  4481. {
  4482. if (values.getUnchecked ((i << 1) + 1) <= range.getStart())
  4483. return false;
  4484. if (values.getUnchecked (i << 1) <= range.getStart()
  4485. && range.getEnd() <= values.getUnchecked ((i << 1) + 1))
  4486. return true;
  4487. }
  4488. }
  4489. return false;
  4490. }
  4491. bool operator== (const SparseSet<Type>& other) throw()
  4492. {
  4493. return values == other.values;
  4494. }
  4495. bool operator!= (const SparseSet<Type>& other) throw()
  4496. {
  4497. return values != other.values;
  4498. }
  4499. juce_UseDebuggingNewOperator
  4500. private:
  4501. // alternating start/end values of ranges of values that are present.
  4502. Array<Type, DummyCriticalSection> values;
  4503. void simplify()
  4504. {
  4505. jassert ((values.size() & 1) == 0);
  4506. for (int i = values.size(); --i > 0;)
  4507. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4508. values.removeRange (--i, 2);
  4509. }
  4510. };
  4511. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4512. /*** End of inlined file: juce_SparseSet.h ***/
  4513. #endif
  4514. #ifndef __JUCE_VALUE_JUCEHEADER__
  4515. /*** Start of inlined file: juce_Value.h ***/
  4516. #ifndef __JUCE_VALUE_JUCEHEADER__
  4517. #define __JUCE_VALUE_JUCEHEADER__
  4518. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4519. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4520. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4521. /*** Start of inlined file: juce_MessageListener.h ***/
  4522. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4523. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4524. /*** Start of inlined file: juce_Message.h ***/
  4525. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4526. #define __JUCE_MESSAGE_JUCEHEADER__
  4527. class MessageListener;
  4528. class MessageManager;
  4529. class JUCE_API Message
  4530. {
  4531. public:
  4532. Message() throw();
  4533. Message (int intParameter1,
  4534. int intParameter2,
  4535. int intParameter3,
  4536. void* pointerParameter) throw();
  4537. virtual ~Message() throw();
  4538. // These values can be used for carrying simple data that the application needs to
  4539. // pass around. For more complex messages, just create a subclass.
  4540. int intParameter1; /**< user-defined integer value. */
  4541. int intParameter2; /**< user-defined integer value. */
  4542. int intParameter3; /**< user-defined integer value. */
  4543. void* pointerParameter; /**< user-defined pointer value. */
  4544. juce_UseDebuggingNewOperator
  4545. private:
  4546. friend class MessageListener;
  4547. friend class MessageManager;
  4548. MessageListener* messageRecipient;
  4549. Message (const Message&);
  4550. Message& operator= (const Message&);
  4551. };
  4552. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4553. /*** End of inlined file: juce_Message.h ***/
  4554. class JUCE_API MessageListener
  4555. {
  4556. protected:
  4557. MessageListener() throw();
  4558. public:
  4559. virtual ~MessageListener();
  4560. virtual void handleMessage (const Message& message) = 0;
  4561. void postMessage (Message* message) const throw();
  4562. bool isValidMessageListener() const throw();
  4563. };
  4564. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4565. /*** End of inlined file: juce_MessageListener.h ***/
  4566. class JUCE_API AsyncUpdater
  4567. {
  4568. public:
  4569. AsyncUpdater() throw();
  4570. virtual ~AsyncUpdater();
  4571. void triggerAsyncUpdate() throw();
  4572. void cancelPendingUpdate() throw();
  4573. void handleUpdateNowIfNeeded();
  4574. virtual void handleAsyncUpdate() = 0;
  4575. private:
  4576. class AsyncUpdaterInternal : public MessageListener
  4577. {
  4578. public:
  4579. AsyncUpdaterInternal() throw() {}
  4580. ~AsyncUpdaterInternal() {}
  4581. void handleMessage (const Message&);
  4582. AsyncUpdater* owner;
  4583. private:
  4584. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4585. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4586. };
  4587. AsyncUpdaterInternal internalAsyncHandler;
  4588. bool asyncMessagePending;
  4589. };
  4590. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4591. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4592. /*** Start of inlined file: juce_ListenerList.h ***/
  4593. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4594. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4595. template <class ListenerClass,
  4596. class ArrayType = Array <ListenerClass*> >
  4597. class ListenerList
  4598. {
  4599. // Horrible macros required to support VC6/7..
  4600. #if defined (_MSC_VER) && _MSC_VER <= 1400
  4601. #define LL_TEMPLATE(a) typename P##a, typename Q##a
  4602. #define LL_PARAM(a) Q##a& param##a
  4603. #else
  4604. #define LL_TEMPLATE(a) typename P##a
  4605. #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a
  4606. #endif
  4607. public:
  4608. ListenerList()
  4609. {
  4610. }
  4611. ~ListenerList()
  4612. {
  4613. }
  4614. void add (ListenerClass* const listenerToAdd)
  4615. {
  4616. // Listeners can't be null pointers!
  4617. jassert (listenerToAdd != 0);
  4618. if (listenerToAdd != 0)
  4619. listeners.addIfNotAlreadyThere (listenerToAdd);
  4620. }
  4621. void remove (ListenerClass* const listenerToRemove)
  4622. {
  4623. // Listeners can't be null pointers!
  4624. jassert (listenerToRemove != 0);
  4625. listeners.removeValue (listenerToRemove);
  4626. }
  4627. int size() const throw()
  4628. {
  4629. return listeners.size();
  4630. }
  4631. bool isEmpty() const throw()
  4632. {
  4633. return listeners.size() == 0;
  4634. }
  4635. bool contains (ListenerClass* const listener) const throw()
  4636. {
  4637. return listeners.contains (listener);
  4638. }
  4639. void call (void (ListenerClass::*callbackFunction) ())
  4640. {
  4641. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4642. }
  4643. template <class BailOutCheckerType>
  4644. void callChecked (const BailOutCheckerType& bailOutChecker,
  4645. void (ListenerClass::*callbackFunction) ())
  4646. {
  4647. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4648. (iter.getListener()->*callbackFunction) ();
  4649. }
  4650. template <LL_TEMPLATE(1)>
  4651. void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
  4652. {
  4653. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4654. (iter.getListener()->*callbackFunction) (param1);
  4655. }
  4656. template <class BailOutCheckerType, LL_TEMPLATE(1)>
  4657. void callChecked (const BailOutCheckerType& bailOutChecker,
  4658. void (ListenerClass::*callbackFunction) (P1),
  4659. LL_PARAM(1))
  4660. {
  4661. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4662. (iter.getListener()->*callbackFunction) (param1);
  4663. }
  4664. template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4665. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4666. LL_PARAM(1), LL_PARAM(2))
  4667. {
  4668. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4669. (iter.getListener()->*callbackFunction) (param1, param2);
  4670. }
  4671. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4672. void callChecked (const BailOutCheckerType& bailOutChecker,
  4673. void (ListenerClass::*callbackFunction) (P1, P2),
  4674. LL_PARAM(1), LL_PARAM(2))
  4675. {
  4676. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4677. (iter.getListener()->*callbackFunction) (param1, param2);
  4678. }
  4679. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4680. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4681. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4682. {
  4683. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4684. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4685. }
  4686. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4687. void callChecked (const BailOutCheckerType& bailOutChecker,
  4688. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4689. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4690. {
  4691. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4692. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4693. }
  4694. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4695. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4696. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4697. {
  4698. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4699. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4700. }
  4701. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4702. void callChecked (const BailOutCheckerType& bailOutChecker,
  4703. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4704. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4705. {
  4706. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4707. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4708. }
  4709. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4710. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4711. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4712. {
  4713. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4714. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4715. }
  4716. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4717. void callChecked (const BailOutCheckerType& bailOutChecker,
  4718. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4719. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4720. {
  4721. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4722. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4723. }
  4724. class DummyBailOutChecker
  4725. {
  4726. public:
  4727. inline bool shouldBailOut() const throw() { return false; }
  4728. };
  4729. template <class BailOutCheckerType, class ListType>
  4730. class Iterator
  4731. {
  4732. public:
  4733. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4734. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4735. {}
  4736. ~Iterator() {}
  4737. bool next()
  4738. {
  4739. if (index <= 0 || bailOutChecker.shouldBailOut())
  4740. return false;
  4741. const int listSize = list.size();
  4742. if (--index < listSize)
  4743. return true;
  4744. index = listSize - 1;
  4745. return index >= 0;
  4746. }
  4747. typename ListType::ListenerType* getListener() const throw()
  4748. {
  4749. return list.getListeners().getUnchecked (index);
  4750. }
  4751. private:
  4752. const ListType& list;
  4753. const BailOutCheckerType& bailOutChecker;
  4754. int index;
  4755. Iterator (const Iterator&);
  4756. Iterator& operator= (const Iterator&);
  4757. };
  4758. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4759. typedef ListenerClass ListenerType;
  4760. const ArrayType& getListeners() const throw() { return listeners; }
  4761. private:
  4762. ArrayType listeners;
  4763. ListenerList (const ListenerList&);
  4764. ListenerList& operator= (const ListenerList&);
  4765. #undef LL_TEMPLATE
  4766. #undef LL_PARAM
  4767. };
  4768. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4769. /*** End of inlined file: juce_ListenerList.h ***/
  4770. class JUCE_API Value
  4771. {
  4772. public:
  4773. Value();
  4774. Value (const Value& other);
  4775. explicit Value (const var& initialValue);
  4776. ~Value();
  4777. const var getValue() const;
  4778. operator const var() const;
  4779. const String toString() const;
  4780. void setValue (const var& newValue);
  4781. Value& operator= (const var& newValue);
  4782. void referTo (const Value& valueToReferTo);
  4783. bool refersToSameSourceAs (const Value& other) const;
  4784. bool operator== (const Value& other) const;
  4785. bool operator!= (const Value& other) const;
  4786. class JUCE_API Listener
  4787. {
  4788. public:
  4789. Listener() {}
  4790. virtual ~Listener() {}
  4791. virtual void valueChanged (Value& value) = 0;
  4792. };
  4793. void addListener (Listener* const listener);
  4794. void removeListener (Listener* const listener);
  4795. class JUCE_API ValueSource : public ReferenceCountedObject,
  4796. public AsyncUpdater
  4797. {
  4798. public:
  4799. ValueSource();
  4800. virtual ~ValueSource();
  4801. virtual const var getValue() const = 0;
  4802. virtual void setValue (const var& newValue) = 0;
  4803. void sendChangeMessage (const bool dispatchSynchronously);
  4804. juce_UseDebuggingNewOperator
  4805. protected:
  4806. friend class Value;
  4807. SortedSet <Value*> valuesWithListeners;
  4808. void handleAsyncUpdate();
  4809. ValueSource (const ValueSource&);
  4810. ValueSource& operator= (const ValueSource&);
  4811. };
  4812. explicit Value (ValueSource* const valueSource);
  4813. ValueSource& getValueSource() { return *value; }
  4814. juce_UseDebuggingNewOperator
  4815. private:
  4816. friend class ValueSource;
  4817. ReferenceCountedObjectPtr <ValueSource> value;
  4818. ListenerList <Listener> listeners;
  4819. void callListeners();
  4820. // This is disallowed to avoid confusion about whether it should
  4821. // do a by-value or by-reference copy.
  4822. Value& operator= (const Value& other);
  4823. };
  4824. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4825. #endif // __JUCE_VALUE_JUCEHEADER__
  4826. /*** End of inlined file: juce_Value.h ***/
  4827. #endif
  4828. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4829. /*** Start of inlined file: juce_ValueTree.h ***/
  4830. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4831. #define __JUCE_VALUETREE_JUCEHEADER__
  4832. /*** Start of inlined file: juce_UndoManager.h ***/
  4833. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4834. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4835. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4836. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4837. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4838. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4839. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4840. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4841. /*** Start of inlined file: juce_ChangeListener.h ***/
  4842. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4843. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4844. class JUCE_API ChangeListener
  4845. {
  4846. public:
  4847. virtual ~ChangeListener() {}
  4848. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4849. };
  4850. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4851. /*** End of inlined file: juce_ChangeListener.h ***/
  4852. /*** Start of inlined file: juce_ScopedLock.h ***/
  4853. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4854. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4855. class JUCE_API ScopedLock
  4856. {
  4857. public:
  4858. inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4859. inline ~ScopedLock() throw() { lock_.exit(); }
  4860. private:
  4861. const CriticalSection& lock_;
  4862. ScopedLock (const ScopedLock&);
  4863. ScopedLock& operator= (const ScopedLock&);
  4864. };
  4865. class ScopedUnlock
  4866. {
  4867. public:
  4868. inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4869. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4870. private:
  4871. const CriticalSection& lock_;
  4872. ScopedUnlock (const ScopedLock&);
  4873. ScopedUnlock& operator= (const ScopedUnlock&);
  4874. };
  4875. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4876. /*** End of inlined file: juce_ScopedLock.h ***/
  4877. class JUCE_API ChangeListenerList : public MessageListener
  4878. {
  4879. public:
  4880. ChangeListenerList() throw();
  4881. ~ChangeListenerList() throw();
  4882. void addChangeListener (ChangeListener* listener) throw();
  4883. void removeChangeListener (ChangeListener* listener) throw();
  4884. void removeAllChangeListeners() throw();
  4885. void sendChangeMessage (void* objectThatHasChanged) throw();
  4886. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4887. void dispatchPendingMessages();
  4888. void handleMessage (const Message&);
  4889. juce_UseDebuggingNewOperator
  4890. private:
  4891. SortedSet <void*> listeners;
  4892. CriticalSection lock;
  4893. void* lastChangedObject;
  4894. bool messagePending;
  4895. ChangeListenerList (const ChangeListenerList&);
  4896. ChangeListenerList& operator= (const ChangeListenerList&);
  4897. };
  4898. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4899. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4900. class JUCE_API ChangeBroadcaster
  4901. {
  4902. public:
  4903. ChangeBroadcaster() throw();
  4904. virtual ~ChangeBroadcaster();
  4905. void addChangeListener (ChangeListener* listener) throw();
  4906. void removeChangeListener (ChangeListener* listener) throw();
  4907. void removeAllChangeListeners() throw();
  4908. void sendChangeMessage (void* objectThatHasChanged) throw();
  4909. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4910. void dispatchPendingMessages();
  4911. private:
  4912. ChangeListenerList changeListenerList;
  4913. ChangeBroadcaster (const ChangeBroadcaster&);
  4914. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4915. };
  4916. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4917. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4918. /*** Start of inlined file: juce_UndoableAction.h ***/
  4919. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4920. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4921. class JUCE_API UndoableAction
  4922. {
  4923. protected:
  4924. UndoableAction() throw() {}
  4925. public:
  4926. virtual ~UndoableAction() {}
  4927. virtual bool perform() = 0;
  4928. virtual bool undo() = 0;
  4929. virtual int getSizeInUnits() { return 10; }
  4930. };
  4931. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4932. /*** End of inlined file: juce_UndoableAction.h ***/
  4933. class JUCE_API UndoManager : public ChangeBroadcaster
  4934. {
  4935. public:
  4936. UndoManager (int maxNumberOfUnitsToKeep = 30000,
  4937. int minimumTransactionsToKeep = 30);
  4938. ~UndoManager();
  4939. void clearUndoHistory();
  4940. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4941. void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
  4942. int minimumTransactionsToKeep);
  4943. bool perform (UndoableAction* action,
  4944. const String& actionName = String::empty);
  4945. void beginNewTransaction (const String& actionName = String::empty);
  4946. void setCurrentTransactionName (const String& newName);
  4947. bool canUndo() const;
  4948. const String getUndoDescription() const;
  4949. bool undo();
  4950. bool undoCurrentTransactionOnly();
  4951. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4952. int getNumActionsInCurrentTransaction() const;
  4953. bool canRedo() const;
  4954. const String getRedoDescription() const;
  4955. bool redo();
  4956. juce_UseDebuggingNewOperator
  4957. private:
  4958. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4959. StringArray transactionNames;
  4960. String currentTransactionName;
  4961. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4962. bool newTransaction, reentrancyCheck;
  4963. // disallow copy constructor
  4964. UndoManager (const UndoManager&);
  4965. UndoManager& operator= (const UndoManager&);
  4966. };
  4967. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4968. /*** End of inlined file: juce_UndoManager.h ***/
  4969. class JUCE_API ValueTree
  4970. {
  4971. public:
  4972. ValueTree() throw();
  4973. explicit ValueTree (const String& type);
  4974. ValueTree (const ValueTree& other);
  4975. ValueTree& operator= (const ValueTree& other);
  4976. ~ValueTree();
  4977. bool operator== (const ValueTree& other) const;
  4978. bool operator!= (const ValueTree& other) const;
  4979. bool isValid() const { return object != 0; }
  4980. ValueTree createCopy() const;
  4981. const String getType() const;
  4982. bool hasType (const String& typeName) const;
  4983. const var& getProperty (const var::identifier& name) const;
  4984. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  4985. const var& operator[] (const var::identifier& name) const;
  4986. void setProperty (const var::identifier& name, const var& newValue, UndoManager* undoManager);
  4987. bool hasProperty (const var::identifier& name) const;
  4988. void removeProperty (const var::identifier& name, UndoManager* undoManager);
  4989. void removeAllProperties (UndoManager* undoManager);
  4990. int getNumProperties() const;
  4991. const var::identifier getPropertyName (int index) const;
  4992. Value getPropertyAsValue (const var::identifier& name, UndoManager* undoManager) const;
  4993. int getNumChildren() const;
  4994. ValueTree getChild (int index) const;
  4995. ValueTree getChildWithName (const String& type) const;
  4996. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4997. void addChild (ValueTree child, int index, UndoManager* undoManager);
  4998. void removeChild (const ValueTree& child, UndoManager* undoManager);
  4999. void removeChild (int childIndex, UndoManager* undoManager);
  5000. void removeAllChildren (UndoManager* undoManager);
  5001. void moveChild (int currentIndex, int newIndex, UndoManager* undoManager);
  5002. bool isAChildOf (const ValueTree& possibleParent) const;
  5003. int indexOf (const ValueTree& child) const;
  5004. ValueTree getParent() const;
  5005. XmlElement* createXml() const;
  5006. static ValueTree fromXml (const XmlElement& xml);
  5007. void writeToStream (OutputStream& output);
  5008. static ValueTree readFromStream (InputStream& input);
  5009. class JUCE_API Listener
  5010. {
  5011. public:
  5012. virtual ~Listener() {}
  5013. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  5014. const var::identifier& property) = 0;
  5015. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  5016. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  5017. };
  5018. void addListener (Listener* listener);
  5019. void removeListener (Listener* listener);
  5020. template <typename ElementComparator>
  5021. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  5022. {
  5023. if (object != 0)
  5024. {
  5025. ComparatorAdapter <ElementComparator> adapter (comparator);
  5026. object->children.sort (adapter, retainOrderOfEquivalentItems);
  5027. object->sendChildChangeMessage();
  5028. }
  5029. }
  5030. static const ValueTree invalid;
  5031. juce_UseDebuggingNewOperator
  5032. private:
  5033. class SetPropertyAction;
  5034. friend class SetPropertyAction;
  5035. class AddOrRemoveChildAction;
  5036. friend class AddOrRemoveChildAction;
  5037. class MoveChildAction;
  5038. friend class MoveChildAction;
  5039. class JUCE_API SharedObject : public ReferenceCountedObject
  5040. {
  5041. public:
  5042. explicit SharedObject (const String& type);
  5043. SharedObject (const SharedObject& other);
  5044. ~SharedObject();
  5045. const String type;
  5046. NamedValueSet properties;
  5047. ReferenceCountedArray <SharedObject> children;
  5048. SortedSet <ValueTree*> valueTreesWithListeners;
  5049. SharedObject* parent;
  5050. void sendPropertyChangeMessage (const var::identifier& property);
  5051. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  5052. void sendChildChangeMessage();
  5053. void sendChildChangeMessage (ValueTree& tree);
  5054. void sendParentChangeMessage();
  5055. const var& getProperty (const var::identifier& name) const;
  5056. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  5057. void setProperty (const var::identifier& name, const var& newValue, UndoManager*);
  5058. bool hasProperty (const var::identifier& name) const;
  5059. void removeProperty (const var::identifier& name, UndoManager*);
  5060. void removeAllProperties (UndoManager*);
  5061. bool isAChildOf (const SharedObject* possibleParent) const;
  5062. int indexOf (const ValueTree& child) const;
  5063. ValueTree getChildWithName (const String& type) const;
  5064. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  5065. void addChild (SharedObject* child, int index, UndoManager*);
  5066. void removeChild (int childIndex, UndoManager*);
  5067. void removeAllChildren (UndoManager*);
  5068. void moveChild (int currentIndex, int newIndex, UndoManager*);
  5069. XmlElement* createXml() const;
  5070. juce_UseDebuggingNewOperator
  5071. private:
  5072. SharedObject& operator= (const SharedObject&);
  5073. };
  5074. template <typename ElementComparator>
  5075. class ComparatorAdapter
  5076. {
  5077. public:
  5078. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  5079. int compareElements (SharedObject* const first, SharedObject* const second)
  5080. {
  5081. return comparator.compareElements (ValueTree (first), ValueTree (second));
  5082. }
  5083. private:
  5084. ElementComparator& comparator;
  5085. ComparatorAdapter (const ComparatorAdapter&);
  5086. ComparatorAdapter& operator= (const ComparatorAdapter&);
  5087. };
  5088. friend class SharedObject;
  5089. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  5090. SharedObjectPtr object;
  5091. ListenerList <Listener> listeners;
  5092. public:
  5093. explicit ValueTree (SharedObject*); // (can be made private when VC6 support is finally dropped)
  5094. };
  5095. #endif // __JUCE_VALUETREE_JUCEHEADER__
  5096. /*** End of inlined file: juce_ValueTree.h ***/
  5097. #endif
  5098. #ifndef __JUCE_VARIANT_JUCEHEADER__
  5099. #endif
  5100. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  5101. /*** Start of inlined file: juce_VoidArray.h ***/
  5102. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  5103. #define __JUCE_VOIDARRAY_JUCEHEADER__
  5104. typedef Array <void*> VoidArray;
  5105. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  5106. /*** End of inlined file: juce_VoidArray.h ***/
  5107. #endif
  5108. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  5109. #endif
  5110. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  5111. #endif
  5112. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  5113. /*** Start of inlined file: juce_FileLogger.h ***/
  5114. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  5115. #define __JUCE_FILELOGGER_JUCEHEADER__
  5116. class JUCE_API FileLogger : public Logger
  5117. {
  5118. public:
  5119. FileLogger (const File& fileToWriteTo,
  5120. const String& welcomeMessage,
  5121. const int maxInitialFileSizeBytes = 128 * 1024);
  5122. ~FileLogger();
  5123. void logMessage (const String& message);
  5124. const File getLogFile() const { return logFile; }
  5125. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  5126. const String& logFileName,
  5127. const String& welcomeMessage,
  5128. const int maxInitialFileSizeBytes = 128 * 1024);
  5129. juce_UseDebuggingNewOperator
  5130. private:
  5131. File logFile;
  5132. CriticalSection logLock;
  5133. ScopedPointer <FileOutputStream> logStream;
  5134. void trimFileSize (int maxFileSizeBytes) const;
  5135. FileLogger (const FileLogger&);
  5136. FileLogger& operator= (const FileLogger&);
  5137. };
  5138. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  5139. /*** End of inlined file: juce_FileLogger.h ***/
  5140. #endif
  5141. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5142. /*** Start of inlined file: juce_Initialisation.h ***/
  5143. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5144. #define __JUCE_INITIALISATION_JUCEHEADER__
  5145. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  5146. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  5147. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  5148. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  5149. class ScopedJuceInitialiser_NonGUI
  5150. {
  5151. public:
  5152. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  5153. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  5154. };
  5155. class ScopedJuceInitialiser_GUI
  5156. {
  5157. public:
  5158. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  5159. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  5160. };
  5161. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  5162. /*** End of inlined file: juce_Initialisation.h ***/
  5163. #endif
  5164. #ifndef __JUCE_LOGGER_JUCEHEADER__
  5165. #endif
  5166. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  5167. #endif
  5168. #ifndef __JUCE_MEMORY_JUCEHEADER__
  5169. #endif
  5170. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5171. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  5172. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5173. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5174. class JUCE_API PerformanceCounter
  5175. {
  5176. public:
  5177. PerformanceCounter (const String& counterName,
  5178. int runsPerPrintout = 100,
  5179. const File& loggingFile = File::nonexistent);
  5180. ~PerformanceCounter();
  5181. void start();
  5182. void stop();
  5183. void printStatistics();
  5184. juce_UseDebuggingNewOperator
  5185. private:
  5186. String name;
  5187. int numRuns, runsPerPrint;
  5188. double totalTime;
  5189. int64 started;
  5190. File outputFile;
  5191. };
  5192. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5193. /*** End of inlined file: juce_PerformanceCounter.h ***/
  5194. #endif
  5195. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  5196. #endif
  5197. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5198. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  5199. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5200. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5201. class JUCE_API PlatformUtilities
  5202. {
  5203. public:
  5204. static void beep();
  5205. static bool openDocument (const String& documentURL, const String& parameters);
  5206. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  5207. const String& emailSubject,
  5208. const String& bodyText,
  5209. const StringArray& filesToAttach);
  5210. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  5211. static const String cfStringToJuceString (CFStringRef cfString);
  5212. static CFStringRef juceStringToCFString (const String& s);
  5213. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5214. static const String makePathFromFSRef (FSRef* file);
  5215. static const String convertToPrecomposedUnicode (const String& s);
  5216. static OSType getTypeOfFile (const String& filename);
  5217. static bool isBundle (const String& filename);
  5218. static void addItemToDock (const File& file);
  5219. static int getOSXMinorVersionNumber();
  5220. #endif
  5221. #if JUCE_WINDOWS || DOXYGEN
  5222. // Some registry helper functions:
  5223. static const String getRegistryValue (const String& regValuePath,
  5224. const String& defaultValue = String::empty);
  5225. static void setRegistryValue (const String& regValuePath,
  5226. const String& value);
  5227. static bool registryValueExists (const String& regValuePath);
  5228. static void deleteRegistryValue (const String& regValuePath);
  5229. static void deleteRegistryKey (const String& regKeyPath);
  5230. static void registerFileAssociation (const String& fileExtension,
  5231. const String& symbolicDescription,
  5232. const String& fullDescription,
  5233. const File& targetExecutable,
  5234. int iconResourceNumber);
  5235. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5236. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5237. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5238. #endif
  5239. static void fpuReset();
  5240. #if JUCE_LINUX || JUCE_WINDOWS
  5241. static void* loadDynamicLibrary (const String& pathOrFilename);
  5242. static void freeDynamicLibrary (void* libraryHandle);
  5243. static void* getProcedureEntryPoint (void* libraryHandle,
  5244. const String& procedureName);
  5245. #endif
  5246. #if JUCE_LINUX || DOXYGEN
  5247. #endif
  5248. private:
  5249. PlatformUtilities();
  5250. PlatformUtilities (const PlatformUtilities&);
  5251. PlatformUtilities& operator= (const PlatformUtilities&);
  5252. };
  5253. #if JUCE_MAC || JUCE_IPHONE
  5254. class ScopedAutoReleasePool
  5255. {
  5256. public:
  5257. ScopedAutoReleasePool();
  5258. ~ScopedAutoReleasePool();
  5259. private:
  5260. void* pool;
  5261. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5262. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5263. };
  5264. #endif
  5265. #if JUCE_LINUX
  5266. class ScopedXLock
  5267. {
  5268. public:
  5269. ScopedXLock();
  5270. ~ScopedXLock();
  5271. };
  5272. #endif
  5273. #if JUCE_MAC
  5274. class JUCE_API AppleRemoteDevice
  5275. {
  5276. public:
  5277. AppleRemoteDevice();
  5278. virtual ~AppleRemoteDevice();
  5279. enum ButtonType
  5280. {
  5281. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5282. playButton, /**< The play button. */
  5283. plusButton, /**< The plus or volume-up button. */
  5284. minusButton, /**< The minus or volume-down button. */
  5285. rightButton, /**< The right button (if it's held for a short time). */
  5286. leftButton, /**< The left button (if it's held for a short time). */
  5287. rightButton_Long, /**< The right button (if it's held for a long time). */
  5288. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5289. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5290. playButtonSleepMode,
  5291. switched
  5292. };
  5293. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5294. bool start (const bool inExclusiveMode);
  5295. void stop();
  5296. bool isActive() const;
  5297. int getRemoteId() const { return remoteId; }
  5298. juce_UseDebuggingNewOperator
  5299. void handleCallbackInternal();
  5300. private:
  5301. void* device;
  5302. void* queue;
  5303. int remoteId;
  5304. bool open (const bool openInExclusiveMode);
  5305. AppleRemoteDevice (const AppleRemoteDevice&);
  5306. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5307. };
  5308. #endif
  5309. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5310. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5311. #endif
  5312. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5313. /*** Start of inlined file: juce_Random.h ***/
  5314. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5315. #define __JUCE_RANDOM_JUCEHEADER__
  5316. class JUCE_API Random
  5317. {
  5318. public:
  5319. explicit Random (int64 seedValue) throw();
  5320. ~Random() throw();
  5321. int nextInt() throw();
  5322. int nextInt (int maxValue) throw();
  5323. int64 nextInt64() throw();
  5324. float nextFloat() throw();
  5325. double nextDouble() throw();
  5326. bool nextBool() throw();
  5327. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5328. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5329. static Random& getSystemRandom() throw();
  5330. void setSeed (int64 newSeed) throw();
  5331. void combineSeed (int64 seedValue) throw();
  5332. void setSeedRandomly();
  5333. juce_UseDebuggingNewOperator
  5334. private:
  5335. int64 seed;
  5336. };
  5337. #endif // __JUCE_RANDOM_JUCEHEADER__
  5338. /*** End of inlined file: juce_Random.h ***/
  5339. #endif
  5340. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5341. #endif
  5342. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5343. /*** Start of inlined file: juce_Singleton.h ***/
  5344. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5345. #define __JUCE_SINGLETON_JUCEHEADER__
  5346. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5347. \
  5348. static classname* _singletonInstance; \
  5349. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5350. \
  5351. static classname* getInstance() \
  5352. { \
  5353. if (_singletonInstance == 0) \
  5354. {\
  5355. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5356. \
  5357. if (_singletonInstance == 0) \
  5358. { \
  5359. static bool alreadyInside = false; \
  5360. static bool createdOnceAlready = false; \
  5361. \
  5362. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5363. jassert (! problem); \
  5364. if (! problem) \
  5365. { \
  5366. createdOnceAlready = true; \
  5367. alreadyInside = true; \
  5368. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5369. alreadyInside = false; \
  5370. \
  5371. _singletonInstance = newObject; \
  5372. } \
  5373. } \
  5374. } \
  5375. \
  5376. return _singletonInstance; \
  5377. } \
  5378. \
  5379. static inline classname* getInstanceWithoutCreating() throw() \
  5380. { \
  5381. return _singletonInstance; \
  5382. } \
  5383. \
  5384. static void deleteInstance() \
  5385. { \
  5386. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5387. if (_singletonInstance != 0) \
  5388. { \
  5389. classname* const old = _singletonInstance; \
  5390. _singletonInstance = 0; \
  5391. delete old; \
  5392. } \
  5393. } \
  5394. \
  5395. void clearSingletonInstance() throw() \
  5396. { \
  5397. if (_singletonInstance == this) \
  5398. _singletonInstance = 0; \
  5399. }
  5400. #define juce_ImplementSingleton(classname) \
  5401. \
  5402. classname* classname::_singletonInstance = 0; \
  5403. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5404. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5405. \
  5406. static classname* _singletonInstance; \
  5407. \
  5408. static classname* getInstance() \
  5409. { \
  5410. if (_singletonInstance == 0) \
  5411. { \
  5412. static bool alreadyInside = false; \
  5413. static bool createdOnceAlready = false; \
  5414. \
  5415. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5416. jassert (! problem); \
  5417. if (! problem) \
  5418. { \
  5419. createdOnceAlready = true; \
  5420. alreadyInside = true; \
  5421. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5422. alreadyInside = false; \
  5423. \
  5424. _singletonInstance = newObject; \
  5425. } \
  5426. } \
  5427. \
  5428. return _singletonInstance; \
  5429. } \
  5430. \
  5431. static inline classname* getInstanceWithoutCreating() throw() \
  5432. { \
  5433. return _singletonInstance; \
  5434. } \
  5435. \
  5436. static void deleteInstance() \
  5437. { \
  5438. if (_singletonInstance != 0) \
  5439. { \
  5440. classname* const old = _singletonInstance; \
  5441. _singletonInstance = 0; \
  5442. delete old; \
  5443. } \
  5444. } \
  5445. \
  5446. void clearSingletonInstance() throw() \
  5447. { \
  5448. if (_singletonInstance == this) \
  5449. _singletonInstance = 0; \
  5450. }
  5451. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5452. \
  5453. static classname* _singletonInstance; \
  5454. \
  5455. static classname* getInstance() \
  5456. { \
  5457. if (_singletonInstance == 0) \
  5458. _singletonInstance = new classname(); \
  5459. \
  5460. return _singletonInstance; \
  5461. } \
  5462. \
  5463. static inline classname* getInstanceWithoutCreating() throw() \
  5464. { \
  5465. return _singletonInstance; \
  5466. } \
  5467. \
  5468. static void deleteInstance() \
  5469. { \
  5470. if (_singletonInstance != 0) \
  5471. { \
  5472. classname* const old = _singletonInstance; \
  5473. _singletonInstance = 0; \
  5474. delete old; \
  5475. } \
  5476. } \
  5477. \
  5478. void clearSingletonInstance() throw() \
  5479. { \
  5480. if (_singletonInstance == this) \
  5481. _singletonInstance = 0; \
  5482. }
  5483. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5484. \
  5485. classname* classname::_singletonInstance = 0;
  5486. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5487. /*** End of inlined file: juce_Singleton.h ***/
  5488. #endif
  5489. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5490. #endif
  5491. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5492. /*** Start of inlined file: juce_SystemStats.h ***/
  5493. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5494. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5495. class JUCE_API SystemStats
  5496. {
  5497. public:
  5498. static const String getJUCEVersion() throw();
  5499. enum OperatingSystemType
  5500. {
  5501. UnknownOS = 0,
  5502. MacOSX = 0x1000,
  5503. Linux = 0x2000,
  5504. Win95 = 0x4001,
  5505. Win98 = 0x4002,
  5506. WinNT351 = 0x4103,
  5507. WinNT40 = 0x4104,
  5508. Win2000 = 0x4105,
  5509. WinXP = 0x4106,
  5510. WinVista = 0x4107,
  5511. Windows7 = 0x4108,
  5512. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5513. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5514. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5515. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5516. };
  5517. static OperatingSystemType getOperatingSystemType() throw();
  5518. static const String getOperatingSystemName() throw();
  5519. static bool isOperatingSystem64Bit() throw();
  5520. static const String getLogonName();
  5521. static const String getFullUserName();
  5522. // CPU and memory information..
  5523. static int getCpuSpeedInMegaherz() throw();
  5524. static const String getCpuVendor() throw();
  5525. static bool hasMMX() throw();
  5526. static bool hasSSE() throw();
  5527. static bool hasSSE2() throw();
  5528. static bool has3DNow() throw();
  5529. static int getNumCpus() throw();
  5530. static int64 getClockCycleCounter() throw();
  5531. static int getMemorySizeInMegabytes() throw();
  5532. static int getPageSize() throw();
  5533. static int getMACAddresses (int64* addresses, int maxNum,
  5534. #if JUCE_MAC
  5535. bool littleEndian = true);
  5536. #else
  5537. bool littleEndian = false);
  5538. #endif
  5539. static const StringArray getMACAddressStrings();
  5540. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5541. static void initialiseStats() throw();
  5542. private:
  5543. SystemStats();
  5544. SystemStats (const SystemStats&);
  5545. SystemStats& operator= (const SystemStats&);
  5546. };
  5547. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5548. /*** End of inlined file: juce_SystemStats.h ***/
  5549. #endif
  5550. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5551. #endif
  5552. #ifndef __JUCE_TIME_JUCEHEADER__
  5553. #endif
  5554. #ifndef __JUCE_UUID_JUCEHEADER__
  5555. /*** Start of inlined file: juce_Uuid.h ***/
  5556. #ifndef __JUCE_UUID_JUCEHEADER__
  5557. #define __JUCE_UUID_JUCEHEADER__
  5558. class JUCE_API Uuid
  5559. {
  5560. public:
  5561. Uuid();
  5562. ~Uuid() throw();
  5563. Uuid (const Uuid& other);
  5564. Uuid& operator= (const Uuid& other);
  5565. bool isNull() const throw();
  5566. bool operator== (const Uuid& other) const;
  5567. bool operator!= (const Uuid& other) const;
  5568. const String toString() const;
  5569. Uuid (const String& uuidString);
  5570. Uuid& operator= (const String& uuidString);
  5571. const uint8* getRawData() const throw() { return value.asBytes; }
  5572. Uuid (const uint8* const rawData);
  5573. Uuid& operator= (const uint8* const rawData);
  5574. juce_UseDebuggingNewOperator
  5575. private:
  5576. union
  5577. {
  5578. uint8 asBytes [16];
  5579. int asInt[4];
  5580. int64 asInt64[2];
  5581. } value;
  5582. };
  5583. #endif // __JUCE_UUID_JUCEHEADER__
  5584. /*** End of inlined file: juce_Uuid.h ***/
  5585. #endif
  5586. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5587. /*** Start of inlined file: juce_BlowFish.h ***/
  5588. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5589. #define __JUCE_BLOWFISH_JUCEHEADER__
  5590. class JUCE_API BlowFish
  5591. {
  5592. public:
  5593. BlowFish (const void* keyData, int keyBytes);
  5594. BlowFish (const BlowFish& other);
  5595. BlowFish& operator= (const BlowFish& other);
  5596. ~BlowFish();
  5597. void encrypt (uint32& data1, uint32& data2) const throw();
  5598. void decrypt (uint32& data1, uint32& data2) const throw();
  5599. juce_UseDebuggingNewOperator
  5600. private:
  5601. uint32 p[18];
  5602. HeapBlock <uint32> s[4];
  5603. uint32 F (uint32 x) const throw();
  5604. };
  5605. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5606. /*** End of inlined file: juce_BlowFish.h ***/
  5607. #endif
  5608. #ifndef __JUCE_MD5_JUCEHEADER__
  5609. /*** Start of inlined file: juce_MD5.h ***/
  5610. #ifndef __JUCE_MD5_JUCEHEADER__
  5611. #define __JUCE_MD5_JUCEHEADER__
  5612. class JUCE_API MD5
  5613. {
  5614. public:
  5615. MD5();
  5616. MD5 (const MD5& other);
  5617. MD5& operator= (const MD5& other);
  5618. explicit MD5 (const MemoryBlock& data);
  5619. MD5 (const void* data, const size_t numBytes);
  5620. explicit MD5 (const String& text);
  5621. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5622. explicit MD5 (const File& file);
  5623. ~MD5();
  5624. const MemoryBlock getRawChecksumData() const;
  5625. const String toHexString() const;
  5626. bool operator== (const MD5& other) const;
  5627. bool operator!= (const MD5& other) const;
  5628. juce_UseDebuggingNewOperator
  5629. private:
  5630. uint8 result [16];
  5631. struct ProcessContext
  5632. {
  5633. uint8 buffer [64];
  5634. uint32 state [4];
  5635. uint32 count [2];
  5636. ProcessContext();
  5637. void processBlock (const void* data, size_t dataSize);
  5638. void transform (const void* buffer);
  5639. void finish (void* const result);
  5640. };
  5641. void processStream (InputStream& input, int64 numBytesToRead);
  5642. };
  5643. #endif // __JUCE_MD5_JUCEHEADER__
  5644. /*** End of inlined file: juce_MD5.h ***/
  5645. #endif
  5646. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5647. /*** Start of inlined file: juce_Primes.h ***/
  5648. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5649. #define __JUCE_PRIMES_JUCEHEADER__
  5650. class JUCE_API Primes
  5651. {
  5652. public:
  5653. static const BigInteger createProbablePrime (int bitLength,
  5654. int certainty,
  5655. const int* randomSeeds = 0,
  5656. int numRandomSeeds = 0);
  5657. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5658. private:
  5659. Primes();
  5660. Primes (const Primes&);
  5661. Primes& operator= (const Primes&);
  5662. };
  5663. #endif // __JUCE_PRIMES_JUCEHEADER__
  5664. /*** End of inlined file: juce_Primes.h ***/
  5665. #endif
  5666. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5667. /*** Start of inlined file: juce_RSAKey.h ***/
  5668. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5669. #define __JUCE_RSAKEY_JUCEHEADER__
  5670. class JUCE_API RSAKey
  5671. {
  5672. public:
  5673. RSAKey();
  5674. explicit RSAKey (const String& stringRepresentation);
  5675. ~RSAKey();
  5676. const String toString() const;
  5677. bool applyToValue (BigInteger& value) const;
  5678. static void createKeyPair (RSAKey& publicKey,
  5679. RSAKey& privateKey,
  5680. int numBits,
  5681. const int* randomSeeds = 0,
  5682. int numRandomSeeds = 0);
  5683. juce_UseDebuggingNewOperator
  5684. protected:
  5685. BigInteger part1, part2;
  5686. };
  5687. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5688. /*** End of inlined file: juce_RSAKey.h ***/
  5689. #endif
  5690. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5691. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5692. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5693. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5694. class JUCE_API DirectoryIterator
  5695. {
  5696. public:
  5697. DirectoryIterator (const File& directory,
  5698. bool isRecursive,
  5699. const String& wildCard = "*",
  5700. int whatToLookFor = File::findFiles);
  5701. ~DirectoryIterator();
  5702. bool next();
  5703. bool next (bool* isDirectory, bool* isHidden, int64* fileSize,
  5704. Time* modTime, Time* creationTime, bool* isReadOnly);
  5705. const File getFile() const;
  5706. float getEstimatedProgress() const;
  5707. juce_UseDebuggingNewOperator
  5708. private:
  5709. friend class File;
  5710. class NativeIterator
  5711. {
  5712. public:
  5713. NativeIterator (const File& directory, const String& wildCard);
  5714. ~NativeIterator();
  5715. bool next (String& filenameFound,
  5716. bool* isDirectory, bool* isHidden, int64* fileSize,
  5717. Time* modTime, Time* creationTime, bool* isReadOnly);
  5718. class Pimpl;
  5719. juce_UseDebuggingNewOperator
  5720. private:
  5721. friend class DirectoryIterator;
  5722. friend class ScopedPointer<Pimpl>;
  5723. ScopedPointer<Pimpl> pimpl;
  5724. NativeIterator (const NativeIterator&);
  5725. NativeIterator& operator= (const NativeIterator&);
  5726. };
  5727. friend class ScopedPointer<NativeIterator::Pimpl>;
  5728. NativeIterator fileFinder;
  5729. String wildCard, path;
  5730. int index;
  5731. mutable int totalNumFiles;
  5732. const int whatToLookFor;
  5733. const bool isRecursive;
  5734. ScopedPointer <DirectoryIterator> subIterator;
  5735. File currentFile;
  5736. DirectoryIterator (const DirectoryIterator&);
  5737. DirectoryIterator& operator= (const DirectoryIterator&);
  5738. };
  5739. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5740. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5741. #endif
  5742. #ifndef __JUCE_FILE_JUCEHEADER__
  5743. #endif
  5744. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5745. /*** Start of inlined file: juce_FileInputStream.h ***/
  5746. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5747. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5748. class JUCE_API FileInputStream : public InputStream
  5749. {
  5750. public:
  5751. explicit FileInputStream (const File& fileToRead);
  5752. ~FileInputStream();
  5753. const File& getFile() const throw() { return file; }
  5754. int64 getTotalLength();
  5755. int read (void* destBuffer, int maxBytesToRead);
  5756. bool isExhausted();
  5757. int64 getPosition();
  5758. bool setPosition (int64 pos);
  5759. juce_UseDebuggingNewOperator
  5760. private:
  5761. File file;
  5762. void* fileHandle;
  5763. int64 currentPosition, totalSize;
  5764. bool needToSeek;
  5765. FileInputStream (const FileInputStream&);
  5766. FileInputStream& operator= (const FileInputStream&);
  5767. };
  5768. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5769. /*** End of inlined file: juce_FileInputStream.h ***/
  5770. #endif
  5771. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5772. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5773. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5774. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5775. class JUCE_API FileOutputStream : public OutputStream
  5776. {
  5777. public:
  5778. FileOutputStream (const File& fileToWriteTo,
  5779. int bufferSizeToUse = 16384);
  5780. ~FileOutputStream();
  5781. const File& getFile() const { return file; }
  5782. bool failedToOpen() const { return fileHandle == 0; }
  5783. void flush();
  5784. int64 getPosition();
  5785. bool setPosition (int64 pos);
  5786. bool write (const void* data, int numBytes);
  5787. juce_UseDebuggingNewOperator
  5788. private:
  5789. File file;
  5790. void* fileHandle;
  5791. int64 currentPosition;
  5792. int bufferSize, bytesInBuffer;
  5793. HeapBlock <char> buffer;
  5794. void flushInternal();
  5795. int64 getPositionInternal() const;
  5796. FileOutputStream (const FileOutputStream&);
  5797. FileOutputStream& operator= (const FileOutputStream&);
  5798. };
  5799. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5800. /*** End of inlined file: juce_FileOutputStream.h ***/
  5801. #endif
  5802. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5803. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5804. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5805. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5806. class JUCE_API FileSearchPath
  5807. {
  5808. public:
  5809. FileSearchPath();
  5810. FileSearchPath (const String& path);
  5811. FileSearchPath (const FileSearchPath& other);
  5812. ~FileSearchPath();
  5813. FileSearchPath& operator= (const String& path);
  5814. int getNumPaths() const;
  5815. const File operator[] (int index) const;
  5816. const String toString() const;
  5817. void add (const File& directoryToAdd,
  5818. int insertIndex = -1);
  5819. void addIfNotAlreadyThere (const File& directoryToAdd);
  5820. void remove (int indexToRemove);
  5821. void addPath (const FileSearchPath& other);
  5822. void removeRedundantPaths();
  5823. void removeNonExistentPaths();
  5824. int findChildFiles (Array<File>& results,
  5825. int whatToLookFor,
  5826. bool searchRecursively,
  5827. const String& wildCardPattern = "*") const;
  5828. bool isFileInPath (const File& fileToCheck,
  5829. bool checkRecursively) const;
  5830. juce_UseDebuggingNewOperator
  5831. private:
  5832. StringArray directories;
  5833. void init (const String& path);
  5834. };
  5835. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5836. /*** End of inlined file: juce_FileSearchPath.h ***/
  5837. #endif
  5838. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5839. /*** Start of inlined file: juce_NamedPipe.h ***/
  5840. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5841. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5842. class JUCE_API NamedPipe
  5843. {
  5844. public:
  5845. NamedPipe();
  5846. ~NamedPipe();
  5847. bool openExisting (const String& pipeName);
  5848. bool createNewPipe (const String& pipeName);
  5849. void close();
  5850. bool isOpen() const;
  5851. const String getName() const;
  5852. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5853. int write (const void* sourceBuffer, int numBytesToWrite,
  5854. int timeOutMilliseconds = 2000);
  5855. void cancelPendingReads();
  5856. juce_UseDebuggingNewOperator
  5857. private:
  5858. void* internal;
  5859. String currentPipeName;
  5860. CriticalSection lock;
  5861. NamedPipe (const NamedPipe&);
  5862. NamedPipe& operator= (const NamedPipe&);
  5863. bool openInternal (const String& pipeName, const bool createPipe);
  5864. };
  5865. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5866. /*** End of inlined file: juce_NamedPipe.h ***/
  5867. #endif
  5868. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5869. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5870. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5871. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5872. class JUCE_API TemporaryFile
  5873. {
  5874. public:
  5875. enum OptionFlags
  5876. {
  5877. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5878. i.e. its name should start with a dot. */
  5879. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5880. the file is unique, they should go in brackets rather
  5881. than just being appended (see File::getNonexistentSibling() )*/
  5882. };
  5883. TemporaryFile (const String& suffix = String::empty,
  5884. int optionFlags = 0);
  5885. TemporaryFile (const File& targetFile,
  5886. int optionFlags = 0);
  5887. ~TemporaryFile();
  5888. const File getFile() const { return temporaryFile; }
  5889. const File getTargetFile() const { return targetFile; }
  5890. bool overwriteTargetFileWithTemporary() const;
  5891. juce_UseDebuggingNewOperator
  5892. private:
  5893. File temporaryFile, targetFile;
  5894. void createTempFile (const File& parentDirectory, String name, const String& suffix, int optionFlags);
  5895. TemporaryFile (const TemporaryFile&);
  5896. TemporaryFile& operator= (const TemporaryFile&);
  5897. };
  5898. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5899. /*** End of inlined file: juce_TemporaryFile.h ***/
  5900. #endif
  5901. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5902. /*** Start of inlined file: juce_ZipFile.h ***/
  5903. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5904. #define __JUCE_ZIPFILE_JUCEHEADER__
  5905. /*** Start of inlined file: juce_InputSource.h ***/
  5906. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5907. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5908. class JUCE_API InputSource
  5909. {
  5910. public:
  5911. InputSource() throw() {}
  5912. virtual ~InputSource() {}
  5913. virtual InputStream* createInputStream() = 0;
  5914. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5915. virtual int64 hashCode() const = 0;
  5916. juce_UseDebuggingNewOperator
  5917. };
  5918. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5919. /*** End of inlined file: juce_InputSource.h ***/
  5920. class JUCE_API ZipFile
  5921. {
  5922. public:
  5923. ZipFile (InputStream* inputStream,
  5924. bool deleteStreamWhenDestroyed) throw();
  5925. ZipFile (const File& file);
  5926. ZipFile (InputSource* inputSource);
  5927. ~ZipFile() throw();
  5928. struct ZipEntry
  5929. {
  5930. String filename;
  5931. unsigned int uncompressedSize;
  5932. Time fileTime;
  5933. };
  5934. int getNumEntries() const throw();
  5935. const ZipEntry* getEntry (int index) const throw();
  5936. int getIndexOfFileName (const String& fileName) const throw();
  5937. const ZipEntry* getEntry (const String& fileName) const throw();
  5938. void sortEntriesByFilename();
  5939. InputStream* createStreamForEntry (int index);
  5940. void uncompressTo (const File& targetDirectory,
  5941. bool shouldOverwriteFiles = true);
  5942. juce_UseDebuggingNewOperator
  5943. private:
  5944. class ZipInputStream;
  5945. class ZipFilenameComparator;
  5946. class ZipEntryInfo;
  5947. friend class ZipInputStream;
  5948. friend class ZipFilenameComparator;
  5949. friend class ZipEntryInfo;
  5950. OwnedArray <ZipEntryInfo> entries;
  5951. CriticalSection lock;
  5952. InputStream* inputStream;
  5953. ScopedPointer <InputStream> streamToDelete;
  5954. ScopedPointer <InputSource> inputSource;
  5955. #if JUCE_DEBUG
  5956. int numOpenStreams;
  5957. #endif
  5958. void init();
  5959. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5960. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5961. ZipFile (const ZipFile&);
  5962. ZipFile& operator= (const ZipFile&);
  5963. };
  5964. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5965. /*** End of inlined file: juce_ZipFile.h ***/
  5966. #endif
  5967. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5968. /*** Start of inlined file: juce_Socket.h ***/
  5969. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5970. #define __JUCE_SOCKET_JUCEHEADER__
  5971. class JUCE_API StreamingSocket
  5972. {
  5973. public:
  5974. StreamingSocket();
  5975. ~StreamingSocket();
  5976. bool bindToPort (int localPortNumber);
  5977. bool connect (const String& remoteHostname,
  5978. int remotePortNumber,
  5979. int timeOutMillisecs = 3000);
  5980. bool isConnected() const throw() { return connected; }
  5981. void close();
  5982. const String& getHostName() const throw() { return hostName; }
  5983. int getPort() const throw() { return portNumber; }
  5984. bool isLocal() const throw();
  5985. int waitUntilReady (bool readyForReading,
  5986. int timeoutMsecs) const;
  5987. int read (void* destBuffer, int maxBytesToRead,
  5988. bool blockUntilSpecifiedAmountHasArrived);
  5989. int write (const void* sourceBuffer, int numBytesToWrite);
  5990. bool createListener (int portNumber, const String& localHostName = String::empty);
  5991. StreamingSocket* waitForNextConnection() const;
  5992. juce_UseDebuggingNewOperator
  5993. private:
  5994. String hostName;
  5995. int volatile portNumber, handle;
  5996. bool connected, isListener;
  5997. StreamingSocket (const String& hostname, int portNumber, int handle);
  5998. StreamingSocket (const StreamingSocket&);
  5999. StreamingSocket& operator= (const StreamingSocket&);
  6000. };
  6001. class JUCE_API DatagramSocket
  6002. {
  6003. public:
  6004. DatagramSocket (int localPortNumber,
  6005. bool enableBroadcasting = false);
  6006. ~DatagramSocket();
  6007. bool bindToPort (int localPortNumber);
  6008. bool connect (const String& remoteHostname,
  6009. int remotePortNumber,
  6010. int timeOutMillisecs = 3000);
  6011. bool isConnected() const throw() { return connected; }
  6012. void close();
  6013. const String& getHostName() const throw() { return hostName; }
  6014. int getPort() const throw() { return portNumber; }
  6015. bool isLocal() const throw();
  6016. int waitUntilReady (bool readyForReading,
  6017. int timeoutMsecs) const;
  6018. int read (void* destBuffer, int maxBytesToRead,
  6019. bool blockUntilSpecifiedAmountHasArrived);
  6020. int write (const void* sourceBuffer, int numBytesToWrite);
  6021. DatagramSocket* waitForNextConnection() const;
  6022. juce_UseDebuggingNewOperator
  6023. private:
  6024. String hostName;
  6025. int volatile portNumber, handle;
  6026. bool connected, allowBroadcast;
  6027. void* serverAddress;
  6028. DatagramSocket (const String& hostname, int portNumber, int handle, int localPortNumber);
  6029. DatagramSocket (const DatagramSocket&);
  6030. DatagramSocket& operator= (const DatagramSocket&);
  6031. };
  6032. #endif // __JUCE_SOCKET_JUCEHEADER__
  6033. /*** End of inlined file: juce_Socket.h ***/
  6034. #endif
  6035. #ifndef __JUCE_URL_JUCEHEADER__
  6036. /*** Start of inlined file: juce_URL.h ***/
  6037. #ifndef __JUCE_URL_JUCEHEADER__
  6038. #define __JUCE_URL_JUCEHEADER__
  6039. class JUCE_API URL
  6040. {
  6041. public:
  6042. URL();
  6043. URL (const String& url);
  6044. URL (const URL& other);
  6045. ~URL();
  6046. URL& operator= (const URL& other);
  6047. const String toString (bool includeGetParameters) const;
  6048. bool isWellFormed() const;
  6049. const String getDomain() const;
  6050. const String getSubPath() const;
  6051. const String getScheme() const;
  6052. const URL withNewSubPath (const String& newPath) const;
  6053. const URL withParameter (const String& parameterName,
  6054. const String& parameterValue) const;
  6055. const URL withFileToUpload (const String& parameterName,
  6056. const File& fileToUpload,
  6057. const String& mimeType) const;
  6058. const StringPairArray& getParameters() const;
  6059. const StringPairArray& getFilesToUpload() const;
  6060. const StringPairArray& getMimeTypesOfUploadFiles() const;
  6061. const URL withPOSTData (const String& postData) const;
  6062. const String getPostData() const { return postData; }
  6063. bool launchInDefaultBrowser() const;
  6064. static bool isProbablyAWebsiteURL (const String& possibleURL);
  6065. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  6066. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  6067. InputStream* createInputStream (bool usePostCommand,
  6068. OpenStreamProgressCallback* progressCallback = 0,
  6069. void* progressCallbackContext = 0,
  6070. const String& extraHeaders = String::empty,
  6071. int connectionTimeOutMs = 0) const;
  6072. bool readEntireBinaryStream (MemoryBlock& destData,
  6073. bool usePostCommand = false) const;
  6074. const String readEntireTextStream (bool usePostCommand = false) const;
  6075. XmlElement* readEntireXmlStream (bool usePostCommand = false) const;
  6076. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  6077. bool isParameter);
  6078. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  6079. juce_UseDebuggingNewOperator
  6080. private:
  6081. String url, postData;
  6082. StringPairArray parameters, filesToUpload, mimeTypes;
  6083. };
  6084. #endif // __JUCE_URL_JUCEHEADER__
  6085. /*** End of inlined file: juce_URL.h ***/
  6086. #endif
  6087. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  6088. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  6089. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  6090. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  6091. class JUCE_API BufferedInputStream : public InputStream
  6092. {
  6093. public:
  6094. BufferedInputStream (InputStream* sourceStream,
  6095. int bufferSize,
  6096. bool deleteSourceWhenDestroyed);
  6097. ~BufferedInputStream();
  6098. int64 getTotalLength();
  6099. int64 getPosition();
  6100. bool setPosition (int64 newPosition);
  6101. int read (void* destBuffer, int maxBytesToRead);
  6102. const String readString();
  6103. bool isExhausted();
  6104. juce_UseDebuggingNewOperator
  6105. private:
  6106. InputStream* const source;
  6107. ScopedPointer <InputStream> sourceToDelete;
  6108. int bufferSize;
  6109. int64 position, lastReadPos, bufferStart, bufferOverlap;
  6110. HeapBlock <char> buffer;
  6111. void ensureBuffered();
  6112. BufferedInputStream (const BufferedInputStream&);
  6113. BufferedInputStream& operator= (const BufferedInputStream&);
  6114. };
  6115. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  6116. /*** End of inlined file: juce_BufferedInputStream.h ***/
  6117. #endif
  6118. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6119. /*** Start of inlined file: juce_FileInputSource.h ***/
  6120. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6121. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6122. class JUCE_API FileInputSource : public InputSource
  6123. {
  6124. public:
  6125. FileInputSource (const File& file);
  6126. ~FileInputSource();
  6127. InputStream* createInputStream();
  6128. InputStream* createInputStreamFor (const String& relatedItemPath);
  6129. int64 hashCode() const;
  6130. juce_UseDebuggingNewOperator
  6131. private:
  6132. const File file;
  6133. FileInputSource (const FileInputSource&);
  6134. FileInputSource& operator= (const FileInputSource&);
  6135. };
  6136. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6137. /*** End of inlined file: juce_FileInputSource.h ***/
  6138. #endif
  6139. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6140. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6141. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6142. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6143. class GZIPCompressorHelper;
  6144. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  6145. {
  6146. public:
  6147. GZIPCompressorOutputStream (OutputStream* destStream,
  6148. int compressionLevel = 0,
  6149. bool deleteDestStreamWhenDestroyed = false,
  6150. bool noWrap = false);
  6151. ~GZIPCompressorOutputStream();
  6152. void flush();
  6153. int64 getPosition();
  6154. bool setPosition (int64 newPosition);
  6155. bool write (const void* destBuffer, int howMany);
  6156. juce_UseDebuggingNewOperator
  6157. private:
  6158. OutputStream* const destStream;
  6159. ScopedPointer <OutputStream> streamToDelete;
  6160. HeapBlock <uint8> buffer;
  6161. ScopedPointer <GZIPCompressorHelper> helper;
  6162. bool doNextBlock();
  6163. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  6164. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  6165. };
  6166. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6167. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6168. #endif
  6169. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6170. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6171. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6172. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6173. class GZIPDecompressHelper;
  6174. class JUCE_API GZIPDecompressorInputStream : public InputStream
  6175. {
  6176. public:
  6177. GZIPDecompressorInputStream (InputStream* sourceStream,
  6178. bool deleteSourceWhenDestroyed,
  6179. bool noWrap = false,
  6180. int64 uncompressedStreamLength = -1);
  6181. ~GZIPDecompressorInputStream();
  6182. int64 getPosition();
  6183. bool setPosition (int64 pos);
  6184. int64 getTotalLength();
  6185. bool isExhausted();
  6186. int read (void* destBuffer, int maxBytesToRead);
  6187. juce_UseDebuggingNewOperator
  6188. private:
  6189. InputStream* const sourceStream;
  6190. ScopedPointer <InputStream> streamToDelete;
  6191. const int64 uncompressedStreamLength;
  6192. const bool noWrap;
  6193. bool isEof;
  6194. int activeBufferSize;
  6195. int64 originalSourcePos, currentPos;
  6196. HeapBlock <uint8> buffer;
  6197. ScopedPointer <GZIPDecompressHelper> helper;
  6198. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  6199. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  6200. };
  6201. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6202. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6203. #endif
  6204. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  6205. #endif
  6206. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  6207. #endif
  6208. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6209. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  6210. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6211. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6212. class JUCE_API MemoryInputStream : public InputStream
  6213. {
  6214. public:
  6215. MemoryInputStream (const void* sourceData,
  6216. size_t sourceDataSize,
  6217. bool keepInternalCopyOfData);
  6218. MemoryInputStream (const MemoryBlock& data,
  6219. bool keepInternalCopyOfData);
  6220. ~MemoryInputStream();
  6221. int64 getPosition();
  6222. bool setPosition (int64 pos);
  6223. int64 getTotalLength();
  6224. bool isExhausted();
  6225. int read (void* destBuffer, int maxBytesToRead);
  6226. juce_UseDebuggingNewOperator
  6227. private:
  6228. const char* data;
  6229. size_t dataSize, position;
  6230. MemoryBlock internalCopy;
  6231. MemoryInputStream (const MemoryInputStream&);
  6232. MemoryInputStream& operator= (const MemoryInputStream&);
  6233. };
  6234. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6235. /*** End of inlined file: juce_MemoryInputStream.h ***/
  6236. #endif
  6237. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6238. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  6239. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6240. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6241. class JUCE_API MemoryOutputStream : public OutputStream
  6242. {
  6243. public:
  6244. MemoryOutputStream (size_t initialSize = 256,
  6245. size_t granularity = 256,
  6246. MemoryBlock* memoryBlockToWriteTo = 0);
  6247. ~MemoryOutputStream();
  6248. const char* getData() const throw();
  6249. size_t getDataSize() const throw() { return size; }
  6250. void reset() throw();
  6251. const String toUTF8() const;
  6252. void flush();
  6253. bool write (const void* buffer, int howMany);
  6254. int64 getPosition() { return position; }
  6255. bool setPosition (int64 newPosition);
  6256. juce_UseDebuggingNewOperator
  6257. private:
  6258. MemoryBlock* data;
  6259. ScopedPointer <MemoryBlock> dataToDelete;
  6260. size_t position, size, blockSize;
  6261. MemoryOutputStream (const MemoryOutputStream&);
  6262. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6263. };
  6264. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6265. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6266. #endif
  6267. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6268. #endif
  6269. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6270. /*** Start of inlined file: juce_SubregionStream.h ***/
  6271. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6272. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6273. class JUCE_API SubregionStream : public InputStream
  6274. {
  6275. public:
  6276. SubregionStream (InputStream* sourceStream,
  6277. int64 startPositionInSourceStream,
  6278. int64 lengthOfSourceStream,
  6279. bool deleteSourceWhenDestroyed) throw();
  6280. ~SubregionStream() throw();
  6281. int64 getTotalLength();
  6282. int64 getPosition();
  6283. bool setPosition (int64 newPosition);
  6284. int read (void* destBuffer, int maxBytesToRead);
  6285. bool isExhausted();
  6286. juce_UseDebuggingNewOperator
  6287. private:
  6288. InputStream* const source;
  6289. ScopedPointer <InputStream> sourceToDelete;
  6290. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6291. SubregionStream (const SubregionStream&);
  6292. SubregionStream& operator= (const SubregionStream&);
  6293. };
  6294. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6295. /*** End of inlined file: juce_SubregionStream.h ***/
  6296. #endif
  6297. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6298. #endif
  6299. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6300. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6301. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6302. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6303. #define TRANS(stringLiteral) \
  6304. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6305. class JUCE_API LocalisedStrings
  6306. {
  6307. public:
  6308. LocalisedStrings (const String& fileContents);
  6309. LocalisedStrings (const File& fileToLoad);
  6310. ~LocalisedStrings();
  6311. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6312. static LocalisedStrings* getCurrentMappings();
  6313. static const String translateWithCurrentMappings (const String& text);
  6314. static const String translateWithCurrentMappings (const char* text);
  6315. const String translate (const String& text) const;
  6316. const String getLanguageName() const { return languageName; }
  6317. const StringArray getCountryCodes() const { return countryCodes; }
  6318. void setIgnoresCase (const bool shouldIgnoreCase);
  6319. juce_UseDebuggingNewOperator
  6320. private:
  6321. String languageName;
  6322. StringArray countryCodes;
  6323. StringPairArray translations;
  6324. void loadFromText (const String& fileContents);
  6325. };
  6326. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6327. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6328. #endif
  6329. #ifndef __JUCE_STRING_JUCEHEADER__
  6330. #endif
  6331. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6332. #endif
  6333. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6334. #endif
  6335. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6336. /*** Start of inlined file: juce_XmlDocument.h ***/
  6337. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6338. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6339. class JUCE_API XmlDocument
  6340. {
  6341. public:
  6342. XmlDocument (const String& documentText);
  6343. XmlDocument (const File& file);
  6344. ~XmlDocument();
  6345. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6346. const String& getLastParseError() const throw();
  6347. void setInputSource (InputSource* const newSource) throw();
  6348. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6349. juce_UseDebuggingNewOperator
  6350. private:
  6351. String originalText;
  6352. const juce_wchar* input;
  6353. bool outOfData, errorOccurred;
  6354. bool identifierLookupTable [128];
  6355. String lastError, dtdText;
  6356. StringArray tokenisedDTD;
  6357. bool needToLoadDTD, ignoreEmptyTextElements;
  6358. ScopedPointer <InputSource> inputSource;
  6359. void setLastError (const String& desc, const bool carryOn);
  6360. void skipHeader();
  6361. void skipNextWhiteSpace();
  6362. juce_wchar readNextChar() throw();
  6363. XmlElement* readNextElement (const bool alsoParseSubElements);
  6364. void readChildElements (XmlElement* parent);
  6365. int findNextTokenLength() throw();
  6366. void readQuotedString (String& result);
  6367. void readEntity (String& result);
  6368. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6369. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6370. const String getFileContents (const String& filename) const;
  6371. const String expandEntity (const String& entity);
  6372. const String expandExternalEntity (const String& entity);
  6373. const String getParameterEntity (const String& entity);
  6374. XmlDocument (const XmlDocument&);
  6375. XmlDocument& operator= (const XmlDocument&);
  6376. };
  6377. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6378. /*** End of inlined file: juce_XmlDocument.h ***/
  6379. #endif
  6380. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6381. #endif
  6382. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6383. #endif
  6384. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6385. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6386. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6387. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6388. class JUCE_API InterProcessLock
  6389. {
  6390. public:
  6391. explicit InterProcessLock (const String& name);
  6392. ~InterProcessLock();
  6393. bool enter (int timeOutMillisecs = -1);
  6394. void exit();
  6395. class ScopedLockType
  6396. {
  6397. public:
  6398. explicit ScopedLockType (InterProcessLock& lock) : lock_ (lock) { lockWasSuccessful = lock.enter(); }
  6399. inline ~ScopedLockType() { lock_.exit(); }
  6400. bool isLocked() const throw() { return lockWasSuccessful; }
  6401. private:
  6402. InterProcessLock& lock_;
  6403. bool lockWasSuccessful;
  6404. ScopedLockType (const ScopedLockType&);
  6405. ScopedLockType& operator= (const ScopedLockType&);
  6406. };
  6407. juce_UseDebuggingNewOperator
  6408. private:
  6409. class Pimpl;
  6410. friend class ScopedPointer <Pimpl>;
  6411. ScopedPointer <Pimpl> pimpl;
  6412. CriticalSection lock;
  6413. String name;
  6414. InterProcessLock (const InterProcessLock&);
  6415. InterProcessLock& operator= (const InterProcessLock&);
  6416. };
  6417. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6418. /*** End of inlined file: juce_InterProcessLock.h ***/
  6419. #endif
  6420. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6421. /*** Start of inlined file: juce_Process.h ***/
  6422. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6423. #define __JUCE_PROCESS_JUCEHEADER__
  6424. class JUCE_API Process
  6425. {
  6426. public:
  6427. enum ProcessPriority
  6428. {
  6429. LowPriority = 0,
  6430. NormalPriority = 1,
  6431. HighPriority = 2,
  6432. RealtimePriority = 3
  6433. };
  6434. static void setPriority (const ProcessPriority priority);
  6435. static void terminate();
  6436. static bool isForegroundProcess();
  6437. static void raisePrivilege();
  6438. static void lowerPrivilege();
  6439. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6440. private:
  6441. Process();
  6442. Process (const Process&);
  6443. Process& operator= (const Process&);
  6444. };
  6445. #endif // __JUCE_PROCESS_JUCEHEADER__
  6446. /*** End of inlined file: juce_Process.h ***/
  6447. #endif
  6448. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6449. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6450. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6451. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6452. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6453. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6454. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6455. class JUCE_API WaitableEvent
  6456. {
  6457. public:
  6458. WaitableEvent (bool manualReset = false) throw();
  6459. ~WaitableEvent() throw();
  6460. bool wait (int timeOutMilliseconds = -1) const throw();
  6461. void signal() const throw();
  6462. void reset() const throw();
  6463. juce_UseDebuggingNewOperator
  6464. private:
  6465. void* internal;
  6466. WaitableEvent (const WaitableEvent&);
  6467. WaitableEvent& operator= (const WaitableEvent&);
  6468. };
  6469. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6470. /*** End of inlined file: juce_WaitableEvent.h ***/
  6471. /*** Start of inlined file: juce_Thread.h ***/
  6472. #ifndef __JUCE_THREAD_JUCEHEADER__
  6473. #define __JUCE_THREAD_JUCEHEADER__
  6474. class JUCE_API Thread
  6475. {
  6476. public:
  6477. explicit Thread (const String& threadName);
  6478. virtual ~Thread();
  6479. virtual void run() = 0;
  6480. // Thread control functions..
  6481. void startThread();
  6482. void startThread (int priority);
  6483. void stopThread (int timeOutMilliseconds);
  6484. bool isThreadRunning() const;
  6485. void signalThreadShouldExit();
  6486. inline bool threadShouldExit() const { return threadShouldExit_; }
  6487. bool waitForThreadToExit (int timeOutMilliseconds) const;
  6488. bool setPriority (int priority);
  6489. static bool setCurrentThreadPriority (int priority);
  6490. void setAffinityMask (uint32 affinityMask);
  6491. static void setCurrentThreadAffinityMask (uint32 affinityMask);
  6492. // this can be called from any thread that needs to pause..
  6493. static void JUCE_CALLTYPE sleep (int milliseconds);
  6494. static void JUCE_CALLTYPE yield();
  6495. bool wait (int timeOutMilliseconds) const;
  6496. void notify() const;
  6497. typedef void* ThreadID;
  6498. static ThreadID getCurrentThreadId();
  6499. static Thread* getCurrentThread();
  6500. ThreadID getThreadId() const throw() { return threadId_; }
  6501. const String getThreadName() const { return threadName_; }
  6502. static int getNumRunningThreads();
  6503. static void stopAllThreads (int timeoutInMillisecs);
  6504. juce_UseDebuggingNewOperator
  6505. private:
  6506. const String threadName_;
  6507. void* volatile threadHandle_;
  6508. CriticalSection startStopLock;
  6509. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6510. int threadPriority_;
  6511. ThreadID threadId_;
  6512. uint32 affinityMask_;
  6513. bool volatile threadShouldExit_;
  6514. friend void JUCE_API juce_threadEntryPoint (void*);
  6515. static void threadEntryPoint (Thread* thread);
  6516. static Array<Thread*> runningThreads;
  6517. static CriticalSection runningThreadsLock;
  6518. Thread (const Thread&);
  6519. Thread& operator= (const Thread&);
  6520. };
  6521. #endif // __JUCE_THREAD_JUCEHEADER__
  6522. /*** End of inlined file: juce_Thread.h ***/
  6523. class JUCE_API ReadWriteLock
  6524. {
  6525. public:
  6526. ReadWriteLock() throw();
  6527. ~ReadWriteLock() throw();
  6528. void enterRead() const throw();
  6529. void exitRead() const throw();
  6530. void enterWrite() const throw();
  6531. bool tryEnterWrite() const throw();
  6532. void exitWrite() const throw();
  6533. juce_UseDebuggingNewOperator
  6534. private:
  6535. CriticalSection accessLock;
  6536. WaitableEvent waitEvent;
  6537. mutable int numWaitingWriters, numWriters;
  6538. mutable Thread::ThreadID writerThreadId;
  6539. mutable Array <Thread::ThreadID> readerThreads;
  6540. ReadWriteLock (const ReadWriteLock&);
  6541. ReadWriteLock& operator= (const ReadWriteLock&);
  6542. };
  6543. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6544. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6545. #endif
  6546. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6547. #endif
  6548. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6549. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6550. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6551. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6552. class JUCE_API ScopedReadLock
  6553. {
  6554. public:
  6555. inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6556. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6557. private:
  6558. const ReadWriteLock& lock_;
  6559. ScopedReadLock (const ScopedReadLock&);
  6560. ScopedReadLock& operator= (const ScopedReadLock&);
  6561. };
  6562. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6563. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6564. #endif
  6565. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6566. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6567. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6568. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6569. class JUCE_API ScopedTryLock
  6570. {
  6571. public:
  6572. inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6573. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6574. bool isLocked() const throw() { return lockWasSuccessful; }
  6575. private:
  6576. const CriticalSection& lock_;
  6577. const bool lockWasSuccessful;
  6578. ScopedTryLock (const ScopedTryLock&);
  6579. ScopedTryLock& operator= (const ScopedTryLock&);
  6580. };
  6581. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6582. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6583. #endif
  6584. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6585. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6586. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6587. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6588. class JUCE_API ScopedWriteLock
  6589. {
  6590. public:
  6591. inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6592. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6593. private:
  6594. const ReadWriteLock& lock_;
  6595. ScopedWriteLock (const ScopedWriteLock&);
  6596. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6597. };
  6598. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6599. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6600. #endif
  6601. #ifndef __JUCE_THREAD_JUCEHEADER__
  6602. #endif
  6603. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6604. /*** Start of inlined file: juce_ThreadPool.h ***/
  6605. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6606. #define __JUCE_THREADPOOL_JUCEHEADER__
  6607. class ThreadPool;
  6608. class ThreadPoolThread;
  6609. class JUCE_API ThreadPoolJob
  6610. {
  6611. public:
  6612. explicit ThreadPoolJob (const String& name);
  6613. virtual ~ThreadPoolJob();
  6614. const String getJobName() const;
  6615. void setJobName (const String& newName);
  6616. enum JobStatus
  6617. {
  6618. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6619. removed from the pool. */
  6620. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6621. should be automatically deleted by the pool. */
  6622. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6623. again when a thread is free. */
  6624. };
  6625. virtual JobStatus runJob() = 0;
  6626. bool isRunning() const { return isActive; }
  6627. bool shouldExit() const { return shouldStop; }
  6628. void signalJobShouldExit();
  6629. juce_UseDebuggingNewOperator
  6630. private:
  6631. friend class ThreadPool;
  6632. friend class ThreadPoolThread;
  6633. String jobName;
  6634. ThreadPool* pool;
  6635. bool shouldStop, isActive, shouldBeDeleted;
  6636. ThreadPoolJob (const ThreadPoolJob&);
  6637. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6638. };
  6639. class JUCE_API ThreadPool
  6640. {
  6641. public:
  6642. ThreadPool (int numberOfThreads,
  6643. bool startThreadsOnlyWhenNeeded = true,
  6644. int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6645. ~ThreadPool();
  6646. class JUCE_API JobSelector
  6647. {
  6648. public:
  6649. virtual ~JobSelector() {}
  6650. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6651. };
  6652. void addJob (ThreadPoolJob* job);
  6653. bool removeJob (ThreadPoolJob* job,
  6654. bool interruptIfRunning,
  6655. int timeOutMilliseconds);
  6656. bool removeAllJobs (bool interruptRunningJobs,
  6657. int timeOutMilliseconds,
  6658. bool deleteInactiveJobs = false,
  6659. JobSelector* selectedJobsToRemove = 0);
  6660. int getNumJobs() const;
  6661. ThreadPoolJob* getJob (int index) const;
  6662. bool contains (const ThreadPoolJob* job) const;
  6663. bool isJobRunning (const ThreadPoolJob* job) const;
  6664. bool waitForJobToFinish (const ThreadPoolJob* job,
  6665. int timeOutMilliseconds) const;
  6666. const StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const;
  6667. bool setThreadPriorities (int newPriority);
  6668. juce_UseDebuggingNewOperator
  6669. private:
  6670. const int threadStopTimeout;
  6671. int priority;
  6672. class ThreadPoolThread;
  6673. OwnedArray <ThreadPoolThread> threads;
  6674. Array <ThreadPoolJob*> jobs;
  6675. CriticalSection lock;
  6676. uint32 lastJobEndTime;
  6677. WaitableEvent jobFinishedSignal;
  6678. friend class ThreadPoolThread;
  6679. bool runNextJob();
  6680. ThreadPool (const ThreadPool&);
  6681. ThreadPool& operator= (const ThreadPool&);
  6682. };
  6683. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6684. /*** End of inlined file: juce_ThreadPool.h ***/
  6685. #endif
  6686. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6687. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6688. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6689. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6690. class JUCE_API TimeSliceClient
  6691. {
  6692. public:
  6693. virtual ~TimeSliceClient() {}
  6694. virtual bool useTimeSlice() = 0;
  6695. };
  6696. class JUCE_API TimeSliceThread : public Thread
  6697. {
  6698. public:
  6699. explicit TimeSliceThread (const String& threadName);
  6700. ~TimeSliceThread();
  6701. void addTimeSliceClient (TimeSliceClient* client);
  6702. void removeTimeSliceClient (TimeSliceClient* client);
  6703. int getNumClients() const;
  6704. TimeSliceClient* getClient (int index) const;
  6705. void run();
  6706. juce_UseDebuggingNewOperator
  6707. private:
  6708. CriticalSection callbackLock, listLock;
  6709. Array <TimeSliceClient*> clients;
  6710. int index;
  6711. TimeSliceClient* clientBeingCalled;
  6712. bool clientsChanged;
  6713. TimeSliceThread (const TimeSliceThread&);
  6714. TimeSliceThread& operator= (const TimeSliceThread&);
  6715. };
  6716. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6717. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6718. #endif
  6719. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6720. #endif
  6721. #endif
  6722. /*** End of inlined file: juce_core_includes.h ***/
  6723. // if you're compiling a command-line app, you might want to just include the core headers,
  6724. // so you can set this macro before including juce.h
  6725. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6726. /*** Start of inlined file: juce_app_includes.h ***/
  6727. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6728. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6729. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6730. /*** Start of inlined file: juce_Application.h ***/
  6731. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6732. #define __JUCE_APPLICATION_JUCEHEADER__
  6733. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6734. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6735. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6736. /*** Start of inlined file: juce_Component.h ***/
  6737. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6738. #define __JUCE_COMPONENT_JUCEHEADER__
  6739. /*** Start of inlined file: juce_MouseCursor.h ***/
  6740. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6741. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6742. class Image;
  6743. class ComponentPeer;
  6744. class Component;
  6745. class JUCE_API MouseCursor
  6746. {
  6747. public:
  6748. enum StandardCursorType
  6749. {
  6750. NoCursor = 0, /**< An invisible cursor. */
  6751. NormalCursor, /**< The stardard arrow cursor. */
  6752. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6753. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6754. CrosshairCursor, /**< A pair of crosshairs. */
  6755. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6756. that you're dragging a copy of something. */
  6757. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6758. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6759. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6760. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6761. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6762. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6763. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6764. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6765. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6766. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6767. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6768. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6769. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6770. };
  6771. MouseCursor();
  6772. MouseCursor (StandardCursorType type);
  6773. MouseCursor (const Image& image, int hotSpotX, int hotSpotY);
  6774. MouseCursor (const MouseCursor& other);
  6775. MouseCursor& operator= (const MouseCursor& other);
  6776. ~MouseCursor();
  6777. bool operator== (const MouseCursor& other) const throw();
  6778. bool operator!= (const MouseCursor& other) const throw();
  6779. static void showWaitCursor();
  6780. static void hideWaitCursor();
  6781. juce_UseDebuggingNewOperator
  6782. private:
  6783. class SharedCursorHandle;
  6784. friend class SharedCursorHandle;
  6785. SharedCursorHandle* cursorHandle;
  6786. friend class MouseInputSourceInternal;
  6787. void showInWindow (ComponentPeer* window) const;
  6788. void showInAllWindows() const;
  6789. void* getHandle() const throw();
  6790. static void* createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY);
  6791. static void* createStandardMouseCursor (MouseCursor::StandardCursorType type);
  6792. static void deleteMouseCursor (void* cursorHandle, bool isStandard);
  6793. };
  6794. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6795. /*** End of inlined file: juce_MouseCursor.h ***/
  6796. /*** Start of inlined file: juce_MouseListener.h ***/
  6797. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6798. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6799. class MouseEvent;
  6800. class JUCE_API MouseListener
  6801. {
  6802. public:
  6803. virtual ~MouseListener() {}
  6804. virtual void mouseMove (const MouseEvent& e);
  6805. virtual void mouseEnter (const MouseEvent& e);
  6806. virtual void mouseExit (const MouseEvent& e);
  6807. virtual void mouseDown (const MouseEvent& e);
  6808. virtual void mouseDrag (const MouseEvent& e);
  6809. virtual void mouseUp (const MouseEvent& e);
  6810. virtual void mouseDoubleClick (const MouseEvent& e);
  6811. virtual void mouseWheelMove (const MouseEvent& e,
  6812. float wheelIncrementX,
  6813. float wheelIncrementY);
  6814. };
  6815. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6816. /*** End of inlined file: juce_MouseListener.h ***/
  6817. /*** Start of inlined file: juce_MouseEvent.h ***/
  6818. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6819. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6820. class Component;
  6821. class MouseInputSource;
  6822. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6823. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6824. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6825. class JUCE_API ModifierKeys
  6826. {
  6827. public:
  6828. ModifierKeys (int flags = 0) throw();
  6829. ModifierKeys (const ModifierKeys& other) throw();
  6830. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6831. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6832. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6833. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6834. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6835. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6836. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6837. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6838. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6839. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6840. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6841. enum Flags
  6842. {
  6843. shiftModifier = 1,
  6844. ctrlModifier = 2,
  6845. altModifier = 4,
  6846. leftButtonModifier = 16,
  6847. rightButtonModifier = 32,
  6848. middleButtonModifier = 64,
  6849. #if JUCE_MAC
  6850. commandModifier = 8,
  6851. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6852. #else
  6853. commandModifier = ctrlModifier,
  6854. popupMenuClickModifier = rightButtonModifier,
  6855. #endif
  6856. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6857. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6858. };
  6859. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6860. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6861. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6862. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6863. inline int getRawFlags() const throw() { return flags; }
  6864. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6865. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6866. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6867. int getNumMouseButtonsDown() const throw();
  6868. static const ModifierKeys getCurrentModifiers() throw();
  6869. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6870. private:
  6871. int flags;
  6872. static ModifierKeys currentModifiers;
  6873. friend class ComponentPeer;
  6874. friend class MouseInputSource;
  6875. friend class MouseInputSourceInternal;
  6876. static void updateCurrentModifiers() throw();
  6877. };
  6878. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6879. /*** End of inlined file: juce_ModifierKeys.h ***/
  6880. /*** Start of inlined file: juce_Point.h ***/
  6881. #ifndef __JUCE_POINT_JUCEHEADER__
  6882. #define __JUCE_POINT_JUCEHEADER__
  6883. /*** Start of inlined file: juce_AffineTransform.h ***/
  6884. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6885. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6886. class JUCE_API AffineTransform
  6887. {
  6888. public:
  6889. AffineTransform() throw();
  6890. AffineTransform (const AffineTransform& other) throw();
  6891. AffineTransform (float mat00, float mat01, float mat02,
  6892. float mat10, float mat11, float mat12) throw();
  6893. AffineTransform& operator= (const AffineTransform& other) throw();
  6894. bool operator== (const AffineTransform& other) const throw();
  6895. bool operator!= (const AffineTransform& other) const throw();
  6896. static const AffineTransform identity;
  6897. void transformPoint (float& x,
  6898. float& y) const throw();
  6899. void transformPoint (double& x,
  6900. double& y) const throw();
  6901. const AffineTransform translated (float deltaX,
  6902. float deltaY) const throw();
  6903. static const AffineTransform translation (float deltaX,
  6904. float deltaY) throw();
  6905. const AffineTransform rotated (float angleInRadians) const throw();
  6906. const AffineTransform rotated (float angleInRadians,
  6907. float pivotX,
  6908. float pivotY) const throw();
  6909. static const AffineTransform rotation (float angleInRadians) throw();
  6910. static const AffineTransform rotation (float angleInRadians,
  6911. float pivotX,
  6912. float pivotY) throw();
  6913. const AffineTransform scaled (float factorX,
  6914. float factorY) const throw();
  6915. static const AffineTransform scale (float factorX,
  6916. float factorY) throw();
  6917. const AffineTransform sheared (float shearX,
  6918. float shearY) const throw();
  6919. const AffineTransform inverted() const throw();
  6920. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6921. bool isIdentity() const throw();
  6922. bool isSingularity() const throw();
  6923. bool isOnlyTranslation() const throw();
  6924. float getTranslationX() const throw() { return mat02; }
  6925. float getTranslationY() const throw() { return mat12; }
  6926. juce_UseDebuggingNewOperator
  6927. float mat00, mat01, mat02;
  6928. float mat10, mat11, mat12;
  6929. private:
  6930. const AffineTransform followedBy (float mat00, float mat01, float mat02,
  6931. float mat10, float mat11, float mat12) const throw();
  6932. };
  6933. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6934. /*** End of inlined file: juce_AffineTransform.h ***/
  6935. template <typename ValueType>
  6936. class Point
  6937. {
  6938. public:
  6939. Point() throw() : x (0), y (0) {}
  6940. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6941. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6942. ~Point() throw() {}
  6943. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6944. inline ValueType getX() const throw() { return x; }
  6945. inline ValueType getY() const throw() { return y; }
  6946. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6947. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6948. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6949. const Point withX (const ValueType newX) const throw() { return Point (newX, y); }
  6950. const Point withY (const ValueType newY) const throw() { return Point (x, newY); }
  6951. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6952. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6953. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6954. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6955. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6956. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6957. const Point operator* (const ValueType multiplier) const throw() { return Point (x * multiplier, y * multiplier); }
  6958. Point& operator*= (const ValueType multiplier) throw() { x *= multiplier; y *= multiplier; return *this; }
  6959. const Point operator/ (const ValueType divisor) const throw() { return Point (x / divisor, y / divisor); }
  6960. Point& operator/= (const ValueType divisor) throw() { x /= divisor; y /= divisor; return *this; }
  6961. const Point operator-() const throw() { return Point (-x, -y); }
  6962. ValueType getDistanceFromOrigin() const throw() { return (ValueType) juce_hypot (x, y); }
  6963. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6964. ValueType getAngleToPoint (const Point& other) const throw() { return (ValueType) atan2 (other.x - x, other.y - y); }
  6965. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6966. const String toString() const { return String (x) + ", " + String (y); }
  6967. juce_UseDebuggingNewOperator
  6968. private:
  6969. ValueType x, y;
  6970. };
  6971. #endif // __JUCE_POINT_JUCEHEADER__
  6972. /*** End of inlined file: juce_Point.h ***/
  6973. class JUCE_API MouseEvent
  6974. {
  6975. public:
  6976. MouseEvent (MouseInputSource& source,
  6977. const Point<int>& position,
  6978. const ModifierKeys& modifiers,
  6979. Component* originator,
  6980. const Time& eventTime,
  6981. const Point<int> mouseDownPos,
  6982. const Time& mouseDownTime,
  6983. int numberOfClicks,
  6984. bool mouseWasDragged) throw();
  6985. ~MouseEvent() throw();
  6986. const int x;
  6987. const int y;
  6988. const ModifierKeys mods;
  6989. Component* const eventComponent;
  6990. Component* const originalComponent;
  6991. const Time eventTime;
  6992. MouseInputSource& source;
  6993. int getMouseDownX() const throw();
  6994. int getMouseDownY() const throw();
  6995. const Point<int> getMouseDownPosition() const throw();
  6996. int getDistanceFromDragStart() const throw();
  6997. int getDistanceFromDragStartX() const throw();
  6998. int getDistanceFromDragStartY() const throw();
  6999. const Point<int> getOffsetFromDragStart() const throw();
  7000. bool mouseWasClicked() const throw();
  7001. int getNumberOfClicks() const throw() { return numberOfClicks; }
  7002. int getLengthOfMousePress() const throw();
  7003. const Point<int> getPosition() const throw();
  7004. int getScreenX() const;
  7005. int getScreenY() const;
  7006. const Point<int> getScreenPosition() const;
  7007. int getMouseDownScreenX() const;
  7008. int getMouseDownScreenY() const;
  7009. const Point<int> getMouseDownScreenPosition() const;
  7010. const MouseEvent getEventRelativeTo (Component* otherComponent) const throw();
  7011. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  7012. static void setDoubleClickTimeout (int timeOutMilliseconds) throw();
  7013. static int getDoubleClickTimeout() throw();
  7014. juce_UseDebuggingNewOperator
  7015. private:
  7016. const Point<int> mouseDownPos;
  7017. const Time mouseDownTime;
  7018. const int numberOfClicks;
  7019. const bool wasMovedSinceMouseDown;
  7020. MouseEvent& operator= (const MouseEvent&);
  7021. };
  7022. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  7023. /*** End of inlined file: juce_MouseEvent.h ***/
  7024. /*** Start of inlined file: juce_ComponentListener.h ***/
  7025. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  7026. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  7027. class Component;
  7028. class JUCE_API ComponentListener
  7029. {
  7030. public:
  7031. virtual ~ComponentListener() {}
  7032. virtual void componentMovedOrResized (Component& component,
  7033. bool wasMoved,
  7034. bool wasResized);
  7035. virtual void componentBroughtToFront (Component& component);
  7036. virtual void componentVisibilityChanged (Component& component);
  7037. virtual void componentChildrenChanged (Component& component);
  7038. virtual void componentParentHierarchyChanged (Component& component);
  7039. virtual void componentNameChanged (Component& component);
  7040. virtual void componentBeingDeleted (Component& component);
  7041. };
  7042. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  7043. /*** End of inlined file: juce_ComponentListener.h ***/
  7044. /*** Start of inlined file: juce_KeyListener.h ***/
  7045. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  7046. #define __JUCE_KEYLISTENER_JUCEHEADER__
  7047. /*** Start of inlined file: juce_KeyPress.h ***/
  7048. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  7049. #define __JUCE_KEYPRESS_JUCEHEADER__
  7050. class JUCE_API KeyPress
  7051. {
  7052. public:
  7053. KeyPress() throw();
  7054. KeyPress (int keyCode,
  7055. const ModifierKeys& modifiers,
  7056. juce_wchar textCharacter) throw();
  7057. KeyPress (int keyCode) throw();
  7058. KeyPress (const KeyPress& other) throw();
  7059. KeyPress& operator= (const KeyPress& other) throw();
  7060. bool operator== (const KeyPress& other) const throw();
  7061. bool operator!= (const KeyPress& other) const throw();
  7062. bool isValid() const throw() { return keyCode != 0; }
  7063. int getKeyCode() const throw() { return keyCode; }
  7064. const ModifierKeys getModifiers() const throw() { return mods; }
  7065. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  7066. bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  7067. static const KeyPress createFromDescription (const String& textVersion);
  7068. const String getTextDescription() const;
  7069. bool isCurrentlyDown() const;
  7070. static bool isKeyCurrentlyDown (int keyCode);
  7071. // Key codes
  7072. //
  7073. // Note that the actual values of these are platform-specific and may change
  7074. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  7075. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  7076. //
  7077. static const int spaceKey; /**< key-code for the space bar */
  7078. static const int escapeKey; /**< key-code for the escape key */
  7079. static const int returnKey; /**< key-code for the return key*/
  7080. static const int tabKey; /**< key-code for the tab key*/
  7081. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  7082. static const int backspaceKey; /**< key-code for the backspace key */
  7083. static const int insertKey; /**< key-code for the insert key */
  7084. static const int upKey; /**< key-code for the cursor-up key */
  7085. static const int downKey; /**< key-code for the cursor-down key */
  7086. static const int leftKey; /**< key-code for the cursor-left key */
  7087. static const int rightKey; /**< key-code for the cursor-right key */
  7088. static const int pageUpKey; /**< key-code for the page-up key */
  7089. static const int pageDownKey; /**< key-code for the page-down key */
  7090. static const int homeKey; /**< key-code for the home key */
  7091. static const int endKey; /**< key-code for the end key */
  7092. static const int F1Key; /**< key-code for the F1 key */
  7093. static const int F2Key; /**< key-code for the F2 key */
  7094. static const int F3Key; /**< key-code for the F3 key */
  7095. static const int F4Key; /**< key-code for the F4 key */
  7096. static const int F5Key; /**< key-code for the F5 key */
  7097. static const int F6Key; /**< key-code for the F6 key */
  7098. static const int F7Key; /**< key-code for the F7 key */
  7099. static const int F8Key; /**< key-code for the F8 key */
  7100. static const int F9Key; /**< key-code for the F9 key */
  7101. static const int F10Key; /**< key-code for the F10 key */
  7102. static const int F11Key; /**< key-code for the F11 key */
  7103. static const int F12Key; /**< key-code for the F12 key */
  7104. static const int F13Key; /**< key-code for the F13 key */
  7105. static const int F14Key; /**< key-code for the F14 key */
  7106. static const int F15Key; /**< key-code for the F15 key */
  7107. static const int F16Key; /**< key-code for the F16 key */
  7108. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  7109. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  7110. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  7111. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  7112. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  7113. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  7114. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  7115. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  7116. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  7117. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  7118. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  7119. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  7120. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  7121. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  7122. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  7123. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  7124. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  7125. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  7126. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  7127. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  7128. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  7129. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  7130. juce_UseDebuggingNewOperator
  7131. private:
  7132. int keyCode;
  7133. ModifierKeys mods;
  7134. juce_wchar textCharacter;
  7135. };
  7136. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  7137. /*** End of inlined file: juce_KeyPress.h ***/
  7138. class Component;
  7139. class JUCE_API KeyListener
  7140. {
  7141. public:
  7142. virtual ~KeyListener() {}
  7143. virtual bool keyPressed (const KeyPress& key,
  7144. Component* originatingComponent) = 0;
  7145. virtual bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  7146. };
  7147. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  7148. /*** End of inlined file: juce_KeyListener.h ***/
  7149. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  7150. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7151. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7152. class Component;
  7153. class JUCE_API KeyboardFocusTraverser
  7154. {
  7155. public:
  7156. KeyboardFocusTraverser();
  7157. virtual ~KeyboardFocusTraverser();
  7158. virtual Component* getNextComponent (Component* current);
  7159. virtual Component* getPreviousComponent (Component* current);
  7160. virtual Component* getDefaultComponent (Component* parentComponent);
  7161. };
  7162. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7163. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  7164. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  7165. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7166. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7167. /*** Start of inlined file: juce_Graphics.h ***/
  7168. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  7169. #define __JUCE_GRAPHICS_JUCEHEADER__
  7170. /*** Start of inlined file: juce_Font.h ***/
  7171. #ifndef __JUCE_FONT_JUCEHEADER__
  7172. #define __JUCE_FONT_JUCEHEADER__
  7173. /*** Start of inlined file: juce_Typeface.h ***/
  7174. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  7175. #define __JUCE_TYPEFACE_JUCEHEADER__
  7176. /*** Start of inlined file: juce_Path.h ***/
  7177. #ifndef __JUCE_PATH_JUCEHEADER__
  7178. #define __JUCE_PATH_JUCEHEADER__
  7179. /*** Start of inlined file: juce_Line.h ***/
  7180. #ifndef __JUCE_LINE_JUCEHEADER__
  7181. #define __JUCE_LINE_JUCEHEADER__
  7182. template <typename ValueType>
  7183. class Line
  7184. {
  7185. public:
  7186. Line() throw() {}
  7187. Line (const Line& other) throw()
  7188. : start (other.start),
  7189. end (other.end)
  7190. {
  7191. }
  7192. Line (ValueType startX, ValueType startY, ValueType endX, ValueType endY) throw()
  7193. : start (startX, startY),
  7194. end (endX, endY)
  7195. {
  7196. }
  7197. Line (const Point<ValueType>& startPoint,
  7198. const Point<ValueType>& endPoint) throw()
  7199. : start (startPoint),
  7200. end (endPoint)
  7201. {
  7202. }
  7203. Line& operator= (const Line& other) throw()
  7204. {
  7205. start = other.start;
  7206. end = other.end;
  7207. return *this;
  7208. }
  7209. ~Line() throw() {}
  7210. inline ValueType getStartX() const throw() { return start.getX(); }
  7211. inline ValueType getStartY() const throw() { return start.getY(); }
  7212. inline ValueType getEndX() const throw() { return end.getX(); }
  7213. inline ValueType getEndY() const throw() { return end.getY(); }
  7214. inline const Point<ValueType>& getStart() const throw() { return start; }
  7215. inline const Point<ValueType>& getEnd() const throw() { return end; }
  7216. void setStart (ValueType newStartX, ValueType newStartY) throw() { start.setXY (newStartX, newStartY); }
  7217. void setEnd (ValueType newEndX, ValueType newEndY) throw() { end.setXY (newEndX, newEndY); }
  7218. void setStart (const Point<ValueType>& newStart) throw() { start = newStart; }
  7219. void setEnd (const Point<ValueType>& newEnd) throw() { end = newEnd; }
  7220. void applyTransform (const AffineTransform& transform) throw()
  7221. {
  7222. start.applyTransform (transform);
  7223. end.applyTransform (transform);
  7224. }
  7225. ValueType getLength() const throw() { return start.getDistanceFrom (end); }
  7226. bool isVertical() const throw() { return start.getX() == end.getX(); }
  7227. bool isHorizontal() const throw() { return start.getY() == end.getY(); }
  7228. ValueType getAngle() const throw() { return start.getAngleToPoint (end); }
  7229. bool operator== (const Line& other) const throw() { return start == other.start && end == other.end; }
  7230. bool operator!= (const Line& other) const throw() { return start != other.start || end != other.end; }
  7231. bool intersects (const Line& line, Point<ValueType>& intersection) const throw()
  7232. {
  7233. return findIntersection (start, end, line.start, line.end, intersection);
  7234. }
  7235. const Point<ValueType> getPointAlongLine (ValueType distanceFromStart) const throw()
  7236. {
  7237. return start + (end - start) * (distanceFromStart / getLength());
  7238. }
  7239. const Point<ValueType> getPointAlongLine (ValueType distanceFromStart,
  7240. ValueType perpendicularDistance) const throw()
  7241. {
  7242. const Point<ValueType> delta (end - start);
  7243. const double length = juce_hypot (delta.getX(), delta.getY());
  7244. if (length == 0)
  7245. return start;
  7246. return Point<ValueType> (start.getX() + (ValueType) ((delta.getX() * distanceFromStart - delta.getY() * perpendicularDistance) / length),
  7247. start.getY() + (ValueType) ((delta.getY() * distanceFromStart + delta.getX() * perpendicularDistance) / length));
  7248. }
  7249. const Point<ValueType> getPointAlongLineProportionally (ValueType proportionOfLength) const throw()
  7250. {
  7251. return start + (end - start) * proportionOfLength;
  7252. }
  7253. ValueType getDistanceFromLine (const Point<ValueType>& point) const throw()
  7254. {
  7255. const Point<ValueType> delta (end - start);
  7256. const double length = delta.getX() * delta.getX() + delta.getY() * delta.getY();
  7257. if (length > 0)
  7258. {
  7259. const double prop = ((point.getX() - start.getX()) * delta.getX()
  7260. + (point.getY() - start.getY()) * delta.getY()) / length;
  7261. if (prop >= 0 && prop <= 1.0)
  7262. return point.getDistanceFrom (start + delta * (ValueType) prop);
  7263. }
  7264. return jmin (point.getDistanceFrom (start),
  7265. point.getDistanceFrom (end));
  7266. }
  7267. ValueType findNearestPointTo (const Point<ValueType>& point) const throw()
  7268. {
  7269. const Point<ValueType> delta (end - start);
  7270. const double length = delta.getX() * delta.getX() + delta.getY() * delta.getY();
  7271. return length <= 0 ? 0
  7272. : jlimit ((ValueType) 0, (ValueType) 1,
  7273. (ValueType) (((point.getX() - start.getX()) * delta.getX()
  7274. + (point.getY() - start.getY()) * delta.getY()) / length));
  7275. }
  7276. bool isPointAbove (const Point<ValueType>& point) const throw()
  7277. {
  7278. return start.getX() != end.getX()
  7279. && point.getY() < ((end.getY() - start.getY())
  7280. * (point.getX() - start.getX())) / (end.getX() - start.getX()) + start.getY();
  7281. }
  7282. const Line withShortenedStart (ValueType distanceToShortenBy) const throw()
  7283. {
  7284. return Line (getPointAlongLine (jmin (distanceToShortenBy, getLength())), end);
  7285. }
  7286. const Line withShortenedEnd (ValueType distanceToShortenBy) const throw()
  7287. {
  7288. const ValueType length = getLength();
  7289. return Line (start, getPointAlongLine (length - jmin (distanceToShortenBy, length)));
  7290. }
  7291. juce_UseDebuggingNewOperator
  7292. private:
  7293. Point<ValueType> start, end;
  7294. static bool findIntersection (const Point<ValueType>& p1, const Point<ValueType>& p2,
  7295. const Point<ValueType>& p3, const Point<ValueType>& p4,
  7296. Point<ValueType>& intersection) throw()
  7297. {
  7298. if (p2 == p3)
  7299. {
  7300. intersection = p2;
  7301. return true;
  7302. }
  7303. const Point<ValueType> d1 (p2 - p1);
  7304. const Point<ValueType> d2 (p4 - p2);
  7305. const ValueType divisor = d1.getX() * d2.getY() - d2.getX() * d1.getY();
  7306. if (divisor == 0)
  7307. {
  7308. if (! (d1.isOrigin() || d2.isOrigin()))
  7309. {
  7310. if (d1.getY() == 0 && d2.getY() != 0)
  7311. {
  7312. const ValueType along = (p1.getY() - p3.getY()) / d2.getY();
  7313. intersection = p1.withX (p3.getX() + along * d2.getX());
  7314. return along >= 0 && along <= (ValueType) 1;
  7315. }
  7316. else if (d2.getY() == 0 && d1.getY() != 0)
  7317. {
  7318. const ValueType along = (p3.getY() - p1.getY()) / d1.getY();
  7319. intersection = p3.withX (p1.getX() + along * d1.getX());
  7320. return along >= 0 && along <= (ValueType) 1;
  7321. }
  7322. else if (d1.getX() == 0 && d2.getX() != 0)
  7323. {
  7324. const ValueType along = (p1.getX() - p3.getX()) / d2.getX();
  7325. intersection = p1.withY (p3.getY() + along * d2.getY());
  7326. return along >= 0 && along <= (ValueType) 1;
  7327. }
  7328. else if (d2.getX() == 0 && d1.getX() != 0)
  7329. {
  7330. const ValueType along = (p3.getX() - p1.getX()) / d1.getX();
  7331. intersection = p3.withY (p1.getY() + along * d1.getY());
  7332. return along >= 0 && along <= (ValueType) 1;
  7333. }
  7334. }
  7335. intersection = (p2 + p3) / (ValueType) 2;
  7336. return false;
  7337. }
  7338. const ValueType along1 = ((p1.getY() - p3.getY()) * d2.getX() - (p1.getX() - p3.getX()) * d2.getY()) / divisor;
  7339. intersection = p1 + d1 * along1;
  7340. if (along1 < 0 || along1 > (ValueType) 1)
  7341. return false;
  7342. const ValueType along2 = ((p1.getY() - p3.getY()) * d1.getX() - (p1.getX() - p3.getX()) * d1.getY()) / divisor;
  7343. return along2 >= 0 && along2 <= (ValueType) 1;
  7344. }
  7345. };
  7346. #endif // __JUCE_LINE_JUCEHEADER__
  7347. /*** End of inlined file: juce_Line.h ***/
  7348. /*** Start of inlined file: juce_Rectangle.h ***/
  7349. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  7350. #define __JUCE_RECTANGLE_JUCEHEADER__
  7351. class RectangleList;
  7352. template <typename ValueType>
  7353. class Rectangle
  7354. {
  7355. public:
  7356. Rectangle() throw()
  7357. : x (0), y (0), w (0), h (0)
  7358. {
  7359. }
  7360. Rectangle (const Rectangle& other) throw()
  7361. : x (other.x), y (other.y),
  7362. w (other.w), h (other.h)
  7363. {
  7364. }
  7365. Rectangle (const ValueType initialX, const ValueType initialY,
  7366. const ValueType width, const ValueType height) throw()
  7367. : x (initialX), y (initialY),
  7368. w (width), h (height)
  7369. {
  7370. }
  7371. Rectangle (const ValueType width, const ValueType height) throw()
  7372. : x (0), y (0), w (width), h (height)
  7373. {
  7374. }
  7375. Rectangle (const Point<ValueType>& corner1, const Point<ValueType>& corner2) throw()
  7376. : x (jmin (corner1.getX(), corner2.getX())),
  7377. y (jmin (corner1.getY(), corner2.getY())),
  7378. w (corner1.getX() - corner2.getX()),
  7379. h (corner1.getY() - corner2.getY())
  7380. {
  7381. if (w < 0) w = -w;
  7382. if (h < 0) h = -h;
  7383. }
  7384. Rectangle& operator= (const Rectangle& other) throw()
  7385. {
  7386. x = other.x; y = other.y;
  7387. w = other.w; h = other.h;
  7388. return *this;
  7389. }
  7390. ~Rectangle() throw() {}
  7391. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  7392. inline ValueType getX() const throw() { return x; }
  7393. inline ValueType getY() const throw() { return y; }
  7394. inline ValueType getWidth() const throw() { return w; }
  7395. inline ValueType getHeight() const throw() { return h; }
  7396. inline ValueType getRight() const throw() { return x + w; }
  7397. inline ValueType getBottom() const throw() { return y + h; }
  7398. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  7399. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  7400. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  7401. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  7402. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  7403. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  7404. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  7405. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  7406. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  7407. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  7408. void setBounds (const ValueType newX, const ValueType newY,
  7409. const ValueType newWidth, const ValueType newHeight) throw()
  7410. {
  7411. x = newX; y = newY; w = newWidth; h = newHeight;
  7412. }
  7413. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  7414. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  7415. const Rectangle withX (const ValueType newX) const throw() { return Rectangle (newX, y, w, h); }
  7416. const Rectangle withY (const ValueType newY) const throw() { return Rectangle (x, newY, w, h); }
  7417. const Rectangle withWidth (const ValueType newWidth) const throw() { return Rectangle (x, y, newWidth, h); }
  7418. const Rectangle withHeight (const ValueType newHeight) const throw() { return Rectangle (x, y, w, newHeight); }
  7419. void setLeft (const ValueType newLeft) throw()
  7420. {
  7421. w = jmax (ValueType(), x + w - newLeft);
  7422. x = newLeft;
  7423. }
  7424. void setTop (const ValueType newTop) throw()
  7425. {
  7426. h = jmax (ValueType(), y + h - newTop);
  7427. y = newTop;
  7428. }
  7429. void setRight (const ValueType newRight) throw()
  7430. {
  7431. x = jmin (x, newRight);
  7432. w = newRight - x;
  7433. }
  7434. void setBottom (const ValueType newBottom) throw()
  7435. {
  7436. y = jmin (y, newBottom);
  7437. h = newBottom - y;
  7438. }
  7439. void translate (const ValueType deltaX,
  7440. const ValueType deltaY) throw()
  7441. {
  7442. x += deltaX;
  7443. y += deltaY;
  7444. }
  7445. const Rectangle translated (const ValueType deltaX,
  7446. const ValueType deltaY) const throw()
  7447. {
  7448. return Rectangle (x + deltaX, y + deltaY, w, h);
  7449. }
  7450. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  7451. {
  7452. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  7453. }
  7454. Rectangle& operator+= (const Point<ValueType>& deltaPosition) throw()
  7455. {
  7456. x += deltaPosition.getX(); y += deltaPosition.getY();
  7457. return *this;
  7458. }
  7459. const Rectangle operator- (const Point<ValueType>& deltaPosition) const throw()
  7460. {
  7461. return Rectangle (x - deltaPosition.getX(), y - deltaPosition.getY(), w, h);
  7462. }
  7463. Rectangle& operator-= (const Point<ValueType>& deltaPosition) throw()
  7464. {
  7465. x -= deltaPosition.getX(); y -= deltaPosition.getY();
  7466. return *this;
  7467. }
  7468. void expand (const ValueType deltaX,
  7469. const ValueType deltaY) throw()
  7470. {
  7471. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7472. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7473. setBounds (x - deltaX, y - deltaY, nw, nh);
  7474. }
  7475. const Rectangle expanded (const ValueType deltaX,
  7476. const ValueType deltaY) const throw()
  7477. {
  7478. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7479. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7480. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7481. }
  7482. void reduce (const ValueType deltaX,
  7483. const ValueType deltaY) throw()
  7484. {
  7485. expand (-deltaX, -deltaY);
  7486. }
  7487. const Rectangle reduced (const ValueType deltaX,
  7488. const ValueType deltaY) const throw()
  7489. {
  7490. return expanded (-deltaX, -deltaY);
  7491. }
  7492. bool operator== (const Rectangle& other) const throw()
  7493. {
  7494. return x == other.x && y == other.y
  7495. && w == other.w && h == other.h;
  7496. }
  7497. bool operator!= (const Rectangle& other) const throw()
  7498. {
  7499. return x != other.x || y != other.y
  7500. || w != other.w || h != other.h;
  7501. }
  7502. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7503. {
  7504. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7505. }
  7506. bool contains (const Point<ValueType>& point) const throw()
  7507. {
  7508. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7509. }
  7510. bool contains (const Rectangle& other) const throw()
  7511. {
  7512. return x <= other.x && y <= other.y
  7513. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7514. }
  7515. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7516. {
  7517. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7518. jlimit (y, y + h, point.getY()));
  7519. }
  7520. bool intersects (const Rectangle& other) const throw()
  7521. {
  7522. return x + w > other.x
  7523. && y + h > other.y
  7524. && x < other.x + other.w
  7525. && y < other.y + other.h
  7526. && w > ValueType() && h > ValueType();
  7527. }
  7528. const Rectangle getIntersection (const Rectangle& other) const throw()
  7529. {
  7530. const ValueType nx = jmax (x, other.x);
  7531. const ValueType ny = jmax (y, other.y);
  7532. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7533. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7534. if (nw >= ValueType() && nh >= ValueType())
  7535. return Rectangle (nx, ny, nw, nh);
  7536. return Rectangle();
  7537. }
  7538. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7539. {
  7540. const int maxX = jmax (otherX, x);
  7541. otherW = jmin (otherX + otherW, x + w) - maxX;
  7542. if (otherW > 0)
  7543. {
  7544. const int maxY = jmax (otherY, y);
  7545. otherH = jmin (otherY + otherH, y + h) - maxY;
  7546. if (otherH > 0)
  7547. {
  7548. otherX = maxX; otherY = maxY;
  7549. return true;
  7550. }
  7551. }
  7552. return false;
  7553. }
  7554. const Rectangle getUnion (const Rectangle& other) const throw()
  7555. {
  7556. const ValueType newX = jmin (x, other.x);
  7557. const ValueType newY = jmin (y, other.y);
  7558. return Rectangle (newX, newY,
  7559. jmax (x + w, other.x + other.w) - newX,
  7560. jmax (y + h, other.y + other.h) - newY);
  7561. }
  7562. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7563. {
  7564. if (x == other.x && getRight() == other.getRight()
  7565. && (other.getBottom() >= y && other.y <= getBottom()))
  7566. {
  7567. const ValueType newY = jmin (y, other.y);
  7568. h = jmax (getBottom(), other.getBottom()) - newY;
  7569. y = newY;
  7570. return true;
  7571. }
  7572. else if (y == other.y && getBottom() == other.getBottom()
  7573. && (other.getRight() >= x && other.x <= getRight()))
  7574. {
  7575. const ValueType newX = jmin (x, other.x);
  7576. w = jmax (getRight(), other.getRight()) - newX;
  7577. x = newX;
  7578. return true;
  7579. }
  7580. return false;
  7581. }
  7582. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7583. {
  7584. int inside = 0;
  7585. const int otherR = other.getRight();
  7586. if (x >= other.x && x < otherR) inside = 1;
  7587. const int otherB = other.getBottom();
  7588. if (y >= other.y && y < otherB) inside |= 2;
  7589. const int r = x + w;
  7590. if (r >= other.x && r < otherR) inside |= 4;
  7591. const int b = y + h;
  7592. if (b >= other.y && b < otherB) inside |= 8;
  7593. switch (inside)
  7594. {
  7595. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7596. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7597. case 2 + 4 + 8: w = other.x - x; return true;
  7598. case 1 + 4 + 8: h = other.y - y; return true;
  7599. }
  7600. return false;
  7601. }
  7602. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7603. {
  7604. float x1 = x, y1 = y;
  7605. float x2 = x + w, y2 = y;
  7606. float x3 = x, y3 = y + h;
  7607. float x4 = x2, y4 = y3;
  7608. transform.transformPoint (x1, y1);
  7609. transform.transformPoint (x2, y2);
  7610. transform.transformPoint (x3, y3);
  7611. transform.transformPoint (x4, y4);
  7612. const float x = jmin (x1, x2, x3, x4);
  7613. const float y = jmin (y1, y2, y3, y4);
  7614. return Rectangle (x, y,
  7615. jmax (x1, x2, x3, x4) - x,
  7616. jmax (y1, y2, y3, y4) - y);
  7617. }
  7618. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7619. {
  7620. const int x1 = (int) floorf ((float) x);
  7621. const int y1 = (int) floorf ((float) y);
  7622. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7623. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7624. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7625. }
  7626. const Rectangle<float> toFloat() const throw()
  7627. {
  7628. return Rectangle<float> (static_cast<float> (x), static_cast<float> (y),
  7629. static_cast<float> (w), static_cast<float> (h));
  7630. }
  7631. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7632. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7633. {
  7634. const ValueType x = jmax (x1, x2);
  7635. w1 = jmin (x1 + w1, x2 + w2) - x;
  7636. if (w1 > 0)
  7637. {
  7638. const ValueType y = jmax (y1, y2);
  7639. h1 = jmin (y1 + h1, y2 + h2) - y;
  7640. if (h1 > 0)
  7641. {
  7642. x1 = x; y1 = y;
  7643. return true;
  7644. }
  7645. }
  7646. return false;
  7647. }
  7648. const String toString() const
  7649. {
  7650. String s;
  7651. s.preallocateStorage (16);
  7652. s << x << ' ' << y << ' ' << w << ' ' << h;
  7653. return s;
  7654. }
  7655. static const Rectangle fromString (const String& stringVersion)
  7656. {
  7657. StringArray toks;
  7658. toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
  7659. return Rectangle (toks[0].trim().getIntValue(),
  7660. toks[1].trim().getIntValue(),
  7661. toks[2].trim().getIntValue(),
  7662. toks[3].trim().getIntValue());
  7663. }
  7664. juce_UseDebuggingNewOperator
  7665. private:
  7666. friend class RectangleList;
  7667. ValueType x, y, w, h;
  7668. };
  7669. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7670. /*** End of inlined file: juce_Rectangle.h ***/
  7671. /*** Start of inlined file: juce_Justification.h ***/
  7672. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7673. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7674. class JUCE_API Justification
  7675. {
  7676. public:
  7677. inline Justification (int flags_) throw() : flags (flags_) {}
  7678. Justification (const Justification& other) throw();
  7679. Justification& operator= (const Justification& other) throw();
  7680. inline int getFlags() const throw() { return flags; }
  7681. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7682. int getOnlyVerticalFlags() const throw();
  7683. int getOnlyHorizontalFlags() const throw();
  7684. void applyToRectangle (int& x, int& y, int w, int h,
  7685. int spaceX, int spaceY, int spaceW, int spaceH) const throw();
  7686. enum
  7687. {
  7688. left = 1,
  7689. right = 2,
  7690. horizontallyCentred = 4,
  7691. top = 8,
  7692. bottom = 16,
  7693. verticallyCentred = 32,
  7694. horizontallyJustified = 64,
  7695. centred = 36,
  7696. centredLeft = 33,
  7697. centredRight = 34,
  7698. centredTop = 12,
  7699. centredBottom = 20,
  7700. topLeft = 9,
  7701. topRight = 10,
  7702. bottomLeft = 17,
  7703. bottomRight = 18
  7704. };
  7705. private:
  7706. int flags;
  7707. };
  7708. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7709. /*** End of inlined file: juce_Justification.h ***/
  7710. /*** Start of inlined file: juce_EdgeTable.h ***/
  7711. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7712. #define __JUCE_EDGETABLE_JUCEHEADER__
  7713. class Path;
  7714. class RectangleList;
  7715. class Image;
  7716. class JUCE_API EdgeTable
  7717. {
  7718. public:
  7719. EdgeTable (const Rectangle<int>& clipLimits,
  7720. const Path& pathToAdd,
  7721. const AffineTransform& transform);
  7722. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7723. EdgeTable (const RectangleList& rectanglesToAdd);
  7724. EdgeTable (float x, float y, float w, float h);
  7725. EdgeTable (const EdgeTable& other);
  7726. EdgeTable& operator= (const EdgeTable& other);
  7727. ~EdgeTable();
  7728. void clipToRectangle (const Rectangle<int>& r) throw();
  7729. void excludeRectangle (const Rectangle<int>& r) throw();
  7730. void clipToEdgeTable (const EdgeTable& other);
  7731. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7732. bool isEmpty() throw();
  7733. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7734. void translate (float dx, int dy) throw();
  7735. void optimiseTable() throw();
  7736. template <class EdgeTableIterationCallback>
  7737. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7738. {
  7739. const int* lineStart = table;
  7740. for (int y = 0; y < bounds.getHeight(); ++y)
  7741. {
  7742. const int* line = lineStart;
  7743. lineStart += lineStrideElements;
  7744. int numPoints = line[0];
  7745. if (--numPoints > 0)
  7746. {
  7747. int x = *++line;
  7748. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7749. int levelAccumulator = 0;
  7750. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7751. while (--numPoints >= 0)
  7752. {
  7753. const int level = *++line;
  7754. jassert (((unsigned int) level) < (unsigned int) 256);
  7755. const int endX = *++line;
  7756. jassert (endX >= x);
  7757. const int endOfRun = (endX >> 8);
  7758. if (endOfRun == (x >> 8))
  7759. {
  7760. // small segment within the same pixel, so just save it for the next
  7761. // time round..
  7762. levelAccumulator += (endX - x) * level;
  7763. }
  7764. else
  7765. {
  7766. // plot the fist pixel of this segment, including any accumulated
  7767. // levels from smaller segments that haven't been drawn yet
  7768. levelAccumulator += (0xff - (x & 0xff)) * level;
  7769. levelAccumulator >>= 8;
  7770. x >>= 8;
  7771. if (levelAccumulator > 0)
  7772. {
  7773. if (levelAccumulator >> 8)
  7774. levelAccumulator = 0xff;
  7775. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7776. }
  7777. // if there's a run of similar pixels, do it all in one go..
  7778. if (level > 0)
  7779. {
  7780. jassert (endOfRun <= bounds.getRight());
  7781. const int numPix = endOfRun - ++x;
  7782. if (numPix > 0)
  7783. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7784. }
  7785. // save the bit at the end to be drawn next time round the loop.
  7786. levelAccumulator = (endX & 0xff) * level;
  7787. }
  7788. x = endX;
  7789. }
  7790. if (levelAccumulator > 0)
  7791. {
  7792. levelAccumulator >>= 8;
  7793. if (levelAccumulator >> 8)
  7794. levelAccumulator = 0xff;
  7795. x >>= 8;
  7796. jassert (x >= bounds.getX() && x < bounds.getRight());
  7797. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7798. }
  7799. }
  7800. }
  7801. }
  7802. juce_UseDebuggingNewOperator
  7803. private:
  7804. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7805. HeapBlock<int> table;
  7806. Rectangle<int> bounds;
  7807. int maxEdgesPerLine, lineStrideElements;
  7808. bool needToCheckEmptinesss;
  7809. void addEdgePoint (int x, int y, int winding) throw();
  7810. void remapTableForNumEdges (int newNumEdgesPerLine) throw();
  7811. void intersectWithEdgeTableLine (int y, const int* otherLine) throw();
  7812. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7813. void sanitiseLevels (bool useNonZeroWinding) throw();
  7814. static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw();
  7815. };
  7816. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7817. /*** End of inlined file: juce_EdgeTable.h ***/
  7818. class Image;
  7819. class JUCE_API Path
  7820. {
  7821. public:
  7822. Path();
  7823. Path (const Path& other);
  7824. ~Path();
  7825. Path& operator= (const Path& other);
  7826. bool isEmpty() const throw();
  7827. const Rectangle<float> getBounds() const throw();
  7828. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7829. bool contains (float x, float y,
  7830. float tolerence = 10.0f) const;
  7831. bool contains (const Point<float>& point,
  7832. float tolerence = 10.0f) const;
  7833. bool intersectsLine (const Line<float>& line,
  7834. float tolerence = 10.0f);
  7835. const Line<float> getClippedLine (const Line<float>& line, bool keepSectionOutsidePath) const;
  7836. void clear() throw();
  7837. void startNewSubPath (float startX, float startY);
  7838. void closeSubPath();
  7839. void lineTo (float endX, float endY);
  7840. void quadraticTo (float controlPointX,
  7841. float controlPointY,
  7842. float endPointX,
  7843. float endPointY);
  7844. void cubicTo (float controlPoint1X,
  7845. float controlPoint1Y,
  7846. float controlPoint2X,
  7847. float controlPoint2Y,
  7848. float endPointX,
  7849. float endPointY);
  7850. const Point<float> getCurrentPosition() const;
  7851. void addRectangle (float x, float y, float width, float height);
  7852. void addRectangle (const Rectangle<int>& rectangle);
  7853. void addRoundedRectangle (float x, float y, float width, float height,
  7854. float cornerSize);
  7855. void addRoundedRectangle (float x, float y, float width, float height,
  7856. float cornerSizeX,
  7857. float cornerSizeY);
  7858. void addTriangle (float x1, float y1,
  7859. float x2, float y2,
  7860. float x3, float y3);
  7861. void addQuadrilateral (float x1, float y1,
  7862. float x2, float y2,
  7863. float x3, float y3,
  7864. float x4, float y4);
  7865. void addEllipse (float x, float y, float width, float height);
  7866. void addArc (float x, float y, float width, float height,
  7867. float fromRadians,
  7868. float toRadians,
  7869. bool startAsNewSubPath = false);
  7870. void addCentredArc (float centreX, float centreY,
  7871. float radiusX, float radiusY,
  7872. float rotationOfEllipse,
  7873. float fromRadians,
  7874. float toRadians,
  7875. bool startAsNewSubPath = false);
  7876. void addPieSegment (float x, float y,
  7877. float width, float height,
  7878. float fromRadians,
  7879. float toRadians,
  7880. float innerCircleProportionalSize);
  7881. void addLineSegment (float startX, float startY,
  7882. float endX, float endY,
  7883. float lineThickness);
  7884. void addArrow (float startX, float startY,
  7885. float endX, float endY,
  7886. float lineThickness,
  7887. float arrowheadWidth,
  7888. float arrowheadLength);
  7889. void addStar (float centreX,
  7890. float centreY,
  7891. int numberOfPoints,
  7892. float innerRadius,
  7893. float outerRadius,
  7894. float startAngle = 0.0f);
  7895. void addBubble (float bodyX, float bodyY,
  7896. float bodyW, float bodyH,
  7897. float cornerSize,
  7898. float arrowTipX,
  7899. float arrowTipY,
  7900. int whichSide,
  7901. float arrowPositionAlongEdgeProportional,
  7902. float arrowWidth);
  7903. void addPath (const Path& pathToAppend);
  7904. void addPath (const Path& pathToAppend,
  7905. const AffineTransform& transformToApply);
  7906. void swapWithPath (Path& other);
  7907. void applyTransform (const AffineTransform& transform) throw();
  7908. void scaleToFit (float x, float y, float width, float height,
  7909. bool preserveProportions) throw();
  7910. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7911. bool preserveProportions,
  7912. const Justification& justificationType = Justification::centred) const;
  7913. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7914. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7915. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7916. class JUCE_API Iterator
  7917. {
  7918. public:
  7919. Iterator (const Path& path);
  7920. ~Iterator();
  7921. bool next();
  7922. enum PathElementType
  7923. {
  7924. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7925. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7926. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7927. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7928. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7929. };
  7930. PathElementType elementType;
  7931. float x1, y1, x2, y2, x3, y3;
  7932. private:
  7933. const Path& path;
  7934. size_t index;
  7935. Iterator (const Iterator&);
  7936. Iterator& operator= (const Iterator&);
  7937. };
  7938. void loadPathFromStream (InputStream& source);
  7939. void loadPathFromData (const void* data, int numberOfBytes);
  7940. void writePathToStream (OutputStream& destination) const;
  7941. const String toString() const;
  7942. void restoreFromString (const String& stringVersion);
  7943. juce_UseDebuggingNewOperator
  7944. private:
  7945. friend class PathFlatteningIterator;
  7946. friend class Path::Iterator;
  7947. ArrayAllocationBase <float, DummyCriticalSection> data;
  7948. size_t numElements;
  7949. float pathXMin, pathXMax, pathYMin, pathYMax;
  7950. bool useNonZeroWinding;
  7951. static const float lineMarker;
  7952. static const float moveMarker;
  7953. static const float quadMarker;
  7954. static const float cubicMarker;
  7955. static const float closeSubPathMarker;
  7956. };
  7957. #endif // __JUCE_PATH_JUCEHEADER__
  7958. /*** End of inlined file: juce_Path.h ***/
  7959. class Font;
  7960. class JUCE_API Typeface : public ReferenceCountedObject
  7961. {
  7962. public:
  7963. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7964. const String getName() const throw() { return name; }
  7965. static const Ptr createSystemTypefaceFor (const Font& font);
  7966. virtual ~Typeface();
  7967. virtual float getAscent() const = 0;
  7968. virtual float getDescent() const = 0;
  7969. virtual float getStringWidth (const String& text) = 0;
  7970. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7971. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7972. juce_UseDebuggingNewOperator
  7973. protected:
  7974. String name;
  7975. explicit Typeface (const String& name) throw();
  7976. private:
  7977. Typeface (const Typeface&);
  7978. Typeface& operator= (const Typeface&);
  7979. };
  7980. class JUCE_API CustomTypeface : public Typeface
  7981. {
  7982. public:
  7983. CustomTypeface();
  7984. explicit CustomTypeface (InputStream& serialisedTypefaceStream);
  7985. ~CustomTypeface();
  7986. void clear();
  7987. void setCharacteristics (const String& name, float ascent,
  7988. bool isBold, bool isItalic,
  7989. juce_wchar defaultCharacter) throw();
  7990. void addGlyph (juce_wchar character, const Path& path, float width) throw();
  7991. void addKerningPair (juce_wchar char1, juce_wchar char2, float extraAmount) throw();
  7992. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7993. bool writeToStream (OutputStream& outputStream);
  7994. // The following methods implement the basic Typeface behaviour.
  7995. float getAscent() const;
  7996. float getDescent() const;
  7997. float getStringWidth (const String& text);
  7998. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7999. bool getOutlineForGlyph (int glyphNumber, Path& path);
  8000. int getGlyphForCharacter (juce_wchar character);
  8001. juce_UseDebuggingNewOperator
  8002. protected:
  8003. juce_wchar defaultCharacter;
  8004. float ascent;
  8005. bool isBold, isItalic;
  8006. virtual bool loadGlyphIfPossible (juce_wchar characterNeeded);
  8007. private:
  8008. class GlyphInfo;
  8009. friend class OwnedArray<GlyphInfo>;
  8010. OwnedArray <GlyphInfo> glyphs;
  8011. short lookupTable [128];
  8012. CustomTypeface (const CustomTypeface&);
  8013. CustomTypeface& operator= (const CustomTypeface&);
  8014. GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) throw();
  8015. GlyphInfo* findGlyphSubstituting (juce_wchar character) throw();
  8016. };
  8017. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  8018. /*** End of inlined file: juce_Typeface.h ***/
  8019. class LowLevelGraphicsContext;
  8020. class JUCE_API Font
  8021. {
  8022. public:
  8023. enum FontStyleFlags
  8024. {
  8025. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  8026. bold = 1, /**< boldens the font. @see setStyleFlags */
  8027. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  8028. underlined = 4 /**< underlines the font. @see setStyleFlags */
  8029. };
  8030. Font (float fontHeight,
  8031. int styleFlags = plain) throw();
  8032. Font (const String& typefaceName,
  8033. float fontHeight,
  8034. int styleFlags) throw();
  8035. Font (const Font& other) throw();
  8036. Font (const Typeface::Ptr& typeface) throw();
  8037. Font() throw();
  8038. Font& operator= (const Font& other) throw();
  8039. bool operator== (const Font& other) const throw();
  8040. bool operator!= (const Font& other) const throw();
  8041. ~Font() throw();
  8042. void setTypefaceName (const String& faceName) throw();
  8043. const String& getTypefaceName() const throw() { return font->typefaceName; }
  8044. static const String getDefaultSansSerifFontName() throw();
  8045. static const String getDefaultSerifFontName() throw();
  8046. static const String getDefaultMonospacedFontName() throw();
  8047. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
  8048. float getHeight() const throw() { return font->height; }
  8049. void setHeight (float newHeight) throw();
  8050. void setHeightWithoutChangingWidth (float newHeight) throw();
  8051. float getAscent() const throw();
  8052. float getDescent() const throw();
  8053. int getStyleFlags() const throw() { return font->styleFlags; }
  8054. void setStyleFlags (int newFlags) throw();
  8055. void setBold (bool shouldBeBold) throw();
  8056. bool isBold() const throw();
  8057. void setItalic (bool shouldBeItalic) throw();
  8058. bool isItalic() const throw();
  8059. void setUnderline (bool shouldBeUnderlined) throw();
  8060. bool isUnderlined() const throw();
  8061. void setHorizontalScale (float scaleFactor) throw();
  8062. float getHorizontalScale() const throw() { return font->horizontalScale; }
  8063. void setExtraKerningFactor (float extraKerning) throw();
  8064. float getExtraKerningFactor() const throw() { return font->kerning; }
  8065. void setSizeAndStyle (float newHeight,
  8066. int newStyleFlags,
  8067. float newHorizontalScale,
  8068. float newKerningAmount) throw();
  8069. int getStringWidth (const String& text) const throw();
  8070. float getStringWidthFloat (const String& text) const throw();
  8071. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  8072. Typeface* getTypeface() const throw();
  8073. static void findFonts (Array<Font>& results) throw();
  8074. static const StringArray findAllTypefaceNames();
  8075. static const String getFallbackFontName() throw();
  8076. static void setFallbackFontName (const String& name) throw();
  8077. juce_UseDebuggingNewOperator
  8078. private:
  8079. friend class FontGlyphAlphaMap;
  8080. friend class TypefaceCache;
  8081. class SharedFontInternal : public ReferenceCountedObject
  8082. {
  8083. public:
  8084. SharedFontInternal (const String& typefaceName, float height, float horizontalScale,
  8085. float kerning, float ascent, int styleFlags,
  8086. Typeface* typeface) throw();
  8087. SharedFontInternal (const SharedFontInternal& other) throw();
  8088. String typefaceName;
  8089. float height, horizontalScale, kerning, ascent;
  8090. int styleFlags;
  8091. Typeface::Ptr typeface;
  8092. };
  8093. ReferenceCountedObjectPtr <SharedFontInternal> font;
  8094. void dupeInternalIfShared() throw();
  8095. };
  8096. #endif // __JUCE_FONT_JUCEHEADER__
  8097. /*** End of inlined file: juce_Font.h ***/
  8098. /*** Start of inlined file: juce_PathStrokeType.h ***/
  8099. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  8100. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  8101. class JUCE_API PathStrokeType
  8102. {
  8103. public:
  8104. enum JointStyle
  8105. {
  8106. mitered, /**< Indicates that corners should be drawn with sharp joints.
  8107. Note that for angles that curve back on themselves, drawing a
  8108. mitre could require extending the point too far away from the
  8109. path, so a mitre limit is imposed and any corners that exceed it
  8110. are drawn as bevelled instead. */
  8111. curved, /**< Indicates that corners should be drawn as rounded-off. */
  8112. beveled /**< Indicates that corners should be drawn with a line flattening their
  8113. outside edge. */
  8114. };
  8115. enum EndCapStyle
  8116. {
  8117. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  8118. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  8119. the thickness of the stroke. */
  8120. rounded /**< Ends of lines are rounded-off with a circular shape. */
  8121. };
  8122. PathStrokeType (float strokeThickness,
  8123. JointStyle jointStyle = mitered,
  8124. EndCapStyle endStyle = butt) throw();
  8125. PathStrokeType (const PathStrokeType& other) throw();
  8126. PathStrokeType& operator= (const PathStrokeType& other) throw();
  8127. ~PathStrokeType() throw();
  8128. void createStrokedPath (Path& destPath,
  8129. const Path& sourcePath,
  8130. const AffineTransform& transform = AffineTransform::identity,
  8131. float extraAccuracy = 1.0f) const;
  8132. void createDashedStroke (Path& destPath,
  8133. const Path& sourcePath,
  8134. const float* dashLengths,
  8135. int numDashLengths,
  8136. const AffineTransform& transform = AffineTransform::identity,
  8137. float extraAccuracy = 1.0f) const;
  8138. float getStrokeThickness() const throw() { return thickness; }
  8139. JointStyle getJointStyle() const throw() { return jointStyle; }
  8140. EndCapStyle getEndStyle() const throw() { return endStyle; }
  8141. juce_UseDebuggingNewOperator
  8142. bool operator== (const PathStrokeType& other) const throw();
  8143. bool operator!= (const PathStrokeType& other) const throw();
  8144. private:
  8145. float thickness;
  8146. JointStyle jointStyle;
  8147. EndCapStyle endStyle;
  8148. };
  8149. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  8150. /*** End of inlined file: juce_PathStrokeType.h ***/
  8151. /*** Start of inlined file: juce_Colours.h ***/
  8152. #ifndef __JUCE_COLOURS_JUCEHEADER__
  8153. #define __JUCE_COLOURS_JUCEHEADER__
  8154. /*** Start of inlined file: juce_Colour.h ***/
  8155. #ifndef __JUCE_COLOUR_JUCEHEADER__
  8156. #define __JUCE_COLOUR_JUCEHEADER__
  8157. /*** Start of inlined file: juce_PixelFormats.h ***/
  8158. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  8159. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  8160. #if JUCE_MSVC
  8161. #pragma pack (push, 1)
  8162. #define PACKED
  8163. #elif JUCE_GCC
  8164. #define PACKED __attribute__((packed))
  8165. #else
  8166. #define PACKED
  8167. #endif
  8168. class PixelRGB;
  8169. class PixelAlpha;
  8170. class JUCE_API PixelARGB
  8171. {
  8172. public:
  8173. PixelARGB() throw() {}
  8174. ~PixelARGB() throw() {}
  8175. PixelARGB (const uint32 argb_) throw()
  8176. : argb (argb_)
  8177. {
  8178. }
  8179. forcedinline uint32 getARGB() const throw() { return argb; }
  8180. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  8181. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  8182. forcedinline uint8 getAlpha() const throw() { return components.a; }
  8183. forcedinline uint8 getRed() const throw() { return components.r; }
  8184. forcedinline uint8 getGreen() const throw() { return components.g; }
  8185. forcedinline uint8 getBlue() const throw() { return components.b; }
  8186. forcedinline void blend (const PixelARGB& src) throw()
  8187. {
  8188. uint32 sargb = src.getARGB();
  8189. const uint32 alpha = 0x100 - (sargb >> 24);
  8190. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8191. sargb += 0xff00ff00 & (getAG() * alpha);
  8192. argb = sargb;
  8193. }
  8194. forcedinline void blend (const PixelAlpha& src) throw();
  8195. forcedinline void blend (const PixelRGB& src) throw();
  8196. template <class Pixel>
  8197. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8198. {
  8199. ++extraAlpha;
  8200. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  8201. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  8202. const uint32 alpha = 0x100 - (sargb >> 24);
  8203. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8204. sargb += 0xff00ff00 & (getAG() * alpha);
  8205. argb = sargb;
  8206. }
  8207. template <class Pixel>
  8208. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8209. {
  8210. uint32 drb = getRB();
  8211. drb += (((src.getRB() - drb) * amount) >> 8);
  8212. drb &= 0x00ff00ff;
  8213. uint32 dag = getAG();
  8214. dag += (((src.getAG() - dag) * amount) >> 8);
  8215. dag &= 0x00ff00ff;
  8216. dag <<= 8;
  8217. dag |= drb;
  8218. argb = dag;
  8219. }
  8220. template <class Pixel>
  8221. forcedinline void set (const Pixel& src) throw()
  8222. {
  8223. argb = src.getARGB();
  8224. }
  8225. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8226. {
  8227. components.a = newAlpha;
  8228. }
  8229. forcedinline void multiplyAlpha (int multiplier) throw()
  8230. {
  8231. ++multiplier;
  8232. argb = ((multiplier * getAG()) & 0xff00ff00)
  8233. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  8234. }
  8235. forcedinline void multiplyAlpha (const float multiplier) throw()
  8236. {
  8237. multiplyAlpha ((int) (multiplier * 256.0f));
  8238. }
  8239. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  8240. {
  8241. components.b = b;
  8242. components.g = g;
  8243. components.r = r;
  8244. components.a = a;
  8245. }
  8246. forcedinline void premultiply() throw()
  8247. {
  8248. const uint32 alpha = components.a;
  8249. if (alpha < 0xff)
  8250. {
  8251. if (alpha == 0)
  8252. {
  8253. components.b = 0;
  8254. components.g = 0;
  8255. components.r = 0;
  8256. }
  8257. else
  8258. {
  8259. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  8260. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  8261. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  8262. }
  8263. }
  8264. }
  8265. forcedinline void unpremultiply() throw()
  8266. {
  8267. const uint32 alpha = components.a;
  8268. if (alpha < 0xff)
  8269. {
  8270. if (alpha == 0)
  8271. {
  8272. components.b = 0;
  8273. components.g = 0;
  8274. components.r = 0;
  8275. }
  8276. else
  8277. {
  8278. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  8279. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  8280. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  8281. }
  8282. }
  8283. }
  8284. forcedinline void desaturate() throw()
  8285. {
  8286. if (components.a < 0xff && components.a > 0)
  8287. {
  8288. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  8289. components.r = components.g = components.b
  8290. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  8291. }
  8292. else
  8293. {
  8294. components.r = components.g = components.b
  8295. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  8296. }
  8297. }
  8298. #if JUCE_BIG_ENDIAN
  8299. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  8300. #else
  8301. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  8302. #endif
  8303. private:
  8304. union
  8305. {
  8306. uint32 argb;
  8307. struct
  8308. {
  8309. #if JUCE_BIG_ENDIAN
  8310. uint8 a : 8, r : 8, g : 8, b : 8;
  8311. #else
  8312. uint8 b, g, r, a;
  8313. #endif
  8314. } PACKED components;
  8315. };
  8316. } PACKED;
  8317. class JUCE_API PixelRGB
  8318. {
  8319. public:
  8320. PixelRGB() throw() {}
  8321. ~PixelRGB() throw() {}
  8322. PixelRGB (const uint32 argb) throw()
  8323. {
  8324. r = (uint8) (argb >> 16);
  8325. g = (uint8) (argb >> 8);
  8326. b = (uint8) (argb);
  8327. }
  8328. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  8329. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  8330. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  8331. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  8332. forcedinline uint8 getRed() const throw() { return r; }
  8333. forcedinline uint8 getGreen() const throw() { return g; }
  8334. forcedinline uint8 getBlue() const throw() { return b; }
  8335. forcedinline void blend (const PixelARGB& src) throw()
  8336. {
  8337. uint32 sargb = src.getARGB();
  8338. const uint32 alpha = 0x100 - (sargb >> 24);
  8339. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8340. sargb += 0x0000ff00 & (g * alpha);
  8341. r = (uint8) (sargb >> 16);
  8342. g = (uint8) (sargb >> 8);
  8343. b = (uint8) sargb;
  8344. }
  8345. forcedinline void blend (const PixelRGB& src) throw()
  8346. {
  8347. set (src);
  8348. }
  8349. forcedinline void blend (const PixelAlpha& src) throw();
  8350. template <class Pixel>
  8351. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8352. {
  8353. ++extraAlpha;
  8354. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  8355. const uint32 sag = extraAlpha * src.getAG();
  8356. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  8357. const uint32 alpha = 0x100 - (sargb >> 24);
  8358. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8359. sargb += 0x0000ff00 & (g * alpha);
  8360. b = (uint8) sargb;
  8361. g = (uint8) (sargb >> 8);
  8362. r = (uint8) (sargb >> 16);
  8363. }
  8364. template <class Pixel>
  8365. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8366. {
  8367. uint32 drb = getRB();
  8368. drb += (((src.getRB() - drb) * amount) >> 8);
  8369. uint32 dag = getAG();
  8370. dag += (((src.getAG() - dag) * amount) >> 8);
  8371. b = (uint8) drb;
  8372. g = (uint8) dag;
  8373. r = (uint8) (drb >> 16);
  8374. }
  8375. template <class Pixel>
  8376. forcedinline void set (const Pixel& src) throw()
  8377. {
  8378. b = src.getBlue();
  8379. g = src.getGreen();
  8380. r = src.getRed();
  8381. }
  8382. forcedinline void setAlpha (const uint8) throw() {}
  8383. forcedinline void multiplyAlpha (int) throw() {}
  8384. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  8385. {
  8386. r = r_;
  8387. g = g_;
  8388. b = b_;
  8389. }
  8390. forcedinline void premultiply() throw() {}
  8391. forcedinline void unpremultiply() throw() {}
  8392. forcedinline void desaturate() throw()
  8393. {
  8394. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  8395. }
  8396. #if JUCE_MAC
  8397. enum { indexR = 0, indexG = 1, indexB = 2 };
  8398. #else
  8399. enum { indexR = 2, indexG = 1, indexB = 0 };
  8400. #endif
  8401. private:
  8402. #if JUCE_MAC
  8403. uint8 r, g, b;
  8404. #else
  8405. uint8 b, g, r;
  8406. #endif
  8407. } PACKED;
  8408. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  8409. {
  8410. set (src);
  8411. }
  8412. class JUCE_API PixelAlpha
  8413. {
  8414. public:
  8415. PixelAlpha() throw() {}
  8416. ~PixelAlpha() throw() {}
  8417. PixelAlpha (const uint32 argb) throw()
  8418. {
  8419. a = (uint8) (argb >> 24);
  8420. }
  8421. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8422. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8423. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8424. forcedinline uint8 getAlpha() const throw() { return a; }
  8425. forcedinline uint8 getRed() const throw() { return 0; }
  8426. forcedinline uint8 getGreen() const throw() { return 0; }
  8427. forcedinline uint8 getBlue() const throw() { return 0; }
  8428. template <class Pixel>
  8429. forcedinline void blend (const Pixel& src) throw()
  8430. {
  8431. const int srcA = src.getAlpha();
  8432. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8433. }
  8434. template <class Pixel>
  8435. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8436. {
  8437. ++extraAlpha;
  8438. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8439. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8440. }
  8441. template <class Pixel>
  8442. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8443. {
  8444. a += ((src,getAlpha() - a) * amount) >> 8;
  8445. }
  8446. template <class Pixel>
  8447. forcedinline void set (const Pixel& src) throw()
  8448. {
  8449. a = src.getAlpha();
  8450. }
  8451. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8452. {
  8453. a = newAlpha;
  8454. }
  8455. forcedinline void multiplyAlpha (int multiplier) throw()
  8456. {
  8457. ++multiplier;
  8458. a = (uint8) ((a * multiplier) >> 8);
  8459. }
  8460. forcedinline void multiplyAlpha (const float multiplier) throw()
  8461. {
  8462. a = (uint8) (a * multiplier);
  8463. }
  8464. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8465. {
  8466. a = a_;
  8467. }
  8468. forcedinline void premultiply() throw()
  8469. {
  8470. }
  8471. forcedinline void unpremultiply() throw()
  8472. {
  8473. }
  8474. forcedinline void desaturate() throw()
  8475. {
  8476. }
  8477. enum { indexA = 0 };
  8478. private:
  8479. uint8 a : 8;
  8480. } PACKED;
  8481. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8482. {
  8483. blend (PixelARGB (src.getARGB()));
  8484. }
  8485. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8486. {
  8487. uint32 sargb = src.getARGB();
  8488. const uint32 alpha = 0x100 - (sargb >> 24);
  8489. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8490. sargb += 0xff00ff00 & (getAG() * alpha);
  8491. argb = sargb;
  8492. }
  8493. #if JUCE_MSVC
  8494. #pragma pack (pop)
  8495. #endif
  8496. #undef PACKED
  8497. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8498. /*** End of inlined file: juce_PixelFormats.h ***/
  8499. class JUCE_API Colour
  8500. {
  8501. public:
  8502. Colour() throw();
  8503. Colour (const Colour& other) throw();
  8504. explicit Colour (uint32 argb) throw();
  8505. Colour (uint8 red,
  8506. uint8 green,
  8507. uint8 blue) throw();
  8508. static const Colour fromRGB (uint8 red,
  8509. uint8 green,
  8510. uint8 blue) throw();
  8511. Colour (uint8 red,
  8512. uint8 green,
  8513. uint8 blue,
  8514. uint8 alpha) throw();
  8515. static const Colour fromRGBA (uint8 red,
  8516. uint8 green,
  8517. uint8 blue,
  8518. uint8 alpha) throw();
  8519. Colour (uint8 red,
  8520. uint8 green,
  8521. uint8 blue,
  8522. float alpha) throw();
  8523. static const Colour fromRGBAFloat (uint8 red,
  8524. uint8 green,
  8525. uint8 blue,
  8526. float alpha) throw();
  8527. Colour (float hue,
  8528. float saturation,
  8529. float brightness,
  8530. uint8 alpha) throw();
  8531. Colour (float hue,
  8532. float saturation,
  8533. float brightness,
  8534. float alpha) throw();
  8535. static const Colour fromHSV (float hue,
  8536. float saturation,
  8537. float brightness,
  8538. float alpha) throw();
  8539. ~Colour() throw();
  8540. Colour& operator= (const Colour& other) throw();
  8541. bool operator== (const Colour& other) const throw();
  8542. bool operator!= (const Colour& other) const throw();
  8543. uint8 getRed() const throw() { return argb.getRed(); }
  8544. uint8 getGreen() const throw() { return argb.getGreen(); }
  8545. uint8 getBlue() const throw() { return argb.getBlue(); }
  8546. float getFloatRed() const throw();
  8547. float getFloatGreen() const throw();
  8548. float getFloatBlue() const throw();
  8549. const PixelARGB getPixelARGB() const throw();
  8550. uint32 getARGB() const throw();
  8551. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8552. float getFloatAlpha() const throw();
  8553. bool isOpaque() const throw();
  8554. bool isTransparent() const throw();
  8555. const Colour withAlpha (uint8 newAlpha) const throw();
  8556. const Colour withAlpha (float newAlpha) const throw();
  8557. const Colour withMultipliedAlpha (float alphaMultiplier) const throw();
  8558. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8559. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8560. float getHue() const throw();
  8561. float getSaturation() const throw();
  8562. float getBrightness() const throw();
  8563. void getHSB (float& hue,
  8564. float& saturation,
  8565. float& brightness) const throw();
  8566. const Colour withHue (float newHue) const throw();
  8567. const Colour withSaturation (float newSaturation) const throw();
  8568. const Colour withBrightness (float newBrightness) const throw();
  8569. const Colour withRotatedHue (float amountToRotate) const throw();
  8570. const Colour withMultipliedSaturation (float multiplier) const throw();
  8571. const Colour withMultipliedBrightness (float amount) const throw();
  8572. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8573. const Colour darker (float amountDarker = 0.4f) const throw();
  8574. const Colour contrasting (float amount = 1.0f) const throw();
  8575. static const Colour contrasting (const Colour& colour1,
  8576. const Colour& colour2) throw();
  8577. static const Colour greyLevel (float brightness) throw();
  8578. const String toString() const;
  8579. static const Colour fromString (const String& encodedColourString);
  8580. const String toDisplayString (bool includeAlphaValue) const;
  8581. juce_UseDebuggingNewOperator
  8582. private:
  8583. PixelARGB argb;
  8584. };
  8585. #endif // __JUCE_COLOUR_JUCEHEADER__
  8586. /*** End of inlined file: juce_Colour.h ***/
  8587. class Colours
  8588. {
  8589. public:
  8590. static JUCE_API const Colour
  8591. transparentBlack, /**< ARGB = 0x00000000 */
  8592. transparentWhite, /**< ARGB = 0x00ffffff */
  8593. black, /**< ARGB = 0xff000000 */
  8594. white, /**< ARGB = 0xffffffff */
  8595. blue, /**< ARGB = 0xff0000ff */
  8596. grey, /**< ARGB = 0xff808080 */
  8597. green, /**< ARGB = 0xff008000 */
  8598. red, /**< ARGB = 0xffff0000 */
  8599. yellow, /**< ARGB = 0xffffff00 */
  8600. aliceblue, antiquewhite, aqua, aquamarine,
  8601. azure, beige, bisque, blanchedalmond,
  8602. blueviolet, brown, burlywood, cadetblue,
  8603. chartreuse, chocolate, coral, cornflowerblue,
  8604. cornsilk, crimson, cyan, darkblue,
  8605. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8606. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8607. darkorchid, darkred, darksalmon, darkseagreen,
  8608. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8609. deeppink, deepskyblue, dimgrey, dodgerblue,
  8610. firebrick, floralwhite, forestgreen, fuchsia,
  8611. gainsboro, gold, goldenrod, greenyellow,
  8612. honeydew, hotpink, indianred, indigo,
  8613. ivory, khaki, lavender, lavenderblush,
  8614. lemonchiffon, lightblue, lightcoral, lightcyan,
  8615. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8616. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8617. lightsteelblue, lightyellow, lime, limegreen,
  8618. linen, magenta, maroon, mediumaquamarine,
  8619. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8620. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8621. midnightblue, mintcream, mistyrose, navajowhite,
  8622. navy, oldlace, olive, olivedrab,
  8623. orange, orangered, orchid, palegoldenrod,
  8624. palegreen, paleturquoise, palevioletred, papayawhip,
  8625. peachpuff, peru, pink, plum,
  8626. powderblue, purple, rosybrown, royalblue,
  8627. saddlebrown, salmon, sandybrown, seagreen,
  8628. seashell, sienna, silver, skyblue,
  8629. slateblue, slategrey, snow, springgreen,
  8630. steelblue, tan, teal, thistle,
  8631. tomato, turquoise, violet, wheat,
  8632. whitesmoke, yellowgreen;
  8633. static JUCE_API const Colour findColourForName (const String& colourName,
  8634. const Colour& defaultColour);
  8635. private:
  8636. // this isn't a class you should ever instantiate - it's just here for the
  8637. // static values in it.
  8638. Colours();
  8639. Colours (const Colours&);
  8640. Colours& operator= (const Colours&);
  8641. };
  8642. #endif // __JUCE_COLOURS_JUCEHEADER__
  8643. /*** End of inlined file: juce_Colours.h ***/
  8644. /*** Start of inlined file: juce_FillType.h ***/
  8645. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8646. #define __JUCE_FILLTYPE_JUCEHEADER__
  8647. /*** Start of inlined file: juce_ColourGradient.h ***/
  8648. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8649. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8650. class JUCE_API ColourGradient
  8651. {
  8652. public:
  8653. ColourGradient (const Colour& colour1, float x1, float y1,
  8654. const Colour& colour2, float x2, float y2,
  8655. bool isRadial);
  8656. ColourGradient() throw();
  8657. ~ColourGradient();
  8658. void clearColours();
  8659. void addColour (double proportionAlongGradient,
  8660. const Colour& colour);
  8661. void multiplyOpacity (float multiplier) throw();
  8662. int getNumColours() const throw();
  8663. double getColourPosition (int index) const throw();
  8664. const Colour getColour (int index) const throw();
  8665. const Colour getColourAtPosition (float position) const throw();
  8666. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const;
  8667. bool isOpaque() const throw();
  8668. bool isInvisible() const throw();
  8669. float x1;
  8670. float y1;
  8671. float x2;
  8672. float y2;
  8673. bool isRadial;
  8674. juce_UseDebuggingNewOperator
  8675. private:
  8676. Array <uint32> colours;
  8677. };
  8678. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8679. /*** End of inlined file: juce_ColourGradient.h ***/
  8680. class Image;
  8681. class JUCE_API FillType
  8682. {
  8683. public:
  8684. FillType() throw();
  8685. FillType (const Colour& colour) throw();
  8686. FillType (const ColourGradient& gradient);
  8687. FillType (const Image& image, const AffineTransform& transform) throw();
  8688. FillType (const FillType& other);
  8689. FillType& operator= (const FillType& other);
  8690. ~FillType() throw();
  8691. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8692. bool isGradient() const throw() { return gradient != 0; }
  8693. bool isTiledImage() const throw() { return image != 0; }
  8694. void setColour (const Colour& newColour) throw();
  8695. void setGradient (const ColourGradient& newGradient);
  8696. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8697. void setOpacity (float newOpacity) throw();
  8698. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8699. Colour colour;
  8700. ScopedPointer <ColourGradient> gradient;
  8701. const Image* image;
  8702. AffineTransform transform;
  8703. juce_UseDebuggingNewOperator
  8704. };
  8705. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8706. /*** End of inlined file: juce_FillType.h ***/
  8707. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8708. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8709. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8710. class JUCE_API RectanglePlacement
  8711. {
  8712. public:
  8713. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8714. RectanglePlacement (const RectanglePlacement& other) throw();
  8715. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8716. enum
  8717. {
  8718. xLeft = 1,
  8719. xRight = 2,
  8720. xMid = 4,
  8721. yTop = 8,
  8722. yBottom = 16,
  8723. yMid = 32,
  8724. stretchToFit = 64,
  8725. fillDestination = 128,
  8726. onlyReduceInSize = 256,
  8727. onlyIncreaseInSize = 512,
  8728. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8729. centred = 4 + 32
  8730. };
  8731. inline int getFlags() const throw() { return flags; }
  8732. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8733. void applyTo (double& sourceX,
  8734. double& sourceY,
  8735. double& sourceW,
  8736. double& sourceH,
  8737. double destinationX,
  8738. double destinationY,
  8739. double destinationW,
  8740. double destinationH) const throw();
  8741. const AffineTransform getTransformToFit (float sourceX,
  8742. float sourceY,
  8743. float sourceW,
  8744. float sourceH,
  8745. float destinationX,
  8746. float destinationY,
  8747. float destinationW,
  8748. float destinationH) const throw();
  8749. private:
  8750. int flags;
  8751. };
  8752. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8753. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8754. class LowLevelGraphicsContext;
  8755. class Image;
  8756. class RectangleList;
  8757. class JUCE_API Graphics
  8758. {
  8759. public:
  8760. explicit Graphics (Image& imageToDrawOnto);
  8761. ~Graphics();
  8762. void setColour (const Colour& newColour);
  8763. void setOpacity (const float newOpacity);
  8764. void setGradientFill (const ColourGradient& gradient);
  8765. void setTiledImageFill (const Image& imageToUse,
  8766. int anchorX, int anchorY,
  8767. float opacity);
  8768. void setFillType (const FillType& newFill);
  8769. void setFont (const Font& newFont);
  8770. void setFont (float newFontHeight, int fontStyleFlags = Font::plain);
  8771. void drawSingleLineText (const String& text,
  8772. int startX, int baselineY) const;
  8773. void drawMultiLineText (const String& text,
  8774. int startX, int baselineY,
  8775. int maximumLineWidth) const;
  8776. void drawTextAsPath (const String& text,
  8777. const AffineTransform& transform) const;
  8778. void drawText (const String& text,
  8779. int x, int y, int width, int height,
  8780. const Justification& justificationType,
  8781. bool useEllipsesIfTooBig) const;
  8782. void drawFittedText (const String& text,
  8783. int x, int y, int width, int height,
  8784. const Justification& justificationFlags,
  8785. int maximumNumberOfLines,
  8786. float minimumHorizontalScale = 0.7f) const;
  8787. void fillAll() const;
  8788. void fillAll (const Colour& colourToUse) const;
  8789. void fillRect (int x, int y, int width, int height) const;
  8790. void fillRect (const Rectangle<int>& rectangle) const;
  8791. void fillRect (float x, float y, float width, float height) const;
  8792. void fillRoundedRectangle (float x, float y, float width, float height,
  8793. float cornerSize) const;
  8794. void fillRoundedRectangle (const Rectangle<float>& rectangle,
  8795. float cornerSize) const;
  8796. void fillCheckerBoard (int x, int y, int width, int height,
  8797. int checkWidth, int checkHeight,
  8798. const Colour& colour1, const Colour& colour2) const;
  8799. void drawRect (int x, int y, int width, int height,
  8800. int lineThickness = 1) const;
  8801. void drawRect (float x, float y, float width, float height,
  8802. float lineThickness = 1.0f) const;
  8803. void drawRect (const Rectangle<int>& rectangle,
  8804. int lineThickness = 1) const;
  8805. void drawRoundedRectangle (float x, float y, float width, float height,
  8806. float cornerSize, float lineThickness) const;
  8807. void drawRoundedRectangle (const Rectangle<float>& rectangle,
  8808. float cornerSize, float lineThickness) const;
  8809. void drawBevel (int x, int y, int width, int height,
  8810. int bevelThickness,
  8811. const Colour& topLeftColour = Colours::white,
  8812. const Colour& bottomRightColour = Colours::black,
  8813. bool useGradient = true,
  8814. bool sharpEdgeOnOutside = true) const;
  8815. void setPixel (int x, int y) const;
  8816. void fillEllipse (float x, float y, float width, float height) const;
  8817. void drawEllipse (float x, float y, float width, float height,
  8818. float lineThickness) const;
  8819. void drawLine (float startX, float startY, float endX, float endY) const;
  8820. void drawLine (float startX, float startY, float endX, float endY,
  8821. float lineThickness) const;
  8822. void drawLine (const Line<float>& line) const;
  8823. void drawLine (const Line<float>& line, float lineThickness) const;
  8824. void drawDashedLine (float startX, float startY,
  8825. float endX, float endY,
  8826. const float* dashLengths, int numDashLengths,
  8827. float lineThickness = 1.0f) const;
  8828. void drawVerticalLine (int x, float top, float bottom) const;
  8829. void drawHorizontalLine (int y, float left, float right) const;
  8830. void fillPath (const Path& path,
  8831. const AffineTransform& transform = AffineTransform::identity) const;
  8832. void strokePath (const Path& path,
  8833. const PathStrokeType& strokeType,
  8834. const AffineTransform& transform = AffineTransform::identity) const;
  8835. void drawArrow (float startX, float startY,
  8836. float endX, float endY,
  8837. float lineThickness,
  8838. float arrowheadWidth,
  8839. float arrowheadLength) const;
  8840. enum ResamplingQuality
  8841. {
  8842. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8843. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8844. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8845. };
  8846. void setImageResamplingQuality (const ResamplingQuality newQuality);
  8847. void drawImageAt (const Image* const imageToDraw, int topLeftX, int topLeftY,
  8848. bool fillAlphaChannelWithCurrentBrush = false) const;
  8849. void drawImage (const Image* const imageToDraw,
  8850. int destX, int destY, int destWidth, int destHeight,
  8851. int sourceX, int sourceY, int sourceWidth, int sourceHeight,
  8852. bool fillAlphaChannelWithCurrentBrush = false) const;
  8853. void drawImageTransformed (const Image* imageToDraw,
  8854. const Rectangle<int>& imageSubRegion,
  8855. const AffineTransform& transform,
  8856. bool fillAlphaChannelWithCurrentBrush = false) const;
  8857. void drawImageWithin (const Image* imageToDraw,
  8858. int destX, int destY, int destWidth, int destHeight,
  8859. const RectanglePlacement& placementWithinTarget,
  8860. bool fillAlphaChannelWithCurrentBrush = false) const;
  8861. const Rectangle<int> getClipBounds() const;
  8862. bool clipRegionIntersects (int x, int y, int width, int height) const;
  8863. bool reduceClipRegion (int x, int y, int width, int height);
  8864. bool reduceClipRegion (const RectangleList& clipRegion);
  8865. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity);
  8866. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8867. const AffineTransform& transform);
  8868. void excludeClipRegion (const Rectangle<int>& rectangleToExclude);
  8869. bool isClipEmpty() const;
  8870. void saveState();
  8871. void restoreState();
  8872. void setOrigin (int newOriginX, int newOriginY);
  8873. void resetToDefaultState();
  8874. bool isVectorDevice() const;
  8875. juce_UseDebuggingNewOperator
  8876. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8877. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8878. private:
  8879. LowLevelGraphicsContext* const context;
  8880. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8881. bool saveStatePending;
  8882. void saveStateIfPending();
  8883. Graphics (const Graphics&);
  8884. Graphics& operator= (const Graphics& other);
  8885. };
  8886. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8887. /*** End of inlined file: juce_Graphics.h ***/
  8888. class JUCE_API ImageEffectFilter
  8889. {
  8890. public:
  8891. virtual void applyEffect (Image& sourceImage,
  8892. Graphics& destContext) = 0;
  8893. virtual ~ImageEffectFilter() {}
  8894. };
  8895. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8896. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8897. /*** Start of inlined file: juce_RectangleList.h ***/
  8898. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8899. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8900. class JUCE_API RectangleList
  8901. {
  8902. public:
  8903. RectangleList() throw();
  8904. RectangleList (const RectangleList& other);
  8905. RectangleList (const Rectangle<int>& rect);
  8906. RectangleList& operator= (const RectangleList& other);
  8907. ~RectangleList();
  8908. bool isEmpty() const throw();
  8909. int getNumRectangles() const throw() { return rects.size(); }
  8910. const Rectangle<int> getRectangle (int index) const throw();
  8911. void clear();
  8912. void add (int x, int y, int width, int height);
  8913. void add (const Rectangle<int>& rect);
  8914. void addWithoutMerging (const Rectangle<int>& rect);
  8915. void add (const RectangleList& other);
  8916. void subtract (const Rectangle<int>& rect);
  8917. void subtract (const RectangleList& otherList);
  8918. bool clipTo (const Rectangle<int>& rect);
  8919. bool clipTo (const RectangleList& other);
  8920. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const;
  8921. void swapWith (RectangleList& otherList) throw();
  8922. bool containsPoint (int x, int y) const throw();
  8923. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const;
  8924. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8925. bool intersects (const RectangleList& other) const throw();
  8926. const Rectangle<int> getBounds() const throw();
  8927. void consolidate();
  8928. void offsetAll (int dx, int dy) throw();
  8929. const Path toPath() const;
  8930. class Iterator
  8931. {
  8932. public:
  8933. Iterator (const RectangleList& list) throw();
  8934. ~Iterator();
  8935. bool next() throw();
  8936. const Rectangle<int>* getRectangle() const throw() { return current; }
  8937. juce_UseDebuggingNewOperator
  8938. private:
  8939. const Rectangle<int>* current;
  8940. const RectangleList& owner;
  8941. int index;
  8942. Iterator (const Iterator&);
  8943. Iterator& operator= (const Iterator&);
  8944. };
  8945. juce_UseDebuggingNewOperator
  8946. private:
  8947. friend class Iterator;
  8948. Array <Rectangle<int> > rects;
  8949. };
  8950. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8951. /*** End of inlined file: juce_RectangleList.h ***/
  8952. /*** Start of inlined file: juce_BorderSize.h ***/
  8953. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8954. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8955. class JUCE_API BorderSize
  8956. {
  8957. public:
  8958. BorderSize() throw();
  8959. BorderSize (const BorderSize& other) throw();
  8960. BorderSize (int topGap,
  8961. int leftGap,
  8962. int bottomGap,
  8963. int rightGap) throw();
  8964. explicit BorderSize (int allGaps) throw();
  8965. ~BorderSize() throw();
  8966. int getTop() const throw() { return top; }
  8967. int getLeft() const throw() { return left; }
  8968. int getBottom() const throw() { return bottom; }
  8969. int getRight() const throw() { return right; }
  8970. int getTopAndBottom() const throw() { return top + bottom; }
  8971. int getLeftAndRight() const throw() { return left + right; }
  8972. void setTop (int newTopGap) throw();
  8973. void setLeft (int newLeftGap) throw();
  8974. void setBottom (int newBottomGap) throw();
  8975. void setRight (int newRightGap) throw();
  8976. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8977. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8978. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8979. void addTo (Rectangle<int>& original) const throw();
  8980. bool operator== (const BorderSize& other) const throw();
  8981. bool operator!= (const BorderSize& other) const throw();
  8982. juce_UseDebuggingNewOperator
  8983. private:
  8984. int top, left, bottom, right;
  8985. };
  8986. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8987. /*** End of inlined file: juce_BorderSize.h ***/
  8988. class LookAndFeel;
  8989. class MouseInputSource;
  8990. class MouseInputSourceInternal;
  8991. class ComponentPeer;
  8992. class JUCE_API Component : public MouseListener,
  8993. protected MessageListener
  8994. {
  8995. public:
  8996. Component();
  8997. virtual ~Component();
  8998. explicit Component (const String& componentName);
  8999. const String& getName() const throw() { return componentName_; }
  9000. virtual void setName (const String& newName);
  9001. bool isValidComponent() const;
  9002. virtual void setVisible (bool shouldBeVisible);
  9003. bool isVisible() const throw() { return flags.visibleFlag; }
  9004. virtual void visibilityChanged();
  9005. bool isShowing() const;
  9006. void fadeOutComponent (int lengthOfFadeOutInMilliseconds,
  9007. int deltaXToMove = 0,
  9008. int deltaYToMove = 0,
  9009. float scaleFactorAtEnd = 1.0f);
  9010. virtual void addToDesktop (int windowStyleFlags,
  9011. void* nativeWindowToAttachTo = 0);
  9012. void removeFromDesktop();
  9013. bool isOnDesktop() const throw();
  9014. ComponentPeer* getPeer() const;
  9015. virtual void userTriedToCloseWindow();
  9016. virtual void minimisationStateChanged (bool isNowMinimised);
  9017. void toFront (bool shouldAlsoGainFocus);
  9018. void toBack();
  9019. void toBehind (Component* other);
  9020. void setAlwaysOnTop (bool shouldStayOnTop);
  9021. bool isAlwaysOnTop() const throw();
  9022. inline int getX() const throw() { return bounds_.getX(); }
  9023. inline int getY() const throw() { return bounds_.getY(); }
  9024. inline int getWidth() const throw() { return bounds_.getWidth(); }
  9025. inline int getHeight() const throw() { return bounds_.getHeight(); }
  9026. int getRight() const throw() { return bounds_.getRight(); }
  9027. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  9028. int getBottom() const throw() { return bounds_.getBottom(); }
  9029. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  9030. const Rectangle<int> getLocalBounds() const throw();
  9031. void getVisibleArea (RectangleList& result,
  9032. bool includeSiblings) const;
  9033. int getScreenX() const;
  9034. int getScreenY() const;
  9035. const Point<int> getScreenPosition() const;
  9036. const Rectangle<int> getScreenBounds() const;
  9037. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  9038. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  9039. const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
  9040. const Point<int>& positionRelativeToThis) const;
  9041. void setTopLeftPosition (int x, int y);
  9042. void setTopRightPosition (int x, int y);
  9043. void setSize (int newWidth, int newHeight);
  9044. void setBounds (int x, int y, int width, int height);
  9045. void setBounds (const Rectangle<int>& newBounds);
  9046. void setBoundsRelative (float proportionalX, float proportionalY,
  9047. float proportionalWidth, float proportionalHeight);
  9048. void setBoundsInset (const BorderSize& borders);
  9049. void setBoundsToFit (int x, int y, int width, int height,
  9050. const Justification& justification,
  9051. bool onlyReduceInSize);
  9052. void setCentrePosition (int x, int y);
  9053. void setCentreRelative (float x, float y);
  9054. void centreWithSize (int width, int height);
  9055. int proportionOfWidth (float proportion) const throw();
  9056. int proportionOfHeight (float proportion) const throw();
  9057. int getParentWidth() const throw();
  9058. int getParentHeight() const throw();
  9059. const Rectangle<int> getParentMonitorArea() const;
  9060. int getNumChildComponents() const throw();
  9061. Component* getChildComponent (int index) const throw();
  9062. int getIndexOfChildComponent (const Component* child) const throw();
  9063. void addChildComponent (Component* child, int zOrder = -1);
  9064. void addAndMakeVisible (Component* child, int zOrder = -1);
  9065. void removeChildComponent (Component* childToRemove);
  9066. Component* removeChildComponent (int childIndexToRemove);
  9067. void removeAllChildren();
  9068. void deleteAllChildren();
  9069. Component* getParentComponent() const throw() { return parentComponent_; }
  9070. template <class TargetClass>
  9071. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  9072. {
  9073. (void) dummyParameter;
  9074. Component* p = parentComponent_;
  9075. while (p != 0)
  9076. {
  9077. TargetClass* target = dynamic_cast <TargetClass*> (p);
  9078. if (target != 0)
  9079. return target;
  9080. p = p->parentComponent_;
  9081. }
  9082. return 0;
  9083. }
  9084. Component* getTopLevelComponent() const throw();
  9085. bool isParentOf (const Component* possibleChild) const throw();
  9086. virtual void parentHierarchyChanged();
  9087. virtual void childrenChanged();
  9088. virtual bool hitTest (int x, int y);
  9089. void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
  9090. bool allowClicksOnChildComponents) throw();
  9091. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  9092. bool& allowsClicksOnChildComponents) const throw();
  9093. virtual bool contains (int x, int y);
  9094. bool reallyContains (int x, int y, bool returnTrueIfWithinAChild);
  9095. Component* getComponentAt (int x, int y);
  9096. Component* getComponentAt (const Point<int>& position);
  9097. void repaint();
  9098. void repaint (int x, int y, int width, int height);
  9099. void setBufferedToImage (bool shouldBeBuffered);
  9100. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  9101. bool clipImageToComponentBounds = true);
  9102. void paintEntireComponent (Graphics& context);
  9103. void setComponentEffect (ImageEffectFilter* newEffect);
  9104. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  9105. LookAndFeel& getLookAndFeel() const throw();
  9106. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  9107. virtual void lookAndFeelChanged();
  9108. void sendLookAndFeelChange();
  9109. void setOpaque (bool shouldBeOpaque);
  9110. bool isOpaque() const throw();
  9111. void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) throw();
  9112. bool isBroughtToFrontOnMouseClick() const throw();
  9113. // Keyboard focus methods
  9114. void setWantsKeyboardFocus (bool wantsFocus) throw();
  9115. bool getWantsKeyboardFocus() const throw();
  9116. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  9117. bool getMouseClickGrabsKeyboardFocus() const throw();
  9118. void grabKeyboardFocus();
  9119. bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
  9120. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  9121. void moveKeyboardFocusToSibling (bool moveToNext);
  9122. virtual KeyboardFocusTraverser* createFocusTraverser();
  9123. int getExplicitFocusOrder() const;
  9124. void setExplicitFocusOrder (int newFocusOrderIndex);
  9125. void setFocusContainer (bool shouldBeFocusContainer) throw();
  9126. bool isFocusContainer() const throw();
  9127. bool isEnabled() const throw();
  9128. void setEnabled (bool shouldBeEnabled);
  9129. virtual void enablementChanged();
  9130. void setMouseCursor (const MouseCursor& cursorType);
  9131. virtual const MouseCursor getMouseCursor();
  9132. void updateMouseCursor() const;
  9133. virtual void paint (Graphics& g);
  9134. virtual void paintOverChildren (Graphics& g);
  9135. virtual void mouseMove (const MouseEvent& e);
  9136. virtual void mouseEnter (const MouseEvent& e);
  9137. virtual void mouseExit (const MouseEvent& e);
  9138. virtual void mouseDown (const MouseEvent& e);
  9139. virtual void mouseDrag (const MouseEvent& e);
  9140. virtual void mouseUp (const MouseEvent& e);
  9141. virtual void mouseDoubleClick (const MouseEvent& e);
  9142. virtual void mouseWheelMove (const MouseEvent& e,
  9143. float wheelIncrementX,
  9144. float wheelIncrementY);
  9145. static void beginDragAutoRepeat (int millisecondIntervalBetweenCallbacks);
  9146. void setRepaintsOnMouseActivity (bool shouldRepaint) throw();
  9147. void addMouseListener (MouseListener* newListener,
  9148. bool wantsEventsForAllNestedChildComponents);
  9149. void removeMouseListener (MouseListener* listenerToRemove);
  9150. void addKeyListener (KeyListener* newListener);
  9151. void removeKeyListener (KeyListener* listenerToRemove);
  9152. virtual bool keyPressed (const KeyPress& key);
  9153. virtual bool keyStateChanged (bool isKeyDown);
  9154. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  9155. enum FocusChangeType
  9156. {
  9157. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  9158. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  9159. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  9160. };
  9161. virtual void focusGained (FocusChangeType cause);
  9162. virtual void focusLost (FocusChangeType cause);
  9163. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  9164. bool isMouseOver() const throw();
  9165. bool isMouseButtonDown() const throw();
  9166. bool isMouseOverOrDragging() const throw();
  9167. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  9168. const Point<int> getMouseXYRelative() const;
  9169. virtual void resized();
  9170. virtual void moved();
  9171. virtual void childBoundsChanged (Component* child);
  9172. virtual void parentSizeChanged();
  9173. virtual void broughtToFront();
  9174. void addComponentListener (ComponentListener* newListener);
  9175. void removeComponentListener (ComponentListener* listenerToRemove);
  9176. void postCommandMessage (int commandId);
  9177. virtual void handleCommandMessage (int commandId);
  9178. int runModalLoop();
  9179. void enterModalState (bool takeKeyboardFocus = true);
  9180. void exitModalState (int returnValue);
  9181. bool isCurrentlyModal() const throw();
  9182. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  9183. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  9184. bool isCurrentlyBlockedByAnotherModalComponent() const;
  9185. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  9186. virtual void inputAttemptWhenModal();
  9187. NamedValueSet& getProperties() throw() { return properties; }
  9188. const NamedValueSet& getProperties() const throw() { return properties; }
  9189. const Colour findColour (int colourId, bool inheritFromParent = false) const;
  9190. void setColour (int colourId, const Colour& colour);
  9191. void removeColour (int colourId);
  9192. bool isColourSpecified (int colourId) const;
  9193. void copyAllExplicitColoursTo (Component& target) const;
  9194. virtual void colourChanged();
  9195. void* getWindowHandle() const;
  9196. uint32 getComponentUID() const throw() { return componentUID; }
  9197. template <class ComponentType>
  9198. class SafePointer : private ComponentListener
  9199. {
  9200. public:
  9201. SafePointer() : comp (0) {}
  9202. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  9203. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  9204. ~SafePointer() { detach(); }
  9205. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  9206. SafePointer& operator= (ComponentType* const newComponent)
  9207. {
  9208. detach();
  9209. comp = newComponent;
  9210. attach();
  9211. return *this;
  9212. }
  9213. operator ComponentType*() const throw() { return comp; }
  9214. ComponentType* getComponent() const throw() { return comp; }
  9215. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  9216. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  9217. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  9218. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  9219. juce_UseDebuggingNewOperator
  9220. private:
  9221. ComponentType* comp;
  9222. void attach() { if (comp != 0) comp->addComponentListener (this); }
  9223. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  9224. void componentBeingDeleted (Component&) { comp = 0; }
  9225. };
  9226. class BailOutChecker
  9227. {
  9228. public:
  9229. BailOutChecker (Component* component1,
  9230. Component* component2 = 0);
  9231. bool shouldBailOut() const throw();
  9232. private:
  9233. typedef SafePointer<Component> SafeComponentPtr;
  9234. SafeComponentPtr safePointer1, safePointer2;
  9235. Component* const component2;
  9236. BailOutChecker (const BailOutChecker&);
  9237. BailOutChecker& operator= (const BailOutChecker&);
  9238. };
  9239. juce_UseDebuggingNewOperator
  9240. private:
  9241. friend class ComponentPeer;
  9242. friend class InternalDragRepeater;
  9243. friend class MouseInputSource;
  9244. friend class MouseInputSourceInternal;
  9245. static Component* currentlyFocusedComponent;
  9246. String componentName_;
  9247. Component* parentComponent_;
  9248. uint32 componentUID;
  9249. Rectangle<int> bounds_;
  9250. int numDeepMouseListeners;
  9251. Array <Component*> childComponentList_;
  9252. LookAndFeel* lookAndFeel_;
  9253. MouseCursor cursor_;
  9254. ImageEffectFilter* effect_;
  9255. Image* bufferedImage_;
  9256. Array <MouseListener*>* mouseListeners_;
  9257. VoidArray* keyListeners_;
  9258. ListenerList <ComponentListener> componentListeners;
  9259. NamedValueSet properties;
  9260. struct ComponentFlags
  9261. {
  9262. bool hasHeavyweightPeerFlag : 1;
  9263. bool visibleFlag : 1;
  9264. bool opaqueFlag : 1;
  9265. bool ignoresMouseClicksFlag : 1;
  9266. bool allowChildMouseClicksFlag : 1;
  9267. bool wantsFocusFlag : 1;
  9268. bool isFocusContainerFlag : 1;
  9269. bool dontFocusOnMouseClickFlag : 1;
  9270. bool alwaysOnTopFlag : 1;
  9271. bool bufferToImageFlag : 1;
  9272. bool bringToFrontOnClickFlag : 1;
  9273. bool repaintOnMouseActivityFlag : 1;
  9274. bool draggingFlag : 1;
  9275. bool mouseOverFlag : 1;
  9276. bool mouseInsideFlag : 1;
  9277. bool currentlyModalFlag : 1;
  9278. bool isDisabledFlag : 1;
  9279. bool childCompFocusedFlag : 1;
  9280. #if JUCE_DEBUG
  9281. bool isInsidePaintCall : 1;
  9282. #endif
  9283. };
  9284. union
  9285. {
  9286. uint32 componentFlags_;
  9287. ComponentFlags flags;
  9288. };
  9289. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9290. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9291. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9292. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  9293. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9294. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9295. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, float amountX, float amountY);
  9296. void internalBroughtToFront();
  9297. void internalFocusGain (const FocusChangeType cause);
  9298. void internalFocusLoss (const FocusChangeType cause);
  9299. void internalChildFocusChange (FocusChangeType cause);
  9300. void internalModalInputAttempt();
  9301. void internalModifierKeysChanged();
  9302. void internalChildrenChanged();
  9303. void internalHierarchyChanged();
  9304. void renderComponent (Graphics& context);
  9305. void sendMovedResizedMessages (bool wasMoved, bool wasResized);
  9306. void repaintParent();
  9307. void sendFakeMouseMove() const;
  9308. void takeKeyboardFocus (const FocusChangeType cause);
  9309. void grabFocusInternal (const FocusChangeType cause, bool canTryParent = true);
  9310. static void giveAwayFocus();
  9311. void sendEnablementChangeMessage();
  9312. static void* runModalLoopCallback (void*);
  9313. static void bringModalComponentToFront();
  9314. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  9315. const Rectangle<int>& clipRect,
  9316. const Component* const compToAvoid) const;
  9317. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  9318. int deltaX, int deltaY) const;
  9319. // how much of the component is not off the edges of its parents
  9320. const Rectangle<int> getUnclippedArea() const;
  9321. void sendVisibilityChangeMessage();
  9322. // This is included here just to cause a compile error if your code is still handling
  9323. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  9324. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  9325. // implement its methods instead of this Component method).
  9326. virtual void filesDropped (const StringArray&, int, int) {}
  9327. // components aren't allowed to have copy constructors, as this would mess up parent
  9328. // hierarchies. You might need to give your subclasses a private dummy constructor like
  9329. // this one to avoid compiler warnings.
  9330. Component (const Component&);
  9331. Component& operator= (const Component&);
  9332. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  9333. // subclass to use the new parameters to keyStateChanged)
  9334. virtual void keyStateChanged() {};
  9335. protected:
  9336. virtual void internalRepaint (int x, int y, int w, int h);
  9337. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  9338. void handleMessage (const Message&);
  9339. };
  9340. #endif // __JUCE_COMPONENT_JUCEHEADER__
  9341. /*** End of inlined file: juce_Component.h ***/
  9342. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  9343. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9344. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9345. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9346. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9347. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9348. typedef int CommandID;
  9349. namespace StandardApplicationCommandIDs
  9350. {
  9351. static const CommandID quit = 0x1001;
  9352. static const CommandID del = 0x1002;
  9353. static const CommandID cut = 0x1003;
  9354. static const CommandID copy = 0x1004;
  9355. static const CommandID paste = 0x1005;
  9356. static const CommandID selectAll = 0x1006;
  9357. static const CommandID deselectAll = 0x1007;
  9358. }
  9359. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9360. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9361. struct JUCE_API ApplicationCommandInfo
  9362. {
  9363. explicit ApplicationCommandInfo (CommandID commandID) throw();
  9364. void setInfo (const String& shortName,
  9365. const String& description,
  9366. const String& categoryName,
  9367. int flags) throw();
  9368. void setActive (bool isActive) throw();
  9369. void setTicked (bool isTicked) throw();
  9370. void addDefaultKeypress (int keyCode,
  9371. const ModifierKeys& modifiers) throw();
  9372. CommandID commandID;
  9373. String shortName;
  9374. String description;
  9375. String categoryName;
  9376. Array <KeyPress> defaultKeypresses;
  9377. enum CommandFlags
  9378. {
  9379. isDisabled = 1 << 0,
  9380. isTicked = 1 << 1,
  9381. wantsKeyUpDownCallbacks = 1 << 2,
  9382. hiddenFromKeyEditor = 1 << 3,
  9383. readOnlyInKeyEditor = 1 << 4,
  9384. dontTriggerVisualFeedback = 1 << 5
  9385. };
  9386. int flags;
  9387. };
  9388. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9389. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9390. class JUCE_API ApplicationCommandTarget
  9391. {
  9392. public:
  9393. ApplicationCommandTarget();
  9394. virtual ~ApplicationCommandTarget();
  9395. struct JUCE_API InvocationInfo
  9396. {
  9397. InvocationInfo (const CommandID commandID) throw();
  9398. CommandID commandID;
  9399. int commandFlags;
  9400. enum InvocationMethod
  9401. {
  9402. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9403. fromKeyPress, /**< The command is being invoked by a key-press. */
  9404. fromMenu, /**< The command is being invoked by a menu selection. */
  9405. fromButton /**< The command is being invoked by a button click. */
  9406. };
  9407. InvocationMethod invocationMethod;
  9408. Component* originatingComponent;
  9409. KeyPress keyPress;
  9410. bool isKeyDown;
  9411. int millisecsSinceKeyPressed;
  9412. };
  9413. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9414. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9415. virtual void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) = 0;
  9416. virtual bool perform (const InvocationInfo& info) = 0;
  9417. bool invoke (const InvocationInfo& invocationInfo,
  9418. const bool asynchronously);
  9419. bool invokeDirectly (const CommandID commandID,
  9420. const bool asynchronously);
  9421. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9422. bool isCommandActive (const CommandID commandID);
  9423. ApplicationCommandTarget* findFirstTargetParentComponent();
  9424. juce_UseDebuggingNewOperator
  9425. private:
  9426. // (for async invocation of commands)
  9427. class CommandTargetMessageInvoker : public MessageListener
  9428. {
  9429. public:
  9430. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9431. ~CommandTargetMessageInvoker();
  9432. void handleMessage (const Message& message);
  9433. private:
  9434. ApplicationCommandTarget* const owner;
  9435. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9436. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9437. };
  9438. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9439. friend class CommandTargetMessageInvoker;
  9440. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9441. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9442. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9443. };
  9444. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9445. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9446. /*** Start of inlined file: juce_ActionListener.h ***/
  9447. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9448. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9449. class JUCE_API ActionListener
  9450. {
  9451. public:
  9452. virtual ~ActionListener() {}
  9453. virtual void actionListenerCallback (const String& message) = 0;
  9454. };
  9455. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9456. /*** End of inlined file: juce_ActionListener.h ***/
  9457. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9458. private ActionListener
  9459. {
  9460. protected:
  9461. JUCEApplication();
  9462. public:
  9463. virtual ~JUCEApplication();
  9464. static JUCEApplication* getInstance() throw();
  9465. virtual void initialise (const String& commandLineParameters) = 0;
  9466. bool isInitialising() const throw();
  9467. virtual void shutdown() = 0;
  9468. virtual const String getApplicationName() = 0;
  9469. virtual const String getApplicationVersion();
  9470. virtual bool moreThanOneInstanceAllowed();
  9471. virtual void anotherInstanceStarted (const String& commandLine);
  9472. virtual void systemRequestedQuit();
  9473. virtual void unhandledException (const std::exception* e,
  9474. const String& sourceFilename,
  9475. int lineNumber);
  9476. static void quit();
  9477. void setApplicationReturnValue (int newReturnValue) throw();
  9478. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9479. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9480. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9481. static int main (String& commandLine, JUCEApplication* newApp);
  9482. static int main (int argc, const char* argv[], JUCEApplication* newApp);
  9483. static void sendUnhandledException (const std::exception* e,
  9484. const char* sourceFile,
  9485. int lineNumber);
  9486. ApplicationCommandTarget* getNextCommandTarget();
  9487. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  9488. void getAllCommands (Array <CommandID>& commands);
  9489. bool perform (const InvocationInfo& info);
  9490. void actionListenerCallback (const String& message);
  9491. private:
  9492. String commandLineParameters;
  9493. int appReturnValue;
  9494. bool stillInitialising;
  9495. ScopedPointer<InterProcessLock> appLock;
  9496. JUCEApplication (const JUCEApplication&);
  9497. JUCEApplication& operator= (const JUCEApplication&);
  9498. public:
  9499. bool initialiseApp (String& commandLine);
  9500. static int shutdownAppAndClearUp();
  9501. };
  9502. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9503. /*** End of inlined file: juce_Application.h ***/
  9504. #endif
  9505. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9506. #endif
  9507. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9508. #endif
  9509. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9510. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9511. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9512. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9513. /*** Start of inlined file: juce_Desktop.h ***/
  9514. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9515. #define __JUCE_DESKTOP_JUCEHEADER__
  9516. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9517. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9518. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9519. class JUCE_API DeletedAtShutdown
  9520. {
  9521. protected:
  9522. DeletedAtShutdown();
  9523. virtual ~DeletedAtShutdown();
  9524. public:
  9525. static void deleteAll();
  9526. private:
  9527. DeletedAtShutdown (const DeletedAtShutdown&);
  9528. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9529. };
  9530. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9531. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9532. /*** Start of inlined file: juce_Timer.h ***/
  9533. #ifndef __JUCE_TIMER_JUCEHEADER__
  9534. #define __JUCE_TIMER_JUCEHEADER__
  9535. class InternalTimerThread;
  9536. class JUCE_API Timer
  9537. {
  9538. protected:
  9539. Timer() throw();
  9540. Timer (const Timer& other) throw();
  9541. public:
  9542. virtual ~Timer();
  9543. virtual void timerCallback() = 0;
  9544. void startTimer (int intervalInMilliseconds) throw();
  9545. void stopTimer() throw();
  9546. bool isTimerRunning() const throw() { return periodMs > 0; }
  9547. int getTimerInterval() const throw() { return periodMs; }
  9548. private:
  9549. friend class InternalTimerThread;
  9550. int countdownMs, periodMs;
  9551. Timer* previous;
  9552. Timer* next;
  9553. Timer& operator= (const Timer&);
  9554. };
  9555. #endif // __JUCE_TIMER_JUCEHEADER__
  9556. /*** End of inlined file: juce_Timer.h ***/
  9557. class MouseInputSource;
  9558. class MouseInputSourceInternal;
  9559. class MouseListener;
  9560. class JUCE_API FocusChangeListener
  9561. {
  9562. public:
  9563. virtual ~FocusChangeListener() {}
  9564. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9565. };
  9566. class JUCE_API Desktop : private DeletedAtShutdown,
  9567. private Timer,
  9568. private AsyncUpdater
  9569. {
  9570. public:
  9571. static Desktop& JUCE_CALLTYPE getInstance();
  9572. const RectangleList getAllMonitorDisplayAreas (bool clippedToWorkArea = true) const throw();
  9573. const Rectangle<int> getMainMonitorArea (bool clippedToWorkArea = true) const throw();
  9574. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, bool clippedToWorkArea = true) const;
  9575. static const Point<int> getMousePosition();
  9576. static void setMousePosition (const Point<int>& newPosition);
  9577. static const Point<int> getLastMouseDownPosition() throw();
  9578. static int getMouseButtonClickCounter() throw();
  9579. static void setScreenSaverEnabled (bool isEnabled) throw();
  9580. static bool isScreenSaverEnabled() throw();
  9581. void addGlobalMouseListener (MouseListener* listener);
  9582. void removeGlobalMouseListener (MouseListener* listener);
  9583. void addFocusChangeListener (FocusChangeListener* listener);
  9584. void removeFocusChangeListener (FocusChangeListener* listener);
  9585. void setKioskModeComponent (Component* componentToUse,
  9586. bool allowMenusAndBars = true);
  9587. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9588. int getNumComponents() const throw();
  9589. Component* getComponent (int index) const throw();
  9590. Component* findComponentAt (const Point<int>& screenPosition) const;
  9591. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9592. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9593. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9594. int getNumDraggingMouseSources() const throw();
  9595. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9596. juce_UseDebuggingNewOperator
  9597. void refreshMonitorSizes();
  9598. static bool canUseSemiTransparentWindows() throw();
  9599. private:
  9600. static Desktop* instance;
  9601. friend class Component;
  9602. friend class ComponentPeer;
  9603. friend class MouseInputSource;
  9604. friend class MouseInputSourceInternal;
  9605. friend class DeletedAtShutdown;
  9606. friend class TopLevelWindowManager;
  9607. OwnedArray <MouseInputSource> mouseSources;
  9608. void createMouseInputSources();
  9609. ListenerList <MouseListener> mouseListeners;
  9610. ListenerList <FocusChangeListener> focusListeners;
  9611. Array <Component*> desktopComponents;
  9612. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9613. Point<int> lastFakeMouseMove;
  9614. void sendMouseMove();
  9615. int mouseClickCounter;
  9616. void incrementMouseClickCounter() throw();
  9617. Component* kioskModeComponent;
  9618. Rectangle<int> kioskComponentOriginalBounds;
  9619. void timerCallback();
  9620. void resetTimer();
  9621. int getNumDisplayMonitors() const throw();
  9622. const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const throw();
  9623. void addDesktopComponent (Component* c);
  9624. void removeDesktopComponent (Component* c);
  9625. void componentBroughtToFront (Component* c);
  9626. void triggerFocusCallback();
  9627. void handleAsyncUpdate();
  9628. Desktop();
  9629. ~Desktop();
  9630. Desktop (const Desktop&);
  9631. Desktop& operator= (const Desktop&);
  9632. };
  9633. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9634. /*** End of inlined file: juce_Desktop.h ***/
  9635. class KeyPressMappingSet;
  9636. class ApplicationCommandManagerListener;
  9637. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9638. private FocusChangeListener
  9639. {
  9640. public:
  9641. ApplicationCommandManager();
  9642. virtual ~ApplicationCommandManager();
  9643. void clearCommands();
  9644. void registerCommand (const ApplicationCommandInfo& newCommand);
  9645. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9646. void removeCommand (CommandID commandID);
  9647. void commandStatusChanged();
  9648. int getNumCommands() const throw() { return commands.size(); }
  9649. const ApplicationCommandInfo* getCommandForIndex (int index) const throw() { return commands [index]; }
  9650. const ApplicationCommandInfo* getCommandForID (CommandID commandID) const throw();
  9651. const String getNameOfCommand (CommandID commandID) const throw();
  9652. const String getDescriptionOfCommand (CommandID commandID) const throw();
  9653. const StringArray getCommandCategories() const throw();
  9654. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9655. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9656. bool invokeDirectly (CommandID commandID, bool asynchronously);
  9657. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9658. bool asynchronously);
  9659. virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
  9660. void setFirstCommandTarget (ApplicationCommandTarget* newTarget) throw();
  9661. ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
  9662. ApplicationCommandInfo& upToDateInfo);
  9663. void addListener (ApplicationCommandManagerListener* listener) throw();
  9664. void removeListener (ApplicationCommandManagerListener* listener) throw();
  9665. static ApplicationCommandTarget* findDefaultComponentTarget();
  9666. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9667. juce_UseDebuggingNewOperator
  9668. private:
  9669. OwnedArray <ApplicationCommandInfo> commands;
  9670. ListenerList <ApplicationCommandManagerListener> listeners;
  9671. ScopedPointer <KeyPressMappingSet> keyMappings;
  9672. ApplicationCommandTarget* firstTarget;
  9673. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9674. void handleAsyncUpdate();
  9675. void globalFocusChanged (Component*);
  9676. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9677. // version of this method.
  9678. virtual short getFirstCommandTarget() { return 0; }
  9679. ApplicationCommandManager (const ApplicationCommandManager&);
  9680. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9681. };
  9682. class JUCE_API ApplicationCommandManagerListener
  9683. {
  9684. public:
  9685. virtual ~ApplicationCommandManagerListener() {}
  9686. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9687. virtual void applicationCommandListChanged() = 0;
  9688. };
  9689. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9690. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9691. #endif
  9692. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9693. #endif
  9694. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9695. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9696. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9697. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9698. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9699. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9700. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9701. class JUCE_API PropertiesFile : public PropertySet,
  9702. public ChangeBroadcaster,
  9703. private Timer
  9704. {
  9705. public:
  9706. enum FileFormatOptions
  9707. {
  9708. ignoreCaseOfKeyNames = 1,
  9709. storeAsBinary = 2,
  9710. storeAsCompressedBinary = 4,
  9711. storeAsXML = 8
  9712. };
  9713. PropertiesFile (const File& file,
  9714. int millisecondsBeforeSaving,
  9715. int optionFlags,
  9716. InterProcessLock* processLock = 0);
  9717. ~PropertiesFile();
  9718. bool isValidFile() const throw() { return loadedOk; }
  9719. bool saveIfNeeded();
  9720. bool save();
  9721. bool needsToBeSaved() const;
  9722. void setNeedsToBeSaved (bool needsToBeSaved);
  9723. const File getFile() const { return file; }
  9724. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9725. const String& fileNameSuffix,
  9726. const String& folderName,
  9727. bool commonToAllUsers,
  9728. int millisecondsBeforeSaving,
  9729. int propertiesFileOptions,
  9730. InterProcessLock* processLock = 0);
  9731. static const File getDefaultAppSettingsFile (const String& applicationName,
  9732. const String& fileNameSuffix,
  9733. const String& folderName,
  9734. bool commonToAllUsers);
  9735. juce_UseDebuggingNewOperator
  9736. protected:
  9737. virtual void propertyChanged();
  9738. private:
  9739. File file;
  9740. int timerInterval;
  9741. const int options;
  9742. bool loadedOk, needsWriting;
  9743. InterProcessLock* processLock;
  9744. typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock;
  9745. InterProcessLock::ScopedLockType* createProcessLock() const;
  9746. void timerCallback();
  9747. PropertiesFile (const PropertiesFile&);
  9748. PropertiesFile& operator= (const PropertiesFile&);
  9749. };
  9750. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9751. /*** End of inlined file: juce_PropertiesFile.h ***/
  9752. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9753. {
  9754. public:
  9755. ApplicationProperties() throw();
  9756. ~ApplicationProperties();
  9757. juce_DeclareSingleton (ApplicationProperties, false)
  9758. void setStorageParameters (const String& applicationName,
  9759. const String& fileNameSuffix,
  9760. const String& folderName,
  9761. int millisecondsBeforeSaving,
  9762. int propertiesFileOptions) throw();
  9763. bool testWriteAccess (bool testUserSettings,
  9764. bool testCommonSettings,
  9765. bool showWarningDialogOnFailure);
  9766. PropertiesFile* getUserSettings() throw();
  9767. PropertiesFile* getCommonSettings (bool returnUserPropsIfReadOnly) throw();
  9768. bool saveIfNeeded();
  9769. void closeFiles();
  9770. juce_UseDebuggingNewOperator
  9771. private:
  9772. ScopedPointer <PropertiesFile> userProps, commonProps;
  9773. String appName, fileSuffix, folderName;
  9774. int msBeforeSaving, options;
  9775. int commonSettingsAreReadOnly;
  9776. ApplicationProperties (const ApplicationProperties&);
  9777. ApplicationProperties& operator= (const ApplicationProperties&);
  9778. void openFiles() throw();
  9779. };
  9780. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9781. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9782. #endif
  9783. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9784. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9785. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9786. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9787. /*** Start of inlined file: juce_AudioFormat.h ***/
  9788. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9789. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9790. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9791. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9792. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9793. class AudioFormat;
  9794. class JUCE_API AudioFormatReader
  9795. {
  9796. protected:
  9797. AudioFormatReader (InputStream* sourceStream,
  9798. const String& formatName);
  9799. public:
  9800. virtual ~AudioFormatReader();
  9801. const String getFormatName() const throw() { return formatName; }
  9802. bool read (int** destSamples,
  9803. int numDestChannels,
  9804. int64 startSampleInSource,
  9805. int numSamplesToRead,
  9806. bool fillLeftoverChannelsWithCopies);
  9807. virtual void readMaxLevels (int64 startSample,
  9808. int64 numSamples,
  9809. float& lowestLeft,
  9810. float& highestLeft,
  9811. float& lowestRight,
  9812. float& highestRight);
  9813. int64 searchForLevel (int64 startSample,
  9814. int64 numSamplesToSearch,
  9815. double magnitudeRangeMinimum,
  9816. double magnitudeRangeMaximum,
  9817. int minimumConsecutiveSamples);
  9818. double sampleRate;
  9819. unsigned int bitsPerSample;
  9820. int64 lengthInSamples;
  9821. unsigned int numChannels;
  9822. bool usesFloatingPointData;
  9823. StringPairArray metadataValues;
  9824. InputStream* input;
  9825. virtual bool readSamples (int** destSamples,
  9826. int numDestChannels,
  9827. int startOffsetInDestBuffer,
  9828. int64 startSampleInFile,
  9829. int numSamples) = 0;
  9830. juce_UseDebuggingNewOperator
  9831. private:
  9832. String formatName;
  9833. AudioFormatReader (const AudioFormatReader&);
  9834. AudioFormatReader& operator= (const AudioFormatReader&);
  9835. };
  9836. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9837. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9838. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9839. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9840. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9841. /*** Start of inlined file: juce_AudioSource.h ***/
  9842. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9843. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9844. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9845. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9846. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9847. class AudioFormatReader;
  9848. class AudioFormatWriter;
  9849. class JUCE_API AudioSampleBuffer
  9850. {
  9851. public:
  9852. AudioSampleBuffer (int numChannels,
  9853. int numSamples) throw();
  9854. AudioSampleBuffer (float** dataToReferTo,
  9855. int numChannels,
  9856. int numSamples) throw();
  9857. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9858. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9859. virtual ~AudioSampleBuffer() throw();
  9860. int getNumChannels() const throw() { return numChannels; }
  9861. int getNumSamples() const throw() { return size; }
  9862. float* getSampleData (const int channelNumber) const throw()
  9863. {
  9864. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9865. return channels [channelNumber];
  9866. }
  9867. float* getSampleData (const int channelNumber,
  9868. const int sampleOffset) const throw()
  9869. {
  9870. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9871. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9872. return channels [channelNumber] + sampleOffset;
  9873. }
  9874. float** getArrayOfChannels() const throw() { return channels; }
  9875. void setSize (int newNumChannels,
  9876. int newNumSamples,
  9877. bool keepExistingContent = false,
  9878. bool clearExtraSpace = false,
  9879. bool avoidReallocating = false) throw();
  9880. void setDataToReferTo (float** dataToReferTo,
  9881. int numChannels,
  9882. int numSamples) throw();
  9883. void clear() throw();
  9884. void clear (int startSample,
  9885. int numSamples) throw();
  9886. void clear (int channel,
  9887. int startSample,
  9888. int numSamples) throw();
  9889. void applyGain (int channel,
  9890. int startSample,
  9891. int numSamples,
  9892. float gain) throw();
  9893. void applyGain (int startSample,
  9894. int numSamples,
  9895. float gain) throw();
  9896. void applyGainRamp (int channel,
  9897. int startSample,
  9898. int numSamples,
  9899. float startGain,
  9900. float endGain) throw();
  9901. void addFrom (int destChannel,
  9902. int destStartSample,
  9903. const AudioSampleBuffer& source,
  9904. int sourceChannel,
  9905. int sourceStartSample,
  9906. int numSamples,
  9907. float gainToApplyToSource = 1.0f) throw();
  9908. void addFrom (int destChannel,
  9909. int destStartSample,
  9910. const float* source,
  9911. int numSamples,
  9912. float gainToApplyToSource = 1.0f) throw();
  9913. void addFromWithRamp (int destChannel,
  9914. int destStartSample,
  9915. const float* source,
  9916. int numSamples,
  9917. float startGain,
  9918. float endGain) throw();
  9919. void copyFrom (int destChannel,
  9920. int destStartSample,
  9921. const AudioSampleBuffer& source,
  9922. int sourceChannel,
  9923. int sourceStartSample,
  9924. int numSamples) throw();
  9925. void copyFrom (int destChannel,
  9926. int destStartSample,
  9927. const float* source,
  9928. int numSamples) throw();
  9929. void copyFrom (int destChannel,
  9930. int destStartSample,
  9931. const float* source,
  9932. int numSamples,
  9933. float gain) throw();
  9934. void copyFromWithRamp (int destChannel,
  9935. int destStartSample,
  9936. const float* source,
  9937. int numSamples,
  9938. float startGain,
  9939. float endGain) throw();
  9940. void findMinMax (int channel,
  9941. int startSample,
  9942. int numSamples,
  9943. float& minVal,
  9944. float& maxVal) const throw();
  9945. float getMagnitude (int channel,
  9946. int startSample,
  9947. int numSamples) const throw();
  9948. float getMagnitude (int startSample,
  9949. int numSamples) const throw();
  9950. float getRMSLevel (int channel,
  9951. int startSample,
  9952. int numSamples) const throw();
  9953. void readFromAudioReader (AudioFormatReader* reader,
  9954. int startSample,
  9955. int numSamples,
  9956. int readerStartSample,
  9957. bool useReaderLeftChan,
  9958. bool useReaderRightChan) throw();
  9959. void writeToAudioWriter (AudioFormatWriter* writer,
  9960. int startSample,
  9961. int numSamples) const throw();
  9962. juce_UseDebuggingNewOperator
  9963. private:
  9964. int numChannels, size;
  9965. size_t allocatedBytes;
  9966. float** channels;
  9967. HeapBlock <char> allocatedData;
  9968. float* preallocatedChannelSpace [32];
  9969. void allocateData();
  9970. void allocateChannels (float** dataToReferTo);
  9971. };
  9972. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9973. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9974. struct JUCE_API AudioSourceChannelInfo
  9975. {
  9976. AudioSampleBuffer* buffer;
  9977. int startSample;
  9978. int numSamples;
  9979. void clearActiveBufferRegion() const
  9980. {
  9981. if (buffer != 0)
  9982. buffer->clear (startSample, numSamples);
  9983. }
  9984. };
  9985. class JUCE_API AudioSource
  9986. {
  9987. protected:
  9988. AudioSource() throw() {}
  9989. public:
  9990. virtual ~AudioSource() {}
  9991. virtual void prepareToPlay (int samplesPerBlockExpected,
  9992. double sampleRate) = 0;
  9993. virtual void releaseResources() = 0;
  9994. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9995. };
  9996. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9997. /*** End of inlined file: juce_AudioSource.h ***/
  9998. class JUCE_API AudioFormatWriter
  9999. {
  10000. protected:
  10001. AudioFormatWriter (OutputStream* destStream,
  10002. const String& formatName,
  10003. double sampleRate,
  10004. unsigned int numberOfChannels,
  10005. unsigned int bitsPerSample);
  10006. public:
  10007. virtual ~AudioFormatWriter();
  10008. const String getFormatName() const throw() { return formatName; }
  10009. virtual bool write (const int** samplesToWrite,
  10010. int numSamples) = 0;
  10011. bool writeFromAudioReader (AudioFormatReader& reader,
  10012. int64 startSample,
  10013. int64 numSamplesToRead);
  10014. bool writeFromAudioSource (AudioSource& source,
  10015. int numSamplesToRead,
  10016. int samplesPerBlock = 2048);
  10017. double getSampleRate() const throw() { return sampleRate; }
  10018. int getNumChannels() const throw() { return numChannels; }
  10019. int getBitsPerSample() const throw() { return bitsPerSample; }
  10020. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  10021. juce_UseDebuggingNewOperator
  10022. protected:
  10023. double sampleRate;
  10024. unsigned int numChannels;
  10025. unsigned int bitsPerSample;
  10026. bool usesFloatingPointData;
  10027. OutputStream* output;
  10028. private:
  10029. String formatName;
  10030. AudioFormatWriter (const AudioFormatWriter&);
  10031. AudioFormatWriter& operator= (const AudioFormatWriter&);
  10032. };
  10033. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  10034. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  10035. class JUCE_API AudioFormat
  10036. {
  10037. public:
  10038. virtual ~AudioFormat();
  10039. const String& getFormatName() const;
  10040. const StringArray& getFileExtensions() const;
  10041. virtual bool canHandleFile (const File& fileToTest);
  10042. virtual const Array <int> getPossibleSampleRates() = 0;
  10043. virtual const Array <int> getPossibleBitDepths() = 0;
  10044. virtual bool canDoStereo() = 0;
  10045. virtual bool canDoMono() = 0;
  10046. virtual bool isCompressed();
  10047. virtual const StringArray getQualityOptions();
  10048. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10049. const bool deleteStreamIfOpeningFails) = 0;
  10050. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10051. double sampleRateToUse,
  10052. unsigned int numberOfChannels,
  10053. int bitsPerSample,
  10054. const StringPairArray& metadataValues,
  10055. int qualityOptionIndex) = 0;
  10056. protected:
  10057. AudioFormat (const String& formatName,
  10058. const juce_wchar** const fileExtensions);
  10059. private:
  10060. String formatName;
  10061. StringArray fileExtensions;
  10062. };
  10063. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  10064. /*** End of inlined file: juce_AudioFormat.h ***/
  10065. class JUCE_API AiffAudioFormat : public AudioFormat
  10066. {
  10067. public:
  10068. AiffAudioFormat();
  10069. ~AiffAudioFormat();
  10070. const Array <int> getPossibleSampleRates();
  10071. const Array <int> getPossibleBitDepths();
  10072. bool canDoStereo();
  10073. bool canDoMono();
  10074. #if JUCE_MAC
  10075. bool canHandleFile (const File& fileToTest);
  10076. #endif
  10077. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10078. const bool deleteStreamIfOpeningFails);
  10079. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10080. double sampleRateToUse,
  10081. unsigned int numberOfChannels,
  10082. int bitsPerSample,
  10083. const StringPairArray& metadataValues,
  10084. int qualityOptionIndex);
  10085. juce_UseDebuggingNewOperator
  10086. };
  10087. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  10088. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  10089. #endif
  10090. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  10091. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  10092. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  10093. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  10094. #if JUCE_USE_CDBURNER
  10095. class AudioCDBurner : public ChangeBroadcaster
  10096. {
  10097. public:
  10098. static const StringArray findAvailableDevices();
  10099. static AudioCDBurner* openDevice (const int deviceIndex);
  10100. ~AudioCDBurner();
  10101. enum DiskState
  10102. {
  10103. unknown, /**< An error condition, if the device isn't responding. */
  10104. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  10105. may seem to be permanently open. */
  10106. noDisc, /**< The drive has no disk in it. */
  10107. writableDiskPresent, /**< The drive contains a writeable disk. */
  10108. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  10109. };
  10110. DiskState getDiskState() const;
  10111. bool isDiskPresent() const;
  10112. bool openTray();
  10113. DiskState waitUntilStateChange (int timeOutMilliseconds);
  10114. const Array<int> getAvailableWriteSpeeds() const;
  10115. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  10116. int getNumAvailableAudioBlocks() const;
  10117. bool addAudioTrack (AudioSource* source, int numSamples);
  10118. class BurnProgressListener
  10119. {
  10120. public:
  10121. BurnProgressListener() throw() {}
  10122. virtual ~BurnProgressListener() {}
  10123. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  10124. };
  10125. const String burn (BurnProgressListener* listener,
  10126. bool ejectDiscAfterwards,
  10127. bool performFakeBurnForTesting,
  10128. int writeSpeed);
  10129. void abortBurn();
  10130. juce_UseDebuggingNewOperator
  10131. private:
  10132. AudioCDBurner (const int deviceIndex);
  10133. class Pimpl;
  10134. friend class ScopedPointer<Pimpl>;
  10135. ScopedPointer<Pimpl> pimpl;
  10136. };
  10137. #endif
  10138. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  10139. /*** End of inlined file: juce_AudioCDBurner.h ***/
  10140. #endif
  10141. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  10142. /*** Start of inlined file: juce_AudioCDReader.h ***/
  10143. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  10144. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  10145. #if JUCE_USE_CDREADER
  10146. #if JUCE_MAC
  10147. #endif
  10148. class JUCE_API AudioCDReader : public AudioFormatReader
  10149. {
  10150. public:
  10151. static const StringArray getAvailableCDNames();
  10152. static AudioCDReader* createReaderForCD (const int index);
  10153. ~AudioCDReader();
  10154. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  10155. int64 startSampleInFile, int numSamples);
  10156. bool isCDStillPresent() const;
  10157. int getNumTracks() const;
  10158. int getPositionOfTrackStart (int trackNum) const;
  10159. bool isTrackAudio (int trackNum) const;
  10160. void refreshTrackLengths();
  10161. void enableIndexScanning (bool enabled);
  10162. int getLastIndex() const;
  10163. const Array <int> findIndexesInTrack (const int trackNumber);
  10164. int getCDDBId();
  10165. void ejectDisk();
  10166. juce_UseDebuggingNewOperator
  10167. private:
  10168. #if JUCE_MAC
  10169. File volumeDir;
  10170. Array<File> tracks;
  10171. Array<int> trackStartSamples;
  10172. int currentReaderTrack;
  10173. ScopedPointer <AudioFormatReader> reader;
  10174. AudioCDReader (const File& volume);
  10175. public:
  10176. static int compareElements (const File&, const File&);
  10177. private:
  10178. #elif JUCE_WINDOWS
  10179. int numTracks;
  10180. int trackStarts[100];
  10181. bool audioTracks [100];
  10182. void* handle;
  10183. bool indexingEnabled;
  10184. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  10185. MemoryBlock buffer;
  10186. AudioCDReader (void* handle);
  10187. int getIndexAt (int samplePos);
  10188. #elif JUCE_LINUX
  10189. AudioCDReader();
  10190. #endif
  10191. AudioCDReader (const AudioCDReader&);
  10192. AudioCDReader& operator= (const AudioCDReader&);
  10193. };
  10194. #endif
  10195. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  10196. /*** End of inlined file: juce_AudioCDReader.h ***/
  10197. #endif
  10198. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  10199. #endif
  10200. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10201. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  10202. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10203. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10204. class JUCE_API AudioFormatManager
  10205. {
  10206. public:
  10207. AudioFormatManager();
  10208. ~AudioFormatManager();
  10209. juce_DeclareSingleton (AudioFormatManager, false);
  10210. void registerFormat (AudioFormat* newFormat,
  10211. bool makeThisTheDefaultFormat);
  10212. void registerBasicFormats();
  10213. void clearFormats();
  10214. int getNumKnownFormats() const;
  10215. AudioFormat* getKnownFormat (int index) const;
  10216. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  10217. AudioFormat* getDefaultFormat() const;
  10218. const String getWildcardForAllFormats() const;
  10219. AudioFormatReader* createReaderFor (const File& audioFile);
  10220. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  10221. juce_UseDebuggingNewOperator
  10222. private:
  10223. OwnedArray<AudioFormat> knownFormats;
  10224. int defaultFormatIndex;
  10225. };
  10226. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10227. /*** End of inlined file: juce_AudioFormatManager.h ***/
  10228. #endif
  10229. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  10230. #endif
  10231. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  10232. #endif
  10233. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10234. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  10235. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10236. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10237. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  10238. {
  10239. public:
  10240. AudioSubsectionReader (AudioFormatReader* sourceReader,
  10241. int64 subsectionStartSample,
  10242. int64 subsectionLength,
  10243. bool deleteSourceWhenDeleted);
  10244. ~AudioSubsectionReader();
  10245. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  10246. int64 startSampleInFile, int numSamples);
  10247. void readMaxLevels (int64 startSample,
  10248. int64 numSamples,
  10249. float& lowestLeft,
  10250. float& highestLeft,
  10251. float& lowestRight,
  10252. float& highestRight);
  10253. juce_UseDebuggingNewOperator
  10254. private:
  10255. AudioFormatReader* const source;
  10256. int64 startSample, length;
  10257. const bool deleteSourceWhenDeleted;
  10258. AudioSubsectionReader (const AudioSubsectionReader&);
  10259. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  10260. };
  10261. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10262. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  10263. #endif
  10264. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10265. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  10266. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10267. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10268. class AudioThumbnailCache;
  10269. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  10270. public TimeSliceClient,
  10271. private Timer
  10272. {
  10273. public:
  10274. AudioThumbnail (int sourceSamplesPerThumbnailSample,
  10275. AudioFormatManager& formatManagerToUse,
  10276. AudioThumbnailCache& cacheToUse);
  10277. ~AudioThumbnail();
  10278. void setSource (InputSource* newSource);
  10279. void loadFrom (InputStream& input);
  10280. void saveTo (OutputStream& output) const;
  10281. int getNumChannels() const throw();
  10282. double getTotalLength() const throw();
  10283. void drawChannel (Graphics& g,
  10284. int x, int y, int w, int h,
  10285. double startTimeSeconds,
  10286. double endTimeSeconds,
  10287. int channelNum,
  10288. float verticalZoomFactor);
  10289. bool isFullyLoaded() const throw();
  10290. bool useTimeSlice();
  10291. void timerCallback();
  10292. juce_UseDebuggingNewOperator
  10293. private:
  10294. AudioFormatManager& formatManagerToUse;
  10295. AudioThumbnailCache& cache;
  10296. ScopedPointer <InputSource> source;
  10297. CriticalSection readerLock;
  10298. ScopedPointer <AudioFormatReader> reader;
  10299. MemoryBlock data, cachedLevels;
  10300. int orginalSamplesPerThumbnailSample;
  10301. int numChannelsCached, numSamplesCached;
  10302. double cachedStart, cachedTimePerPixel;
  10303. bool cacheNeedsRefilling;
  10304. void clear();
  10305. AudioFormatReader* createReader() const;
  10306. void generateSection (AudioFormatReader& reader, int64 startSample, int numSamples);
  10307. char* getChannelData (int channel) const;
  10308. void refillCache (int numSamples, double startTime, double timePerPixel);
  10309. friend class AudioThumbnailCache;
  10310. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  10311. bool initialiseFromAudioFile (AudioFormatReader& reader);
  10312. // returns true if more needs to be read
  10313. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  10314. };
  10315. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10316. /*** End of inlined file: juce_AudioThumbnail.h ***/
  10317. #endif
  10318. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10319. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  10320. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10321. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10322. struct ThumbnailCacheEntry;
  10323. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  10324. {
  10325. public:
  10326. explicit AudioThumbnailCache (int maxNumThumbsToStore);
  10327. ~AudioThumbnailCache();
  10328. void clear();
  10329. bool loadThumb (AudioThumbnail& thumb, int64 hashCode);
  10330. void storeThumb (const AudioThumbnail& thumb, int64 hashCode);
  10331. juce_UseDebuggingNewOperator
  10332. private:
  10333. OwnedArray <ThumbnailCacheEntry> thumbs;
  10334. int maxNumThumbsToStore;
  10335. friend class AudioThumbnail;
  10336. void addThumbnail (AudioThumbnail* thumb);
  10337. void removeThumbnail (AudioThumbnail* thumb);
  10338. };
  10339. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10340. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  10341. #endif
  10342. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10343. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10344. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10345. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10346. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10347. class JUCE_API FlacAudioFormat : public AudioFormat
  10348. {
  10349. public:
  10350. FlacAudioFormat();
  10351. ~FlacAudioFormat();
  10352. const Array <int> getPossibleSampleRates();
  10353. const Array <int> getPossibleBitDepths();
  10354. bool canDoStereo();
  10355. bool canDoMono();
  10356. bool isCompressed();
  10357. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10358. const bool deleteStreamIfOpeningFails);
  10359. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10360. double sampleRateToUse,
  10361. unsigned int numberOfChannels,
  10362. int bitsPerSample,
  10363. const StringPairArray& metadataValues,
  10364. int qualityOptionIndex);
  10365. juce_UseDebuggingNewOperator
  10366. };
  10367. #endif
  10368. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10369. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10370. #endif
  10371. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10372. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10373. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10374. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10375. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10376. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10377. {
  10378. public:
  10379. OggVorbisAudioFormat();
  10380. ~OggVorbisAudioFormat();
  10381. const Array <int> getPossibleSampleRates();
  10382. const Array <int> getPossibleBitDepths();
  10383. bool canDoStereo();
  10384. bool canDoMono();
  10385. bool isCompressed();
  10386. const StringArray getQualityOptions();
  10387. int estimateOggFileQuality (const File& source);
  10388. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10389. const bool deleteStreamIfOpeningFails);
  10390. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10391. double sampleRateToUse,
  10392. unsigned int numberOfChannels,
  10393. int bitsPerSample,
  10394. const StringPairArray& metadataValues,
  10395. int qualityOptionIndex);
  10396. juce_UseDebuggingNewOperator
  10397. };
  10398. #endif
  10399. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10400. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10401. #endif
  10402. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10403. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10404. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10405. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10406. #if JUCE_QUICKTIME
  10407. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10408. {
  10409. public:
  10410. QuickTimeAudioFormat();
  10411. ~QuickTimeAudioFormat();
  10412. const Array <int> getPossibleSampleRates();
  10413. const Array <int> getPossibleBitDepths();
  10414. bool canDoStereo();
  10415. bool canDoMono();
  10416. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10417. const bool deleteStreamIfOpeningFails);
  10418. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10419. double sampleRateToUse,
  10420. unsigned int numberOfChannels,
  10421. int bitsPerSample,
  10422. const StringPairArray& metadataValues,
  10423. int qualityOptionIndex);
  10424. juce_UseDebuggingNewOperator
  10425. };
  10426. #endif
  10427. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10428. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10429. #endif
  10430. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10431. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10432. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10433. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10434. class JUCE_API WavAudioFormat : public AudioFormat
  10435. {
  10436. public:
  10437. WavAudioFormat();
  10438. ~WavAudioFormat();
  10439. static const char* const bwavDescription;
  10440. static const char* const bwavOriginator;
  10441. static const char* const bwavOriginatorRef;
  10442. static const char* const bwavOriginationDate;
  10443. static const char* const bwavOriginationTime;
  10444. static const char* const bwavTimeReference;
  10445. static const char* const bwavCodingHistory;
  10446. static const StringPairArray createBWAVMetadata (const String& description,
  10447. const String& originator,
  10448. const String& originatorRef,
  10449. const Time& dateAndTime,
  10450. const int64 timeReferenceSamples,
  10451. const String& codingHistory);
  10452. const Array <int> getPossibleSampleRates();
  10453. const Array <int> getPossibleBitDepths();
  10454. bool canDoStereo();
  10455. bool canDoMono();
  10456. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10457. const bool deleteStreamIfOpeningFails);
  10458. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10459. double sampleRateToUse,
  10460. unsigned int numberOfChannels,
  10461. int bitsPerSample,
  10462. const StringPairArray& metadataValues,
  10463. int qualityOptionIndex);
  10464. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10465. juce_UseDebuggingNewOperator
  10466. };
  10467. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10468. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10469. #endif
  10470. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10471. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10472. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10473. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10474. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10475. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10476. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10477. class JUCE_API PositionableAudioSource : public AudioSource
  10478. {
  10479. protected:
  10480. PositionableAudioSource() throw() {}
  10481. public:
  10482. ~PositionableAudioSource() {}
  10483. virtual void setNextReadPosition (int newPosition) = 0;
  10484. virtual int getNextReadPosition() const = 0;
  10485. virtual int getTotalLength() const = 0;
  10486. virtual bool isLooping() const = 0;
  10487. };
  10488. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10489. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10490. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10491. {
  10492. public:
  10493. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10494. const bool deleteReaderWhenThisIsDeleted);
  10495. ~AudioFormatReaderSource();
  10496. void setLooping (const bool shouldLoop) throw();
  10497. bool isLooping() const { return looping; }
  10498. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10499. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10500. void releaseResources();
  10501. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10502. void setNextReadPosition (int newPosition);
  10503. int getNextReadPosition() const;
  10504. int getTotalLength() const;
  10505. juce_UseDebuggingNewOperator
  10506. private:
  10507. AudioFormatReader* reader;
  10508. bool deleteReader;
  10509. int volatile nextPlayPos;
  10510. bool volatile looping;
  10511. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10512. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10513. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10514. };
  10515. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10516. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10517. #endif
  10518. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10519. #endif
  10520. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10521. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10522. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10523. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10524. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10525. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10526. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10527. class AudioIODevice;
  10528. class JUCE_API AudioIODeviceCallback
  10529. {
  10530. public:
  10531. virtual ~AudioIODeviceCallback() {}
  10532. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10533. int numInputChannels,
  10534. float** outputChannelData,
  10535. int numOutputChannels,
  10536. int numSamples) = 0;
  10537. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10538. virtual void audioDeviceStopped() = 0;
  10539. };
  10540. class JUCE_API AudioIODevice
  10541. {
  10542. public:
  10543. virtual ~AudioIODevice();
  10544. const String& getName() const throw() { return name; }
  10545. const String& getTypeName() const throw() { return typeName; }
  10546. virtual const StringArray getOutputChannelNames() = 0;
  10547. virtual const StringArray getInputChannelNames() = 0;
  10548. virtual int getNumSampleRates() = 0;
  10549. virtual double getSampleRate (int index) = 0;
  10550. virtual int getNumBufferSizesAvailable() = 0;
  10551. virtual int getBufferSizeSamples (int index) = 0;
  10552. virtual int getDefaultBufferSize() = 0;
  10553. virtual const String open (const BigInteger& inputChannels,
  10554. const BigInteger& outputChannels,
  10555. double sampleRate,
  10556. int bufferSizeSamples) = 0;
  10557. virtual void close() = 0;
  10558. virtual bool isOpen() = 0;
  10559. virtual void start (AudioIODeviceCallback* callback) = 0;
  10560. virtual void stop() = 0;
  10561. virtual bool isPlaying() = 0;
  10562. virtual const String getLastError() = 0;
  10563. virtual int getCurrentBufferSizeSamples() = 0;
  10564. virtual double getCurrentSampleRate() = 0;
  10565. virtual int getCurrentBitDepth() = 0;
  10566. virtual const BigInteger getActiveOutputChannels() const = 0;
  10567. virtual const BigInteger getActiveInputChannels() const = 0;
  10568. virtual int getOutputLatencyInSamples() = 0;
  10569. virtual int getInputLatencyInSamples() = 0;
  10570. virtual bool hasControlPanel() const;
  10571. virtual bool showControlPanel();
  10572. protected:
  10573. AudioIODevice (const String& deviceName,
  10574. const String& typeName);
  10575. String name, typeName;
  10576. };
  10577. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10578. /*** End of inlined file: juce_AudioIODevice.h ***/
  10579. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10580. {
  10581. public:
  10582. AudioSourcePlayer();
  10583. virtual ~AudioSourcePlayer();
  10584. void setSource (AudioSource* newSource);
  10585. AudioSource* getCurrentSource() const throw() { return source; }
  10586. void setGain (const float newGain) throw();
  10587. void audioDeviceIOCallback (const float** inputChannelData,
  10588. int totalNumInputChannels,
  10589. float** outputChannelData,
  10590. int totalNumOutputChannels,
  10591. int numSamples);
  10592. void audioDeviceAboutToStart (AudioIODevice* device);
  10593. void audioDeviceStopped();
  10594. juce_UseDebuggingNewOperator
  10595. private:
  10596. CriticalSection readLock;
  10597. AudioSource* source;
  10598. double sampleRate;
  10599. int bufferSize;
  10600. float* channels [128];
  10601. float* outputChans [128];
  10602. const float* inputChans [128];
  10603. AudioSampleBuffer tempBuffer;
  10604. float lastGain, gain;
  10605. AudioSourcePlayer (const AudioSourcePlayer&);
  10606. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10607. };
  10608. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10609. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10610. #endif
  10611. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10612. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10613. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10614. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10615. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10616. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10617. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10618. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10619. {
  10620. public:
  10621. BufferingAudioSource (PositionableAudioSource* source,
  10622. const bool deleteSourceWhenDeleted,
  10623. int numberOfSamplesToBuffer);
  10624. ~BufferingAudioSource();
  10625. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10626. void releaseResources();
  10627. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10628. void setNextReadPosition (int newPosition);
  10629. int getNextReadPosition() const;
  10630. int getTotalLength() const { return source->getTotalLength(); }
  10631. bool isLooping() const { return source->isLooping(); }
  10632. juce_UseDebuggingNewOperator
  10633. private:
  10634. PositionableAudioSource* source;
  10635. bool deleteSourceWhenDeleted;
  10636. int numberOfSamplesToBuffer;
  10637. AudioSampleBuffer buffer;
  10638. CriticalSection bufferStartPosLock;
  10639. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10640. bool wasSourceLooping;
  10641. double volatile sampleRate;
  10642. friend class SharedBufferingAudioSourceThread;
  10643. bool readNextBufferChunk();
  10644. void readBufferSection (int start, int length, int bufferOffset);
  10645. BufferingAudioSource (const BufferingAudioSource&);
  10646. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10647. };
  10648. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10649. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10650. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10651. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10652. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10653. class JUCE_API ResamplingAudioSource : public AudioSource
  10654. {
  10655. public:
  10656. ResamplingAudioSource (AudioSource* const inputSource,
  10657. const bool deleteInputWhenDeleted);
  10658. ~ResamplingAudioSource();
  10659. void setResamplingRatio (const double samplesInPerOutputSample);
  10660. double getResamplingRatio() const throw() { return ratio; }
  10661. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10662. void releaseResources();
  10663. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10664. juce_UseDebuggingNewOperator
  10665. private:
  10666. AudioSource* const input;
  10667. const bool deleteInputWhenDeleted;
  10668. double ratio, lastRatio;
  10669. AudioSampleBuffer buffer;
  10670. int bufferPos, sampsInBuffer;
  10671. double subSampleOffset;
  10672. double coefficients[6];
  10673. CriticalSection ratioLock;
  10674. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10675. void createLowPass (const double proportionalRate);
  10676. struct FilterState
  10677. {
  10678. double x1, x2, y1, y2;
  10679. };
  10680. FilterState filterStates[2];
  10681. void resetFilters();
  10682. void applyFilter (float* samples, int num, FilterState& fs);
  10683. ResamplingAudioSource (const ResamplingAudioSource&);
  10684. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10685. };
  10686. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10687. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10688. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10689. public ChangeBroadcaster
  10690. {
  10691. public:
  10692. AudioTransportSource();
  10693. ~AudioTransportSource();
  10694. void setSource (PositionableAudioSource* const newSource,
  10695. int readAheadBufferSize = 0,
  10696. double sourceSampleRateToCorrectFor = 0.0);
  10697. void setPosition (double newPosition);
  10698. double getCurrentPosition() const;
  10699. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10700. void start();
  10701. void stop();
  10702. bool isPlaying() const throw() { return playing; }
  10703. void setGain (const float newGain) throw();
  10704. float getGain() const throw() { return gain; }
  10705. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10706. void releaseResources();
  10707. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10708. void setNextReadPosition (int newPosition);
  10709. int getNextReadPosition() const;
  10710. int getTotalLength() const;
  10711. bool isLooping() const;
  10712. juce_UseDebuggingNewOperator
  10713. private:
  10714. PositionableAudioSource* source;
  10715. ResamplingAudioSource* resamplerSource;
  10716. BufferingAudioSource* bufferingSource;
  10717. PositionableAudioSource* positionableSource;
  10718. AudioSource* masterSource;
  10719. CriticalSection callbackLock;
  10720. float volatile gain, lastGain;
  10721. bool volatile playing, stopped;
  10722. double sampleRate, sourceSampleRate;
  10723. int blockSize, readAheadBufferSize;
  10724. bool isPrepared, inputStreamEOF;
  10725. AudioTransportSource (const AudioTransportSource&);
  10726. AudioTransportSource& operator= (const AudioTransportSource&);
  10727. };
  10728. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10729. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10730. #endif
  10731. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10732. #endif
  10733. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10734. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10735. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10736. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10737. class ChannelRemappingAudioSource : public AudioSource
  10738. {
  10739. public:
  10740. ChannelRemappingAudioSource (AudioSource* const source,
  10741. const bool deleteSourceWhenDeleted);
  10742. ~ChannelRemappingAudioSource();
  10743. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10744. void clearAllMappings() throw();
  10745. void setInputChannelMapping (const int destChannelIndex,
  10746. const int sourceChannelIndex) throw();
  10747. void setOutputChannelMapping (const int sourceChannelIndex,
  10748. const int destChannelIndex) throw();
  10749. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10750. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10751. XmlElement* createXml() const throw();
  10752. void restoreFromXml (const XmlElement& e) throw();
  10753. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10754. void releaseResources();
  10755. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10756. juce_UseDebuggingNewOperator
  10757. private:
  10758. int requiredNumberOfChannels;
  10759. Array <int> remappedInputs, remappedOutputs;
  10760. AudioSource* const source;
  10761. const bool deleteSourceWhenDeleted;
  10762. AudioSampleBuffer buffer;
  10763. AudioSourceChannelInfo remappedInfo;
  10764. CriticalSection lock;
  10765. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10766. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10767. };
  10768. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10769. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10770. #endif
  10771. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10772. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10773. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10774. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10775. /*** Start of inlined file: juce_IIRFilter.h ***/
  10776. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10777. #define __JUCE_IIRFILTER_JUCEHEADER__
  10778. class JUCE_API IIRFilter
  10779. {
  10780. public:
  10781. IIRFilter();
  10782. IIRFilter (const IIRFilter& other);
  10783. ~IIRFilter();
  10784. void reset() throw();
  10785. void processSamples (float* samples,
  10786. int numSamples) throw();
  10787. float processSingleSampleRaw (float sample) throw();
  10788. void makeLowPass (double sampleRate,
  10789. double frequency) throw();
  10790. void makeHighPass (double sampleRate,
  10791. double frequency) throw();
  10792. void makeLowShelf (double sampleRate,
  10793. double cutOffFrequency,
  10794. double Q,
  10795. float gainFactor) throw();
  10796. void makeHighShelf (double sampleRate,
  10797. double cutOffFrequency,
  10798. double Q,
  10799. float gainFactor) throw();
  10800. void makeBandPass (double sampleRate,
  10801. double centreFrequency,
  10802. double Q,
  10803. float gainFactor) throw();
  10804. void makeInactive() throw();
  10805. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10806. juce_UseDebuggingNewOperator
  10807. protected:
  10808. CriticalSection processLock;
  10809. void setCoefficients (double c1, double c2, double c3,
  10810. double c4, double c5, double c6) throw();
  10811. bool active;
  10812. float coefficients[6];
  10813. float x1, x2, y1, y2;
  10814. // (use the copyCoefficientsFrom() method instead of this operator)
  10815. IIRFilter& operator= (const IIRFilter&);
  10816. };
  10817. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10818. /*** End of inlined file: juce_IIRFilter.h ***/
  10819. class JUCE_API IIRFilterAudioSource : public AudioSource
  10820. {
  10821. public:
  10822. IIRFilterAudioSource (AudioSource* const inputSource,
  10823. const bool deleteInputWhenDeleted);
  10824. ~IIRFilterAudioSource();
  10825. void setFilterParameters (const IIRFilter& newSettings);
  10826. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10827. void releaseResources();
  10828. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10829. juce_UseDebuggingNewOperator
  10830. private:
  10831. AudioSource* const input;
  10832. const bool deleteInputWhenDeleted;
  10833. OwnedArray <IIRFilter> iirFilters;
  10834. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10835. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10836. };
  10837. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10838. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10839. #endif
  10840. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10841. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10842. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10843. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10844. class JUCE_API MixerAudioSource : public AudioSource
  10845. {
  10846. public:
  10847. MixerAudioSource();
  10848. ~MixerAudioSource();
  10849. void addInputSource (AudioSource* newInput,
  10850. const bool deleteWhenRemoved);
  10851. void removeInputSource (AudioSource* input,
  10852. const bool deleteSource);
  10853. void removeAllInputs();
  10854. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10855. void releaseResources();
  10856. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10857. juce_UseDebuggingNewOperator
  10858. private:
  10859. VoidArray inputs;
  10860. BigInteger inputsToDelete;
  10861. CriticalSection lock;
  10862. AudioSampleBuffer tempBuffer;
  10863. double currentSampleRate;
  10864. int bufferSizeExpected;
  10865. MixerAudioSource (const MixerAudioSource&);
  10866. MixerAudioSource& operator= (const MixerAudioSource&);
  10867. };
  10868. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10869. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10870. #endif
  10871. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10872. #endif
  10873. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10874. #endif
  10875. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10876. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10877. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10878. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10879. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10880. {
  10881. public:
  10882. ToneGeneratorAudioSource();
  10883. ~ToneGeneratorAudioSource();
  10884. void setAmplitude (const float newAmplitude);
  10885. void setFrequency (const double newFrequencyHz);
  10886. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10887. void releaseResources();
  10888. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10889. juce_UseDebuggingNewOperator
  10890. private:
  10891. double frequency, sampleRate;
  10892. double currentPhase, phasePerSample;
  10893. float amplitude;
  10894. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10895. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10896. };
  10897. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10898. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10899. #endif
  10900. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10901. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10902. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10903. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10904. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10905. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10906. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10907. class AudioDeviceManager;
  10908. class Component;
  10909. class JUCE_API AudioIODeviceType
  10910. {
  10911. public:
  10912. const String& getTypeName() const throw() { return typeName; }
  10913. virtual void scanForDevices() = 0;
  10914. virtual const StringArray getDeviceNames (bool wantInputNames = false) const = 0;
  10915. virtual int getDefaultDeviceIndex (bool forInput) const = 0;
  10916. virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
  10917. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10918. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10919. const String& inputDeviceName) = 0;
  10920. struct DeviceSetupDetails
  10921. {
  10922. AudioDeviceManager* manager;
  10923. int minNumInputChannels, maxNumInputChannels;
  10924. int minNumOutputChannels, maxNumOutputChannels;
  10925. bool useStereoPairs;
  10926. };
  10927. virtual ~AudioIODeviceType();
  10928. protected:
  10929. explicit AudioIODeviceType (const String& typeName);
  10930. private:
  10931. String typeName;
  10932. AudioIODeviceType (const AudioIODeviceType&);
  10933. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10934. };
  10935. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10936. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10937. /*** Start of inlined file: juce_MidiInput.h ***/
  10938. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10939. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10940. /*** Start of inlined file: juce_MidiMessage.h ***/
  10941. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10942. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10943. class JUCE_API MidiMessage
  10944. {
  10945. public:
  10946. MidiMessage (int byte1, int byte2, int byte3, double timeStamp = 0) throw();
  10947. MidiMessage (int byte1, int byte2, double timeStamp = 0) throw();
  10948. MidiMessage (int byte1, double timeStamp = 0) throw();
  10949. MidiMessage (const void* data, int numBytes, double timeStamp = 0);
  10950. MidiMessage (const void* data, int maxBytesToUse,
  10951. int& numBytesUsed, uint8 lastStatusByte,
  10952. double timeStamp = 0);
  10953. MidiMessage (const MidiMessage& other);
  10954. MidiMessage (const MidiMessage& other, double newTimeStamp);
  10955. ~MidiMessage();
  10956. MidiMessage& operator= (const MidiMessage& other);
  10957. uint8* getRawData() const throw() { return data; }
  10958. int getRawDataSize() const throw() { return size; }
  10959. double getTimeStamp() const throw() { return timeStamp; }
  10960. void setTimeStamp (double newTimestamp) throw() { timeStamp = newTimestamp; }
  10961. void addToTimeStamp (double delta) throw() { timeStamp += delta; }
  10962. int getChannel() const throw();
  10963. bool isForChannel (int channelNumber) const throw();
  10964. void setChannel (int newChannelNumber) throw();
  10965. bool isSysEx() const throw();
  10966. const uint8* getSysExData() const throw();
  10967. int getSysExDataSize() const throw();
  10968. bool isNoteOn (bool returnTrueForVelocity0 = false) const throw();
  10969. static const MidiMessage noteOn (int channel, int noteNumber, float velocity) throw();
  10970. static const MidiMessage noteOn (int channel, int noteNumber, uint8 velocity) throw();
  10971. bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const throw();
  10972. static const MidiMessage noteOff (int channel, int noteNumber) throw();
  10973. bool isNoteOnOrOff() const throw();
  10974. int getNoteNumber() const throw();
  10975. void setNoteNumber (int newNoteNumber) throw();
  10976. uint8 getVelocity() const throw();
  10977. float getFloatVelocity() const throw();
  10978. void setVelocity (float newVelocity) throw();
  10979. void multiplyVelocity (float scaleFactor) throw();
  10980. bool isProgramChange() const throw();
  10981. int getProgramChangeNumber() const throw();
  10982. static const MidiMessage programChange (int channel, int programNumber) throw();
  10983. bool isPitchWheel() const throw();
  10984. int getPitchWheelValue() const throw();
  10985. static const MidiMessage pitchWheel (int channel, int position) throw();
  10986. bool isAftertouch() const throw();
  10987. int getAfterTouchValue() const throw();
  10988. static const MidiMessage aftertouchChange (int channel,
  10989. int noteNumber,
  10990. int aftertouchAmount) throw();
  10991. bool isChannelPressure() const throw();
  10992. int getChannelPressureValue() const throw();
  10993. static const MidiMessage channelPressureChange (int channel, int pressure) throw();
  10994. bool isController() const throw();
  10995. int getControllerNumber() const throw();
  10996. int getControllerValue() const throw();
  10997. static const MidiMessage controllerEvent (int channel,
  10998. int controllerType,
  10999. int value) throw();
  11000. bool isAllNotesOff() const throw();
  11001. bool isAllSoundOff() const throw();
  11002. static const MidiMessage allNotesOff (int channel) throw();
  11003. static const MidiMessage allSoundOff (int channel) throw();
  11004. static const MidiMessage allControllersOff (int channel) throw();
  11005. bool isMetaEvent() const throw();
  11006. int getMetaEventType() const throw();
  11007. const uint8* getMetaEventData() const throw();
  11008. int getMetaEventLength() const throw();
  11009. bool isTrackMetaEvent() const throw();
  11010. bool isEndOfTrackMetaEvent() const throw();
  11011. static const MidiMessage endOfTrack() throw();
  11012. bool isTrackNameEvent() const throw();
  11013. bool isTextMetaEvent() const throw();
  11014. const String getTextFromTextMetaEvent() const;
  11015. bool isTempoMetaEvent() const throw();
  11016. double getTempoMetaEventTickLength (short timeFormat) const throw();
  11017. double getTempoSecondsPerQuarterNote() const throw();
  11018. static const MidiMessage tempoMetaEvent (int microsecondsPerQuarterNote) throw();
  11019. bool isTimeSignatureMetaEvent() const throw();
  11020. void getTimeSignatureInfo (int& numerator, int& denominator) const throw();
  11021. static const MidiMessage timeSignatureMetaEvent (int numerator, int denominator);
  11022. bool isKeySignatureMetaEvent() const throw();
  11023. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  11024. bool isMidiChannelMetaEvent() const throw();
  11025. int getMidiChannelMetaEventChannel() const throw();
  11026. static const MidiMessage midiChannelMetaEvent (int channel) throw();
  11027. bool isActiveSense() const throw();
  11028. bool isMidiStart() const throw();
  11029. static const MidiMessage midiStart() throw();
  11030. bool isMidiContinue() const throw();
  11031. static const MidiMessage midiContinue() throw();
  11032. bool isMidiStop() const throw();
  11033. static const MidiMessage midiStop() throw();
  11034. bool isMidiClock() const throw();
  11035. static const MidiMessage midiClock() throw();
  11036. bool isSongPositionPointer() const throw();
  11037. int getSongPositionPointerMidiBeat() const throw();
  11038. static const MidiMessage songPositionPointer (int positionInMidiBeats) throw();
  11039. bool isQuarterFrame() const throw();
  11040. int getQuarterFrameSequenceNumber() const throw();
  11041. int getQuarterFrameValue() const throw();
  11042. static const MidiMessage quarterFrame (int sequenceNumber, int value) throw();
  11043. enum SmpteTimecodeType
  11044. {
  11045. fps24 = 0,
  11046. fps25 = 1,
  11047. fps30drop = 2,
  11048. fps30 = 3
  11049. };
  11050. bool isFullFrame() const throw();
  11051. void getFullFrameParameters (int& hours,
  11052. int& minutes,
  11053. int& seconds,
  11054. int& frames,
  11055. SmpteTimecodeType& timecodeType) const throw();
  11056. static const MidiMessage fullFrame (int hours,
  11057. int minutes,
  11058. int seconds,
  11059. int frames,
  11060. SmpteTimecodeType timecodeType);
  11061. enum MidiMachineControlCommand
  11062. {
  11063. mmc_stop = 1,
  11064. mmc_play = 2,
  11065. mmc_deferredplay = 3,
  11066. mmc_fastforward = 4,
  11067. mmc_rewind = 5,
  11068. mmc_recordStart = 6,
  11069. mmc_recordStop = 7,
  11070. mmc_pause = 9
  11071. };
  11072. bool isMidiMachineControlMessage() const throw();
  11073. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  11074. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  11075. bool isMidiMachineControlGoto (int& hours,
  11076. int& minutes,
  11077. int& seconds,
  11078. int& frames) const throw();
  11079. static const MidiMessage midiMachineControlGoto (int hours,
  11080. int minutes,
  11081. int seconds,
  11082. int frames);
  11083. static const MidiMessage masterVolume (float volume);
  11084. static const MidiMessage createSysExMessage (const uint8* sysexData,
  11085. int dataSize);
  11086. static int readVariableLengthVal (const uint8* data,
  11087. int& numBytesUsed) throw();
  11088. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  11089. static const String getMidiNoteName (int noteNumber,
  11090. bool useSharps,
  11091. bool includeOctaveNumber,
  11092. int octaveNumForMiddleC) throw();
  11093. static const double getMidiNoteInHertz (int noteNumber) throw();
  11094. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  11095. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  11096. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  11097. static const String getControllerName (int controllerNumber) throw();
  11098. juce_UseDebuggingNewOperator
  11099. private:
  11100. double timeStamp;
  11101. uint8* data;
  11102. int size;
  11103. union
  11104. {
  11105. uint8 asBytes[4];
  11106. uint32 asInt32;
  11107. } preallocatedData;
  11108. };
  11109. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  11110. /*** End of inlined file: juce_MidiMessage.h ***/
  11111. class MidiInput;
  11112. class JUCE_API MidiInputCallback
  11113. {
  11114. public:
  11115. virtual ~MidiInputCallback() {}
  11116. virtual void handleIncomingMidiMessage (MidiInput* source,
  11117. const MidiMessage& message) = 0;
  11118. virtual void handlePartialSysexMessage (MidiInput* source,
  11119. const uint8* messageData,
  11120. const int numBytesSoFar,
  11121. const double timestamp)
  11122. {
  11123. // (this bit is just to avoid compiler warnings about unused variables)
  11124. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  11125. }
  11126. };
  11127. class JUCE_API MidiInput
  11128. {
  11129. public:
  11130. static const StringArray getDevices();
  11131. static int getDefaultDeviceIndex();
  11132. static MidiInput* openDevice (int deviceIndex,
  11133. MidiInputCallback* callback);
  11134. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  11135. static MidiInput* createNewDevice (const String& deviceName,
  11136. MidiInputCallback* callback);
  11137. #endif
  11138. virtual ~MidiInput();
  11139. virtual const String getName() const throw() { return name; }
  11140. virtual void setName (const String& newName) throw() { name = newName; }
  11141. virtual void start();
  11142. virtual void stop();
  11143. juce_UseDebuggingNewOperator
  11144. protected:
  11145. String name;
  11146. void* internal;
  11147. explicit MidiInput (const String& name);
  11148. private:
  11149. MidiInput (const MidiInput&);
  11150. MidiInput& operator= (const MidiInput&);
  11151. };
  11152. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  11153. /*** End of inlined file: juce_MidiInput.h ***/
  11154. /*** Start of inlined file: juce_MidiOutput.h ***/
  11155. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11156. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  11157. /*** Start of inlined file: juce_MidiBuffer.h ***/
  11158. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11159. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  11160. class JUCE_API MidiBuffer
  11161. {
  11162. public:
  11163. MidiBuffer() throw();
  11164. explicit MidiBuffer (const MidiMessage& message) throw();
  11165. MidiBuffer (const MidiBuffer& other) throw();
  11166. MidiBuffer& operator= (const MidiBuffer& other) throw();
  11167. ~MidiBuffer() throw();
  11168. void clear() throw();
  11169. void clear (const int start,
  11170. const int numSamples) throw();
  11171. bool isEmpty() const throw();
  11172. int getNumEvents() const throw();
  11173. void addEvent (const MidiMessage& midiMessage,
  11174. const int sampleNumber) throw();
  11175. void addEvent (const uint8* const rawMidiData,
  11176. const int maxBytesOfMidiData,
  11177. const int sampleNumber) throw();
  11178. void addEvents (const MidiBuffer& otherBuffer,
  11179. const int startSample,
  11180. const int numSamples,
  11181. const int sampleDeltaToAdd) throw();
  11182. int getFirstEventTime() const throw();
  11183. int getLastEventTime() const throw();
  11184. void swapWith (MidiBuffer& other);
  11185. void ensureSize (size_t minimumNumBytes);
  11186. class Iterator
  11187. {
  11188. public:
  11189. Iterator (const MidiBuffer& buffer) throw();
  11190. ~Iterator() throw();
  11191. void setNextSamplePosition (const int samplePosition) throw();
  11192. bool getNextEvent (MidiMessage& result,
  11193. int& samplePosition) throw();
  11194. bool getNextEvent (const uint8* &midiData,
  11195. int& numBytesOfMidiData,
  11196. int& samplePosition) throw();
  11197. juce_UseDebuggingNewOperator
  11198. private:
  11199. const MidiBuffer& buffer;
  11200. const uint8* data;
  11201. Iterator (const Iterator&);
  11202. Iterator& operator= (const Iterator&);
  11203. };
  11204. juce_UseDebuggingNewOperator
  11205. private:
  11206. friend class MidiBuffer::Iterator;
  11207. MemoryBlock data;
  11208. int bytesUsed;
  11209. uint8* getData() const throw();
  11210. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  11211. static int getEventTime (const void* d) throw();
  11212. static uint16 getEventDataSize (const void* d) throw();
  11213. static uint16 getEventTotalSize (const void* d) throw();
  11214. };
  11215. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  11216. /*** End of inlined file: juce_MidiBuffer.h ***/
  11217. class JUCE_API MidiOutput : private Thread
  11218. {
  11219. public:
  11220. static const StringArray getDevices();
  11221. static int getDefaultDeviceIndex();
  11222. static MidiOutput* openDevice (int deviceIndex);
  11223. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  11224. static MidiOutput* createNewDevice (const String& deviceName);
  11225. #endif
  11226. virtual ~MidiOutput();
  11227. virtual void sendMessageNow (const MidiMessage& message);
  11228. virtual void reset();
  11229. virtual bool getVolume (float& leftVol,
  11230. float& rightVol);
  11231. virtual void setVolume (float leftVol,
  11232. float rightVol);
  11233. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  11234. double millisecondCounterToStartAt,
  11235. double samplesPerSecondForBuffer);
  11236. virtual void clearAllPendingMessages();
  11237. virtual void startBackgroundThread();
  11238. virtual void stopBackgroundThread();
  11239. juce_UseDebuggingNewOperator
  11240. protected:
  11241. void* internal;
  11242. struct PendingMessage
  11243. {
  11244. PendingMessage (const uint8* data, int len, double sampleNumber);
  11245. MidiMessage message;
  11246. PendingMessage* next;
  11247. juce_UseDebuggingNewOperator
  11248. };
  11249. CriticalSection lock;
  11250. PendingMessage* firstMessage;
  11251. MidiOutput();
  11252. void run();
  11253. private:
  11254. MidiOutput (const MidiOutput&);
  11255. MidiOutput& operator= (const MidiOutput&);
  11256. };
  11257. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  11258. /*** End of inlined file: juce_MidiOutput.h ***/
  11259. /*** Start of inlined file: juce_ComboBox.h ***/
  11260. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  11261. #define __JUCE_COMBOBOX_JUCEHEADER__
  11262. /*** Start of inlined file: juce_Label.h ***/
  11263. #ifndef __JUCE_LABEL_JUCEHEADER__
  11264. #define __JUCE_LABEL_JUCEHEADER__
  11265. /*** Start of inlined file: juce_TextEditor.h ***/
  11266. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  11267. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  11268. /*** Start of inlined file: juce_Viewport.h ***/
  11269. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  11270. #define __JUCE_VIEWPORT_JUCEHEADER__
  11271. /*** Start of inlined file: juce_ScrollBar.h ***/
  11272. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  11273. #define __JUCE_SCROLLBAR_JUCEHEADER__
  11274. /*** Start of inlined file: juce_Button.h ***/
  11275. #ifndef __JUCE_BUTTON_JUCEHEADER__
  11276. #define __JUCE_BUTTON_JUCEHEADER__
  11277. /*** Start of inlined file: juce_TooltipWindow.h ***/
  11278. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11279. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11280. /*** Start of inlined file: juce_TooltipClient.h ***/
  11281. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11282. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11283. class JUCE_API TooltipClient
  11284. {
  11285. public:
  11286. virtual ~TooltipClient() {}
  11287. virtual const String getTooltip() = 0;
  11288. };
  11289. class JUCE_API SettableTooltipClient : public TooltipClient
  11290. {
  11291. public:
  11292. virtual ~SettableTooltipClient() {}
  11293. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  11294. virtual const String getTooltip() { return tooltipString; }
  11295. juce_UseDebuggingNewOperator
  11296. protected:
  11297. String tooltipString;
  11298. };
  11299. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11300. /*** End of inlined file: juce_TooltipClient.h ***/
  11301. class JUCE_API TooltipWindow : public Component,
  11302. private Timer
  11303. {
  11304. public:
  11305. explicit TooltipWindow (Component* parentComponent = 0,
  11306. int millisecondsBeforeTipAppears = 700);
  11307. ~TooltipWindow();
  11308. void setMillisecondsBeforeTipAppears (int newTimeMs = 700) throw();
  11309. enum ColourIds
  11310. {
  11311. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  11312. textColourId = 0x1001c00, /**< The colour to use for the text. */
  11313. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  11314. };
  11315. juce_UseDebuggingNewOperator
  11316. private:
  11317. int millisecondsBeforeTipAppears;
  11318. Point<int> lastMousePos;
  11319. int mouseClicks;
  11320. unsigned int lastCompChangeTime, lastHideTime;
  11321. Component* lastComponentUnderMouse;
  11322. bool changedCompsSinceShown;
  11323. String tipShowing, lastTipUnderMouse;
  11324. void paint (Graphics& g);
  11325. void mouseEnter (const MouseEvent& e);
  11326. void timerCallback();
  11327. static const String getTipFor (Component* c);
  11328. void showFor (const String& tip);
  11329. void hide();
  11330. TooltipWindow (const TooltipWindow&);
  11331. TooltipWindow& operator= (const TooltipWindow&);
  11332. };
  11333. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11334. /*** End of inlined file: juce_TooltipWindow.h ***/
  11335. class Button;
  11336. class JUCE_API ButtonListener
  11337. {
  11338. public:
  11339. virtual ~ButtonListener() {}
  11340. virtual void buttonClicked (Button* button) = 0;
  11341. virtual void buttonStateChanged (Button*) {}
  11342. };
  11343. class JUCE_API Button : public Component,
  11344. public SettableTooltipClient,
  11345. public ApplicationCommandManagerListener,
  11346. public Value::Listener,
  11347. private KeyListener
  11348. {
  11349. protected:
  11350. explicit Button (const String& buttonName);
  11351. public:
  11352. virtual ~Button();
  11353. void setButtonText (const String& newText);
  11354. const String getButtonText() const { return text; }
  11355. bool isDown() const throw();
  11356. bool isOver() const throw();
  11357. void setToggleState (bool shouldBeOn,
  11358. bool sendChangeNotification);
  11359. bool getToggleState() const throw() { return isOn.getValue(); }
  11360. Value& getToggleStateValue() { return isOn; }
  11361. void setClickingTogglesState (bool shouldToggle) throw();
  11362. bool getClickingTogglesState() const throw();
  11363. void setRadioGroupId (int newGroupId);
  11364. int getRadioGroupId() const throw() { return radioGroupId; }
  11365. void addButtonListener (ButtonListener* newListener);
  11366. void removeButtonListener (ButtonListener* listener);
  11367. virtual void triggerClick();
  11368. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11369. int commandID,
  11370. bool generateTooltip);
  11371. int getCommandID() const throw() { return commandID; }
  11372. void addShortcut (const KeyPress& key);
  11373. void clearShortcuts();
  11374. bool isRegisteredForShortcut (const KeyPress& key) const;
  11375. void setRepeatSpeed (int initialDelayInMillisecs,
  11376. int repeatDelayInMillisecs,
  11377. int minimumDelayInMillisecs = -1) throw();
  11378. void setTriggeredOnMouseDown (bool isTriggeredOnMouseDown) throw();
  11379. uint32 getMillisecondsSinceButtonDown() const throw();
  11380. void setVisible (bool shouldBeVisible);
  11381. void setTooltip (const String& newTooltip);
  11382. // (implementation of the TooltipClient method)
  11383. const String getTooltip();
  11384. enum ConnectedEdgeFlags
  11385. {
  11386. ConnectedOnLeft = 1,
  11387. ConnectedOnRight = 2,
  11388. ConnectedOnTop = 4,
  11389. ConnectedOnBottom = 8
  11390. };
  11391. void setConnectedEdges (int connectedEdgeFlags);
  11392. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11393. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11394. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11395. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11396. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11397. enum ButtonState
  11398. {
  11399. buttonNormal,
  11400. buttonOver,
  11401. buttonDown
  11402. };
  11403. void setState (const ButtonState newState);
  11404. juce_UseDebuggingNewOperator
  11405. protected:
  11406. virtual void clicked();
  11407. virtual void clicked (const ModifierKeys& modifiers);
  11408. virtual void paintButton (Graphics& g,
  11409. bool isMouseOverButton,
  11410. bool isButtonDown) = 0;
  11411. virtual void buttonStateChanged();
  11412. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11413. void handleCommandMessage (int commandId);
  11414. void mouseEnter (const MouseEvent& e);
  11415. void mouseExit (const MouseEvent& e);
  11416. void mouseDown (const MouseEvent& e);
  11417. void mouseDrag (const MouseEvent& e);
  11418. void mouseUp (const MouseEvent& e);
  11419. bool keyPressed (const KeyPress& key);
  11420. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11421. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  11422. void paint (Graphics& g);
  11423. void parentHierarchyChanged();
  11424. void focusGained (FocusChangeType cause);
  11425. void focusLost (FocusChangeType cause);
  11426. void enablementChanged();
  11427. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11428. void applicationCommandListChanged();
  11429. void valueChanged (Value& value);
  11430. private:
  11431. Array <KeyPress> shortcuts;
  11432. Component::SafePointer<Component> keySource;
  11433. String text;
  11434. ListenerList <ButtonListener> buttonListeners;
  11435. class RepeatTimer;
  11436. friend class RepeatTimer;
  11437. friend class ScopedPointer <RepeatTimer>;
  11438. ScopedPointer <RepeatTimer> repeatTimer;
  11439. uint32 buttonPressTime, lastTimeCallbackTime;
  11440. ApplicationCommandManager* commandManagerToUse;
  11441. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11442. int radioGroupId, commandID, connectedEdgeFlags;
  11443. ButtonState buttonState;
  11444. Value isOn;
  11445. bool lastToggleState : 1;
  11446. bool clickTogglesState : 1;
  11447. bool needsToRelease : 1;
  11448. bool needsRepainting : 1;
  11449. bool isKeyDown : 1;
  11450. bool triggerOnMouseDown : 1;
  11451. bool generateTooltip : 1;
  11452. void repeatTimerCallback();
  11453. RepeatTimer& getRepeatTimer();
  11454. ButtonState updateState (const MouseEvent* const e);
  11455. bool isShortcutPressed() const;
  11456. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11457. void flashButtonState();
  11458. void sendClickMessage (const ModifierKeys& modifiers);
  11459. void sendStateMessage();
  11460. Button (const Button&);
  11461. Button& operator= (const Button&);
  11462. };
  11463. #endif // __JUCE_BUTTON_JUCEHEADER__
  11464. /*** End of inlined file: juce_Button.h ***/
  11465. class ScrollBar;
  11466. class JUCE_API ScrollBarListener
  11467. {
  11468. public:
  11469. virtual ~ScrollBarListener() {}
  11470. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11471. double newRangeStart) = 0;
  11472. };
  11473. class JUCE_API ScrollBar : public Component,
  11474. public AsyncUpdater,
  11475. private Timer
  11476. {
  11477. public:
  11478. ScrollBar (bool isVertical,
  11479. bool buttonsAreVisible = true);
  11480. ~ScrollBar();
  11481. bool isVertical() const throw() { return vertical; }
  11482. void setOrientation (bool shouldBeVertical);
  11483. void setButtonVisibility (bool buttonsAreVisible);
  11484. void setAutoHide (bool shouldHideWhenFullRange);
  11485. bool autoHides() const throw();
  11486. void setRangeLimits (const Range<double>& newRangeLimit);
  11487. void setRangeLimits (double minimum, double maximum);
  11488. const Range<double> getRangeLimit() const throw() { return totalRange; }
  11489. double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }
  11490. double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }
  11491. void setCurrentRange (const Range<double>& newRange);
  11492. void setCurrentRange (double newStart, double newSize);
  11493. void setCurrentRangeStart (double newStart);
  11494. const Range<double> getCurrentRange() const throw() { return visibleRange; }
  11495. double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }
  11496. double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }
  11497. void setSingleStepSize (double newSingleStepSize);
  11498. void moveScrollbarInSteps (int howManySteps);
  11499. void moveScrollbarInPages (int howManyPages);
  11500. void scrollToTop();
  11501. void scrollToBottom();
  11502. void setButtonRepeatSpeed (int initialDelayInMillisecs,
  11503. int repeatDelayInMillisecs,
  11504. int minimumDelayInMillisecs = -1);
  11505. enum ColourIds
  11506. {
  11507. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11508. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11509. 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. */
  11510. };
  11511. void addListener (ScrollBarListener* listener);
  11512. void removeListener (ScrollBarListener* listener);
  11513. bool keyPressed (const KeyPress& key);
  11514. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11515. void lookAndFeelChanged();
  11516. void handleAsyncUpdate();
  11517. void mouseDown (const MouseEvent& e);
  11518. void mouseDrag (const MouseEvent& e);
  11519. void mouseUp (const MouseEvent& e);
  11520. void paint (Graphics& g);
  11521. void resized();
  11522. juce_UseDebuggingNewOperator
  11523. private:
  11524. Range <double> totalRange, visibleRange;
  11525. double singleStepSize, dragStartRange;
  11526. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11527. int dragStartMousePos, lastMousePos;
  11528. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11529. bool vertical, isDraggingThumb, autohides;
  11530. class ScrollbarButton;
  11531. ScrollbarButton* upButton;
  11532. ScrollbarButton* downButton;
  11533. ListenerList <ScrollBarListener> listeners;
  11534. void updateThumbPosition();
  11535. void timerCallback();
  11536. ScrollBar (const ScrollBar&);
  11537. ScrollBar& operator= (const ScrollBar&);
  11538. };
  11539. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11540. /*** End of inlined file: juce_ScrollBar.h ***/
  11541. class JUCE_API Viewport : public Component,
  11542. private ComponentListener,
  11543. private ScrollBarListener
  11544. {
  11545. public:
  11546. explicit Viewport (const String& componentName = String::empty);
  11547. ~Viewport();
  11548. void setViewedComponent (Component* newViewedComponent);
  11549. Component* getViewedComponent() const throw() { return contentComp; }
  11550. void setViewPosition (int xPixelsOffset, int yPixelsOffset);
  11551. void setViewPositionProportionately (double proportionX, double proportionY);
  11552. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11553. const Point<int> getViewPosition() const throw() { return lastViewPos.getPosition(); }
  11554. int getViewPositionX() const throw() { return lastViewPos.getX(); }
  11555. int getViewPositionY() const throw() { return lastViewPos.getY(); }
  11556. int getViewWidth() const throw() { return lastViewPos.getWidth(); }
  11557. int getViewHeight() const throw() { return lastViewPos.getHeight(); }
  11558. int getMaximumVisibleWidth() const throw();
  11559. int getMaximumVisibleHeight() const throw();
  11560. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11561. int visibleW, int visibleH);
  11562. void setScrollBarsShown (bool showVerticalScrollbarIfNeeded,
  11563. bool showHorizontalScrollbarIfNeeded);
  11564. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11565. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11566. void setScrollBarThickness (int thickness);
  11567. int getScrollBarThickness() const throw();
  11568. void setSingleStepSizes (int stepX, int stepY);
  11569. void setScrollBarButtonVisibility (bool buttonsVisible);
  11570. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11571. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11572. juce_UseDebuggingNewOperator
  11573. void resized();
  11574. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11575. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11576. bool keyPressed (const KeyPress& key);
  11577. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11578. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11579. private:
  11580. Component::SafePointer<Component> contentComp;
  11581. Rectangle<int> lastViewPos;
  11582. int scrollBarThickness;
  11583. int singleStepX, singleStepY;
  11584. bool showHScrollbar, showVScrollbar;
  11585. Component* contentHolder;
  11586. ScrollBar* verticalScrollBar;
  11587. ScrollBar* horizontalScrollBar;
  11588. void updateVisibleRegion();
  11589. Viewport (const Viewport&);
  11590. Viewport& operator= (const Viewport&);
  11591. };
  11592. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11593. /*** End of inlined file: juce_Viewport.h ***/
  11594. /*** Start of inlined file: juce_PopupMenu.h ***/
  11595. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11596. #define __JUCE_POPUPMENU_JUCEHEADER__
  11597. class PopupMenuCustomComponent;
  11598. class JUCE_API PopupMenu
  11599. {
  11600. public:
  11601. PopupMenu();
  11602. PopupMenu (const PopupMenu& other);
  11603. ~PopupMenu();
  11604. PopupMenu& operator= (const PopupMenu& other);
  11605. void clear();
  11606. void addItem (int itemResultId,
  11607. const String& itemText,
  11608. bool isActive = true,
  11609. bool isTicked = false,
  11610. const Image* iconToUse = 0);
  11611. void addCommandItem (ApplicationCommandManager* commandManager,
  11612. int commandID,
  11613. const String& displayName = String::empty);
  11614. void addColouredItem (int itemResultId,
  11615. const String& itemText,
  11616. const Colour& itemTextColour,
  11617. bool isActive = true,
  11618. bool isTicked = false,
  11619. const Image* iconToUse = 0);
  11620. void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent);
  11621. void addCustomItem (int itemResultId,
  11622. Component* customComponent,
  11623. int idealWidth, int idealHeight,
  11624. bool triggerMenuItemAutomaticallyWhenClicked);
  11625. void addSubMenu (const String& subMenuName,
  11626. const PopupMenu& subMenu,
  11627. bool isActive = true,
  11628. Image* iconToUse = 0,
  11629. bool isTicked = false);
  11630. void addSeparator();
  11631. void addSectionHeader (const String& title);
  11632. int getNumItems() const throw();
  11633. bool containsCommandItem (int commandID) const;
  11634. bool containsAnyActiveItems() const throw();
  11635. int show (int itemIdThatMustBeVisible = 0,
  11636. int minimumWidth = 0,
  11637. int maximumNumColumns = 0,
  11638. int standardItemHeight = 0);
  11639. int showAt (int screenX,
  11640. int screenY,
  11641. int itemIdThatMustBeVisible = 0,
  11642. int minimumWidth = 0,
  11643. int maximumNumColumns = 0,
  11644. int standardItemHeight = 0);
  11645. int showAt (Component* componentToAttachTo,
  11646. int itemIdThatMustBeVisible = 0,
  11647. int minimumWidth = 0,
  11648. int maximumNumColumns = 0,
  11649. int standardItemHeight = 0);
  11650. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11651. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  11652. enum ColourIds
  11653. {
  11654. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11655. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11656. colour is specified when the item is added). */
  11657. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11658. addSectionHeader() method). */
  11659. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11660. highlighted menu item. */
  11661. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11662. highlighted item. */
  11663. };
  11664. class JUCE_API MenuItemIterator
  11665. {
  11666. public:
  11667. MenuItemIterator (const PopupMenu& menu);
  11668. ~MenuItemIterator();
  11669. bool next();
  11670. String itemName;
  11671. const PopupMenu* subMenu;
  11672. int itemId;
  11673. bool isSeparator;
  11674. bool isTicked;
  11675. bool isEnabled;
  11676. bool isCustomComponent;
  11677. bool isSectionHeader;
  11678. const Colour* customColour;
  11679. const Image* customImage;
  11680. ApplicationCommandManager* commandManager;
  11681. juce_UseDebuggingNewOperator
  11682. private:
  11683. const PopupMenu& menu;
  11684. int index;
  11685. MenuItemIterator (const MenuItemIterator&);
  11686. MenuItemIterator& operator= (const MenuItemIterator&);
  11687. };
  11688. juce_UseDebuggingNewOperator
  11689. private:
  11690. class Item;
  11691. class ItemComponent;
  11692. class Window;
  11693. friend class MenuItemIterator;
  11694. friend class ItemComponent;
  11695. friend class Window;
  11696. friend class PopupMenuCustomComponent;
  11697. friend class OwnedArray <Item>;
  11698. friend class ScopedPointer <Window>;
  11699. OwnedArray <Item> items;
  11700. LookAndFeel* lookAndFeel;
  11701. bool separatorPending;
  11702. void addSeparatorIfPending();
  11703. int showMenu (int x, int y, int w, int h,
  11704. int itemIdThatMustBeVisible,
  11705. int minimumWidth,
  11706. int maximumNumColumns,
  11707. int standardItemHeight,
  11708. bool alignToRectangle,
  11709. Component* componentAttachedTo);
  11710. friend class MenuBarComponent;
  11711. Component* createMenuComponent (int x, int y, int w, int h,
  11712. int itemIdThatMustBeVisible,
  11713. int minimumWidth,
  11714. int maximumNumColumns,
  11715. int standardItemHeight,
  11716. bool alignToRectangle,
  11717. Component* menuBarComponent,
  11718. ApplicationCommandManager** managerOfChosenCommand,
  11719. Component* componentAttachedTo);
  11720. };
  11721. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11722. /*** End of inlined file: juce_PopupMenu.h ***/
  11723. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11724. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11725. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11726. class JUCE_API TextInputTarget
  11727. {
  11728. public:
  11729. TextInputTarget() {}
  11730. virtual ~TextInputTarget() {}
  11731. virtual bool isTextInputActive() const = 0;
  11732. virtual const Range<int> getHighlightedRegion() const = 0;
  11733. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11734. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11735. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11736. };
  11737. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11738. /*** End of inlined file: juce_TextInputTarget.h ***/
  11739. class TextEditor;
  11740. class JUCE_API TextEditorListener
  11741. {
  11742. public:
  11743. virtual ~TextEditorListener() {}
  11744. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11745. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11746. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11747. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11748. };
  11749. class JUCE_API TextEditor : public Component,
  11750. public TextInputTarget,
  11751. public SettableTooltipClient
  11752. {
  11753. public:
  11754. explicit TextEditor (const String& componentName = String::empty,
  11755. juce_wchar passwordCharacter = 0);
  11756. virtual ~TextEditor();
  11757. void setMultiLine (bool shouldBeMultiLine,
  11758. bool shouldWordWrap = true);
  11759. bool isMultiLine() const;
  11760. void setReturnKeyStartsNewLine (bool shouldStartNewLine);
  11761. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11762. void setTabKeyUsedAsCharacter (bool shouldTabKeyBeUsed);
  11763. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11764. void setReadOnly (bool shouldBeReadOnly);
  11765. bool isReadOnly() const;
  11766. void setCaretVisible (bool shouldBeVisible);
  11767. bool isCaretVisible() const { return caretVisible; }
  11768. void setScrollbarsShown (bool shouldBeEnabled);
  11769. bool areScrollbarsShown() const { return scrollbarVisible; }
  11770. void setPasswordCharacter (juce_wchar passwordCharacter);
  11771. juce_wchar getPasswordCharacter() const { return passwordCharacter; }
  11772. void setPopupMenuEnabled (bool menuEnabled);
  11773. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11774. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11775. enum ColourIds
  11776. {
  11777. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11778. transparent if necessary. */
  11779. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11780. that because the editor can contain multiple colours, calling this
  11781. method won't change the colour of existing text - to do that, call
  11782. applyFontToAllText() after calling this method.*/
  11783. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11784. the text - this can be transparent if you don't want to show any
  11785. highlighting.*/
  11786. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11787. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11788. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11789. the edge of the component. */
  11790. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11791. the edge of the component when it has focus. */
  11792. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11793. around the edge of the editor. */
  11794. };
  11795. void setFont (const Font& newFont);
  11796. void applyFontToAllText (const Font& newFont);
  11797. const Font getFont() const;
  11798. void setSelectAllWhenFocused (bool b);
  11799. void setInputRestrictions (int maxTextLength,
  11800. const String& allowedCharacters = String::empty);
  11801. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11802. void setScrollBarThickness (int newThicknessPixels);
  11803. void setScrollBarButtonVisibility (bool buttonsVisible);
  11804. void addListener (TextEditorListener* newListener);
  11805. void removeListener (TextEditorListener* listenerToRemove);
  11806. const String getText() const;
  11807. const String getTextInRange (const Range<int>& textRange) const;
  11808. bool isEmpty() const;
  11809. void setText (const String& newText,
  11810. bool sendTextChangeMessage = true);
  11811. Value& getTextValue();
  11812. void insertTextAtCaret (const String& textToInsert);
  11813. void clear();
  11814. void cut();
  11815. void copy();
  11816. void paste();
  11817. void setCaretPosition (int newIndex);
  11818. int getCaretPosition() const;
  11819. void scrollEditorToPositionCaret (int desiredCaretX, int desiredCaretY);
  11820. const Rectangle<int> getCaretRectangle();
  11821. void setHighlightedRegion (const Range<int>& newSelection);
  11822. const Range<int> getHighlightedRegion() const { return selection; }
  11823. const String getHighlightedText() const;
  11824. int getTextIndexAt (int x, int y);
  11825. int getTotalNumChars() const;
  11826. int getTextWidth() const;
  11827. int getTextHeight() const;
  11828. void setIndents (int newLeftIndent, int newTopIndent);
  11829. void setBorder (const BorderSize& border);
  11830. const BorderSize getBorder() const;
  11831. void setScrollToShowCursor (bool shouldScrollToShowCursor);
  11832. void paint (Graphics& g);
  11833. void paintOverChildren (Graphics& g);
  11834. void mouseDown (const MouseEvent& e);
  11835. void mouseUp (const MouseEvent& e);
  11836. void mouseDrag (const MouseEvent& e);
  11837. void mouseDoubleClick (const MouseEvent& e);
  11838. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11839. bool keyPressed (const KeyPress& key);
  11840. bool keyStateChanged (bool isKeyDown);
  11841. void focusGained (FocusChangeType cause);
  11842. void focusLost (FocusChangeType cause);
  11843. void resized();
  11844. void enablementChanged();
  11845. void colourChanged();
  11846. bool isTextInputActive() const;
  11847. juce_UseDebuggingNewOperator
  11848. protected:
  11849. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11850. const MouseEvent* mouseClickEvent);
  11851. virtual void performPopupMenuAction (int menuItemID);
  11852. void scrollToMakeSureCursorIsVisible();
  11853. void moveCaret (int newCaretPos);
  11854. void moveCursorTo (int newPosition, bool isSelecting);
  11855. void textChanged();
  11856. void newTransaction();
  11857. void doUndoRedo (bool isRedo);
  11858. virtual void returnPressed();
  11859. virtual void escapePressed();
  11860. void handleCommandMessage (int commandId);
  11861. private:
  11862. class Iterator;
  11863. class UniformTextSection;
  11864. class TextHolderComponent;
  11865. class InsertAction;
  11866. class RemoveAction;
  11867. friend class InsertAction;
  11868. friend class RemoveAction;
  11869. ScopedPointer <Viewport> viewport;
  11870. TextHolderComponent* textHolder;
  11871. BorderSize borderSize;
  11872. bool readOnly : 1;
  11873. bool multiline : 1;
  11874. bool wordWrap : 1;
  11875. bool returnKeyStartsNewLine : 1;
  11876. bool caretVisible : 1;
  11877. bool popupMenuEnabled : 1;
  11878. bool selectAllTextWhenFocused : 1;
  11879. bool scrollbarVisible : 1;
  11880. bool wasFocused : 1;
  11881. bool caretFlashState : 1;
  11882. bool keepCursorOnScreen : 1;
  11883. bool tabKeyUsed : 1;
  11884. bool menuActive : 1;
  11885. bool valueTextNeedsUpdating : 1;
  11886. UndoManager undoManager;
  11887. float cursorX, cursorY, cursorHeight;
  11888. int maxTextLength;
  11889. Range<int> selection;
  11890. int leftIndent, topIndent;
  11891. unsigned int lastTransactionTime;
  11892. Font currentFont;
  11893. mutable int totalNumChars;
  11894. int caretPosition;
  11895. Array <UniformTextSection*> sections;
  11896. String textToShowWhenEmpty;
  11897. Colour colourForTextWhenEmpty;
  11898. juce_wchar passwordCharacter;
  11899. Value textValue;
  11900. enum
  11901. {
  11902. notDragging,
  11903. draggingSelectionStart,
  11904. draggingSelectionEnd
  11905. } dragType;
  11906. String allowedCharacters;
  11907. ListenerList <TextEditorListener> listeners;
  11908. void coalesceSimilarSections();
  11909. void splitSection (int sectionIndex, int charToSplitAt);
  11910. void clearInternal (UndoManager* um);
  11911. void insert (const String& text, int insertIndex, const Font& font,
  11912. const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
  11913. void reinsert (int insertIndex, const Array <UniformTextSection*>& sections);
  11914. void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
  11915. void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
  11916. void updateCaretPosition();
  11917. void textWasChangedByValue();
  11918. int indexAtPosition (float x, float y);
  11919. int findWordBreakAfter (int position) const;
  11920. int findWordBreakBefore (int position) const;
  11921. friend class TextHolderComponent;
  11922. friend class TextEditorViewport;
  11923. void drawContent (Graphics& g);
  11924. void updateTextHolderSize();
  11925. float getWordWrapWidth() const;
  11926. void timerCallbackInt();
  11927. void repaintCaret();
  11928. void repaintText (const Range<int>& range);
  11929. UndoManager* getUndoManager() throw();
  11930. TextEditor (const TextEditor&);
  11931. TextEditor& operator= (const TextEditor&);
  11932. };
  11933. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11934. /*** End of inlined file: juce_TextEditor.h ***/
  11935. class Label;
  11936. class JUCE_API LabelListener
  11937. {
  11938. public:
  11939. virtual ~LabelListener() {}
  11940. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11941. };
  11942. class JUCE_API Label : public Component,
  11943. public SettableTooltipClient,
  11944. protected TextEditorListener,
  11945. private ComponentListener,
  11946. private Value::Listener
  11947. {
  11948. public:
  11949. Label (const String& componentName,
  11950. const String& labelText);
  11951. ~Label();
  11952. void setText (const String& newText,
  11953. bool broadcastChangeMessage);
  11954. const String getText (bool returnActiveEditorContents = false) const throw();
  11955. Value& getTextValue() { return textValue; }
  11956. void setFont (const Font& newFont) throw();
  11957. const Font& getFont() const throw();
  11958. enum ColourIds
  11959. {
  11960. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11961. textColourId = 0x1000281, /**< The colour for the text. */
  11962. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11963. Leave this transparent to not have an outline. */
  11964. };
  11965. void setJustificationType (const Justification& justification) throw();
  11966. const Justification getJustificationType() const throw() { return justification; }
  11967. void setBorderSize (int horizontalBorder, int verticalBorder);
  11968. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11969. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11970. void attachToComponent (Component* owner, bool onLeft);
  11971. Component* getAttachedComponent() const;
  11972. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11973. void setMinimumHorizontalScale (float newScale);
  11974. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11975. void addListener (LabelListener* listener) throw();
  11976. void removeListener (LabelListener* listener) throw();
  11977. void setEditable (bool editOnSingleClick,
  11978. bool editOnDoubleClick = false,
  11979. bool lossOfFocusDiscardsChanges = false) throw();
  11980. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11981. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11982. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11983. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11984. void showEditor();
  11985. void hideEditor (bool discardCurrentEditorContents);
  11986. bool isBeingEdited() const throw();
  11987. juce_UseDebuggingNewOperator
  11988. protected:
  11989. virtual TextEditor* createEditorComponent();
  11990. virtual void textWasEdited();
  11991. virtual void textWasChanged();
  11992. virtual void editorShown (TextEditor* editorComponent);
  11993. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11994. void paint (Graphics& g);
  11995. void resized();
  11996. void mouseUp (const MouseEvent& e);
  11997. void mouseDoubleClick (const MouseEvent& e);
  11998. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11999. void componentParentHierarchyChanged (Component& component);
  12000. void componentVisibilityChanged (Component& component);
  12001. void inputAttemptWhenModal();
  12002. void focusGained (FocusChangeType);
  12003. void enablementChanged();
  12004. KeyboardFocusTraverser* createFocusTraverser();
  12005. void textEditorTextChanged (TextEditor& editor);
  12006. void textEditorReturnKeyPressed (TextEditor& editor);
  12007. void textEditorEscapeKeyPressed (TextEditor& editor);
  12008. void textEditorFocusLost (TextEditor& editor);
  12009. void colourChanged();
  12010. void valueChanged (Value&);
  12011. private:
  12012. Value textValue;
  12013. String lastTextValue;
  12014. Font font;
  12015. Justification justification;
  12016. ScopedPointer <TextEditor> editor;
  12017. ListenerList <LabelListener> listeners;
  12018. Component::SafePointer<Component> ownerComponent;
  12019. int horizontalBorderSize, verticalBorderSize;
  12020. float minimumHorizontalScale;
  12021. bool editSingleClick : 1;
  12022. bool editDoubleClick : 1;
  12023. bool lossOfFocusDiscardsChanges : 1;
  12024. bool leftOfOwnerComp : 1;
  12025. bool updateFromTextEditorContents();
  12026. void callChangeListeners();
  12027. Label (const Label&);
  12028. Label& operator= (const Label&);
  12029. };
  12030. #endif // __JUCE_LABEL_JUCEHEADER__
  12031. /*** End of inlined file: juce_Label.h ***/
  12032. class ComboBox;
  12033. class JUCE_API ComboBoxListener
  12034. {
  12035. public:
  12036. virtual ~ComboBoxListener() {}
  12037. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  12038. };
  12039. class JUCE_API ComboBox : public Component,
  12040. public SettableTooltipClient,
  12041. private LabelListener,
  12042. private AsyncUpdater,
  12043. private Value::Listener
  12044. {
  12045. public:
  12046. explicit ComboBox (const String& componentName);
  12047. ~ComboBox();
  12048. void setEditableText (bool isEditable);
  12049. bool isTextEditable() const throw();
  12050. void setJustificationType (const Justification& justification) throw();
  12051. const Justification getJustificationType() const throw();
  12052. void addItem (const String& newItemText,
  12053. int newItemId) throw();
  12054. void addSeparator() throw();
  12055. void addSectionHeading (const String& headingName) throw();
  12056. void setItemEnabled (int itemId,
  12057. bool shouldBeEnabled) throw();
  12058. void changeItemText (int itemId,
  12059. const String& newText) throw();
  12060. void clear (bool dontSendChangeMessage = false);
  12061. int getNumItems() const throw();
  12062. const String getItemText (int index) const throw();
  12063. int getItemId (int index) const throw();
  12064. int indexOfItemId (int itemId) const throw();
  12065. int getSelectedId() const throw();
  12066. Value& getSelectedIdAsValue() throw() { return currentId; }
  12067. void setSelectedId (int newItemId,
  12068. bool dontSendChangeMessage = false) throw();
  12069. int getSelectedItemIndex() const throw();
  12070. void setSelectedItemIndex (int newItemIndex,
  12071. bool dontSendChangeMessage = false) throw();
  12072. const String getText() const throw();
  12073. void setText (const String& newText,
  12074. bool dontSendChangeMessage = false) throw();
  12075. void showEditor();
  12076. void addListener (ComboBoxListener* listener) throw();
  12077. void removeListener (ComboBoxListener* listener) throw();
  12078. void setTextWhenNothingSelected (const String& newMessage) throw();
  12079. const String getTextWhenNothingSelected() const throw();
  12080. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  12081. const String getTextWhenNoChoicesAvailable() const throw();
  12082. void setTooltip (const String& newTooltip);
  12083. enum ColourIds
  12084. {
  12085. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  12086. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  12087. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  12088. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  12089. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  12090. };
  12091. void labelTextChanged (Label*);
  12092. void enablementChanged();
  12093. void colourChanged();
  12094. void focusGained (Component::FocusChangeType cause);
  12095. void focusLost (Component::FocusChangeType cause);
  12096. void handleAsyncUpdate();
  12097. const String getTooltip() { return label->getTooltip(); }
  12098. void mouseDown (const MouseEvent&);
  12099. void mouseDrag (const MouseEvent&);
  12100. void mouseUp (const MouseEvent&);
  12101. void lookAndFeelChanged();
  12102. void paint (Graphics&);
  12103. void resized();
  12104. bool keyStateChanged (bool isKeyDown);
  12105. bool keyPressed (const KeyPress&);
  12106. void valueChanged (Value&);
  12107. juce_UseDebuggingNewOperator
  12108. private:
  12109. struct ItemInfo
  12110. {
  12111. String name;
  12112. int itemId;
  12113. bool isEnabled : 1, isHeading : 1;
  12114. bool isSeparator() const throw();
  12115. bool isRealItem() const throw();
  12116. };
  12117. OwnedArray <ItemInfo> items;
  12118. Value currentId;
  12119. int lastCurrentId;
  12120. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  12121. ListenerList <ComboBoxListener> listeners;
  12122. ScopedPointer<Label> label;
  12123. String textWhenNothingSelected, noChoicesMessage;
  12124. void showPopup();
  12125. ItemInfo* getItemForId (int itemId) const throw();
  12126. ItemInfo* getItemForIndex (int index) const throw();
  12127. ComboBox (const ComboBox&);
  12128. ComboBox& operator= (const ComboBox&);
  12129. };
  12130. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  12131. /*** End of inlined file: juce_ComboBox.h ***/
  12132. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  12133. {
  12134. public:
  12135. AudioDeviceManager();
  12136. ~AudioDeviceManager();
  12137. struct JUCE_API AudioDeviceSetup
  12138. {
  12139. AudioDeviceSetup();
  12140. bool operator== (const AudioDeviceSetup& other) const;
  12141. String outputDeviceName;
  12142. String inputDeviceName;
  12143. double sampleRate;
  12144. int bufferSize;
  12145. BigInteger inputChannels;
  12146. bool useDefaultInputChannels;
  12147. BigInteger outputChannels;
  12148. bool useDefaultOutputChannels;
  12149. };
  12150. const String initialise (int numInputChannelsNeeded,
  12151. int numOutputChannelsNeeded,
  12152. const XmlElement* savedState,
  12153. bool selectDefaultDeviceOnFailure,
  12154. const String& preferredDefaultDeviceName = String::empty,
  12155. const AudioDeviceSetup* preferredSetupOptions = 0);
  12156. XmlElement* createStateXml() const;
  12157. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  12158. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  12159. bool treatAsChosenDevice);
  12160. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  12161. const String getCurrentAudioDeviceType() const { return currentDeviceType; }
  12162. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  12163. void setCurrentAudioDeviceType (const String& type,
  12164. bool treatAsChosenDevice);
  12165. void closeAudioDevice();
  12166. void restartLastAudioDevice();
  12167. void addAudioCallback (AudioIODeviceCallback* newCallback);
  12168. void removeAudioCallback (AudioIODeviceCallback* callback);
  12169. double getCpuUsage() const;
  12170. void setMidiInputEnabled (const String& midiInputDeviceName,
  12171. bool enabled);
  12172. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  12173. void addMidiInputCallback (const String& midiInputDeviceName,
  12174. MidiInputCallback* callback);
  12175. void removeMidiInputCallback (const String& midiInputDeviceName,
  12176. MidiInputCallback* callback);
  12177. void setDefaultMidiOutput (const String& deviceName);
  12178. const String getDefaultMidiOutputName() const { return defaultMidiOutputName; }
  12179. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  12180. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  12181. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  12182. void playTestSound();
  12183. void enableInputLevelMeasurement (bool enableMeasurement);
  12184. double getCurrentInputLevel() const;
  12185. juce_UseDebuggingNewOperator
  12186. private:
  12187. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  12188. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  12189. AudioDeviceSetup currentSetup;
  12190. ScopedPointer <AudioIODevice> currentAudioDevice;
  12191. SortedSet <AudioIODeviceCallback*> callbacks;
  12192. int numInputChansNeeded, numOutputChansNeeded;
  12193. String currentDeviceType;
  12194. BigInteger inputChannels, outputChannels;
  12195. ScopedPointer <XmlElement> lastExplicitSettings;
  12196. mutable bool listNeedsScanning;
  12197. bool useInputNames;
  12198. int inputLevelMeasurementEnabledCount;
  12199. double inputLevel;
  12200. ScopedPointer <AudioSampleBuffer> testSound;
  12201. int testSoundPosition;
  12202. AudioSampleBuffer tempBuffer;
  12203. StringArray midiInsFromXml;
  12204. OwnedArray <MidiInput> enabledMidiInputs;
  12205. Array <MidiInputCallback*> midiCallbacks;
  12206. Array <MidiInput*> midiCallbackDevices;
  12207. String defaultMidiOutputName;
  12208. ScopedPointer <MidiOutput> defaultMidiOutput;
  12209. CriticalSection audioCallbackLock, midiCallbackLock;
  12210. double cpuUsageMs, timeToCpuScale;
  12211. class CallbackHandler : public AudioIODeviceCallback,
  12212. public MidiInputCallback
  12213. {
  12214. public:
  12215. AudioDeviceManager* owner;
  12216. void audioDeviceIOCallback (const float** inputChannelData,
  12217. int totalNumInputChannels,
  12218. float** outputChannelData,
  12219. int totalNumOutputChannels,
  12220. int numSamples);
  12221. void audioDeviceAboutToStart (AudioIODevice*);
  12222. void audioDeviceStopped();
  12223. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12224. };
  12225. CallbackHandler callbackHandler;
  12226. friend class CallbackHandler;
  12227. void audioDeviceIOCallbackInt (const float** inputChannelData,
  12228. int totalNumInputChannels,
  12229. float** outputChannelData,
  12230. int totalNumOutputChannels,
  12231. int numSamples);
  12232. void audioDeviceAboutToStartInt (AudioIODevice* device);
  12233. void audioDeviceStoppedInt();
  12234. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  12235. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  12236. const BigInteger& ins, const BigInteger& outs);
  12237. void stopDevice();
  12238. void updateXml();
  12239. void createDeviceTypesIfNeeded();
  12240. void scanDevicesIfNeeded();
  12241. void deleteCurrentDevice();
  12242. double chooseBestSampleRate (double preferred) const;
  12243. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  12244. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  12245. AudioDeviceManager (const AudioDeviceManager&);
  12246. AudioDeviceManager& operator= (const AudioDeviceManager&);
  12247. };
  12248. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  12249. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  12250. #endif
  12251. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  12252. #endif
  12253. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  12254. #endif
  12255. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  12256. #endif
  12257. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  12258. #endif
  12259. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12260. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  12261. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12262. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12263. class JUCE_API AudioDataConverters
  12264. {
  12265. public:
  12266. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  12267. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  12268. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  12269. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  12270. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12271. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12272. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12273. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12274. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  12275. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  12276. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  12277. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  12278. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12279. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12280. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12281. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12282. enum DataFormat
  12283. {
  12284. int16LE,
  12285. int16BE,
  12286. int24LE,
  12287. int24BE,
  12288. int32LE,
  12289. int32BE,
  12290. float32LE,
  12291. float32BE,
  12292. };
  12293. static void convertFloatToFormat (DataFormat destFormat,
  12294. const float* source, void* dest, int numSamples);
  12295. static void convertFormatToFloat (DataFormat sourceFormat,
  12296. const void* source, float* dest, int numSamples);
  12297. static void interleaveSamples (const float** source, float* dest,
  12298. int numSamples, int numChannels);
  12299. static void deinterleaveSamples (const float* source, float** dest,
  12300. int numSamples, int numChannels);
  12301. private:
  12302. AudioDataConverters();
  12303. AudioDataConverters (const AudioDataConverters&);
  12304. AudioDataConverters& operator= (const AudioDataConverters&);
  12305. };
  12306. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12307. /*** End of inlined file: juce_AudioDataConverters.h ***/
  12308. #endif
  12309. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  12310. #endif
  12311. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  12312. #endif
  12313. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  12314. #endif
  12315. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12316. /*** Start of inlined file: juce_MidiFile.h ***/
  12317. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12318. #define __JUCE_MIDIFILE_JUCEHEADER__
  12319. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  12320. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12321. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12322. class JUCE_API MidiMessageSequence
  12323. {
  12324. public:
  12325. MidiMessageSequence();
  12326. MidiMessageSequence (const MidiMessageSequence& other);
  12327. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  12328. ~MidiMessageSequence();
  12329. class MidiEventHolder
  12330. {
  12331. public:
  12332. ~MidiEventHolder();
  12333. MidiMessage message;
  12334. MidiEventHolder* noteOffObject;
  12335. juce_UseDebuggingNewOperator
  12336. private:
  12337. friend class MidiMessageSequence;
  12338. MidiEventHolder (const MidiMessage& message);
  12339. };
  12340. void clear();
  12341. int getNumEvents() const;
  12342. MidiEventHolder* getEventPointer (int index) const;
  12343. double getTimeOfMatchingKeyUp (int index) const;
  12344. int getIndexOfMatchingKeyUp (int index) const;
  12345. int getIndexOf (MidiEventHolder* event) const;
  12346. int getNextIndexAtTime (double timeStamp) const;
  12347. double getStartTime() const;
  12348. double getEndTime() const;
  12349. double getEventTime (int index) const;
  12350. void addEvent (const MidiMessage& newMessage,
  12351. double timeAdjustment = 0);
  12352. void deleteEvent (int index, bool deleteMatchingNoteUp);
  12353. void addSequence (const MidiMessageSequence& other,
  12354. double timeAdjustmentDelta,
  12355. double firstAllowableDestTime,
  12356. double endOfAllowableDestTimes);
  12357. void updateMatchedPairs();
  12358. void extractMidiChannelMessages (int channelNumberToExtract,
  12359. MidiMessageSequence& destSequence,
  12360. bool alsoIncludeMetaEvents) const;
  12361. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12362. void deleteMidiChannelMessages (int channelNumberToRemove);
  12363. void deleteSysExMessages();
  12364. void addTimeToMessages (double deltaTime);
  12365. void createControllerUpdatesForTime (int channelNumber, double time,
  12366. OwnedArray<MidiMessage>& resultMessages);
  12367. void swapWith (MidiMessageSequence& other) throw();
  12368. juce_UseDebuggingNewOperator
  12369. static int compareElements (const MidiMessageSequence::MidiEventHolder* first,
  12370. const MidiMessageSequence::MidiEventHolder* second) throw();
  12371. private:
  12372. friend class MidiFile;
  12373. OwnedArray <MidiEventHolder> list;
  12374. void sort();
  12375. };
  12376. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12377. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12378. class JUCE_API MidiFile
  12379. {
  12380. public:
  12381. MidiFile();
  12382. ~MidiFile();
  12383. int getNumTracks() const throw();
  12384. const MidiMessageSequence* getTrack (const int index) const throw();
  12385. void addTrack (const MidiMessageSequence& trackSequence);
  12386. void clear();
  12387. short getTimeFormat() const throw();
  12388. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12389. void setSmpteTimeFormat (const int framesPerSecond,
  12390. const int subframeResolution) throw();
  12391. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12392. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12393. double getLastTimestamp() const;
  12394. bool readFrom (InputStream& sourceStream);
  12395. bool writeTo (OutputStream& destStream);
  12396. void convertTimestampTicksToSeconds();
  12397. juce_UseDebuggingNewOperator
  12398. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12399. const MidiMessageSequence::MidiEventHolder* const second);
  12400. private:
  12401. OwnedArray <MidiMessageSequence> tracks;
  12402. short timeFormat;
  12403. MidiFile (const MidiFile&);
  12404. MidiFile& operator= (const MidiFile&);
  12405. void readNextTrack (const uint8* data, int size);
  12406. void writeTrack (OutputStream& mainOut, const int trackNum);
  12407. };
  12408. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12409. /*** End of inlined file: juce_MidiFile.h ***/
  12410. #endif
  12411. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12412. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12413. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12414. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12415. class MidiKeyboardState;
  12416. class JUCE_API MidiKeyboardStateListener
  12417. {
  12418. public:
  12419. MidiKeyboardStateListener() throw() {}
  12420. virtual ~MidiKeyboardStateListener() {}
  12421. virtual void handleNoteOn (MidiKeyboardState* source,
  12422. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12423. virtual void handleNoteOff (MidiKeyboardState* source,
  12424. int midiChannel, int midiNoteNumber) = 0;
  12425. };
  12426. class JUCE_API MidiKeyboardState
  12427. {
  12428. public:
  12429. MidiKeyboardState();
  12430. ~MidiKeyboardState();
  12431. void reset();
  12432. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12433. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12434. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12435. void noteOff (const int midiChannel, const int midiNoteNumber);
  12436. void allNotesOff (const int midiChannel);
  12437. void processNextMidiEvent (const MidiMessage& message);
  12438. void processNextMidiBuffer (MidiBuffer& buffer,
  12439. const int startSample,
  12440. const int numSamples,
  12441. const bool injectIndirectEvents);
  12442. void addListener (MidiKeyboardStateListener* const listener) throw();
  12443. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12444. juce_UseDebuggingNewOperator
  12445. private:
  12446. CriticalSection lock;
  12447. uint16 noteStates [128];
  12448. MidiBuffer eventsToAdd;
  12449. Array <MidiKeyboardStateListener*> listeners;
  12450. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12451. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12452. MidiKeyboardState (const MidiKeyboardState&);
  12453. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12454. };
  12455. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12456. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12457. #endif
  12458. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12459. #endif
  12460. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12461. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12462. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12463. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12464. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12465. public MidiInputCallback
  12466. {
  12467. public:
  12468. MidiMessageCollector();
  12469. ~MidiMessageCollector();
  12470. void reset (double sampleRate);
  12471. void addMessageToQueue (const MidiMessage& message);
  12472. void removeNextBlockOfMessages (MidiBuffer& destBuffer, int numSamples);
  12473. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12474. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12475. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12476. juce_UseDebuggingNewOperator
  12477. private:
  12478. double lastCallbackTime;
  12479. CriticalSection midiCallbackLock;
  12480. MidiBuffer incomingMessages;
  12481. double sampleRate;
  12482. MidiMessageCollector (const MidiMessageCollector&);
  12483. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12484. };
  12485. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12486. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12487. #endif
  12488. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12489. #endif
  12490. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12491. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12492. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12493. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12494. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12495. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12496. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12497. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12498. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12499. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12500. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12501. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12502. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12503. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12504. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12505. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12506. class AudioProcessor;
  12507. class JUCE_API AudioProcessorEditor : public Component
  12508. {
  12509. protected:
  12510. AudioProcessorEditor (AudioProcessor* const owner);
  12511. public:
  12512. ~AudioProcessorEditor();
  12513. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12514. private:
  12515. AudioProcessor* const owner;
  12516. AudioProcessorEditor (const AudioProcessorEditor&);
  12517. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12518. };
  12519. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12520. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12521. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12522. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12523. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12524. class AudioProcessor;
  12525. class JUCE_API AudioProcessorListener
  12526. {
  12527. public:
  12528. virtual ~AudioProcessorListener() {}
  12529. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12530. int parameterIndex,
  12531. float newValue) = 0;
  12532. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12533. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12534. int parameterIndex);
  12535. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12536. int parameterIndex);
  12537. };
  12538. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12539. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12540. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12541. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12542. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12543. class JUCE_API AudioPlayHead
  12544. {
  12545. protected:
  12546. AudioPlayHead() {}
  12547. public:
  12548. virtual ~AudioPlayHead() {}
  12549. enum FrameRateType
  12550. {
  12551. fps24 = 0,
  12552. fps25 = 1,
  12553. fps2997 = 2,
  12554. fps30 = 3,
  12555. fps2997drop = 4,
  12556. fps30drop = 5,
  12557. fpsUnknown = 99
  12558. };
  12559. struct CurrentPositionInfo
  12560. {
  12561. double bpm;
  12562. int timeSigNumerator;
  12563. int timeSigDenominator;
  12564. double timeInSeconds;
  12565. double editOriginTime;
  12566. double ppqPosition;
  12567. double ppqPositionOfLastBarStart;
  12568. FrameRateType frameRate;
  12569. bool isPlaying;
  12570. bool isRecording;
  12571. bool operator== (const CurrentPositionInfo& other) const throw();
  12572. bool operator!= (const CurrentPositionInfo& other) const throw();
  12573. void resetToDefault();
  12574. };
  12575. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12576. };
  12577. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12578. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12579. class JUCE_API AudioProcessor
  12580. {
  12581. protected:
  12582. AudioProcessor();
  12583. public:
  12584. virtual ~AudioProcessor();
  12585. virtual const String getName() const = 0;
  12586. virtual void prepareToPlay (double sampleRate,
  12587. int estimatedSamplesPerBlock) = 0;
  12588. virtual void releaseResources() = 0;
  12589. virtual void processBlock (AudioSampleBuffer& buffer,
  12590. MidiBuffer& midiMessages) = 0;
  12591. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12592. double getSampleRate() const throw() { return sampleRate; }
  12593. int getBlockSize() const throw() { return blockSize; }
  12594. int getNumInputChannels() const throw() { return numInputChannels; }
  12595. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12596. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12597. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12598. virtual bool isInputChannelStereoPair (int index) const = 0;
  12599. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12600. int getLatencySamples() const throw() { return latencySamples; }
  12601. void setLatencySamples (const int newLatency);
  12602. virtual bool acceptsMidi() const = 0;
  12603. virtual bool producesMidi() const = 0;
  12604. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12605. void suspendProcessing (const bool shouldBeSuspended);
  12606. bool isSuspended() const throw() { return suspended; }
  12607. virtual void reset();
  12608. bool isNonRealtime() const throw() { return nonRealtime; }
  12609. void setNonRealtime (const bool isNonRealtime) throw();
  12610. virtual AudioProcessorEditor* createEditor() = 0;
  12611. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12612. AudioProcessorEditor* createEditorIfNeeded();
  12613. virtual int getNumParameters() = 0;
  12614. virtual const String getParameterName (int parameterIndex) = 0;
  12615. virtual float getParameter (int parameterIndex) = 0;
  12616. virtual const String getParameterText (int parameterIndex) = 0;
  12617. virtual void setParameter (int parameterIndex,
  12618. float newValue) = 0;
  12619. void setParameterNotifyingHost (int parameterIndex,
  12620. float newValue);
  12621. virtual bool isParameterAutomatable (int parameterIndex) const;
  12622. virtual bool isMetaParameter (int parameterIndex) const;
  12623. void beginParameterChangeGesture (int parameterIndex);
  12624. void endParameterChangeGesture (int parameterIndex);
  12625. void updateHostDisplay();
  12626. virtual int getNumPrograms() = 0;
  12627. virtual int getCurrentProgram() = 0;
  12628. virtual void setCurrentProgram (int index) = 0;
  12629. virtual const String getProgramName (int index) = 0;
  12630. virtual void changeProgramName (int index, const String& newName) = 0;
  12631. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12632. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12633. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12634. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12635. void addListener (AudioProcessorListener* const newListener) throw();
  12636. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12637. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12638. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12639. void setPlayConfigDetails (const int numIns, const int numOuts,
  12640. const double sampleRate,
  12641. const int blockSize) throw();
  12642. juce_UseDebuggingNewOperator
  12643. protected:
  12644. static void copyXmlToBinary (const XmlElement& xml,
  12645. JUCE_NAMESPACE::MemoryBlock& destData);
  12646. static XmlElement* getXmlFromBinary (const void* data,
  12647. const int sizeInBytes);
  12648. AudioPlayHead* playHead;
  12649. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12650. private:
  12651. VoidArray listeners;
  12652. AudioProcessorEditor* activeEditor;
  12653. double sampleRate;
  12654. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12655. bool suspended, nonRealtime;
  12656. CriticalSection callbackLock, listenerLock;
  12657. #if JUCE_DEBUG
  12658. BigInteger changingParams;
  12659. #endif
  12660. AudioProcessor (const AudioProcessor&);
  12661. AudioProcessor& operator= (const AudioProcessor&);
  12662. };
  12663. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12664. /*** End of inlined file: juce_AudioProcessor.h ***/
  12665. /*** Start of inlined file: juce_PluginDescription.h ***/
  12666. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12667. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12668. class JUCE_API PluginDescription
  12669. {
  12670. public:
  12671. PluginDescription() throw();
  12672. PluginDescription (const PluginDescription& other) throw();
  12673. PluginDescription& operator= (const PluginDescription& other) throw();
  12674. ~PluginDescription() throw();
  12675. String name;
  12676. String pluginFormatName;
  12677. String category;
  12678. String manufacturerName;
  12679. String version;
  12680. String fileOrIdentifier;
  12681. Time lastFileModTime;
  12682. int uid;
  12683. bool isInstrument;
  12684. int numInputChannels;
  12685. int numOutputChannels;
  12686. bool isDuplicateOf (const PluginDescription& other) const;
  12687. const String createIdentifierString() const throw();
  12688. XmlElement* createXml() const;
  12689. bool loadFromXml (const XmlElement& xml);
  12690. juce_UseDebuggingNewOperator
  12691. };
  12692. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12693. /*** End of inlined file: juce_PluginDescription.h ***/
  12694. class JUCE_API AudioPluginInstance : public AudioProcessor
  12695. {
  12696. public:
  12697. virtual ~AudioPluginInstance();
  12698. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12699. juce_UseDebuggingNewOperator
  12700. protected:
  12701. AudioPluginInstance();
  12702. AudioPluginInstance (const AudioPluginInstance&);
  12703. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12704. };
  12705. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12706. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12707. class PluginDescription;
  12708. class JUCE_API AudioPluginFormat
  12709. {
  12710. public:
  12711. virtual ~AudioPluginFormat();
  12712. virtual const String getName() const = 0;
  12713. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12714. const String& fileOrIdentifier) = 0;
  12715. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12716. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12717. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12718. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12719. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12720. bool recursive) = 0;
  12721. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12722. juce_UseDebuggingNewOperator
  12723. protected:
  12724. AudioPluginFormat() throw();
  12725. AudioPluginFormat (const AudioPluginFormat&);
  12726. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12727. };
  12728. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12729. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12730. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12731. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12732. {
  12733. public:
  12734. AudioUnitPluginFormat();
  12735. ~AudioUnitPluginFormat();
  12736. const String getName() const { return "AudioUnit"; }
  12737. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12738. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12739. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12740. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12741. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12742. bool doesPluginStillExist (const PluginDescription& desc);
  12743. const FileSearchPath getDefaultLocationsToSearch();
  12744. juce_UseDebuggingNewOperator
  12745. private:
  12746. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12747. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12748. };
  12749. #endif
  12750. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12751. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12752. #endif
  12753. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12754. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12755. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12756. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12757. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12758. // Sorry, this file is just a placeholder at the moment!...
  12759. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12760. {
  12761. public:
  12762. DirectXPluginFormat();
  12763. ~DirectXPluginFormat();
  12764. const String getName() const { return "DirectX"; }
  12765. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12766. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12767. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12768. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12769. const FileSearchPath getDefaultLocationsToSearch();
  12770. juce_UseDebuggingNewOperator
  12771. private:
  12772. DirectXPluginFormat (const DirectXPluginFormat&);
  12773. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12774. };
  12775. #endif
  12776. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12777. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12778. #endif
  12779. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12780. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12781. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12782. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12783. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12784. // Sorry, this file is just a placeholder at the moment!...
  12785. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12786. {
  12787. public:
  12788. LADSPAPluginFormat();
  12789. ~LADSPAPluginFormat();
  12790. const String getName() const { return "LADSPA"; }
  12791. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12792. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12793. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12794. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12795. const FileSearchPath getDefaultLocationsToSearch();
  12796. juce_UseDebuggingNewOperator
  12797. private:
  12798. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12799. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12800. };
  12801. #endif
  12802. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12803. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12804. #endif
  12805. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12806. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12807. #ifdef __aeffect__
  12808. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12809. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12810. class VSTMidiEventList
  12811. {
  12812. public:
  12813. VSTMidiEventList()
  12814. : numEventsUsed (0), numEventsAllocated (0)
  12815. {
  12816. }
  12817. ~VSTMidiEventList()
  12818. {
  12819. freeEvents();
  12820. }
  12821. void clear()
  12822. {
  12823. numEventsUsed = 0;
  12824. if (events != 0)
  12825. events->numEvents = 0;
  12826. }
  12827. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12828. {
  12829. ensureSize (numEventsUsed + 1);
  12830. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12831. events->numEvents = ++numEventsUsed;
  12832. if (numBytes <= 4)
  12833. {
  12834. if (e->type == kVstSysExType)
  12835. {
  12836. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12837. e->type = kVstMidiType;
  12838. e->byteSize = sizeof (VstMidiEvent);
  12839. e->noteLength = 0;
  12840. e->noteOffset = 0;
  12841. e->detune = 0;
  12842. e->noteOffVelocity = 0;
  12843. }
  12844. e->deltaFrames = frameOffset;
  12845. memcpy (e->midiData, midiData, numBytes);
  12846. }
  12847. else
  12848. {
  12849. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12850. if (se->type == kVstSysExType)
  12851. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12852. else
  12853. se->sysexDump = (char*) juce_malloc (numBytes);
  12854. memcpy (se->sysexDump, midiData, numBytes);
  12855. se->type = kVstSysExType;
  12856. se->byteSize = sizeof (VstMidiSysexEvent);
  12857. se->deltaFrames = frameOffset;
  12858. se->flags = 0;
  12859. se->dumpBytes = numBytes;
  12860. se->resvd1 = 0;
  12861. se->resvd2 = 0;
  12862. }
  12863. }
  12864. // Handy method to pull the events out of an event buffer supplied by the host
  12865. // or plugin.
  12866. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12867. {
  12868. for (int i = 0; i < events->numEvents; ++i)
  12869. {
  12870. const VstEvent* const e = events->events[i];
  12871. if (e != 0)
  12872. {
  12873. if (e->type == kVstMidiType)
  12874. {
  12875. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12876. 4, e->deltaFrames);
  12877. }
  12878. else if (e->type == kVstSysExType)
  12879. {
  12880. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12881. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12882. e->deltaFrames);
  12883. }
  12884. }
  12885. }
  12886. }
  12887. void ensureSize (int numEventsNeeded)
  12888. {
  12889. if (numEventsNeeded > numEventsAllocated)
  12890. {
  12891. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12892. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12893. if (events == 0)
  12894. events.calloc (size, 1);
  12895. else
  12896. events.realloc (size, 1);
  12897. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12898. {
  12899. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12900. (int) sizeof (VstMidiSysexEvent)));
  12901. e->type = kVstMidiType;
  12902. e->byteSize = sizeof (VstMidiEvent);
  12903. events->events[i] = (VstEvent*) e;
  12904. }
  12905. numEventsAllocated = numEventsNeeded;
  12906. }
  12907. }
  12908. void freeEvents()
  12909. {
  12910. if (events != 0)
  12911. {
  12912. for (int i = numEventsAllocated; --i >= 0;)
  12913. {
  12914. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12915. if (e->type == kVstSysExType)
  12916. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12917. juce_free (e);
  12918. }
  12919. events.free();
  12920. numEventsUsed = 0;
  12921. numEventsAllocated = 0;
  12922. }
  12923. }
  12924. HeapBlock <VstEvents> events;
  12925. private:
  12926. int numEventsUsed, numEventsAllocated;
  12927. };
  12928. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12929. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12930. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12931. #endif
  12932. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12933. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12934. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12935. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12936. #if JUCE_PLUGINHOST_VST
  12937. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12938. {
  12939. public:
  12940. VSTPluginFormat();
  12941. ~VSTPluginFormat();
  12942. const String getName() const { return "VST"; }
  12943. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12944. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12945. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12946. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12947. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12948. bool doesPluginStillExist (const PluginDescription& desc);
  12949. const FileSearchPath getDefaultLocationsToSearch();
  12950. juce_UseDebuggingNewOperator
  12951. private:
  12952. VSTPluginFormat (const VSTPluginFormat&);
  12953. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12954. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12955. };
  12956. #endif
  12957. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12958. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12959. #endif
  12960. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12961. #endif
  12962. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12963. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12964. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12965. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12966. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12967. {
  12968. public:
  12969. AudioPluginFormatManager() throw();
  12970. ~AudioPluginFormatManager() throw();
  12971. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12972. void addDefaultFormats();
  12973. int getNumFormats() throw();
  12974. AudioPluginFormat* getFormat (const int index) throw();
  12975. void addFormat (AudioPluginFormat* const format) throw();
  12976. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12977. String& errorMessage) const;
  12978. bool doesPluginStillExist (const PluginDescription& description) const;
  12979. juce_UseDebuggingNewOperator
  12980. private:
  12981. OwnedArray <AudioPluginFormat> formats;
  12982. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12983. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12984. };
  12985. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12986. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12987. #endif
  12988. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12989. #endif
  12990. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12991. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12992. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12993. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12994. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12995. {
  12996. public:
  12997. KnownPluginList();
  12998. ~KnownPluginList();
  12999. void clear();
  13000. int getNumTypes() const throw() { return types.size(); }
  13001. PluginDescription* getType (int index) const throw() { return types [index]; }
  13002. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  13003. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  13004. bool addType (const PluginDescription& type);
  13005. void removeType (int index) throw();
  13006. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  13007. bool dontRescanIfAlreadyInList,
  13008. OwnedArray <PluginDescription>& typesFound,
  13009. AudioPluginFormat& formatToUse);
  13010. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  13011. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  13012. OwnedArray <PluginDescription>& typesFound);
  13013. enum SortMethod
  13014. {
  13015. defaultOrder = 0,
  13016. sortAlphabetically,
  13017. sortByCategory,
  13018. sortByManufacturer,
  13019. sortByFileSystemLocation
  13020. };
  13021. void addToMenu (PopupMenu& menu,
  13022. const SortMethod sortMethod) const;
  13023. int getIndexChosenByMenu (int menuResultCode) const;
  13024. void sort (const SortMethod method);
  13025. XmlElement* createXml() const;
  13026. void recreateFromXml (const XmlElement& xml);
  13027. juce_UseDebuggingNewOperator
  13028. private:
  13029. OwnedArray <PluginDescription> types;
  13030. KnownPluginList (const KnownPluginList&);
  13031. KnownPluginList& operator= (const KnownPluginList&);
  13032. };
  13033. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  13034. /*** End of inlined file: juce_KnownPluginList.h ***/
  13035. #endif
  13036. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  13037. #endif
  13038. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  13039. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  13040. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  13041. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  13042. class JUCE_API PluginDirectoryScanner
  13043. {
  13044. public:
  13045. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  13046. AudioPluginFormat& formatToLookFor,
  13047. FileSearchPath directoriesToSearch,
  13048. bool searchRecursively,
  13049. const File& deadMansPedalFile);
  13050. ~PluginDirectoryScanner();
  13051. bool scanNextFile (bool dontRescanIfAlreadyInList);
  13052. const String getNextPluginFileThatWillBeScanned() const throw();
  13053. float getProgress() const { return progress; }
  13054. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  13055. juce_UseDebuggingNewOperator
  13056. private:
  13057. KnownPluginList& list;
  13058. AudioPluginFormat& format;
  13059. StringArray filesOrIdentifiersToScan;
  13060. File deadMansPedalFile;
  13061. StringArray failedFiles;
  13062. int nextIndex;
  13063. float progress;
  13064. const StringArray getDeadMansPedalFile() throw();
  13065. void setDeadMansPedalFile (const StringArray& newContents) throw();
  13066. PluginDirectoryScanner (const PluginDirectoryScanner&);
  13067. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  13068. };
  13069. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  13070. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  13071. #endif
  13072. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  13073. /*** Start of inlined file: juce_PluginListComponent.h ***/
  13074. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  13075. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  13076. /*** Start of inlined file: juce_ListBox.h ***/
  13077. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  13078. #define __JUCE_LISTBOX_JUCEHEADER__
  13079. class ListViewport;
  13080. class JUCE_API ListBoxModel
  13081. {
  13082. public:
  13083. virtual ~ListBoxModel() {}
  13084. virtual int getNumRows() = 0;
  13085. virtual void paintListBoxItem (int rowNumber,
  13086. Graphics& g,
  13087. int width, int height,
  13088. bool rowIsSelected) = 0;
  13089. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  13090. Component* existingComponentToUpdate);
  13091. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  13092. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  13093. virtual void backgroundClicked();
  13094. virtual void selectedRowsChanged (int lastRowSelected);
  13095. virtual void deleteKeyPressed (int lastRowSelected);
  13096. virtual void returnKeyPressed (int lastRowSelected);
  13097. virtual void listWasScrolled();
  13098. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  13099. virtual const String getTooltipForRow (int row);
  13100. };
  13101. class JUCE_API ListBox : public Component,
  13102. public SettableTooltipClient
  13103. {
  13104. public:
  13105. ListBox (const String& componentName,
  13106. ListBoxModel* model);
  13107. ~ListBox();
  13108. void setModel (ListBoxModel* newModel);
  13109. ListBoxModel* getModel() const throw() { return model; }
  13110. void updateContent();
  13111. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  13112. void setMouseMoveSelectsRows (bool shouldSelect);
  13113. void selectRow (int rowNumber,
  13114. bool dontScrollToShowThisRow = false,
  13115. bool deselectOthersFirst = true);
  13116. void selectRangeOfRows (int firstRow,
  13117. int lastRow);
  13118. void deselectRow (int rowNumber);
  13119. void deselectAllRows();
  13120. void flipRowSelection (int rowNumber);
  13121. const SparseSet<int> getSelectedRows() const;
  13122. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  13123. bool sendNotificationEventToModel = true);
  13124. bool isRowSelected (int rowNumber) const;
  13125. int getNumSelectedRows() const;
  13126. int getSelectedRow (int index = 0) const;
  13127. int getLastRowSelected() const;
  13128. void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn,
  13129. const ModifierKeys& modifiers);
  13130. void setVerticalPosition (double newProportion);
  13131. double getVerticalPosition() const;
  13132. void scrollToEnsureRowIsOnscreen (int row);
  13133. ScrollBar* getVerticalScrollBar() const throw();
  13134. ScrollBar* getHorizontalScrollBar() const throw();
  13135. int getRowContainingPosition (int x, int y) const throw();
  13136. int getInsertionIndexForPosition (int x, int y) const throw();
  13137. const Rectangle<int> getRowPosition (int rowNumber,
  13138. bool relativeToComponentTopLeft) const throw();
  13139. Component* getComponentForRowNumber (int rowNumber) const throw();
  13140. int getRowNumberOfComponent (Component* rowComponent) const throw();
  13141. int getVisibleRowWidth() const throw();
  13142. void setRowHeight (int newHeight);
  13143. int getRowHeight() const throw() { return rowHeight; }
  13144. int getNumRowsOnScreen() const throw();
  13145. enum ColourIds
  13146. {
  13147. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  13148. Make this transparent if you don't want the background to be filled. */
  13149. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  13150. Make this transparent to not have an outline. */
  13151. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  13152. };
  13153. void setOutlineThickness (int outlineThickness);
  13154. int getOutlineThickness() const throw() { return outlineThickness; }
  13155. void setHeaderComponent (Component* newHeaderComponent);
  13156. void setMinimumContentWidth (int newMinimumWidth);
  13157. int getVisibleContentWidth() const throw();
  13158. void repaintRow (int rowNumber) throw();
  13159. Image* createSnapshotOfSelectedRows (int& x, int& y);
  13160. Viewport* getViewport() const throw();
  13161. bool keyPressed (const KeyPress& key);
  13162. bool keyStateChanged (bool isKeyDown);
  13163. void paint (Graphics& g);
  13164. void paintOverChildren (Graphics& g);
  13165. void resized();
  13166. void visibilityChanged();
  13167. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  13168. void mouseMove (const MouseEvent&);
  13169. void mouseExit (const MouseEvent&);
  13170. void mouseUp (const MouseEvent&);
  13171. void colourChanged();
  13172. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  13173. juce_UseDebuggingNewOperator
  13174. private:
  13175. friend class ListViewport;
  13176. friend class TableListBox;
  13177. ListBoxModel* model;
  13178. ListViewport* viewport;
  13179. Component* headerComponent;
  13180. int totalItems, rowHeight, minimumRowWidth;
  13181. int outlineThickness;
  13182. int lastRowSelected;
  13183. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  13184. SparseSet <int> selected;
  13185. void selectRowInternal (int rowNumber,
  13186. bool dontScrollToShowThisRow,
  13187. bool deselectOthersFirst,
  13188. bool isMouseClick);
  13189. ListBox (const ListBox&);
  13190. ListBox& operator= (const ListBox&);
  13191. };
  13192. #endif // __JUCE_LISTBOX_JUCEHEADER__
  13193. /*** End of inlined file: juce_ListBox.h ***/
  13194. /*** Start of inlined file: juce_TextButton.h ***/
  13195. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13196. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  13197. class JUCE_API TextButton : public Button
  13198. {
  13199. public:
  13200. TextButton (const String& buttonName,
  13201. const String& toolTip = String::empty);
  13202. ~TextButton();
  13203. enum ColourIds
  13204. {
  13205. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  13206. 'off'). The look-and-feel class might re-interpret this to add
  13207. effects, etc. */
  13208. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  13209. 'on'). The look-and-feel class might re-interpret this to add
  13210. effects, etc. */
  13211. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  13212. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  13213. };
  13214. void changeWidthToFitText (int newHeight = -1);
  13215. virtual const Font getFont();
  13216. juce_UseDebuggingNewOperator
  13217. protected:
  13218. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  13219. void colourChanged();
  13220. private:
  13221. TextButton (const TextButton&);
  13222. TextButton& operator= (const TextButton&);
  13223. };
  13224. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  13225. /*** End of inlined file: juce_TextButton.h ***/
  13226. class JUCE_API PluginListComponent : public Component,
  13227. public ListBoxModel,
  13228. public ChangeListener,
  13229. public ButtonListener,
  13230. public Timer
  13231. {
  13232. public:
  13233. PluginListComponent (KnownPluginList& listToRepresent,
  13234. const File& deadMansPedalFile,
  13235. PropertiesFile* propertiesToUse);
  13236. ~PluginListComponent();
  13237. void resized();
  13238. bool isInterestedInFileDrag (const StringArray& files);
  13239. void filesDropped (const StringArray& files, int, int);
  13240. int getNumRows();
  13241. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  13242. void deleteKeyPressed (int lastRowSelected);
  13243. void buttonClicked (Button* b);
  13244. void changeListenerCallback (void*);
  13245. void timerCallback();
  13246. juce_UseDebuggingNewOperator
  13247. private:
  13248. KnownPluginList& list;
  13249. File deadMansPedalFile;
  13250. ListBox* listBox;
  13251. TextButton* optionsButton;
  13252. PropertiesFile* propertiesToUse;
  13253. int typeToScan;
  13254. void scanFor (AudioPluginFormat* format);
  13255. PluginListComponent (const PluginListComponent&);
  13256. PluginListComponent& operator= (const PluginListComponent&);
  13257. };
  13258. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  13259. /*** End of inlined file: juce_PluginListComponent.h ***/
  13260. #endif
  13261. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  13262. #endif
  13263. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  13264. #endif
  13265. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  13266. #endif
  13267. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13268. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  13269. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13270. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13271. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  13272. public AsyncUpdater
  13273. {
  13274. public:
  13275. AudioProcessorGraph();
  13276. ~AudioProcessorGraph();
  13277. class JUCE_API Node : public ReferenceCountedObject
  13278. {
  13279. public:
  13280. ~Node();
  13281. const uint32 id;
  13282. AudioProcessor* const processor;
  13283. NamedValueSet properties;
  13284. typedef ReferenceCountedObjectPtr <Node> Ptr;
  13285. juce_UseDebuggingNewOperator
  13286. private:
  13287. friend class AudioProcessorGraph;
  13288. bool isPrepared;
  13289. Node (uint32 id, AudioProcessor* processor);
  13290. void prepare (double sampleRate, int blockSize, AudioProcessorGraph* graph);
  13291. void unprepare();
  13292. Node (const Node&);
  13293. Node& operator= (const Node&);
  13294. };
  13295. struct JUCE_API Connection
  13296. {
  13297. public:
  13298. uint32 sourceNodeId;
  13299. int sourceChannelIndex;
  13300. uint32 destNodeId;
  13301. int destChannelIndex;
  13302. juce_UseDebuggingNewOperator
  13303. private:
  13304. };
  13305. void clear();
  13306. int getNumNodes() const { return nodes.size(); }
  13307. Node* getNode (const int index) const { return nodes [index]; }
  13308. Node* getNodeForId (const uint32 nodeId) const;
  13309. Node* addNode (AudioProcessor* newProcessor, uint32 nodeId = 0);
  13310. bool removeNode (uint32 nodeId);
  13311. int getNumConnections() const { return connections.size(); }
  13312. const Connection* getConnection (int index) const { return connections [index]; }
  13313. const Connection* getConnectionBetween (uint32 sourceNodeId,
  13314. int sourceChannelIndex,
  13315. uint32 destNodeId,
  13316. int destChannelIndex) const;
  13317. bool isConnected (uint32 possibleSourceNodeId,
  13318. uint32 possibleDestNodeId) const;
  13319. bool canConnect (uint32 sourceNodeId, int sourceChannelIndex,
  13320. uint32 destNodeId, int destChannelIndex) const;
  13321. bool addConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13322. uint32 destNodeId, int destChannelIndex);
  13323. void removeConnection (int index);
  13324. bool removeConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13325. uint32 destNodeId, int destChannelIndex);
  13326. bool disconnectNode (uint32 nodeId);
  13327. bool removeIllegalConnections();
  13328. static const int midiChannelIndex;
  13329. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13330. {
  13331. public:
  13332. enum IODeviceType
  13333. {
  13334. audioInputNode, /**< In this mode, the processor has output channels
  13335. representing all the audio input channels that are
  13336. coming into its parent audio graph. */
  13337. audioOutputNode, /**< In this mode, the processor has input channels
  13338. representing all the audio output channels that are
  13339. going out of its parent audio graph. */
  13340. midiInputNode, /**< In this mode, the processor has a midi output which
  13341. delivers the same midi data that is arriving at its
  13342. parent graph. */
  13343. midiOutputNode /**< In this mode, the processor has a midi input and
  13344. any data sent to it will be passed out of the parent
  13345. graph. */
  13346. };
  13347. IODeviceType getType() const { return type; }
  13348. AudioProcessorGraph* getParentGraph() const { return graph; }
  13349. bool isInput() const;
  13350. bool isOutput() const;
  13351. AudioGraphIOProcessor (const IODeviceType type);
  13352. ~AudioGraphIOProcessor();
  13353. const String getName() const;
  13354. void fillInPluginDescription (PluginDescription& d) const;
  13355. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13356. void releaseResources();
  13357. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13358. const String getInputChannelName (const int channelIndex) const;
  13359. const String getOutputChannelName (const int channelIndex) const;
  13360. bool isInputChannelStereoPair (int index) const;
  13361. bool isOutputChannelStereoPair (int index) const;
  13362. bool acceptsMidi() const;
  13363. bool producesMidi() const;
  13364. AudioProcessorEditor* createEditor();
  13365. int getNumParameters();
  13366. const String getParameterName (int);
  13367. float getParameter (int);
  13368. const String getParameterText (int);
  13369. void setParameter (int, float);
  13370. int getNumPrograms();
  13371. int getCurrentProgram();
  13372. void setCurrentProgram (int);
  13373. const String getProgramName (int);
  13374. void changeProgramName (int, const String&);
  13375. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13376. void setStateInformation (const void* data, int sizeInBytes);
  13377. void setParentGraph (AudioProcessorGraph* graph);
  13378. juce_UseDebuggingNewOperator
  13379. private:
  13380. const IODeviceType type;
  13381. AudioProcessorGraph* graph;
  13382. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13383. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13384. };
  13385. // AudioProcessor methods:
  13386. const String getName() const;
  13387. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13388. void releaseResources();
  13389. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13390. const String getInputChannelName (const int channelIndex) const;
  13391. const String getOutputChannelName (const int channelIndex) const;
  13392. bool isInputChannelStereoPair (int index) const;
  13393. bool isOutputChannelStereoPair (int index) const;
  13394. bool acceptsMidi() const;
  13395. bool producesMidi() const;
  13396. AudioProcessorEditor* createEditor() { return 0; }
  13397. int getNumParameters() { return 0; }
  13398. const String getParameterName (int) { return String::empty; }
  13399. float getParameter (int) { return 0; }
  13400. const String getParameterText (int) { return String::empty; }
  13401. void setParameter (int, float) { }
  13402. int getNumPrograms() { return 0; }
  13403. int getCurrentProgram() { return 0; }
  13404. void setCurrentProgram (int) { }
  13405. const String getProgramName (int) { return String::empty; }
  13406. void changeProgramName (int, const String&) { }
  13407. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13408. void setStateInformation (const void* data, int sizeInBytes);
  13409. void handleAsyncUpdate();
  13410. juce_UseDebuggingNewOperator
  13411. private:
  13412. ReferenceCountedArray <Node> nodes;
  13413. OwnedArray <Connection> connections;
  13414. int lastNodeId;
  13415. AudioSampleBuffer renderingBuffers;
  13416. OwnedArray <MidiBuffer> midiBuffers;
  13417. CriticalSection renderLock;
  13418. VoidArray renderingOps;
  13419. friend class AudioGraphIOProcessor;
  13420. AudioSampleBuffer* currentAudioInputBuffer;
  13421. AudioSampleBuffer currentAudioOutputBuffer;
  13422. MidiBuffer* currentMidiInputBuffer;
  13423. MidiBuffer currentMidiOutputBuffer;
  13424. void clearRenderingSequence();
  13425. void buildRenderingSequence();
  13426. bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const;
  13427. AudioProcessorGraph (const AudioProcessorGraph&);
  13428. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13429. };
  13430. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13431. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13432. #endif
  13433. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13434. #endif
  13435. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13436. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13437. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13438. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13439. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13440. public MidiInputCallback
  13441. {
  13442. public:
  13443. AudioProcessorPlayer();
  13444. virtual ~AudioProcessorPlayer();
  13445. void setProcessor (AudioProcessor* const processorToPlay);
  13446. AudioProcessor* getCurrentProcessor() const { return processor; }
  13447. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13448. void audioDeviceIOCallback (const float** inputChannelData,
  13449. int totalNumInputChannels,
  13450. float** outputChannelData,
  13451. int totalNumOutputChannels,
  13452. int numSamples);
  13453. void audioDeviceAboutToStart (AudioIODevice* device);
  13454. void audioDeviceStopped();
  13455. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13456. juce_UseDebuggingNewOperator
  13457. private:
  13458. AudioProcessor* processor;
  13459. CriticalSection lock;
  13460. double sampleRate;
  13461. int blockSize;
  13462. bool isPrepared;
  13463. int numInputChans, numOutputChans;
  13464. float* channels [128];
  13465. AudioSampleBuffer tempBuffer;
  13466. MidiBuffer incomingMidi;
  13467. MidiMessageCollector messageCollector;
  13468. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13469. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13470. };
  13471. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13472. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13473. #endif
  13474. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13475. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13476. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13477. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13478. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13479. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13480. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13481. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13482. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13483. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13484. class EditableProperty;
  13485. class JUCE_API PropertyComponent : public Component,
  13486. public SettableTooltipClient
  13487. {
  13488. public:
  13489. PropertyComponent (const String& propertyName,
  13490. int preferredHeight = 25);
  13491. ~PropertyComponent();
  13492. int getPreferredHeight() const throw() { return preferredHeight; }
  13493. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13494. virtual void refresh() = 0;
  13495. void paint (Graphics& g);
  13496. void resized();
  13497. void enablementChanged();
  13498. juce_UseDebuggingNewOperator
  13499. protected:
  13500. int preferredHeight;
  13501. };
  13502. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13503. /*** End of inlined file: juce_PropertyComponent.h ***/
  13504. class JUCE_API PropertyPanel : public Component
  13505. {
  13506. public:
  13507. PropertyPanel();
  13508. ~PropertyPanel();
  13509. void clear();
  13510. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13511. void addSection (const String& sectionTitle,
  13512. const Array <PropertyComponent*>& newPropertyComponents,
  13513. bool shouldSectionInitiallyBeOpen = true);
  13514. void refreshAll() const;
  13515. const StringArray getSectionNames() const;
  13516. bool isSectionOpen (int sectionIndex) const;
  13517. void setSectionOpen (int sectionIndex, bool shouldBeOpen);
  13518. void setSectionEnabled (int sectionIndex, bool shouldBeEnabled);
  13519. XmlElement* getOpennessState() const;
  13520. void restoreOpennessState (const XmlElement& newState);
  13521. void setMessageWhenEmpty (const String& newMessage);
  13522. const String& getMessageWhenEmpty() const;
  13523. void paint (Graphics& g);
  13524. void resized();
  13525. juce_UseDebuggingNewOperator
  13526. private:
  13527. Viewport* viewport;
  13528. class PropertyHolderComponent;
  13529. PropertyHolderComponent* propertyHolderComponent;
  13530. String messageWhenEmpty;
  13531. void updatePropHolderLayout() const;
  13532. void updatePropHolderLayout (int width) const;
  13533. };
  13534. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13535. /*** End of inlined file: juce_PropertyPanel.h ***/
  13536. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13537. {
  13538. public:
  13539. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13540. ~GenericAudioProcessorEditor();
  13541. void paint (Graphics& g);
  13542. void resized();
  13543. juce_UseDebuggingNewOperator
  13544. private:
  13545. PropertyPanel* panel;
  13546. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13547. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13548. };
  13549. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13550. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13551. #endif
  13552. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13553. /*** Start of inlined file: juce_Sampler.h ***/
  13554. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13555. #define __JUCE_SAMPLER_JUCEHEADER__
  13556. /*** Start of inlined file: juce_Synthesiser.h ***/
  13557. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13558. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13559. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13560. {
  13561. protected:
  13562. SynthesiserSound();
  13563. public:
  13564. virtual ~SynthesiserSound();
  13565. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13566. virtual bool appliesToChannel (const int midiChannel) = 0;
  13567. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13568. juce_UseDebuggingNewOperator
  13569. };
  13570. class JUCE_API SynthesiserVoice
  13571. {
  13572. public:
  13573. SynthesiserVoice();
  13574. virtual ~SynthesiserVoice();
  13575. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13576. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13577. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13578. virtual void startNote (const int midiNoteNumber,
  13579. const float velocity,
  13580. SynthesiserSound* sound,
  13581. const int currentPitchWheelPosition) = 0;
  13582. virtual void stopNote (const bool allowTailOff) = 0;
  13583. virtual void pitchWheelMoved (const int newValue) = 0;
  13584. virtual void controllerMoved (const int controllerNumber,
  13585. const int newValue) = 0;
  13586. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13587. int startSample,
  13588. int numSamples) = 0;
  13589. bool isPlayingChannel (int midiChannel) const;
  13590. void setCurrentPlaybackSampleRate (double newRate);
  13591. juce_UseDebuggingNewOperator
  13592. protected:
  13593. double getSampleRate() const { return currentSampleRate; }
  13594. void clearCurrentNote();
  13595. private:
  13596. friend class Synthesiser;
  13597. double currentSampleRate;
  13598. int currentlyPlayingNote;
  13599. uint32 noteOnTime;
  13600. SynthesiserSound::Ptr currentlyPlayingSound;
  13601. };
  13602. class JUCE_API Synthesiser
  13603. {
  13604. public:
  13605. Synthesiser();
  13606. virtual ~Synthesiser();
  13607. void clearVoices();
  13608. int getNumVoices() const { return voices.size(); }
  13609. SynthesiserVoice* getVoice (int index) const;
  13610. void addVoice (SynthesiserVoice* newVoice);
  13611. void removeVoice (int index);
  13612. void clearSounds();
  13613. int getNumSounds() const { return sounds.size(); }
  13614. SynthesiserSound* getSound (int index) const { return sounds [index]; }
  13615. void addSound (const SynthesiserSound::Ptr& newSound);
  13616. void removeSound (int index);
  13617. void setNoteStealingEnabled (bool shouldStealNotes);
  13618. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13619. virtual void noteOn (const int midiChannel,
  13620. const int midiNoteNumber,
  13621. const float velocity);
  13622. virtual void noteOff (const int midiChannel,
  13623. const int midiNoteNumber,
  13624. const bool allowTailOff);
  13625. virtual void allNotesOff (const int midiChannel,
  13626. const bool allowTailOff);
  13627. virtual void handlePitchWheel (const int midiChannel,
  13628. const int wheelValue);
  13629. virtual void handleController (const int midiChannel,
  13630. const int controllerNumber,
  13631. const int controllerValue);
  13632. void setCurrentPlaybackSampleRate (const double sampleRate);
  13633. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13634. const MidiBuffer& inputMidi,
  13635. int startSample,
  13636. int numSamples);
  13637. juce_UseDebuggingNewOperator
  13638. protected:
  13639. CriticalSection lock;
  13640. OwnedArray <SynthesiserVoice> voices;
  13641. ReferenceCountedArray <SynthesiserSound> sounds;
  13642. int lastPitchWheelValues [16];
  13643. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13644. const bool stealIfNoneAvailable) const;
  13645. void startVoice (SynthesiserVoice* voice,
  13646. SynthesiserSound* sound,
  13647. int midiChannel,
  13648. int midiNoteNumber,
  13649. float velocity);
  13650. int findFreeVoice (const bool) const { return 0; }
  13651. private:
  13652. double sampleRate;
  13653. uint32 lastNoteOnCounter;
  13654. bool shouldStealNotes;
  13655. Synthesiser (const Synthesiser&);
  13656. Synthesiser& operator= (const Synthesiser&);
  13657. };
  13658. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13659. /*** End of inlined file: juce_Synthesiser.h ***/
  13660. class JUCE_API SamplerSound : public SynthesiserSound
  13661. {
  13662. public:
  13663. SamplerSound (const String& name,
  13664. AudioFormatReader& source,
  13665. const BigInteger& midiNotes,
  13666. int midiNoteForNormalPitch,
  13667. double attackTimeSecs,
  13668. double releaseTimeSecs,
  13669. double maxSampleLengthSeconds);
  13670. ~SamplerSound();
  13671. const String& getName() const { return name; }
  13672. AudioSampleBuffer* getAudioData() const { return data; }
  13673. bool appliesToNote (const int midiNoteNumber);
  13674. bool appliesToChannel (const int midiChannel);
  13675. juce_UseDebuggingNewOperator
  13676. private:
  13677. friend class SamplerVoice;
  13678. String name;
  13679. ScopedPointer <AudioSampleBuffer> data;
  13680. double sourceSampleRate;
  13681. BigInteger midiNotes;
  13682. int length, attackSamples, releaseSamples;
  13683. int midiRootNote;
  13684. };
  13685. class JUCE_API SamplerVoice : public SynthesiserVoice
  13686. {
  13687. public:
  13688. SamplerVoice();
  13689. ~SamplerVoice();
  13690. bool canPlaySound (SynthesiserSound* sound);
  13691. void startNote (const int midiNoteNumber,
  13692. const float velocity,
  13693. SynthesiserSound* sound,
  13694. const int currentPitchWheelPosition);
  13695. void stopNote (const bool allowTailOff);
  13696. void pitchWheelMoved (const int newValue);
  13697. void controllerMoved (const int controllerNumber,
  13698. const int newValue);
  13699. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13700. juce_UseDebuggingNewOperator
  13701. private:
  13702. double pitchRatio;
  13703. double sourceSamplePosition;
  13704. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13705. bool isInAttack, isInRelease;
  13706. };
  13707. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13708. /*** End of inlined file: juce_Sampler.h ***/
  13709. #endif
  13710. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13711. #endif
  13712. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13713. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13714. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13715. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13716. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13717. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13718. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13719. class JUCE_API ActionListenerList : public MessageListener
  13720. {
  13721. public:
  13722. ActionListenerList() throw();
  13723. ~ActionListenerList() throw();
  13724. void addActionListener (ActionListener* listener) throw();
  13725. void removeActionListener (ActionListener* listener) throw();
  13726. void removeAllActionListeners() throw();
  13727. void sendActionMessage (const String& message) const;
  13728. void handleMessage (const Message&);
  13729. juce_UseDebuggingNewOperator
  13730. private:
  13731. SortedSet <void*> actionListeners_;
  13732. CriticalSection actionListenerLock_;
  13733. ActionListenerList (const ActionListenerList&);
  13734. ActionListenerList& operator= (const ActionListenerList&);
  13735. };
  13736. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13737. /*** End of inlined file: juce_ActionListenerList.h ***/
  13738. class JUCE_API ActionBroadcaster
  13739. {
  13740. public:
  13741. ActionBroadcaster() throw();
  13742. virtual ~ActionBroadcaster();
  13743. void addActionListener (ActionListener* listener);
  13744. void removeActionListener (ActionListener* listener);
  13745. void removeAllActionListeners();
  13746. void sendActionMessage (const String& message) const;
  13747. private:
  13748. ActionListenerList actionListenerList;
  13749. ActionBroadcaster (const ActionBroadcaster&);
  13750. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13751. };
  13752. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13753. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13754. #endif
  13755. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13756. #endif
  13757. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13758. #endif
  13759. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13760. #endif
  13761. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13762. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13763. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13764. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13765. class JUCE_API CallbackMessage : public Message
  13766. {
  13767. public:
  13768. CallbackMessage() throw();
  13769. ~CallbackMessage() throw();
  13770. virtual void messageCallback() = 0;
  13771. void post();
  13772. juce_UseDebuggingNewOperator
  13773. private:
  13774. CallbackMessage (const CallbackMessage&);
  13775. CallbackMessage& operator= (const CallbackMessage&);
  13776. };
  13777. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13778. /*** End of inlined file: juce_CallbackMessage.h ***/
  13779. #endif
  13780. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13781. #endif
  13782. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13783. #endif
  13784. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13785. #endif
  13786. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13787. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13788. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13789. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13790. class InterprocessConnectionServer;
  13791. class JUCE_API InterprocessConnection : public Thread,
  13792. private MessageListener
  13793. {
  13794. public:
  13795. InterprocessConnection (bool callbacksOnMessageThread = true,
  13796. uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13797. ~InterprocessConnection();
  13798. bool connectToSocket (const String& hostName,
  13799. int portNumber,
  13800. int timeOutMillisecs);
  13801. bool connectToPipe (const String& pipeName,
  13802. int pipeReceiveMessageTimeoutMs = -1);
  13803. bool createPipe (const String& pipeName,
  13804. int pipeReceiveMessageTimeoutMs = -1);
  13805. void disconnect();
  13806. bool isConnected() const;
  13807. StreamingSocket* getSocket() const throw() { return socket; }
  13808. NamedPipe* getPipe() const throw() { return pipe; }
  13809. const String getConnectedHostName() const;
  13810. bool sendMessage (const MemoryBlock& message);
  13811. virtual void connectionMade() = 0;
  13812. virtual void connectionLost() = 0;
  13813. virtual void messageReceived (const MemoryBlock& message) = 0;
  13814. juce_UseDebuggingNewOperator
  13815. private:
  13816. CriticalSection pipeAndSocketLock;
  13817. ScopedPointer <StreamingSocket> socket;
  13818. ScopedPointer <NamedPipe> pipe;
  13819. bool callbackConnectionState;
  13820. const bool useMessageThread;
  13821. const uint32 magicMessageHeader;
  13822. int pipeReceiveMessageTimeout;
  13823. friend class InterprocessConnectionServer;
  13824. void initialiseWithSocket (StreamingSocket* socket_);
  13825. void initialiseWithPipe (NamedPipe* pipe_);
  13826. void handleMessage (const Message& message);
  13827. void connectionMadeInt();
  13828. void connectionLostInt();
  13829. void deliverDataInt (const MemoryBlock& data);
  13830. bool readNextMessageInt();
  13831. void run();
  13832. InterprocessConnection (const InterprocessConnection&);
  13833. InterprocessConnection& operator= (const InterprocessConnection&);
  13834. };
  13835. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13836. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13837. #endif
  13838. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13839. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13840. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13841. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13842. class JUCE_API InterprocessConnectionServer : private Thread
  13843. {
  13844. public:
  13845. InterprocessConnectionServer();
  13846. ~InterprocessConnectionServer();
  13847. bool beginWaitingForSocket (int portNumber);
  13848. void stop();
  13849. protected:
  13850. virtual InterprocessConnection* createConnectionObject() = 0;
  13851. public:
  13852. juce_UseDebuggingNewOperator
  13853. private:
  13854. ScopedPointer <StreamingSocket> socket;
  13855. void run();
  13856. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13857. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13858. };
  13859. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13860. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13861. #endif
  13862. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13863. #endif
  13864. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13865. #endif
  13866. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13867. #endif
  13868. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13869. /*** Start of inlined file: juce_MessageManager.h ***/
  13870. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13871. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13872. class Component;
  13873. class MessageManagerLock;
  13874. typedef void* (MessageCallbackFunction) (void* userData);
  13875. class JUCE_API MessageManager
  13876. {
  13877. public:
  13878. static MessageManager* getInstance() throw();
  13879. void runDispatchLoop();
  13880. void stopDispatchLoop();
  13881. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13882. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13883. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13884. void* userData);
  13885. bool isThisTheMessageThread() const throw();
  13886. void setCurrentThreadAsMessageThread();
  13887. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13888. bool currentThreadHasLockedMessageManager() const throw();
  13889. static void broadcastMessage (const String& messageText) throw();
  13890. void registerBroadcastListener (ActionListener* listener) throw();
  13891. void deregisterBroadcastListener (ActionListener* listener) throw();
  13892. void deliverMessage (void*);
  13893. void deliverBroadcastMessage (const String&);
  13894. ~MessageManager() throw();
  13895. juce_UseDebuggingNewOperator
  13896. private:
  13897. MessageManager() throw();
  13898. friend class MessageListener;
  13899. friend class ChangeBroadcaster;
  13900. friend class ActionBroadcaster;
  13901. friend class CallbackMessage;
  13902. static MessageManager* instance;
  13903. SortedSet <const MessageListener*> messageListeners;
  13904. ScopedPointer <ActionListenerList> broadcastListeners;
  13905. friend class JUCEApplication;
  13906. bool quitMessagePosted, quitMessageReceived;
  13907. Thread::ThreadID messageThreadId;
  13908. VoidArray modalComponents;
  13909. static void* exitModalLoopCallback (void*);
  13910. void postMessageToQueue (Message* message);
  13911. void postCallbackMessage (Message* message);
  13912. static void doPlatformSpecificInitialisation();
  13913. static void doPlatformSpecificShutdown();
  13914. friend class MessageManagerLock;
  13915. Thread::ThreadID volatile threadWithLock;
  13916. CriticalSection lockingLock;
  13917. MessageManager (const MessageManager&);
  13918. MessageManager& operator= (const MessageManager&);
  13919. };
  13920. class JUCE_API MessageManagerLock
  13921. {
  13922. public:
  13923. MessageManagerLock (Thread* threadToCheckForExitSignal = 0) throw();
  13924. MessageManagerLock (ThreadPoolJob* jobToCheckForExitSignal) throw();
  13925. ~MessageManagerLock() throw();
  13926. bool lockWasGained() const throw() { return locked; }
  13927. private:
  13928. class SharedEvents;
  13929. class BlockingMessage;
  13930. friend class SharedEvents;
  13931. friend class BlockingMessage;
  13932. SharedEvents* sharedEvents;
  13933. bool locked;
  13934. void init (Thread* thread, ThreadPoolJob* job) throw();
  13935. MessageManagerLock (const MessageManagerLock&);
  13936. MessageManagerLock& operator= (const MessageManagerLock&);
  13937. };
  13938. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13939. /*** End of inlined file: juce_MessageManager.h ***/
  13940. #endif
  13941. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13942. /*** Start of inlined file: juce_MultiTimer.h ***/
  13943. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13944. #define __JUCE_MULTITIMER_JUCEHEADER__
  13945. class JUCE_API MultiTimer
  13946. {
  13947. protected:
  13948. MultiTimer() throw();
  13949. MultiTimer (const MultiTimer& other) throw();
  13950. public:
  13951. virtual ~MultiTimer();
  13952. virtual void timerCallback (int timerId) = 0;
  13953. void startTimer (int timerId, int intervalInMilliseconds) throw();
  13954. void stopTimer (int timerId) throw();
  13955. bool isTimerRunning (int timerId) const throw();
  13956. int getTimerInterval (int timerId) const throw();
  13957. private:
  13958. class MultiTimerCallback;
  13959. CriticalSection timerListLock;
  13960. OwnedArray <MultiTimerCallback> timers;
  13961. MultiTimer& operator= (const MultiTimer&);
  13962. };
  13963. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13964. /*** End of inlined file: juce_MultiTimer.h ***/
  13965. #endif
  13966. #ifndef __JUCE_TIMER_JUCEHEADER__
  13967. #endif
  13968. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13969. /*** Start of inlined file: juce_ArrowButton.h ***/
  13970. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13971. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13972. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13973. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13974. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13975. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13976. {
  13977. public:
  13978. DropShadowEffect();
  13979. ~DropShadowEffect();
  13980. void setShadowProperties (float newRadius,
  13981. float newOpacity,
  13982. int newShadowOffsetX,
  13983. int newShadowOffsetY);
  13984. void applyEffect (Image& sourceImage, Graphics& destContext);
  13985. juce_UseDebuggingNewOperator
  13986. private:
  13987. int offsetX, offsetY;
  13988. float radius, opacity;
  13989. };
  13990. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13991. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13992. class JUCE_API ArrowButton : public Button
  13993. {
  13994. public:
  13995. ArrowButton (const String& buttonName,
  13996. float arrowDirection,
  13997. const Colour& arrowColour);
  13998. ~ArrowButton();
  13999. juce_UseDebuggingNewOperator
  14000. protected:
  14001. void paintButton (Graphics& g,
  14002. bool isMouseOverButton,
  14003. bool isButtonDown);
  14004. void buttonStateChanged();
  14005. private:
  14006. Colour colour;
  14007. DropShadowEffect shadow;
  14008. Path path;
  14009. int offset;
  14010. ArrowButton (const ArrowButton&);
  14011. ArrowButton& operator= (const ArrowButton&);
  14012. };
  14013. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  14014. /*** End of inlined file: juce_ArrowButton.h ***/
  14015. #endif
  14016. #ifndef __JUCE_BUTTON_JUCEHEADER__
  14017. #endif
  14018. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  14019. /*** Start of inlined file: juce_DrawableButton.h ***/
  14020. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  14021. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  14022. /*** Start of inlined file: juce_Drawable.h ***/
  14023. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  14024. #define __JUCE_DRAWABLE_JUCEHEADER__
  14025. class JUCE_API Drawable
  14026. {
  14027. protected:
  14028. Drawable();
  14029. public:
  14030. virtual ~Drawable();
  14031. virtual Drawable* createCopy() const = 0;
  14032. void draw (Graphics& g, float opacity,
  14033. const AffineTransform& transform = AffineTransform::identity) const;
  14034. void drawAt (Graphics& g,
  14035. float x, float y,
  14036. float opacity) const;
  14037. void drawWithin (Graphics& g,
  14038. int destX,
  14039. int destY,
  14040. int destWidth,
  14041. int destHeight,
  14042. const RectanglePlacement& placement,
  14043. float opacity) const;
  14044. class RenderingContext
  14045. {
  14046. public:
  14047. RenderingContext (Graphics& g, const AffineTransform& transform, float opacity) throw();
  14048. Graphics& g;
  14049. AffineTransform transform;
  14050. float opacity;
  14051. private:
  14052. RenderingContext& operator= (const RenderingContext&);
  14053. };
  14054. virtual void render (const RenderingContext& context) const = 0;
  14055. virtual const Rectangle<float> getBounds() const = 0;
  14056. virtual bool hitTest (float x, float y) const = 0;
  14057. const String& getName() const throw() { return name; }
  14058. void setName (const String& newName) throw() { name = newName; }
  14059. static Drawable* createFromImageData (const void* data, size_t numBytes);
  14060. static Drawable* createFromImageDataStream (InputStream& dataSource);
  14061. static Drawable* createFromImageFile (const File& file);
  14062. static Drawable* createFromSVG (const XmlElement& svgDocument);
  14063. static Drawable* createFromValueTree (const ValueTree& tree);
  14064. virtual ValueTree createValueTree() const = 0;
  14065. juce_UseDebuggingNewOperator
  14066. private:
  14067. Drawable (const Drawable&);
  14068. Drawable& operator= (const Drawable&);
  14069. String name;
  14070. };
  14071. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  14072. /*** End of inlined file: juce_Drawable.h ***/
  14073. class JUCE_API DrawableButton : public Button
  14074. {
  14075. public:
  14076. enum ButtonStyle
  14077. {
  14078. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  14079. ImageRaw, /**< The button will just display the images in their normal size and position.
  14080. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  14081. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  14082. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  14083. };
  14084. DrawableButton (const String& buttonName,
  14085. ButtonStyle buttonStyle);
  14086. ~DrawableButton();
  14087. void setImages (const Drawable* normalImage,
  14088. const Drawable* overImage = 0,
  14089. const Drawable* downImage = 0,
  14090. const Drawable* disabledImage = 0,
  14091. const Drawable* normalImageOn = 0,
  14092. const Drawable* overImageOn = 0,
  14093. const Drawable* downImageOn = 0,
  14094. const Drawable* disabledImageOn = 0);
  14095. void setButtonStyle (ButtonStyle newStyle);
  14096. void setBackgroundColours (const Colour& toggledOffColour,
  14097. const Colour& toggledOnColour);
  14098. const Colour& getBackgroundColour() const throw();
  14099. void setEdgeIndent (int numPixelsIndent);
  14100. const Drawable* getCurrentImage() const throw();
  14101. const Drawable* getNormalImage() const throw();
  14102. const Drawable* getOverImage() const throw();
  14103. const Drawable* getDownImage() const throw();
  14104. juce_UseDebuggingNewOperator
  14105. protected:
  14106. void paintButton (Graphics& g,
  14107. bool isMouseOverButton,
  14108. bool isButtonDown);
  14109. private:
  14110. ButtonStyle style;
  14111. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  14112. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  14113. Colour backgroundOff, backgroundOn;
  14114. int edgeIndent;
  14115. void deleteImages();
  14116. DrawableButton (const DrawableButton&);
  14117. DrawableButton& operator= (const DrawableButton&);
  14118. };
  14119. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  14120. /*** End of inlined file: juce_DrawableButton.h ***/
  14121. #endif
  14122. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  14123. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  14124. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  14125. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  14126. class JUCE_API HyperlinkButton : public Button
  14127. {
  14128. public:
  14129. HyperlinkButton (const String& linkText,
  14130. const URL& linkURL);
  14131. ~HyperlinkButton();
  14132. void setFont (const Font& newFont,
  14133. bool resizeToMatchComponentHeight,
  14134. const Justification& justificationType = Justification::horizontallyCentred);
  14135. enum ColourIds
  14136. {
  14137. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  14138. };
  14139. void setURL (const URL& newURL) throw();
  14140. const URL& getURL() const throw() { return url; }
  14141. void changeWidthToFitText();
  14142. juce_UseDebuggingNewOperator
  14143. protected:
  14144. void clicked();
  14145. void colourChanged();
  14146. void paintButton (Graphics& g,
  14147. bool isMouseOverButton,
  14148. bool isButtonDown);
  14149. private:
  14150. URL url;
  14151. Font font;
  14152. bool resizeFont;
  14153. Justification justification;
  14154. const Font getFontToUse() const;
  14155. HyperlinkButton (const HyperlinkButton&);
  14156. HyperlinkButton& operator= (const HyperlinkButton&);
  14157. };
  14158. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  14159. /*** End of inlined file: juce_HyperlinkButton.h ***/
  14160. #endif
  14161. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  14162. /*** Start of inlined file: juce_ImageButton.h ***/
  14163. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  14164. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  14165. class JUCE_API ImageButton : public Button
  14166. {
  14167. public:
  14168. explicit ImageButton (const String& name);
  14169. ~ImageButton();
  14170. void setImages (bool resizeButtonNowToFitThisImage,
  14171. bool rescaleImagesWhenButtonSizeChanges,
  14172. bool preserveImageProportions,
  14173. Image* normalImage,
  14174. float imageOpacityWhenNormal,
  14175. const Colour& overlayColourWhenNormal,
  14176. Image* overImage,
  14177. float imageOpacityWhenOver,
  14178. const Colour& overlayColourWhenOver,
  14179. Image* downImage,
  14180. float imageOpacityWhenDown,
  14181. const Colour& overlayColourWhenDown,
  14182. float hitTestAlphaThreshold = 0.0f);
  14183. Image* getNormalImage() const throw();
  14184. Image* getOverImage() const throw();
  14185. Image* getDownImage() const throw();
  14186. juce_UseDebuggingNewOperator
  14187. protected:
  14188. bool hitTest (int x, int y);
  14189. void paintButton (Graphics& g,
  14190. bool isMouseOverButton,
  14191. bool isButtonDown);
  14192. private:
  14193. bool scaleImageToFit, preserveProportions;
  14194. unsigned char alphaThreshold;
  14195. int imageX, imageY, imageW, imageH;
  14196. Image* normalImage;
  14197. Image* overImage;
  14198. Image* downImage;
  14199. float normalOpacity, overOpacity, downOpacity;
  14200. Colour normalOverlay, overOverlay, downOverlay;
  14201. Image* getCurrentImage() const;
  14202. void deleteImages();
  14203. ImageButton (const ImageButton&);
  14204. ImageButton& operator= (const ImageButton&);
  14205. };
  14206. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  14207. /*** End of inlined file: juce_ImageButton.h ***/
  14208. #endif
  14209. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  14210. /*** Start of inlined file: juce_ShapeButton.h ***/
  14211. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  14212. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  14213. class JUCE_API ShapeButton : public Button
  14214. {
  14215. public:
  14216. ShapeButton (const String& name,
  14217. const Colour& normalColour,
  14218. const Colour& overColour,
  14219. const Colour& downColour);
  14220. ~ShapeButton();
  14221. void setShape (const Path& newShape,
  14222. bool resizeNowToFitThisShape,
  14223. bool maintainShapeProportions,
  14224. bool hasDropShadow);
  14225. void setColours (const Colour& normalColour,
  14226. const Colour& overColour,
  14227. const Colour& downColour);
  14228. void setOutline (const Colour& outlineColour,
  14229. float outlineStrokeWidth);
  14230. juce_UseDebuggingNewOperator
  14231. protected:
  14232. void paintButton (Graphics& g,
  14233. bool isMouseOverButton,
  14234. bool isButtonDown);
  14235. private:
  14236. Colour normalColour, overColour, downColour, outlineColour;
  14237. DropShadowEffect shadow;
  14238. Path shape;
  14239. bool maintainShapeProportions;
  14240. float outlineWidth;
  14241. ShapeButton (const ShapeButton&);
  14242. ShapeButton& operator= (const ShapeButton&);
  14243. };
  14244. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  14245. /*** End of inlined file: juce_ShapeButton.h ***/
  14246. #endif
  14247. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  14248. #endif
  14249. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14250. /*** Start of inlined file: juce_ToggleButton.h ***/
  14251. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14252. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14253. class JUCE_API ToggleButton : public Button
  14254. {
  14255. public:
  14256. ToggleButton (const String& buttonText);
  14257. ~ToggleButton();
  14258. void changeWidthToFitText();
  14259. enum ColourIds
  14260. {
  14261. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  14262. };
  14263. juce_UseDebuggingNewOperator
  14264. protected:
  14265. void paintButton (Graphics& g,
  14266. bool isMouseOverButton,
  14267. bool isButtonDown);
  14268. void colourChanged();
  14269. private:
  14270. ToggleButton (const ToggleButton&);
  14271. ToggleButton& operator= (const ToggleButton&);
  14272. };
  14273. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14274. /*** End of inlined file: juce_ToggleButton.h ***/
  14275. #endif
  14276. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14277. /*** Start of inlined file: juce_ToolbarButton.h ***/
  14278. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14279. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14280. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  14281. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14282. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14283. /*** Start of inlined file: juce_Toolbar.h ***/
  14284. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14285. #define __JUCE_TOOLBAR_JUCEHEADER__
  14286. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  14287. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14288. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14289. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  14290. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14291. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14292. class JUCE_API DragAndDropTarget
  14293. {
  14294. public:
  14295. virtual ~DragAndDropTarget() {}
  14296. virtual bool isInterestedInDragSource (const String& sourceDescription,
  14297. Component* sourceComponent) = 0;
  14298. virtual void itemDragEnter (const String& sourceDescription,
  14299. Component* sourceComponent,
  14300. int x, int y);
  14301. virtual void itemDragMove (const String& sourceDescription,
  14302. Component* sourceComponent,
  14303. int x, int y);
  14304. virtual void itemDragExit (const String& sourceDescription,
  14305. Component* sourceComponent);
  14306. virtual void itemDropped (const String& sourceDescription,
  14307. Component* sourceComponent,
  14308. int x, int y) = 0;
  14309. virtual bool shouldDrawDragImageWhenOver();
  14310. };
  14311. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14312. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  14313. class JUCE_API DragAndDropContainer
  14314. {
  14315. public:
  14316. DragAndDropContainer();
  14317. virtual ~DragAndDropContainer();
  14318. void startDragging (const String& sourceDescription,
  14319. Component* sourceComponent,
  14320. Image* dragImage = 0,
  14321. bool allowDraggingToOtherJuceWindows = false,
  14322. const Point<int>* imageOffsetFromMouse = 0);
  14323. bool isDragAndDropActive() const;
  14324. const String getCurrentDragDescription() const;
  14325. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14326. static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles);
  14327. static bool performExternalDragDropOfText (const String& text);
  14328. juce_UseDebuggingNewOperator
  14329. protected:
  14330. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14331. Component* dragSourceComponent,
  14332. StringArray& files,
  14333. bool& canMoveFiles);
  14334. private:
  14335. friend class DragImageComponent;
  14336. ScopedPointer <Component> dragImageComponent;
  14337. String currentDragDesc;
  14338. };
  14339. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14340. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14341. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14342. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14343. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14344. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14345. private Timer
  14346. {
  14347. public:
  14348. ComponentAnimator();
  14349. ~ComponentAnimator();
  14350. void animateComponent (Component* component,
  14351. const Rectangle<int>& finalPosition,
  14352. int millisecondsToSpendMoving,
  14353. double startSpeed = 1.0,
  14354. double endSpeed = 1.0);
  14355. void cancelAnimation (Component* component,
  14356. bool moveComponentToItsFinalPosition);
  14357. void cancelAllAnimations (bool moveComponentsToTheirFinalPositions);
  14358. const Rectangle<int> getComponentDestination (Component* component);
  14359. bool isAnimating (Component* component) const;
  14360. juce_UseDebuggingNewOperator
  14361. private:
  14362. class AnimationTask;
  14363. Array <AnimationTask*> tasks;
  14364. uint32 lastTime;
  14365. AnimationTask* findTaskFor (Component* component) const;
  14366. void timerCallback();
  14367. };
  14368. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14369. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14370. class ToolbarItemComponent;
  14371. class ToolbarItemFactory;
  14372. class MissingItemsComponent;
  14373. class JUCE_API Toolbar : public Component,
  14374. public DragAndDropContainer,
  14375. public DragAndDropTarget,
  14376. private ButtonListener
  14377. {
  14378. public:
  14379. Toolbar();
  14380. ~Toolbar();
  14381. void setVertical (bool shouldBeVertical);
  14382. bool isVertical() const throw() { return vertical; }
  14383. int getThickness() const throw();
  14384. int getLength() const throw();
  14385. void clear();
  14386. void addItem (ToolbarItemFactory& factory,
  14387. int itemId,
  14388. int insertIndex = -1);
  14389. void removeToolbarItem (int itemIndex);
  14390. int getNumItems() const throw();
  14391. int getItemId (int itemIndex) const throw();
  14392. ToolbarItemComponent* getItemComponent (int itemIndex) const throw();
  14393. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14394. enum ToolbarItemStyle
  14395. {
  14396. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14397. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14398. textOnly /**< Means that the toolbar only display text labels for each item. */
  14399. };
  14400. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14401. void setStyle (const ToolbarItemStyle& newStyle);
  14402. enum CustomisationFlags
  14403. {
  14404. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14405. show the "icons only" option on its choice of toolbar styles. */
  14406. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14407. show the "icons with text" option on its choice of toolbar styles. */
  14408. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14409. show the "text only" option on its choice of toolbar styles. */
  14410. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14411. show a button to reset the toolbar to its default set of items. */
  14412. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14413. };
  14414. void showCustomisationDialog (ToolbarItemFactory& factory,
  14415. int optionFlags = allCustomisationOptionsEnabled);
  14416. void setEditingActive (bool editingEnabled);
  14417. enum ColourIds
  14418. {
  14419. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14420. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14421. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14422. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14423. over them. */
  14424. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14425. held down on them. */
  14426. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14427. when the style is set to iconsWithText or textOnly. */
  14428. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14429. the customisation dialog is active and the mouse moves over them. */
  14430. };
  14431. const String toString() const;
  14432. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14433. const String& savedVersion);
  14434. void paint (Graphics& g);
  14435. void resized();
  14436. void buttonClicked (Button*);
  14437. void mouseDown (const MouseEvent&);
  14438. bool isInterestedInDragSource (const String&, Component*);
  14439. void itemDragMove (const String&, Component*, int, int);
  14440. void itemDragExit (const String&, Component*);
  14441. void itemDropped (const String&, Component*, int, int);
  14442. void updateAllItemPositions (const bool animate);
  14443. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14444. juce_UseDebuggingNewOperator
  14445. private:
  14446. Button* missingItemsButton;
  14447. bool vertical, isEditingActive;
  14448. ToolbarItemStyle toolbarStyle;
  14449. ComponentAnimator animator;
  14450. friend class MissingItemsComponent;
  14451. Array <ToolbarItemComponent*> items;
  14452. friend class ItemDragAndDropOverlayComponent;
  14453. static const char* const toolbarDragDescriptor;
  14454. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14455. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14456. Toolbar (const Toolbar&);
  14457. Toolbar& operator= (const Toolbar&);
  14458. };
  14459. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14460. /*** End of inlined file: juce_Toolbar.h ***/
  14461. class ItemDragAndDropOverlayComponent;
  14462. class JUCE_API ToolbarItemComponent : public Button
  14463. {
  14464. public:
  14465. ToolbarItemComponent (int itemId,
  14466. const String& labelText,
  14467. bool isBeingUsedAsAButton);
  14468. ~ToolbarItemComponent();
  14469. int getItemId() const throw() { return itemId; }
  14470. Toolbar* getToolbar() const;
  14471. bool isToolbarVertical() const;
  14472. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14473. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14474. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14475. virtual bool getToolbarItemSizes (int toolbarThickness,
  14476. bool isToolbarVertical,
  14477. int& preferredSize,
  14478. int& minSize,
  14479. int& maxSize) = 0;
  14480. virtual void paintButtonArea (Graphics& g,
  14481. int width, int height,
  14482. bool isMouseOver, bool isMouseDown) = 0;
  14483. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14484. enum ToolbarEditingMode
  14485. {
  14486. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14487. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14488. customisation mode, and the items can be dragged around. */
  14489. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14490. dragged onto a toolbar to add it to that bar.*/
  14491. };
  14492. void setEditingMode (const ToolbarEditingMode newMode);
  14493. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14494. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14495. void resized();
  14496. juce_UseDebuggingNewOperator
  14497. private:
  14498. friend class Toolbar;
  14499. friend class ItemDragAndDropOverlayComponent;
  14500. const int itemId;
  14501. ToolbarEditingMode mode;
  14502. Toolbar::ToolbarItemStyle toolbarStyle;
  14503. ScopedPointer <Component> overlayComp;
  14504. int dragOffsetX, dragOffsetY;
  14505. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14506. Rectangle<int> contentArea;
  14507. ToolbarItemComponent (const ToolbarItemComponent&);
  14508. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14509. };
  14510. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14511. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14512. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14513. {
  14514. public:
  14515. ToolbarButton (int itemId,
  14516. const String& labelText,
  14517. Drawable* normalImage,
  14518. Drawable* toggledOnImage);
  14519. ~ToolbarButton();
  14520. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14521. int& minSize, int& maxSize);
  14522. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14523. void contentAreaChanged (const Rectangle<int>& newBounds);
  14524. juce_UseDebuggingNewOperator
  14525. private:
  14526. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14527. ToolbarButton (const ToolbarButton&);
  14528. ToolbarButton& operator= (const ToolbarButton&);
  14529. };
  14530. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14531. /*** End of inlined file: juce_ToolbarButton.h ***/
  14532. #endif
  14533. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14534. /*** Start of inlined file: juce_CodeDocument.h ***/
  14535. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14536. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14537. class CodeDocumentLine;
  14538. class JUCE_API CodeDocument
  14539. {
  14540. public:
  14541. CodeDocument();
  14542. ~CodeDocument();
  14543. class JUCE_API Position
  14544. {
  14545. public:
  14546. Position() throw();
  14547. Position (const CodeDocument* ownerDocument,
  14548. int line, int indexInLine) throw();
  14549. Position (const CodeDocument* ownerDocument,
  14550. int charactersFromStartOfDocument) throw();
  14551. Position (const Position& other) throw();
  14552. ~Position() throw();
  14553. Position& operator= (const Position& other) throw();
  14554. bool operator== (const Position& other) const throw();
  14555. bool operator!= (const Position& other) const throw();
  14556. void setPosition (int charactersFromStartOfDocument) throw();
  14557. int getPosition() const throw() { return characterPos; }
  14558. void setLineAndIndex (int newLine, int newIndexInLine) throw();
  14559. int getLineNumber() const throw() { return line; }
  14560. int getIndexInLine() const throw() { return indexInLine; }
  14561. void setPositionMaintained (bool isMaintained) throw();
  14562. void moveBy (int characterDelta) throw();
  14563. const Position movedBy (int characterDelta) const throw();
  14564. const Position movedByLines (int deltaLines) const throw();
  14565. const juce_wchar getCharacter() const throw();
  14566. const String getLineText() const throw();
  14567. private:
  14568. CodeDocument* owner;
  14569. int characterPos, line, indexInLine;
  14570. bool positionMaintained;
  14571. };
  14572. const String getAllContent() const throw();
  14573. const String getTextBetween (const Position& start, const Position& end) const throw();
  14574. const String getLine (int lineIndex) const throw();
  14575. int getNumCharacters() const throw();
  14576. int getNumLines() const throw() { return lines.size(); }
  14577. int getMaximumLineLength() throw();
  14578. void deleteSection (const Position& startPosition, const Position& endPosition);
  14579. void insertText (const Position& position, const String& text);
  14580. void replaceAllContent (const String& newContent);
  14581. bool loadFromStream (InputStream& stream);
  14582. bool writeToStream (OutputStream& stream);
  14583. const String getNewLineCharacters() const throw() { return newLineChars; }
  14584. void setNewLineCharacters (const String& newLine) throw();
  14585. void newTransaction();
  14586. void undo();
  14587. void redo();
  14588. void clearUndoHistory();
  14589. UndoManager& getUndoManager() throw() { return undoManager; }
  14590. void setSavePoint() throw();
  14591. bool hasChangedSinceSavePoint() const throw();
  14592. const Position findWordBreakAfter (const Position& position) const throw();
  14593. const Position findWordBreakBefore (const Position& position) const throw();
  14594. class JUCE_API Listener
  14595. {
  14596. public:
  14597. Listener() {}
  14598. virtual ~Listener() {}
  14599. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14600. const Position& affectedTextEnd) = 0;
  14601. };
  14602. void addListener (Listener* listener) throw();
  14603. void removeListener (Listener* listener) throw();
  14604. class Iterator
  14605. {
  14606. public:
  14607. Iterator (CodeDocument* document);
  14608. Iterator (const Iterator& other);
  14609. Iterator& operator= (const Iterator& other) throw();
  14610. ~Iterator() throw();
  14611. juce_wchar nextChar();
  14612. juce_wchar peekNextChar() const;
  14613. void skip();
  14614. int getPosition() const throw() { return position; }
  14615. void skipWhitespace();
  14616. void skipToEndOfLine();
  14617. int getLine() const throw() { return line; }
  14618. bool isEOF() const throw();
  14619. private:
  14620. CodeDocument* document;
  14621. CodeDocumentLine* currentLine;
  14622. int line, position;
  14623. };
  14624. juce_UseDebuggingNewOperator
  14625. private:
  14626. friend class CodeDocumentInsertAction;
  14627. friend class CodeDocumentDeleteAction;
  14628. friend class Iterator;
  14629. friend class Position;
  14630. OwnedArray <CodeDocumentLine> lines;
  14631. Array <Position*> positionsToMaintain;
  14632. UndoManager undoManager;
  14633. int currentActionIndex, indexOfSavedState;
  14634. int maximumLineLength;
  14635. ListenerList <Listener> listeners;
  14636. String newLineChars;
  14637. void sendListenerChangeMessage (int startLine, int endLine);
  14638. void insert (const String& text, int insertPos, bool undoable);
  14639. void remove (int startPos, int endPos, bool undoable);
  14640. void checkLastLineStatus();
  14641. CodeDocument (const CodeDocument&);
  14642. CodeDocument& operator= (const CodeDocument&);
  14643. };
  14644. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14645. /*** End of inlined file: juce_CodeDocument.h ***/
  14646. #endif
  14647. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14648. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14649. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14650. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14651. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14652. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14653. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14654. class JUCE_API CodeTokeniser
  14655. {
  14656. public:
  14657. CodeTokeniser() {}
  14658. virtual ~CodeTokeniser() {}
  14659. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14660. virtual const StringArray getTokenTypes() = 0;
  14661. virtual const Colour getDefaultColour (int tokenType) = 0;
  14662. juce_UseDebuggingNewOperator
  14663. };
  14664. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14665. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14666. class JUCE_API CodeEditorComponent : public Component,
  14667. public TextInputTarget,
  14668. public Timer,
  14669. public ScrollBarListener,
  14670. public CodeDocument::Listener,
  14671. public AsyncUpdater
  14672. {
  14673. public:
  14674. CodeEditorComponent (CodeDocument& document,
  14675. CodeTokeniser* codeTokeniser);
  14676. ~CodeEditorComponent();
  14677. CodeDocument& getDocument() const throw() { return document; }
  14678. void loadContent (const String& newContent);
  14679. float getCharWidth() const throw() { return charWidth; }
  14680. int getLineHeight() const throw() { return lineHeight; }
  14681. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14682. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14683. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14684. void moveCaretTo (const CodeDocument::Position& newPos, bool selecting);
  14685. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14686. const CodeDocument::Position getPositionAt (int x, int y);
  14687. void cursorLeft (bool moveInWholeWordSteps, bool selecting);
  14688. void cursorRight (bool moveInWholeWordSteps, bool selecting);
  14689. void cursorDown (bool selecting);
  14690. void cursorUp (bool selecting);
  14691. void pageDown (bool selecting);
  14692. void pageUp (bool selecting);
  14693. void scrollDown();
  14694. void scrollUp();
  14695. void scrollToLine (int newFirstLineOnScreen);
  14696. void scrollBy (int deltaLines);
  14697. void scrollToColumn (int newFirstColumnOnScreen);
  14698. void scrollToKeepCaretOnScreen();
  14699. void goToStartOfDocument (bool selecting);
  14700. void goToStartOfLine (bool selecting);
  14701. void goToEndOfDocument (bool selecting);
  14702. void goToEndOfLine (bool selecting);
  14703. void deselectAll();
  14704. void selectAll();
  14705. void insertTextAtCaret (const String& textToInsert);
  14706. void insertTabAtCaret();
  14707. void cut();
  14708. void copy();
  14709. void copyThenCut();
  14710. void paste();
  14711. void backspace (bool moveInWholeWordSteps);
  14712. void deleteForward (bool moveInWholeWordSteps);
  14713. void undo();
  14714. void redo();
  14715. const Range<int> getHighlightedRegion() const;
  14716. void setHighlightedRegion (const Range<int>& newRange);
  14717. const String getTextInRange (const Range<int>& range) const;
  14718. void setTabSize (int numSpacesPerTab,
  14719. bool insertSpacesInsteadOfTabCharacters) throw();
  14720. int getTabSize() const throw() { return spacesPerTab; }
  14721. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14722. void setFont (const Font& newFont);
  14723. const Font& getFont() const throw() { return font; }
  14724. void resetToDefaultColours();
  14725. void setColourForTokenType (int tokenType, const Colour& colour);
  14726. const Colour getColourForTokenType (int tokenType) const throw();
  14727. enum ColourIds
  14728. {
  14729. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14730. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14731. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14732. selected text. */
  14733. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14734. enabled. */
  14735. };
  14736. void setScrollbarThickness (int thickness) throw();
  14737. int getScrollbarThickness() const throw() { return scrollbarThickness; }
  14738. void resized();
  14739. void paint (Graphics& g);
  14740. bool keyPressed (const KeyPress& key);
  14741. void mouseDown (const MouseEvent& e);
  14742. void mouseDrag (const MouseEvent& e);
  14743. void mouseUp (const MouseEvent& e);
  14744. void mouseDoubleClick (const MouseEvent& e);
  14745. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14746. void focusGained (FocusChangeType cause);
  14747. void focusLost (FocusChangeType cause);
  14748. void timerCallback();
  14749. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14750. void handleAsyncUpdate();
  14751. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14752. const CodeDocument::Position& affectedTextEnd);
  14753. bool isTextInputActive() const;
  14754. juce_UseDebuggingNewOperator
  14755. private:
  14756. CodeDocument& document;
  14757. Font font;
  14758. int firstLineOnScreen, gutter, spacesPerTab;
  14759. float charWidth;
  14760. int lineHeight, linesOnScreen, columnsOnScreen;
  14761. int scrollbarThickness, columnToTryToMaintain;
  14762. bool useSpacesForTabs;
  14763. double xOffset;
  14764. CodeDocument::Position caretPos;
  14765. CodeDocument::Position selectionStart, selectionEnd;
  14766. class CaretComponent;
  14767. CaretComponent* caret;
  14768. ScrollBar* verticalScrollBar;
  14769. ScrollBar* horizontalScrollBar;
  14770. enum DragType
  14771. {
  14772. notDragging,
  14773. draggingSelectionStart,
  14774. draggingSelectionEnd
  14775. };
  14776. DragType dragType;
  14777. CodeTokeniser* codeTokeniser;
  14778. Array <Colour> coloursForTokenCategories;
  14779. class CodeEditorLine;
  14780. OwnedArray <CodeEditorLine> lines;
  14781. void rebuildLineTokens();
  14782. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14783. void clearCachedIterators (int firstLineToBeInvalid) throw();
  14784. void updateCachedIterators (int maxLineNum);
  14785. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14786. void moveLineDelta (int delta, bool selecting);
  14787. void updateScrollBars();
  14788. void scrollToLineInternal (int line);
  14789. void scrollToColumnInternal (double column);
  14790. void newTransaction();
  14791. int indexToColumn (int line, int index) const throw();
  14792. int columnToIndex (int line, int column) const throw();
  14793. CodeEditorComponent (const CodeEditorComponent&);
  14794. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14795. };
  14796. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14797. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14798. #endif
  14799. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14800. #endif
  14801. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14802. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14803. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14804. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14805. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14806. {
  14807. public:
  14808. CPlusPlusCodeTokeniser();
  14809. ~CPlusPlusCodeTokeniser();
  14810. enum TokenType
  14811. {
  14812. tokenType_error = 0,
  14813. tokenType_comment,
  14814. tokenType_builtInKeyword,
  14815. tokenType_identifier,
  14816. tokenType_integerLiteral,
  14817. tokenType_floatLiteral,
  14818. tokenType_stringLiteral,
  14819. tokenType_operator,
  14820. tokenType_bracket,
  14821. tokenType_punctuation,
  14822. tokenType_preprocessor
  14823. };
  14824. int readNextToken (CodeDocument::Iterator& source);
  14825. const StringArray getTokenTypes();
  14826. const Colour getDefaultColour (int tokenType);
  14827. juce_UseDebuggingNewOperator
  14828. };
  14829. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14830. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14831. #endif
  14832. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14833. #endif
  14834. #ifndef __JUCE_LABEL_JUCEHEADER__
  14835. #endif
  14836. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14837. #endif
  14838. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14839. /*** Start of inlined file: juce_ProgressBar.h ***/
  14840. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14841. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14842. class JUCE_API ProgressBar : public Component,
  14843. public SettableTooltipClient,
  14844. private Timer
  14845. {
  14846. public:
  14847. explicit ProgressBar (double& progress);
  14848. ~ProgressBar();
  14849. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14850. void setTextToDisplay (const String& text);
  14851. enum ColourIds
  14852. {
  14853. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14854. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14855. classes will probably use variations on this colour. */
  14856. };
  14857. juce_UseDebuggingNewOperator
  14858. protected:
  14859. void paint (Graphics& g);
  14860. void lookAndFeelChanged();
  14861. void visibilityChanged();
  14862. void colourChanged();
  14863. private:
  14864. double& progress;
  14865. double currentValue;
  14866. bool displayPercentage;
  14867. String displayedMessage, currentMessage;
  14868. uint32 lastCallbackTime;
  14869. void timerCallback();
  14870. ProgressBar (const ProgressBar&);
  14871. ProgressBar& operator= (const ProgressBar&);
  14872. };
  14873. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14874. /*** End of inlined file: juce_ProgressBar.h ***/
  14875. #endif
  14876. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14877. /*** Start of inlined file: juce_Slider.h ***/
  14878. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14879. #define __JUCE_SLIDER_JUCEHEADER__
  14880. /*** Start of inlined file: juce_SliderListener.h ***/
  14881. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14882. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14883. class Slider;
  14884. class JUCE_API SliderListener
  14885. {
  14886. public:
  14887. virtual ~SliderListener() {}
  14888. virtual void sliderValueChanged (Slider* slider) = 0;
  14889. virtual void sliderDragStarted (Slider* slider);
  14890. virtual void sliderDragEnded (Slider* slider);
  14891. };
  14892. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14893. /*** End of inlined file: juce_SliderListener.h ***/
  14894. class JUCE_API Slider : public Component,
  14895. public SettableTooltipClient,
  14896. private AsyncUpdater,
  14897. private ButtonListener,
  14898. private LabelListener,
  14899. private Value::Listener
  14900. {
  14901. public:
  14902. explicit Slider (const String& componentName);
  14903. ~Slider();
  14904. enum SliderStyle
  14905. {
  14906. LinearHorizontal, /**< A traditional horizontal slider. */
  14907. LinearVertical, /**< A traditional vertical slider. */
  14908. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14909. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14910. @see setRotaryParameters */
  14911. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14912. @see setRotaryParameters */
  14913. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14914. @see setRotaryParameters */
  14915. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14916. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14917. @see setMinValue, setMaxValue */
  14918. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14919. @see setMinValue, setMaxValue */
  14920. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14921. value, with the current value being somewhere between them.
  14922. @see setMinValue, setMaxValue */
  14923. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14924. value, with the current value being somewhere between them.
  14925. @see setMinValue, setMaxValue */
  14926. };
  14927. void setSliderStyle (SliderStyle newStyle);
  14928. SliderStyle getSliderStyle() const { return style; }
  14929. void setRotaryParameters (float startAngleRadians,
  14930. float endAngleRadians,
  14931. bool stopAtEnd);
  14932. void setMouseDragSensitivity (int distanceForFullScaleDrag);
  14933. void setVelocityBasedMode (bool isVelocityBased);
  14934. bool getVelocityBasedMode() const { return isVelocityBased; }
  14935. void setVelocityModeParameters (double sensitivity = 1.0,
  14936. int threshold = 1,
  14937. double offset = 0.0,
  14938. bool userCanPressKeyToSwapMode = true);
  14939. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14940. int getVelocityThreshold() const { return velocityModeThreshold; }
  14941. double getVelocityOffset() const { return velocityModeOffset; }
  14942. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14943. void setSkewFactor (double factor);
  14944. void setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint);
  14945. double getSkewFactor() const { return skewFactor; }
  14946. enum IncDecButtonMode
  14947. {
  14948. incDecButtonsNotDraggable,
  14949. incDecButtonsDraggable_AutoDirection,
  14950. incDecButtonsDraggable_Horizontal,
  14951. incDecButtonsDraggable_Vertical
  14952. };
  14953. void setIncDecButtonsMode (IncDecButtonMode mode);
  14954. enum TextEntryBoxPosition
  14955. {
  14956. NoTextBox, /**< Doesn't display a text box. */
  14957. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14958. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14959. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14960. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14961. };
  14962. void setTextBoxStyle (TextEntryBoxPosition newPosition,
  14963. bool isReadOnly,
  14964. int textEntryBoxWidth,
  14965. int textEntryBoxHeight);
  14966. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14967. int getTextBoxWidth() const { return textBoxWidth; }
  14968. int getTextBoxHeight() const { return textBoxHeight; }
  14969. void setTextBoxIsEditable (bool shouldBeEditable);
  14970. bool isTextBoxEditable() const { return editableText; }
  14971. void showTextBox();
  14972. void hideTextBox (bool discardCurrentEditorContents);
  14973. void setValue (double newValue,
  14974. bool sendUpdateMessage = true,
  14975. bool sendMessageSynchronously = false);
  14976. double getValue() const;
  14977. Value& getValueObject() { return currentValue; }
  14978. void setRange (double newMinimum,
  14979. double newMaximum,
  14980. double newInterval = 0);
  14981. double getMaximum() const { return maximum; }
  14982. double getMinimum() const { return minimum; }
  14983. double getInterval() const { return interval; }
  14984. double getMinValue() const;
  14985. Value& getMinValueObject() { return valueMin; }
  14986. void setMinValue (double newValue,
  14987. bool sendUpdateMessage = true,
  14988. bool sendMessageSynchronously = false,
  14989. bool allowNudgingOfOtherValues = false);
  14990. double getMaxValue() const;
  14991. Value& getMaxValueObject() { return valueMax; }
  14992. void setMaxValue (double newValue,
  14993. bool sendUpdateMessage = true,
  14994. bool sendMessageSynchronously = false,
  14995. bool allowNudgingOfOtherValues = false);
  14996. void addListener (SliderListener* listener);
  14997. void removeListener (SliderListener* listener);
  14998. void setDoubleClickReturnValue (bool isDoubleClickEnabled,
  14999. double valueToSetOnDoubleClick);
  15000. double getDoubleClickReturnValue (bool& isEnabled) const;
  15001. void setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease);
  15002. void setSliderSnapsToMousePosition (bool shouldSnapToMouse);
  15003. void setPopupDisplayEnabled (bool isEnabled,
  15004. Component* parentComponentToUse);
  15005. void setPopupMenuEnabled (bool menuEnabled);
  15006. void setScrollWheelEnabled (bool enabled);
  15007. int getThumbBeingDragged() const { return sliderBeingDragged; }
  15008. virtual void startedDragging();
  15009. virtual void stoppedDragging();
  15010. virtual void valueChanged();
  15011. /** Callback to indicate that the user has just moved the slider.
  15012. Note - the valueChanged() method has changed its format and now no longer has
  15013. any parameters. Update your code to use the new version.
  15014. This version has been left here with an int as its return value to cause
  15015. a syntax error if you've got existing code that uses the old version.
  15016. */
  15017. virtual int valueChanged (double) { jassertfalse; return 0; }
  15018. virtual double getValueFromText (const String& text);
  15019. virtual const String getTextFromValue (double value);
  15020. void setTextValueSuffix (const String& suffix);
  15021. const String getTextValueSuffix() const;
  15022. virtual double proportionOfLengthToValue (double proportion);
  15023. virtual double valueToProportionOfLength (double value);
  15024. float getPositionOfValue (double value);
  15025. virtual double snapValue (double attemptedValue, bool userIsDragging);
  15026. void updateText();
  15027. bool isHorizontal() const;
  15028. bool isVertical() const;
  15029. enum ColourIds
  15030. {
  15031. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  15032. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  15033. and feel class how this is used. */
  15034. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  15035. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  15036. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  15037. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  15038. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  15039. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  15040. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  15041. };
  15042. juce_UseDebuggingNewOperator
  15043. protected:
  15044. void labelTextChanged (Label*);
  15045. void paint (Graphics& g);
  15046. void resized();
  15047. void mouseDown (const MouseEvent& e);
  15048. void mouseUp (const MouseEvent& e);
  15049. void mouseDrag (const MouseEvent& e);
  15050. void mouseDoubleClick (const MouseEvent& e);
  15051. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  15052. void modifierKeysChanged (const ModifierKeys& modifiers);
  15053. void buttonClicked (Button* button);
  15054. void lookAndFeelChanged();
  15055. void enablementChanged();
  15056. void focusOfChildComponentChanged (FocusChangeType cause);
  15057. void handleAsyncUpdate();
  15058. void colourChanged();
  15059. void valueChanged (Value& value);
  15060. int getNumDecimalPlacesToDisplay() const throw() { return numDecimalPlaces; }
  15061. private:
  15062. ListenerList <SliderListener> listeners;
  15063. Value currentValue, valueMin, valueMax;
  15064. double lastCurrentValue, lastValueMin, lastValueMax;
  15065. double minimum, maximum, interval, doubleClickReturnValue;
  15066. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  15067. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  15068. int velocityModeThreshold;
  15069. float rotaryStart, rotaryEnd;
  15070. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  15071. int mouseDragStartX, mouseDragStartY;
  15072. int sliderRegionStart, sliderRegionSize;
  15073. int sliderBeingDragged;
  15074. int pixelsForFullDragExtent;
  15075. Rectangle<int> sliderRect;
  15076. String textSuffix;
  15077. SliderStyle style;
  15078. TextEntryBoxPosition textBoxPos;
  15079. int textBoxWidth, textBoxHeight;
  15080. IncDecButtonMode incDecButtonMode;
  15081. bool editableText : 1, doubleClickToValue : 1;
  15082. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  15083. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  15084. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  15085. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  15086. Label* valueBox;
  15087. Button* incButton;
  15088. Button* decButton;
  15089. ScopedPointer <Component> popupDisplay;
  15090. Component* parentForPopupDisplay;
  15091. float getLinearSliderPos (double value);
  15092. void restoreMouseIfHidden();
  15093. void sendDragStart();
  15094. void sendDragEnd();
  15095. double constrainedValue (double value) const;
  15096. void triggerChangeMessage (bool synchronous);
  15097. bool incDecDragDirectionIsHorizontal() const;
  15098. Slider (const Slider&);
  15099. Slider& operator= (const Slider&);
  15100. };
  15101. #endif // __JUCE_SLIDER_JUCEHEADER__
  15102. /*** End of inlined file: juce_Slider.h ***/
  15103. #endif
  15104. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  15105. #endif
  15106. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  15107. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  15108. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  15109. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  15110. class TableHeaderComponent;
  15111. class JUCE_API TableHeaderListener
  15112. {
  15113. public:
  15114. TableHeaderListener() {}
  15115. virtual ~TableHeaderListener() {}
  15116. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  15117. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  15118. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  15119. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  15120. int columnIdNowBeingDragged);
  15121. };
  15122. class JUCE_API TableHeaderComponent : public Component,
  15123. private AsyncUpdater
  15124. {
  15125. public:
  15126. TableHeaderComponent();
  15127. ~TableHeaderComponent();
  15128. enum ColumnPropertyFlags
  15129. {
  15130. 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. */
  15131. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  15132. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  15133. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  15134. 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. */
  15135. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  15136. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  15137. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  15138. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  15139. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  15140. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  15141. };
  15142. void addColumn (const String& columnName,
  15143. int columnId,
  15144. int width,
  15145. int minimumWidth = 30,
  15146. int maximumWidth = -1,
  15147. int propertyFlags = defaultFlags,
  15148. int insertIndex = -1);
  15149. void removeColumn (int columnIdToRemove);
  15150. void removeAllColumns();
  15151. int getNumColumns (bool onlyCountVisibleColumns) const;
  15152. const String getColumnName (int columnId) const;
  15153. void setColumnName (int columnId, const String& newName);
  15154. void moveColumn (int columnId, int newVisibleIndex);
  15155. int getColumnWidth (int columnId) const;
  15156. void setColumnWidth (int columnId, int newWidth);
  15157. void setColumnVisible (int columnId, bool shouldBeVisible);
  15158. bool isColumnVisible (int columnId) const;
  15159. void setSortColumnId (int columnId, bool sortForwards);
  15160. int getSortColumnId() const;
  15161. bool isSortedForwards() const;
  15162. void reSortTable();
  15163. int getTotalWidth() const;
  15164. int getIndexOfColumnId (int columnId, bool onlyCountVisibleColumns) const;
  15165. int getColumnIdOfIndex (int index, bool onlyCountVisibleColumns) const;
  15166. const Rectangle<int> getColumnPosition (int index) const;
  15167. int getColumnIdAtX (int xToFind) const;
  15168. void setStretchToFitActive (bool shouldStretchToFit);
  15169. bool isStretchToFitActive() const;
  15170. void resizeAllColumnsToFit (int targetTotalWidth);
  15171. void setPopupMenuActive (bool hasMenu);
  15172. bool isPopupMenuActive() const;
  15173. const String toString() const;
  15174. void restoreFromString (const String& storedVersion);
  15175. void addListener (TableHeaderListener* newListener);
  15176. void removeListener (TableHeaderListener* listenerToRemove);
  15177. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  15178. virtual void addMenuItems (PopupMenu& menu, int columnIdClicked);
  15179. virtual void reactToMenuItem (int menuReturnId, int columnIdClicked);
  15180. void paint (Graphics& g);
  15181. void resized();
  15182. void mouseMove (const MouseEvent&);
  15183. void mouseEnter (const MouseEvent&);
  15184. void mouseExit (const MouseEvent&);
  15185. void mouseDown (const MouseEvent&);
  15186. void mouseDrag (const MouseEvent&);
  15187. void mouseUp (const MouseEvent&);
  15188. const MouseCursor getMouseCursor();
  15189. virtual void showColumnChooserMenu (int columnIdClicked);
  15190. juce_UseDebuggingNewOperator
  15191. private:
  15192. struct ColumnInfo
  15193. {
  15194. String name;
  15195. int id, propertyFlags, width, minimumWidth, maximumWidth;
  15196. double lastDeliberateWidth;
  15197. bool isVisible() const;
  15198. };
  15199. OwnedArray <ColumnInfo> columns;
  15200. Array <TableHeaderListener*> listeners;
  15201. ScopedPointer <Component> dragOverlayComp;
  15202. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  15203. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  15204. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  15205. ColumnInfo* getInfoForId (int columnId) const;
  15206. int visibleIndexToTotalIndex (int visibleIndex) const;
  15207. void sendColumnsChanged();
  15208. void handleAsyncUpdate();
  15209. void beginDrag (const MouseEvent&);
  15210. void endDrag (int finalIndex);
  15211. int getResizeDraggerAt (int mouseX) const;
  15212. void updateColumnUnderMouse (int x, int y);
  15213. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  15214. TableHeaderComponent (const TableHeaderComponent&);
  15215. TableHeaderComponent operator= (const TableHeaderComponent&);
  15216. };
  15217. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  15218. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  15219. #endif
  15220. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  15221. /*** Start of inlined file: juce_TableListBox.h ***/
  15222. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  15223. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  15224. class JUCE_API TableListBoxModel
  15225. {
  15226. public:
  15227. TableListBoxModel() {}
  15228. virtual ~TableListBoxModel() {}
  15229. virtual int getNumRows() = 0;
  15230. virtual void paintRowBackground (Graphics& g,
  15231. int rowNumber,
  15232. int width, int height,
  15233. bool rowIsSelected) = 0;
  15234. virtual void paintCell (Graphics& g,
  15235. int rowNumber,
  15236. int columnId,
  15237. int width, int height,
  15238. bool rowIsSelected) = 0;
  15239. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  15240. Component* existingComponentToUpdate);
  15241. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  15242. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  15243. virtual void backgroundClicked();
  15244. virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
  15245. virtual int getColumnAutoSizeWidth (int columnId);
  15246. virtual const String getCellTooltip (int rowNumber, int columnId);
  15247. virtual void selectedRowsChanged (int lastRowSelected);
  15248. virtual void deleteKeyPressed (int lastRowSelected);
  15249. virtual void returnKeyPressed (int lastRowSelected);
  15250. virtual void listWasScrolled();
  15251. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  15252. };
  15253. class JUCE_API TableListBox : public ListBox,
  15254. private ListBoxModel,
  15255. private TableHeaderListener
  15256. {
  15257. public:
  15258. TableListBox (const String& componentName,
  15259. TableListBoxModel* model);
  15260. ~TableListBox();
  15261. void setModel (TableListBoxModel* newModel);
  15262. TableListBoxModel* getModel() const { return model; }
  15263. TableHeaderComponent* getHeader() const { return header; }
  15264. void setHeaderHeight (int newHeight);
  15265. int getHeaderHeight() const;
  15266. void autoSizeColumn (int columnId);
  15267. void autoSizeAllColumns();
  15268. void setAutoSizeMenuOptionShown (bool shouldBeShown);
  15269. bool isAutoSizeMenuOptionShown() const;
  15270. const Rectangle<int> getCellPosition (int columnId,
  15271. int rowNumber,
  15272. bool relativeToComponentTopLeft) const;
  15273. void scrollToEnsureColumnIsOnscreen (int columnId);
  15274. int getNumRows();
  15275. void paintListBoxItem (int, Graphics&, int, int, bool);
  15276. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15277. void selectedRowsChanged (int lastRowSelected);
  15278. void deleteKeyPressed (int currentSelectedRow);
  15279. void returnKeyPressed (int currentSelectedRow);
  15280. void backgroundClicked();
  15281. void listWasScrolled();
  15282. void tableColumnsChanged (TableHeaderComponent*);
  15283. void tableColumnsResized (TableHeaderComponent*);
  15284. void tableSortOrderChanged (TableHeaderComponent*);
  15285. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  15286. void resized();
  15287. juce_UseDebuggingNewOperator
  15288. private:
  15289. TableHeaderComponent* header;
  15290. TableListBoxModel* model;
  15291. int columnIdNowBeingDragged;
  15292. bool autoSizeOptionsShown;
  15293. void updateColumnComponents() const;
  15294. TableListBox (const TableListBox&);
  15295. TableListBox& operator= (const TableListBox&);
  15296. };
  15297. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  15298. /*** End of inlined file: juce_TableListBox.h ***/
  15299. #endif
  15300. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  15301. #endif
  15302. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  15303. #endif
  15304. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  15305. #endif
  15306. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15307. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  15308. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15309. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15310. class JUCE_API ToolbarItemFactory
  15311. {
  15312. public:
  15313. ToolbarItemFactory();
  15314. virtual ~ToolbarItemFactory();
  15315. enum SpecialItemIds
  15316. {
  15317. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  15318. can be placed between sets of items to break them into groups. */
  15319. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  15320. items.*/
  15321. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  15322. either side of it, filling any available space. */
  15323. };
  15324. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  15325. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  15326. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  15327. };
  15328. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15329. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  15330. #endif
  15331. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15332. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15333. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15334. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15335. class JUCE_API ToolbarItemPalette : public Component,
  15336. public DragAndDropContainer
  15337. {
  15338. public:
  15339. ToolbarItemPalette (ToolbarItemFactory& factory,
  15340. Toolbar* toolbar);
  15341. ~ToolbarItemPalette();
  15342. void resized();
  15343. juce_UseDebuggingNewOperator
  15344. private:
  15345. ToolbarItemFactory& factory;
  15346. Toolbar* toolbar;
  15347. Viewport* viewport;
  15348. friend class Toolbar;
  15349. void replaceComponent (ToolbarItemComponent* comp);
  15350. ToolbarItemPalette (const ToolbarItemPalette&);
  15351. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15352. };
  15353. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15354. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15355. #endif
  15356. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15357. /*** Start of inlined file: juce_TreeView.h ***/
  15358. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15359. #define __JUCE_TREEVIEW_JUCEHEADER__
  15360. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15361. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15362. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15363. class JUCE_API FileDragAndDropTarget
  15364. {
  15365. public:
  15366. virtual ~FileDragAndDropTarget() {}
  15367. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15368. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15369. virtual void fileDragMove (const StringArray& files, int x, int y);
  15370. virtual void fileDragExit (const StringArray& files);
  15371. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15372. };
  15373. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15374. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15375. class TreeView;
  15376. class JUCE_API TreeViewItem
  15377. {
  15378. public:
  15379. TreeViewItem();
  15380. virtual ~TreeViewItem();
  15381. int getNumSubItems() const throw();
  15382. TreeViewItem* getSubItem (int index) const throw();
  15383. void clearSubItems();
  15384. void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
  15385. void removeSubItem (int index, bool deleteItem = true);
  15386. TreeView* getOwnerView() const throw() { return ownerView; }
  15387. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15388. bool isOpen() const throw();
  15389. void setOpen (bool shouldBeOpen);
  15390. bool isSelected() const throw();
  15391. void setSelected (bool shouldBeSelected,
  15392. bool deselectOtherItemsFirst);
  15393. const Rectangle<int> getItemPosition (bool relativeToTreeViewTopLeft) const throw();
  15394. void treeHasChanged() const throw();
  15395. void repaintItem() const;
  15396. int getRowNumberInTree() const throw();
  15397. bool areAllParentsOpen() const throw();
  15398. void setLinesDrawnForSubItems (bool shouldDrawLines) throw();
  15399. virtual bool mightContainSubItems() = 0;
  15400. virtual const String getUniqueName() const;
  15401. virtual void itemOpennessChanged (bool isNowOpen);
  15402. virtual int getItemWidth() const { return -1; }
  15403. virtual int getItemHeight() const { return 20; }
  15404. virtual bool canBeSelected() const { return true; }
  15405. virtual Component* createItemComponent() { return 0; }
  15406. virtual void paintItem (Graphics& g, int width, int height);
  15407. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15408. virtual void itemClicked (const MouseEvent& e);
  15409. virtual void itemDoubleClicked (const MouseEvent& e);
  15410. virtual void itemSelectionChanged (bool isNowSelected);
  15411. virtual const String getTooltip();
  15412. virtual const String getDragSourceDescription();
  15413. virtual bool isInterestedInFileDrag (const StringArray& files);
  15414. virtual void filesDropped (const StringArray& files, int insertIndex);
  15415. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15416. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15417. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15418. XmlElement* getOpennessState() const throw();
  15419. void restoreOpennessState (const XmlElement& xml) throw();
  15420. int getIndexInParent() const throw();
  15421. bool isLastOfSiblings() const throw();
  15422. const String getItemIdentifierString() const;
  15423. juce_UseDebuggingNewOperator
  15424. private:
  15425. TreeView* ownerView;
  15426. TreeViewItem* parentItem;
  15427. OwnedArray <TreeViewItem> subItems;
  15428. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15429. int uid;
  15430. bool selected : 1;
  15431. bool redrawNeeded : 1;
  15432. bool drawLinesInside : 1;
  15433. bool drawsInLeftMargin : 1;
  15434. unsigned int openness : 2;
  15435. friend class TreeView;
  15436. friend class TreeViewContentComponent;
  15437. void updatePositions (int newY);
  15438. int getIndentX() const throw();
  15439. void setOwnerView (TreeView* newOwner) throw();
  15440. void paintRecursively (Graphics& g, int width);
  15441. TreeViewItem* getTopLevelItem() throw();
  15442. TreeViewItem* findItemRecursively (int y) throw();
  15443. TreeViewItem* getDeepestOpenParentItem() throw();
  15444. int getNumRows() const throw();
  15445. TreeViewItem* getItemOnRow (int index) throw();
  15446. void deselectAllRecursively();
  15447. int countSelectedItemsRecursively() const throw();
  15448. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15449. TreeViewItem* getNextVisibleItem (bool recurse) const throw();
  15450. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15451. TreeViewItem (const TreeViewItem&);
  15452. TreeViewItem& operator= (const TreeViewItem&);
  15453. };
  15454. class JUCE_API TreeView : public Component,
  15455. public SettableTooltipClient,
  15456. public FileDragAndDropTarget,
  15457. public DragAndDropTarget,
  15458. private AsyncUpdater
  15459. {
  15460. public:
  15461. TreeView (const String& componentName = String::empty);
  15462. ~TreeView();
  15463. void setRootItem (TreeViewItem* newRootItem);
  15464. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15465. void deleteRootItem();
  15466. void setRootItemVisible (bool shouldBeVisible);
  15467. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15468. void setDefaultOpenness (bool isOpenByDefault);
  15469. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15470. void setMultiSelectEnabled (bool canMultiSelect);
  15471. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15472. void setOpenCloseButtonsVisible (bool shouldBeVisible);
  15473. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15474. void clearSelectedItems();
  15475. int getNumSelectedItems() const throw();
  15476. TreeViewItem* getSelectedItem (int index) const throw();
  15477. int getNumRowsInTree() const;
  15478. TreeViewItem* getItemOnRow (int index) const;
  15479. TreeViewItem* getItemAt (int yPosition) const throw();
  15480. void scrollToKeepItemVisible (TreeViewItem* item);
  15481. Viewport* getViewport() const throw();
  15482. int getIndentSize() const throw() { return indentSize; }
  15483. void setIndentSize (int newIndentSize);
  15484. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15485. XmlElement* getOpennessState (bool alsoIncludeScrollPosition) const;
  15486. void restoreOpennessState (const XmlElement& newState);
  15487. enum ColourIds
  15488. {
  15489. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15490. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15491. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15492. };
  15493. void paint (Graphics& g);
  15494. void resized();
  15495. bool keyPressed (const KeyPress& key);
  15496. void colourChanged();
  15497. void enablementChanged();
  15498. bool isInterestedInFileDrag (const StringArray& files);
  15499. void fileDragEnter (const StringArray& files, int x, int y);
  15500. void fileDragMove (const StringArray& files, int x, int y);
  15501. void fileDragExit (const StringArray& files);
  15502. void filesDropped (const StringArray& files, int x, int y);
  15503. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15504. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15505. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15506. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15507. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15508. juce_UseDebuggingNewOperator
  15509. private:
  15510. friend class TreeViewItem;
  15511. friend class TreeViewContentComponent;
  15512. class TreeViewport;
  15513. TreeViewport* viewport;
  15514. CriticalSection nodeAlterationLock;
  15515. TreeViewItem* rootItem;
  15516. class InsertPointHighlight;
  15517. class TargetGroupHighlight;
  15518. InsertPointHighlight* dragInsertPointHighlight;
  15519. TargetGroupHighlight* dragTargetGroupHighlight;
  15520. int indentSize;
  15521. bool defaultOpenness : 1;
  15522. bool needsRecalculating : 1;
  15523. bool rootItemVisible : 1;
  15524. bool multiSelectEnabled : 1;
  15525. bool openCloseButtonsVisible : 1;
  15526. void itemsChanged() throw();
  15527. void handleAsyncUpdate();
  15528. void moveSelectedRow (int delta);
  15529. void updateButtonUnderMouse (const MouseEvent& e);
  15530. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15531. void hideDragHighlight() throw();
  15532. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15533. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15534. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15535. const StringArray& files, const String& sourceDescription,
  15536. Component* sourceComponent) const throw();
  15537. TreeView (const TreeView&);
  15538. TreeView& operator= (const TreeView&);
  15539. };
  15540. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15541. /*** End of inlined file: juce_TreeView.h ***/
  15542. #endif
  15543. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15544. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15545. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15546. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15547. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15548. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15549. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15550. /*** Start of inlined file: juce_FileFilter.h ***/
  15551. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15552. #define __JUCE_FILEFILTER_JUCEHEADER__
  15553. class JUCE_API FileFilter
  15554. {
  15555. public:
  15556. FileFilter (const String& filterDescription);
  15557. virtual ~FileFilter();
  15558. const String& getDescription() const throw();
  15559. virtual bool isFileSuitable (const File& file) const = 0;
  15560. virtual bool isDirectorySuitable (const File& file) const = 0;
  15561. protected:
  15562. String description;
  15563. };
  15564. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15565. /*** End of inlined file: juce_FileFilter.h ***/
  15566. /*** Start of inlined file: juce_Image.h ***/
  15567. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15568. #define __JUCE_IMAGE_JUCEHEADER__
  15569. class JUCE_API Image
  15570. {
  15571. public:
  15572. enum PixelFormat
  15573. {
  15574. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15575. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15576. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15577. };
  15578. Image (PixelFormat format,
  15579. int imageWidth,
  15580. int imageHeight,
  15581. bool clearImage);
  15582. Image (const Image& other);
  15583. virtual ~Image();
  15584. static Image* createNativeImage (PixelFormat format,
  15585. int imageWidth,
  15586. int imageHeight,
  15587. bool clearImage);
  15588. int getWidth() const throw() { return imageWidth; }
  15589. int getHeight() const throw() { return imageHeight; }
  15590. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15591. PixelFormat getFormat() const throw() { return format; }
  15592. bool isARGB() const throw() { return format == ARGB; }
  15593. bool isRGB() const throw() { return format == RGB; }
  15594. bool hasAlphaChannel() const throw() { return format != RGB; }
  15595. virtual void clear (int x, int y, int w, int h,
  15596. const Colour& colourToClearTo = Colour (0x00000000));
  15597. virtual Image* createCopy (int newWidth = -1,
  15598. int newHeight = -1,
  15599. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15600. virtual Image* createCopyOfAlphaChannel() const;
  15601. virtual const Colour getPixelAt (int x, int y) const;
  15602. virtual void setPixelAt (int x, int y, const Colour& colour);
  15603. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15604. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15605. virtual void desaturate();
  15606. class BitmapData
  15607. {
  15608. public:
  15609. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15610. BitmapData (const Image& image, int x, int y, int w, int h);
  15611. ~BitmapData();
  15612. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15613. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15614. uint8* data;
  15615. int lineStride, pixelStride, width, height;
  15616. private:
  15617. BitmapData (const BitmapData&);
  15618. BitmapData& operator= (const BitmapData&);
  15619. };
  15620. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15621. const uint8* sourcePixelData, int sourceLineStride);
  15622. virtual void moveImageSection (int destX, int destY,
  15623. int sourceX, int sourceY,
  15624. int width, int height);
  15625. void createSolidAreaMask (RectangleList& result,
  15626. float alphaThreshold = 0.5f) const;
  15627. juce_UseDebuggingNewOperator
  15628. virtual LowLevelGraphicsContext* createLowLevelContext();
  15629. protected:
  15630. friend class BitmapData;
  15631. const PixelFormat format;
  15632. const int imageWidth, imageHeight;
  15633. Image (PixelFormat format,
  15634. int imageWidth,
  15635. int imageHeight);
  15636. int pixelStride, lineStride;
  15637. HeapBlock <uint8> imageDataAllocated;
  15638. uint8* imageData;
  15639. private:
  15640. Image& operator= (const Image&);
  15641. };
  15642. #endif // __JUCE_IMAGE_JUCEHEADER__
  15643. /*** End of inlined file: juce_Image.h ***/
  15644. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15645. public TimeSliceClient
  15646. {
  15647. public:
  15648. DirectoryContentsList (const FileFilter* fileFilter,
  15649. TimeSliceThread& threadToUse);
  15650. ~DirectoryContentsList();
  15651. void setDirectory (const File& directory,
  15652. bool includeDirectories,
  15653. bool includeFiles);
  15654. const File& getDirectory() const;
  15655. void clear();
  15656. void refresh();
  15657. bool isStillLoading() const;
  15658. void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
  15659. bool ignoresHiddenFiles() const;
  15660. struct FileInfo
  15661. {
  15662. String filename;
  15663. int64 fileSize;
  15664. Time modificationTime;
  15665. Time creationTime;
  15666. bool isDirectory;
  15667. bool isReadOnly;
  15668. };
  15669. int getNumFiles() const;
  15670. bool getFileInfo (int index, FileInfo& resultInfo) const;
  15671. const File getFile (int index) const;
  15672. const FileFilter* getFilter() const { return fileFilter; }
  15673. bool useTimeSlice();
  15674. TimeSliceThread& getTimeSliceThread() { return thread; }
  15675. static int compareElements (const DirectoryContentsList::FileInfo* first,
  15676. const DirectoryContentsList::FileInfo* second);
  15677. juce_UseDebuggingNewOperator
  15678. private:
  15679. File root;
  15680. const FileFilter* fileFilter;
  15681. TimeSliceThread& thread;
  15682. int fileTypeFlags;
  15683. CriticalSection fileListLock;
  15684. OwnedArray <FileInfo> files;
  15685. ScopedPointer <DirectoryIterator> fileFindHandle;
  15686. bool volatile shouldStop;
  15687. void changed();
  15688. bool checkNextFile (bool& hasChanged);
  15689. bool addFile (const File& file, bool isDir,
  15690. const int64 fileSize, const Time& modTime,
  15691. const Time& creationTime, bool isReadOnly);
  15692. void setTypeFlags (int newFlags);
  15693. DirectoryContentsList (const DirectoryContentsList&);
  15694. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15695. };
  15696. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15697. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15698. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15699. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15700. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15701. class JUCE_API FileBrowserListener
  15702. {
  15703. public:
  15704. virtual ~FileBrowserListener();
  15705. virtual void selectionChanged() = 0;
  15706. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15707. virtual void fileDoubleClicked (const File& file) = 0;
  15708. };
  15709. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15710. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15711. class JUCE_API DirectoryContentsDisplayComponent
  15712. {
  15713. public:
  15714. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15715. virtual ~DirectoryContentsDisplayComponent();
  15716. virtual int getNumSelectedFiles() const = 0;
  15717. virtual const File getSelectedFile (int index) const = 0;
  15718. virtual void deselectAllFiles() = 0;
  15719. virtual void scrollToTop() = 0;
  15720. void addListener (FileBrowserListener* listener);
  15721. void removeListener (FileBrowserListener* listener);
  15722. enum ColourIds
  15723. {
  15724. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15725. textColourId = 0x1000541, /**< The colour for the text. */
  15726. };
  15727. void sendSelectionChangeMessage();
  15728. void sendDoubleClickMessage (const File& file);
  15729. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15730. juce_UseDebuggingNewOperator
  15731. protected:
  15732. DirectoryContentsList& fileList;
  15733. ListenerList <FileBrowserListener> listeners;
  15734. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15735. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15736. };
  15737. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15738. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15739. #endif
  15740. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15741. #endif
  15742. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15743. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15744. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15745. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15746. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15747. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15748. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15749. class JUCE_API FilePreviewComponent : public Component
  15750. {
  15751. public:
  15752. FilePreviewComponent();
  15753. ~FilePreviewComponent();
  15754. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15755. juce_UseDebuggingNewOperator
  15756. private:
  15757. FilePreviewComponent (const FilePreviewComponent&);
  15758. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15759. };
  15760. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15761. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15762. class JUCE_API FileBrowserComponent : public Component,
  15763. public ChangeBroadcaster,
  15764. private FileBrowserListener,
  15765. private TextEditorListener,
  15766. private ButtonListener,
  15767. private ComboBoxListener,
  15768. private FileFilter
  15769. {
  15770. public:
  15771. enum FileChooserFlags
  15772. {
  15773. openMode = 1, /**< specifies that the component should allow the user to
  15774. choose an existing file with the intention of opening it. */
  15775. saveMode = 2, /**< specifies that the component should allow the user to specify
  15776. the name of a file that will be used to save something. */
  15777. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15778. conjunction with canSelectDirectories). */
  15779. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15780. conjuction with canSelectFiles). */
  15781. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15782. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15783. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15784. };
  15785. FileBrowserComponent (int flags,
  15786. const File& initialFileOrDirectory,
  15787. const FileFilter* fileFilter,
  15788. FilePreviewComponent* previewComp);
  15789. ~FileBrowserComponent();
  15790. int getNumSelectedFiles() const throw();
  15791. const File getSelectedFile (int index) const throw();
  15792. void deselectAllFiles();
  15793. bool currentFileIsValid() const;
  15794. const File getHighlightedFile() const throw();
  15795. const File getRoot() const;
  15796. void setRoot (const File& newRootDirectory);
  15797. void goUp();
  15798. void refresh();
  15799. virtual const String getActionVerb() const;
  15800. bool isSaveMode() const throw();
  15801. void addListener (FileBrowserListener* listener);
  15802. void removeListener (FileBrowserListener* listener);
  15803. void resized();
  15804. void buttonClicked (Button* b);
  15805. void comboBoxChanged (ComboBox*);
  15806. void textEditorTextChanged (TextEditor& editor);
  15807. void textEditorReturnKeyPressed (TextEditor& editor);
  15808. void textEditorEscapeKeyPressed (TextEditor& editor);
  15809. void textEditorFocusLost (TextEditor& editor);
  15810. bool keyPressed (const KeyPress& key);
  15811. void selectionChanged();
  15812. void fileClicked (const File& f, const MouseEvent& e);
  15813. void fileDoubleClicked (const File& f);
  15814. bool isFileSuitable (const File& file) const;
  15815. bool isDirectorySuitable (const File&) const;
  15816. FilePreviewComponent* getPreviewComponent() const throw();
  15817. juce_UseDebuggingNewOperator
  15818. protected:
  15819. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15820. private:
  15821. ScopedPointer <DirectoryContentsList> fileList;
  15822. const FileFilter* fileFilter;
  15823. int flags;
  15824. File currentRoot;
  15825. Array<File> chosenFiles;
  15826. ListenerList <FileBrowserListener> listeners;
  15827. DirectoryContentsDisplayComponent* fileListComponent;
  15828. FilePreviewComponent* previewComp;
  15829. ComboBox* currentPathBox;
  15830. TextEditor* filenameBox;
  15831. Button* goUpButton;
  15832. TimeSliceThread thread;
  15833. void sendListenerChangeMessage();
  15834. bool isFileOrDirSuitable (const File& f) const;
  15835. FileBrowserComponent (const FileBrowserComponent&);
  15836. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15837. };
  15838. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15839. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15840. #endif
  15841. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15842. #endif
  15843. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15844. /*** Start of inlined file: juce_FileChooser.h ***/
  15845. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15846. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15847. class JUCE_API FileChooser
  15848. {
  15849. public:
  15850. FileChooser (const String& dialogBoxTitle,
  15851. const File& initialFileOrDirectory = File::nonexistent,
  15852. const String& filePatternsAllowed = String::empty,
  15853. bool useOSNativeDialogBox = true);
  15854. ~FileChooser();
  15855. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15856. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15857. bool browseForFileToSave (bool warnAboutOverwritingExistingFiles);
  15858. bool browseForDirectory();
  15859. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15860. const File getResult() const;
  15861. const Array<File>& getResults() const;
  15862. juce_UseDebuggingNewOperator
  15863. private:
  15864. String title, filters;
  15865. File startingFile;
  15866. Array<File> results;
  15867. bool useNativeDialogBox;
  15868. bool showDialog (bool selectsDirectories, bool selectsFiles, bool isSave,
  15869. bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15870. FilePreviewComponent* previewComponent);
  15871. static void showPlatformDialog (Array<File>& results, const String& title, const File& file,
  15872. const String& filters, bool selectsDirectories, bool selectsFiles,
  15873. bool isSave, bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15874. FilePreviewComponent* previewComponent);
  15875. };
  15876. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15877. /*** End of inlined file: juce_FileChooser.h ***/
  15878. #endif
  15879. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15880. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15881. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15882. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15883. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15884. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15885. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15886. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15887. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15888. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15889. /*** Start of inlined file: juce_DropShadower.h ***/
  15890. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15891. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15892. class JUCE_API DropShadower : public ComponentListener
  15893. {
  15894. public:
  15895. DropShadower (float alpha = 0.5f,
  15896. int xOffset = 1,
  15897. int yOffset = 5,
  15898. float blurRadius = 10.0f);
  15899. virtual ~DropShadower();
  15900. void setOwner (Component* componentToFollow);
  15901. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15902. void componentBroughtToFront (Component& component);
  15903. void componentChildrenChanged (Component& component);
  15904. void componentParentHierarchyChanged (Component& component);
  15905. void componentVisibilityChanged (Component& component);
  15906. juce_UseDebuggingNewOperator
  15907. private:
  15908. Component* owner;
  15909. int numShadows;
  15910. Component* shadowWindows[4];
  15911. Image* shadowImageSections[12];
  15912. const int shadowEdge, xOffset, yOffset;
  15913. const float alpha, blurRadius;
  15914. bool inDestructor, reentrant;
  15915. void updateShadows();
  15916. void setShadowImage (Image* const src,
  15917. const int num,
  15918. const int w, const int h,
  15919. const int sx, const int sy);
  15920. void bringShadowWindowsToFront();
  15921. void deleteShadowWindows();
  15922. DropShadower (const DropShadower&);
  15923. DropShadower& operator= (const DropShadower&);
  15924. };
  15925. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15926. /*** End of inlined file: juce_DropShadower.h ***/
  15927. class JUCE_API TopLevelWindow : public Component
  15928. {
  15929. public:
  15930. TopLevelWindow (const String& name, bool addToDesktop);
  15931. ~TopLevelWindow();
  15932. bool isActiveWindow() const throw() { return windowIsActive_; }
  15933. void centreAroundComponent (Component* componentToCentreAround,
  15934. int width, int height);
  15935. void setDropShadowEnabled (bool useShadow);
  15936. void setUsingNativeTitleBar (bool useNativeTitleBar);
  15937. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15938. static int getNumTopLevelWindows() throw();
  15939. static TopLevelWindow* getTopLevelWindow (int index) throw();
  15940. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15941. juce_UseDebuggingNewOperator
  15942. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15943. protected:
  15944. virtual void activeWindowStatusChanged();
  15945. void focusOfChildComponentChanged (FocusChangeType cause);
  15946. void parentHierarchyChanged();
  15947. void visibilityChanged();
  15948. virtual int getDesktopWindowStyleFlags() const;
  15949. void recreateDesktopWindow();
  15950. private:
  15951. friend class TopLevelWindowManager;
  15952. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15953. ScopedPointer <DropShadower> shadower;
  15954. void setWindowActive (bool isNowActive);
  15955. TopLevelWindow (const TopLevelWindow&);
  15956. TopLevelWindow& operator= (const TopLevelWindow&);
  15957. };
  15958. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15959. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15960. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15961. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15962. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15963. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15964. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15965. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15966. class JUCE_API ComponentBoundsConstrainer
  15967. {
  15968. public:
  15969. ComponentBoundsConstrainer() throw();
  15970. virtual ~ComponentBoundsConstrainer();
  15971. void setMinimumWidth (int minimumWidth) throw();
  15972. int getMinimumWidth() const throw() { return minW; }
  15973. void setMaximumWidth (int maximumWidth) throw();
  15974. int getMaximumWidth() const throw() { return maxW; }
  15975. void setMinimumHeight (int minimumHeight) throw();
  15976. int getMinimumHeight() const throw() { return minH; }
  15977. void setMaximumHeight (int maximumHeight) throw();
  15978. int getMaximumHeight() const throw() { return maxH; }
  15979. void setMinimumSize (int minimumWidth,
  15980. int minimumHeight) throw();
  15981. void setMaximumSize (int maximumWidth,
  15982. int maximumHeight) throw();
  15983. void setSizeLimits (int minimumWidth,
  15984. int minimumHeight,
  15985. int maximumWidth,
  15986. int maximumHeight) throw();
  15987. void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
  15988. int minimumWhenOffTheLeft,
  15989. int minimumWhenOffTheBottom,
  15990. int minimumWhenOffTheRight) throw();
  15991. void setFixedAspectRatio (double widthOverHeight) throw();
  15992. double getFixedAspectRatio() const throw();
  15993. virtual void checkBounds (Rectangle<int>& bounds,
  15994. const Rectangle<int>& previousBounds,
  15995. const Rectangle<int>& limits,
  15996. bool isStretchingTop,
  15997. bool isStretchingLeft,
  15998. bool isStretchingBottom,
  15999. bool isStretchingRight);
  16000. virtual void resizeStart();
  16001. virtual void resizeEnd();
  16002. void setBoundsForComponent (Component* const component,
  16003. const Rectangle<int>& bounds,
  16004. bool isStretchingTop,
  16005. bool isStretchingLeft,
  16006. bool isStretchingBottom,
  16007. bool isStretchingRight);
  16008. void checkComponentBounds (Component* component);
  16009. virtual void applyBoundsToComponent (Component* component,
  16010. const Rectangle<int>& bounds);
  16011. juce_UseDebuggingNewOperator
  16012. private:
  16013. int minW, maxW, minH, maxH;
  16014. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  16015. double aspectRatio;
  16016. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  16017. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  16018. };
  16019. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16020. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  16021. class JUCE_API ComponentDragger
  16022. {
  16023. public:
  16024. ComponentDragger();
  16025. virtual ~ComponentDragger();
  16026. void startDraggingComponent (Component* const componentToDrag,
  16027. ComponentBoundsConstrainer* constrainer);
  16028. void dragComponent (Component* const componentToDrag,
  16029. const MouseEvent& e);
  16030. juce_UseDebuggingNewOperator
  16031. private:
  16032. ComponentBoundsConstrainer* constrainer;
  16033. Point<int> originalPos;
  16034. ComponentDragger (const ComponentDragger&);
  16035. ComponentDragger& operator= (const ComponentDragger&);
  16036. };
  16037. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  16038. /*** End of inlined file: juce_ComponentDragger.h ***/
  16039. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  16040. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16041. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16042. class JUCE_API ResizableBorderComponent : public Component
  16043. {
  16044. public:
  16045. ResizableBorderComponent (Component* componentToResize,
  16046. ComponentBoundsConstrainer* constrainer);
  16047. ~ResizableBorderComponent();
  16048. void setBorderThickness (const BorderSize& newBorderSize);
  16049. const BorderSize getBorderThickness() const;
  16050. class Zone
  16051. {
  16052. public:
  16053. enum Zones
  16054. {
  16055. centre = 0,
  16056. left = 1,
  16057. top = 2,
  16058. right = 4,
  16059. bottom = 8
  16060. };
  16061. explicit Zone (int zoneFlags = 0) throw();
  16062. Zone (const Zone& other) throw();
  16063. Zone& operator= (const Zone& other) throw();
  16064. bool operator== (const Zone& other) const throw();
  16065. bool operator!= (const Zone& other) const throw();
  16066. static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
  16067. const BorderSize& border,
  16068. const Point<int>& position);
  16069. const MouseCursor getMouseCursor() const throw();
  16070. bool isDraggingWholeObject() const throw() { return zone == centre; }
  16071. bool isDraggingLeftEdge() const throw() { return (zone & left) != 0; }
  16072. bool isDraggingRightEdge() const throw() { return (zone & right) != 0; }
  16073. bool isDraggingTopEdge() const throw() { return (zone & top) != 0; }
  16074. bool isDraggingBottomEdge() const throw() { return (zone & bottom) != 0; }
  16075. const Rectangle<int> resizeRectangleBy (Rectangle<int> original,
  16076. const Point<int>& distance) const throw();
  16077. const Rectangle<float> resizeRectangleBy (Rectangle<float> original,
  16078. const Point<float>& distance) const throw();
  16079. int getZoneFlags() const throw() { return zone; }
  16080. private:
  16081. int zone;
  16082. };
  16083. juce_UseDebuggingNewOperator
  16084. protected:
  16085. void paint (Graphics& g);
  16086. void mouseEnter (const MouseEvent& e);
  16087. void mouseMove (const MouseEvent& e);
  16088. void mouseDown (const MouseEvent& e);
  16089. void mouseDrag (const MouseEvent& e);
  16090. void mouseUp (const MouseEvent& e);
  16091. bool hitTest (int x, int y);
  16092. private:
  16093. Component::SafePointer<Component> component;
  16094. ComponentBoundsConstrainer* constrainer;
  16095. BorderSize borderSize;
  16096. Rectangle<int> originalBounds;
  16097. Zone mouseZone;
  16098. void updateMouseZone (const MouseEvent& e);
  16099. ResizableBorderComponent (const ResizableBorderComponent&);
  16100. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  16101. };
  16102. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16103. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  16104. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  16105. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16106. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16107. class JUCE_API ResizableCornerComponent : public Component
  16108. {
  16109. public:
  16110. ResizableCornerComponent (Component* componentToResize,
  16111. ComponentBoundsConstrainer* constrainer);
  16112. ~ResizableCornerComponent();
  16113. juce_UseDebuggingNewOperator
  16114. protected:
  16115. void paint (Graphics& g);
  16116. void mouseDown (const MouseEvent& e);
  16117. void mouseDrag (const MouseEvent& e);
  16118. void mouseUp (const MouseEvent& e);
  16119. bool hitTest (int x, int y);
  16120. private:
  16121. Component::SafePointer<Component> component;
  16122. ComponentBoundsConstrainer* constrainer;
  16123. Rectangle<int> originalBounds;
  16124. ResizableCornerComponent (const ResizableCornerComponent&);
  16125. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  16126. };
  16127. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16128. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  16129. class JUCE_API ResizableWindow : public TopLevelWindow
  16130. {
  16131. public:
  16132. ResizableWindow (const String& name,
  16133. bool addToDesktop);
  16134. ResizableWindow (const String& name,
  16135. const Colour& backgroundColour,
  16136. bool addToDesktop);
  16137. ~ResizableWindow();
  16138. const Colour getBackgroundColour() const throw();
  16139. void setBackgroundColour (const Colour& newColour);
  16140. void setResizable (bool shouldBeResizable,
  16141. bool useBottomRightCornerResizer);
  16142. bool isResizable() const throw();
  16143. void setResizeLimits (int newMinimumWidth,
  16144. int newMinimumHeight,
  16145. int newMaximumWidth,
  16146. int newMaximumHeight) throw();
  16147. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  16148. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  16149. void setBoundsConstrained (const Rectangle<int>& bounds);
  16150. bool isFullScreen() const;
  16151. void setFullScreen (bool shouldBeFullScreen);
  16152. bool isMinimised() const;
  16153. void setMinimised (bool shouldMinimise);
  16154. const String getWindowStateAsString();
  16155. bool restoreWindowStateFromString (const String& previousState);
  16156. Component* getContentComponent() const throw() { return contentComponent; }
  16157. void setContentComponent (Component* newContentComponent,
  16158. bool deleteOldOne = true,
  16159. bool resizeToFit = false);
  16160. void setContentComponentSize (int width, int height);
  16161. enum ColourIds
  16162. {
  16163. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  16164. };
  16165. juce_UseDebuggingNewOperator
  16166. protected:
  16167. void paint (Graphics& g);
  16168. void moved();
  16169. void resized();
  16170. void mouseDown (const MouseEvent& e);
  16171. void mouseDrag (const MouseEvent& e);
  16172. void lookAndFeelChanged();
  16173. void childBoundsChanged (Component* child);
  16174. void parentSizeChanged();
  16175. void visibilityChanged();
  16176. void activeWindowStatusChanged();
  16177. int getDesktopWindowStyleFlags() const;
  16178. virtual const BorderSize getBorderThickness();
  16179. virtual const BorderSize getContentComponentBorder();
  16180. #if JUCE_DEBUG
  16181. void addChildComponent (Component* child, int zOrder = -1);
  16182. void addAndMakeVisible (Component* child, int zOrder = -1);
  16183. #endif
  16184. ScopedPointer <ResizableCornerComponent> resizableCorner;
  16185. ScopedPointer <ResizableBorderComponent> resizableBorder;
  16186. private:
  16187. ScopedPointer <Component> contentComponent;
  16188. bool resizeToFitContent, fullscreen;
  16189. ComponentDragger dragger;
  16190. Rectangle<int> lastNonFullScreenPos;
  16191. ComponentBoundsConstrainer defaultConstrainer;
  16192. ComponentBoundsConstrainer* constrainer;
  16193. #if JUCE_DEBUG
  16194. bool hasBeenResized;
  16195. #endif
  16196. void updateLastPos();
  16197. ResizableWindow (const ResizableWindow&);
  16198. ResizableWindow& operator= (const ResizableWindow&);
  16199. // (xxx remove these eventually)
  16200. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  16201. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  16202. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  16203. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  16204. };
  16205. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  16206. /*** End of inlined file: juce_ResizableWindow.h ***/
  16207. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  16208. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16209. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16210. class JUCE_API PositionedGlyph
  16211. {
  16212. public:
  16213. juce_wchar getCharacter() const { return character; }
  16214. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  16215. float getLeft() const { return x; }
  16216. float getRight() const { return x + w; }
  16217. float getBaselineY() const { return y; }
  16218. float getTop() const { return y - font.getAscent(); }
  16219. float getBottom() const { return y + font.getDescent(); }
  16220. const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
  16221. void moveBy (float deltaX, float deltaY);
  16222. void draw (const Graphics& g) const;
  16223. void draw (const Graphics& g, const AffineTransform& transform) const;
  16224. void createPath (Path& path) const;
  16225. bool hitTest (float x, float y) const;
  16226. juce_UseDebuggingNewOperator
  16227. private:
  16228. friend class GlyphArrangement;
  16229. float x, y, w;
  16230. Font font;
  16231. juce_wchar character;
  16232. int glyph;
  16233. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  16234. PositionedGlyph (const PositionedGlyph& other);
  16235. };
  16236. class JUCE_API GlyphArrangement
  16237. {
  16238. public:
  16239. GlyphArrangement();
  16240. GlyphArrangement (const GlyphArrangement& other);
  16241. GlyphArrangement& operator= (const GlyphArrangement& other);
  16242. ~GlyphArrangement();
  16243. int getNumGlyphs() const throw() { return glyphs.size(); }
  16244. PositionedGlyph& getGlyph (int index) const;
  16245. void clear();
  16246. void addLineOfText (const Font& font,
  16247. const String& text,
  16248. float x, float y);
  16249. void addCurtailedLineOfText (const Font& font,
  16250. const String& text,
  16251. float x, float y,
  16252. float maxWidthPixels,
  16253. bool useEllipsis);
  16254. void addJustifiedText (const Font& font,
  16255. const String& text,
  16256. float x, float y,
  16257. float maxLineWidth,
  16258. const Justification& horizontalLayout);
  16259. void addFittedText (const Font& font,
  16260. const String& text,
  16261. float x, float y, float width, float height,
  16262. const Justification& layout,
  16263. int maximumLinesToUse,
  16264. float minimumHorizontalScale = 0.7f);
  16265. void addGlyphArrangement (const GlyphArrangement& other);
  16266. void draw (const Graphics& g) const;
  16267. void draw (const Graphics& g, const AffineTransform& transform) const;
  16268. void createPath (Path& path) const;
  16269. int findGlyphIndexAt (float x, float y) const;
  16270. const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
  16271. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  16272. float deltaX, float deltaY);
  16273. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  16274. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  16275. float horizontalScaleFactor);
  16276. void justifyGlyphs (int startIndex, int numGlyphs,
  16277. float x, float y, float width, float height,
  16278. const Justification& justification);
  16279. juce_UseDebuggingNewOperator
  16280. private:
  16281. OwnedArray <PositionedGlyph> glyphs;
  16282. int insertEllipsis (const Font& font, float maxXPos, int startIndex, int endIndex);
  16283. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  16284. const Justification& justification, float minimumHorizontalScale);
  16285. void spreadOutLine (int start, int numGlyphs, float targetWidth);
  16286. };
  16287. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16288. /*** End of inlined file: juce_GlyphArrangement.h ***/
  16289. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  16290. public ButtonListener,
  16291. public FileBrowserListener
  16292. {
  16293. public:
  16294. FileChooserDialogBox (const String& title,
  16295. const String& instructions,
  16296. FileBrowserComponent& browserComponent,
  16297. bool warnAboutOverwritingExistingFiles,
  16298. const Colour& backgroundColour);
  16299. ~FileChooserDialogBox();
  16300. bool show (int width = 0,int height = 0);
  16301. enum ColourIds
  16302. {
  16303. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  16304. };
  16305. void buttonClicked (Button* button);
  16306. void closeButtonPressed();
  16307. void selectionChanged();
  16308. void fileClicked (const File& file, const MouseEvent& e);
  16309. void fileDoubleClicked (const File& file);
  16310. juce_UseDebuggingNewOperator
  16311. private:
  16312. class ContentComponent : public Component
  16313. {
  16314. public:
  16315. ContentComponent();
  16316. ~ContentComponent();
  16317. void paint (Graphics& g);
  16318. void resized();
  16319. String instructions;
  16320. GlyphArrangement text;
  16321. FileBrowserComponent* chooserComponent;
  16322. FilePreviewComponent* previewComponent;
  16323. TextButton* okButton;
  16324. TextButton* cancelButton;
  16325. };
  16326. ContentComponent* content;
  16327. const bool warnAboutOverwritingExistingFiles;
  16328. FileChooserDialogBox (const FileChooserDialogBox&);
  16329. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  16330. };
  16331. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  16332. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  16333. #endif
  16334. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  16335. #endif
  16336. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16337. /*** Start of inlined file: juce_FileListComponent.h ***/
  16338. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16339. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16340. class JUCE_API FileListComponent : public ListBox,
  16341. public DirectoryContentsDisplayComponent,
  16342. private ListBoxModel,
  16343. private ChangeListener
  16344. {
  16345. public:
  16346. FileListComponent (DirectoryContentsList& listToShow);
  16347. ~FileListComponent();
  16348. int getNumSelectedFiles() const;
  16349. const File getSelectedFile (int index = 0) const;
  16350. void deselectAllFiles();
  16351. void scrollToTop();
  16352. void changeListenerCallback (void*);
  16353. int getNumRows();
  16354. void paintListBoxItem (int, Graphics&, int, int, bool);
  16355. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16356. void selectedRowsChanged (int lastRowSelected);
  16357. void deleteKeyPressed (int currentSelectedRow);
  16358. void returnKeyPressed (int currentSelectedRow);
  16359. juce_UseDebuggingNewOperator
  16360. private:
  16361. FileListComponent (const FileListComponent&);
  16362. FileListComponent& operator= (const FileListComponent&);
  16363. File lastDirectory;
  16364. };
  16365. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16366. /*** End of inlined file: juce_FileListComponent.h ***/
  16367. #endif
  16368. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16369. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16370. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16371. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16372. class FilenameComponent;
  16373. class JUCE_API FilenameComponentListener
  16374. {
  16375. public:
  16376. virtual ~FilenameComponentListener() {}
  16377. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16378. };
  16379. class JUCE_API FilenameComponent : public Component,
  16380. public SettableTooltipClient,
  16381. public FileDragAndDropTarget,
  16382. private AsyncUpdater,
  16383. private ButtonListener,
  16384. private ComboBoxListener
  16385. {
  16386. public:
  16387. FilenameComponent (const String& name,
  16388. const File& currentFile,
  16389. bool canEditFilename,
  16390. bool isDirectory,
  16391. bool isForSaving,
  16392. const String& fileBrowserWildcard,
  16393. const String& enforcedSuffix,
  16394. const String& textWhenNothingSelected);
  16395. ~FilenameComponent();
  16396. const File getCurrentFile() const;
  16397. void setCurrentFile (File newFile,
  16398. bool addToRecentlyUsedList,
  16399. bool sendChangeNotification = true);
  16400. void setFilenameIsEditable (bool shouldBeEditable);
  16401. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16402. const StringArray getRecentlyUsedFilenames() const;
  16403. void setRecentlyUsedFilenames (const StringArray& filenames);
  16404. void addRecentlyUsedFile (const File& file);
  16405. void setMaxNumberOfRecentFiles (int newMaximum);
  16406. void setBrowseButtonText (const String& browseButtonText);
  16407. void addListener (FilenameComponentListener* listener);
  16408. void removeListener (FilenameComponentListener* listener);
  16409. void setTooltip (const String& newTooltip);
  16410. void paintOverChildren (Graphics& g);
  16411. void resized();
  16412. void lookAndFeelChanged();
  16413. bool isInterestedInFileDrag (const StringArray& files);
  16414. void filesDropped (const StringArray& files, int, int);
  16415. void fileDragEnter (const StringArray& files, int, int);
  16416. void fileDragExit (const StringArray& files);
  16417. juce_UseDebuggingNewOperator
  16418. private:
  16419. ComboBox* filenameBox;
  16420. String lastFilename;
  16421. Button* browseButton;
  16422. int maxRecentFiles;
  16423. bool isDir, isSaving, isFileDragOver;
  16424. String wildcard, enforcedSuffix, browseButtonText;
  16425. ListenerList <FilenameComponentListener> listeners;
  16426. File defaultBrowseFile;
  16427. void comboBoxChanged (ComboBox*);
  16428. void buttonClicked (Button* button);
  16429. void handleAsyncUpdate();
  16430. FilenameComponent (const FilenameComponent&);
  16431. FilenameComponent& operator= (const FilenameComponent&);
  16432. };
  16433. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16434. /*** End of inlined file: juce_FilenameComponent.h ***/
  16435. #endif
  16436. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16437. #endif
  16438. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16439. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16440. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16441. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16442. class JUCE_API FileSearchPathListComponent : public Component,
  16443. public SettableTooltipClient,
  16444. public FileDragAndDropTarget,
  16445. private ButtonListener,
  16446. private ListBoxModel
  16447. {
  16448. public:
  16449. FileSearchPathListComponent();
  16450. ~FileSearchPathListComponent();
  16451. const FileSearchPath& getPath() const throw() { return path; }
  16452. void setPath (const FileSearchPath& newPath);
  16453. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16454. enum ColourIds
  16455. {
  16456. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16457. Make this transparent if you don't want the background to be filled. */
  16458. };
  16459. int getNumRows();
  16460. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16461. void deleteKeyPressed (int lastRowSelected);
  16462. void returnKeyPressed (int lastRowSelected);
  16463. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16464. void selectedRowsChanged (int lastRowSelected);
  16465. void resized();
  16466. void paint (Graphics& g);
  16467. bool isInterestedInFileDrag (const StringArray& files);
  16468. void filesDropped (const StringArray& files, int, int);
  16469. void buttonClicked (Button* button);
  16470. juce_UseDebuggingNewOperator
  16471. private:
  16472. FileSearchPath path;
  16473. File defaultBrowseTarget;
  16474. ListBox* listBox;
  16475. Button* addButton;
  16476. Button* removeButton;
  16477. TextButton* changeButton;
  16478. DrawableButton* upButton;
  16479. DrawableButton* downButton;
  16480. void changed();
  16481. void updateButtons();
  16482. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16483. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16484. };
  16485. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16486. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16487. #endif
  16488. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16489. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16490. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16491. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16492. class JUCE_API FileTreeComponent : public TreeView,
  16493. public DirectoryContentsDisplayComponent
  16494. {
  16495. public:
  16496. FileTreeComponent (DirectoryContentsList& listToShow);
  16497. ~FileTreeComponent();
  16498. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16499. const File getSelectedFile (int index = 0) const;
  16500. void deselectAllFiles();
  16501. void scrollToTop();
  16502. void setDragAndDropDescription (const String& description);
  16503. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16504. juce_UseDebuggingNewOperator
  16505. private:
  16506. String dragAndDropDescription;
  16507. FileTreeComponent (const FileTreeComponent&);
  16508. FileTreeComponent& operator= (const FileTreeComponent&);
  16509. };
  16510. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16511. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16512. #endif
  16513. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16514. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16515. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16516. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16517. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16518. private Timer
  16519. {
  16520. public:
  16521. ImagePreviewComponent();
  16522. ~ImagePreviewComponent();
  16523. void selectedFileChanged (const File& newSelectedFile);
  16524. void paint (Graphics& g);
  16525. void timerCallback();
  16526. juce_UseDebuggingNewOperator
  16527. private:
  16528. File fileToLoad;
  16529. ScopedPointer <Image> currentThumbnail;
  16530. String currentDetails;
  16531. void getThumbSize (int& w, int& h) const;
  16532. ImagePreviewComponent (const ImagePreviewComponent&);
  16533. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16534. };
  16535. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16536. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16537. #endif
  16538. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16539. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16540. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16541. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16542. class JUCE_API WildcardFileFilter : public FileFilter
  16543. {
  16544. public:
  16545. WildcardFileFilter (const String& fileWildcardPatterns,
  16546. const String& directoryWildcardPatterns,
  16547. const String& description);
  16548. ~WildcardFileFilter();
  16549. bool isFileSuitable (const File& file) const;
  16550. bool isDirectorySuitable (const File& file) const;
  16551. juce_UseDebuggingNewOperator
  16552. private:
  16553. StringArray fileWildcards, directoryWildcards;
  16554. static void parse (const String& pattern, StringArray& result);
  16555. static bool match (const File& file, const StringArray& wildcards);
  16556. };
  16557. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16558. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16559. #endif
  16560. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16561. #endif
  16562. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16563. #endif
  16564. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16565. #endif
  16566. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16567. #endif
  16568. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16569. #endif
  16570. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16571. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16572. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16573. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16574. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16575. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16576. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16577. class JUCE_API KeyPressMappingSet : public KeyListener,
  16578. public ChangeBroadcaster,
  16579. public FocusChangeListener
  16580. {
  16581. public:
  16582. explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);
  16583. KeyPressMappingSet (const KeyPressMappingSet& other);
  16584. ~KeyPressMappingSet();
  16585. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16586. const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
  16587. void addKeyPress (CommandID commandID,
  16588. const KeyPress& newKeyPress,
  16589. int insertIndex = -1);
  16590. void resetToDefaultMappings();
  16591. void resetToDefaultMapping (CommandID commandID);
  16592. void clearAllKeyPresses();
  16593. void clearAllKeyPresses (CommandID commandID);
  16594. void removeKeyPress (CommandID commandID, int keyPressIndex);
  16595. void removeKeyPress (const KeyPress& keypress);
  16596. bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();
  16597. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16598. bool restoreFromXml (const XmlElement& xmlVersion);
  16599. XmlElement* createXml (bool saveDifferencesFromDefaultSet) const;
  16600. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16601. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  16602. void globalFocusChanged (Component* focusedComponent);
  16603. juce_UseDebuggingNewOperator
  16604. private:
  16605. ApplicationCommandManager* commandManager;
  16606. struct CommandMapping
  16607. {
  16608. CommandID commandID;
  16609. Array <KeyPress> keypresses;
  16610. bool wantsKeyUpDownCallbacks;
  16611. };
  16612. OwnedArray <CommandMapping> mappings;
  16613. struct KeyPressTime
  16614. {
  16615. KeyPress key;
  16616. uint32 timeWhenPressed;
  16617. };
  16618. OwnedArray <KeyPressTime> keysDown;
  16619. void handleMessage (const Message& message);
  16620. void invokeCommand (const CommandID commandID,
  16621. const KeyPress& keyPress,
  16622. const bool isKeyDown,
  16623. const int millisecsSinceKeyPressed,
  16624. Component* const originatingComponent) const;
  16625. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16626. };
  16627. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16628. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16629. class JUCE_API KeyMappingEditorComponent : public Component,
  16630. public TreeViewItem,
  16631. public ChangeListener,
  16632. private ButtonListener
  16633. {
  16634. public:
  16635. KeyMappingEditorComponent (KeyPressMappingSet* mappingSet,
  16636. bool showResetToDefaultButton);
  16637. virtual ~KeyMappingEditorComponent();
  16638. void setColours (const Colour& mainBackground,
  16639. const Colour& textColour);
  16640. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16641. virtual bool shouldCommandBeIncluded (CommandID commandID);
  16642. virtual bool isCommandReadOnly (CommandID commandID);
  16643. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16644. enum ColourIds
  16645. {
  16646. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16647. textColourId = 0x100ad01, /**< The colour for the text. */
  16648. };
  16649. void parentHierarchyChanged();
  16650. void resized();
  16651. void changeListenerCallback (void*);
  16652. bool mightContainSubItems();
  16653. const String getUniqueName() const;
  16654. void buttonClicked (Button* button);
  16655. juce_UseDebuggingNewOperator
  16656. private:
  16657. KeyPressMappingSet* mappings;
  16658. TreeView* tree;
  16659. friend class KeyMappingTreeViewItem;
  16660. friend class KeyCategoryTreeViewItem;
  16661. friend class KeyMappingItemComponent;
  16662. friend class KeyMappingChangeButton;
  16663. TextButton* resetButton;
  16664. void assignNewKey (CommandID commandID, int index);
  16665. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16666. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16667. };
  16668. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16669. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16670. #endif
  16671. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16672. #endif
  16673. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16674. #endif
  16675. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16676. #endif
  16677. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16678. #endif
  16679. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16680. #endif
  16681. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16682. #endif
  16683. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16684. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16685. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16686. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16687. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16688. {
  16689. public:
  16690. ComponentMovementWatcher (Component* component);
  16691. ~ComponentMovementWatcher();
  16692. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16693. virtual void componentPeerChanged() = 0;
  16694. juce_UseDebuggingNewOperator
  16695. void componentParentHierarchyChanged (Component& component);
  16696. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16697. private:
  16698. Component::SafePointer<Component> component;
  16699. ComponentPeer* lastPeer;
  16700. VoidArray registeredParentComps;
  16701. bool reentrant;
  16702. Rectangle<int> lastBounds;
  16703. void unregister() throw();
  16704. void registerWithParentComps() throw();
  16705. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16706. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16707. };
  16708. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16709. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16710. #endif
  16711. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16712. /*** Start of inlined file: juce_GroupComponent.h ***/
  16713. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16714. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16715. class JUCE_API GroupComponent : public Component
  16716. {
  16717. public:
  16718. GroupComponent (const String& componentName,
  16719. const String& labelText);
  16720. ~GroupComponent();
  16721. void setText (const String& newText);
  16722. const String getText() const;
  16723. void setTextLabelPosition (const Justification& justification);
  16724. const Justification getTextLabelPosition() const throw() { return justification; }
  16725. enum ColourIds
  16726. {
  16727. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16728. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16729. };
  16730. void paint (Graphics& g);
  16731. void enablementChanged();
  16732. void colourChanged();
  16733. private:
  16734. String text;
  16735. Justification justification;
  16736. GroupComponent (const GroupComponent&);
  16737. GroupComponent& operator= (const GroupComponent&);
  16738. };
  16739. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16740. /*** End of inlined file: juce_GroupComponent.h ***/
  16741. #endif
  16742. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16743. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16744. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16745. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16746. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16747. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16748. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16749. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16750. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16751. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16752. class TabbedButtonBar;
  16753. class JUCE_API TabBarButton : public Button
  16754. {
  16755. public:
  16756. TabBarButton (const String& name,
  16757. TabbedButtonBar* ownerBar,
  16758. int tabIndex);
  16759. ~TabBarButton();
  16760. virtual int getBestTabLength (int depth);
  16761. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16762. void clicked (const ModifierKeys& mods);
  16763. bool hitTest (int x, int y);
  16764. juce_UseDebuggingNewOperator
  16765. protected:
  16766. friend class TabbedButtonBar;
  16767. TabbedButtonBar* const owner;
  16768. int tabIndex, overlapPixels;
  16769. DropShadowEffect shadow;
  16770. void getActiveArea (int& x, int& y, int& w, int& h);
  16771. private:
  16772. TabBarButton (const TabBarButton&);
  16773. TabBarButton& operator= (const TabBarButton&);
  16774. };
  16775. class JUCE_API TabbedButtonBar : public Component,
  16776. public ChangeBroadcaster,
  16777. public ButtonListener
  16778. {
  16779. public:
  16780. enum Orientation
  16781. {
  16782. TabsAtTop,
  16783. TabsAtBottom,
  16784. TabsAtLeft,
  16785. TabsAtRight
  16786. };
  16787. TabbedButtonBar (Orientation orientation);
  16788. ~TabbedButtonBar();
  16789. void setOrientation (Orientation orientation);
  16790. Orientation getOrientation() const throw() { return orientation; }
  16791. void clearTabs();
  16792. void addTab (const String& tabName,
  16793. const Colour& tabBackgroundColour,
  16794. int insertIndex = -1);
  16795. void setTabName (int tabIndex,
  16796. const String& newName);
  16797. void removeTab (int tabIndex);
  16798. void moveTab (int currentIndex, int newIndex);
  16799. int getNumTabs() const;
  16800. const StringArray getTabNames() const;
  16801. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16802. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16803. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16804. TabBarButton* getTabButton (int index) const;
  16805. virtual void currentTabChanged (int newCurrentTabIndex,
  16806. const String& newCurrentTabName);
  16807. virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
  16808. const Colour getTabBackgroundColour (int tabIndex);
  16809. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16810. enum ColourIds
  16811. {
  16812. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16813. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16814. the look and feel will choose an appropriate colour. */
  16815. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16816. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16817. this isn't specified, the look and feel will choose an appropriate
  16818. colour. */
  16819. };
  16820. void resized();
  16821. void buttonClicked (Button* button);
  16822. void lookAndFeelChanged();
  16823. juce_UseDebuggingNewOperator
  16824. protected:
  16825. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16826. private:
  16827. Orientation orientation;
  16828. StringArray tabs;
  16829. Array <Colour> tabColours;
  16830. int currentTabIndex;
  16831. Component* behindFrontTab;
  16832. Button* extraTabsButton;
  16833. TabbedButtonBar (const TabbedButtonBar&);
  16834. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16835. };
  16836. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16837. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16838. class JUCE_API TabbedComponent : public Component
  16839. {
  16840. public:
  16841. explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
  16842. ~TabbedComponent();
  16843. void setOrientation (TabbedButtonBar::Orientation orientation);
  16844. TabbedButtonBar::Orientation getOrientation() const throw();
  16845. void setTabBarDepth (int newDepth);
  16846. int getTabBarDepth() const throw() { return tabDepth; }
  16847. void setOutline (int newThickness);
  16848. void setIndent (int indentThickness);
  16849. void clearTabs();
  16850. void addTab (const String& tabName,
  16851. const Colour& tabBackgroundColour,
  16852. Component* contentComponent,
  16853. bool deleteComponentWhenNotNeeded,
  16854. int insertIndex = -1);
  16855. void setTabName (int tabIndex, const String& newName);
  16856. void removeTab (int tabIndex);
  16857. int getNumTabs() const;
  16858. const StringArray getTabNames() const;
  16859. Component* getTabContentComponent (int tabIndex) const throw();
  16860. const Colour getTabBackgroundColour (int tabIndex) const throw();
  16861. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16862. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16863. int getCurrentTabIndex() const;
  16864. const String& getCurrentTabName() const;
  16865. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16866. virtual void currentTabChanged (int newCurrentTabIndex,
  16867. const String& newCurrentTabName);
  16868. virtual void popupMenuClickOnTab (int tabIndex,
  16869. const String& tabName);
  16870. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16871. enum ColourIds
  16872. {
  16873. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16874. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16875. (See setOutline) */
  16876. };
  16877. void paint (Graphics& g);
  16878. void resized();
  16879. void lookAndFeelChanged();
  16880. juce_UseDebuggingNewOperator
  16881. protected:
  16882. TabbedButtonBar* tabs;
  16883. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16884. private:
  16885. Array <Component*> contentComponents;
  16886. Component* panelComponent;
  16887. int tabDepth;
  16888. int outlineThickness, edgeIndent;
  16889. friend class TabCompButtonBar;
  16890. void changeCallback (int newCurrentTabIndex, const String& newTabName);
  16891. TabbedComponent (const TabbedComponent&);
  16892. TabbedComponent& operator= (const TabbedComponent&);
  16893. };
  16894. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16895. /*** End of inlined file: juce_TabbedComponent.h ***/
  16896. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16897. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16898. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16899. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16900. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16901. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16902. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16903. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16904. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16905. class MenuBarModel;
  16906. class JUCE_API MenuBarModelListener
  16907. {
  16908. public:
  16909. virtual ~MenuBarModelListener() {}
  16910. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16911. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16912. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16913. };
  16914. class JUCE_API MenuBarModel : private AsyncUpdater,
  16915. private ApplicationCommandManagerListener
  16916. {
  16917. public:
  16918. MenuBarModel() throw();
  16919. virtual ~MenuBarModel();
  16920. void menuItemsChanged();
  16921. void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
  16922. void addListener (MenuBarModelListener* listenerToAdd) throw();
  16923. void removeListener (MenuBarModelListener* listenerToRemove) throw();
  16924. virtual const StringArray getMenuBarNames() = 0;
  16925. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16926. const String& menuName) = 0;
  16927. virtual void menuItemSelected (int menuItemID,
  16928. int topLevelMenuIndex) = 0;
  16929. #if JUCE_MAC || DOXYGEN
  16930. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16931. const PopupMenu* extraAppleMenuItems = 0);
  16932. static MenuBarModel* getMacMainMenu();
  16933. #endif
  16934. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16935. void applicationCommandListChanged();
  16936. void handleAsyncUpdate();
  16937. juce_UseDebuggingNewOperator
  16938. private:
  16939. ApplicationCommandManager* manager;
  16940. ListenerList <MenuBarModelListener> listeners;
  16941. MenuBarModel (const MenuBarModel&);
  16942. MenuBarModel& operator= (const MenuBarModel&);
  16943. };
  16944. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16945. /*** End of inlined file: juce_MenuBarModel.h ***/
  16946. class JUCE_API MenuBarComponent : public Component,
  16947. private MenuBarModelListener,
  16948. private Timer
  16949. {
  16950. public:
  16951. MenuBarComponent (MenuBarModel* model);
  16952. ~MenuBarComponent();
  16953. void setModel (MenuBarModel* newModel);
  16954. void showMenu (int menuIndex);
  16955. void paint (Graphics& g);
  16956. void resized();
  16957. void mouseEnter (const MouseEvent& e);
  16958. void mouseExit (const MouseEvent& e);
  16959. void mouseDown (const MouseEvent& e);
  16960. void mouseDrag (const MouseEvent& e);
  16961. void mouseUp (const MouseEvent& e);
  16962. void mouseMove (const MouseEvent& e);
  16963. void inputAttemptWhenModal();
  16964. void handleCommandMessage (int commandId);
  16965. bool keyPressed (const KeyPress& key);
  16966. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16967. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16968. const ApplicationCommandTarget::InvocationInfo& info);
  16969. juce_UseDebuggingNewOperator
  16970. private:
  16971. MenuBarModel* model;
  16972. StringArray menuNames;
  16973. Array <int> xPositions;
  16974. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16975. int lastMouseX, lastMouseY;
  16976. bool inModalState;
  16977. ScopedPointer <Component> currentPopup;
  16978. int getItemAt (int x, int y);
  16979. void updateItemUnderMouse (int x, int y);
  16980. void hideCurrentMenu();
  16981. void timerCallback();
  16982. void repaintMenuItem (int index);
  16983. MenuBarComponent (const MenuBarComponent&);
  16984. MenuBarComponent& operator= (const MenuBarComponent&);
  16985. };
  16986. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16987. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16988. class JUCE_API DocumentWindow : public ResizableWindow
  16989. {
  16990. public:
  16991. enum TitleBarButtons
  16992. {
  16993. minimiseButton = 1,
  16994. maximiseButton = 2,
  16995. closeButton = 4,
  16996. allButtons = 7
  16997. };
  16998. DocumentWindow (const String& name,
  16999. const Colour& backgroundColour,
  17000. int requiredButtons,
  17001. bool addToDesktop = true);
  17002. ~DocumentWindow();
  17003. void setName (const String& newName);
  17004. void setIcon (const Image* imageToUse);
  17005. void setTitleBarHeight (int newHeight);
  17006. int getTitleBarHeight() const;
  17007. void setTitleBarButtonsRequired (int requiredButtons,
  17008. bool positionTitleBarButtonsOnLeft);
  17009. void setTitleBarTextCentred (bool textShouldBeCentred);
  17010. void setMenuBar (MenuBarModel* menuBarModel,
  17011. int menuBarHeight = 0);
  17012. virtual void closeButtonPressed();
  17013. virtual void minimiseButtonPressed();
  17014. virtual void maximiseButtonPressed();
  17015. Button* getCloseButton() const throw();
  17016. Button* getMinimiseButton() const throw();
  17017. Button* getMaximiseButton() const throw();
  17018. enum ColourIds
  17019. {
  17020. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  17021. and feel class how this is used. */
  17022. };
  17023. void paint (Graphics& g);
  17024. void resized();
  17025. void lookAndFeelChanged();
  17026. const BorderSize getBorderThickness();
  17027. const BorderSize getContentComponentBorder();
  17028. void mouseDoubleClick (const MouseEvent& e);
  17029. void userTriedToCloseWindow();
  17030. void activeWindowStatusChanged();
  17031. int getDesktopWindowStyleFlags() const;
  17032. void parentHierarchyChanged();
  17033. const Rectangle<int> getTitleBarArea();
  17034. juce_UseDebuggingNewOperator
  17035. private:
  17036. int titleBarHeight, menuBarHeight, requiredButtons;
  17037. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  17038. ScopedPointer <Button> titleBarButtons [3];
  17039. ScopedPointer <Image> titleBarIcon;
  17040. ScopedPointer <MenuBarComponent> menuBar;
  17041. MenuBarModel* menuBarModel;
  17042. class ButtonListenerProxy;
  17043. friend class ScopedPointer <ButtonListenerProxy>;
  17044. ScopedPointer <ButtonListenerProxy> buttonListener;
  17045. void repaintTitleBar();
  17046. DocumentWindow (const DocumentWindow&);
  17047. DocumentWindow& operator= (const DocumentWindow&);
  17048. };
  17049. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  17050. /*** End of inlined file: juce_DocumentWindow.h ***/
  17051. class MultiDocumentPanel;
  17052. class MDITabbedComponentInternal;
  17053. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  17054. {
  17055. public:
  17056. MultiDocumentPanelWindow (const Colour& backgroundColour);
  17057. ~MultiDocumentPanelWindow();
  17058. void maximiseButtonPressed();
  17059. void closeButtonPressed();
  17060. void activeWindowStatusChanged();
  17061. void broughtToFront();
  17062. juce_UseDebuggingNewOperator
  17063. private:
  17064. void updateOrder();
  17065. MultiDocumentPanel* getOwner() const throw();
  17066. };
  17067. class JUCE_API MultiDocumentPanel : public Component,
  17068. private ComponentListener
  17069. {
  17070. public:
  17071. MultiDocumentPanel();
  17072. ~MultiDocumentPanel();
  17073. bool closeAllDocuments (bool checkItsOkToCloseFirst);
  17074. bool addDocument (Component* component,
  17075. const Colour& backgroundColour,
  17076. bool deleteWhenRemoved);
  17077. bool closeDocument (Component* component,
  17078. bool checkItsOkToCloseFirst);
  17079. int getNumDocuments() const throw();
  17080. Component* getDocument (int index) const throw();
  17081. Component* getActiveDocument() const throw();
  17082. void setActiveDocument (Component* component);
  17083. virtual void activeDocumentChanged();
  17084. void setMaximumNumDocuments (int maximumNumDocuments);
  17085. void useFullscreenWhenOneDocument (bool shouldUseTabs);
  17086. bool isFullscreenWhenOneDocument() const throw();
  17087. enum LayoutMode
  17088. {
  17089. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  17090. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  17091. };
  17092. void setLayoutMode (LayoutMode newLayoutMode);
  17093. LayoutMode getLayoutMode() const throw() { return mode; }
  17094. void setBackgroundColour (const Colour& newBackgroundColour);
  17095. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  17096. virtual bool tryToCloseDocument (Component* component) = 0;
  17097. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  17098. void paint (Graphics& g);
  17099. void resized();
  17100. void componentNameChanged (Component&);
  17101. juce_UseDebuggingNewOperator
  17102. private:
  17103. LayoutMode mode;
  17104. Array <Component*> components;
  17105. TabbedComponent* tabComponent;
  17106. Colour backgroundColour;
  17107. int maximumNumDocuments, numDocsBeforeTabsUsed;
  17108. friend class MultiDocumentPanelWindow;
  17109. friend class MDITabbedComponentInternal;
  17110. Component* getContainerComp (Component* c) const;
  17111. void updateOrder();
  17112. void addWindow (Component* component);
  17113. };
  17114. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  17115. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  17116. #endif
  17117. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  17118. #endif
  17119. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  17120. #endif
  17121. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  17122. #endif
  17123. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  17124. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  17125. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  17126. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  17127. class JUCE_API StretchableLayoutManager
  17128. {
  17129. public:
  17130. StretchableLayoutManager();
  17131. ~StretchableLayoutManager();
  17132. void setItemLayout (int itemIndex,
  17133. double minimumSize,
  17134. double maximumSize,
  17135. double preferredSize);
  17136. bool getItemLayout (int itemIndex,
  17137. double& minimumSize,
  17138. double& maximumSize,
  17139. double& preferredSize) const;
  17140. void clearAllItems();
  17141. void layOutComponents (Component** components,
  17142. int numComponents,
  17143. int x, int y, int width, int height,
  17144. bool vertically,
  17145. bool resizeOtherDimension);
  17146. int getItemCurrentPosition (int itemIndex) const;
  17147. int getItemCurrentAbsoluteSize (int itemIndex) const;
  17148. double getItemCurrentRelativeSize (int itemIndex) const;
  17149. void setItemPosition (int itemIndex,
  17150. int newPosition);
  17151. juce_UseDebuggingNewOperator
  17152. private:
  17153. struct ItemLayoutProperties
  17154. {
  17155. int itemIndex;
  17156. int currentSize;
  17157. double minSize, maxSize, preferredSize;
  17158. };
  17159. OwnedArray <ItemLayoutProperties> items;
  17160. int totalSize;
  17161. static int sizeToRealSize (double size, int totalSpace);
  17162. ItemLayoutProperties* getInfoFor (int itemIndex) const;
  17163. void setTotalSize (int newTotalSize);
  17164. int fitComponentsIntoSpace (int startIndex, int endIndex, int availableSpace, int startPos);
  17165. int getMinimumSizeOfItems (int startIndex, int endIndex) const;
  17166. int getMaximumSizeOfItems (int startIndex, int endIndex) const;
  17167. void updatePrefSizesToMatchCurrentPositions();
  17168. StretchableLayoutManager (const StretchableLayoutManager&);
  17169. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  17170. };
  17171. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  17172. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  17173. #endif
  17174. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17175. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  17176. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17177. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17178. class JUCE_API StretchableLayoutResizerBar : public Component
  17179. {
  17180. public:
  17181. StretchableLayoutResizerBar (StretchableLayoutManager* layoutToUse,
  17182. int itemIndexInLayout,
  17183. bool isBarVertical);
  17184. ~StretchableLayoutResizerBar();
  17185. virtual void hasBeenMoved();
  17186. void paint (Graphics& g);
  17187. void mouseDown (const MouseEvent& e);
  17188. void mouseDrag (const MouseEvent& e);
  17189. juce_UseDebuggingNewOperator
  17190. private:
  17191. StretchableLayoutManager* layout;
  17192. int itemIndex, mouseDownPos;
  17193. bool isVertical;
  17194. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  17195. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  17196. };
  17197. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17198. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  17199. #endif
  17200. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17201. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  17202. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17203. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17204. class StretchableObjectResizer
  17205. {
  17206. public:
  17207. StretchableObjectResizer();
  17208. ~StretchableObjectResizer();
  17209. void addItem (double currentSize,
  17210. double minSize,
  17211. double maxSize,
  17212. int order = 0);
  17213. void resizeToFit (double targetSize);
  17214. int getNumItems() const throw() { return items.size(); }
  17215. double getItemSize (int index) const throw();
  17216. juce_UseDebuggingNewOperator
  17217. private:
  17218. struct Item
  17219. {
  17220. double size;
  17221. double minSize;
  17222. double maxSize;
  17223. int order;
  17224. };
  17225. OwnedArray <Item> items;
  17226. StretchableObjectResizer (const StretchableObjectResizer&);
  17227. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  17228. };
  17229. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17230. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  17231. #endif
  17232. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  17233. #endif
  17234. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  17235. #endif
  17236. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  17237. #endif
  17238. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  17239. /*** Start of inlined file: juce_LookAndFeel.h ***/
  17240. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  17241. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  17242. /*** Start of inlined file: juce_AlertWindow.h ***/
  17243. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  17244. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  17245. /*** Start of inlined file: juce_TextLayout.h ***/
  17246. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  17247. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  17248. class Graphics;
  17249. class JUCE_API TextLayout
  17250. {
  17251. public:
  17252. TextLayout();
  17253. TextLayout (const TextLayout& other);
  17254. TextLayout (const String& text, const Font& font);
  17255. ~TextLayout();
  17256. TextLayout& operator= (const TextLayout& layoutToCopy);
  17257. void clear();
  17258. void appendText (const String& textToAppend,
  17259. const Font& fontToUse);
  17260. void setText (const String& newText,
  17261. const Font& fontToUse);
  17262. void layout (int maximumWidth,
  17263. const Justification& justification,
  17264. bool attemptToBalanceLineLengths);
  17265. int getWidth() const;
  17266. int getHeight() const;
  17267. int getNumLines() const { return totalLines; }
  17268. int getLineWidth (int lineNumber) const;
  17269. void draw (Graphics& g, int topLeftX, int topLeftY) const;
  17270. void drawWithin (Graphics& g,
  17271. int x, int y, int w, int h,
  17272. const Justification& layoutFlags) const;
  17273. juce_UseDebuggingNewOperator
  17274. private:
  17275. class Token;
  17276. friend class OwnedArray <Token>;
  17277. OwnedArray <Token> tokens;
  17278. int totalLines;
  17279. };
  17280. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  17281. /*** End of inlined file: juce_TextLayout.h ***/
  17282. class JUCE_API AlertWindow : public TopLevelWindow,
  17283. private ButtonListener
  17284. {
  17285. public:
  17286. enum AlertIconType
  17287. {
  17288. NoIcon, /**< No icon will be shown on the dialog box. */
  17289. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  17290. user to answer a question. */
  17291. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  17292. warning about something and shouldn't be ignored. */
  17293. InfoIcon /**< An icon that indicates that the dialog box is just
  17294. giving the user some information, which doesn't require
  17295. a response from them. */
  17296. };
  17297. AlertWindow (const String& title,
  17298. const String& message,
  17299. AlertIconType iconType,
  17300. Component* associatedComponent = 0);
  17301. ~AlertWindow();
  17302. AlertIconType getAlertType() const throw() { return alertIconType; }
  17303. void setMessage (const String& message);
  17304. void addButton (const String& name,
  17305. int returnValue,
  17306. const KeyPress& shortcutKey1 = KeyPress(),
  17307. const KeyPress& shortcutKey2 = KeyPress());
  17308. int getNumButtons() const;
  17309. void addTextEditor (const String& name,
  17310. const String& initialContents,
  17311. const String& onScreenLabel = String::empty,
  17312. bool isPasswordBox = false);
  17313. const String getTextEditorContents (const String& nameOfTextEditor) const;
  17314. void addComboBox (const String& name,
  17315. const StringArray& items,
  17316. const String& onScreenLabel = String::empty);
  17317. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  17318. void addTextBlock (const String& text);
  17319. void addProgressBarComponent (double& progressValue);
  17320. void addCustomComponent (Component* component);
  17321. int getNumCustomComponents() const;
  17322. Component* getCustomComponent (int index) const;
  17323. Component* removeCustomComponent (int index);
  17324. bool containsAnyExtraComponents() const;
  17325. // easy-to-use message box functions:
  17326. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  17327. const String& title,
  17328. const String& message,
  17329. const String& buttonText = String::empty,
  17330. Component* associatedComponent = 0);
  17331. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  17332. const String& title,
  17333. const String& message,
  17334. const String& button1Text = String::empty,
  17335. const String& button2Text = String::empty,
  17336. Component* associatedComponent = 0);
  17337. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17338. const String& title,
  17339. const String& message,
  17340. const String& button1Text = String::empty,
  17341. const String& button2Text = String::empty,
  17342. const String& button3Text = String::empty,
  17343. Component* associatedComponent = 0);
  17344. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17345. const String& bodyText,
  17346. bool isOkCancel);
  17347. enum ColourIds
  17348. {
  17349. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17350. textColourId = 0x1001810, /**< The colour for the text. */
  17351. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17352. };
  17353. juce_UseDebuggingNewOperator
  17354. protected:
  17355. void paint (Graphics& g);
  17356. void mouseDown (const MouseEvent& e);
  17357. void mouseDrag (const MouseEvent& e);
  17358. bool keyPressed (const KeyPress& key);
  17359. void buttonClicked (Button* button);
  17360. void lookAndFeelChanged();
  17361. void userTriedToCloseWindow();
  17362. int getDesktopWindowStyleFlags() const;
  17363. private:
  17364. String text;
  17365. TextLayout textLayout;
  17366. AlertIconType alertIconType;
  17367. ComponentBoundsConstrainer constrainer;
  17368. ComponentDragger dragger;
  17369. Rectangle<int> textArea;
  17370. VoidArray buttons, textBoxes, comboBoxes;
  17371. VoidArray progressBars, customComps, textBlocks, allComps;
  17372. StringArray textboxNames, comboBoxNames;
  17373. Font font;
  17374. Component* associatedComponent;
  17375. void updateLayout (bool onlyIncreaseSize);
  17376. // disable copy constructor
  17377. AlertWindow (const AlertWindow&);
  17378. AlertWindow& operator= (const AlertWindow&);
  17379. };
  17380. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17381. /*** End of inlined file: juce_AlertWindow.h ***/
  17382. class ToggleButton;
  17383. class TextButton;
  17384. class AlertWindow;
  17385. class TextLayout;
  17386. class ScrollBar;
  17387. class BubbleComponent;
  17388. class ComboBox;
  17389. class Button;
  17390. class FilenameComponent;
  17391. class DocumentWindow;
  17392. class ResizableWindow;
  17393. class GroupComponent;
  17394. class MenuBarComponent;
  17395. class DropShadower;
  17396. class GlyphArrangement;
  17397. class PropertyComponent;
  17398. class TableHeaderComponent;
  17399. class Toolbar;
  17400. class ToolbarItemComponent;
  17401. class PopupMenu;
  17402. class ProgressBar;
  17403. class FileBrowserComponent;
  17404. class DirectoryContentsDisplayComponent;
  17405. class FilePreviewComponent;
  17406. class ImageButton;
  17407. class JUCE_API LookAndFeel
  17408. {
  17409. public:
  17410. LookAndFeel();
  17411. virtual ~LookAndFeel();
  17412. static LookAndFeel& getDefaultLookAndFeel() throw();
  17413. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17414. const Colour findColour (int colourId) const throw();
  17415. void setColour (int colourId, const Colour& colour) throw();
  17416. bool isColourSpecified (int colourId) const throw();
  17417. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17418. void setDefaultSansSerifTypefaceName (const String& newName);
  17419. virtual const MouseCursor getMouseCursorFor (Component& component);
  17420. virtual void drawButtonBackground (Graphics& g,
  17421. Button& button,
  17422. const Colour& backgroundColour,
  17423. bool isMouseOverButton,
  17424. bool isButtonDown);
  17425. virtual const Font getFontForTextButton (TextButton& button);
  17426. virtual void drawButtonText (Graphics& g,
  17427. TextButton& button,
  17428. bool isMouseOverButton,
  17429. bool isButtonDown);
  17430. virtual void drawToggleButton (Graphics& g,
  17431. ToggleButton& button,
  17432. bool isMouseOverButton,
  17433. bool isButtonDown);
  17434. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17435. virtual void drawTickBox (Graphics& g,
  17436. Component& component,
  17437. float x, float y, float w, float h,
  17438. bool ticked,
  17439. bool isEnabled,
  17440. bool isMouseOverButton,
  17441. bool isButtonDown);
  17442. virtual AlertWindow* createAlertWindow (const String& title,
  17443. const String& message,
  17444. const String& button1,
  17445. const String& button2,
  17446. const String& button3,
  17447. AlertWindow::AlertIconType iconType,
  17448. int numButtons,
  17449. Component* associatedComponent);
  17450. virtual void drawAlertBox (Graphics& g,
  17451. AlertWindow& alert,
  17452. const Rectangle<int>& textArea,
  17453. TextLayout& textLayout);
  17454. virtual int getAlertBoxWindowFlags();
  17455. virtual int getAlertWindowButtonHeight();
  17456. virtual const Font getAlertWindowFont();
  17457. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17458. int width, int height,
  17459. double progress, const String& textToShow);
  17460. // Draws a small image that spins to indicate that something's happening..
  17461. // This method should use the current time to animate itself, so just keep
  17462. // repainting it every so often.
  17463. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17464. int x, int y, int w, int h);
  17465. virtual void drawScrollbarButton (Graphics& g,
  17466. ScrollBar& scrollbar,
  17467. int width, int height,
  17468. int buttonDirection,
  17469. bool isScrollbarVertical,
  17470. bool isMouseOverButton,
  17471. bool isButtonDown);
  17472. virtual void drawScrollbar (Graphics& g,
  17473. ScrollBar& scrollbar,
  17474. int x, int y,
  17475. int width, int height,
  17476. bool isScrollbarVertical,
  17477. int thumbStartPosition,
  17478. int thumbSize,
  17479. bool isMouseOver,
  17480. bool isMouseDown);
  17481. virtual ImageEffectFilter* getScrollbarEffect();
  17482. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17483. virtual int getDefaultScrollbarWidth();
  17484. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17485. virtual const Path getTickShape (float height);
  17486. virtual const Path getCrossShape (float height);
  17487. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17488. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17489. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17490. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17491. virtual Image* getDefaultFolderImage();
  17492. virtual Image* getDefaultDocumentFileImage();
  17493. virtual void createFileChooserHeaderText (const String& title,
  17494. const String& instructions,
  17495. GlyphArrangement& destArrangement,
  17496. int width);
  17497. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17498. const String& filename, Image* icon,
  17499. const String& fileSizeDescription,
  17500. const String& fileTimeDescription,
  17501. bool isDirectory,
  17502. bool isItemSelected,
  17503. int itemIndex);
  17504. virtual Button* createFileBrowserGoUpButton();
  17505. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17506. DirectoryContentsDisplayComponent* fileListComponent,
  17507. FilePreviewComponent* previewComp,
  17508. ComboBox* currentPathBox,
  17509. TextEditor* filenameBox,
  17510. Button* goUpButton);
  17511. virtual void drawBubble (Graphics& g,
  17512. float tipX, float tipY,
  17513. float boxX, float boxY, float boxW, float boxH);
  17514. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17515. virtual void drawPopupMenuItem (Graphics& g,
  17516. int width, int height,
  17517. bool isSeparator,
  17518. bool isActive,
  17519. bool isHighlighted,
  17520. bool isTicked,
  17521. bool hasSubMenu,
  17522. const String& text,
  17523. const String& shortcutKeyText,
  17524. Image* image,
  17525. const Colour* const textColour);
  17526. virtual const Font getPopupMenuFont();
  17527. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17528. int width, int height,
  17529. bool isScrollUpArrow);
  17530. virtual void getIdealPopupMenuItemSize (const String& text,
  17531. bool isSeparator,
  17532. int standardMenuItemHeight,
  17533. int& idealWidth,
  17534. int& idealHeight);
  17535. virtual int getMenuWindowFlags();
  17536. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17537. bool isMouseOverBar,
  17538. MenuBarComponent& menuBar);
  17539. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17540. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17541. virtual void drawMenuBarItem (Graphics& g,
  17542. int width, int height,
  17543. int itemIndex,
  17544. const String& itemText,
  17545. bool isMouseOverItem,
  17546. bool isMenuOpen,
  17547. bool isMouseOverBar,
  17548. MenuBarComponent& menuBar);
  17549. virtual void drawComboBox (Graphics& g, int width, int height,
  17550. bool isButtonDown,
  17551. int buttonX, int buttonY,
  17552. int buttonW, int buttonH,
  17553. ComboBox& box);
  17554. virtual const Font getComboBoxFont (ComboBox& box);
  17555. virtual Label* createComboBoxTextBox (ComboBox& box);
  17556. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17557. virtual void drawLabel (Graphics& g, Label& label);
  17558. virtual void drawLinearSlider (Graphics& g,
  17559. int x, int y,
  17560. int width, int height,
  17561. float sliderPos,
  17562. float minSliderPos,
  17563. float maxSliderPos,
  17564. const Slider::SliderStyle style,
  17565. Slider& slider);
  17566. virtual void drawLinearSliderBackground (Graphics& g,
  17567. int x, int y,
  17568. int width, int height,
  17569. float sliderPos,
  17570. float minSliderPos,
  17571. float maxSliderPos,
  17572. const Slider::SliderStyle style,
  17573. Slider& slider);
  17574. virtual void drawLinearSliderThumb (Graphics& g,
  17575. int x, int y,
  17576. int width, int height,
  17577. float sliderPos,
  17578. float minSliderPos,
  17579. float maxSliderPos,
  17580. const Slider::SliderStyle style,
  17581. Slider& slider);
  17582. virtual int getSliderThumbRadius (Slider& slider);
  17583. virtual void drawRotarySlider (Graphics& g,
  17584. int x, int y,
  17585. int width, int height,
  17586. float sliderPosProportional,
  17587. float rotaryStartAngle,
  17588. float rotaryEndAngle,
  17589. Slider& slider);
  17590. virtual Button* createSliderButton (bool isIncrement);
  17591. virtual Label* createSliderTextBox (Slider& slider);
  17592. virtual ImageEffectFilter* getSliderEffect();
  17593. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17594. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17595. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17596. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17597. ComboBox* filenameBox, Button* browseButton);
  17598. virtual void drawCornerResizer (Graphics& g,
  17599. int w, int h,
  17600. bool isMouseOver,
  17601. bool isMouseDragging);
  17602. virtual void drawResizableFrame (Graphics& g,
  17603. int w, int h,
  17604. const BorderSize& borders);
  17605. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17606. const BorderSize& border,
  17607. ResizableWindow& window);
  17608. virtual void drawResizableWindowBorder (Graphics& g,
  17609. int w, int h,
  17610. const BorderSize& border,
  17611. ResizableWindow& window);
  17612. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17613. Graphics& g, int w, int h,
  17614. int titleSpaceX, int titleSpaceW,
  17615. const Image* icon,
  17616. bool drawTitleTextOnLeft);
  17617. virtual Button* createDocumentWindowButton (int buttonType);
  17618. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17619. int titleBarX, int titleBarY,
  17620. int titleBarW, int titleBarH,
  17621. Button* minimiseButton,
  17622. Button* maximiseButton,
  17623. Button* closeButton,
  17624. bool positionTitleBarButtonsOnLeft);
  17625. virtual int getDefaultMenuBarHeight();
  17626. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17627. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17628. int w, int h,
  17629. bool isVerticalBar,
  17630. bool isMouseOver,
  17631. bool isMouseDragging);
  17632. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17633. const String& text,
  17634. const Justification& position,
  17635. GroupComponent& group);
  17636. virtual void createTabButtonShape (Path& p,
  17637. int width, int height,
  17638. int tabIndex,
  17639. const String& text,
  17640. Button& button,
  17641. TabbedButtonBar::Orientation orientation,
  17642. bool isMouseOver,
  17643. bool isMouseDown,
  17644. bool isFrontTab);
  17645. virtual void fillTabButtonShape (Graphics& g,
  17646. const Path& path,
  17647. const Colour& preferredBackgroundColour,
  17648. int tabIndex,
  17649. const String& text,
  17650. Button& button,
  17651. TabbedButtonBar::Orientation orientation,
  17652. bool isMouseOver,
  17653. bool isMouseDown,
  17654. bool isFrontTab);
  17655. virtual void drawTabButtonText (Graphics& g,
  17656. int x, int y, int w, int h,
  17657. const Colour& preferredBackgroundColour,
  17658. int tabIndex,
  17659. const String& text,
  17660. Button& button,
  17661. TabbedButtonBar::Orientation orientation,
  17662. bool isMouseOver,
  17663. bool isMouseDown,
  17664. bool isFrontTab);
  17665. virtual int getTabButtonOverlap (int tabDepth);
  17666. virtual int getTabButtonSpaceAroundImage();
  17667. virtual int getTabButtonBestWidth (int tabIndex,
  17668. const String& text,
  17669. int tabDepth,
  17670. Button& button);
  17671. virtual void drawTabButton (Graphics& g,
  17672. int w, int h,
  17673. const Colour& preferredColour,
  17674. int tabIndex,
  17675. const String& text,
  17676. Button& button,
  17677. TabbedButtonBar::Orientation orientation,
  17678. bool isMouseOver,
  17679. bool isMouseDown,
  17680. bool isFrontTab);
  17681. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17682. int w, int h,
  17683. TabbedButtonBar& tabBar,
  17684. TabbedButtonBar::Orientation orientation);
  17685. virtual Button* createTabBarExtrasButton();
  17686. virtual void drawImageButton (Graphics& g, Image* image,
  17687. int imageX, int imageY, int imageW, int imageH,
  17688. const Colour& overlayColour,
  17689. float imageOpacity,
  17690. ImageButton& button);
  17691. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17692. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17693. int width, int height,
  17694. bool isMouseOver, bool isMouseDown,
  17695. int columnFlags);
  17696. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17697. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17698. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17699. bool isMouseOver, bool isMouseDown,
  17700. ToolbarItemComponent& component);
  17701. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17702. const String& text, ToolbarItemComponent& component);
  17703. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17704. bool isOpen, int width, int height);
  17705. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17706. PropertyComponent& component);
  17707. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17708. PropertyComponent& component);
  17709. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17710. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17711. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17712. virtual void playAlertSound();
  17713. static void drawGlassSphere (Graphics& g,
  17714. float x, float y,
  17715. float diameter,
  17716. const Colour& colour,
  17717. float outlineThickness) throw();
  17718. static void drawGlassPointer (Graphics& g,
  17719. float x, float y,
  17720. float diameter,
  17721. const Colour& colour, float outlineThickness,
  17722. int direction) throw();
  17723. static void drawGlassLozenge (Graphics& g,
  17724. float x, float y,
  17725. float width, float height,
  17726. const Colour& colour,
  17727. float outlineThickness,
  17728. float cornerSize,
  17729. bool flatOnLeft, bool flatOnRight,
  17730. bool flatOnTop, bool flatOnBottom) throw();
  17731. juce_UseDebuggingNewOperator
  17732. private:
  17733. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17734. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17735. Array <int> colourIds;
  17736. Array <Colour> colours;
  17737. // default typeface names
  17738. String defaultSans, defaultSerif, defaultFixed;
  17739. void drawShinyButtonShape (Graphics& g,
  17740. float x, float y, float w, float h, float maxCornerSize,
  17741. const Colour& baseColour,
  17742. float strokeWidth,
  17743. bool flatOnLeft,
  17744. bool flatOnRight,
  17745. bool flatOnTop,
  17746. bool flatOnBottom) throw();
  17747. LookAndFeel (const LookAndFeel&);
  17748. LookAndFeel& operator= (const LookAndFeel&);
  17749. };
  17750. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17751. /*** End of inlined file: juce_LookAndFeel.h ***/
  17752. #endif
  17753. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17754. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17755. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17756. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17757. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17758. {
  17759. public:
  17760. OldSchoolLookAndFeel();
  17761. virtual ~OldSchoolLookAndFeel();
  17762. virtual void drawButtonBackground (Graphics& g,
  17763. Button& button,
  17764. const Colour& backgroundColour,
  17765. bool isMouseOverButton,
  17766. bool isButtonDown);
  17767. virtual void drawToggleButton (Graphics& g,
  17768. ToggleButton& button,
  17769. bool isMouseOverButton,
  17770. bool isButtonDown);
  17771. virtual void drawTickBox (Graphics& g,
  17772. Component& component,
  17773. float x, float y, float w, float h,
  17774. bool ticked,
  17775. bool isEnabled,
  17776. bool isMouseOverButton,
  17777. bool isButtonDown);
  17778. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17779. int width, int height,
  17780. double progress, const String& textToShow);
  17781. virtual void drawScrollbarButton (Graphics& g,
  17782. ScrollBar& scrollbar,
  17783. int width, int height,
  17784. int buttonDirection,
  17785. bool isScrollbarVertical,
  17786. bool isMouseOverButton,
  17787. bool isButtonDown);
  17788. virtual void drawScrollbar (Graphics& g,
  17789. ScrollBar& scrollbar,
  17790. int x, int y,
  17791. int width, int height,
  17792. bool isScrollbarVertical,
  17793. int thumbStartPosition,
  17794. int thumbSize,
  17795. bool isMouseOver,
  17796. bool isMouseDown);
  17797. virtual ImageEffectFilter* getScrollbarEffect();
  17798. virtual void drawTextEditorOutline (Graphics& g,
  17799. int width, int height,
  17800. TextEditor& textEditor);
  17801. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17802. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17803. bool isMouseOverBar,
  17804. MenuBarComponent& menuBar);
  17805. virtual void drawComboBox (Graphics& g, int width, int height,
  17806. bool isButtonDown,
  17807. int buttonX, int buttonY,
  17808. int buttonW, int buttonH,
  17809. ComboBox& box);
  17810. virtual const Font getComboBoxFont (ComboBox& box);
  17811. virtual void drawLinearSlider (Graphics& g,
  17812. int x, int y,
  17813. int width, int height,
  17814. float sliderPos,
  17815. float minSliderPos,
  17816. float maxSliderPos,
  17817. const Slider::SliderStyle style,
  17818. Slider& slider);
  17819. virtual int getSliderThumbRadius (Slider& slider);
  17820. virtual Button* createSliderButton (bool isIncrement);
  17821. virtual ImageEffectFilter* getSliderEffect();
  17822. virtual void drawCornerResizer (Graphics& g,
  17823. int w, int h,
  17824. bool isMouseOver,
  17825. bool isMouseDragging);
  17826. virtual Button* createDocumentWindowButton (int buttonType);
  17827. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17828. int titleBarX, int titleBarY,
  17829. int titleBarW, int titleBarH,
  17830. Button* minimiseButton,
  17831. Button* maximiseButton,
  17832. Button* closeButton,
  17833. bool positionTitleBarButtonsOnLeft);
  17834. juce_UseDebuggingNewOperator
  17835. private:
  17836. DropShadowEffect scrollbarShadow;
  17837. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17838. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17839. };
  17840. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17841. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17842. #endif
  17843. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17844. #endif
  17845. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17846. #endif
  17847. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17848. #endif
  17849. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17850. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17851. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17852. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17853. class JUCE_API PopupMenuCustomComponent : public Component,
  17854. public ReferenceCountedObject
  17855. {
  17856. public:
  17857. ~PopupMenuCustomComponent();
  17858. virtual void getIdealSize (int& idealWidth,
  17859. int& idealHeight) = 0;
  17860. void triggerMenuItem();
  17861. bool isItemHighlighted() const throw() { return isHighlighted; }
  17862. protected:
  17863. PopupMenuCustomComponent (bool isTriggeredAutomatically = true);
  17864. private:
  17865. friend class PopupMenu;
  17866. friend class PopupMenu::ItemComponent;
  17867. friend class PopupMenu::Window;
  17868. bool isHighlighted, isTriggeredAutomatically;
  17869. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17870. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17871. };
  17872. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17873. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17874. #endif
  17875. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17876. #endif
  17877. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17878. #endif
  17879. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17880. #endif
  17881. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17882. #endif
  17883. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17884. /*** Start of inlined file: juce_LassoComponent.h ***/
  17885. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17886. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17887. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17888. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17889. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17890. template <class SelectableItemType>
  17891. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17892. {
  17893. public:
  17894. typedef SelectableItemType ItemType;
  17895. SelectedItemSet()
  17896. {
  17897. }
  17898. explicit SelectedItemSet (const Array <SelectableItemType>& items)
  17899. : selectedItems (items)
  17900. {
  17901. }
  17902. SelectedItemSet (const SelectedItemSet& other)
  17903. : selectedItems (other.selectedItems)
  17904. {
  17905. }
  17906. SelectedItemSet& operator= (const SelectedItemSet& other)
  17907. {
  17908. if (selectedItems != other.selectedItems)
  17909. {
  17910. selectedItems = other.selectedItems;
  17911. changed();
  17912. }
  17913. return *this;
  17914. }
  17915. ~SelectedItemSet()
  17916. {
  17917. }
  17918. void selectOnly (SelectableItemType item)
  17919. {
  17920. if (isSelected (item))
  17921. {
  17922. for (int i = selectedItems.size(); --i >= 0;)
  17923. {
  17924. if (selectedItems.getUnchecked(i) != item)
  17925. {
  17926. deselect (selectedItems.getUnchecked(i));
  17927. i = jmin (i, selectedItems.size());
  17928. }
  17929. }
  17930. }
  17931. else
  17932. {
  17933. deselectAll();
  17934. changed();
  17935. selectedItems.add (item);
  17936. itemSelected (item);
  17937. }
  17938. }
  17939. void addToSelection (SelectableItemType item)
  17940. {
  17941. if (! isSelected (item))
  17942. {
  17943. changed();
  17944. selectedItems.add (item);
  17945. itemSelected (item);
  17946. }
  17947. }
  17948. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17949. const ModifierKeys& modifiers)
  17950. {
  17951. if (modifiers.isShiftDown())
  17952. {
  17953. addToSelection (item);
  17954. }
  17955. else if (modifiers.isCommandDown())
  17956. {
  17957. if (isSelected (item))
  17958. deselect (item);
  17959. else
  17960. addToSelection (item);
  17961. }
  17962. else
  17963. {
  17964. selectOnly (item);
  17965. }
  17966. }
  17967. bool addToSelectionOnMouseDown (SelectableItemType item,
  17968. const ModifierKeys& modifiers)
  17969. {
  17970. if (isSelected (item))
  17971. {
  17972. return ! modifiers.isPopupMenu();
  17973. }
  17974. else
  17975. {
  17976. addToSelectionBasedOnModifiers (item, modifiers);
  17977. return false;
  17978. }
  17979. }
  17980. void addToSelectionOnMouseUp (SelectableItemType item,
  17981. const ModifierKeys& modifiers,
  17982. const bool wasItemDragged,
  17983. const bool resultOfMouseDownSelectMethod)
  17984. {
  17985. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17986. addToSelectionBasedOnModifiers (item, modifiers);
  17987. }
  17988. void deselect (SelectableItemType item)
  17989. {
  17990. const int i = selectedItems.indexOf (item);
  17991. if (i >= 0)
  17992. {
  17993. changed();
  17994. itemDeselected (selectedItems.remove (i));
  17995. }
  17996. }
  17997. void deselectAll()
  17998. {
  17999. if (selectedItems.size() > 0)
  18000. {
  18001. changed();
  18002. for (int i = selectedItems.size(); --i >= 0;)
  18003. {
  18004. itemDeselected (selectedItems.remove (i));
  18005. i = jmin (i, selectedItems.size());
  18006. }
  18007. }
  18008. }
  18009. int getNumSelected() const throw()
  18010. {
  18011. return selectedItems.size();
  18012. }
  18013. SelectableItemType getSelectedItem (const int index) const throw()
  18014. {
  18015. return selectedItems [index];
  18016. }
  18017. bool isSelected (const SelectableItemType item) const throw()
  18018. {
  18019. return selectedItems.contains (item);
  18020. }
  18021. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  18022. virtual void itemSelected (SelectableItemType item) {}
  18023. virtual void itemDeselected (SelectableItemType item) {}
  18024. void changed (const bool synchronous = false)
  18025. {
  18026. if (synchronous)
  18027. sendSynchronousChangeMessage (this);
  18028. else
  18029. sendChangeMessage (this);
  18030. }
  18031. juce_UseDebuggingNewOperator
  18032. private:
  18033. Array <SelectableItemType> selectedItems;
  18034. };
  18035. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  18036. /*** End of inlined file: juce_SelectedItemSet.h ***/
  18037. template <class SelectableItemType>
  18038. class LassoSource
  18039. {
  18040. public:
  18041. virtual ~LassoSource() {}
  18042. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  18043. const Rectangle<int>& area) = 0;
  18044. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  18045. };
  18046. template <class SelectableItemType>
  18047. class LassoComponent : public Component
  18048. {
  18049. public:
  18050. explicit LassoComponent (const int outlineThickness_ = 1)
  18051. : source (0),
  18052. outlineThickness (outlineThickness_)
  18053. {
  18054. }
  18055. ~LassoComponent()
  18056. {
  18057. }
  18058. void beginLasso (const MouseEvent& e,
  18059. LassoSource <SelectableItemType>* const lassoSource)
  18060. {
  18061. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  18062. jassert (lassoSource != 0); // the source can't be null!
  18063. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  18064. source = lassoSource;
  18065. if (lassoSource != 0)
  18066. originalSelection = lassoSource->getLassoSelection().getItemArray();
  18067. setSize (0, 0);
  18068. dragStartPos = e.getMouseDownPosition();
  18069. }
  18070. void dragLasso (const MouseEvent& e)
  18071. {
  18072. if (source != 0)
  18073. {
  18074. setBounds (Rectangle<int> (dragStartPos, e.getPosition()));
  18075. setVisible (true);
  18076. Array <SelectableItemType> itemsInLasso;
  18077. source->findLassoItemsInArea (itemsInLasso, getBounds());
  18078. if (e.mods.isShiftDown())
  18079. {
  18080. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  18081. itemsInLasso.addArray (originalSelection);
  18082. }
  18083. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  18084. {
  18085. Array <SelectableItemType> originalMinusNew (originalSelection);
  18086. originalMinusNew.removeValuesIn (itemsInLasso);
  18087. itemsInLasso.removeValuesIn (originalSelection);
  18088. itemsInLasso.addArray (originalMinusNew);
  18089. }
  18090. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  18091. }
  18092. }
  18093. void endLasso()
  18094. {
  18095. source = 0;
  18096. originalSelection.clear();
  18097. setVisible (false);
  18098. }
  18099. enum ColourIds
  18100. {
  18101. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  18102. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  18103. };
  18104. void paint (Graphics& g)
  18105. {
  18106. g.fillAll (findColour (lassoFillColourId));
  18107. g.setColour (findColour (lassoOutlineColourId));
  18108. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  18109. // this suggests that you've left a lasso comp lying around after the
  18110. // mouse drag has finished.. Be careful to call endLasso() when you get a
  18111. // mouse-up event.
  18112. jassert (isMouseButtonDownAnywhere());
  18113. }
  18114. bool hitTest (int x, int y) { return false; }
  18115. juce_UseDebuggingNewOperator
  18116. private:
  18117. Array <SelectableItemType> originalSelection;
  18118. LassoSource <SelectableItemType>* source;
  18119. int outlineThickness;
  18120. Point<int> dragStartPos;
  18121. };
  18122. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  18123. /*** End of inlined file: juce_LassoComponent.h ***/
  18124. #endif
  18125. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  18126. #endif
  18127. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  18128. #endif
  18129. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  18130. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  18131. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  18132. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  18133. class JUCE_API MouseHoverDetector
  18134. {
  18135. public:
  18136. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  18137. virtual ~MouseHoverDetector();
  18138. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  18139. void setHoverComponent (Component* const newSourceComponent);
  18140. protected:
  18141. virtual void mouseHovered (int mouseX,
  18142. int mouseY) = 0;
  18143. virtual void mouseMovedAfterHover() = 0;
  18144. private:
  18145. class JUCE_API HoverDetectorInternal : public MouseListener,
  18146. public Timer
  18147. {
  18148. public:
  18149. MouseHoverDetector* owner;
  18150. int lastX, lastY;
  18151. void timerCallback();
  18152. void mouseEnter (const MouseEvent&);
  18153. void mouseExit (const MouseEvent&);
  18154. void mouseDown (const MouseEvent&);
  18155. void mouseUp (const MouseEvent&);
  18156. void mouseMove (const MouseEvent&);
  18157. void mouseWheelMove (const MouseEvent&, float, float);
  18158. } internalTimer;
  18159. friend class HoverDetectorInternal;
  18160. Component* source;
  18161. int hoverTimeMillisecs;
  18162. bool hasJustHovered;
  18163. void hoverTimerCallback();
  18164. void checkJustHoveredCallback();
  18165. MouseHoverDetector (const MouseHoverDetector&);
  18166. MouseHoverDetector& operator= (const MouseHoverDetector&);
  18167. };
  18168. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  18169. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  18170. #endif
  18171. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18172. /*** Start of inlined file: juce_MouseInputSource.h ***/
  18173. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18174. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18175. class Component;
  18176. class ComponentPeer;
  18177. class MouseInputSourceInternal;
  18178. class JUCE_API MouseInputSource
  18179. {
  18180. public:
  18181. MouseInputSource (int index, bool isMouseDevice);
  18182. ~MouseInputSource();
  18183. bool isMouse() const;
  18184. bool isTouch() const;
  18185. bool canHover() const;
  18186. bool hasMouseWheel() const;
  18187. int getIndex() const;
  18188. bool isDragging() const;
  18189. const Point<int> getScreenPosition() const;
  18190. const ModifierKeys getCurrentModifiers() const;
  18191. Component* getComponentUnderMouse() const;
  18192. void triggerFakeMove() const;
  18193. int getNumberOfMultipleClicks() const throw();
  18194. const Time getLastMouseDownTime() const throw();
  18195. const Point<int> getLastMouseDownPosition() const throw();
  18196. bool hasMouseMovedSignificantlySincePressed() const throw();
  18197. bool hasMouseCursor() const throw();
  18198. void showMouseCursor (const MouseCursor& cursor);
  18199. void hideCursor();
  18200. void revealCursor();
  18201. void forceMouseCursorUpdate();
  18202. bool canDoUnboundedMovement() const throw();
  18203. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  18204. juce_UseDebuggingNewOperator
  18205. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  18206. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18207. private:
  18208. friend class Desktop;
  18209. friend class ComponentPeer;
  18210. friend class MouseInputSourceInternal;
  18211. ScopedPointer<MouseInputSourceInternal> pimpl;
  18212. MouseInputSource (const MouseInputSource&);
  18213. MouseInputSource& operator= (const MouseInputSource&);
  18214. };
  18215. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18216. /*** End of inlined file: juce_MouseInputSource.h ***/
  18217. #endif
  18218. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  18219. #endif
  18220. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  18221. #endif
  18222. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18223. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  18224. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18225. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18226. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  18227. private ButtonListener
  18228. {
  18229. protected:
  18230. BooleanPropertyComponent (const String& propertyName,
  18231. const String& buttonTextWhenTrue,
  18232. const String& buttonTextWhenFalse);
  18233. public:
  18234. BooleanPropertyComponent (const Value& valueToControl,
  18235. const String& propertyName,
  18236. const String& buttonText);
  18237. ~BooleanPropertyComponent();
  18238. virtual void setState (bool newState);
  18239. virtual bool getState() const;
  18240. void paint (Graphics& g);
  18241. void refresh();
  18242. void buttonClicked (Button*);
  18243. juce_UseDebuggingNewOperator
  18244. private:
  18245. ToggleButton* button;
  18246. String onText, offText;
  18247. void createButton();
  18248. BooleanPropertyComponent (const BooleanPropertyComponent&);
  18249. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  18250. };
  18251. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18252. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  18253. #endif
  18254. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18255. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  18256. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18257. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18258. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  18259. private ButtonListener
  18260. {
  18261. public:
  18262. ButtonPropertyComponent (const String& propertyName,
  18263. bool triggerOnMouseDown);
  18264. ~ButtonPropertyComponent();
  18265. virtual void buttonClicked() = 0;
  18266. virtual const String getButtonText() const = 0;
  18267. void refresh();
  18268. void buttonClicked (Button*);
  18269. juce_UseDebuggingNewOperator
  18270. private:
  18271. TextButton* button;
  18272. ButtonPropertyComponent (const ButtonPropertyComponent&);
  18273. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  18274. };
  18275. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18276. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  18277. #endif
  18278. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18279. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  18280. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18281. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18282. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  18283. private ComboBoxListener
  18284. {
  18285. protected:
  18286. ChoicePropertyComponent (const String& propertyName);
  18287. public:
  18288. ChoicePropertyComponent (const Value& valueToControl,
  18289. const String& propertyName,
  18290. const StringArray& choices,
  18291. const Array <int>* choiceIDs = 0);
  18292. ~ChoicePropertyComponent();
  18293. virtual void setIndex (int newIndex);
  18294. virtual int getIndex() const;
  18295. const StringArray& getChoices() const;
  18296. void refresh();
  18297. void comboBoxChanged (ComboBox*);
  18298. juce_UseDebuggingNewOperator
  18299. protected:
  18300. StringArray choices;
  18301. private:
  18302. ComboBox* comboBox;
  18303. void createComboBox (const Array <int>* choiceIDs);
  18304. ChoicePropertyComponent (const ChoicePropertyComponent&);
  18305. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  18306. };
  18307. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18308. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  18309. #endif
  18310. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  18311. #endif
  18312. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  18313. #endif
  18314. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18315. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  18316. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18317. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18318. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  18319. private SliderListener
  18320. {
  18321. protected:
  18322. SliderPropertyComponent (const String& propertyName,
  18323. double rangeMin,
  18324. double rangeMax,
  18325. double interval,
  18326. double skewFactor = 1.0);
  18327. public:
  18328. SliderPropertyComponent (const Value& valueToControl,
  18329. const String& propertyName,
  18330. double rangeMin,
  18331. double rangeMax,
  18332. double interval,
  18333. double skewFactor = 1.0);
  18334. ~SliderPropertyComponent();
  18335. virtual void setValue (double newValue);
  18336. virtual double getValue() const;
  18337. void refresh();
  18338. void changeListenerCallback (void*);
  18339. void sliderValueChanged (Slider*);
  18340. juce_UseDebuggingNewOperator
  18341. protected:
  18342. Slider* slider;
  18343. SliderPropertyComponent (const SliderPropertyComponent&);
  18344. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18345. };
  18346. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18347. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18348. #endif
  18349. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18350. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18351. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18352. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18353. class JUCE_API TextPropertyComponent : public PropertyComponent
  18354. {
  18355. protected:
  18356. TextPropertyComponent (const String& propertyName,
  18357. int maxNumChars,
  18358. bool isMultiLine);
  18359. public:
  18360. TextPropertyComponent (const Value& valueToControl,
  18361. const String& propertyName,
  18362. int maxNumChars,
  18363. bool isMultiLine);
  18364. ~TextPropertyComponent();
  18365. virtual void setText (const String& newText);
  18366. virtual const String getText() const;
  18367. void refresh();
  18368. void textWasEdited();
  18369. juce_UseDebuggingNewOperator
  18370. private:
  18371. Label* textEditor;
  18372. void createEditor (int maxNumChars, bool isMultiLine);
  18373. TextPropertyComponent (const TextPropertyComponent&);
  18374. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18375. };
  18376. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18377. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18378. #endif
  18379. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18380. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18381. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18382. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18383. #if JUCE_WINDOWS || DOXYGEN
  18384. class JUCE_API ActiveXControlComponent : public Component
  18385. {
  18386. public:
  18387. ActiveXControlComponent();
  18388. ~ActiveXControlComponent();
  18389. bool createControl (const void* controlIID);
  18390. void deleteControl();
  18391. bool isControlOpen() const throw() { return control != 0; }
  18392. void* queryInterface (const void* iid) const;
  18393. void setMouseEventsAllowed (bool eventsCanReachControl);
  18394. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18395. void paint (Graphics& g);
  18396. void* originalWndProc;
  18397. juce_UseDebuggingNewOperator
  18398. private:
  18399. class Pimpl;
  18400. friend class Pimpl;
  18401. friend class ScopedPointer <Pimpl>;
  18402. ScopedPointer <Pimpl> control;
  18403. bool mouseEventsAllowed;
  18404. void setControlBounds (const Rectangle<int>& bounds) const;
  18405. void setControlVisible (bool b) const;
  18406. ActiveXControlComponent (const ActiveXControlComponent&);
  18407. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18408. };
  18409. #endif
  18410. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18411. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18412. #endif
  18413. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18414. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18415. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18416. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18417. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18418. public ComboBoxListener,
  18419. public ButtonListener,
  18420. public ChangeListener
  18421. {
  18422. public:
  18423. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18424. const int minAudioInputChannels,
  18425. const int maxAudioInputChannels,
  18426. const int minAudioOutputChannels,
  18427. const int maxAudioOutputChannels,
  18428. const bool showMidiInputOptions,
  18429. const bool showMidiOutputSelector,
  18430. const bool showChannelsAsStereoPairs,
  18431. const bool hideAdvancedOptionsWithButton);
  18432. ~AudioDeviceSelectorComponent();
  18433. void resized();
  18434. void comboBoxChanged (ComboBox*);
  18435. void buttonClicked (Button*);
  18436. void changeListenerCallback (void*);
  18437. void childBoundsChanged (Component*);
  18438. juce_UseDebuggingNewOperator
  18439. private:
  18440. AudioDeviceManager& deviceManager;
  18441. ComboBox* deviceTypeDropDown;
  18442. Label* deviceTypeDropDownLabel;
  18443. Component* audioDeviceSettingsComp;
  18444. String audioDeviceSettingsCompType;
  18445. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18446. const bool showChannelsAsStereoPairs;
  18447. const bool hideAdvancedOptionsWithButton;
  18448. class MidiInputSelectorComponentListBox;
  18449. MidiInputSelectorComponentListBox* midiInputsList;
  18450. Label* midiInputsLabel;
  18451. ComboBox* midiOutputSelector;
  18452. Label* midiOutputLabel;
  18453. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18454. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18455. };
  18456. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18457. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18458. #endif
  18459. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18460. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18461. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18462. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18463. class JUCE_API BubbleComponent : public Component
  18464. {
  18465. protected:
  18466. BubbleComponent();
  18467. public:
  18468. ~BubbleComponent();
  18469. enum BubblePlacement
  18470. {
  18471. above = 1,
  18472. below = 2,
  18473. left = 4,
  18474. right = 8
  18475. };
  18476. void setAllowedPlacement (int newPlacement);
  18477. void setPosition (Component* componentToPointTo);
  18478. void setPosition (int arrowTipX,
  18479. int arrowTipY);
  18480. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18481. protected:
  18482. virtual void getContentSize (int& width, int& height) = 0;
  18483. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18484. public:
  18485. void paint (Graphics& g);
  18486. juce_UseDebuggingNewOperator
  18487. private:
  18488. Rectangle<int> content;
  18489. int side, allowablePlacements;
  18490. float arrowTipX, arrowTipY;
  18491. DropShadowEffect shadow;
  18492. BubbleComponent (const BubbleComponent&);
  18493. BubbleComponent& operator= (const BubbleComponent&);
  18494. };
  18495. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18496. /*** End of inlined file: juce_BubbleComponent.h ***/
  18497. #endif
  18498. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18499. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18500. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18501. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18502. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18503. private Timer
  18504. {
  18505. public:
  18506. BubbleMessageComponent (int fadeOutLengthMs = 150);
  18507. ~BubbleMessageComponent();
  18508. void showAt (int x, int y,
  18509. const String& message,
  18510. int numMillisecondsBeforeRemoving,
  18511. bool removeWhenMouseClicked = true,
  18512. bool deleteSelfAfterUse = false);
  18513. void showAt (Component* component,
  18514. const String& message,
  18515. int numMillisecondsBeforeRemoving,
  18516. bool removeWhenMouseClicked = true,
  18517. bool deleteSelfAfterUse = false);
  18518. void getContentSize (int& w, int& h);
  18519. void paintContent (Graphics& g, int w, int h);
  18520. void timerCallback();
  18521. juce_UseDebuggingNewOperator
  18522. private:
  18523. int fadeOutLength, mouseClickCounter;
  18524. TextLayout textLayout;
  18525. int64 expiryTime;
  18526. bool deleteAfterUse;
  18527. void init (int numMillisecondsBeforeRemoving,
  18528. bool removeWhenMouseClicked,
  18529. bool deleteSelfAfterUse);
  18530. BubbleMessageComponent (const BubbleMessageComponent&);
  18531. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18532. };
  18533. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18534. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18535. #endif
  18536. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18537. /*** Start of inlined file: juce_ColourSelector.h ***/
  18538. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18539. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18540. class JUCE_API ColourSelector : public Component,
  18541. public ChangeBroadcaster,
  18542. protected SliderListener
  18543. {
  18544. public:
  18545. enum ColourSelectorOptions
  18546. {
  18547. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18548. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18549. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18550. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18551. };
  18552. ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18553. int edgeGap = 4,
  18554. int gapAroundColourSpaceComponent = 7);
  18555. ~ColourSelector();
  18556. const Colour getCurrentColour() const;
  18557. void setCurrentColour (const Colour& newColour);
  18558. virtual int getNumSwatches() const;
  18559. virtual const Colour getSwatchColour (int index) const;
  18560. virtual void setSwatchColour (int index, const Colour& newColour) const;
  18561. enum ColourIds
  18562. {
  18563. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18564. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18565. };
  18566. juce_UseDebuggingNewOperator
  18567. private:
  18568. class ColourSpaceView;
  18569. class HueSelectorComp;
  18570. class SwatchComponent;
  18571. friend class ColourSpaceView;
  18572. friend class HueSelectorComp;
  18573. Colour colour;
  18574. float h, s, v;
  18575. Slider* sliders[4];
  18576. ColourSpaceView* colourSpace;
  18577. HueSelectorComp* hueSelector;
  18578. OwnedArray <SwatchComponent> swatchComponents;
  18579. const int flags;
  18580. int topSpace, edgeGap;
  18581. void setHue (float newH);
  18582. void setSV (float newS, float newV);
  18583. void updateHSV();
  18584. void update();
  18585. void sliderValueChanged (Slider*);
  18586. void paint (Graphics& g);
  18587. void resized();
  18588. ColourSelector (const ColourSelector&);
  18589. ColourSelector& operator= (const ColourSelector&);
  18590. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18591. // have changed - if you get an error here, update your code to use the new constructor instead..
  18592. // (xxx - note to self: remember to remove this at some point in the future)
  18593. ColourSelector (bool);
  18594. };
  18595. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18596. /*** End of inlined file: juce_ColourSelector.h ***/
  18597. #endif
  18598. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18599. #endif
  18600. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18601. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18602. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18603. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18604. class JUCE_API MagnifierComponent : public Component
  18605. {
  18606. public:
  18607. MagnifierComponent (Component* contentComponent,
  18608. bool deleteContentCompWhenNoLongerNeeded);
  18609. ~MagnifierComponent();
  18610. Component* getContentComponent() const { return content; }
  18611. void setScaleFactor (double newScaleFactor);
  18612. double getScaleFactor() const { return scaleFactor; }
  18613. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18614. juce_UseDebuggingNewOperator
  18615. void childBoundsChanged (Component*);
  18616. private:
  18617. Component* content;
  18618. Component* holderComp;
  18619. double scaleFactor;
  18620. ComponentPeer* peer;
  18621. bool deleteContent;
  18622. Graphics::ResamplingQuality quality;
  18623. MouseInputSource mouseSource;
  18624. void paint (Graphics& g);
  18625. void mouseDown (const MouseEvent& e);
  18626. void mouseUp (const MouseEvent& e);
  18627. void mouseDrag (const MouseEvent& e);
  18628. void mouseMove (const MouseEvent& e);
  18629. void mouseEnter (const MouseEvent& e);
  18630. void mouseExit (const MouseEvent& e);
  18631. void mouseWheelMove (const MouseEvent& e, float, float);
  18632. void passOnMouseEventToPeer (const MouseEvent& e);
  18633. int scaleInt (int n) const;
  18634. MagnifierComponent (const MagnifierComponent&);
  18635. MagnifierComponent& operator= (const MagnifierComponent&);
  18636. };
  18637. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18638. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18639. #endif
  18640. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18641. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18642. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18643. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18644. class JUCE_API MidiKeyboardComponent : public Component,
  18645. public MidiKeyboardStateListener,
  18646. public ChangeBroadcaster,
  18647. private Timer,
  18648. private AsyncUpdater
  18649. {
  18650. public:
  18651. enum Orientation
  18652. {
  18653. horizontalKeyboard,
  18654. verticalKeyboardFacingLeft,
  18655. verticalKeyboardFacingRight,
  18656. };
  18657. MidiKeyboardComponent (MidiKeyboardState& state,
  18658. Orientation orientation);
  18659. ~MidiKeyboardComponent();
  18660. void setVelocity (float velocity, bool useMousePositionForVelocity);
  18661. void setMidiChannel (int midiChannelNumber);
  18662. int getMidiChannel() const throw() { return midiChannel; }
  18663. void setMidiChannelsToDisplay (int midiChannelMask);
  18664. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18665. void setKeyWidth (float widthInPixels);
  18666. float getKeyWidth() const throw() { return keyWidth; }
  18667. void setOrientation (Orientation newOrientation);
  18668. const Orientation getOrientation() const throw() { return orientation; }
  18669. void setAvailableRange (int lowestNote,
  18670. int highestNote);
  18671. int getRangeStart() const throw() { return rangeStart; }
  18672. int getRangeEnd() const throw() { return rangeEnd; }
  18673. void setLowestVisibleKey (int noteNumber);
  18674. int getLowestVisibleKey() const throw() { return firstKey; }
  18675. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18676. void setScrollButtonsVisible (bool canScroll);
  18677. enum ColourIds
  18678. {
  18679. whiteNoteColourId = 0x1005000,
  18680. blackNoteColourId = 0x1005001,
  18681. keySeparatorLineColourId = 0x1005002,
  18682. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18683. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18684. textLabelColourId = 0x1005005,
  18685. upDownButtonBackgroundColourId = 0x1005006,
  18686. upDownButtonArrowColourId = 0x1005007
  18687. };
  18688. int getKeyStartPosition (const int midiNoteNumber) const;
  18689. void clearKeyMappings();
  18690. void setKeyPressForNote (const KeyPress& key,
  18691. int midiNoteOffsetFromC);
  18692. void removeKeyPressForNote (int midiNoteOffsetFromC);
  18693. void setKeyPressBaseOctave (int newOctaveNumber);
  18694. void setOctaveForMiddleC (int octaveNumForMiddleC);
  18695. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18696. void paint (Graphics& g);
  18697. void resized();
  18698. void mouseMove (const MouseEvent& e);
  18699. void mouseDrag (const MouseEvent& e);
  18700. void mouseDown (const MouseEvent& e);
  18701. void mouseUp (const MouseEvent& e);
  18702. void mouseEnter (const MouseEvent& e);
  18703. void mouseExit (const MouseEvent& e);
  18704. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18705. void timerCallback();
  18706. bool keyStateChanged (bool isKeyDown);
  18707. void focusLost (FocusChangeType cause);
  18708. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18709. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18710. void handleAsyncUpdate();
  18711. void colourChanged();
  18712. juce_UseDebuggingNewOperator
  18713. protected:
  18714. friend class MidiKeyboardUpDownButton;
  18715. virtual void drawWhiteNote (int midiNoteNumber,
  18716. Graphics& g,
  18717. int x, int y, int w, int h,
  18718. bool isDown, bool isOver,
  18719. const Colour& lineColour,
  18720. const Colour& textColour);
  18721. virtual void drawBlackNote (int midiNoteNumber,
  18722. Graphics& g,
  18723. int x, int y, int w, int h,
  18724. bool isDown, bool isOver,
  18725. const Colour& noteFillColour);
  18726. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18727. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18728. const bool isMouseOver,
  18729. const bool isButtonPressed,
  18730. const bool movesOctavesUp);
  18731. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18732. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18733. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18734. int& x, int& w) const;
  18735. private:
  18736. MidiKeyboardState& state;
  18737. int xOffset, blackNoteLength;
  18738. float keyWidth;
  18739. Orientation orientation;
  18740. int midiChannel, midiInChannelMask;
  18741. float velocity;
  18742. int noteUnderMouse, mouseDownNote;
  18743. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18744. int rangeStart, rangeEnd, firstKey;
  18745. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18746. Button* scrollDown;
  18747. Button* scrollUp;
  18748. Array <KeyPress> keyPresses;
  18749. Array <int> keyPressNotes;
  18750. int keyMappingOctave;
  18751. int octaveNumForMiddleC;
  18752. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18753. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18754. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18755. void resetAnyKeysInUse();
  18756. void updateNoteUnderMouse (const Point<int>& pos);
  18757. void repaintNote (const int midiNoteNumber);
  18758. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18759. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18760. };
  18761. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18762. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18763. #endif
  18764. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18765. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18766. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18767. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18768. #if ! DOXYGEN
  18769. class NSViewComponentInternal;
  18770. #endif
  18771. #if JUCE_MAC || DOXYGEN
  18772. class JUCE_API NSViewComponent : public Component
  18773. {
  18774. public:
  18775. NSViewComponent();
  18776. ~NSViewComponent();
  18777. void setView (void* nsView);
  18778. void* getView() const;
  18779. void paint (Graphics& g);
  18780. juce_UseDebuggingNewOperator
  18781. private:
  18782. friend class NSViewComponentInternal;
  18783. ScopedPointer <NSViewComponentInternal> info;
  18784. NSViewComponent (const NSViewComponent&);
  18785. NSViewComponent& operator= (const NSViewComponent&);
  18786. };
  18787. #endif
  18788. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18789. /*** End of inlined file: juce_NSViewComponent.h ***/
  18790. #endif
  18791. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18792. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18793. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18794. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18795. // this is used to disable OpenGL, and is defined in juce_Config.h
  18796. #if JUCE_OPENGL || DOXYGEN
  18797. class JUCE_API OpenGLPixelFormat
  18798. {
  18799. public:
  18800. OpenGLPixelFormat (int bitsPerRGBComponent = 8,
  18801. int alphaBits = 8,
  18802. int depthBufferBits = 16,
  18803. int stencilBufferBits = 0);
  18804. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18805. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18806. bool operator== (const OpenGLPixelFormat&) const;
  18807. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18808. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18809. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18810. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18811. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18812. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18813. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18814. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18815. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18816. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18817. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18818. static void getAvailablePixelFormats (Component* component,
  18819. OwnedArray <OpenGLPixelFormat>& results);
  18820. juce_UseDebuggingNewOperator
  18821. };
  18822. class JUCE_API OpenGLContext
  18823. {
  18824. public:
  18825. virtual ~OpenGLContext();
  18826. virtual bool makeActive() const throw() = 0;
  18827. virtual bool makeInactive() const throw() = 0;
  18828. virtual bool isActive() const throw() = 0;
  18829. virtual void swapBuffers() = 0;
  18830. virtual bool setSwapInterval (int numFramesPerSwap) = 0;
  18831. virtual int getSwapInterval() const = 0;
  18832. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18833. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18834. virtual void repaint() = 0;
  18835. virtual void* getRawContext() const throw() = 0;
  18836. static OpenGLContext* getCurrentContext();
  18837. juce_UseDebuggingNewOperator
  18838. protected:
  18839. OpenGLContext() throw();
  18840. };
  18841. class JUCE_API OpenGLComponent : public Component
  18842. {
  18843. public:
  18844. enum OpenGLType
  18845. {
  18846. openGLDefault = 0,
  18847. #if JUCE_IPHONE
  18848. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18849. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18850. #endif
  18851. };
  18852. OpenGLComponent (OpenGLType type = openGLDefault);
  18853. ~OpenGLComponent();
  18854. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18855. const OpenGLPixelFormat getPixelFormat() const;
  18856. void shareWith (OpenGLContext* contextToShareListsWith);
  18857. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18858. void swapBuffers();
  18859. virtual void renderOpenGL() = 0;
  18860. virtual void newOpenGLContextCreated() = 0;
  18861. OpenGLContext* getCurrentContext() const throw() { return context; }
  18862. bool makeCurrentContextActive();
  18863. void makeCurrentContextInactive();
  18864. bool isActiveContext() const throw();
  18865. virtual bool renderAndSwapBuffers();
  18866. CriticalSection& getContextLock() throw() { return contextLock; }
  18867. void paint (Graphics& g);
  18868. void* getNativeWindowHandle() const;
  18869. juce_UseDebuggingNewOperator
  18870. private:
  18871. const OpenGLType type;
  18872. class OpenGLComponentWatcher;
  18873. friend class OpenGLComponentWatcher;
  18874. friend class ScopedPointer <OpenGLComponentWatcher>;
  18875. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18876. ScopedPointer <OpenGLContext> context;
  18877. OpenGLContext* contextToShareListsWith;
  18878. CriticalSection contextLock;
  18879. OpenGLPixelFormat preferredPixelFormat;
  18880. bool needToUpdateViewport;
  18881. OpenGLContext* createContext();
  18882. void deleteContext();
  18883. void updateContextPosition();
  18884. void internalRepaint (int x, int y, int w, int h);
  18885. OpenGLComponent (const OpenGLComponent&);
  18886. OpenGLComponent& operator= (const OpenGLComponent&);
  18887. };
  18888. #endif
  18889. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18890. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18891. #endif
  18892. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18893. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18894. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18895. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18896. class JUCE_API PreferencesPanel : public Component,
  18897. private ButtonListener
  18898. {
  18899. public:
  18900. PreferencesPanel();
  18901. ~PreferencesPanel();
  18902. void addSettingsPage (const String& pageTitle,
  18903. const Drawable* normalIcon,
  18904. const Drawable* overIcon,
  18905. const Drawable* downIcon);
  18906. void addSettingsPage (const String& pageTitle,
  18907. const char* imageData,
  18908. int imageDataSize);
  18909. void showInDialogBox (const String& dialogtitle,
  18910. int dialogWidth,
  18911. int dialogHeight,
  18912. const Colour& backgroundColour = Colours::white);
  18913. virtual Component* createComponentForPage (const String& pageName) = 0;
  18914. void setCurrentPage (const String& pageName);
  18915. void resized();
  18916. void paint (Graphics& g);
  18917. void buttonClicked (Button* button);
  18918. juce_UseDebuggingNewOperator
  18919. private:
  18920. String currentPageName;
  18921. ScopedPointer <Component> currentPage;
  18922. int buttonSize;
  18923. PreferencesPanel (const PreferencesPanel&);
  18924. PreferencesPanel& operator= (const PreferencesPanel&);
  18925. };
  18926. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18927. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18928. #endif
  18929. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18930. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18931. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18932. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18933. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18934. // amalgamated build)
  18935. #if JUCE_WINDOWS
  18936. typedef ActiveXControlComponent QTCompBaseClass;
  18937. #elif JUCE_MAC
  18938. typedef NSViewComponent QTCompBaseClass;
  18939. #endif
  18940. // this is used to disable QuickTime, and is defined in juce_Config.h
  18941. #if JUCE_QUICKTIME || DOXYGEN
  18942. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18943. {
  18944. public:
  18945. QuickTimeMovieComponent();
  18946. ~QuickTimeMovieComponent();
  18947. static bool isQuickTimeAvailable() throw();
  18948. bool loadMovie (const File& movieFile,
  18949. bool isControllerVisible);
  18950. bool loadMovie (const URL& movieURL,
  18951. bool isControllerVisible);
  18952. bool loadMovie (InputStream* movieStream,
  18953. bool isControllerVisible);
  18954. void closeMovie();
  18955. const File getCurrentMovieFile() const;
  18956. bool isMovieOpen() const;
  18957. double getMovieDuration() const;
  18958. void getMovieNormalSize (int& width, int& height) const;
  18959. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18960. const RectanglePlacement& placement);
  18961. void play();
  18962. void stop();
  18963. bool isPlaying() const;
  18964. void goToStart();
  18965. void setPosition (double seconds);
  18966. double getPosition() const;
  18967. void setSpeed (float newSpeed);
  18968. void setMovieVolume (float newVolume);
  18969. float getMovieVolume() const;
  18970. void setLooping (bool shouldLoop);
  18971. bool isLooping() const;
  18972. bool isControllerVisible() const;
  18973. void paint (Graphics& g);
  18974. juce_UseDebuggingNewOperator
  18975. private:
  18976. File movieFile;
  18977. bool movieLoaded, controllerVisible, looping;
  18978. #if JUCE_WINDOWS
  18979. void parentHierarchyChanged();
  18980. void visibilityChanged();
  18981. void createControlIfNeeded();
  18982. bool isControlCreated() const;
  18983. class Pimpl;
  18984. friend class ScopedPointer <Pimpl>;
  18985. ScopedPointer <Pimpl> pimpl;
  18986. #else
  18987. void* movie;
  18988. #endif
  18989. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18990. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18991. };
  18992. #endif
  18993. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18994. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18995. #endif
  18996. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18997. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18998. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18999. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  19000. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  19001. class JUCE_API SystemTrayIconComponent : public Component
  19002. {
  19003. public:
  19004. SystemTrayIconComponent();
  19005. ~SystemTrayIconComponent();
  19006. void setIconImage (const Image& newImage);
  19007. void setIconTooltip (const String& tooltip);
  19008. #if JUCE_LINUX
  19009. void paint (Graphics& g);
  19010. #endif
  19011. juce_UseDebuggingNewOperator
  19012. private:
  19013. SystemTrayIconComponent (const SystemTrayIconComponent&);
  19014. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  19015. };
  19016. #endif
  19017. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  19018. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  19019. #endif
  19020. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  19021. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  19022. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  19023. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  19024. #if JUCE_WEB_BROWSER || DOXYGEN
  19025. #if ! DOXYGEN
  19026. class WebBrowserComponentInternal;
  19027. #endif
  19028. class JUCE_API WebBrowserComponent : public Component
  19029. {
  19030. public:
  19031. explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true);
  19032. ~WebBrowserComponent();
  19033. void goToURL (const String& url,
  19034. const StringArray* headers = 0,
  19035. const MemoryBlock* postData = 0);
  19036. void stop();
  19037. void goBack();
  19038. void goForward();
  19039. void refresh();
  19040. virtual bool pageAboutToLoad (const String& newURL);
  19041. void paint (Graphics& g);
  19042. void resized();
  19043. void parentHierarchyChanged();
  19044. void visibilityChanged();
  19045. juce_UseDebuggingNewOperator
  19046. private:
  19047. WebBrowserComponentInternal* browser;
  19048. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  19049. String lastURL;
  19050. StringArray lastHeaders;
  19051. MemoryBlock lastPostData;
  19052. void reloadLastURL();
  19053. void checkWindowAssociation();
  19054. WebBrowserComponent (const WebBrowserComponent&);
  19055. WebBrowserComponent& operator= (const WebBrowserComponent&);
  19056. };
  19057. #endif
  19058. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  19059. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  19060. #endif
  19061. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  19062. #endif
  19063. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  19064. /*** Start of inlined file: juce_ComponentPeer.h ***/
  19065. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  19066. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  19067. class ComponentBoundsConstrainer;
  19068. class JUCE_API ComponentPeer
  19069. {
  19070. public:
  19071. enum StyleFlags
  19072. {
  19073. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  19074. entry on the taskbar (ignored on MacOSX) */
  19075. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  19076. tooltip, etc. */
  19077. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  19078. through it (may not be possible on some platforms). */
  19079. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  19080. title bar and frame\. if not specified, the window will be
  19081. borderless. */
  19082. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  19083. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  19084. minimise button on it. */
  19085. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  19086. maximise button on it. */
  19087. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  19088. close button on it. */
  19089. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  19090. not be possible on all platforms). */
  19091. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  19092. do its own repainting, but only to repaint when the
  19093. performAnyPendingRepaintsNow() method is called. */
  19094. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  19095. be used for things like plugin windows, to stop them interfering
  19096. with the host's shortcut keys */
  19097. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  19098. };
  19099. ComponentPeer (Component* component, int styleFlags);
  19100. virtual ~ComponentPeer();
  19101. Component* getComponent() const throw() { return component; }
  19102. int getStyleFlags() const throw() { return styleFlags; }
  19103. virtual void* getNativeHandle() const = 0;
  19104. virtual void setVisible (bool shouldBeVisible) = 0;
  19105. virtual void setTitle (const String& title) = 0;
  19106. virtual void setPosition (int x, int y) = 0;
  19107. virtual void setSize (int w, int h) = 0;
  19108. virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0;
  19109. virtual const Rectangle<int> getBounds() const = 0;
  19110. virtual const Point<int> getScreenPosition() const = 0;
  19111. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  19112. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  19113. virtual void setMinimised (bool shouldBeMinimised) = 0;
  19114. virtual bool isMinimised() const = 0;
  19115. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  19116. virtual bool isFullScreen() const = 0;
  19117. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  19118. const Rectangle<int>& getNonFullScreenBounds() const throw();
  19119. virtual void setIcon (const Image& newIcon) = 0;
  19120. void setConstrainer (ComponentBoundsConstrainer* newConstrainer) throw();
  19121. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  19122. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  19123. virtual const BorderSize getFrameSize() const = 0;
  19124. void handleMovedOrResized();
  19125. void handleScreenSizeChange();
  19126. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  19127. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  19128. virtual void toFront (bool makeActive) = 0;
  19129. virtual void toBehind (ComponentPeer* other) = 0;
  19130. void handleBroughtToFront();
  19131. virtual bool isFocused() const = 0;
  19132. virtual void grabFocus() = 0;
  19133. virtual void textInputRequired (const Point<int>& position) = 0;
  19134. void handleFocusGain();
  19135. void handleFocusLoss();
  19136. Component* getLastFocusedSubcomponent() const throw();
  19137. bool handleKeyPress (int keyCode,
  19138. juce_wchar textCharacter);
  19139. bool handleKeyUpOrDown (bool isKeyDown);
  19140. void handleModifierKeysChange();
  19141. TextInputTarget* findCurrentTextInputTarget();
  19142. virtual void repaint (int x, int y, int w, int h) = 0;
  19143. virtual void performAnyPendingRepaintsNow() = 0;
  19144. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
  19145. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  19146. void handleUserClosingWindow();
  19147. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  19148. void handleFileDragExit (const StringArray& files);
  19149. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  19150. void clearMaskedRegion();
  19151. void addMaskedRegion (int x, int y, int w, int h);
  19152. static int getNumPeers() throw();
  19153. static ComponentPeer* getPeer (int index) throw();
  19154. static bool isValidPeer (const ComponentPeer* peer) throw();
  19155. static void bringModalComponentToFront();
  19156. virtual const StringArray getAvailableRenderingEngines() throw();
  19157. virtual int getCurrentRenderingEngine() throw();
  19158. virtual void setCurrentRenderingEngine (int index) throw();
  19159. juce_UseDebuggingNewOperator
  19160. protected:
  19161. Component* const component;
  19162. const int styleFlags;
  19163. RectangleList maskedRegion;
  19164. Rectangle<int> lastNonFullscreenBounds;
  19165. uint32 lastPaintTime;
  19166. ComponentBoundsConstrainer* constrainer;
  19167. static void updateCurrentModifiers() throw();
  19168. private:
  19169. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  19170. Component* lastDragAndDropCompUnderMouse;
  19171. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  19172. friend class Component;
  19173. static ComponentPeer* getPeerFor (const Component* component) throw();
  19174. void setLastDragDropTarget (Component* comp);
  19175. ComponentPeer (const ComponentPeer&);
  19176. ComponentPeer& operator= (const ComponentPeer&);
  19177. };
  19178. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  19179. /*** End of inlined file: juce_ComponentPeer.h ***/
  19180. #endif
  19181. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  19182. /*** Start of inlined file: juce_DialogWindow.h ***/
  19183. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  19184. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  19185. class JUCE_API DialogWindow : public DocumentWindow
  19186. {
  19187. public:
  19188. DialogWindow (const String& name,
  19189. const Colour& backgroundColour,
  19190. bool escapeKeyTriggersCloseButton,
  19191. bool addToDesktop = true);
  19192. ~DialogWindow();
  19193. static int showModalDialog (const String& dialogTitle,
  19194. Component* contentComponent,
  19195. Component* componentToCentreAround,
  19196. const Colour& backgroundColour,
  19197. bool escapeKeyTriggersCloseButton,
  19198. bool shouldBeResizable = false,
  19199. bool useBottomRightCornerResizer = false);
  19200. juce_UseDebuggingNewOperator
  19201. protected:
  19202. void resized();
  19203. private:
  19204. bool escapeKeyTriggersCloseButton;
  19205. DialogWindow (const DialogWindow&);
  19206. DialogWindow& operator= (const DialogWindow&);
  19207. };
  19208. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  19209. /*** End of inlined file: juce_DialogWindow.h ***/
  19210. #endif
  19211. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  19212. #endif
  19213. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  19214. #endif
  19215. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  19216. /*** Start of inlined file: juce_SplashScreen.h ***/
  19217. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  19218. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  19219. class JUCE_API SplashScreen : public Component,
  19220. public Timer,
  19221. private DeletedAtShutdown
  19222. {
  19223. public:
  19224. SplashScreen();
  19225. ~SplashScreen();
  19226. void show (const String& title,
  19227. Image* backgroundImage,
  19228. int minimumTimeToDisplayFor,
  19229. bool useDropShadow,
  19230. bool removeOnMouseClick = true);
  19231. void show (const String& title,
  19232. int width,
  19233. int height,
  19234. int minimumTimeToDisplayFor,
  19235. bool useDropShadow,
  19236. bool removeOnMouseClick = true);
  19237. void paint (Graphics& g);
  19238. void timerCallback();
  19239. juce_UseDebuggingNewOperator
  19240. private:
  19241. Image* backgroundImage;
  19242. Time earliestTimeToDelete;
  19243. int originalClickCounter;
  19244. SplashScreen (const SplashScreen&);
  19245. SplashScreen& operator= (const SplashScreen&);
  19246. };
  19247. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  19248. /*** End of inlined file: juce_SplashScreen.h ***/
  19249. #endif
  19250. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19251. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  19252. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19253. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19254. class JUCE_API ThreadWithProgressWindow : public Thread,
  19255. private Timer
  19256. {
  19257. public:
  19258. ThreadWithProgressWindow (const String& windowTitle,
  19259. bool hasProgressBar,
  19260. bool hasCancelButton,
  19261. int timeOutMsWhenCancelling = 10000,
  19262. const String& cancelButtonText = "Cancel");
  19263. ~ThreadWithProgressWindow();
  19264. bool runThread (int threadPriority = 5);
  19265. void setProgress (double newProgress);
  19266. void setStatusMessage (const String& newStatusMessage);
  19267. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  19268. juce_UseDebuggingNewOperator
  19269. private:
  19270. void timerCallback();
  19271. double progress;
  19272. ScopedPointer <AlertWindow> alertWindow;
  19273. String message;
  19274. CriticalSection messageLock;
  19275. const int timeOutMsWhenCancelling;
  19276. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  19277. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  19278. };
  19279. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19280. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  19281. #endif
  19282. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  19283. #endif
  19284. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  19285. #endif
  19286. #ifndef __JUCE_COLOUR_JUCEHEADER__
  19287. #endif
  19288. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  19289. #endif
  19290. #ifndef __JUCE_COLOURS_JUCEHEADER__
  19291. #endif
  19292. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  19293. #endif
  19294. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  19295. #endif
  19296. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  19297. #endif
  19298. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  19299. #endif
  19300. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  19301. #endif
  19302. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19303. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  19304. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19305. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19306. class JUCE_API LowLevelGraphicsContext
  19307. {
  19308. protected:
  19309. LowLevelGraphicsContext();
  19310. public:
  19311. virtual ~LowLevelGraphicsContext();
  19312. virtual bool isVectorDevice() const = 0;
  19313. virtual void setOrigin (int x, int y) = 0;
  19314. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  19315. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  19316. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  19317. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  19318. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  19319. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  19320. virtual const Rectangle<int> getClipBounds() const = 0;
  19321. virtual bool isClipEmpty() const = 0;
  19322. virtual void saveState() = 0;
  19323. virtual void restoreState() = 0;
  19324. virtual void setFill (const FillType& fillType) = 0;
  19325. virtual void setOpacity (float newOpacity) = 0;
  19326. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  19327. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  19328. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  19329. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19330. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  19331. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  19332. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  19333. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  19334. virtual void setFont (const Font& newFont) = 0;
  19335. virtual const Font getFont() = 0;
  19336. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  19337. };
  19338. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19339. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  19340. #endif
  19341. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19342. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19343. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19344. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19345. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  19346. {
  19347. public:
  19348. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19349. const String& documentTitle,
  19350. int totalWidth,
  19351. int totalHeight);
  19352. ~LowLevelGraphicsPostScriptRenderer();
  19353. bool isVectorDevice() const;
  19354. void setOrigin (int x, int y);
  19355. bool clipToRectangle (const Rectangle<int>& r);
  19356. bool clipToRectangleList (const RectangleList& clipRegion);
  19357. void excludeClipRectangle (const Rectangle<int>& r);
  19358. void clipToPath (const Path& path, const AffineTransform& transform);
  19359. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19360. void saveState();
  19361. void restoreState();
  19362. bool clipRegionIntersects (const Rectangle<int>& r);
  19363. const Rectangle<int> getClipBounds() const;
  19364. bool isClipEmpty() const;
  19365. void setFill (const FillType& fillType);
  19366. void setOpacity (float opacity);
  19367. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19368. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19369. void fillPath (const Path& path, const AffineTransform& transform);
  19370. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19371. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19372. void drawLine (double x1, double y1, double x2, double y2);
  19373. void drawVerticalLine (int x, double top, double bottom);
  19374. void drawHorizontalLine (int x, double top, double bottom);
  19375. const Font getFont();
  19376. void setFont (const Font& newFont);
  19377. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19378. juce_UseDebuggingNewOperator
  19379. protected:
  19380. OutputStream& out;
  19381. int totalWidth, totalHeight;
  19382. bool needToClip;
  19383. Colour lastColour;
  19384. struct SavedState
  19385. {
  19386. SavedState();
  19387. ~SavedState();
  19388. RectangleList clip;
  19389. int xOffset, yOffset;
  19390. FillType fillType;
  19391. Font font;
  19392. private:
  19393. SavedState& operator= (const SavedState&);
  19394. };
  19395. OwnedArray <SavedState> stateStack;
  19396. void writeClip();
  19397. void writeColour (const Colour& colour);
  19398. void writePath (const Path& path) const;
  19399. void writeXY (float x, float y) const;
  19400. void writeTransform (const AffineTransform& trans) const;
  19401. void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
  19402. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19403. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19404. };
  19405. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19406. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19407. #endif
  19408. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19409. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19410. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19411. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19412. class LLGCSavedState;
  19413. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19414. {
  19415. public:
  19416. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19417. ~LowLevelGraphicsSoftwareRenderer();
  19418. bool isVectorDevice() const;
  19419. void setOrigin (int x, int y);
  19420. bool clipToRectangle (const Rectangle<int>& r);
  19421. bool clipToRectangleList (const RectangleList& clipRegion);
  19422. void excludeClipRectangle (const Rectangle<int>& r);
  19423. void clipToPath (const Path& path, const AffineTransform& transform);
  19424. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19425. bool clipRegionIntersects (const Rectangle<int>& r);
  19426. const Rectangle<int> getClipBounds() const;
  19427. bool isClipEmpty() const;
  19428. void saveState();
  19429. void restoreState();
  19430. void setFill (const FillType& fillType);
  19431. void setOpacity (float opacity);
  19432. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19433. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19434. void fillPath (const Path& path, const AffineTransform& transform);
  19435. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19436. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19437. void drawLine (double x1, double y1, double x2, double y2);
  19438. void drawVerticalLine (int x, double top, double bottom);
  19439. void drawHorizontalLine (int x, double top, double bottom);
  19440. void setFont (const Font& newFont);
  19441. const Font getFont();
  19442. void drawGlyph (int glyphNumber, float x, float y);
  19443. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19444. juce_UseDebuggingNewOperator
  19445. protected:
  19446. Image& image;
  19447. ScopedPointer <LLGCSavedState> currentState;
  19448. OwnedArray <LLGCSavedState> stateStack;
  19449. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19450. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19451. };
  19452. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19453. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19454. #endif
  19455. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19456. #endif
  19457. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19458. #endif
  19459. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19460. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19461. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19462. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19463. class JUCE_API DrawableComposite : public Drawable
  19464. {
  19465. public:
  19466. DrawableComposite();
  19467. virtual ~DrawableComposite();
  19468. void insertDrawable (Drawable* drawable,
  19469. const AffineTransform& transform = AffineTransform::identity,
  19470. int index = -1);
  19471. void insertDrawable (const Drawable& drawable,
  19472. const AffineTransform& transform = AffineTransform::identity,
  19473. int index = -1);
  19474. void removeDrawable (int index, bool deleteDrawable = true);
  19475. int getNumDrawables() const throw() { return drawables.size(); }
  19476. Drawable* getDrawable (int index) const throw() { return drawables [index]; }
  19477. const AffineTransform* getDrawableTransform (int index) const throw() { return transforms [index]; }
  19478. void bringToFront (int index);
  19479. void render (const Drawable::RenderingContext& context) const;
  19480. const Rectangle<float> getBounds() const;
  19481. bool hitTest (float x, float y) const;
  19482. Drawable* createCopy() const;
  19483. ValueTree createValueTree() const;
  19484. static DrawableComposite* createFromValueTree (const ValueTree& tree);
  19485. juce_UseDebuggingNewOperator
  19486. private:
  19487. OwnedArray <Drawable> drawables;
  19488. OwnedArray <AffineTransform> transforms;
  19489. DrawableComposite (const DrawableComposite&);
  19490. DrawableComposite& operator= (const DrawableComposite&);
  19491. };
  19492. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19493. /*** End of inlined file: juce_DrawableComposite.h ***/
  19494. #endif
  19495. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19496. /*** Start of inlined file: juce_DrawableImage.h ***/
  19497. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19498. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19499. class JUCE_API DrawableImage : public Drawable
  19500. {
  19501. public:
  19502. DrawableImage();
  19503. virtual ~DrawableImage();
  19504. void setImage (const Image& imageToCopy);
  19505. void setImage (Image* imageToUse,
  19506. bool releaseWhenNotNeeded);
  19507. Image* getImage() const throw() { return image; }
  19508. void clearImage();
  19509. void setOpacity (float newOpacity);
  19510. float getOpacity() const throw() { return opacity; }
  19511. void setOverlayColour (const Colour& newOverlayColour);
  19512. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19513. void render (const Drawable::RenderingContext& context) const;
  19514. const Rectangle<float> getBounds() const;
  19515. bool hitTest (float x, float y) const;
  19516. Drawable* createCopy() const;
  19517. ValueTree createValueTree() const;
  19518. static DrawableImage* createFromValueTree (const ValueTree& tree);
  19519. juce_UseDebuggingNewOperator
  19520. private:
  19521. Image* image;
  19522. bool canDeleteImage;
  19523. float opacity;
  19524. Colour overlayColour;
  19525. DrawableImage (const DrawableImage&);
  19526. DrawableImage& operator= (const DrawableImage&);
  19527. };
  19528. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19529. /*** End of inlined file: juce_DrawableImage.h ***/
  19530. #endif
  19531. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19532. /*** Start of inlined file: juce_DrawablePath.h ***/
  19533. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19534. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19535. class JUCE_API DrawablePath : public Drawable
  19536. {
  19537. public:
  19538. DrawablePath();
  19539. virtual ~DrawablePath();
  19540. void setPath (const Path& newPath);
  19541. const Path& getPath() const throw() { return path; }
  19542. void setFill (const FillType& newFill);
  19543. const FillType& getFill() const throw() { return mainFill; }
  19544. void setStrokeFill (const FillType& newStrokeFill);
  19545. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19546. void setStrokeType (const PathStrokeType& newStrokeType);
  19547. void setStrokeThickness (float newThickness);
  19548. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19549. void render (const Drawable::RenderingContext& context) const;
  19550. const Rectangle<float> getBounds() const;
  19551. bool hitTest (float x, float y) const;
  19552. Drawable* createCopy() const;
  19553. ValueTree createValueTree() const;
  19554. static DrawablePath* createFromValueTree (const ValueTree& tree);
  19555. juce_UseDebuggingNewOperator
  19556. private:
  19557. Path path, stroke;
  19558. FillType mainFill, strokeFill;
  19559. PathStrokeType strokeType;
  19560. void updateOutline();
  19561. DrawablePath (const DrawablePath&);
  19562. DrawablePath& operator= (const DrawablePath&);
  19563. };
  19564. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19565. /*** End of inlined file: juce_DrawablePath.h ***/
  19566. #endif
  19567. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19568. /*** Start of inlined file: juce_DrawableText.h ***/
  19569. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19570. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19571. class JUCE_API DrawableText : public Drawable
  19572. {
  19573. public:
  19574. DrawableText();
  19575. virtual ~DrawableText();
  19576. void setText (const GlyphArrangement& newText);
  19577. void setText (const String& newText, const Font& fontToUse);
  19578. const GlyphArrangement& getText() const throw() { return text; }
  19579. void setColour (const Colour& newColour);
  19580. const Colour& getColour() const throw() { return colour; }
  19581. void render (const Drawable::RenderingContext& context) const;
  19582. const Rectangle<float> getBounds() const;
  19583. bool hitTest (float x, float y) const;
  19584. Drawable* createCopy() const;
  19585. ValueTree createValueTree() const;
  19586. static DrawableText* createFromValueTree (const ValueTree& tree);
  19587. juce_UseDebuggingNewOperator
  19588. private:
  19589. GlyphArrangement text;
  19590. Colour colour;
  19591. DrawableText (const DrawableText&);
  19592. DrawableText& operator= (const DrawableText&);
  19593. };
  19594. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19595. /*** End of inlined file: juce_DrawableText.h ***/
  19596. #endif
  19597. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19598. #endif
  19599. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19600. /*** Start of inlined file: juce_GlowEffect.h ***/
  19601. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19602. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19603. class JUCE_API GlowEffect : public ImageEffectFilter
  19604. {
  19605. public:
  19606. GlowEffect();
  19607. ~GlowEffect();
  19608. void setGlowProperties (float newRadius,
  19609. const Colour& newColour);
  19610. void applyEffect (Image& sourceImage, Graphics& destContext);
  19611. juce_UseDebuggingNewOperator
  19612. private:
  19613. float radius;
  19614. Colour colour;
  19615. };
  19616. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19617. /*** End of inlined file: juce_GlowEffect.h ***/
  19618. #endif
  19619. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19620. #endif
  19621. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19622. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19623. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19624. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19625. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19626. {
  19627. public:
  19628. ReduceOpacityEffect (float opacity = 1.0f);
  19629. ~ReduceOpacityEffect();
  19630. void setOpacity (float newOpacity);
  19631. void applyEffect (Image& sourceImage, Graphics& destContext);
  19632. juce_UseDebuggingNewOperator
  19633. private:
  19634. float opacity;
  19635. };
  19636. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19637. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19638. #endif
  19639. #ifndef __JUCE_FONT_JUCEHEADER__
  19640. #endif
  19641. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19642. #endif
  19643. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19644. #endif
  19645. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19646. #endif
  19647. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19648. #endif
  19649. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19650. #endif
  19651. #ifndef __JUCE_LINE_JUCEHEADER__
  19652. #endif
  19653. #ifndef __JUCE_PATH_JUCEHEADER__
  19654. #endif
  19655. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19656. /*** Start of inlined file: juce_PathIterator.h ***/
  19657. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19658. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19659. class JUCE_API PathFlatteningIterator
  19660. {
  19661. public:
  19662. PathFlatteningIterator (const Path& path,
  19663. const AffineTransform& transform = AffineTransform::identity,
  19664. float tolerence = 6.0f);
  19665. ~PathFlatteningIterator();
  19666. bool next();
  19667. float x1;
  19668. float y1;
  19669. float x2;
  19670. float y2;
  19671. bool closesSubPath;
  19672. int subPathIndex;
  19673. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19674. && (index >= path.numElements
  19675. || points [index] == Path::moveMarker); }
  19676. juce_UseDebuggingNewOperator
  19677. private:
  19678. const Path& path;
  19679. const AffineTransform transform;
  19680. float* points;
  19681. float tolerence, subPathCloseX, subPathCloseY;
  19682. const bool isIdentityTransform;
  19683. HeapBlock <float> stackBase;
  19684. float* stackPos;
  19685. size_t index, stackSize;
  19686. PathFlatteningIterator (const PathFlatteningIterator&);
  19687. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19688. };
  19689. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19690. /*** End of inlined file: juce_PathIterator.h ***/
  19691. #endif
  19692. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19693. #endif
  19694. #ifndef __JUCE_POINT_JUCEHEADER__
  19695. #endif
  19696. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19697. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19698. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19699. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19700. class JUCE_API PositionedRectangle
  19701. {
  19702. public:
  19703. PositionedRectangle() throw();
  19704. PositionedRectangle (const String& stringVersion) throw();
  19705. PositionedRectangle (const PositionedRectangle& other) throw();
  19706. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19707. ~PositionedRectangle() throw();
  19708. const String toString() const throw();
  19709. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19710. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19711. double& x,
  19712. double& y,
  19713. double& width,
  19714. double& height) const throw();
  19715. void applyToComponent (Component& comp) const throw();
  19716. void updateFrom (const Rectangle<int>& newPosition,
  19717. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19718. void updateFromDouble (double x, double y, double width, double height,
  19719. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19720. void updateFromComponent (const Component& comp) throw();
  19721. enum AnchorPoint
  19722. {
  19723. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19724. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19725. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19726. };
  19727. enum PositionMode
  19728. {
  19729. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19730. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19731. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19732. 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. */
  19733. };
  19734. enum SizeMode
  19735. {
  19736. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19737. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19738. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19739. };
  19740. void setModes (const AnchorPoint xAnchorMode,
  19741. const PositionMode xPositionMode,
  19742. const AnchorPoint yAnchorMode,
  19743. const PositionMode yPositionMode,
  19744. const SizeMode widthMode,
  19745. const SizeMode heightMode,
  19746. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19747. AnchorPoint getAnchorPointX() const throw();
  19748. PositionMode getPositionModeX() const throw();
  19749. double getX() const throw() { return x; }
  19750. void setX (const double newX) throw() { x = newX; }
  19751. AnchorPoint getAnchorPointY() const throw();
  19752. PositionMode getPositionModeY() const throw();
  19753. double getY() const throw() { return y; }
  19754. void setY (const double newY) throw() { y = newY; }
  19755. SizeMode getWidthMode() const throw();
  19756. double getWidth() const throw() { return w; }
  19757. void setWidth (const double newWidth) throw() { w = newWidth; }
  19758. SizeMode getHeightMode() const throw();
  19759. double getHeight() const throw() { return h; }
  19760. void setHeight (const double newHeight) throw() { h = newHeight; }
  19761. bool isPositionAbsolute() const throw();
  19762. bool operator== (const PositionedRectangle& other) const throw();
  19763. bool operator!= (const PositionedRectangle& other) const throw();
  19764. juce_UseDebuggingNewOperator
  19765. private:
  19766. double x, y, w, h;
  19767. uint8 xMode, yMode, wMode, hMode;
  19768. void addPosDescription (String& result, uint8 mode, double value) const throw();
  19769. void addSizeDescription (String& result, uint8 mode, double value) const throw();
  19770. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19771. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19772. void applyPosAndSize (double& xOut, double& wOut, double x, double w,
  19773. uint8 xMode, uint8 wMode,
  19774. int parentPos, int parentSize) const throw();
  19775. void updatePosAndSize (double& xOut, double& wOut, double x, double w,
  19776. uint8 xMode, uint8 wMode,
  19777. int parentPos, int parentSize) const throw();
  19778. };
  19779. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19780. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19781. #endif
  19782. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19783. #endif
  19784. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19785. #endif
  19786. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19787. /*** Start of inlined file: juce_CameraDevice.h ***/
  19788. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19789. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19790. #if JUCE_USE_CAMERA
  19791. class CameraImageListener
  19792. {
  19793. public:
  19794. CameraImageListener() {}
  19795. virtual ~CameraImageListener() {}
  19796. virtual void imageReceived (Image& image) = 0;
  19797. };
  19798. class JUCE_API CameraDevice
  19799. {
  19800. public:
  19801. virtual ~CameraDevice();
  19802. static const StringArray getAvailableDevices();
  19803. static CameraDevice* openDevice (int deviceIndex,
  19804. int minWidth = 128, int minHeight = 64,
  19805. int maxWidth = 1024, int maxHeight = 768);
  19806. const String getName() const { return name; }
  19807. Component* createViewerComponent();
  19808. void startRecordingToFile (const File& file, int quality = 2);
  19809. void stopRecording();
  19810. static const String getFileExtension();
  19811. const Time getTimeOfFirstRecordedFrame() const;
  19812. void addListener (CameraImageListener* listenerToAdd);
  19813. void removeListener (CameraImageListener* listenerToRemove);
  19814. juce_UseDebuggingNewOperator
  19815. protected:
  19816. CameraDevice (const String& name, int index);
  19817. private:
  19818. void* internal;
  19819. bool isRecording;
  19820. String name;
  19821. CameraDevice (const CameraDevice&);
  19822. CameraDevice& operator= (const CameraDevice&);
  19823. };
  19824. #endif
  19825. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19826. /*** End of inlined file: juce_CameraDevice.h ***/
  19827. #endif
  19828. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19829. #endif
  19830. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19831. /*** Start of inlined file: juce_ImageCache.h ***/
  19832. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19833. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19834. class JUCE_API ImageCache : private DeletedAtShutdown,
  19835. private Timer
  19836. {
  19837. public:
  19838. static Image* getFromFile (const File& file);
  19839. static Image* getFromMemory (const void* imageData, int dataSize);
  19840. static void release (Image* imageToRelease);
  19841. static void releaseOrDelete (Image* imageToRelease);
  19842. static bool isImageInCache (Image* imageToLookFor);
  19843. static void incReferenceCount (Image* image);
  19844. static Image* getFromHashCode (int64 hashCode);
  19845. static void addImageToCache (Image* image, int64 hashCode);
  19846. static void setCacheTimeout (int millisecs);
  19847. juce_UseDebuggingNewOperator
  19848. private:
  19849. CriticalSection lock;
  19850. struct Item;
  19851. friend class ScopedPointer<Item>;
  19852. friend class OwnedArray<Item>;
  19853. OwnedArray<Item> images;
  19854. static ImageCache* instance;
  19855. static int cacheTimeout;
  19856. ImageCache();
  19857. ImageCache (const ImageCache&);
  19858. ImageCache& operator= (const ImageCache&);
  19859. ~ImageCache();
  19860. void timerCallback();
  19861. };
  19862. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19863. /*** End of inlined file: juce_ImageCache.h ***/
  19864. #endif
  19865. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19866. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19867. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19868. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19869. class JUCE_API ImageConvolutionKernel
  19870. {
  19871. public:
  19872. ImageConvolutionKernel (int size);
  19873. ~ImageConvolutionKernel();
  19874. void clear();
  19875. float getKernelValue (int x, int y) const throw();
  19876. void setKernelValue (int x, int y, float value) throw();
  19877. void setOverallSum (float desiredTotalSum);
  19878. void rescaleAllValues (float multiplier);
  19879. void createGaussianBlur (float blurRadius);
  19880. int getKernelSize() const { return size; }
  19881. void applyToImage (Image& destImage,
  19882. const Image* sourceImage,
  19883. const Rectangle<int>& destinationArea) const;
  19884. juce_UseDebuggingNewOperator
  19885. private:
  19886. HeapBlock <float> values;
  19887. const int size;
  19888. // no reason not to implement these one day..
  19889. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19890. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19891. };
  19892. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19893. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19894. #endif
  19895. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19896. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19897. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19898. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19899. class JUCE_API ImageFileFormat
  19900. {
  19901. protected:
  19902. ImageFileFormat() {}
  19903. public:
  19904. virtual ~ImageFileFormat() {}
  19905. virtual const String getFormatName() = 0;
  19906. virtual bool canUnderstand (InputStream& input) = 0;
  19907. virtual Image* decodeImage (InputStream& input) = 0;
  19908. virtual bool writeImageToStream (const Image& sourceImage,
  19909. OutputStream& destStream) = 0;
  19910. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19911. static Image* loadFrom (InputStream& input);
  19912. static Image* loadFrom (const File& file);
  19913. static Image* loadFrom (const void* rawData,
  19914. const int numBytesOfData);
  19915. };
  19916. class JUCE_API PNGImageFormat : public ImageFileFormat
  19917. {
  19918. public:
  19919. PNGImageFormat();
  19920. ~PNGImageFormat();
  19921. const String getFormatName();
  19922. bool canUnderstand (InputStream& input);
  19923. Image* decodeImage (InputStream& input);
  19924. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19925. };
  19926. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19927. {
  19928. public:
  19929. JPEGImageFormat();
  19930. ~JPEGImageFormat();
  19931. void setQuality (const float newQuality);
  19932. const String getFormatName();
  19933. bool canUnderstand (InputStream& input);
  19934. Image* decodeImage (InputStream& input);
  19935. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19936. private:
  19937. float quality;
  19938. };
  19939. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19940. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19941. #endif
  19942. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19943. #endif
  19944. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19945. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19946. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19947. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19948. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19949. {
  19950. public:
  19951. FileBasedDocument (const String& fileExtension,
  19952. const String& fileWildCard,
  19953. const String& openFileDialogTitle,
  19954. const String& saveFileDialogTitle);
  19955. virtual ~FileBasedDocument();
  19956. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19957. virtual void changed();
  19958. void setChangedFlag (bool hasChanged);
  19959. bool loadFrom (const File& fileToLoadFrom,
  19960. bool showMessageOnFailure);
  19961. bool loadFromUserSpecifiedFile (bool showMessageOnFailure);
  19962. enum SaveResult
  19963. {
  19964. savedOk = 0, /**< indicates that a file was saved successfully. */
  19965. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19966. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19967. };
  19968. SaveResult save (bool askUserForFileIfNotSpecified,
  19969. bool showMessageOnFailure);
  19970. SaveResult saveIfNeededAndUserAgrees();
  19971. SaveResult saveAs (const File& newFile,
  19972. bool warnAboutOverwritingExistingFiles,
  19973. bool askUserForFileIfNotSpecified,
  19974. bool showMessageOnFailure);
  19975. SaveResult saveAsInteractive (bool warnAboutOverwritingExistingFiles);
  19976. const File getFile() const { return documentFile; }
  19977. void setFile (const File& newFile);
  19978. protected:
  19979. virtual const String getDocumentTitle() = 0;
  19980. virtual const String loadDocument (const File& file) = 0;
  19981. virtual const String saveDocument (const File& file) = 0;
  19982. virtual const File getLastDocumentOpened() = 0;
  19983. virtual void setLastDocumentOpened (const File& file) = 0;
  19984. public:
  19985. juce_UseDebuggingNewOperator
  19986. private:
  19987. File documentFile;
  19988. bool changedSinceSave;
  19989. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19990. FileBasedDocument (const FileBasedDocument&);
  19991. FileBasedDocument& operator= (const FileBasedDocument&);
  19992. };
  19993. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19994. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19995. #endif
  19996. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19997. #endif
  19998. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19999. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  20000. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  20001. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  20002. class JUCE_API RecentlyOpenedFilesList
  20003. {
  20004. public:
  20005. RecentlyOpenedFilesList();
  20006. ~RecentlyOpenedFilesList();
  20007. void setMaxNumberOfItems (int newMaxNumber);
  20008. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  20009. int getNumFiles() const;
  20010. const File getFile (int index) const;
  20011. const StringArray& getAllFilenames() const throw() { return files; }
  20012. void clear();
  20013. void addFile (const File& file);
  20014. void removeNonExistentFiles();
  20015. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  20016. int baseItemId,
  20017. bool showFullPaths,
  20018. bool dontAddNonExistentFiles,
  20019. const File** filesToAvoid = 0);
  20020. const String toString() const;
  20021. void restoreFromString (const String& stringifiedVersion);
  20022. juce_UseDebuggingNewOperator
  20023. private:
  20024. StringArray files;
  20025. int maxNumberOfItems;
  20026. };
  20027. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  20028. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  20029. #endif
  20030. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  20031. #endif
  20032. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  20033. /*** Start of inlined file: juce_SystemClipboard.h ***/
  20034. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  20035. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  20036. class JUCE_API SystemClipboard
  20037. {
  20038. public:
  20039. static void copyTextToClipboard (const String& text);
  20040. static const String getTextFromClipboard();
  20041. };
  20042. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  20043. /*** End of inlined file: juce_SystemClipboard.h ***/
  20044. #endif
  20045. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  20046. #endif
  20047. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  20048. #endif
  20049. #endif
  20050. /*** End of inlined file: juce_app_includes.h ***/
  20051. #endif
  20052. #if JUCE_MSVC
  20053. #pragma warning (pop)
  20054. #pragma pack (pop)
  20055. #endif
  20056. END_JUCE_NAMESPACE
  20057. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  20058. #ifdef JUCE_NAMESPACE
  20059. // this will obviously save a lot of typing, but can be disabled by
  20060. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  20061. using namespace JUCE_NAMESPACE;
  20062. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  20063. #define Component JUCE_NAMESPACE::Component
  20064. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  20065. #define Point JUCE_NAMESPACE::Point
  20066. #define Button JUCE_NAMESPACE::Button
  20067. #endif
  20068. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  20069. #define Rectangle JUCE_NAMESPACE::Rectangle
  20070. #endif
  20071. #endif
  20072. #endif
  20073. #if JUCE_MSVC
  20074. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  20075. #ifdef JUCE_DLL
  20076. #if JUCE_DEBUG
  20077. #define AUTOLINKEDLIB "JUCE_debug.lib"
  20078. #else
  20079. #define AUTOLINKEDLIB "JUCE.lib"
  20080. #endif
  20081. #else
  20082. #if JUCE_DEBUG
  20083. #ifdef _WIN64
  20084. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  20085. #else
  20086. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  20087. #endif
  20088. #else
  20089. #ifdef _WIN64
  20090. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  20091. #else
  20092. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  20093. #endif
  20094. #endif
  20095. #endif
  20096. #pragma comment(lib, AUTOLINKEDLIB)
  20097. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  20098. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  20099. #endif
  20100. // Auto-link the other win32 libs that are needed by library calls..
  20101. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  20102. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  20103. // Auto-links to various win32 libs that are needed by library calls..
  20104. #pragma comment(lib, "kernel32.lib")
  20105. #pragma comment(lib, "user32.lib")
  20106. #pragma comment(lib, "shell32.lib")
  20107. #pragma comment(lib, "gdi32.lib")
  20108. #pragma comment(lib, "vfw32.lib")
  20109. #pragma comment(lib, "comdlg32.lib")
  20110. #pragma comment(lib, "winmm.lib")
  20111. #pragma comment(lib, "wininet.lib")
  20112. #pragma comment(lib, "ole32.lib")
  20113. #pragma comment(lib, "oleaut32.lib")
  20114. #pragma comment(lib, "advapi32.lib")
  20115. #pragma comment(lib, "ws2_32.lib")
  20116. #pragma comment(lib, "comsupp.lib")
  20117. #pragma comment(lib, "version.lib")
  20118. #if JUCE_OPENGL
  20119. #pragma comment(lib, "OpenGL32.Lib")
  20120. #pragma comment(lib, "GlU32.Lib")
  20121. #endif
  20122. #if JUCE_QUICKTIME
  20123. #pragma comment (lib, "QTMLClient.lib")
  20124. #endif
  20125. #if JUCE_USE_CAMERA
  20126. #pragma comment (lib, "Strmiids.lib")
  20127. #pragma comment (lib, "wmvcore.lib")
  20128. #endif
  20129. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  20130. #endif
  20131. #endif
  20132. #endif
  20133. #if defined (JUCE_GCC) || defined (__MWERKS__)
  20134. #define START_JUCE_APPLICATION(AppClass) \
  20135. int main (int argc, char* argv[]) \
  20136. { \
  20137. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  20138. }
  20139. #elif JUCE_WINDOWS
  20140. #ifdef _CONSOLE
  20141. #define START_JUCE_APPLICATION(AppClass) \
  20142. int main (int, char* argv[]) \
  20143. { \
  20144. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20145. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20146. }
  20147. #elif ! defined (_AFXDLL)
  20148. #ifdef _WINDOWS_
  20149. #define START_JUCE_APPLICATION(AppClass) \
  20150. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  20151. { \
  20152. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20153. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20154. }
  20155. #else
  20156. #define START_JUCE_APPLICATION(AppClass) \
  20157. int __stdcall WinMain (int, int, const char*, int) \
  20158. { \
  20159. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20160. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20161. }
  20162. #endif
  20163. #endif
  20164. #endif
  20165. #endif // __JUCE_JUCEHEADER__
  20166. /*** End of inlined file: juce.h ***/
  20167. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__