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.

29022 lines
746KB

  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 0
  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 defined (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. #ifdef 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 defined (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. int indexOf (ParameterType elementToLookFor) const
  1533. {
  1534. const ScopedLockType lock (getLock());
  1535. const ElementType* e = data.elements.getData();
  1536. const ElementType* const end = e + numUsed;
  1537. while (e != end)
  1538. {
  1539. if (elementToLookFor == *e)
  1540. return static_cast <int> (e - data.elements.getData());
  1541. ++e;
  1542. }
  1543. return -1;
  1544. }
  1545. bool contains (ParameterType elementToLookFor) const
  1546. {
  1547. const ScopedLockType lock (getLock());
  1548. const ElementType* e = data.elements.getData();
  1549. const ElementType* const end = e + numUsed;
  1550. while (e != end)
  1551. {
  1552. if (elementToLookFor == *e)
  1553. return true;
  1554. ++e;
  1555. }
  1556. return false;
  1557. }
  1558. void add (ParameterType newElement)
  1559. {
  1560. const ScopedLockType lock (getLock());
  1561. data.ensureAllocatedSize (numUsed + 1);
  1562. new (data.elements + numUsed++) ElementType (newElement);
  1563. }
  1564. void insert (int indexToInsertAt, ParameterType newElement)
  1565. {
  1566. const ScopedLockType lock (getLock());
  1567. data.ensureAllocatedSize (numUsed + 1);
  1568. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1569. {
  1570. ElementType* const insertPos = data.elements + indexToInsertAt;
  1571. const int numberToMove = numUsed - indexToInsertAt;
  1572. if (numberToMove > 0)
  1573. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1574. new (insertPos) ElementType (newElement);
  1575. ++numUsed;
  1576. }
  1577. else
  1578. {
  1579. new (data.elements + numUsed++) ElementType (newElement);
  1580. }
  1581. }
  1582. void insertMultiple (int indexToInsertAt, ParameterType newElement,
  1583. int numberOfTimesToInsertIt)
  1584. {
  1585. if (numberOfTimesToInsertIt > 0)
  1586. {
  1587. const ScopedLockType lock (getLock());
  1588. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1589. ElementType* insertPos;
  1590. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1591. {
  1592. insertPos = data.elements + indexToInsertAt;
  1593. const int numberToMove = numUsed - indexToInsertAt;
  1594. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1595. }
  1596. else
  1597. {
  1598. insertPos = data.elements + numUsed;
  1599. }
  1600. numUsed += numberOfTimesToInsertIt;
  1601. while (--numberOfTimesToInsertIt >= 0)
  1602. new (insertPos++) ElementType (newElement);
  1603. }
  1604. }
  1605. void insertArray (int indexToInsertAt,
  1606. const ElementType* newElements,
  1607. int numberOfElements)
  1608. {
  1609. if (numberOfElements > 0)
  1610. {
  1611. const ScopedLockType lock (getLock());
  1612. data.ensureAllocatedSize (numUsed + numberOfElements);
  1613. ElementType* insertPos;
  1614. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1615. {
  1616. insertPos = data.elements + indexToInsertAt;
  1617. const int numberToMove = numUsed - indexToInsertAt;
  1618. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1619. }
  1620. else
  1621. {
  1622. insertPos = data.elements + numUsed;
  1623. }
  1624. numUsed += numberOfElements;
  1625. while (--numberOfElements >= 0)
  1626. new (insertPos++) ElementType (*newElements++);
  1627. }
  1628. }
  1629. void addIfNotAlreadyThere (ParameterType newElement)
  1630. {
  1631. const ScopedLockType lock (getLock());
  1632. if (! contains (newElement))
  1633. add (newElement);
  1634. }
  1635. void set (const int indexToChange, ParameterType newValue)
  1636. {
  1637. jassert (indexToChange >= 0);
  1638. const ScopedLockType lock (getLock());
  1639. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1640. {
  1641. data.elements [indexToChange] = newValue;
  1642. }
  1643. else if (indexToChange >= 0)
  1644. {
  1645. data.ensureAllocatedSize (numUsed + 1);
  1646. new (data.elements + numUsed++) ElementType (newValue);
  1647. }
  1648. }
  1649. void setUnchecked (const int indexToChange, ParameterType newValue)
  1650. {
  1651. const ScopedLockType lock (getLock());
  1652. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1653. data.elements [indexToChange] = newValue;
  1654. }
  1655. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1656. {
  1657. const ScopedLockType lock (getLock());
  1658. if (numElementsToAdd > 0)
  1659. {
  1660. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1661. while (--numElementsToAdd >= 0)
  1662. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1663. }
  1664. }
  1665. void swapWithArray (Array& otherArray) throw()
  1666. {
  1667. const ScopedLockType lock1 (getLock());
  1668. const ScopedLockType lock2 (otherArray.getLock());
  1669. data.swapWith (otherArray.data);
  1670. swapVariables (numUsed, otherArray.numUsed);
  1671. }
  1672. template <class OtherArrayType>
  1673. void addArray (const OtherArrayType& arrayToAddFrom,
  1674. int startIndex = 0,
  1675. int numElementsToAdd = -1)
  1676. {
  1677. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1678. const ScopedLockType lock2 (getLock());
  1679. if (startIndex < 0)
  1680. {
  1681. jassertfalse
  1682. startIndex = 0;
  1683. }
  1684. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1685. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1686. while (--numElementsToAdd >= 0)
  1687. add (arrayToAddFrom.getUnchecked (startIndex++));
  1688. }
  1689. template <class ElementComparator>
  1690. void addSorted (ElementComparator& comparator, ParameterType newElement)
  1691. {
  1692. const ScopedLockType lock (getLock());
  1693. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1694. }
  1695. void addUsingDefaultSort (ParameterType newElement)
  1696. {
  1697. DefaultElementComparator <ElementType> comparator;
  1698. addSorted (comparator, newElement);
  1699. }
  1700. template <class ElementComparator>
  1701. int indexOfSorted (ElementComparator& comparator, ParameterType elementToLookFor) const
  1702. {
  1703. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1704. // avoids getting warning messages about the parameter being unused
  1705. const ScopedLockType lock (getLock());
  1706. int start = 0;
  1707. int end = numUsed;
  1708. for (;;)
  1709. {
  1710. if (start >= end)
  1711. {
  1712. return -1;
  1713. }
  1714. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1715. {
  1716. return start;
  1717. }
  1718. else
  1719. {
  1720. const int halfway = (start + end) >> 1;
  1721. if (halfway == start)
  1722. return -1;
  1723. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1724. start = halfway;
  1725. else
  1726. end = halfway;
  1727. }
  1728. }
  1729. }
  1730. ElementType remove (const int indexToRemove)
  1731. {
  1732. const ScopedLockType lock (getLock());
  1733. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1734. {
  1735. --numUsed;
  1736. ElementType* const e = data.elements + indexToRemove;
  1737. ElementType removed (*e);
  1738. e->~ElementType();
  1739. const int numberToShift = numUsed - indexToRemove;
  1740. if (numberToShift > 0)
  1741. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1742. if ((numUsed << 1) < data.numAllocated)
  1743. minimiseStorageOverheads();
  1744. return removed;
  1745. }
  1746. else
  1747. {
  1748. return ElementType();
  1749. }
  1750. }
  1751. void removeValue (ParameterType valueToRemove)
  1752. {
  1753. const ScopedLockType lock (getLock());
  1754. ElementType* e = data.elements;
  1755. for (int i = numUsed; --i >= 0;)
  1756. {
  1757. if (valueToRemove == *e)
  1758. {
  1759. remove (static_cast <int> (e - data.elements.getData()));
  1760. break;
  1761. }
  1762. ++e;
  1763. }
  1764. }
  1765. void removeRange (int startIndex, int numberToRemove)
  1766. {
  1767. const ScopedLockType lock (getLock());
  1768. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1769. startIndex = jlimit (0, numUsed, startIndex);
  1770. if (endIndex > startIndex)
  1771. {
  1772. ElementType* const e = data.elements + startIndex;
  1773. numberToRemove = endIndex - startIndex;
  1774. for (int i = 0; i < numberToRemove; ++i)
  1775. e[i].~ElementType();
  1776. const int numToShift = numUsed - endIndex;
  1777. if (numToShift > 0)
  1778. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1779. numUsed -= numberToRemove;
  1780. if ((numUsed << 1) < data.numAllocated)
  1781. minimiseStorageOverheads();
  1782. }
  1783. }
  1784. void removeLast (int howManyToRemove = 1)
  1785. {
  1786. const ScopedLockType lock (getLock());
  1787. if (howManyToRemove > numUsed)
  1788. howManyToRemove = numUsed;
  1789. for (int i = 0; i < howManyToRemove; ++i)
  1790. data.elements [numUsed - i].~ElementType();
  1791. numUsed -= howManyToRemove;
  1792. if ((numUsed << 1) < data.numAllocated)
  1793. minimiseStorageOverheads();
  1794. }
  1795. template <class OtherArrayType>
  1796. void removeValuesIn (const OtherArrayType& otherArray)
  1797. {
  1798. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1799. const ScopedLockType lock2 (getLock());
  1800. if (this == &otherArray)
  1801. {
  1802. clear();
  1803. }
  1804. else
  1805. {
  1806. if (otherArray.size() > 0)
  1807. {
  1808. for (int i = numUsed; --i >= 0;)
  1809. if (otherArray.contains (data.elements [i]))
  1810. remove (i);
  1811. }
  1812. }
  1813. }
  1814. template <class OtherArrayType>
  1815. void removeValuesNotIn (const OtherArrayType& otherArray)
  1816. {
  1817. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1818. const ScopedLockType lock2 (getLock());
  1819. if (this != &otherArray)
  1820. {
  1821. if (otherArray.size() <= 0)
  1822. {
  1823. clear();
  1824. }
  1825. else
  1826. {
  1827. for (int i = numUsed; --i >= 0;)
  1828. if (! otherArray.contains (data.elements [i]))
  1829. remove (i);
  1830. }
  1831. }
  1832. }
  1833. void swap (const int index1,
  1834. const int index2)
  1835. {
  1836. const ScopedLockType lock (getLock());
  1837. if (((unsigned int) index1) < (unsigned int) numUsed
  1838. && ((unsigned int) index2) < (unsigned int) numUsed)
  1839. {
  1840. swapVariables (data.elements [index1],
  1841. data.elements [index2]);
  1842. }
  1843. }
  1844. void move (const int currentIndex, int newIndex) throw()
  1845. {
  1846. if (currentIndex != newIndex)
  1847. {
  1848. const ScopedLockType lock (getLock());
  1849. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1850. {
  1851. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1852. newIndex = numUsed - 1;
  1853. char tempCopy [sizeof (ElementType)];
  1854. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1855. if (newIndex > currentIndex)
  1856. {
  1857. memmove (data.elements + currentIndex,
  1858. data.elements + currentIndex + 1,
  1859. (newIndex - currentIndex) * sizeof (ElementType));
  1860. }
  1861. else
  1862. {
  1863. memmove (data.elements + newIndex + 1,
  1864. data.elements + newIndex,
  1865. (currentIndex - newIndex) * sizeof (ElementType));
  1866. }
  1867. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1868. }
  1869. }
  1870. }
  1871. void minimiseStorageOverheads()
  1872. {
  1873. const ScopedLockType lock (getLock());
  1874. data.shrinkToNoMoreThan (numUsed);
  1875. }
  1876. void ensureStorageAllocated (const int minNumElements)
  1877. {
  1878. const ScopedLockType lock (getLock());
  1879. data.ensureAllocatedSize (minNumElements);
  1880. }
  1881. template <class ElementComparator>
  1882. void sort (ElementComparator& comparator,
  1883. const bool retainOrderOfEquivalentItems = false) const
  1884. {
  1885. const ScopedLockType lock (getLock());
  1886. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1887. // avoids getting warning messages about the parameter being unused
  1888. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1889. }
  1890. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1891. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1892. juce_UseDebuggingNewOperator
  1893. private:
  1894. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1895. int numUsed;
  1896. };
  1897. #endif // __JUCE_ARRAY_JUCEHEADER__
  1898. /*** End of inlined file: juce_Array.h ***/
  1899. #endif
  1900. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1901. #endif
  1902. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1903. /*** Start of inlined file: juce_BitArray.h ***/
  1904. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1905. #define __JUCE_BITARRAY_JUCEHEADER__
  1906. class MemoryBlock;
  1907. class JUCE_API BigInteger
  1908. {
  1909. public:
  1910. BigInteger();
  1911. BigInteger (unsigned int value);
  1912. BigInteger (int value);
  1913. BigInteger (int64 value);
  1914. BigInteger (const BigInteger& other);
  1915. ~BigInteger();
  1916. BigInteger& operator= (const BigInteger& other);
  1917. void swapWith (BigInteger& other) throw();
  1918. bool operator[] (int bit) const throw();
  1919. bool isZero() const throw();
  1920. bool isOne() const throw();
  1921. int toInteger() const throw();
  1922. void clear();
  1923. void clearBit (int bitNumber) throw();
  1924. void setBit (int bitNumber);
  1925. void setBit (int bitNumber, bool shouldBeSet);
  1926. void setRange (int startBit, int numBits, bool shouldBeSet);
  1927. void insertBit (int bitNumber, bool shouldBeSet);
  1928. const BigInteger getBitRange (int startBit, int numBits) const;
  1929. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1930. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1931. void shiftBits (int howManyBitsLeft, int startBit);
  1932. int countNumberOfSetBits() const throw();
  1933. int findNextSetBit (int startIndex = 0) const throw();
  1934. int findNextClearBit (int startIndex = 0) const throw();
  1935. int getHighestBit() const throw();
  1936. // All the standard arithmetic ops...
  1937. BigInteger& operator+= (const BigInteger& other);
  1938. BigInteger& operator-= (const BigInteger& other);
  1939. BigInteger& operator*= (const BigInteger& other);
  1940. BigInteger& operator/= (const BigInteger& other);
  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<<= (int numBitsToShift);
  1946. BigInteger& operator>>= (int numBitsToShift);
  1947. BigInteger& operator++();
  1948. BigInteger& operator--();
  1949. const BigInteger operator++ (int);
  1950. const BigInteger operator-- (int);
  1951. const BigInteger operator-() const;
  1952. const BigInteger operator+ (const BigInteger& other) const;
  1953. const BigInteger operator- (const BigInteger& other) const;
  1954. const BigInteger operator* (const BigInteger& other) const;
  1955. const BigInteger operator/ (const BigInteger& other) 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<< (int numBitsToShift) const;
  1961. const BigInteger operator>> (int numBitsToShift) const;
  1962. bool operator== (const BigInteger& other) const throw();
  1963. bool operator!= (const BigInteger& other) const throw();
  1964. bool operator< (const BigInteger& other) const throw();
  1965. bool operator<= (const BigInteger& other) const throw();
  1966. bool operator> (const BigInteger& other) const throw();
  1967. bool operator>= (const BigInteger& other) const throw();
  1968. int compare (const BigInteger& other) const throw();
  1969. int compareAbsolute (const BigInteger& other) const throw();
  1970. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1971. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1972. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1973. void inverseModulo (const BigInteger& modulus);
  1974. bool isNegative() const throw();
  1975. void setNegative (const bool shouldBeNegative) throw();
  1976. void negate() throw();
  1977. const String toString (int base, int minimumNumCharacters = 1) const;
  1978. void parseString (const String& text, int base);
  1979. const MemoryBlock toMemoryBlock() const;
  1980. void loadFromMemoryBlock (const MemoryBlock& data);
  1981. juce_UseDebuggingNewOperator
  1982. private:
  1983. HeapBlock <unsigned int> values;
  1984. int numValues, highestBit;
  1985. bool negative;
  1986. void ensureSize (int numVals);
  1987. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1988. };
  1989. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1990. typedef BigInteger BitArray;
  1991. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1992. /*** End of inlined file: juce_BitArray.h ***/
  1993. #endif
  1994. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1995. /*** Start of inlined file: juce_DynamicObject.h ***/
  1996. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1997. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1998. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1999. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2000. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  2001. /*** Start of inlined file: juce_Variant.h ***/
  2002. #ifndef __JUCE_VARIANT_JUCEHEADER__
  2003. #define __JUCE_VARIANT_JUCEHEADER__
  2004. /*** Start of inlined file: juce_OutputStream.h ***/
  2005. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2006. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2007. /*** Start of inlined file: juce_InputStream.h ***/
  2008. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2009. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2010. /*** Start of inlined file: juce_MemoryBlock.h ***/
  2011. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2012. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2013. class JUCE_API MemoryBlock
  2014. {
  2015. public:
  2016. MemoryBlock() throw();
  2017. MemoryBlock (const size_t initialSize,
  2018. const bool initialiseToZero = false) throw();
  2019. MemoryBlock (const MemoryBlock& other) throw();
  2020. MemoryBlock (const void* const dataToInitialiseFrom,
  2021. const size_t sizeInBytes) throw();
  2022. ~MemoryBlock() throw();
  2023. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2024. bool operator== (const MemoryBlock& other) const throw();
  2025. bool operator!= (const MemoryBlock& other) const throw();
  2026. bool matches (const void* data, size_t dataSize) const throw();
  2027. void* getData() const throw() { return data; }
  2028. template <typename Type>
  2029. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2030. size_t getSize() const throw() { return size; }
  2031. void setSize (const size_t newSize,
  2032. const bool initialiseNewSpaceToZero = false) throw();
  2033. void ensureSize (const size_t minimumSize,
  2034. const bool initialiseNewSpaceToZero = false) throw();
  2035. void fillWith (const uint8 valueToUse) throw();
  2036. void append (const void* const data,
  2037. const size_t numBytes) throw();
  2038. void swapWith (MemoryBlock& other) throw();
  2039. void copyFrom (const void* srcData,
  2040. int destinationOffset,
  2041. size_t numBytes) throw();
  2042. void copyTo (void* destData,
  2043. int sourceOffset,
  2044. size_t numBytes) const throw();
  2045. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2046. const String toString() const throw();
  2047. void loadFromHexString (const String& sourceHexString) throw();
  2048. void setBitRange (size_t bitRangeStart,
  2049. size_t numBits,
  2050. int binaryNumberToApply) throw();
  2051. int getBitRange (size_t bitRangeStart,
  2052. size_t numBitsToRead) const throw();
  2053. const String toBase64Encoding() const throw();
  2054. bool fromBase64Encoding (const String& encodedString) throw();
  2055. juce_UseDebuggingNewOperator
  2056. private:
  2057. HeapBlock <char> data;
  2058. size_t size;
  2059. };
  2060. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2061. /*** End of inlined file: juce_MemoryBlock.h ***/
  2062. class JUCE_API InputStream
  2063. {
  2064. public:
  2065. virtual ~InputStream() {}
  2066. virtual int64 getTotalLength() = 0;
  2067. virtual bool isExhausted() = 0;
  2068. virtual int read (void* destBuffer, int maxBytesToRead) = 0;
  2069. virtual char readByte();
  2070. virtual bool readBool();
  2071. virtual short readShort();
  2072. virtual short readShortBigEndian();
  2073. virtual int readInt();
  2074. virtual int readIntBigEndian();
  2075. virtual int64 readInt64();
  2076. virtual int64 readInt64BigEndian();
  2077. virtual float readFloat();
  2078. virtual float readFloatBigEndian();
  2079. virtual double readDouble();
  2080. virtual double readDoubleBigEndian();
  2081. virtual int readCompressedInt();
  2082. virtual const String readNextLine();
  2083. virtual const String readString();
  2084. virtual const String readEntireStreamAsString();
  2085. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2086. int maxNumBytesToRead = -1);
  2087. virtual int64 getPosition() = 0;
  2088. virtual bool setPosition (int64 newPosition) = 0;
  2089. virtual void skipNextBytes (int64 numBytesToSkip);
  2090. juce_UseDebuggingNewOperator
  2091. protected:
  2092. InputStream() throw() {}
  2093. };
  2094. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2095. /*** End of inlined file: juce_InputStream.h ***/
  2096. class File;
  2097. class JUCE_API OutputStream
  2098. {
  2099. protected:
  2100. OutputStream();
  2101. public:
  2102. virtual ~OutputStream();
  2103. virtual void flush() = 0;
  2104. virtual bool setPosition (int64 newPosition) = 0;
  2105. virtual int64 getPosition() = 0;
  2106. virtual bool write (const void* dataToWrite,
  2107. int howManyBytes) = 0;
  2108. virtual void writeByte (char byte);
  2109. virtual void writeBool (bool boolValue);
  2110. virtual void writeShort (short value);
  2111. virtual void writeShortBigEndian (short value);
  2112. virtual void writeInt (int value);
  2113. virtual void writeIntBigEndian (int value);
  2114. virtual void writeInt64 (int64 value);
  2115. virtual void writeInt64BigEndian (int64 value);
  2116. virtual void writeFloat (float value);
  2117. virtual void writeFloatBigEndian (float value);
  2118. virtual void writeDouble (double value);
  2119. virtual void writeDoubleBigEndian (double value);
  2120. virtual void writeCompressedInt (int value);
  2121. virtual void writeString (const String& text);
  2122. virtual void writeText (const String& text,
  2123. bool asUnicode,
  2124. bool writeUnicodeHeaderBytes);
  2125. virtual int writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite);
  2126. juce_UseDebuggingNewOperator
  2127. };
  2128. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
  2129. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
  2130. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
  2131. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
  2132. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data);
  2133. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileToRead);
  2134. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2135. /*** End of inlined file: juce_OutputStream.h ***/
  2136. class JUCE_API DynamicObject;
  2137. class JUCE_API var
  2138. {
  2139. public:
  2140. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2141. var() throw();
  2142. ~var() throw();
  2143. static const var null;
  2144. var (const var& valueToCopy);
  2145. var (int value) throw();
  2146. var (bool value) throw();
  2147. var (double value) throw();
  2148. var (const char* value);
  2149. var (const juce_wchar* value);
  2150. var (const String& value);
  2151. var (DynamicObject* object);
  2152. var (MethodFunction method) throw();
  2153. var& operator= (const var& valueToCopy);
  2154. var& operator= (int value);
  2155. var& operator= (bool value);
  2156. var& operator= (double value);
  2157. var& operator= (const char* value);
  2158. var& operator= (const juce_wchar* value);
  2159. var& operator= (const String& value);
  2160. var& operator= (DynamicObject* object);
  2161. var& operator= (MethodFunction method);
  2162. void swapWith (var& other) throw();
  2163. operator int() const;
  2164. operator bool() const;
  2165. operator float() const;
  2166. operator double() const;
  2167. operator const String() const;
  2168. const String toString() const;
  2169. DynamicObject* getObject() const;
  2170. bool isVoid() const throw() { return type == voidType; }
  2171. bool isInt() const throw() { return type == intType; }
  2172. bool isBool() const throw() { return type == boolType; }
  2173. bool isDouble() const throw() { return type == doubleType; }
  2174. bool isString() const throw() { return type == stringType; }
  2175. bool isObject() const throw() { return type == objectType; }
  2176. bool isMethod() const throw() { return type == methodType; }
  2177. void writeToStream (OutputStream& output) const;
  2178. static const var readFromStream (InputStream& input);
  2179. class JUCE_API identifier
  2180. {
  2181. public:
  2182. identifier() throw();
  2183. identifier (const char* name);
  2184. identifier (const String& name);
  2185. ~identifier();
  2186. bool operator== (const identifier& other) const throw()
  2187. {
  2188. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2189. return hashCode == other.hashCode;
  2190. }
  2191. String name;
  2192. int hashCode;
  2193. };
  2194. const var operator[] (const identifier& propertyName) const;
  2195. const var call (const identifier& method) const;
  2196. const var call (const identifier& method, const var& arg1) const;
  2197. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2198. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2199. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2200. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2201. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2202. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2203. juce_UseDebuggingNewOperator
  2204. bool equals (const var& other) const throw();
  2205. private:
  2206. enum Type
  2207. {
  2208. voidType = 0,
  2209. intType,
  2210. boolType,
  2211. doubleType,
  2212. stringType,
  2213. objectType,
  2214. methodType
  2215. };
  2216. union ValueUnion
  2217. {
  2218. int intValue;
  2219. bool boolValue;
  2220. double doubleValue;
  2221. String* stringValue;
  2222. DynamicObject* objectValue;
  2223. MethodFunction methodValue;
  2224. };
  2225. Type type;
  2226. ValueUnion value;
  2227. };
  2228. bool operator== (const var& v1, const var& v2) throw();
  2229. bool operator!= (const var& v1, const var& v2) throw();
  2230. bool operator== (const var& v1, const String& v2) throw();
  2231. bool operator!= (const var& v1, const String& v2) throw();
  2232. #endif // __JUCE_VARIANT_JUCEHEADER__
  2233. /*** End of inlined file: juce_Variant.h ***/
  2234. class JUCE_API NamedValueSet
  2235. {
  2236. public:
  2237. NamedValueSet() throw();
  2238. NamedValueSet (const NamedValueSet& other);
  2239. NamedValueSet& operator= (const NamedValueSet& other);
  2240. ~NamedValueSet();
  2241. int size() const throw();
  2242. const var& operator[] (const var::identifier& name) const;
  2243. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2244. var* getItem (const var::identifier& name) const;
  2245. bool set (const var::identifier& name, const var& newValue);
  2246. bool contains (const var::identifier& name) const;
  2247. bool remove (const var::identifier& name);
  2248. const var::identifier getName (int index) const;
  2249. void clear();
  2250. juce_UseDebuggingNewOperator
  2251. private:
  2252. struct NamedValue
  2253. {
  2254. NamedValue() throw();
  2255. NamedValue (const var::identifier& name, const var& value);
  2256. var::identifier name;
  2257. var value;
  2258. };
  2259. Array <NamedValue> values;
  2260. };
  2261. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2262. /*** End of inlined file: juce_NamedValueSet.h ***/
  2263. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2264. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2265. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2266. /*** Start of inlined file: juce_Atomic.h ***/
  2267. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2268. #define __JUCE_ATOMIC_JUCEHEADER__
  2269. class JUCE_API Atomic
  2270. {
  2271. public:
  2272. static void increment (int32& variable);
  2273. static int32 incrementAndReturn (int32& variable);
  2274. static void decrement (int32& variable);
  2275. static int32 decrementAndReturn (int32& variable);
  2276. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2277. static void* swapPointers (void* volatile* value1, void* value2);
  2278. private:
  2279. Atomic();
  2280. Atomic (const Atomic&);
  2281. Atomic& operator= (const Atomic&);
  2282. };
  2283. #if JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) // Older Mac builds using gcc4.1 or earlier...
  2284. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 (static_cast <int32_t*> (&variable)); }
  2285. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 (static_cast <int32_t*> (&variable)); }
  2286. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 (static_cast <int32_t*> (&variable)); }
  2287. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 (static_cast <int32_t*> (&variable)); }
  2288. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2289. {
  2290. for (;;) // Annoying workaround for OSX only having a bool CAS operation..
  2291. {
  2292. if (OSAtomicCompareAndSwap32Barrier (oldValue, newValue, static_cast <int32_t*> (&destination)))
  2293. return oldValue;
  2294. const uint32 result = destination;
  2295. if (result != oldValue)
  2296. return result;
  2297. }
  2298. }
  2299. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2300. {
  2301. void* currentVal = *value1;
  2302. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2303. while (! OSAtomicCompareAndSwap32 (reinterpret_cast <int32_t> (currentVal), reinterpret_cast <int32_t> (value2),
  2304. const_cast <int32_t*> (reinterpret_cast <volatile int32_t*> (value1)))) { currentVal = *value1; }
  2305. #else
  2306. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2307. #endif
  2308. return currentVal;
  2309. }
  2310. #elif JUCE_LINUX && __INTEL_COMPILER // Linux with Intel compiler...
  2311. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (&variable); }
  2312. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (&variable); }
  2313. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (&variable); }
  2314. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (&variable); }
  2315. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2316. { return _InterlockedCompareExchange (&destination, newValue, oldValue); }
  2317. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2318. {
  2319. #if __ia64__
  2320. return reinterpret_cast<void*> (_InterlockedExchange64 (const_cast<void**> (value1), reinterpret_cast<__int64> (value2)));
  2321. #else
  2322. return reinterpret_cast<void*> (_InterlockedExchange (const_cast<void**> (value1), reinterpret_cast<long> (value2)));
  2323. #endif
  2324. }
  2325. #elif JUCE_GCC // On GCC, use intrinsics...
  2326. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2327. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2328. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2329. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2330. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2331. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2332. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2333. {
  2334. void* currentVal = *value1;
  2335. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2336. return currentVal;
  2337. }
  2338. #elif JUCE_USE_INTRINSICS // Windows...
  2339. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is declared in juce_win32_Threads.cpp)
  2340. #pragma intrinsic (_InterlockedIncrement)
  2341. #pragma intrinsic (_InterlockedDecrement)
  2342. #pragma intrinsic (_InterlockedCompareExchange)
  2343. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2344. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2345. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2346. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2347. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2348. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2349. #endif
  2350. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2351. /*** End of inlined file: juce_Atomic.h ***/
  2352. class JUCE_API ReferenceCountedObject
  2353. {
  2354. public:
  2355. inline void incReferenceCount() throw()
  2356. {
  2357. Atomic::increment (refCounts);
  2358. jassert (refCounts > 0);
  2359. }
  2360. inline void decReferenceCount() throw()
  2361. {
  2362. jassert (refCounts > 0);
  2363. if (Atomic::decrementAndReturn (refCounts) == 0)
  2364. delete this;
  2365. }
  2366. inline int getReferenceCount() const throw()
  2367. {
  2368. return refCounts;
  2369. }
  2370. protected:
  2371. ReferenceCountedObject()
  2372. : refCounts (0)
  2373. {
  2374. }
  2375. virtual ~ReferenceCountedObject()
  2376. {
  2377. // it's dangerous to delete an object that's still referenced by something else!
  2378. jassert (refCounts == 0);
  2379. }
  2380. private:
  2381. int32 refCounts;
  2382. };
  2383. template <class ReferenceCountedObjectClass>
  2384. class ReferenceCountedObjectPtr
  2385. {
  2386. public:
  2387. inline ReferenceCountedObjectPtr() throw()
  2388. : referencedObject (0)
  2389. {
  2390. }
  2391. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2392. : referencedObject (refCountedObject)
  2393. {
  2394. if (refCountedObject != 0)
  2395. refCountedObject->incReferenceCount();
  2396. }
  2397. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2398. : referencedObject (other.referencedObject)
  2399. {
  2400. if (referencedObject != 0)
  2401. referencedObject->incReferenceCount();
  2402. }
  2403. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2404. {
  2405. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2406. if (newObject != referencedObject)
  2407. {
  2408. if (newObject != 0)
  2409. newObject->incReferenceCount();
  2410. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2411. referencedObject = newObject;
  2412. if (oldObject != 0)
  2413. oldObject->decReferenceCount();
  2414. }
  2415. return *this;
  2416. }
  2417. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2418. {
  2419. if (referencedObject != newObject)
  2420. {
  2421. if (newObject != 0)
  2422. newObject->incReferenceCount();
  2423. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2424. referencedObject = newObject;
  2425. if (oldObject != 0)
  2426. oldObject->decReferenceCount();
  2427. }
  2428. return *this;
  2429. }
  2430. inline ~ReferenceCountedObjectPtr()
  2431. {
  2432. if (referencedObject != 0)
  2433. referencedObject->decReferenceCount();
  2434. }
  2435. inline operator ReferenceCountedObjectClass*() const throw()
  2436. {
  2437. return referencedObject;
  2438. }
  2439. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2440. {
  2441. return referencedObject == object;
  2442. }
  2443. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2444. {
  2445. return referencedObject != object;
  2446. }
  2447. // the -> operator is called on the referenced object
  2448. inline ReferenceCountedObjectClass* operator->() const throw()
  2449. {
  2450. return referencedObject;
  2451. }
  2452. inline ReferenceCountedObjectClass* getObject() const throw()
  2453. {
  2454. return referencedObject;
  2455. }
  2456. private:
  2457. ReferenceCountedObjectClass* referencedObject;
  2458. };
  2459. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2460. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2461. class JUCE_API DynamicObject : public ReferenceCountedObject
  2462. {
  2463. public:
  2464. DynamicObject();
  2465. virtual ~DynamicObject();
  2466. virtual bool hasProperty (const var::identifier& propertyName) const;
  2467. virtual const var getProperty (const var::identifier& propertyName) const;
  2468. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2469. virtual void removeProperty (const var::identifier& propertyName);
  2470. virtual bool hasMethod (const var::identifier& methodName) const;
  2471. virtual const var invokeMethod (const var::identifier& methodName,
  2472. const var* parameters,
  2473. int numParameters);
  2474. void setMethod (const var::identifier& methodName,
  2475. var::MethodFunction methodFunction);
  2476. void clear();
  2477. juce_UseDebuggingNewOperator
  2478. private:
  2479. NamedValueSet properties;
  2480. };
  2481. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2482. /*** End of inlined file: juce_DynamicObject.h ***/
  2483. #endif
  2484. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2485. #endif
  2486. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2487. #endif
  2488. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2489. #endif
  2490. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2491. #endif
  2492. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2493. /*** Start of inlined file: juce_OwnedArray.h ***/
  2494. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2495. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2496. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2497. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2498. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2499. template <class ObjectType>
  2500. class ScopedPointer
  2501. {
  2502. public:
  2503. inline ScopedPointer() throw() : object (0)
  2504. {
  2505. }
  2506. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2507. : object (objectToTakePossessionOf)
  2508. {
  2509. }
  2510. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2511. : object (objectToTransferFrom.object)
  2512. {
  2513. objectToTransferFrom.object = 0;
  2514. }
  2515. inline ~ScopedPointer() { delete object; }
  2516. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2517. {
  2518. if (this != objectToTransferFrom.getAddress())
  2519. {
  2520. // Two ScopedPointers should never be able to refer to the same object - if
  2521. // this happens, you must have done something dodgy!
  2522. jassert (object == 0 || object != objectToTransferFrom.object);
  2523. ObjectType* const oldObject = object;
  2524. object = objectToTransferFrom.object;
  2525. objectToTransferFrom.object = 0;
  2526. delete oldObject;
  2527. }
  2528. return *this;
  2529. }
  2530. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2531. {
  2532. if (object != newObjectToTakePossessionOf)
  2533. {
  2534. ObjectType* const oldObject = object;
  2535. object = newObjectToTakePossessionOf;
  2536. delete oldObject;
  2537. }
  2538. return *this;
  2539. }
  2540. inline operator ObjectType*() const throw() { return object; }
  2541. inline ObjectType& operator*() const throw() { return *object; }
  2542. inline ObjectType* operator->() const throw() { return object; }
  2543. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2544. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2545. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2546. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2547. {
  2548. // Two ScopedPointers should never be able to refer to the same object - if
  2549. // this happens, you must have done something dodgy!
  2550. jassert (object != other.object);
  2551. swapVariables (object, other.object);
  2552. }
  2553. private:
  2554. ObjectType* object;
  2555. // (Required as an alternative to the overloaded & operator).
  2556. const ScopedPointer* getAddress() const throw() { return this; }
  2557. #if ! JUCE_MSVC // (MSVC can't deal with multiple copy constructors)
  2558. // This is private to stop people accidentally copying a const ScopedPointer (the compiler
  2559. // will let you do so by implicitly casting the source to its raw object pointer).
  2560. ScopedPointer (const ScopedPointer&);
  2561. #endif
  2562. };
  2563. template <class ObjectType>
  2564. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2565. {
  2566. return static_cast <ObjectType*> (pointer1) == pointer2;
  2567. }
  2568. template <class ObjectType>
  2569. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2570. {
  2571. return static_cast <ObjectType*> (pointer1) != pointer2;
  2572. }
  2573. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2574. /*** End of inlined file: juce_ScopedPointer.h ***/
  2575. template <class ObjectClass,
  2576. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2577. class OwnedArray
  2578. {
  2579. public:
  2580. OwnedArray() throw()
  2581. : numUsed (0)
  2582. {
  2583. }
  2584. ~OwnedArray()
  2585. {
  2586. clear (true);
  2587. }
  2588. void clear (const bool deleteObjects = true)
  2589. {
  2590. const ScopedLockType lock (getLock());
  2591. if (deleteObjects)
  2592. {
  2593. while (numUsed > 0)
  2594. delete data.elements [--numUsed];
  2595. }
  2596. data.setAllocatedSize (0);
  2597. numUsed = 0;
  2598. }
  2599. inline int size() const throw()
  2600. {
  2601. return numUsed;
  2602. }
  2603. inline ObjectClass* operator[] (const int index) const throw()
  2604. {
  2605. const ScopedLockType lock (getLock());
  2606. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2607. : static_cast <ObjectClass*> (0);
  2608. }
  2609. inline ObjectClass* getUnchecked (const int index) const throw()
  2610. {
  2611. const ScopedLockType lock (getLock());
  2612. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2613. return data.elements [index];
  2614. }
  2615. inline ObjectClass* getFirst() const throw()
  2616. {
  2617. const ScopedLockType lock (getLock());
  2618. return numUsed > 0 ? data.elements [0]
  2619. : static_cast <ObjectClass*> (0);
  2620. }
  2621. inline ObjectClass* getLast() const throw()
  2622. {
  2623. const ScopedLockType lock (getLock());
  2624. return numUsed > 0 ? data.elements [numUsed - 1]
  2625. : static_cast <ObjectClass*> (0);
  2626. }
  2627. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2628. {
  2629. const ScopedLockType lock (getLock());
  2630. ObjectClass* const* e = data.elements.getData();
  2631. ObjectClass* const* const end = e + numUsed;
  2632. while (e != end)
  2633. {
  2634. if (objectToLookFor == *e)
  2635. return static_cast <int> (e - data.elements.getData());
  2636. ++e;
  2637. }
  2638. return -1;
  2639. }
  2640. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2641. {
  2642. const ScopedLockType lock (getLock());
  2643. ObjectClass* const* e = data.elements.getData();
  2644. ObjectClass* const* const end = e + numUsed;
  2645. while (e != end)
  2646. {
  2647. if (objectToLookFor == *e)
  2648. return true;
  2649. ++e;
  2650. }
  2651. return false;
  2652. }
  2653. void add (const ObjectClass* const newObject) throw()
  2654. {
  2655. const ScopedLockType lock (getLock());
  2656. data.ensureAllocatedSize (numUsed + 1);
  2657. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2658. }
  2659. void insert (int indexToInsertAt,
  2660. const ObjectClass* const newObject) throw()
  2661. {
  2662. if (indexToInsertAt >= 0)
  2663. {
  2664. const ScopedLockType lock (getLock());
  2665. if (indexToInsertAt > numUsed)
  2666. indexToInsertAt = numUsed;
  2667. data.ensureAllocatedSize (numUsed + 1);
  2668. ObjectClass** const e = data.elements + indexToInsertAt;
  2669. const int numToMove = numUsed - indexToInsertAt;
  2670. if (numToMove > 0)
  2671. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2672. *e = const_cast <ObjectClass*> (newObject);
  2673. ++numUsed;
  2674. }
  2675. else
  2676. {
  2677. add (newObject);
  2678. }
  2679. }
  2680. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2681. {
  2682. const ScopedLockType lock (getLock());
  2683. if (! contains (newObject))
  2684. add (newObject);
  2685. }
  2686. void set (const int indexToChange,
  2687. const ObjectClass* const newObject,
  2688. const bool deleteOldElement = true)
  2689. {
  2690. if (indexToChange >= 0)
  2691. {
  2692. ScopedPointer <ObjectClass> toDelete;
  2693. const ScopedLockType lock (getLock());
  2694. if (indexToChange < numUsed)
  2695. {
  2696. if (deleteOldElement)
  2697. {
  2698. toDelete = data.elements [indexToChange];
  2699. if (toDelete == newObject)
  2700. toDelete = 0;
  2701. }
  2702. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2703. }
  2704. else
  2705. {
  2706. data.ensureAllocatedSize (numUsed + 1);
  2707. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2708. }
  2709. }
  2710. }
  2711. template <class OtherArrayType>
  2712. void addArray (const OtherArrayType& arrayToAddFrom,
  2713. int startIndex = 0,
  2714. int numElementsToAdd = -1)
  2715. {
  2716. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2717. const ScopedLockType lock2 (getLock());
  2718. if (startIndex < 0)
  2719. {
  2720. jassertfalse
  2721. startIndex = 0;
  2722. }
  2723. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2724. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2725. while (--numElementsToAdd >= 0)
  2726. add (arrayToAddFrom.getUnchecked (startIndex++));
  2727. }
  2728. template <class ElementComparator>
  2729. void addSorted (ElementComparator& comparator,
  2730. ObjectClass* const newObject) throw()
  2731. {
  2732. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2733. // avoids getting warning messages about the parameter being unused
  2734. const ScopedLockType lock (getLock());
  2735. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2736. }
  2737. template <class ElementComparator>
  2738. int indexOfSorted (ElementComparator& comparator,
  2739. const ObjectClass* const objectToLookFor) const throw()
  2740. {
  2741. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2742. // avoids getting warning messages about the parameter being unused
  2743. const ScopedLockType lock (getLock());
  2744. int start = 0;
  2745. int end = numUsed;
  2746. for (;;)
  2747. {
  2748. if (start >= end)
  2749. {
  2750. return -1;
  2751. }
  2752. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2753. {
  2754. return start;
  2755. }
  2756. else
  2757. {
  2758. const int halfway = (start + end) >> 1;
  2759. if (halfway == start)
  2760. return -1;
  2761. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2762. start = halfway;
  2763. else
  2764. end = halfway;
  2765. }
  2766. }
  2767. }
  2768. void remove (const int indexToRemove,
  2769. const bool deleteObject = true)
  2770. {
  2771. ScopedPointer <ObjectClass> toDelete;
  2772. const ScopedLockType lock (getLock());
  2773. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2774. {
  2775. ObjectClass** const e = data.elements + indexToRemove;
  2776. if (deleteObject)
  2777. toDelete = *e;
  2778. --numUsed;
  2779. const int numToShift = numUsed - indexToRemove;
  2780. if (numToShift > 0)
  2781. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2782. if ((numUsed << 1) < data.numAllocated)
  2783. minimiseStorageOverheads();
  2784. }
  2785. }
  2786. void removeObject (const ObjectClass* const objectToRemove,
  2787. const bool deleteObject = true)
  2788. {
  2789. const ScopedLockType lock (getLock());
  2790. ObjectClass** e = data.elements.getData();
  2791. for (int i = numUsed; --i >= 0;)
  2792. {
  2793. if (objectToRemove == *e)
  2794. {
  2795. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2796. break;
  2797. }
  2798. ++e;
  2799. }
  2800. }
  2801. void removeRange (int startIndex,
  2802. const int numberToRemove,
  2803. const bool deleteObjects = true)
  2804. {
  2805. const ScopedLockType lock (getLock());
  2806. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2807. startIndex = jlimit (0, numUsed, startIndex);
  2808. if (endIndex > startIndex)
  2809. {
  2810. if (deleteObjects)
  2811. {
  2812. for (int i = startIndex; i < endIndex; ++i)
  2813. {
  2814. delete data.elements [i];
  2815. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2816. }
  2817. }
  2818. const int rangeSize = endIndex - startIndex;
  2819. ObjectClass** e = data.elements + startIndex;
  2820. int numToShift = numUsed - endIndex;
  2821. numUsed -= rangeSize;
  2822. while (--numToShift >= 0)
  2823. {
  2824. *e = e [rangeSize];
  2825. ++e;
  2826. }
  2827. if ((numUsed << 1) < data.numAllocated)
  2828. minimiseStorageOverheads();
  2829. }
  2830. }
  2831. void removeLast (int howManyToRemove = 1,
  2832. const bool deleteObjects = true)
  2833. {
  2834. const ScopedLockType lock (getLock());
  2835. if (howManyToRemove >= numUsed)
  2836. {
  2837. clear (deleteObjects);
  2838. }
  2839. else
  2840. {
  2841. while (--howManyToRemove >= 0)
  2842. remove (numUsed - 1, deleteObjects);
  2843. }
  2844. }
  2845. void swap (const int index1,
  2846. const int index2) throw()
  2847. {
  2848. const ScopedLockType lock (getLock());
  2849. if (((unsigned int) index1) < (unsigned int) numUsed
  2850. && ((unsigned int) index2) < (unsigned int) numUsed)
  2851. {
  2852. swapVariables (data.elements [index1],
  2853. data.elements [index2]);
  2854. }
  2855. }
  2856. void move (const int currentIndex,
  2857. int newIndex) throw()
  2858. {
  2859. if (currentIndex != newIndex)
  2860. {
  2861. const ScopedLockType lock (getLock());
  2862. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2863. {
  2864. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2865. newIndex = numUsed - 1;
  2866. ObjectClass* const value = data.elements [currentIndex];
  2867. if (newIndex > currentIndex)
  2868. {
  2869. memmove (data.elements + currentIndex,
  2870. data.elements + currentIndex + 1,
  2871. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2872. }
  2873. else
  2874. {
  2875. memmove (data.elements + newIndex + 1,
  2876. data.elements + newIndex,
  2877. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2878. }
  2879. data.elements [newIndex] = value;
  2880. }
  2881. }
  2882. }
  2883. void swapWithArray (OwnedArray& otherArray) throw()
  2884. {
  2885. const ScopedLockType lock1 (getLock());
  2886. const ScopedLockType lock2 (otherArray.getLock());
  2887. data.swapWith (otherArray.data);
  2888. swapVariables (numUsed, otherArray.numUsed);
  2889. }
  2890. void minimiseStorageOverheads() throw()
  2891. {
  2892. const ScopedLockType lock (getLock());
  2893. data.shrinkToNoMoreThan (numUsed);
  2894. }
  2895. void ensureStorageAllocated (const int minNumElements) throw()
  2896. {
  2897. const ScopedLockType lock (getLock());
  2898. data.ensureAllocatedSize (minNumElements);
  2899. }
  2900. template <class ElementComparator>
  2901. void sort (ElementComparator& comparator,
  2902. const bool retainOrderOfEquivalentItems = false) const throw()
  2903. {
  2904. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2905. // avoids getting warning messages about the parameter being unused
  2906. const ScopedLockType lock (getLock());
  2907. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2908. }
  2909. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2910. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2911. juce_UseDebuggingNewOperator
  2912. private:
  2913. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2914. int numUsed;
  2915. // disallow copy constructor and assignment
  2916. OwnedArray (const OwnedArray&);
  2917. OwnedArray& operator= (const OwnedArray&);
  2918. };
  2919. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2920. /*** End of inlined file: juce_OwnedArray.h ***/
  2921. #endif
  2922. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2923. /*** Start of inlined file: juce_PropertySet.h ***/
  2924. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2925. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2926. /*** Start of inlined file: juce_StringPairArray.h ***/
  2927. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2928. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2929. /*** Start of inlined file: juce_StringArray.h ***/
  2930. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2931. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2932. class JUCE_API StringArray
  2933. {
  2934. public:
  2935. StringArray() throw();
  2936. StringArray (const StringArray& other);
  2937. explicit StringArray (const String& firstValue);
  2938. StringArray (const juce_wchar** strings, int numberOfStrings);
  2939. StringArray (const char** strings, int numberOfStrings);
  2940. explicit StringArray (const juce_wchar** strings);
  2941. explicit StringArray (const char** strings);
  2942. ~StringArray();
  2943. StringArray& operator= (const StringArray& other);
  2944. bool operator== (const StringArray& other) const throw();
  2945. bool operator!= (const StringArray& other) const throw();
  2946. inline int size() const throw() { return strings.size(); };
  2947. const String& operator[] (int index) const throw();
  2948. String& getReference (int index) throw();
  2949. bool contains (const String& stringToLookFor,
  2950. bool ignoreCase = false) const;
  2951. int indexOf (const String& stringToLookFor,
  2952. bool ignoreCase = false,
  2953. int startIndex = 0) const;
  2954. void add (const String& stringToAdd);
  2955. void insert (int index, const String& stringToAdd);
  2956. void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
  2957. void set (int index, const String& newString);
  2958. void addArray (const StringArray& other,
  2959. int startIndex = 0,
  2960. int numElementsToAdd = -1);
  2961. int addTokens (const String& stringToTokenise,
  2962. bool preserveQuotedStrings);
  2963. int addTokens (const String& stringToTokenise,
  2964. const String& breakCharacters,
  2965. const String& quoteCharacters);
  2966. int addLines (const String& stringToBreakUp);
  2967. void clear();
  2968. void remove (int index);
  2969. void removeString (const String& stringToRemove,
  2970. bool ignoreCase = false);
  2971. void removeRange (int startIndex, int numberToRemove);
  2972. void removeDuplicates (bool ignoreCase);
  2973. void removeEmptyStrings (bool removeWhitespaceStrings = true);
  2974. void move (int currentIndex, int newIndex) throw();
  2975. void trim();
  2976. void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
  2977. bool appendNumberToFirstInstance,
  2978. const juce_wchar* preNumberString = 0,
  2979. const juce_wchar* postNumberString = 0);
  2980. const String joinIntoString (const String& separatorString,
  2981. int startIndex = 0,
  2982. int numberOfElements = -1) const;
  2983. void sort (bool ignoreCase);
  2984. void minimiseStorageOverheads();
  2985. juce_UseDebuggingNewOperator
  2986. private:
  2987. Array <String> strings;
  2988. };
  2989. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2990. /*** End of inlined file: juce_StringArray.h ***/
  2991. class JUCE_API StringPairArray
  2992. {
  2993. public:
  2994. StringPairArray (bool ignoreCaseWhenComparingKeys = true);
  2995. StringPairArray (const StringPairArray& other);
  2996. ~StringPairArray();
  2997. StringPairArray& operator= (const StringPairArray& other);
  2998. bool operator== (const StringPairArray& other) const;
  2999. bool operator!= (const StringPairArray& other) const;
  3000. const String& operator[] (const String& key) const;
  3001. const String getValue (const String& key, const String& defaultReturnValue) const;
  3002. const StringArray& getAllKeys() const throw() { return keys; }
  3003. const StringArray& getAllValues() const throw() { return values; }
  3004. inline int size() const throw() { return keys.size(); };
  3005. void set (const String& key, const String& value);
  3006. void addArray (const StringPairArray& other);
  3007. void clear();
  3008. void remove (const String& key);
  3009. void remove (int index);
  3010. void setIgnoresCase (bool shouldIgnoreCase);
  3011. const String getDescription() const;
  3012. void minimiseStorageOverheads();
  3013. juce_UseDebuggingNewOperator
  3014. private:
  3015. StringArray keys, values;
  3016. bool ignoreCase;
  3017. };
  3018. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3019. /*** End of inlined file: juce_StringPairArray.h ***/
  3020. /*** Start of inlined file: juce_XmlElement.h ***/
  3021. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3022. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3023. /*** Start of inlined file: juce_File.h ***/
  3024. #ifndef __JUCE_FILE_JUCEHEADER__
  3025. #define __JUCE_FILE_JUCEHEADER__
  3026. /*** Start of inlined file: juce_Time.h ***/
  3027. #ifndef __JUCE_TIME_JUCEHEADER__
  3028. #define __JUCE_TIME_JUCEHEADER__
  3029. /*** Start of inlined file: juce_RelativeTime.h ***/
  3030. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3031. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3032. class JUCE_API RelativeTime
  3033. {
  3034. public:
  3035. explicit RelativeTime (double seconds = 0.0) throw();
  3036. RelativeTime (const RelativeTime& other) throw();
  3037. RelativeTime& operator= (const RelativeTime& other) throw();
  3038. ~RelativeTime() throw();
  3039. static const RelativeTime milliseconds (int milliseconds) throw();
  3040. static const RelativeTime milliseconds (int64 milliseconds) throw();
  3041. static const RelativeTime minutes (double numberOfMinutes) throw();
  3042. static const RelativeTime hours (double numberOfHours) throw();
  3043. static const RelativeTime days (double numberOfDays) throw();
  3044. static const RelativeTime weeks (double numberOfWeeks) throw();
  3045. int64 inMilliseconds() const throw();
  3046. double inSeconds() const throw() { return seconds; }
  3047. double inMinutes() const throw();
  3048. double inHours() const throw();
  3049. double inDays() const throw();
  3050. double inWeeks() const throw();
  3051. const String getDescription (const String& returnValueForZeroTime = "0") const throw();
  3052. bool operator== (const RelativeTime& other) const throw();
  3053. bool operator!= (const RelativeTime& other) const throw();
  3054. bool operator> (const RelativeTime& other) const throw();
  3055. bool operator< (const RelativeTime& other) const throw();
  3056. bool operator>= (const RelativeTime& other) const throw();
  3057. bool operator<= (const RelativeTime& other) const throw();
  3058. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3059. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3060. const RelativeTime operator+ (double secondsToAdd) const throw();
  3061. const RelativeTime operator- (double secondsToSubtract) const throw();
  3062. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3063. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3064. const RelativeTime& operator+= (double secondsToAdd) throw();
  3065. const RelativeTime& operator-= (double secondsToSubtract) throw();
  3066. juce_UseDebuggingNewOperator
  3067. private:
  3068. double seconds;
  3069. };
  3070. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3071. /*** End of inlined file: juce_RelativeTime.h ***/
  3072. class JUCE_API Time
  3073. {
  3074. public:
  3075. Time() throw();
  3076. Time (const Time& other) throw();
  3077. Time (int64 millisecondsSinceEpoch) throw();
  3078. Time (int year,
  3079. int month,
  3080. int day,
  3081. int hours,
  3082. int minutes,
  3083. int seconds = 0,
  3084. int milliseconds = 0,
  3085. bool useLocalTime = true) throw();
  3086. ~Time() throw();
  3087. Time& operator= (const Time& other) throw();
  3088. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3089. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3090. int getYear() const throw();
  3091. int getMonth() const throw();
  3092. const String getMonthName (bool threeLetterVersion) const throw();
  3093. int getDayOfMonth() const throw();
  3094. int getDayOfWeek() const throw();
  3095. const String getWeekdayName (bool threeLetterVersion) const throw();
  3096. int getHours() const throw();
  3097. bool isAfternoon() const throw();
  3098. int getHoursInAmPmFormat() const throw();
  3099. int getMinutes() const throw();
  3100. int getSeconds() const throw();
  3101. int getMilliseconds() const throw();
  3102. bool isDaylightSavingTime() const throw();
  3103. const String getTimeZone() const throw();
  3104. const String toString (bool includeDate,
  3105. bool includeTime,
  3106. bool includeSeconds = true,
  3107. bool use24HourClock = false) const throw();
  3108. const String formatted (const String& format) const throw();
  3109. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3110. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3111. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3112. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3113. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3114. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3115. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3116. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3117. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3118. bool setSystemTimeToThisTime() const throw();
  3119. static const String getWeekdayName (int dayNumber,
  3120. bool threeLetterVersion) throw();
  3121. static const String getMonthName (int monthNumber,
  3122. bool threeLetterVersion) throw();
  3123. // Static methods for getting system timers directly..
  3124. static int64 currentTimeMillis() throw();
  3125. static uint32 getMillisecondCounter() throw();
  3126. static double getMillisecondCounterHiRes() throw();
  3127. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3128. static uint32 getApproximateMillisecondCounter() throw();
  3129. // High-resolution timers..
  3130. static int64 getHighResolutionTicks() throw();
  3131. static int64 getHighResolutionTicksPerSecond() throw();
  3132. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3133. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3134. private:
  3135. int64 millisSinceEpoch;
  3136. };
  3137. #endif // __JUCE_TIME_JUCEHEADER__
  3138. /*** End of inlined file: juce_Time.h ***/
  3139. class FileInputStream;
  3140. class FileOutputStream;
  3141. class JUCE_API File
  3142. {
  3143. public:
  3144. File() {}
  3145. File (const String& path);
  3146. File (const File& other);
  3147. ~File() {}
  3148. File& operator= (const String& newFilePath);
  3149. File& operator= (const File& otherFile);
  3150. static const File nonexistent;
  3151. bool exists() const;
  3152. bool existsAsFile() const;
  3153. bool isDirectory() const;
  3154. int64 getSize() const;
  3155. static const String descriptionOfSizeInBytes (int64 bytes);
  3156. const String& getFullPathName() const throw() { return fullPath; }
  3157. const String getFileName() const;
  3158. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3159. const String getFileExtension() const;
  3160. bool hasFileExtension (const String& extensionToTest) const;
  3161. const File withFileExtension (const String& newExtension) const;
  3162. const String getFileNameWithoutExtension() const;
  3163. int hashCode() const;
  3164. int64 hashCode64() const;
  3165. const File getChildFile (String relativePath) const;
  3166. const File getSiblingFile (const String& siblingFileName) const;
  3167. const File getParentDirectory() const;
  3168. bool isAChildOf (const File& potentialParentDirectory) const;
  3169. const File getNonexistentChildFile (const String& prefix,
  3170. const String& suffix,
  3171. bool putNumbersInBrackets = true) const;
  3172. const File getNonexistentSibling (bool putNumbersInBrackets = true) const;
  3173. bool operator== (const File& otherFile) const;
  3174. bool operator!= (const File& otherFile) const;
  3175. bool operator< (const File& otherFile) const;
  3176. bool operator> (const File& otherFile) const;
  3177. bool hasWriteAccess() const;
  3178. bool setReadOnly (bool shouldBeReadOnly,
  3179. bool applyRecursively = false) const;
  3180. bool isHidden() const;
  3181. const File getLinkedTarget() const;
  3182. const Time getLastModificationTime() const;
  3183. const Time getLastAccessTime() const;
  3184. const Time getCreationTime() const;
  3185. bool setLastModificationTime (const Time& newTime) const;
  3186. bool setLastAccessTime (const Time& newTime) const;
  3187. bool setCreationTime (const Time& newTime) const;
  3188. const String getVersion() const;
  3189. bool create() const;
  3190. bool createDirectory() const;
  3191. bool deleteFile() const;
  3192. bool deleteRecursively() const;
  3193. bool moveToTrash() const;
  3194. bool moveFileTo (const File& targetLocation) const;
  3195. bool copyFileTo (const File& targetLocation) const;
  3196. bool copyDirectoryTo (const File& newDirectory) const;
  3197. enum TypesOfFileToFind
  3198. {
  3199. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3200. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3201. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3202. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3203. };
  3204. int findChildFiles (Array<File>& results,
  3205. int whatToLookFor,
  3206. bool searchRecursively,
  3207. const String& wildCardPattern = "*") const;
  3208. int getNumberOfChildFiles (int whatToLookFor,
  3209. const String& wildCardPattern = "*") const;
  3210. bool containsSubDirectories() const;
  3211. FileInputStream* createInputStream() const;
  3212. FileOutputStream* createOutputStream (int bufferSize = 0x8000) const;
  3213. bool loadFileAsData (MemoryBlock& result) const;
  3214. const String loadFileAsString() const;
  3215. bool appendData (const void* dataToAppend,
  3216. int numberOfBytes) const;
  3217. bool replaceWithData (const void* dataToWrite,
  3218. int numberOfBytes) const;
  3219. bool appendText (const String& textToAppend,
  3220. bool asUnicode = false,
  3221. bool writeUnicodeHeaderBytes = false) const;
  3222. bool replaceWithText (const String& textToWrite,
  3223. bool asUnicode = false,
  3224. bool writeUnicodeHeaderBytes = false) const;
  3225. static void findFileSystemRoots (Array<File>& results);
  3226. const String getVolumeLabel() const;
  3227. int getVolumeSerialNumber() const;
  3228. int64 getBytesFreeOnVolume() const;
  3229. int64 getVolumeTotalSize() const;
  3230. bool isOnCDRomDrive() const;
  3231. bool isOnHardDisk() const;
  3232. bool isOnRemovableDrive() const;
  3233. bool startAsProcess (const String& parameters = String::empty) const;
  3234. void revealToUser() const;
  3235. enum SpecialLocationType
  3236. {
  3237. userHomeDirectory,
  3238. userDocumentsDirectory,
  3239. userDesktopDirectory,
  3240. userApplicationDataDirectory,
  3241. commonApplicationDataDirectory,
  3242. tempDirectory,
  3243. currentExecutableFile,
  3244. currentApplicationFile,
  3245. invokedExecutableFile,
  3246. globalApplicationsDirectory,
  3247. userMusicDirectory,
  3248. userMoviesDirectory,
  3249. };
  3250. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3251. static const File createTempFile (const String& fileNameEnding);
  3252. static const File getCurrentWorkingDirectory();
  3253. bool setAsCurrentWorkingDirectory() const;
  3254. static const juce_wchar separator;
  3255. static const String separatorString;
  3256. static const String createLegalFileName (const String& fileNameToFix);
  3257. static const String createLegalPathName (const String& pathNameToFix);
  3258. static bool areFileNamesCaseSensitive();
  3259. static bool isAbsolutePath (const String& path);
  3260. static const File createFileWithoutCheckingPath (const String& path);
  3261. static const String addTrailingSeparator (const String& path);
  3262. juce_UseDebuggingNewOperator
  3263. private:
  3264. String fullPath;
  3265. // internal way of contructing a file without checking the path
  3266. friend class DirectoryIterator;
  3267. File (const String&, int);
  3268. const String getPathUpToLastSlash() const;
  3269. void createDirectoryInternal (const String& fileName) const;
  3270. bool copyInternal (const File& dest) const;
  3271. bool moveInternal (const File& dest) const;
  3272. bool setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 creationTime) const;
  3273. void getFileTimesInternal (int64& modificationTime, int64& accessTime, int64& creationTime) const;
  3274. bool setFileReadOnlyInternal (bool shouldBeReadOnly) const;
  3275. static const String parseAbsolutePath (const String& path);
  3276. static bool fileTypeMatches (int whatToLookFor, bool isDir, bool isHidden);
  3277. };
  3278. #endif // __JUCE_FILE_JUCEHEADER__
  3279. /*** End of inlined file: juce_File.h ***/
  3280. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3281. \
  3282. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3283. childElementVariableName != 0; \
  3284. childElementVariableName = childElementVariableName->getNextElement())
  3285. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3286. \
  3287. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3288. childElementVariableName != 0; \
  3289. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3290. class JUCE_API XmlElement
  3291. {
  3292. public:
  3293. explicit XmlElement (const String& tagName) throw();
  3294. XmlElement (const XmlElement& other) throw();
  3295. XmlElement& operator= (const XmlElement& other) throw();
  3296. ~XmlElement() throw();
  3297. bool isEquivalentTo (const XmlElement* other,
  3298. bool ignoreOrderOfAttributes) const throw();
  3299. const String createDocument (const String& dtdToUse,
  3300. bool allOnOneLine = false,
  3301. bool includeXmlHeader = true,
  3302. const String& encodingType = "UTF-8",
  3303. int lineWrapLength = 60) const;
  3304. void writeToStream (OutputStream& output,
  3305. const String& dtdToUse,
  3306. bool allOnOneLine = false,
  3307. bool includeXmlHeader = true,
  3308. const String& encodingType = "UTF-8",
  3309. int lineWrapLength = 60) const;
  3310. bool writeToFile (const File& destinationFile,
  3311. const String& dtdToUse,
  3312. const String& encodingType = "UTF-8",
  3313. int lineWrapLength = 60) const;
  3314. inline const String& getTagName() const throw() { return tagName; }
  3315. bool hasTagName (const String& possibleTagName) const throw();
  3316. int getNumAttributes() const throw();
  3317. const String& getAttributeName (int attributeIndex) const throw();
  3318. const String& getAttributeValue (int attributeIndex) const throw();
  3319. // Attribute-handling methods..
  3320. bool hasAttribute (const String& attributeName) const throw();
  3321. const String& getStringAttribute (const String& attributeName) const throw();
  3322. const String getStringAttribute (const String& attributeName,
  3323. const String& defaultReturnValue) const;
  3324. bool compareAttribute (const String& attributeName,
  3325. const String& stringToCompareAgainst,
  3326. bool ignoreCase = false) const throw();
  3327. int getIntAttribute (const String& attributeName,
  3328. int defaultReturnValue = 0) const;
  3329. double getDoubleAttribute (const String& attributeName,
  3330. double defaultReturnValue = 0.0) const;
  3331. bool getBoolAttribute (const String& attributeName,
  3332. bool defaultReturnValue = false) const;
  3333. void setAttribute (const String& attributeName,
  3334. const String& newValue);
  3335. void setAttribute (const String& attributeName,
  3336. int newValue);
  3337. void setAttribute (const String& attributeName,
  3338. double newValue);
  3339. void removeAttribute (const String& attributeName) throw();
  3340. void removeAllAttributes() throw();
  3341. // Child element methods..
  3342. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3343. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3344. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3345. int getNumChildElements() const throw();
  3346. XmlElement* getChildElement (int index) const throw();
  3347. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3348. void addChildElement (XmlElement* const newChildElement) throw();
  3349. void insertChildElement (XmlElement* newChildNode,
  3350. int indexToInsertAt) throw();
  3351. XmlElement* createNewChildElement (const String& tagName);
  3352. bool replaceChildElement (XmlElement* currentChildElement,
  3353. XmlElement* newChildNode) throw();
  3354. void removeChildElement (XmlElement* childToRemove,
  3355. bool shouldDeleteTheChild) throw();
  3356. void deleteAllChildElements() throw();
  3357. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3358. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3359. XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
  3360. template <class ElementComparator>
  3361. void sortChildElements (ElementComparator& comparator,
  3362. const bool retainOrderOfEquivalentItems = false) throw()
  3363. {
  3364. const int num = getNumChildElements();
  3365. if (num > 1)
  3366. {
  3367. HeapBlock <XmlElement*> elems (num);
  3368. getChildElementsAsArray (elems);
  3369. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3370. reorderChildElements (elems, num);
  3371. }
  3372. }
  3373. bool isTextElement() const throw();
  3374. const String getText() const throw();
  3375. void setText (const String& newText) throw();
  3376. const String getAllSubText() const throw();
  3377. const String getChildElementAllSubText (const String& childTagName,
  3378. const String& defaultReturnValue) const throw();
  3379. void addTextElement (const String& text) throw();
  3380. void deleteAllTextElements() throw();
  3381. static XmlElement* createTextElement (const String& text) throw();
  3382. juce_UseDebuggingNewOperator
  3383. private:
  3384. friend class XmlDocument;
  3385. String tagName;
  3386. XmlElement* firstChildElement;
  3387. XmlElement* nextElement;
  3388. struct XmlAttributeNode
  3389. {
  3390. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3391. XmlAttributeNode (const String& name, const String& value) throw();
  3392. String name, value;
  3393. XmlAttributeNode* next;
  3394. private:
  3395. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3396. };
  3397. XmlAttributeNode* attributes;
  3398. XmlElement (int) throw();
  3399. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3400. void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
  3401. void getChildElementsAsArray (XmlElement**) const throw();
  3402. void reorderChildElements (XmlElement** const, const int) throw();
  3403. };
  3404. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3405. /*** End of inlined file: juce_XmlElement.h ***/
  3406. class JUCE_API PropertySet
  3407. {
  3408. public:
  3409. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3410. PropertySet (const PropertySet& other) throw();
  3411. PropertySet& operator= (const PropertySet& other) throw();
  3412. virtual ~PropertySet();
  3413. const String getValue (const String& keyName,
  3414. const String& defaultReturnValue = String::empty) const throw();
  3415. int getIntValue (const String& keyName,
  3416. const int defaultReturnValue = 0) const throw();
  3417. double getDoubleValue (const String& keyName,
  3418. const double defaultReturnValue = 0.0) const throw();
  3419. bool getBoolValue (const String& keyName,
  3420. const bool defaultReturnValue = false) const throw();
  3421. XmlElement* getXmlValue (const String& keyName) const;
  3422. void setValue (const String& keyName, const String& value) throw();
  3423. void setValue (const String& keyName, const int value) throw();
  3424. void setValue (const String& keyName, const double value) throw();
  3425. void setValue (const String& keyName, const bool value) throw();
  3426. void setValue (const String& keyName, const XmlElement* const xml);
  3427. void removeValue (const String& keyName) throw();
  3428. bool containsKey (const String& keyName) const throw();
  3429. void clear();
  3430. StringPairArray& getAllProperties() throw() { return properties; }
  3431. const CriticalSection& getLock() const throw() { return lock; }
  3432. XmlElement* createXml (const String& nodeName) const throw();
  3433. void restoreFromXml (const XmlElement& xml) throw();
  3434. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3435. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3436. juce_UseDebuggingNewOperator
  3437. protected:
  3438. virtual void propertyChanged();
  3439. private:
  3440. StringPairArray properties;
  3441. PropertySet* fallbackProperties;
  3442. CriticalSection lock;
  3443. bool ignoreCaseOfKeys;
  3444. };
  3445. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3446. /*** End of inlined file: juce_PropertySet.h ***/
  3447. #endif
  3448. #ifndef __JUCE_RANGE_JUCEHEADER__
  3449. /*** Start of inlined file: juce_Range.h ***/
  3450. #ifndef __JUCE_RANGE_JUCEHEADER__
  3451. #define __JUCE_RANGE_JUCEHEADER__
  3452. template <typename ValueType>
  3453. class Range
  3454. {
  3455. public:
  3456. Range() throw()
  3457. : start (ValueType()), end (ValueType())
  3458. {
  3459. }
  3460. Range (const ValueType start_, const ValueType end_) throw()
  3461. : start (start_), end (jmax (start_, end_))
  3462. {
  3463. }
  3464. Range (const Range& other) throw()
  3465. : start (other.start), end (other.end)
  3466. {
  3467. }
  3468. Range& operator= (const Range& other) throw()
  3469. {
  3470. start = other.start;
  3471. end = other.end;
  3472. return *this;
  3473. }
  3474. ~Range() throw()
  3475. {
  3476. }
  3477. static const Range between (const ValueType position1, const ValueType position2) throw()
  3478. {
  3479. return (position1 < position2) ? Range (position1, position2)
  3480. : Range (position2, position1);
  3481. }
  3482. static const Range emptyRange (const ValueType start) throw()
  3483. {
  3484. return Range (start, start);
  3485. }
  3486. inline ValueType getStart() const throw() { return start; }
  3487. inline ValueType getLength() const throw() { return end - start; }
  3488. inline ValueType getEnd() const throw() { return end; }
  3489. inline bool isEmpty() const throw() { return start == end; }
  3490. void setStart (const ValueType newStart) throw()
  3491. {
  3492. start = newStart;
  3493. if (end < newStart)
  3494. end = newStart;
  3495. }
  3496. const Range withStart (const ValueType newStart) const throw()
  3497. {
  3498. return Range (newStart, jmax (newStart, end));
  3499. }
  3500. const Range movedToStartAt (const ValueType newStart) const throw()
  3501. {
  3502. return Range (newStart, newStart + getLength());
  3503. }
  3504. void setEnd (const ValueType newEnd) throw()
  3505. {
  3506. end = newEnd;
  3507. if (newEnd < start)
  3508. start = newEnd;
  3509. }
  3510. const Range withEnd (const ValueType newEnd) const throw()
  3511. {
  3512. return Range (jmin (start, newEnd), newEnd);
  3513. }
  3514. const Range movedToEndAt (const ValueType newEnd) const throw()
  3515. {
  3516. return Range (newEnd - getLength(), newEnd);
  3517. }
  3518. void setLength (const ValueType newLength) throw()
  3519. {
  3520. end = start + jmax (ValueType(), newLength);
  3521. }
  3522. const Range withLength (const ValueType newLength) const throw()
  3523. {
  3524. return Range (start, start + newLength);
  3525. }
  3526. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3527. {
  3528. start += amountToAdd;
  3529. end += amountToAdd;
  3530. return *this;
  3531. }
  3532. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3533. {
  3534. start -= amountToSubtract;
  3535. end -= amountToSubtract;
  3536. return *this;
  3537. }
  3538. const Range operator+ (const ValueType amountToAdd) const throw()
  3539. {
  3540. return Range (start + amountToAdd, end + amountToAdd);
  3541. }
  3542. const Range operator- (const ValueType amountToSubtract) const throw()
  3543. {
  3544. return Range (start - amountToSubtract, end - amountToSubtract);
  3545. }
  3546. bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
  3547. bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }
  3548. bool contains (const ValueType position) const throw()
  3549. {
  3550. return start <= position && position < end;
  3551. }
  3552. ValueType clipValue (const ValueType value) const throw()
  3553. {
  3554. return jlimit (start, end, value);
  3555. }
  3556. bool intersects (const Range& other) const throw()
  3557. {
  3558. return other.start < end && start < other.end;
  3559. }
  3560. const Range getIntersectionWith (const Range& other) const throw()
  3561. {
  3562. return Range (jmax (start, other.start),
  3563. jmin (end, other.end));
  3564. }
  3565. const Range getUnionWith (const Range& other) const throw()
  3566. {
  3567. return Range (jmin (start, other.start),
  3568. jmax (end, other.end));
  3569. }
  3570. const Range constrainRange (const Range& rangeToConstrain) const throw()
  3571. {
  3572. const ValueType otherLen = rangeToConstrain.getLength();
  3573. return getLength() <= otherLen
  3574. ? *this
  3575. : rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
  3576. }
  3577. juce_UseDebuggingNewOperator
  3578. private:
  3579. ValueType start, end;
  3580. };
  3581. #endif // __JUCE_RANGE_JUCEHEADER__
  3582. /*** End of inlined file: juce_Range.h ***/
  3583. #endif
  3584. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3585. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3586. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3587. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3588. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3589. class ReferenceCountedArray
  3590. {
  3591. public:
  3592. ReferenceCountedArray() throw()
  3593. : numUsed (0)
  3594. {
  3595. }
  3596. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3597. {
  3598. const ScopedLockType lock (other.getLock());
  3599. numUsed = other.numUsed;
  3600. data.setAllocatedSize (numUsed);
  3601. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3602. for (int i = numUsed; --i >= 0;)
  3603. if (data.elements[i] != 0)
  3604. data.elements[i]->incReferenceCount();
  3605. }
  3606. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3607. {
  3608. if (this != &other)
  3609. {
  3610. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3611. swapWithArray (other);
  3612. }
  3613. return *this;
  3614. }
  3615. ~ReferenceCountedArray()
  3616. {
  3617. clear();
  3618. }
  3619. void clear()
  3620. {
  3621. const ScopedLockType lock (getLock());
  3622. while (numUsed > 0)
  3623. if (data.elements [--numUsed] != 0)
  3624. data.elements [numUsed]->decReferenceCount();
  3625. jassert (numUsed == 0);
  3626. data.setAllocatedSize (0);
  3627. }
  3628. inline int size() const throw()
  3629. {
  3630. return numUsed;
  3631. }
  3632. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3633. {
  3634. const ScopedLockType lock (getLock());
  3635. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3636. : static_cast <ObjectClass*> (0);
  3637. }
  3638. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3639. {
  3640. const ScopedLockType lock (getLock());
  3641. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3642. return data.elements [index];
  3643. }
  3644. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3645. {
  3646. const ScopedLockType lock (getLock());
  3647. return numUsed > 0 ? data.elements [0]
  3648. : static_cast <ObjectClass*> (0);
  3649. }
  3650. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3651. {
  3652. const ScopedLockType lock (getLock());
  3653. return numUsed > 0 ? data.elements [numUsed - 1]
  3654. : static_cast <ObjectClass*> (0);
  3655. }
  3656. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3657. {
  3658. const ScopedLockType lock (getLock());
  3659. ObjectClass** e = data.elements.getData();
  3660. ObjectClass** const end = e + numUsed;
  3661. while (e != end)
  3662. {
  3663. if (objectToLookFor == *e)
  3664. return static_cast <int> (e - data.elements.getData());
  3665. ++e;
  3666. }
  3667. return -1;
  3668. }
  3669. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3670. {
  3671. const ScopedLockType lock (getLock());
  3672. ObjectClass** e = data.elements.getData();
  3673. ObjectClass** const end = e + numUsed;
  3674. while (e != end)
  3675. {
  3676. if (objectToLookFor == *e)
  3677. return true;
  3678. ++e;
  3679. }
  3680. return false;
  3681. }
  3682. void add (ObjectClass* const newObject) throw()
  3683. {
  3684. const ScopedLockType lock (getLock());
  3685. data.ensureAllocatedSize (numUsed + 1);
  3686. data.elements [numUsed++] = newObject;
  3687. if (newObject != 0)
  3688. newObject->incReferenceCount();
  3689. }
  3690. void insert (int indexToInsertAt,
  3691. ObjectClass* const newObject) throw()
  3692. {
  3693. if (indexToInsertAt >= 0)
  3694. {
  3695. const ScopedLockType lock (getLock());
  3696. if (indexToInsertAt > numUsed)
  3697. indexToInsertAt = numUsed;
  3698. data.ensureAllocatedSize (numUsed + 1);
  3699. ObjectClass** const e = data.elements + indexToInsertAt;
  3700. const int numToMove = numUsed - indexToInsertAt;
  3701. if (numToMove > 0)
  3702. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3703. *e = newObject;
  3704. if (newObject != 0)
  3705. newObject->incReferenceCount();
  3706. ++numUsed;
  3707. }
  3708. else
  3709. {
  3710. add (newObject);
  3711. }
  3712. }
  3713. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3714. {
  3715. const ScopedLockType lock (getLock());
  3716. if (! contains (newObject))
  3717. add (newObject);
  3718. }
  3719. void set (const int indexToChange,
  3720. ObjectClass* const newObject)
  3721. {
  3722. if (indexToChange >= 0)
  3723. {
  3724. const ScopedLockType lock (getLock());
  3725. if (newObject != 0)
  3726. newObject->incReferenceCount();
  3727. if (indexToChange < numUsed)
  3728. {
  3729. if (data.elements [indexToChange] != 0)
  3730. data.elements [indexToChange]->decReferenceCount();
  3731. data.elements [indexToChange] = newObject;
  3732. }
  3733. else
  3734. {
  3735. data.ensureAllocatedSize (numUsed + 1);
  3736. data.elements [numUsed++] = newObject;
  3737. }
  3738. }
  3739. }
  3740. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3741. int startIndex = 0,
  3742. int numElementsToAdd = -1) throw()
  3743. {
  3744. arrayToAddFrom.lockArray();
  3745. const ScopedLockType lock (getLock());
  3746. if (startIndex < 0)
  3747. {
  3748. jassertfalse
  3749. startIndex = 0;
  3750. }
  3751. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3752. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3753. if (numElementsToAdd > 0)
  3754. {
  3755. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3756. while (--numElementsToAdd >= 0)
  3757. add (arrayToAddFrom.getUnchecked (startIndex++));
  3758. }
  3759. arrayToAddFrom.unlockArray();
  3760. }
  3761. template <class ElementComparator>
  3762. void addSorted (ElementComparator& comparator,
  3763. ObjectClass* newObject) throw()
  3764. {
  3765. const ScopedLockType lock (getLock());
  3766. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3767. }
  3768. template <class ElementComparator>
  3769. void addOrReplaceSorted (ElementComparator& comparator,
  3770. ObjectClass* newObject) throw()
  3771. {
  3772. const ScopedLockType lock (getLock());
  3773. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3774. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3775. set (index - 1, newObject); // replace an existing object that matches
  3776. else
  3777. insert (index, newObject); // no match, so insert the new one
  3778. }
  3779. void remove (const int indexToRemove)
  3780. {
  3781. const ScopedLockType lock (getLock());
  3782. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3783. {
  3784. ObjectClass** const e = data.elements + indexToRemove;
  3785. if (*e != 0)
  3786. (*e)->decReferenceCount();
  3787. --numUsed;
  3788. const int numberToShift = numUsed - indexToRemove;
  3789. if (numberToShift > 0)
  3790. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3791. if ((numUsed << 1) < data.numAllocated)
  3792. minimiseStorageOverheads();
  3793. }
  3794. }
  3795. void removeObject (ObjectClass* const objectToRemove)
  3796. {
  3797. const ScopedLockType lock (getLock());
  3798. remove (indexOf (objectToRemove));
  3799. }
  3800. void removeRange (const int startIndex,
  3801. const int numberToRemove)
  3802. {
  3803. const ScopedLockType lock (getLock());
  3804. const int start = jlimit (0, numUsed, startIndex);
  3805. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3806. if (end > start)
  3807. {
  3808. int i;
  3809. for (i = start; i < end; ++i)
  3810. {
  3811. if (data.elements[i] != 0)
  3812. {
  3813. data.elements[i]->decReferenceCount();
  3814. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3815. }
  3816. }
  3817. const int rangeSize = end - start;
  3818. ObjectClass** e = data.elements + start;
  3819. i = numUsed - end;
  3820. numUsed -= rangeSize;
  3821. while (--i >= 0)
  3822. {
  3823. *e = e [rangeSize];
  3824. ++e;
  3825. }
  3826. if ((numUsed << 1) < data.numAllocated)
  3827. minimiseStorageOverheads();
  3828. }
  3829. }
  3830. void removeLast (int howManyToRemove = 1)
  3831. {
  3832. const ScopedLockType lock (getLock());
  3833. if (howManyToRemove > numUsed)
  3834. howManyToRemove = numUsed;
  3835. while (--howManyToRemove >= 0)
  3836. remove (numUsed - 1);
  3837. }
  3838. void swap (const int index1,
  3839. const int index2) throw()
  3840. {
  3841. const ScopedLockType lock (getLock());
  3842. if (((unsigned int) index1) < (unsigned int) numUsed
  3843. && ((unsigned int) index2) < (unsigned int) numUsed)
  3844. {
  3845. swapVariables (data.elements [index1],
  3846. data.elements [index2]);
  3847. }
  3848. }
  3849. void move (const int currentIndex,
  3850. int newIndex) throw()
  3851. {
  3852. if (currentIndex != newIndex)
  3853. {
  3854. const ScopedLockType lock (getLock());
  3855. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3856. {
  3857. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3858. newIndex = numUsed - 1;
  3859. ObjectClass* const value = data.elements [currentIndex];
  3860. if (newIndex > currentIndex)
  3861. {
  3862. memmove (data.elements + currentIndex,
  3863. data.elements + currentIndex + 1,
  3864. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3865. }
  3866. else
  3867. {
  3868. memmove (data.elements + newIndex + 1,
  3869. data.elements + newIndex,
  3870. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3871. }
  3872. data.elements [newIndex] = value;
  3873. }
  3874. }
  3875. }
  3876. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3877. {
  3878. const ScopedLockType lock1 (getLock());
  3879. const ScopedLockType lock2 (otherArray.getLock());
  3880. data.swapWith (otherArray.data);
  3881. swapVariables (numUsed, otherArray.numUsed);
  3882. }
  3883. bool operator== (const ReferenceCountedArray& other) const throw()
  3884. {
  3885. const ScopedLockType lock2 (other.getLock());
  3886. const ScopedLockType lock1 (getLock());
  3887. if (numUsed != other.numUsed)
  3888. return false;
  3889. for (int i = numUsed; --i >= 0;)
  3890. if (data.elements [i] != other.data.elements [i])
  3891. return false;
  3892. return true;
  3893. }
  3894. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3895. {
  3896. return ! operator== (other);
  3897. }
  3898. template <class ElementComparator>
  3899. void sort (ElementComparator& comparator,
  3900. const bool retainOrderOfEquivalentItems = false) const throw()
  3901. {
  3902. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3903. // avoids getting warning messages about the parameter being unused
  3904. const ScopedLockType lock (getLock());
  3905. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3906. }
  3907. void minimiseStorageOverheads() throw()
  3908. {
  3909. const ScopedLockType lock (getLock());
  3910. data.shrinkToNoMoreThan (numUsed);
  3911. }
  3912. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3913. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3914. juce_UseDebuggingNewOperator
  3915. private:
  3916. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3917. int numUsed;
  3918. };
  3919. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3920. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3921. #endif
  3922. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3923. #endif
  3924. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3925. #endif
  3926. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3927. /*** Start of inlined file: juce_SortedSet.h ***/
  3928. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3929. #define __JUCE_SORTEDSET_JUCEHEADER__
  3930. #if JUCE_MSVC
  3931. #pragma warning (push)
  3932. #pragma warning (disable: 4512)
  3933. #endif
  3934. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3935. class SortedSet
  3936. {
  3937. public:
  3938. SortedSet() throw()
  3939. : numUsed (0)
  3940. {
  3941. }
  3942. SortedSet (const SortedSet& other) throw()
  3943. {
  3944. const ScopedLockType lock (other.getLock());
  3945. numUsed = other.numUsed;
  3946. data.setAllocatedSize (other.numUsed);
  3947. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3948. }
  3949. ~SortedSet() throw()
  3950. {
  3951. }
  3952. SortedSet& operator= (const SortedSet& other) throw()
  3953. {
  3954. if (this != &other)
  3955. {
  3956. const ScopedLockType lock1 (other.getLock());
  3957. const ScopedLockType lock2 (getLock());
  3958. data.ensureAllocatedSize (other.size());
  3959. numUsed = other.numUsed;
  3960. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3961. minimiseStorageOverheads();
  3962. }
  3963. return *this;
  3964. }
  3965. bool operator== (const SortedSet<ElementType>& other) const throw()
  3966. {
  3967. const ScopedLockType lock (getLock());
  3968. if (numUsed != other.numUsed)
  3969. return false;
  3970. for (int i = numUsed; --i >= 0;)
  3971. if (data.elements[i] != other.data.elements[i])
  3972. return false;
  3973. return true;
  3974. }
  3975. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3976. {
  3977. return ! operator== (other);
  3978. }
  3979. void clear() throw()
  3980. {
  3981. const ScopedLockType lock (getLock());
  3982. data.setAllocatedSize (0);
  3983. numUsed = 0;
  3984. }
  3985. void clearQuick() throw()
  3986. {
  3987. const ScopedLockType lock (getLock());
  3988. numUsed = 0;
  3989. }
  3990. inline int size() const throw()
  3991. {
  3992. return numUsed;
  3993. }
  3994. inline ElementType operator[] (const int index) const throw()
  3995. {
  3996. const ScopedLockType lock (getLock());
  3997. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3998. : ElementType();
  3999. }
  4000. inline ElementType getUnchecked (const int index) const throw()
  4001. {
  4002. const ScopedLockType lock (getLock());
  4003. jassert (((unsigned int) index) < (unsigned int) numUsed);
  4004. return data.elements [index];
  4005. }
  4006. inline ElementType getFirst() const throw()
  4007. {
  4008. const ScopedLockType lock (getLock());
  4009. return numUsed > 0 ? data.elements [0] : ElementType();
  4010. }
  4011. inline ElementType getLast() const throw()
  4012. {
  4013. const ScopedLockType lock (getLock());
  4014. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  4015. }
  4016. int indexOf (const ElementType elementToLookFor) const throw()
  4017. {
  4018. const ScopedLockType lock (getLock());
  4019. int start = 0;
  4020. int end = numUsed;
  4021. for (;;)
  4022. {
  4023. if (start >= end)
  4024. {
  4025. return -1;
  4026. }
  4027. else if (elementToLookFor == data.elements [start])
  4028. {
  4029. return start;
  4030. }
  4031. else
  4032. {
  4033. const int halfway = (start + end) >> 1;
  4034. if (halfway == start)
  4035. return -1;
  4036. else if (elementToLookFor >= data.elements [halfway])
  4037. start = halfway;
  4038. else
  4039. end = halfway;
  4040. }
  4041. }
  4042. }
  4043. bool contains (const ElementType elementToLookFor) const throw()
  4044. {
  4045. const ScopedLockType lock (getLock());
  4046. int start = 0;
  4047. int end = numUsed;
  4048. for (;;)
  4049. {
  4050. if (start >= end)
  4051. {
  4052. return false;
  4053. }
  4054. else if (elementToLookFor == data.elements [start])
  4055. {
  4056. return true;
  4057. }
  4058. else
  4059. {
  4060. const int halfway = (start + end) >> 1;
  4061. if (halfway == start)
  4062. return false;
  4063. else if (elementToLookFor >= data.elements [halfway])
  4064. start = halfway;
  4065. else
  4066. end = halfway;
  4067. }
  4068. }
  4069. }
  4070. void add (const ElementType newElement) throw()
  4071. {
  4072. const ScopedLockType lock (getLock());
  4073. int start = 0;
  4074. int end = numUsed;
  4075. for (;;)
  4076. {
  4077. if (start >= end)
  4078. {
  4079. jassert (start <= end);
  4080. insertInternal (start, newElement);
  4081. break;
  4082. }
  4083. else if (newElement == data.elements [start])
  4084. {
  4085. break;
  4086. }
  4087. else
  4088. {
  4089. const int halfway = (start + end) >> 1;
  4090. if (halfway == start)
  4091. {
  4092. if (newElement >= data.elements [halfway])
  4093. insertInternal (start + 1, newElement);
  4094. else
  4095. insertInternal (start, newElement);
  4096. break;
  4097. }
  4098. else if (newElement >= data.elements [halfway])
  4099. start = halfway;
  4100. else
  4101. end = halfway;
  4102. }
  4103. }
  4104. }
  4105. void addArray (const ElementType* elementsToAdd,
  4106. int numElementsToAdd) throw()
  4107. {
  4108. const ScopedLockType lock (getLock());
  4109. while (--numElementsToAdd >= 0)
  4110. add (*elementsToAdd++);
  4111. }
  4112. template <class OtherSetType>
  4113. void addSet (const OtherSetType& setToAddFrom,
  4114. int startIndex = 0,
  4115. int numElementsToAdd = -1) throw()
  4116. {
  4117. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4118. const ScopedLockType lock2 (getLock());
  4119. jassert (this != &setToAddFrom);
  4120. if (this != &setToAddFrom)
  4121. {
  4122. if (startIndex < 0)
  4123. {
  4124. jassertfalse
  4125. startIndex = 0;
  4126. }
  4127. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4128. numElementsToAdd = setToAddFrom.size() - startIndex;
  4129. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4130. }
  4131. }
  4132. ElementType remove (const int indexToRemove) throw()
  4133. {
  4134. const ScopedLockType lock (getLock());
  4135. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4136. {
  4137. --numUsed;
  4138. ElementType* const e = data.elements + indexToRemove;
  4139. ElementType const removed = *e;
  4140. const int numberToShift = numUsed - indexToRemove;
  4141. if (numberToShift > 0)
  4142. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4143. if ((numUsed << 1) < data.numAllocated)
  4144. minimiseStorageOverheads();
  4145. return removed;
  4146. }
  4147. return 0;
  4148. }
  4149. void removeValue (const ElementType valueToRemove) throw()
  4150. {
  4151. const ScopedLockType lock (getLock());
  4152. remove (indexOf (valueToRemove));
  4153. }
  4154. template <class OtherSetType>
  4155. void removeValuesIn (const OtherSetType& otherSet) throw()
  4156. {
  4157. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4158. const ScopedLockType lock2 (getLock());
  4159. if (this == &otherSet)
  4160. {
  4161. clear();
  4162. }
  4163. else
  4164. {
  4165. if (otherSet.size() > 0)
  4166. {
  4167. for (int i = numUsed; --i >= 0;)
  4168. if (otherSet.contains (data.elements [i]))
  4169. remove (i);
  4170. }
  4171. }
  4172. }
  4173. template <class OtherSetType>
  4174. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4175. {
  4176. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4177. const ScopedLockType lock2 (getLock());
  4178. if (this != &otherSet)
  4179. {
  4180. if (otherSet.size() <= 0)
  4181. {
  4182. clear();
  4183. }
  4184. else
  4185. {
  4186. for (int i = numUsed; --i >= 0;)
  4187. if (! otherSet.contains (data.elements [i]))
  4188. remove (i);
  4189. }
  4190. }
  4191. }
  4192. void minimiseStorageOverheads() throw()
  4193. {
  4194. const ScopedLockType lock (getLock());
  4195. data.shrinkToNoMoreThan (numUsed);
  4196. }
  4197. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4198. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4199. juce_UseDebuggingNewOperator
  4200. private:
  4201. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4202. int numUsed;
  4203. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4204. {
  4205. data.ensureAllocatedSize (numUsed + 1);
  4206. ElementType* const insertPos = data.elements + indexToInsertAt;
  4207. const int numberToMove = numUsed - indexToInsertAt;
  4208. if (numberToMove > 0)
  4209. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4210. *insertPos = newElement;
  4211. ++numUsed;
  4212. }
  4213. };
  4214. #if JUCE_MSVC
  4215. #pragma warning (pop)
  4216. #endif
  4217. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4218. /*** End of inlined file: juce_SortedSet.h ***/
  4219. #endif
  4220. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4221. /*** Start of inlined file: juce_SparseSet.h ***/
  4222. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4223. #define __JUCE_SPARSESET_JUCEHEADER__
  4224. template <class Type>
  4225. class SparseSet
  4226. {
  4227. public:
  4228. SparseSet()
  4229. {
  4230. }
  4231. SparseSet (const SparseSet<Type>& other)
  4232. : values (other.values)
  4233. {
  4234. }
  4235. ~SparseSet()
  4236. {
  4237. }
  4238. void clear()
  4239. {
  4240. values.clear();
  4241. }
  4242. bool isEmpty() const throw()
  4243. {
  4244. return values.size() == 0;
  4245. }
  4246. Type size() const
  4247. {
  4248. Type total (0);
  4249. for (int i = 0; i < values.size(); i += 2)
  4250. total += values.getUnchecked (i + 1) - values.getUnchecked (i);
  4251. return total;
  4252. }
  4253. Type operator[] (Type index) const
  4254. {
  4255. for (int i = 0; i < values.size(); i += 2)
  4256. {
  4257. const Type start (values.getUnchecked (i));
  4258. const Type len (values.getUnchecked (i + 1) - start);
  4259. if (index < len)
  4260. return start + index;
  4261. index -= len;
  4262. }
  4263. return Type (0);
  4264. }
  4265. bool contains (const Type valueToLookFor) const
  4266. {
  4267. for (int i = 0; i < values.size(); ++i)
  4268. if (valueToLookFor < values.getUnchecked(i))
  4269. return (i & 1) != 0;
  4270. return false;
  4271. }
  4272. int getNumRanges() const throw()
  4273. {
  4274. return values.size() >> 1;
  4275. }
  4276. const Range<Type> getRange (const int rangeIndex) const
  4277. {
  4278. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4279. return Range<Type> (values.getUnchecked (rangeIndex << 1),
  4280. values.getUnchecked ((rangeIndex << 1) + 1));
  4281. else
  4282. return Range<Type>();
  4283. }
  4284. const Range<Type> getTotalRange() const
  4285. {
  4286. if (values.size() > 0)
  4287. {
  4288. jassert ((values.size() & 1) == 0);
  4289. return Range<Type> (values.getUnchecked (0),
  4290. values.getUnchecked (values.size() - 1));
  4291. }
  4292. return Range<Type>();
  4293. }
  4294. void addRange (const Range<Type>& range)
  4295. {
  4296. jassert (range.getLength() >= 0);
  4297. if (range.getLength() > 0)
  4298. {
  4299. removeRange (range);
  4300. values.addUsingDefaultSort (range.getStart());
  4301. values.addUsingDefaultSort (range.getEnd());
  4302. simplify();
  4303. }
  4304. }
  4305. void removeRange (const Range<Type>& rangeToRemove)
  4306. {
  4307. jassert (rangeToRemove.getLength() >= 0);
  4308. if (rangeToRemove.getLength() > 0
  4309. && values.size() > 0
  4310. && rangeToRemove.getStart() < values.getUnchecked (values.size() - 1)
  4311. && values.getUnchecked(0) < rangeToRemove.getEnd())
  4312. {
  4313. const bool onAtStart = contains (rangeToRemove.getStart() - 1);
  4314. const Type lastValue (jmin (rangeToRemove.getEnd(), values.getLast()));
  4315. const bool onAtEnd = contains (lastValue);
  4316. for (int i = values.size(); --i >= 0;)
  4317. {
  4318. if (values.getUnchecked(i) <= lastValue)
  4319. {
  4320. while (values.getUnchecked(i) >= rangeToRemove.getStart())
  4321. {
  4322. values.remove (i);
  4323. if (--i < 0)
  4324. break;
  4325. }
  4326. break;
  4327. }
  4328. }
  4329. if (onAtStart) values.addUsingDefaultSort (rangeToRemove.getStart());
  4330. if (onAtEnd) values.addUsingDefaultSort (lastValue);
  4331. simplify();
  4332. }
  4333. }
  4334. void invertRange (const Range<Type>& range)
  4335. {
  4336. SparseSet newItems;
  4337. newItems.addRange (range);
  4338. int i;
  4339. for (i = getNumRanges(); --i >= 0;)
  4340. newItems.removeRange (getRange (i));
  4341. removeRange (range);
  4342. for (i = newItems.getNumRanges(); --i >= 0;)
  4343. addRange (newItems.getRange(i));
  4344. }
  4345. bool overlapsRange (const Range<Type>& range)
  4346. {
  4347. if (range.getLength() > 0)
  4348. {
  4349. for (int i = getNumRanges(); --i >= 0;)
  4350. {
  4351. if (values.getUnchecked ((i << 1) + 1) <= range.getStart())
  4352. return false;
  4353. if (values.getUnchecked (i << 1) < range.getEnd())
  4354. return true;
  4355. }
  4356. }
  4357. return false;
  4358. }
  4359. bool containsRange (const Range<Type>& range)
  4360. {
  4361. if (range.getLength() > 0)
  4362. {
  4363. for (int i = getNumRanges(); --i >= 0;)
  4364. {
  4365. if (values.getUnchecked ((i << 1) + 1) <= range.getStart())
  4366. return false;
  4367. if (values.getUnchecked (i << 1) <= range.getStart()
  4368. && range.getEnd() <= values.getUnchecked ((i << 1) + 1))
  4369. return true;
  4370. }
  4371. }
  4372. return false;
  4373. }
  4374. bool operator== (const SparseSet<Type>& other) throw()
  4375. {
  4376. return values == other.values;
  4377. }
  4378. bool operator!= (const SparseSet<Type>& other) throw()
  4379. {
  4380. return values != other.values;
  4381. }
  4382. juce_UseDebuggingNewOperator
  4383. private:
  4384. // alternating start/end values of ranges of values that are present.
  4385. Array<Type, DummyCriticalSection> values;
  4386. void simplify()
  4387. {
  4388. jassert ((values.size() & 1) == 0);
  4389. for (int i = values.size(); --i > 0;)
  4390. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4391. values.removeRange (--i, 2);
  4392. }
  4393. };
  4394. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4395. /*** End of inlined file: juce_SparseSet.h ***/
  4396. #endif
  4397. #ifndef __JUCE_VALUE_JUCEHEADER__
  4398. /*** Start of inlined file: juce_Value.h ***/
  4399. #ifndef __JUCE_VALUE_JUCEHEADER__
  4400. #define __JUCE_VALUE_JUCEHEADER__
  4401. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4402. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4403. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4404. /*** Start of inlined file: juce_MessageListener.h ***/
  4405. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4406. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4407. /*** Start of inlined file: juce_Message.h ***/
  4408. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4409. #define __JUCE_MESSAGE_JUCEHEADER__
  4410. class MessageListener;
  4411. class MessageManager;
  4412. class JUCE_API Message
  4413. {
  4414. public:
  4415. Message() throw();
  4416. Message (int intParameter1,
  4417. int intParameter2,
  4418. int intParameter3,
  4419. void* pointerParameter) throw();
  4420. virtual ~Message() throw();
  4421. // These values can be used for carrying simple data that the application needs to
  4422. // pass around. For more complex messages, just create a subclass.
  4423. int intParameter1; /**< user-defined integer value. */
  4424. int intParameter2; /**< user-defined integer value. */
  4425. int intParameter3; /**< user-defined integer value. */
  4426. void* pointerParameter; /**< user-defined pointer value. */
  4427. juce_UseDebuggingNewOperator
  4428. private:
  4429. friend class MessageListener;
  4430. friend class MessageManager;
  4431. MessageListener* messageRecipient;
  4432. Message (const Message&);
  4433. Message& operator= (const Message&);
  4434. };
  4435. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4436. /*** End of inlined file: juce_Message.h ***/
  4437. class JUCE_API MessageListener
  4438. {
  4439. protected:
  4440. MessageListener() throw();
  4441. public:
  4442. virtual ~MessageListener();
  4443. virtual void handleMessage (const Message& message) = 0;
  4444. void postMessage (Message* message) const throw();
  4445. bool isValidMessageListener() const throw();
  4446. };
  4447. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4448. /*** End of inlined file: juce_MessageListener.h ***/
  4449. class JUCE_API AsyncUpdater
  4450. {
  4451. public:
  4452. AsyncUpdater() throw();
  4453. virtual ~AsyncUpdater();
  4454. void triggerAsyncUpdate() throw();
  4455. void cancelPendingUpdate() throw();
  4456. void handleUpdateNowIfNeeded();
  4457. virtual void handleAsyncUpdate() = 0;
  4458. private:
  4459. class AsyncUpdaterInternal : public MessageListener
  4460. {
  4461. public:
  4462. AsyncUpdaterInternal() throw() {}
  4463. ~AsyncUpdaterInternal() {}
  4464. void handleMessage (const Message&);
  4465. AsyncUpdater* owner;
  4466. private:
  4467. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4468. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4469. };
  4470. AsyncUpdaterInternal internalAsyncHandler;
  4471. bool asyncMessagePending;
  4472. };
  4473. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4474. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4475. /*** Start of inlined file: juce_ListenerList.h ***/
  4476. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4477. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4478. template <class ListenerClass,
  4479. class ArrayType = Array <ListenerClass*> >
  4480. class ListenerList
  4481. {
  4482. // Horrible macros required to support VC6/7..
  4483. #if defined (_MSC_VER) && _MSC_VER <= 1400
  4484. #define LL_TEMPLATE(a) typename P##a, typename Q##a
  4485. #define LL_PARAM(a) Q##a& param##a
  4486. #else
  4487. #define LL_TEMPLATE(a) typename P##a
  4488. #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a
  4489. #endif
  4490. public:
  4491. ListenerList()
  4492. {
  4493. }
  4494. ~ListenerList()
  4495. {
  4496. }
  4497. void add (ListenerClass* const listenerToAdd)
  4498. {
  4499. // Listeners can't be null pointers!
  4500. jassert (listenerToAdd != 0);
  4501. if (listenerToAdd != 0)
  4502. listeners.addIfNotAlreadyThere (listenerToAdd);
  4503. }
  4504. void remove (ListenerClass* const listenerToRemove)
  4505. {
  4506. // Listeners can't be null pointers!
  4507. jassert (listenerToRemove != 0);
  4508. listeners.removeValue (listenerToRemove);
  4509. }
  4510. int size() const throw()
  4511. {
  4512. return listeners.size();
  4513. }
  4514. bool isEmpty() const throw()
  4515. {
  4516. return listeners.size() == 0;
  4517. }
  4518. bool contains (ListenerClass* const listener) const throw()
  4519. {
  4520. return listeners.contains (listener);
  4521. }
  4522. void call (void (ListenerClass::*callbackFunction) ())
  4523. {
  4524. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4525. }
  4526. template <class BailOutCheckerType>
  4527. void callChecked (const BailOutCheckerType& bailOutChecker,
  4528. void (ListenerClass::*callbackFunction) ())
  4529. {
  4530. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4531. (iter.getListener()->*callbackFunction) ();
  4532. }
  4533. template <LL_TEMPLATE(1)>
  4534. void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
  4535. {
  4536. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4537. (iter.getListener()->*callbackFunction) (param1);
  4538. }
  4539. template <class BailOutCheckerType, LL_TEMPLATE(1)>
  4540. void callChecked (const BailOutCheckerType& bailOutChecker,
  4541. void (ListenerClass::*callbackFunction) (P1),
  4542. LL_PARAM(1))
  4543. {
  4544. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4545. (iter.getListener()->*callbackFunction) (param1);
  4546. }
  4547. template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4548. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4549. LL_PARAM(1), LL_PARAM(2))
  4550. {
  4551. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4552. (iter.getListener()->*callbackFunction) (param1, param2);
  4553. }
  4554. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4555. void callChecked (const BailOutCheckerType& bailOutChecker,
  4556. void (ListenerClass::*callbackFunction) (P1, P2),
  4557. LL_PARAM(1), LL_PARAM(2))
  4558. {
  4559. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4560. (iter.getListener()->*callbackFunction) (param1, param2);
  4561. }
  4562. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4563. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4564. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4565. {
  4566. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4567. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4568. }
  4569. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4570. void callChecked (const BailOutCheckerType& bailOutChecker,
  4571. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4572. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4573. {
  4574. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4575. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4576. }
  4577. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4578. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4579. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4580. {
  4581. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4582. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4583. }
  4584. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4585. void callChecked (const BailOutCheckerType& bailOutChecker,
  4586. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4587. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4588. {
  4589. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4590. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4591. }
  4592. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4593. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4594. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4595. {
  4596. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4597. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4598. }
  4599. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4600. void callChecked (const BailOutCheckerType& bailOutChecker,
  4601. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4602. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4603. {
  4604. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4605. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4606. }
  4607. class DummyBailOutChecker
  4608. {
  4609. public:
  4610. inline bool shouldBailOut() const throw() { return false; }
  4611. };
  4612. template <class BailOutCheckerType, class ListType>
  4613. class Iterator
  4614. {
  4615. public:
  4616. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4617. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4618. {}
  4619. ~Iterator() {}
  4620. bool next()
  4621. {
  4622. if (index <= 0 || bailOutChecker.shouldBailOut())
  4623. return false;
  4624. const int listSize = list.size();
  4625. if (--index < listSize)
  4626. return true;
  4627. index = listSize - 1;
  4628. return index >= 0;
  4629. }
  4630. typename ListType::ListenerType* getListener() const throw()
  4631. {
  4632. return list.getListeners().getUnchecked (index);
  4633. }
  4634. private:
  4635. const ListType& list;
  4636. const BailOutCheckerType& bailOutChecker;
  4637. int index;
  4638. Iterator (const Iterator&);
  4639. Iterator& operator= (const Iterator&);
  4640. };
  4641. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4642. typedef ListenerClass ListenerType;
  4643. const ArrayType& getListeners() const throw() { return listeners; }
  4644. private:
  4645. ArrayType listeners;
  4646. ListenerList (const ListenerList&);
  4647. ListenerList& operator= (const ListenerList&);
  4648. #undef LL_TEMPLATE
  4649. #undef LL_PARAM
  4650. };
  4651. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4652. /*** End of inlined file: juce_ListenerList.h ***/
  4653. class JUCE_API Value
  4654. {
  4655. public:
  4656. Value();
  4657. Value (const Value& other);
  4658. Value (const var& initialValue);
  4659. ~Value();
  4660. const var getValue() const;
  4661. operator const var() const;
  4662. const String toString() const;
  4663. void setValue (const var& newValue);
  4664. Value& operator= (const var& newValue);
  4665. void referTo (const Value& valueToReferTo);
  4666. bool refersToSameSourceAs (const Value& other) const;
  4667. bool operator== (const Value& other) const;
  4668. bool operator!= (const Value& other) const;
  4669. class JUCE_API Listener
  4670. {
  4671. public:
  4672. Listener() {}
  4673. virtual ~Listener() {}
  4674. virtual void valueChanged (Value& value) = 0;
  4675. };
  4676. void addListener (Listener* const listener);
  4677. void removeListener (Listener* const listener);
  4678. class JUCE_API ValueSource : public ReferenceCountedObject,
  4679. public AsyncUpdater
  4680. {
  4681. public:
  4682. ValueSource();
  4683. virtual ~ValueSource();
  4684. virtual const var getValue() const = 0;
  4685. virtual void setValue (const var& newValue) = 0;
  4686. void sendChangeMessage (const bool dispatchSynchronously);
  4687. juce_UseDebuggingNewOperator
  4688. protected:
  4689. friend class Value;
  4690. SortedSet <Value*> valuesWithListeners;
  4691. void handleAsyncUpdate();
  4692. ValueSource (const ValueSource&);
  4693. ValueSource& operator= (const ValueSource&);
  4694. };
  4695. explicit Value (ValueSource* const valueSource);
  4696. ValueSource& getValueSource() { return *value; }
  4697. juce_UseDebuggingNewOperator
  4698. private:
  4699. friend class ValueSource;
  4700. ReferenceCountedObjectPtr <ValueSource> value;
  4701. ListenerList <Listener> listeners;
  4702. void callListeners();
  4703. // This is disallowed to avoid confusion about whether it should
  4704. // do a by-value or by-reference copy.
  4705. Value& operator= (const Value& other);
  4706. };
  4707. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4708. #endif // __JUCE_VALUE_JUCEHEADER__
  4709. /*** End of inlined file: juce_Value.h ***/
  4710. #endif
  4711. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4712. /*** Start of inlined file: juce_ValueTree.h ***/
  4713. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4714. #define __JUCE_VALUETREE_JUCEHEADER__
  4715. /*** Start of inlined file: juce_UndoManager.h ***/
  4716. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4717. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4718. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4719. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4720. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4721. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4722. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4723. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4724. /*** Start of inlined file: juce_ChangeListener.h ***/
  4725. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4726. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4727. class JUCE_API ChangeListener
  4728. {
  4729. public:
  4730. virtual ~ChangeListener() {}
  4731. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4732. };
  4733. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4734. /*** End of inlined file: juce_ChangeListener.h ***/
  4735. /*** Start of inlined file: juce_ScopedLock.h ***/
  4736. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4737. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4738. class JUCE_API ScopedLock
  4739. {
  4740. public:
  4741. inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4742. inline ~ScopedLock() throw() { lock_.exit(); }
  4743. private:
  4744. const CriticalSection& lock_;
  4745. ScopedLock (const ScopedLock&);
  4746. ScopedLock& operator= (const ScopedLock&);
  4747. };
  4748. class ScopedUnlock
  4749. {
  4750. public:
  4751. inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4752. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4753. private:
  4754. const CriticalSection& lock_;
  4755. ScopedUnlock (const ScopedLock&);
  4756. ScopedUnlock& operator= (const ScopedUnlock&);
  4757. };
  4758. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4759. /*** End of inlined file: juce_ScopedLock.h ***/
  4760. class JUCE_API ChangeListenerList : public MessageListener
  4761. {
  4762. public:
  4763. ChangeListenerList() throw();
  4764. ~ChangeListenerList() throw();
  4765. void addChangeListener (ChangeListener* listener) throw();
  4766. void removeChangeListener (ChangeListener* listener) throw();
  4767. void removeAllChangeListeners() throw();
  4768. void sendChangeMessage (void* objectThatHasChanged) throw();
  4769. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4770. void dispatchPendingMessages();
  4771. void handleMessage (const Message&);
  4772. juce_UseDebuggingNewOperator
  4773. private:
  4774. SortedSet <void*> listeners;
  4775. CriticalSection lock;
  4776. void* lastChangedObject;
  4777. bool messagePending;
  4778. ChangeListenerList (const ChangeListenerList&);
  4779. ChangeListenerList& operator= (const ChangeListenerList&);
  4780. };
  4781. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4782. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4783. class JUCE_API ChangeBroadcaster
  4784. {
  4785. public:
  4786. ChangeBroadcaster() throw();
  4787. virtual ~ChangeBroadcaster();
  4788. void addChangeListener (ChangeListener* listener) throw();
  4789. void removeChangeListener (ChangeListener* listener) throw();
  4790. void removeAllChangeListeners() throw();
  4791. void sendChangeMessage (void* objectThatHasChanged) throw();
  4792. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4793. void dispatchPendingMessages();
  4794. private:
  4795. ChangeListenerList changeListenerList;
  4796. ChangeBroadcaster (const ChangeBroadcaster&);
  4797. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4798. };
  4799. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4800. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4801. /*** Start of inlined file: juce_UndoableAction.h ***/
  4802. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4803. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4804. class JUCE_API UndoableAction
  4805. {
  4806. protected:
  4807. UndoableAction() throw() {}
  4808. public:
  4809. virtual ~UndoableAction() {}
  4810. virtual bool perform() = 0;
  4811. virtual bool undo() = 0;
  4812. virtual int getSizeInUnits() { return 10; }
  4813. };
  4814. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4815. /*** End of inlined file: juce_UndoableAction.h ***/
  4816. class JUCE_API UndoManager : public ChangeBroadcaster
  4817. {
  4818. public:
  4819. UndoManager (int maxNumberOfUnitsToKeep = 30000,
  4820. int minimumTransactionsToKeep = 30);
  4821. ~UndoManager();
  4822. void clearUndoHistory();
  4823. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4824. void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
  4825. int minimumTransactionsToKeep);
  4826. bool perform (UndoableAction* action,
  4827. const String& actionName = String::empty);
  4828. void beginNewTransaction (const String& actionName = String::empty);
  4829. void setCurrentTransactionName (const String& newName);
  4830. bool canUndo() const;
  4831. const String getUndoDescription() const;
  4832. bool undo();
  4833. bool undoCurrentTransactionOnly();
  4834. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4835. int getNumActionsInCurrentTransaction() const;
  4836. bool canRedo() const;
  4837. const String getRedoDescription() const;
  4838. bool redo();
  4839. juce_UseDebuggingNewOperator
  4840. private:
  4841. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4842. StringArray transactionNames;
  4843. String currentTransactionName;
  4844. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4845. bool newTransaction, reentrancyCheck;
  4846. // disallow copy constructor
  4847. UndoManager (const UndoManager&);
  4848. UndoManager& operator= (const UndoManager&);
  4849. };
  4850. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4851. /*** End of inlined file: juce_UndoManager.h ***/
  4852. class JUCE_API ValueTree
  4853. {
  4854. public:
  4855. ValueTree() throw();
  4856. explicit ValueTree (const String& type);
  4857. ValueTree (const ValueTree& other);
  4858. ValueTree& operator= (const ValueTree& other);
  4859. ~ValueTree();
  4860. bool operator== (const ValueTree& other) const;
  4861. bool operator!= (const ValueTree& other) const;
  4862. bool isValid() const { return object != 0; }
  4863. ValueTree createCopy() const;
  4864. const String getType() const;
  4865. bool hasType (const String& typeName) const;
  4866. const var& getProperty (const var::identifier& name) const;
  4867. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  4868. const var& operator[] (const var::identifier& name) const;
  4869. void setProperty (const var::identifier& name, const var& newValue, UndoManager* undoManager);
  4870. bool hasProperty (const var::identifier& name) const;
  4871. void removeProperty (const var::identifier& name, UndoManager* undoManager);
  4872. void removeAllProperties (UndoManager* undoManager);
  4873. int getNumProperties() const;
  4874. const var::identifier getPropertyName (int index) const;
  4875. Value getPropertyAsValue (const var::identifier& name, UndoManager* undoManager) const;
  4876. int getNumChildren() const;
  4877. ValueTree getChild (int index) const;
  4878. ValueTree getChildWithName (const String& type) const;
  4879. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4880. void addChild (ValueTree child, int index, UndoManager* undoManager);
  4881. void removeChild (const ValueTree& child, UndoManager* undoManager);
  4882. void removeChild (int childIndex, UndoManager* undoManager);
  4883. void removeAllChildren (UndoManager* undoManager);
  4884. void moveChild (int currentIndex, int newIndex, UndoManager* undoManager);
  4885. bool isAChildOf (const ValueTree& possibleParent) const;
  4886. int indexOf (const ValueTree& child) const;
  4887. ValueTree getParent() const;
  4888. XmlElement* createXml() const;
  4889. static ValueTree fromXml (const XmlElement& xml);
  4890. void writeToStream (OutputStream& output);
  4891. static ValueTree readFromStream (InputStream& input);
  4892. class JUCE_API Listener
  4893. {
  4894. public:
  4895. virtual ~Listener() {}
  4896. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4897. const var::identifier& property) = 0;
  4898. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4899. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4900. };
  4901. void addListener (Listener* listener);
  4902. void removeListener (Listener* listener);
  4903. template <typename ElementComparator>
  4904. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4905. {
  4906. if (object != 0)
  4907. {
  4908. ComparatorAdapter <ElementComparator> adapter (comparator);
  4909. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4910. object->sendChildChangeMessage();
  4911. }
  4912. }
  4913. static const ValueTree invalid;
  4914. juce_UseDebuggingNewOperator
  4915. private:
  4916. class SetPropertyAction;
  4917. friend class SetPropertyAction;
  4918. class AddOrRemoveChildAction;
  4919. friend class AddOrRemoveChildAction;
  4920. class MoveChildAction;
  4921. friend class MoveChildAction;
  4922. class JUCE_API SharedObject : public ReferenceCountedObject
  4923. {
  4924. public:
  4925. explicit SharedObject (const String& type);
  4926. SharedObject (const SharedObject& other);
  4927. ~SharedObject();
  4928. const String type;
  4929. NamedValueSet properties;
  4930. ReferenceCountedArray <SharedObject> children;
  4931. SortedSet <ValueTree*> valueTreesWithListeners;
  4932. SharedObject* parent;
  4933. void sendPropertyChangeMessage (const var::identifier& property);
  4934. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4935. void sendChildChangeMessage();
  4936. void sendChildChangeMessage (ValueTree& tree);
  4937. void sendParentChangeMessage();
  4938. const var& getProperty (const var::identifier& name) const;
  4939. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  4940. void setProperty (const var::identifier& name, const var& newValue, UndoManager*);
  4941. bool hasProperty (const var::identifier& name) const;
  4942. void removeProperty (const var::identifier& name, UndoManager*);
  4943. void removeAllProperties (UndoManager*);
  4944. bool isAChildOf (const SharedObject* possibleParent) const;
  4945. int indexOf (const ValueTree& child) const;
  4946. ValueTree getChildWithName (const String& type) const;
  4947. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4948. void addChild (SharedObject* child, int index, UndoManager*);
  4949. void removeChild (int childIndex, UndoManager*);
  4950. void removeAllChildren (UndoManager*);
  4951. void moveChild (int currentIndex, int newIndex, UndoManager*);
  4952. XmlElement* createXml() const;
  4953. juce_UseDebuggingNewOperator
  4954. private:
  4955. SharedObject& operator= (const SharedObject&);
  4956. };
  4957. template <typename ElementComparator>
  4958. class ComparatorAdapter
  4959. {
  4960. public:
  4961. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4962. int compareElements (SharedObject* const first, SharedObject* const second)
  4963. {
  4964. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4965. }
  4966. private:
  4967. ElementComparator& comparator;
  4968. ComparatorAdapter (const ComparatorAdapter&);
  4969. ComparatorAdapter& operator= (const ComparatorAdapter&);
  4970. };
  4971. friend class SharedObject;
  4972. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4973. SharedObjectPtr object;
  4974. ListenerList <Listener> listeners;
  4975. public:
  4976. explicit ValueTree (SharedObject*); // (can be made private when VC6 support is finally dropped)
  4977. };
  4978. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4979. /*** End of inlined file: juce_ValueTree.h ***/
  4980. #endif
  4981. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4982. #endif
  4983. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4984. /*** Start of inlined file: juce_VoidArray.h ***/
  4985. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4986. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4987. typedef Array <void*> VoidArray;
  4988. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4989. /*** End of inlined file: juce_VoidArray.h ***/
  4990. #endif
  4991. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4992. #endif
  4993. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4994. #endif
  4995. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4996. /*** Start of inlined file: juce_FileLogger.h ***/
  4997. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4998. #define __JUCE_FILELOGGER_JUCEHEADER__
  4999. class JUCE_API FileLogger : public Logger
  5000. {
  5001. public:
  5002. FileLogger (const File& fileToWriteTo,
  5003. const String& welcomeMessage,
  5004. const int maxInitialFileSizeBytes = 128 * 1024);
  5005. ~FileLogger();
  5006. void logMessage (const String& message);
  5007. const File getLogFile() const { return logFile; }
  5008. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  5009. const String& logFileName,
  5010. const String& welcomeMessage,
  5011. const int maxInitialFileSizeBytes = 128 * 1024);
  5012. juce_UseDebuggingNewOperator
  5013. private:
  5014. File logFile;
  5015. CriticalSection logLock;
  5016. ScopedPointer <FileOutputStream> logStream;
  5017. void trimFileSize (int maxFileSizeBytes) const;
  5018. FileLogger (const FileLogger&);
  5019. FileLogger& operator= (const FileLogger&);
  5020. };
  5021. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  5022. /*** End of inlined file: juce_FileLogger.h ***/
  5023. #endif
  5024. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5025. /*** Start of inlined file: juce_Initialisation.h ***/
  5026. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5027. #define __JUCE_INITIALISATION_JUCEHEADER__
  5028. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  5029. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  5030. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  5031. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  5032. class ScopedJuceInitialiser_NonGUI
  5033. {
  5034. public:
  5035. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  5036. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  5037. };
  5038. class ScopedJuceInitialiser_GUI
  5039. {
  5040. public:
  5041. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  5042. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  5043. };
  5044. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  5045. /*** End of inlined file: juce_Initialisation.h ***/
  5046. #endif
  5047. #ifndef __JUCE_LOGGER_JUCEHEADER__
  5048. #endif
  5049. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  5050. #endif
  5051. #ifndef __JUCE_MEMORY_JUCEHEADER__
  5052. #endif
  5053. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5054. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  5055. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5056. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5057. class JUCE_API PerformanceCounter
  5058. {
  5059. public:
  5060. PerformanceCounter (const String& counterName,
  5061. int runsPerPrintout = 100,
  5062. const File& loggingFile = File::nonexistent);
  5063. ~PerformanceCounter();
  5064. void start();
  5065. void stop();
  5066. void printStatistics();
  5067. juce_UseDebuggingNewOperator
  5068. private:
  5069. String name;
  5070. int numRuns, runsPerPrint;
  5071. double totalTime;
  5072. int64 started;
  5073. File outputFile;
  5074. };
  5075. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5076. /*** End of inlined file: juce_PerformanceCounter.h ***/
  5077. #endif
  5078. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  5079. #endif
  5080. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5081. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  5082. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5083. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5084. class JUCE_API PlatformUtilities
  5085. {
  5086. public:
  5087. static void beep();
  5088. static bool openDocument (const String& documentURL, const String& parameters);
  5089. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  5090. const String& emailSubject,
  5091. const String& bodyText,
  5092. const StringArray& filesToAttach);
  5093. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  5094. static const String cfStringToJuceString (CFStringRef cfString);
  5095. static CFStringRef juceStringToCFString (const String& s);
  5096. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5097. static const String makePathFromFSRef (FSRef* file);
  5098. static const String convertToPrecomposedUnicode (const String& s);
  5099. static OSType getTypeOfFile (const String& filename);
  5100. static bool isBundle (const String& filename);
  5101. static void addItemToDock (const File& file);
  5102. static int getOSXMinorVersionNumber();
  5103. #endif
  5104. #if JUCE_WINDOWS || DOXYGEN
  5105. // Some registry helper functions:
  5106. static const String getRegistryValue (const String& regValuePath,
  5107. const String& defaultValue = String::empty);
  5108. static void setRegistryValue (const String& regValuePath,
  5109. const String& value);
  5110. static bool registryValueExists (const String& regValuePath);
  5111. static void deleteRegistryValue (const String& regValuePath);
  5112. static void deleteRegistryKey (const String& regKeyPath);
  5113. static void registerFileAssociation (const String& fileExtension,
  5114. const String& symbolicDescription,
  5115. const String& fullDescription,
  5116. const File& targetExecutable,
  5117. int iconResourceNumber);
  5118. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5119. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5120. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5121. #endif
  5122. static void fpuReset();
  5123. #if JUCE_LINUX || JUCE_WINDOWS
  5124. static void* loadDynamicLibrary (const String& pathOrFilename);
  5125. static void freeDynamicLibrary (void* libraryHandle);
  5126. static void* getProcedureEntryPoint (void* libraryHandle,
  5127. const String& procedureName);
  5128. #endif
  5129. #if JUCE_LINUX || DOXYGEN
  5130. #endif
  5131. private:
  5132. PlatformUtilities();
  5133. PlatformUtilities (const PlatformUtilities&);
  5134. PlatformUtilities& operator= (const PlatformUtilities&);
  5135. };
  5136. #if JUCE_MAC || JUCE_IPHONE
  5137. class ScopedAutoReleasePool
  5138. {
  5139. public:
  5140. ScopedAutoReleasePool();
  5141. ~ScopedAutoReleasePool();
  5142. private:
  5143. void* pool;
  5144. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5145. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5146. };
  5147. #endif
  5148. #if JUCE_LINUX
  5149. class ScopedXLock
  5150. {
  5151. public:
  5152. ScopedXLock();
  5153. ~ScopedXLock();
  5154. };
  5155. #endif
  5156. #if JUCE_MAC
  5157. class JUCE_API AppleRemoteDevice
  5158. {
  5159. public:
  5160. AppleRemoteDevice();
  5161. virtual ~AppleRemoteDevice();
  5162. enum ButtonType
  5163. {
  5164. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5165. playButton, /**< The play button. */
  5166. plusButton, /**< The plus or volume-up button. */
  5167. minusButton, /**< The minus or volume-down button. */
  5168. rightButton, /**< The right button (if it's held for a short time). */
  5169. leftButton, /**< The left button (if it's held for a short time). */
  5170. rightButton_Long, /**< The right button (if it's held for a long time). */
  5171. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5172. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5173. playButtonSleepMode,
  5174. switched
  5175. };
  5176. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5177. bool start (const bool inExclusiveMode);
  5178. void stop();
  5179. bool isActive() const;
  5180. int getRemoteId() const { return remoteId; }
  5181. juce_UseDebuggingNewOperator
  5182. void handleCallbackInternal();
  5183. private:
  5184. void* device;
  5185. void* queue;
  5186. int remoteId;
  5187. bool open (const bool openInExclusiveMode);
  5188. AppleRemoteDevice (const AppleRemoteDevice&);
  5189. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5190. };
  5191. #endif
  5192. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5193. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5194. #endif
  5195. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5196. /*** Start of inlined file: juce_Random.h ***/
  5197. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5198. #define __JUCE_RANDOM_JUCEHEADER__
  5199. class JUCE_API Random
  5200. {
  5201. public:
  5202. explicit Random (int64 seedValue) throw();
  5203. ~Random() throw();
  5204. int nextInt() throw();
  5205. int nextInt (int maxValue) throw();
  5206. int64 nextInt64() throw();
  5207. float nextFloat() throw();
  5208. double nextDouble() throw();
  5209. bool nextBool() throw();
  5210. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5211. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5212. static Random& getSystemRandom() throw();
  5213. void setSeed (int64 newSeed) throw();
  5214. void combineSeed (int64 seedValue) throw();
  5215. void setSeedRandomly();
  5216. juce_UseDebuggingNewOperator
  5217. private:
  5218. int64 seed;
  5219. };
  5220. #endif // __JUCE_RANDOM_JUCEHEADER__
  5221. /*** End of inlined file: juce_Random.h ***/
  5222. #endif
  5223. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5224. #endif
  5225. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5226. /*** Start of inlined file: juce_Singleton.h ***/
  5227. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5228. #define __JUCE_SINGLETON_JUCEHEADER__
  5229. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5230. \
  5231. static classname* _singletonInstance; \
  5232. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5233. \
  5234. static classname* getInstance() \
  5235. { \
  5236. if (_singletonInstance == 0) \
  5237. {\
  5238. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5239. \
  5240. if (_singletonInstance == 0) \
  5241. { \
  5242. static bool alreadyInside = false; \
  5243. static bool createdOnceAlready = false; \
  5244. \
  5245. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5246. jassert (! problem); \
  5247. if (! problem) \
  5248. { \
  5249. createdOnceAlready = true; \
  5250. alreadyInside = true; \
  5251. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5252. alreadyInside = false; \
  5253. \
  5254. _singletonInstance = newObject; \
  5255. } \
  5256. } \
  5257. } \
  5258. \
  5259. return _singletonInstance; \
  5260. } \
  5261. \
  5262. static inline classname* getInstanceWithoutCreating() throw() \
  5263. { \
  5264. return _singletonInstance; \
  5265. } \
  5266. \
  5267. static void deleteInstance() \
  5268. { \
  5269. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5270. if (_singletonInstance != 0) \
  5271. { \
  5272. classname* const old = _singletonInstance; \
  5273. _singletonInstance = 0; \
  5274. delete old; \
  5275. } \
  5276. } \
  5277. \
  5278. void clearSingletonInstance() throw() \
  5279. { \
  5280. if (_singletonInstance == this) \
  5281. _singletonInstance = 0; \
  5282. }
  5283. #define juce_ImplementSingleton(classname) \
  5284. \
  5285. classname* classname::_singletonInstance = 0; \
  5286. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5287. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5288. \
  5289. static classname* _singletonInstance; \
  5290. \
  5291. static classname* getInstance() \
  5292. { \
  5293. if (_singletonInstance == 0) \
  5294. { \
  5295. static bool alreadyInside = false; \
  5296. static bool createdOnceAlready = false; \
  5297. \
  5298. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5299. jassert (! problem); \
  5300. if (! problem) \
  5301. { \
  5302. createdOnceAlready = true; \
  5303. alreadyInside = true; \
  5304. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5305. alreadyInside = false; \
  5306. \
  5307. _singletonInstance = newObject; \
  5308. } \
  5309. } \
  5310. \
  5311. return _singletonInstance; \
  5312. } \
  5313. \
  5314. static inline classname* getInstanceWithoutCreating() throw() \
  5315. { \
  5316. return _singletonInstance; \
  5317. } \
  5318. \
  5319. static void deleteInstance() \
  5320. { \
  5321. if (_singletonInstance != 0) \
  5322. { \
  5323. classname* const old = _singletonInstance; \
  5324. _singletonInstance = 0; \
  5325. delete old; \
  5326. } \
  5327. } \
  5328. \
  5329. void clearSingletonInstance() throw() \
  5330. { \
  5331. if (_singletonInstance == this) \
  5332. _singletonInstance = 0; \
  5333. }
  5334. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5335. \
  5336. static classname* _singletonInstance; \
  5337. \
  5338. static classname* getInstance() \
  5339. { \
  5340. if (_singletonInstance == 0) \
  5341. _singletonInstance = new classname(); \
  5342. \
  5343. return _singletonInstance; \
  5344. } \
  5345. \
  5346. static inline classname* getInstanceWithoutCreating() throw() \
  5347. { \
  5348. return _singletonInstance; \
  5349. } \
  5350. \
  5351. static void deleteInstance() \
  5352. { \
  5353. if (_singletonInstance != 0) \
  5354. { \
  5355. classname* const old = _singletonInstance; \
  5356. _singletonInstance = 0; \
  5357. delete old; \
  5358. } \
  5359. } \
  5360. \
  5361. void clearSingletonInstance() throw() \
  5362. { \
  5363. if (_singletonInstance == this) \
  5364. _singletonInstance = 0; \
  5365. }
  5366. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5367. \
  5368. classname* classname::_singletonInstance = 0;
  5369. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5370. /*** End of inlined file: juce_Singleton.h ***/
  5371. #endif
  5372. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5373. #endif
  5374. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5375. /*** Start of inlined file: juce_SystemStats.h ***/
  5376. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5377. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5378. class JUCE_API SystemStats
  5379. {
  5380. public:
  5381. static const String getJUCEVersion() throw();
  5382. enum OperatingSystemType
  5383. {
  5384. UnknownOS = 0,
  5385. MacOSX = 0x1000,
  5386. Linux = 0x2000,
  5387. Win95 = 0x4001,
  5388. Win98 = 0x4002,
  5389. WinNT351 = 0x4103,
  5390. WinNT40 = 0x4104,
  5391. Win2000 = 0x4105,
  5392. WinXP = 0x4106,
  5393. WinVista = 0x4107,
  5394. Windows7 = 0x4108,
  5395. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5396. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5397. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5398. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5399. };
  5400. static OperatingSystemType getOperatingSystemType() throw();
  5401. static const String getOperatingSystemName() throw();
  5402. static bool isOperatingSystem64Bit() throw();
  5403. static const String getLogonName();
  5404. static const String getFullUserName();
  5405. // CPU and memory information..
  5406. static int getCpuSpeedInMegaherz() throw();
  5407. static const String getCpuVendor() throw();
  5408. static bool hasMMX() throw();
  5409. static bool hasSSE() throw();
  5410. static bool hasSSE2() throw();
  5411. static bool has3DNow() throw();
  5412. static int getNumCpus() throw();
  5413. static int64 getClockCycleCounter() throw();
  5414. static int getMemorySizeInMegabytes() throw();
  5415. static int getPageSize() throw();
  5416. static int getMACAddresses (int64* addresses, int maxNum,
  5417. #if JUCE_MAC
  5418. bool littleEndian = true);
  5419. #else
  5420. bool littleEndian = false);
  5421. #endif
  5422. static const StringArray getMACAddressStrings();
  5423. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5424. static void initialiseStats() throw();
  5425. private:
  5426. SystemStats();
  5427. SystemStats (const SystemStats&);
  5428. SystemStats& operator= (const SystemStats&);
  5429. };
  5430. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5431. /*** End of inlined file: juce_SystemStats.h ***/
  5432. #endif
  5433. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5434. #endif
  5435. #ifndef __JUCE_TIME_JUCEHEADER__
  5436. #endif
  5437. #ifndef __JUCE_UUID_JUCEHEADER__
  5438. /*** Start of inlined file: juce_Uuid.h ***/
  5439. #ifndef __JUCE_UUID_JUCEHEADER__
  5440. #define __JUCE_UUID_JUCEHEADER__
  5441. class JUCE_API Uuid
  5442. {
  5443. public:
  5444. Uuid();
  5445. ~Uuid() throw();
  5446. Uuid (const Uuid& other);
  5447. Uuid& operator= (const Uuid& other);
  5448. bool isNull() const throw();
  5449. bool operator== (const Uuid& other) const;
  5450. bool operator!= (const Uuid& other) const;
  5451. const String toString() const;
  5452. Uuid (const String& uuidString);
  5453. Uuid& operator= (const String& uuidString);
  5454. const uint8* getRawData() const throw() { return value.asBytes; }
  5455. Uuid (const uint8* const rawData);
  5456. Uuid& operator= (const uint8* const rawData);
  5457. juce_UseDebuggingNewOperator
  5458. private:
  5459. union
  5460. {
  5461. uint8 asBytes [16];
  5462. int asInt[4];
  5463. int64 asInt64[2];
  5464. } value;
  5465. };
  5466. #endif // __JUCE_UUID_JUCEHEADER__
  5467. /*** End of inlined file: juce_Uuid.h ***/
  5468. #endif
  5469. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5470. /*** Start of inlined file: juce_BlowFish.h ***/
  5471. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5472. #define __JUCE_BLOWFISH_JUCEHEADER__
  5473. class JUCE_API BlowFish
  5474. {
  5475. public:
  5476. BlowFish (const void* keyData, int keyBytes);
  5477. BlowFish (const BlowFish& other);
  5478. BlowFish& operator= (const BlowFish& other);
  5479. ~BlowFish();
  5480. void encrypt (uint32& data1, uint32& data2) const throw();
  5481. void decrypt (uint32& data1, uint32& data2) const throw();
  5482. juce_UseDebuggingNewOperator
  5483. private:
  5484. uint32 p[18];
  5485. HeapBlock <uint32> s[4];
  5486. uint32 F (uint32 x) const throw();
  5487. };
  5488. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5489. /*** End of inlined file: juce_BlowFish.h ***/
  5490. #endif
  5491. #ifndef __JUCE_MD5_JUCEHEADER__
  5492. /*** Start of inlined file: juce_MD5.h ***/
  5493. #ifndef __JUCE_MD5_JUCEHEADER__
  5494. #define __JUCE_MD5_JUCEHEADER__
  5495. class JUCE_API MD5
  5496. {
  5497. public:
  5498. MD5();
  5499. MD5 (const MD5& other);
  5500. MD5& operator= (const MD5& other);
  5501. explicit MD5 (const MemoryBlock& data);
  5502. MD5 (const void* data, const size_t numBytes);
  5503. explicit MD5 (const String& text);
  5504. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5505. explicit MD5 (const File& file);
  5506. ~MD5();
  5507. const MemoryBlock getRawChecksumData() const;
  5508. const String toHexString() const;
  5509. bool operator== (const MD5& other) const;
  5510. bool operator!= (const MD5& other) const;
  5511. juce_UseDebuggingNewOperator
  5512. private:
  5513. uint8 result [16];
  5514. struct ProcessContext
  5515. {
  5516. uint8 buffer [64];
  5517. uint32 state [4];
  5518. uint32 count [2];
  5519. ProcessContext();
  5520. void processBlock (const void* data, size_t dataSize);
  5521. void transform (const void* buffer);
  5522. void finish (void* const result);
  5523. };
  5524. void processStream (InputStream& input, int64 numBytesToRead);
  5525. };
  5526. #endif // __JUCE_MD5_JUCEHEADER__
  5527. /*** End of inlined file: juce_MD5.h ***/
  5528. #endif
  5529. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5530. /*** Start of inlined file: juce_Primes.h ***/
  5531. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5532. #define __JUCE_PRIMES_JUCEHEADER__
  5533. class JUCE_API Primes
  5534. {
  5535. public:
  5536. static const BigInteger createProbablePrime (int bitLength,
  5537. int certainty,
  5538. const int* randomSeeds = 0,
  5539. int numRandomSeeds = 0);
  5540. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5541. private:
  5542. Primes();
  5543. Primes (const Primes&);
  5544. Primes& operator= (const Primes&);
  5545. };
  5546. #endif // __JUCE_PRIMES_JUCEHEADER__
  5547. /*** End of inlined file: juce_Primes.h ***/
  5548. #endif
  5549. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5550. /*** Start of inlined file: juce_RSAKey.h ***/
  5551. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5552. #define __JUCE_RSAKEY_JUCEHEADER__
  5553. class JUCE_API RSAKey
  5554. {
  5555. public:
  5556. RSAKey();
  5557. explicit RSAKey (const String& stringRepresentation);
  5558. ~RSAKey();
  5559. const String toString() const;
  5560. bool applyToValue (BigInteger& value) const;
  5561. static void createKeyPair (RSAKey& publicKey,
  5562. RSAKey& privateKey,
  5563. int numBits,
  5564. const int* randomSeeds = 0,
  5565. int numRandomSeeds = 0);
  5566. juce_UseDebuggingNewOperator
  5567. protected:
  5568. BigInteger part1, part2;
  5569. };
  5570. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5571. /*** End of inlined file: juce_RSAKey.h ***/
  5572. #endif
  5573. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5574. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5575. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5576. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5577. class JUCE_API DirectoryIterator
  5578. {
  5579. public:
  5580. DirectoryIterator (const File& directory,
  5581. bool isRecursive,
  5582. const String& wildCard = "*",
  5583. int whatToLookFor = File::findFiles);
  5584. ~DirectoryIterator();
  5585. bool next();
  5586. bool next (bool* isDirectory, bool* isHidden, int64* fileSize,
  5587. Time* modTime, Time* creationTime, bool* isReadOnly);
  5588. const File getFile() const;
  5589. float getEstimatedProgress() const;
  5590. juce_UseDebuggingNewOperator
  5591. private:
  5592. friend class File;
  5593. class NativeIterator
  5594. {
  5595. public:
  5596. NativeIterator (const File& directory, const String& wildCard);
  5597. ~NativeIterator();
  5598. bool next (String& filenameFound,
  5599. bool* isDirectory, bool* isHidden, int64* fileSize,
  5600. Time* modTime, Time* creationTime, bool* isReadOnly);
  5601. juce_UseDebuggingNewOperator
  5602. private:
  5603. class Pimpl;
  5604. friend class DirectoryIterator;
  5605. friend class ScopedPointer<Pimpl>;
  5606. ScopedPointer<Pimpl> pimpl;
  5607. NativeIterator (const NativeIterator&);
  5608. NativeIterator& operator= (const NativeIterator&);
  5609. };
  5610. friend class ScopedPointer<NativeIterator::Pimpl>;
  5611. NativeIterator fileFinder;
  5612. String wildCard, path;
  5613. int index;
  5614. mutable int totalNumFiles;
  5615. const int whatToLookFor;
  5616. const bool isRecursive;
  5617. ScopedPointer <DirectoryIterator> subIterator;
  5618. File currentFile;
  5619. DirectoryIterator (const DirectoryIterator&);
  5620. DirectoryIterator& operator= (const DirectoryIterator&);
  5621. };
  5622. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5623. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5624. #endif
  5625. #ifndef __JUCE_FILE_JUCEHEADER__
  5626. #endif
  5627. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5628. /*** Start of inlined file: juce_FileInputStream.h ***/
  5629. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5630. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5631. class JUCE_API FileInputStream : public InputStream
  5632. {
  5633. public:
  5634. explicit FileInputStream (const File& fileToRead);
  5635. ~FileInputStream();
  5636. const File& getFile() const throw() { return file; }
  5637. int64 getTotalLength();
  5638. int read (void* destBuffer, int maxBytesToRead);
  5639. bool isExhausted();
  5640. int64 getPosition();
  5641. bool setPosition (int64 pos);
  5642. juce_UseDebuggingNewOperator
  5643. private:
  5644. File file;
  5645. void* fileHandle;
  5646. int64 currentPosition, totalSize;
  5647. bool needToSeek;
  5648. FileInputStream (const FileInputStream&);
  5649. FileInputStream& operator= (const FileInputStream&);
  5650. };
  5651. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5652. /*** End of inlined file: juce_FileInputStream.h ***/
  5653. #endif
  5654. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5655. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5656. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5657. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5658. class JUCE_API FileOutputStream : public OutputStream
  5659. {
  5660. public:
  5661. FileOutputStream (const File& fileToWriteTo,
  5662. int bufferSizeToUse = 16384);
  5663. ~FileOutputStream();
  5664. const File& getFile() const { return file; }
  5665. bool failedToOpen() const { return fileHandle == 0; }
  5666. void flush();
  5667. int64 getPosition();
  5668. bool setPosition (int64 pos);
  5669. bool write (const void* data, int numBytes);
  5670. juce_UseDebuggingNewOperator
  5671. private:
  5672. File file;
  5673. void* fileHandle;
  5674. int64 currentPosition;
  5675. int bufferSize, bytesInBuffer;
  5676. HeapBlock <char> buffer;
  5677. void flushInternal();
  5678. int64 getPositionInternal() const;
  5679. FileOutputStream (const FileOutputStream&);
  5680. FileOutputStream& operator= (const FileOutputStream&);
  5681. };
  5682. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5683. /*** End of inlined file: juce_FileOutputStream.h ***/
  5684. #endif
  5685. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5686. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5687. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5688. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5689. class JUCE_API FileSearchPath
  5690. {
  5691. public:
  5692. FileSearchPath();
  5693. FileSearchPath (const String& path);
  5694. FileSearchPath (const FileSearchPath& other);
  5695. ~FileSearchPath();
  5696. FileSearchPath& operator= (const String& path);
  5697. int getNumPaths() const;
  5698. const File operator[] (int index) const;
  5699. const String toString() const;
  5700. void add (const File& directoryToAdd,
  5701. int insertIndex = -1);
  5702. void addIfNotAlreadyThere (const File& directoryToAdd);
  5703. void remove (int indexToRemove);
  5704. void addPath (const FileSearchPath& other);
  5705. void removeRedundantPaths();
  5706. void removeNonExistentPaths();
  5707. int findChildFiles (Array<File>& results,
  5708. int whatToLookFor,
  5709. bool searchRecursively,
  5710. const String& wildCardPattern = "*") const;
  5711. bool isFileInPath (const File& fileToCheck,
  5712. bool checkRecursively) const;
  5713. juce_UseDebuggingNewOperator
  5714. private:
  5715. StringArray directories;
  5716. void init (const String& path);
  5717. };
  5718. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5719. /*** End of inlined file: juce_FileSearchPath.h ***/
  5720. #endif
  5721. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5722. /*** Start of inlined file: juce_NamedPipe.h ***/
  5723. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5724. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5725. class JUCE_API NamedPipe
  5726. {
  5727. public:
  5728. NamedPipe();
  5729. ~NamedPipe();
  5730. bool openExisting (const String& pipeName);
  5731. bool createNewPipe (const String& pipeName);
  5732. void close();
  5733. bool isOpen() const;
  5734. const String getName() const;
  5735. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5736. int write (const void* sourceBuffer, int numBytesToWrite,
  5737. int timeOutMilliseconds = 2000);
  5738. void cancelPendingReads();
  5739. juce_UseDebuggingNewOperator
  5740. private:
  5741. void* internal;
  5742. String currentPipeName;
  5743. CriticalSection lock;
  5744. NamedPipe (const NamedPipe&);
  5745. NamedPipe& operator= (const NamedPipe&);
  5746. bool openInternal (const String& pipeName, const bool createPipe);
  5747. };
  5748. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5749. /*** End of inlined file: juce_NamedPipe.h ***/
  5750. #endif
  5751. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5752. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5753. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5754. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5755. class JUCE_API TemporaryFile
  5756. {
  5757. public:
  5758. enum OptionFlags
  5759. {
  5760. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5761. i.e. its name should start with a dot. */
  5762. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5763. the file is unique, they should go in brackets rather
  5764. than just being appended (see File::getNonexistentSibling() )*/
  5765. };
  5766. TemporaryFile (const String& suffix = String::empty,
  5767. int optionFlags = 0);
  5768. TemporaryFile (const File& targetFile,
  5769. int optionFlags = 0);
  5770. ~TemporaryFile();
  5771. const File getFile() const { return temporaryFile; }
  5772. const File getTargetFile() const { return targetFile; }
  5773. bool overwriteTargetFileWithTemporary() const;
  5774. juce_UseDebuggingNewOperator
  5775. private:
  5776. File temporaryFile, targetFile;
  5777. void createTempFile (const File& parentDirectory, String name, const String& suffix, int optionFlags);
  5778. TemporaryFile (const TemporaryFile&);
  5779. TemporaryFile& operator= (const TemporaryFile&);
  5780. };
  5781. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5782. /*** End of inlined file: juce_TemporaryFile.h ***/
  5783. #endif
  5784. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5785. /*** Start of inlined file: juce_ZipFile.h ***/
  5786. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5787. #define __JUCE_ZIPFILE_JUCEHEADER__
  5788. /*** Start of inlined file: juce_InputSource.h ***/
  5789. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5790. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5791. class JUCE_API InputSource
  5792. {
  5793. public:
  5794. InputSource() throw() {}
  5795. virtual ~InputSource() {}
  5796. virtual InputStream* createInputStream() = 0;
  5797. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5798. virtual int64 hashCode() const = 0;
  5799. juce_UseDebuggingNewOperator
  5800. };
  5801. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5802. /*** End of inlined file: juce_InputSource.h ***/
  5803. class JUCE_API ZipFile
  5804. {
  5805. public:
  5806. ZipFile (InputStream* inputStream,
  5807. bool deleteStreamWhenDestroyed) throw();
  5808. ZipFile (const File& file);
  5809. ZipFile (InputSource* inputSource);
  5810. ~ZipFile() throw();
  5811. struct ZipEntry
  5812. {
  5813. String filename;
  5814. unsigned int uncompressedSize;
  5815. Time fileTime;
  5816. };
  5817. int getNumEntries() const throw();
  5818. const ZipEntry* getEntry (int index) const throw();
  5819. int getIndexOfFileName (const String& fileName) const throw();
  5820. const ZipEntry* getEntry (const String& fileName) const throw();
  5821. void sortEntriesByFilename();
  5822. InputStream* createStreamForEntry (int index);
  5823. void uncompressTo (const File& targetDirectory,
  5824. bool shouldOverwriteFiles = true);
  5825. juce_UseDebuggingNewOperator
  5826. private:
  5827. class ZipInputStream;
  5828. class ZipFilenameComparator;
  5829. class ZipEntryInfo;
  5830. friend class ZipInputStream;
  5831. friend class ZipFilenameComparator;
  5832. friend class ZipEntryInfo;
  5833. OwnedArray <ZipEntryInfo> entries;
  5834. CriticalSection lock;
  5835. InputStream* inputStream;
  5836. ScopedPointer <InputStream> streamToDelete;
  5837. ScopedPointer <InputSource> inputSource;
  5838. #ifdef JUCE_DEBUG
  5839. int numOpenStreams;
  5840. #endif
  5841. void init();
  5842. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5843. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5844. ZipFile (const ZipFile&);
  5845. ZipFile& operator= (const ZipFile&);
  5846. };
  5847. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5848. /*** End of inlined file: juce_ZipFile.h ***/
  5849. #endif
  5850. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5851. /*** Start of inlined file: juce_Socket.h ***/
  5852. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5853. #define __JUCE_SOCKET_JUCEHEADER__
  5854. class JUCE_API StreamingSocket
  5855. {
  5856. public:
  5857. StreamingSocket();
  5858. ~StreamingSocket();
  5859. bool bindToPort (int localPortNumber);
  5860. bool connect (const String& remoteHostname,
  5861. int remotePortNumber,
  5862. int timeOutMillisecs = 3000);
  5863. bool isConnected() const throw() { return connected; }
  5864. void close();
  5865. const String& getHostName() const throw() { return hostName; }
  5866. int getPort() const throw() { return portNumber; }
  5867. bool isLocal() const throw();
  5868. int waitUntilReady (bool readyForReading,
  5869. int timeoutMsecs) const;
  5870. int read (void* destBuffer, int maxBytesToRead,
  5871. bool blockUntilSpecifiedAmountHasArrived);
  5872. int write (const void* sourceBuffer, int numBytesToWrite);
  5873. bool createListener (int portNumber, const String& localHostName = String::empty);
  5874. StreamingSocket* waitForNextConnection() const;
  5875. juce_UseDebuggingNewOperator
  5876. private:
  5877. String hostName;
  5878. int volatile portNumber, handle;
  5879. bool connected, isListener;
  5880. StreamingSocket (const String& hostname, int portNumber, int handle);
  5881. StreamingSocket (const StreamingSocket&);
  5882. StreamingSocket& operator= (const StreamingSocket&);
  5883. };
  5884. class JUCE_API DatagramSocket
  5885. {
  5886. public:
  5887. DatagramSocket (int localPortNumber,
  5888. bool enableBroadcasting = false);
  5889. ~DatagramSocket();
  5890. bool bindToPort (int localPortNumber);
  5891. bool connect (const String& remoteHostname,
  5892. int remotePortNumber,
  5893. int timeOutMillisecs = 3000);
  5894. bool isConnected() const throw() { return connected; }
  5895. void close();
  5896. const String& getHostName() const throw() { return hostName; }
  5897. int getPort() const throw() { return portNumber; }
  5898. bool isLocal() const throw();
  5899. int waitUntilReady (bool readyForReading,
  5900. int timeoutMsecs) const;
  5901. int read (void* destBuffer, int maxBytesToRead,
  5902. bool blockUntilSpecifiedAmountHasArrived);
  5903. int write (const void* sourceBuffer, int numBytesToWrite);
  5904. DatagramSocket* waitForNextConnection() const;
  5905. juce_UseDebuggingNewOperator
  5906. private:
  5907. String hostName;
  5908. int volatile portNumber, handle;
  5909. bool connected, allowBroadcast;
  5910. void* serverAddress;
  5911. DatagramSocket (const String& hostname, int portNumber, int handle, int localPortNumber);
  5912. DatagramSocket (const DatagramSocket&);
  5913. DatagramSocket& operator= (const DatagramSocket&);
  5914. };
  5915. #endif // __JUCE_SOCKET_JUCEHEADER__
  5916. /*** End of inlined file: juce_Socket.h ***/
  5917. #endif
  5918. #ifndef __JUCE_URL_JUCEHEADER__
  5919. /*** Start of inlined file: juce_URL.h ***/
  5920. #ifndef __JUCE_URL_JUCEHEADER__
  5921. #define __JUCE_URL_JUCEHEADER__
  5922. class JUCE_API URL
  5923. {
  5924. public:
  5925. URL();
  5926. URL (const String& url);
  5927. URL (const URL& other);
  5928. ~URL();
  5929. URL& operator= (const URL& other);
  5930. const String toString (bool includeGetParameters) const;
  5931. bool isWellFormed() const;
  5932. const String getDomain() const;
  5933. const String getSubPath() const;
  5934. const String getScheme() const;
  5935. const URL withNewSubPath (const String& newPath) const;
  5936. const URL withParameter (const String& parameterName,
  5937. const String& parameterValue) const;
  5938. const URL withFileToUpload (const String& parameterName,
  5939. const File& fileToUpload,
  5940. const String& mimeType) const;
  5941. const StringPairArray& getParameters() const;
  5942. const StringPairArray& getFilesToUpload() const;
  5943. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5944. const URL withPOSTData (const String& postData) const;
  5945. const String getPostData() const { return postData; }
  5946. bool launchInDefaultBrowser() const;
  5947. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5948. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5949. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5950. InputStream* createInputStream (bool usePostCommand,
  5951. OpenStreamProgressCallback* progressCallback = 0,
  5952. void* progressCallbackContext = 0,
  5953. const String& extraHeaders = String::empty,
  5954. int connectionTimeOutMs = 0) const;
  5955. bool readEntireBinaryStream (MemoryBlock& destData,
  5956. bool usePostCommand = false) const;
  5957. const String readEntireTextStream (bool usePostCommand = false) const;
  5958. XmlElement* readEntireXmlStream (bool usePostCommand = false) const;
  5959. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5960. bool isParameter);
  5961. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5962. juce_UseDebuggingNewOperator
  5963. private:
  5964. String url, postData;
  5965. StringPairArray parameters, filesToUpload, mimeTypes;
  5966. };
  5967. #endif // __JUCE_URL_JUCEHEADER__
  5968. /*** End of inlined file: juce_URL.h ***/
  5969. #endif
  5970. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5971. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5972. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5973. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5974. class JUCE_API BufferedInputStream : public InputStream
  5975. {
  5976. public:
  5977. BufferedInputStream (InputStream* sourceStream,
  5978. int bufferSize,
  5979. bool deleteSourceWhenDestroyed);
  5980. ~BufferedInputStream();
  5981. int64 getTotalLength();
  5982. int64 getPosition();
  5983. bool setPosition (int64 newPosition);
  5984. int read (void* destBuffer, int maxBytesToRead);
  5985. const String readString();
  5986. bool isExhausted();
  5987. juce_UseDebuggingNewOperator
  5988. private:
  5989. InputStream* const source;
  5990. ScopedPointer <InputStream> sourceToDelete;
  5991. int bufferSize;
  5992. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5993. HeapBlock <char> buffer;
  5994. void ensureBuffered();
  5995. BufferedInputStream (const BufferedInputStream&);
  5996. BufferedInputStream& operator= (const BufferedInputStream&);
  5997. };
  5998. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5999. /*** End of inlined file: juce_BufferedInputStream.h ***/
  6000. #endif
  6001. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6002. /*** Start of inlined file: juce_FileInputSource.h ***/
  6003. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6004. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6005. class JUCE_API FileInputSource : public InputSource
  6006. {
  6007. public:
  6008. FileInputSource (const File& file);
  6009. ~FileInputSource();
  6010. InputStream* createInputStream();
  6011. InputStream* createInputStreamFor (const String& relatedItemPath);
  6012. int64 hashCode() const;
  6013. juce_UseDebuggingNewOperator
  6014. private:
  6015. const File file;
  6016. FileInputSource (const FileInputSource&);
  6017. FileInputSource& operator= (const FileInputSource&);
  6018. };
  6019. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  6020. /*** End of inlined file: juce_FileInputSource.h ***/
  6021. #endif
  6022. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6023. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6024. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6025. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6026. class GZIPCompressorHelper;
  6027. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  6028. {
  6029. public:
  6030. GZIPCompressorOutputStream (OutputStream* destStream,
  6031. int compressionLevel = 0,
  6032. bool deleteDestStreamWhenDestroyed = false,
  6033. bool noWrap = false);
  6034. ~GZIPCompressorOutputStream();
  6035. void flush();
  6036. int64 getPosition();
  6037. bool setPosition (int64 newPosition);
  6038. bool write (const void* destBuffer, int howMany);
  6039. juce_UseDebuggingNewOperator
  6040. private:
  6041. OutputStream* const destStream;
  6042. ScopedPointer <OutputStream> streamToDelete;
  6043. HeapBlock <uint8> buffer;
  6044. ScopedPointer <GZIPCompressorHelper> helper;
  6045. bool doNextBlock();
  6046. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  6047. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  6048. };
  6049. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6050. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6051. #endif
  6052. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6053. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6054. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6055. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6056. class GZIPDecompressHelper;
  6057. class JUCE_API GZIPDecompressorInputStream : public InputStream
  6058. {
  6059. public:
  6060. GZIPDecompressorInputStream (InputStream* sourceStream,
  6061. bool deleteSourceWhenDestroyed,
  6062. bool noWrap = false,
  6063. int64 uncompressedStreamLength = -1);
  6064. ~GZIPDecompressorInputStream();
  6065. int64 getPosition();
  6066. bool setPosition (int64 pos);
  6067. int64 getTotalLength();
  6068. bool isExhausted();
  6069. int read (void* destBuffer, int maxBytesToRead);
  6070. juce_UseDebuggingNewOperator
  6071. private:
  6072. InputStream* const sourceStream;
  6073. ScopedPointer <InputStream> streamToDelete;
  6074. const int64 uncompressedStreamLength;
  6075. const bool noWrap;
  6076. bool isEof;
  6077. int activeBufferSize;
  6078. int64 originalSourcePos, currentPos;
  6079. HeapBlock <uint8> buffer;
  6080. ScopedPointer <GZIPDecompressHelper> helper;
  6081. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  6082. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  6083. };
  6084. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6085. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6086. #endif
  6087. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  6088. #endif
  6089. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  6090. #endif
  6091. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6092. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  6093. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6094. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6095. class JUCE_API MemoryInputStream : public InputStream
  6096. {
  6097. public:
  6098. MemoryInputStream (const void* sourceData,
  6099. size_t sourceDataSize,
  6100. bool keepInternalCopyOfData);
  6101. MemoryInputStream (const MemoryBlock& data,
  6102. bool keepInternalCopyOfData);
  6103. ~MemoryInputStream();
  6104. int64 getPosition();
  6105. bool setPosition (int64 pos);
  6106. int64 getTotalLength();
  6107. bool isExhausted();
  6108. int read (void* destBuffer, int maxBytesToRead);
  6109. juce_UseDebuggingNewOperator
  6110. private:
  6111. const char* data;
  6112. size_t dataSize, position;
  6113. MemoryBlock internalCopy;
  6114. MemoryInputStream (const MemoryInputStream&);
  6115. MemoryInputStream& operator= (const MemoryInputStream&);
  6116. };
  6117. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6118. /*** End of inlined file: juce_MemoryInputStream.h ***/
  6119. #endif
  6120. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6121. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  6122. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6123. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6124. class JUCE_API MemoryOutputStream : public OutputStream
  6125. {
  6126. public:
  6127. MemoryOutputStream (size_t initialSize = 256,
  6128. size_t granularity = 256,
  6129. MemoryBlock* memoryBlockToWriteTo = 0);
  6130. ~MemoryOutputStream();
  6131. const char* getData() const throw();
  6132. size_t getDataSize() const throw() { return size; }
  6133. void reset() throw();
  6134. const String toUTF8() const;
  6135. void flush();
  6136. bool write (const void* buffer, int howMany);
  6137. int64 getPosition() { return position; }
  6138. bool setPosition (int64 newPosition);
  6139. juce_UseDebuggingNewOperator
  6140. private:
  6141. MemoryBlock* data;
  6142. ScopedPointer <MemoryBlock> dataToDelete;
  6143. size_t position, size, blockSize;
  6144. MemoryOutputStream (const MemoryOutputStream&);
  6145. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6146. };
  6147. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6148. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6149. #endif
  6150. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6151. #endif
  6152. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6153. /*** Start of inlined file: juce_SubregionStream.h ***/
  6154. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6155. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6156. class JUCE_API SubregionStream : public InputStream
  6157. {
  6158. public:
  6159. SubregionStream (InputStream* sourceStream,
  6160. int64 startPositionInSourceStream,
  6161. int64 lengthOfSourceStream,
  6162. bool deleteSourceWhenDestroyed) throw();
  6163. ~SubregionStream() throw();
  6164. int64 getTotalLength();
  6165. int64 getPosition();
  6166. bool setPosition (int64 newPosition);
  6167. int read (void* destBuffer, int maxBytesToRead);
  6168. bool isExhausted();
  6169. juce_UseDebuggingNewOperator
  6170. private:
  6171. InputStream* const source;
  6172. ScopedPointer <InputStream> sourceToDelete;
  6173. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6174. SubregionStream (const SubregionStream&);
  6175. SubregionStream& operator= (const SubregionStream&);
  6176. };
  6177. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6178. /*** End of inlined file: juce_SubregionStream.h ***/
  6179. #endif
  6180. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6181. #endif
  6182. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6183. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6184. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6185. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6186. #define TRANS(stringLiteral) \
  6187. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6188. class JUCE_API LocalisedStrings
  6189. {
  6190. public:
  6191. LocalisedStrings (const String& fileContents);
  6192. LocalisedStrings (const File& fileToLoad);
  6193. ~LocalisedStrings();
  6194. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6195. static LocalisedStrings* getCurrentMappings();
  6196. static const String translateWithCurrentMappings (const String& text);
  6197. static const String translateWithCurrentMappings (const char* text);
  6198. const String translate (const String& text) const;
  6199. const String getLanguageName() const { return languageName; }
  6200. const StringArray getCountryCodes() const { return countryCodes; }
  6201. void setIgnoresCase (const bool shouldIgnoreCase);
  6202. juce_UseDebuggingNewOperator
  6203. private:
  6204. String languageName;
  6205. StringArray countryCodes;
  6206. StringPairArray translations;
  6207. void loadFromText (const String& fileContents);
  6208. };
  6209. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6210. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6211. #endif
  6212. #ifndef __JUCE_STRING_JUCEHEADER__
  6213. #endif
  6214. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6215. #endif
  6216. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6217. #endif
  6218. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6219. /*** Start of inlined file: juce_XmlDocument.h ***/
  6220. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6221. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6222. class JUCE_API XmlDocument
  6223. {
  6224. public:
  6225. XmlDocument (const String& documentText);
  6226. XmlDocument (const File& file);
  6227. ~XmlDocument();
  6228. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6229. const String& getLastParseError() const throw();
  6230. void setInputSource (InputSource* const newSource) throw();
  6231. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6232. juce_UseDebuggingNewOperator
  6233. private:
  6234. String originalText;
  6235. const juce_wchar* input;
  6236. bool outOfData, errorOccurred;
  6237. bool identifierLookupTable [128];
  6238. String lastError, dtdText;
  6239. StringArray tokenisedDTD;
  6240. bool needToLoadDTD, ignoreEmptyTextElements;
  6241. ScopedPointer <InputSource> inputSource;
  6242. void setLastError (const String& desc, const bool carryOn);
  6243. void skipHeader();
  6244. void skipNextWhiteSpace();
  6245. juce_wchar readNextChar() throw();
  6246. XmlElement* readNextElement (const bool alsoParseSubElements);
  6247. void readChildElements (XmlElement* parent);
  6248. int findNextTokenLength() throw();
  6249. void readQuotedString (String& result);
  6250. void readEntity (String& result);
  6251. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6252. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6253. const String getFileContents (const String& filename) const;
  6254. const String expandEntity (const String& entity);
  6255. const String expandExternalEntity (const String& entity);
  6256. const String getParameterEntity (const String& entity);
  6257. XmlDocument (const XmlDocument&);
  6258. XmlDocument& operator= (const XmlDocument&);
  6259. };
  6260. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6261. /*** End of inlined file: juce_XmlDocument.h ***/
  6262. #endif
  6263. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6264. #endif
  6265. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6266. #endif
  6267. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6268. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6269. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6270. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6271. class JUCE_API InterProcessLock
  6272. {
  6273. public:
  6274. explicit InterProcessLock (const String& name);
  6275. ~InterProcessLock();
  6276. bool enter (int timeOutMillisecs = -1);
  6277. void exit();
  6278. class ScopedLockType
  6279. {
  6280. public:
  6281. explicit ScopedLockType (InterProcessLock& lock) : lock_ (lock) { lockWasSuccessful = lock.enter(); }
  6282. inline ~ScopedLockType() { lock_.exit(); }
  6283. bool isLocked() const throw() { return lockWasSuccessful; }
  6284. private:
  6285. InterProcessLock& lock_;
  6286. bool lockWasSuccessful;
  6287. ScopedLockType (const ScopedLockType&);
  6288. ScopedLockType& operator= (const ScopedLockType&);
  6289. };
  6290. juce_UseDebuggingNewOperator
  6291. private:
  6292. class Pimpl;
  6293. friend class ScopedPointer <Pimpl>;
  6294. ScopedPointer <Pimpl> pimpl;
  6295. CriticalSection lock;
  6296. String name;
  6297. InterProcessLock (const InterProcessLock&);
  6298. InterProcessLock& operator= (const InterProcessLock&);
  6299. };
  6300. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6301. /*** End of inlined file: juce_InterProcessLock.h ***/
  6302. #endif
  6303. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6304. /*** Start of inlined file: juce_Process.h ***/
  6305. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6306. #define __JUCE_PROCESS_JUCEHEADER__
  6307. class JUCE_API Process
  6308. {
  6309. public:
  6310. enum ProcessPriority
  6311. {
  6312. LowPriority = 0,
  6313. NormalPriority = 1,
  6314. HighPriority = 2,
  6315. RealtimePriority = 3
  6316. };
  6317. static void setPriority (const ProcessPriority priority);
  6318. static void terminate();
  6319. static bool isForegroundProcess();
  6320. static void raisePrivilege();
  6321. static void lowerPrivilege();
  6322. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6323. private:
  6324. Process();
  6325. Process (const Process&);
  6326. Process& operator= (const Process&);
  6327. };
  6328. #endif // __JUCE_PROCESS_JUCEHEADER__
  6329. /*** End of inlined file: juce_Process.h ***/
  6330. #endif
  6331. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6332. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6333. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6334. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6335. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6336. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6337. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6338. class JUCE_API WaitableEvent
  6339. {
  6340. public:
  6341. WaitableEvent (bool manualReset = false) throw();
  6342. ~WaitableEvent() throw();
  6343. bool wait (int timeOutMilliseconds = -1) const throw();
  6344. void signal() const throw();
  6345. void reset() const throw();
  6346. juce_UseDebuggingNewOperator
  6347. private:
  6348. void* internal;
  6349. WaitableEvent (const WaitableEvent&);
  6350. WaitableEvent& operator= (const WaitableEvent&);
  6351. };
  6352. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6353. /*** End of inlined file: juce_WaitableEvent.h ***/
  6354. /*** Start of inlined file: juce_Thread.h ***/
  6355. #ifndef __JUCE_THREAD_JUCEHEADER__
  6356. #define __JUCE_THREAD_JUCEHEADER__
  6357. class JUCE_API Thread
  6358. {
  6359. public:
  6360. explicit Thread (const String& threadName);
  6361. virtual ~Thread();
  6362. virtual void run() = 0;
  6363. // Thread control functions..
  6364. void startThread();
  6365. void startThread (int priority);
  6366. void stopThread (int timeOutMilliseconds);
  6367. bool isThreadRunning() const;
  6368. void signalThreadShouldExit();
  6369. inline bool threadShouldExit() const { return threadShouldExit_; }
  6370. bool waitForThreadToExit (int timeOutMilliseconds) const;
  6371. bool setPriority (int priority);
  6372. static bool setCurrentThreadPriority (int priority);
  6373. void setAffinityMask (uint32 affinityMask);
  6374. static void setCurrentThreadAffinityMask (uint32 affinityMask);
  6375. // this can be called from any thread that needs to pause..
  6376. static void JUCE_CALLTYPE sleep (int milliseconds);
  6377. static void JUCE_CALLTYPE yield();
  6378. bool wait (int timeOutMilliseconds) const;
  6379. void notify() const;
  6380. typedef void* ThreadID;
  6381. static ThreadID getCurrentThreadId();
  6382. static Thread* getCurrentThread();
  6383. ThreadID getThreadId() const throw() { return threadId_; }
  6384. const String getThreadName() const { return threadName_; }
  6385. static int getNumRunningThreads();
  6386. static void stopAllThreads (int timeoutInMillisecs);
  6387. juce_UseDebuggingNewOperator
  6388. private:
  6389. const String threadName_;
  6390. void* volatile threadHandle_;
  6391. CriticalSection startStopLock;
  6392. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6393. int threadPriority_;
  6394. ThreadID threadId_;
  6395. uint32 affinityMask_;
  6396. bool volatile threadShouldExit_;
  6397. friend void JUCE_API juce_threadEntryPoint (void*);
  6398. static void threadEntryPoint (Thread* thread);
  6399. static Array<Thread*> runningThreads;
  6400. static CriticalSection runningThreadsLock;
  6401. Thread (const Thread&);
  6402. Thread& operator= (const Thread&);
  6403. };
  6404. #endif // __JUCE_THREAD_JUCEHEADER__
  6405. /*** End of inlined file: juce_Thread.h ***/
  6406. class JUCE_API ReadWriteLock
  6407. {
  6408. public:
  6409. ReadWriteLock() throw();
  6410. ~ReadWriteLock() throw();
  6411. void enterRead() const throw();
  6412. void exitRead() const throw();
  6413. void enterWrite() const throw();
  6414. bool tryEnterWrite() const throw();
  6415. void exitWrite() const throw();
  6416. juce_UseDebuggingNewOperator
  6417. private:
  6418. CriticalSection accessLock;
  6419. WaitableEvent waitEvent;
  6420. mutable int numWaitingWriters, numWriters;
  6421. mutable Thread::ThreadID writerThreadId;
  6422. mutable Array <Thread::ThreadID> readerThreads;
  6423. ReadWriteLock (const ReadWriteLock&);
  6424. ReadWriteLock& operator= (const ReadWriteLock&);
  6425. };
  6426. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6427. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6428. #endif
  6429. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6430. #endif
  6431. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6432. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6433. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6434. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6435. class JUCE_API ScopedReadLock
  6436. {
  6437. public:
  6438. inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6439. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6440. private:
  6441. const ReadWriteLock& lock_;
  6442. ScopedReadLock (const ScopedReadLock&);
  6443. ScopedReadLock& operator= (const ScopedReadLock&);
  6444. };
  6445. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6446. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6447. #endif
  6448. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6449. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6450. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6451. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6452. class JUCE_API ScopedTryLock
  6453. {
  6454. public:
  6455. inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6456. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6457. bool isLocked() const throw() { return lockWasSuccessful; }
  6458. private:
  6459. const CriticalSection& lock_;
  6460. const bool lockWasSuccessful;
  6461. ScopedTryLock (const ScopedTryLock&);
  6462. ScopedTryLock& operator= (const ScopedTryLock&);
  6463. };
  6464. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6465. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6466. #endif
  6467. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6468. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6469. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6470. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6471. class JUCE_API ScopedWriteLock
  6472. {
  6473. public:
  6474. inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6475. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6476. private:
  6477. const ReadWriteLock& lock_;
  6478. ScopedWriteLock (const ScopedWriteLock&);
  6479. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6480. };
  6481. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6482. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6483. #endif
  6484. #ifndef __JUCE_THREAD_JUCEHEADER__
  6485. #endif
  6486. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6487. /*** Start of inlined file: juce_ThreadPool.h ***/
  6488. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6489. #define __JUCE_THREADPOOL_JUCEHEADER__
  6490. class ThreadPool;
  6491. class ThreadPoolThread;
  6492. class JUCE_API ThreadPoolJob
  6493. {
  6494. public:
  6495. explicit ThreadPoolJob (const String& name);
  6496. virtual ~ThreadPoolJob();
  6497. const String getJobName() const;
  6498. void setJobName (const String& newName);
  6499. enum JobStatus
  6500. {
  6501. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6502. removed from the pool. */
  6503. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6504. should be automatically deleted by the pool. */
  6505. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6506. again when a thread is free. */
  6507. };
  6508. virtual JobStatus runJob() = 0;
  6509. bool isRunning() const { return isActive; }
  6510. bool shouldExit() const { return shouldStop; }
  6511. void signalJobShouldExit();
  6512. juce_UseDebuggingNewOperator
  6513. private:
  6514. friend class ThreadPool;
  6515. friend class ThreadPoolThread;
  6516. String jobName;
  6517. ThreadPool* pool;
  6518. bool shouldStop, isActive, shouldBeDeleted;
  6519. ThreadPoolJob (const ThreadPoolJob&);
  6520. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6521. };
  6522. class JUCE_API ThreadPool
  6523. {
  6524. public:
  6525. ThreadPool (int numberOfThreads,
  6526. bool startThreadsOnlyWhenNeeded = true,
  6527. int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6528. ~ThreadPool();
  6529. class JUCE_API JobSelector
  6530. {
  6531. public:
  6532. virtual ~JobSelector() {}
  6533. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6534. };
  6535. void addJob (ThreadPoolJob* job);
  6536. bool removeJob (ThreadPoolJob* job,
  6537. bool interruptIfRunning,
  6538. int timeOutMilliseconds);
  6539. bool removeAllJobs (bool interruptRunningJobs,
  6540. int timeOutMilliseconds,
  6541. bool deleteInactiveJobs = false,
  6542. JobSelector* selectedJobsToRemove = 0);
  6543. int getNumJobs() const;
  6544. ThreadPoolJob* getJob (int index) const;
  6545. bool contains (const ThreadPoolJob* job) const;
  6546. bool isJobRunning (const ThreadPoolJob* job) const;
  6547. bool waitForJobToFinish (const ThreadPoolJob* job,
  6548. int timeOutMilliseconds) const;
  6549. const StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const;
  6550. bool setThreadPriorities (int newPriority);
  6551. juce_UseDebuggingNewOperator
  6552. private:
  6553. const int threadStopTimeout;
  6554. int priority;
  6555. class ThreadPoolThread;
  6556. OwnedArray <ThreadPoolThread> threads;
  6557. Array <ThreadPoolJob*> jobs;
  6558. CriticalSection lock;
  6559. uint32 lastJobEndTime;
  6560. WaitableEvent jobFinishedSignal;
  6561. friend class ThreadPoolThread;
  6562. bool runNextJob();
  6563. ThreadPool (const ThreadPool&);
  6564. ThreadPool& operator= (const ThreadPool&);
  6565. };
  6566. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6567. /*** End of inlined file: juce_ThreadPool.h ***/
  6568. #endif
  6569. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6570. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6571. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6572. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6573. class JUCE_API TimeSliceClient
  6574. {
  6575. public:
  6576. virtual ~TimeSliceClient() {}
  6577. virtual bool useTimeSlice() = 0;
  6578. };
  6579. class JUCE_API TimeSliceThread : public Thread
  6580. {
  6581. public:
  6582. explicit TimeSliceThread (const String& threadName);
  6583. ~TimeSliceThread();
  6584. void addTimeSliceClient (TimeSliceClient* client);
  6585. void removeTimeSliceClient (TimeSliceClient* client);
  6586. int getNumClients() const;
  6587. TimeSliceClient* getClient (int index) const;
  6588. void run();
  6589. juce_UseDebuggingNewOperator
  6590. private:
  6591. CriticalSection callbackLock, listLock;
  6592. Array <TimeSliceClient*> clients;
  6593. int index;
  6594. TimeSliceClient* clientBeingCalled;
  6595. bool clientsChanged;
  6596. TimeSliceThread (const TimeSliceThread&);
  6597. TimeSliceThread& operator= (const TimeSliceThread&);
  6598. };
  6599. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6600. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6601. #endif
  6602. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6603. #endif
  6604. #endif
  6605. /*** End of inlined file: juce_core_includes.h ***/
  6606. // if you're compiling a command-line app, you might want to just include the core headers,
  6607. // so you can set this macro before including juce.h
  6608. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6609. /*** Start of inlined file: juce_app_includes.h ***/
  6610. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6611. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6612. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6613. /*** Start of inlined file: juce_Application.h ***/
  6614. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6615. #define __JUCE_APPLICATION_JUCEHEADER__
  6616. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6617. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6618. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6619. /*** Start of inlined file: juce_Component.h ***/
  6620. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6621. #define __JUCE_COMPONENT_JUCEHEADER__
  6622. /*** Start of inlined file: juce_MouseCursor.h ***/
  6623. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6624. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6625. class Image;
  6626. class ComponentPeer;
  6627. class Component;
  6628. class JUCE_API MouseCursor
  6629. {
  6630. public:
  6631. enum StandardCursorType
  6632. {
  6633. NoCursor = 0, /**< An invisible cursor. */
  6634. NormalCursor, /**< The stardard arrow cursor. */
  6635. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6636. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6637. CrosshairCursor, /**< A pair of crosshairs. */
  6638. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6639. that you're dragging a copy of something. */
  6640. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6641. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6642. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6643. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6644. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6645. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6646. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6647. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6648. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6649. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6650. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6651. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6652. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6653. };
  6654. MouseCursor();
  6655. MouseCursor (StandardCursorType type);
  6656. MouseCursor (const Image& image, int hotSpotX, int hotSpotY);
  6657. MouseCursor (const MouseCursor& other);
  6658. MouseCursor& operator= (const MouseCursor& other);
  6659. ~MouseCursor();
  6660. bool operator== (const MouseCursor& other) const throw();
  6661. bool operator!= (const MouseCursor& other) const throw();
  6662. static void showWaitCursor();
  6663. static void hideWaitCursor();
  6664. juce_UseDebuggingNewOperator
  6665. private:
  6666. class SharedCursorHandle;
  6667. SharedCursorHandle* cursorHandle;
  6668. friend class MouseInputSourceInternal;
  6669. void showInWindow (ComponentPeer* window) const;
  6670. void showInAllWindows() const;
  6671. void* getHandle() const throw();
  6672. };
  6673. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6674. /*** End of inlined file: juce_MouseCursor.h ***/
  6675. /*** Start of inlined file: juce_MouseListener.h ***/
  6676. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6677. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6678. class MouseEvent;
  6679. class JUCE_API MouseListener
  6680. {
  6681. public:
  6682. virtual ~MouseListener() {}
  6683. virtual void mouseMove (const MouseEvent& e);
  6684. virtual void mouseEnter (const MouseEvent& e);
  6685. virtual void mouseExit (const MouseEvent& e);
  6686. virtual void mouseDown (const MouseEvent& e);
  6687. virtual void mouseDrag (const MouseEvent& e);
  6688. virtual void mouseUp (const MouseEvent& e);
  6689. virtual void mouseDoubleClick (const MouseEvent& e);
  6690. virtual void mouseWheelMove (const MouseEvent& e,
  6691. float wheelIncrementX,
  6692. float wheelIncrementY);
  6693. };
  6694. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6695. /*** End of inlined file: juce_MouseListener.h ***/
  6696. /*** Start of inlined file: juce_MouseEvent.h ***/
  6697. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6698. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6699. class Component;
  6700. class MouseInputSource;
  6701. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6702. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6703. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6704. class JUCE_API ModifierKeys
  6705. {
  6706. public:
  6707. ModifierKeys (int flags = 0) throw();
  6708. ModifierKeys (const ModifierKeys& other) throw();
  6709. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6710. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6711. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6712. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6713. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6714. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6715. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6716. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6717. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6718. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6719. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6720. enum Flags
  6721. {
  6722. shiftModifier = 1,
  6723. ctrlModifier = 2,
  6724. altModifier = 4,
  6725. leftButtonModifier = 16,
  6726. rightButtonModifier = 32,
  6727. middleButtonModifier = 64,
  6728. #if JUCE_MAC
  6729. commandModifier = 8,
  6730. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6731. #else
  6732. commandModifier = ctrlModifier,
  6733. popupMenuClickModifier = rightButtonModifier,
  6734. #endif
  6735. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6736. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6737. };
  6738. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6739. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6740. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6741. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6742. inline int getRawFlags() const throw() { return flags; }
  6743. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6744. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6745. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6746. int getNumMouseButtonsDown() const throw();
  6747. static const ModifierKeys getCurrentModifiers() throw();
  6748. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6749. private:
  6750. int flags;
  6751. static ModifierKeys currentModifiers;
  6752. friend class ComponentPeer;
  6753. friend class MouseInputSource;
  6754. friend class MouseInputSourceInternal;
  6755. static void updateCurrentModifiers() throw();
  6756. };
  6757. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6758. /*** End of inlined file: juce_ModifierKeys.h ***/
  6759. /*** Start of inlined file: juce_Point.h ***/
  6760. #ifndef __JUCE_POINT_JUCEHEADER__
  6761. #define __JUCE_POINT_JUCEHEADER__
  6762. /*** Start of inlined file: juce_AffineTransform.h ***/
  6763. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6764. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6765. class JUCE_API AffineTransform
  6766. {
  6767. public:
  6768. AffineTransform() throw();
  6769. AffineTransform (const AffineTransform& other) throw();
  6770. AffineTransform (const float mat00, const float mat01, const float mat02,
  6771. const float mat10, const float mat11, const float mat12) throw();
  6772. AffineTransform& operator= (const AffineTransform& other) throw();
  6773. bool operator== (const AffineTransform& other) const throw();
  6774. bool operator!= (const AffineTransform& other) const throw();
  6775. static const AffineTransform identity;
  6776. void transformPoint (float& x,
  6777. float& y) const throw();
  6778. void transformPoint (double& x,
  6779. double& y) const throw();
  6780. const AffineTransform translated (const float deltaX,
  6781. const float deltaY) const throw();
  6782. static const AffineTransform translation (const float deltaX,
  6783. const float deltaY) throw();
  6784. const AffineTransform rotated (const float angleInRadians) const throw();
  6785. const AffineTransform rotated (const float angleInRadians,
  6786. const float pivotX,
  6787. const float pivotY) const throw();
  6788. static const AffineTransform rotation (const float angleInRadians) throw();
  6789. static const AffineTransform rotation (const float angleInRadians,
  6790. const float pivotX,
  6791. const float pivotY) throw();
  6792. const AffineTransform scaled (const float factorX,
  6793. const float factorY) const throw();
  6794. static const AffineTransform scale (const float factorX,
  6795. const float factorY) throw();
  6796. const AffineTransform sheared (const float shearX,
  6797. const float shearY) const throw();
  6798. const AffineTransform inverted() const throw();
  6799. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6800. bool isIdentity() const throw();
  6801. bool isSingularity() const throw();
  6802. bool isOnlyTranslation() const throw();
  6803. float getTranslationX() const throw() { return mat02; }
  6804. float getTranslationY() const throw() { return mat12; }
  6805. juce_UseDebuggingNewOperator
  6806. float mat00, mat01, mat02;
  6807. float mat10, mat11, mat12;
  6808. private:
  6809. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6810. const float mat10, const float mat11, const float mat12) const throw();
  6811. };
  6812. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6813. /*** End of inlined file: juce_AffineTransform.h ***/
  6814. template <typename ValueType>
  6815. class Point
  6816. {
  6817. public:
  6818. Point() throw() : x (0), y (0) {}
  6819. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6820. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6821. ~Point() throw() {}
  6822. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6823. inline ValueType getX() const throw() { return x; }
  6824. inline ValueType getY() const throw() { return y; }
  6825. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6826. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6827. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6828. const Point withX (const ValueType newX) const throw() { return Point (newX, y); }
  6829. const Point withY (const ValueType newY) const throw() { return Point (x, newY); }
  6830. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6831. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6832. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6833. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6834. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6835. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6836. const Point operator* (const ValueType multiplier) const throw() { return Point (x * multiplier, y * multiplier); }
  6837. Point& operator*= (const ValueType multiplier) throw() { x *= multiplier; y *= multiplier; return *this; }
  6838. const Point operator/ (const ValueType divisor) const throw() { return Point (x / divisor, y / divisor); }
  6839. Point& operator/= (const ValueType divisor) throw() { x /= divisor; y /= divisor; return *this; }
  6840. const Point operator-() const throw() { return Point (-x, -y); }
  6841. ValueType getDistanceFromOrigin() const throw() { return (ValueType) juce_hypot (x, y); }
  6842. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6843. ValueType getAngleToPoint (const Point& other) const throw() { return (ValueType) atan2 (other.x - x, other.y - y); }
  6844. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6845. const String toString() const { return String (x) + ", " + String (y); }
  6846. juce_UseDebuggingNewOperator
  6847. private:
  6848. ValueType x, y;
  6849. };
  6850. #endif // __JUCE_POINT_JUCEHEADER__
  6851. /*** End of inlined file: juce_Point.h ***/
  6852. class JUCE_API MouseEvent
  6853. {
  6854. public:
  6855. MouseEvent (MouseInputSource& source,
  6856. const Point<int>& position,
  6857. const ModifierKeys& modifiers,
  6858. Component* originator,
  6859. const Time& eventTime,
  6860. const Point<int> mouseDownPos,
  6861. const Time& mouseDownTime,
  6862. int numberOfClicks,
  6863. bool mouseWasDragged) throw();
  6864. ~MouseEvent() throw();
  6865. const int x;
  6866. const int y;
  6867. const ModifierKeys mods;
  6868. Component* const eventComponent;
  6869. Component* const originalComponent;
  6870. const Time eventTime;
  6871. MouseInputSource& source;
  6872. int getMouseDownX() const throw();
  6873. int getMouseDownY() const throw();
  6874. const Point<int> getMouseDownPosition() const throw();
  6875. int getDistanceFromDragStart() const throw();
  6876. int getDistanceFromDragStartX() const throw();
  6877. int getDistanceFromDragStartY() const throw();
  6878. const Point<int> getOffsetFromDragStart() const throw();
  6879. bool mouseWasClicked() const throw();
  6880. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6881. int getLengthOfMousePress() const throw();
  6882. const Point<int> getPosition() const throw();
  6883. int getScreenX() const;
  6884. int getScreenY() const;
  6885. const Point<int> getScreenPosition() const;
  6886. int getMouseDownScreenX() const;
  6887. int getMouseDownScreenY() const;
  6888. const Point<int> getMouseDownScreenPosition() const;
  6889. const MouseEvent getEventRelativeTo (Component* otherComponent) const throw();
  6890. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6891. static void setDoubleClickTimeout (int timeOutMilliseconds) throw();
  6892. static int getDoubleClickTimeout() throw();
  6893. juce_UseDebuggingNewOperator
  6894. private:
  6895. const Point<int> mouseDownPos;
  6896. const Time mouseDownTime;
  6897. const int numberOfClicks;
  6898. const bool wasMovedSinceMouseDown;
  6899. MouseEvent& operator= (const MouseEvent&);
  6900. };
  6901. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6902. /*** End of inlined file: juce_MouseEvent.h ***/
  6903. /*** Start of inlined file: juce_ComponentListener.h ***/
  6904. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6905. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6906. class Component;
  6907. class JUCE_API ComponentListener
  6908. {
  6909. public:
  6910. virtual ~ComponentListener() {}
  6911. virtual void componentMovedOrResized (Component& component,
  6912. bool wasMoved,
  6913. bool wasResized);
  6914. virtual void componentBroughtToFront (Component& component);
  6915. virtual void componentVisibilityChanged (Component& component);
  6916. virtual void componentChildrenChanged (Component& component);
  6917. virtual void componentParentHierarchyChanged (Component& component);
  6918. virtual void componentNameChanged (Component& component);
  6919. virtual void componentBeingDeleted (Component& component);
  6920. };
  6921. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6922. /*** End of inlined file: juce_ComponentListener.h ***/
  6923. /*** Start of inlined file: juce_KeyListener.h ***/
  6924. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6925. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6926. /*** Start of inlined file: juce_KeyPress.h ***/
  6927. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6928. #define __JUCE_KEYPRESS_JUCEHEADER__
  6929. class JUCE_API KeyPress
  6930. {
  6931. public:
  6932. KeyPress() throw();
  6933. KeyPress (int keyCode,
  6934. const ModifierKeys& modifiers,
  6935. juce_wchar textCharacter) throw();
  6936. KeyPress (int keyCode) throw();
  6937. KeyPress (const KeyPress& other) throw();
  6938. KeyPress& operator= (const KeyPress& other) throw();
  6939. bool operator== (const KeyPress& other) const throw();
  6940. bool operator!= (const KeyPress& other) const throw();
  6941. bool isValid() const throw() { return keyCode != 0; }
  6942. int getKeyCode() const throw() { return keyCode; }
  6943. const ModifierKeys getModifiers() const throw() { return mods; }
  6944. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6945. bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6946. static const KeyPress createFromDescription (const String& textVersion);
  6947. const String getTextDescription() const;
  6948. bool isCurrentlyDown() const;
  6949. static bool isKeyCurrentlyDown (int keyCode);
  6950. // Key codes
  6951. //
  6952. // Note that the actual values of these are platform-specific and may change
  6953. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6954. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6955. //
  6956. static const int spaceKey; /**< key-code for the space bar */
  6957. static const int escapeKey; /**< key-code for the escape key */
  6958. static const int returnKey; /**< key-code for the return key*/
  6959. static const int tabKey; /**< key-code for the tab key*/
  6960. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6961. static const int backspaceKey; /**< key-code for the backspace key */
  6962. static const int insertKey; /**< key-code for the insert key */
  6963. static const int upKey; /**< key-code for the cursor-up key */
  6964. static const int downKey; /**< key-code for the cursor-down key */
  6965. static const int leftKey; /**< key-code for the cursor-left key */
  6966. static const int rightKey; /**< key-code for the cursor-right key */
  6967. static const int pageUpKey; /**< key-code for the page-up key */
  6968. static const int pageDownKey; /**< key-code for the page-down key */
  6969. static const int homeKey; /**< key-code for the home key */
  6970. static const int endKey; /**< key-code for the end key */
  6971. static const int F1Key; /**< key-code for the F1 key */
  6972. static const int F2Key; /**< key-code for the F2 key */
  6973. static const int F3Key; /**< key-code for the F3 key */
  6974. static const int F4Key; /**< key-code for the F4 key */
  6975. static const int F5Key; /**< key-code for the F5 key */
  6976. static const int F6Key; /**< key-code for the F6 key */
  6977. static const int F7Key; /**< key-code for the F7 key */
  6978. static const int F8Key; /**< key-code for the F8 key */
  6979. static const int F9Key; /**< key-code for the F9 key */
  6980. static const int F10Key; /**< key-code for the F10 key */
  6981. static const int F11Key; /**< key-code for the F11 key */
  6982. static const int F12Key; /**< key-code for the F12 key */
  6983. static const int F13Key; /**< key-code for the F13 key */
  6984. static const int F14Key; /**< key-code for the F14 key */
  6985. static const int F15Key; /**< key-code for the F15 key */
  6986. static const int F16Key; /**< key-code for the F16 key */
  6987. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6988. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6989. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6990. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6991. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6992. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6993. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6994. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6995. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6996. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6997. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6998. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6999. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  7000. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  7001. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  7002. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  7003. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  7004. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  7005. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  7006. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  7007. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  7008. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  7009. juce_UseDebuggingNewOperator
  7010. private:
  7011. int keyCode;
  7012. ModifierKeys mods;
  7013. juce_wchar textCharacter;
  7014. };
  7015. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  7016. /*** End of inlined file: juce_KeyPress.h ***/
  7017. class Component;
  7018. class JUCE_API KeyListener
  7019. {
  7020. public:
  7021. virtual ~KeyListener() {}
  7022. virtual bool keyPressed (const KeyPress& key,
  7023. Component* originatingComponent) = 0;
  7024. virtual bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  7025. };
  7026. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  7027. /*** End of inlined file: juce_KeyListener.h ***/
  7028. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  7029. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7030. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7031. class Component;
  7032. class JUCE_API KeyboardFocusTraverser
  7033. {
  7034. public:
  7035. KeyboardFocusTraverser();
  7036. virtual ~KeyboardFocusTraverser();
  7037. virtual Component* getNextComponent (Component* current);
  7038. virtual Component* getPreviousComponent (Component* current);
  7039. virtual Component* getDefaultComponent (Component* parentComponent);
  7040. };
  7041. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7042. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  7043. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  7044. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7045. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7046. /*** Start of inlined file: juce_Graphics.h ***/
  7047. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  7048. #define __JUCE_GRAPHICS_JUCEHEADER__
  7049. /*** Start of inlined file: juce_Font.h ***/
  7050. #ifndef __JUCE_FONT_JUCEHEADER__
  7051. #define __JUCE_FONT_JUCEHEADER__
  7052. /*** Start of inlined file: juce_Typeface.h ***/
  7053. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  7054. #define __JUCE_TYPEFACE_JUCEHEADER__
  7055. /*** Start of inlined file: juce_Path.h ***/
  7056. #ifndef __JUCE_PATH_JUCEHEADER__
  7057. #define __JUCE_PATH_JUCEHEADER__
  7058. /*** Start of inlined file: juce_Line.h ***/
  7059. #ifndef __JUCE_LINE_JUCEHEADER__
  7060. #define __JUCE_LINE_JUCEHEADER__
  7061. template <typename ValueType>
  7062. class Line
  7063. {
  7064. public:
  7065. Line() throw() {}
  7066. Line (const Line& other) throw()
  7067. : start (other.start),
  7068. end (other.end)
  7069. {
  7070. }
  7071. Line (ValueType startX, ValueType startY, ValueType endX, ValueType endY) throw()
  7072. : start (startX, startY),
  7073. end (endX, endY)
  7074. {
  7075. }
  7076. Line (const Point<ValueType>& startPoint,
  7077. const Point<ValueType>& endPoint) throw()
  7078. : start (startPoint),
  7079. end (endPoint)
  7080. {
  7081. }
  7082. Line& operator= (const Line& other) throw()
  7083. {
  7084. start = other.start;
  7085. end = other.end;
  7086. return *this;
  7087. }
  7088. ~Line() throw() {}
  7089. inline ValueType getStartX() const throw() { return start.getX(); }
  7090. inline ValueType getStartY() const throw() { return start.getY(); }
  7091. inline ValueType getEndX() const throw() { return end.getX(); }
  7092. inline ValueType getEndY() const throw() { return end.getY(); }
  7093. inline const Point<ValueType>& getStart() const throw() { return start; }
  7094. inline const Point<ValueType>& getEnd() const throw() { return end; }
  7095. void setStart (ValueType newStartX, ValueType newStartY) throw() { start.setXY (newStartX, newStartY); }
  7096. void setEnd (ValueType newEndX, ValueType newEndY) throw() { end.setXY (newEndX, newEndY); }
  7097. void setStart (const Point<ValueType>& newStart) throw() { start = newStart; }
  7098. void setEnd (const Point<ValueType>& newEnd) throw() { end = newEnd; }
  7099. void applyTransform (const AffineTransform& transform) throw()
  7100. {
  7101. start.applyTransform (transform);
  7102. end.applyTransform (transform);
  7103. }
  7104. ValueType getLength() const throw() { return start.getDistanceFrom (end); }
  7105. bool isVertical() const throw() { return start.getX() == end.getX(); }
  7106. bool isHorizontal() const throw() { return start.getY() == end.getY(); }
  7107. ValueType getAngle() const throw() { return start.getAngleToPoint (end); }
  7108. bool operator== (const Line& other) const throw() { return start == other.start && end == other.end; }
  7109. bool operator!= (const Line& other) const throw() { return start != other.start || end != other.end; }
  7110. bool intersects (const Line& line, Point<ValueType>& intersection) const throw()
  7111. {
  7112. return findIntersection (start, end, line.start, line.end, intersection);
  7113. }
  7114. const Point<ValueType> getPointAlongLine (ValueType distanceFromStart) const throw()
  7115. {
  7116. return start + (end - start) * (distanceFromStart / getLength());
  7117. }
  7118. const Point<ValueType> getPointAlongLine (ValueType distanceFromStart,
  7119. ValueType perpendicularDistance) const throw()
  7120. {
  7121. const Point<ValueType> delta (end - start);
  7122. const double length = juce_hypot (delta.getX(), delta.getY());
  7123. if (length == 0)
  7124. return start;
  7125. return Point<ValueType> (start.getX() + (ValueType) ((delta.getX() * distanceFromStart - delta.getY() * perpendicularDistance) / length),
  7126. start.getY() + (ValueType) ((delta.getY() * distanceFromStart + delta.getX() * perpendicularDistance) / length));
  7127. }
  7128. const Point<ValueType> getPointAlongLineProportionally (ValueType proportionOfLength) const throw()
  7129. {
  7130. return start + (end - start) * proportionOfLength;
  7131. }
  7132. ValueType getDistanceFromLine (const Point<ValueType>& point) const throw()
  7133. {
  7134. const Point<ValueType> delta (end - start);
  7135. const double length = delta.getX() * delta.getX() + delta.getY() * delta.getY();
  7136. if (length > 0)
  7137. {
  7138. const double prop = ((point.getX() - start.getX()) * delta.getX()
  7139. + (point.getY() - start.getY()) * delta.getY()) / length;
  7140. if (prop >= 0 && prop <= 1.0)
  7141. return point.getDistanceFrom (start + delta * (ValueType) prop);
  7142. }
  7143. return jmin (point.getDistanceFrom (start),
  7144. point.getDistanceFrom (end));
  7145. }
  7146. ValueType findNearestPointTo (const Point<ValueType>& point) const throw()
  7147. {
  7148. const Point<ValueType> delta (end - start);
  7149. const double length = delta.getX() * delta.getX() + delta.getY() * delta.getY();
  7150. return length <= 0 ? 0
  7151. : jlimit ((ValueType) 0, (ValueType) 1,
  7152. (ValueType) (((point.getX() - start.getX()) * delta.getX()
  7153. + (point.getY() - start.getY()) * delta.getY()) / length));
  7154. }
  7155. bool isPointAbove (const Point<ValueType>& point) const throw()
  7156. {
  7157. return start.getX() != end.getX()
  7158. && point.getY() < ((end.getY() - start.getY())
  7159. * (point.getX() - start.getX())) / (end.getX() - start.getX()) + start.getY();
  7160. }
  7161. const Line withShortenedStart (ValueType distanceToShortenBy) const throw()
  7162. {
  7163. return Line (getPointAlongLine (jmin (distanceToShortenBy, getLength())), end);
  7164. }
  7165. const Line withShortenedEnd (ValueType distanceToShortenBy) const throw()
  7166. {
  7167. const ValueType length = getLength();
  7168. return Line (start, getPointAlongLine (length - jmin (distanceToShortenBy, length)));
  7169. }
  7170. juce_UseDebuggingNewOperator
  7171. private:
  7172. Point<ValueType> start, end;
  7173. static bool findIntersection (const Point<ValueType>& p1, const Point<ValueType>& p2,
  7174. const Point<ValueType>& p3, const Point<ValueType>& p4,
  7175. Point<ValueType>& intersection) throw()
  7176. {
  7177. if (p2 == p3)
  7178. {
  7179. intersection = p2;
  7180. return true;
  7181. }
  7182. const Point<ValueType> d1 (p2 - p1);
  7183. const Point<ValueType> d2 (p4 - p2);
  7184. const ValueType divisor = d1.getX() * d2.getY() - d2.getX() * d1.getY();
  7185. if (divisor == 0)
  7186. {
  7187. if (! (d1.isOrigin() || d2.isOrigin()))
  7188. {
  7189. if (d1.getY() == 0 && d2.getY() != 0)
  7190. {
  7191. const ValueType along = (p1.getY() - p3.getY()) / d2.getY();
  7192. intersection = p1.withX (p3.getX() + along * d2.getX());
  7193. return along >= 0 && along <= (ValueType) 1;
  7194. }
  7195. else if (d2.getY() == 0 && d1.getY() != 0)
  7196. {
  7197. const ValueType along = (p3.getY() - p1.getY()) / d1.getY();
  7198. intersection = p3.withX (p1.getX() + along * d1.getX());
  7199. return along >= 0 && along <= (ValueType) 1;
  7200. }
  7201. else if (d1.getX() == 0 && d2.getX() != 0)
  7202. {
  7203. const ValueType along = (p1.getX() - p3.getX()) / d2.getX();
  7204. intersection = p1.withY (p3.getY() + along * d2.getY());
  7205. return along >= 0 && along <= (ValueType) 1;
  7206. }
  7207. else if (d2.getX() == 0 && d1.getX() != 0)
  7208. {
  7209. const ValueType along = (p3.getX() - p1.getX()) / d1.getX();
  7210. intersection = p3.withY (p1.getY() + along * d1.getY());
  7211. return along >= 0 && along <= (ValueType) 1;
  7212. }
  7213. }
  7214. intersection = (p2 + p3) / (ValueType) 2;
  7215. return false;
  7216. }
  7217. const ValueType along1 = ((p1.getY() - p3.getY()) * d2.getX() - (p1.getX() - p3.getX()) * d2.getY()) / divisor;
  7218. intersection = p1 + d1 * along1;
  7219. if (along1 < 0 || along1 > (ValueType) 1)
  7220. return false;
  7221. const ValueType along2 = ((p1.getY() - p3.getY()) * d1.getX() - (p1.getX() - p3.getX()) * d1.getY()) / divisor;
  7222. return along2 >= 0 && along2 <= (ValueType) 1;
  7223. }
  7224. };
  7225. #endif // __JUCE_LINE_JUCEHEADER__
  7226. /*** End of inlined file: juce_Line.h ***/
  7227. /*** Start of inlined file: juce_Rectangle.h ***/
  7228. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  7229. #define __JUCE_RECTANGLE_JUCEHEADER__
  7230. class RectangleList;
  7231. template <typename ValueType>
  7232. class Rectangle
  7233. {
  7234. public:
  7235. Rectangle() throw()
  7236. : x (0), y (0), w (0), h (0)
  7237. {
  7238. }
  7239. Rectangle (const Rectangle& other) throw()
  7240. : x (other.x), y (other.y),
  7241. w (other.w), h (other.h)
  7242. {
  7243. }
  7244. Rectangle (const ValueType initialX, const ValueType initialY,
  7245. const ValueType width, const ValueType height) throw()
  7246. : x (initialX), y (initialY),
  7247. w (width), h (height)
  7248. {
  7249. }
  7250. Rectangle (const ValueType width, const ValueType height) throw()
  7251. : x (0), y (0), w (width), h (height)
  7252. {
  7253. }
  7254. Rectangle (const Point<ValueType>& corner1, const Point<ValueType>& corner2) throw()
  7255. : x (jmin (corner1.getX(), corner2.getX())),
  7256. y (jmin (corner1.getY(), corner2.getY())),
  7257. w (corner1.getX() - corner2.getX()),
  7258. h (corner1.getY() - corner2.getY())
  7259. {
  7260. if (w < 0) w = -w;
  7261. if (h < 0) h = -h;
  7262. }
  7263. Rectangle& operator= (const Rectangle& other) throw()
  7264. {
  7265. x = other.x; y = other.y;
  7266. w = other.w; h = other.h;
  7267. return *this;
  7268. }
  7269. ~Rectangle() throw() {}
  7270. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  7271. inline ValueType getX() const throw() { return x; }
  7272. inline ValueType getY() const throw() { return y; }
  7273. inline ValueType getWidth() const throw() { return w; }
  7274. inline ValueType getHeight() const throw() { return h; }
  7275. inline ValueType getRight() const throw() { return x + w; }
  7276. inline ValueType getBottom() const throw() { return y + h; }
  7277. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  7278. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  7279. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  7280. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  7281. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  7282. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  7283. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  7284. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  7285. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  7286. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  7287. void setBounds (const ValueType newX, const ValueType newY,
  7288. const ValueType newWidth, const ValueType newHeight) throw()
  7289. {
  7290. x = newX; y = newY; w = newWidth; h = newHeight;
  7291. }
  7292. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  7293. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  7294. const Rectangle withX (const ValueType newX) const throw() { return Rectangle (newX, y, w, h); }
  7295. const Rectangle withY (const ValueType newY) const throw() { return Rectangle (x, newY, w, h); }
  7296. const Rectangle withWidth (const ValueType newWidth) const throw() { return Rectangle (x, y, newWidth, h); }
  7297. const Rectangle withHeight (const ValueType newHeight) const throw() { return Rectangle (x, y, w, newHeight); }
  7298. void setLeft (const ValueType newLeft) throw()
  7299. {
  7300. w = jmax (ValueType(), x + w - newLeft);
  7301. x = newLeft;
  7302. }
  7303. void setTop (const ValueType newTop) throw()
  7304. {
  7305. h = jmax (ValueType(), y + h - newTop);
  7306. y = newTop;
  7307. }
  7308. void setRight (const ValueType newRight) throw()
  7309. {
  7310. x = jmin (x, newRight);
  7311. w = newRight - x;
  7312. }
  7313. void setBottom (const ValueType newBottom) throw()
  7314. {
  7315. y = jmin (y, newBottom);
  7316. h = newBottom - y;
  7317. }
  7318. void translate (const ValueType deltaX,
  7319. const ValueType deltaY) throw()
  7320. {
  7321. x += deltaX;
  7322. y += deltaY;
  7323. }
  7324. const Rectangle translated (const ValueType deltaX,
  7325. const ValueType deltaY) const throw()
  7326. {
  7327. return Rectangle (x + deltaX, y + deltaY, w, h);
  7328. }
  7329. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  7330. {
  7331. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  7332. }
  7333. const Rectangle operator- (const Point<ValueType>& deltaPosition) const throw()
  7334. {
  7335. return Rectangle (x - deltaPosition.getX(), y - deltaPosition.getY(), w, h);
  7336. }
  7337. void expand (const ValueType deltaX,
  7338. const ValueType deltaY) throw()
  7339. {
  7340. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7341. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7342. setBounds (x - deltaX, y - deltaY, nw, nh);
  7343. }
  7344. const Rectangle expanded (const ValueType deltaX,
  7345. const ValueType deltaY) const throw()
  7346. {
  7347. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7348. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7349. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7350. }
  7351. void reduce (const ValueType deltaX,
  7352. const ValueType deltaY) throw()
  7353. {
  7354. expand (-deltaX, -deltaY);
  7355. }
  7356. const Rectangle reduced (const ValueType deltaX,
  7357. const ValueType deltaY) const throw()
  7358. {
  7359. return expanded (-deltaX, -deltaY);
  7360. }
  7361. bool operator== (const Rectangle& other) const throw()
  7362. {
  7363. return x == other.x && y == other.y
  7364. && w == other.w && h == other.h;
  7365. }
  7366. bool operator!= (const Rectangle& other) const throw()
  7367. {
  7368. return x != other.x || y != other.y
  7369. || w != other.w || h != other.h;
  7370. }
  7371. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7372. {
  7373. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7374. }
  7375. bool contains (const Point<ValueType>& point) const throw()
  7376. {
  7377. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7378. }
  7379. bool contains (const Rectangle& other) const throw()
  7380. {
  7381. return x <= other.x && y <= other.y
  7382. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7383. }
  7384. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7385. {
  7386. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7387. jlimit (y, y + h, point.getY()));
  7388. }
  7389. bool intersects (const Rectangle& other) const throw()
  7390. {
  7391. return x + w > other.x
  7392. && y + h > other.y
  7393. && x < other.x + other.w
  7394. && y < other.y + other.h
  7395. && w > ValueType() && h > ValueType();
  7396. }
  7397. const Rectangle getIntersection (const Rectangle& other) const throw()
  7398. {
  7399. const ValueType nx = jmax (x, other.x);
  7400. const ValueType ny = jmax (y, other.y);
  7401. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7402. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7403. if (nw >= ValueType() && nh >= ValueType())
  7404. return Rectangle (nx, ny, nw, nh);
  7405. return Rectangle();
  7406. }
  7407. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7408. {
  7409. const int maxX = jmax (otherX, x);
  7410. otherW = jmin (otherX + otherW, x + w) - maxX;
  7411. if (otherW > 0)
  7412. {
  7413. const int maxY = jmax (otherY, y);
  7414. otherH = jmin (otherY + otherH, y + h) - maxY;
  7415. if (otherH > 0)
  7416. {
  7417. otherX = maxX; otherY = maxY;
  7418. return true;
  7419. }
  7420. }
  7421. return false;
  7422. }
  7423. const Rectangle getUnion (const Rectangle& other) const throw()
  7424. {
  7425. const ValueType newX = jmin (x, other.x);
  7426. const ValueType newY = jmin (y, other.y);
  7427. return Rectangle (newX, newY,
  7428. jmax (x + w, other.x + other.w) - newX,
  7429. jmax (y + h, other.y + other.h) - newY);
  7430. }
  7431. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7432. {
  7433. if (x == other.x && getRight() == other.getRight()
  7434. && (other.getBottom() >= y && other.y <= getBottom()))
  7435. {
  7436. const ValueType newY = jmin (y, other.y);
  7437. h = jmax (getBottom(), other.getBottom()) - newY;
  7438. y = newY;
  7439. return true;
  7440. }
  7441. else if (y == other.y && getBottom() == other.getBottom()
  7442. && (other.getRight() >= x && other.x <= getRight()))
  7443. {
  7444. const ValueType newX = jmin (x, other.x);
  7445. w = jmax (getRight(), other.getRight()) - newX;
  7446. x = newX;
  7447. return true;
  7448. }
  7449. return false;
  7450. }
  7451. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7452. {
  7453. int inside = 0;
  7454. const int otherR = other.getRight();
  7455. if (x >= other.x && x < otherR) inside = 1;
  7456. const int otherB = other.getBottom();
  7457. if (y >= other.y && y < otherB) inside |= 2;
  7458. const int r = x + w;
  7459. if (r >= other.x && r < otherR) inside |= 4;
  7460. const int b = y + h;
  7461. if (b >= other.y && b < otherB) inside |= 8;
  7462. switch (inside)
  7463. {
  7464. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7465. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7466. case 2 + 4 + 8: w = other.x - x; return true;
  7467. case 1 + 4 + 8: h = other.y - y; return true;
  7468. }
  7469. return false;
  7470. }
  7471. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7472. {
  7473. float x1 = x, y1 = y;
  7474. float x2 = x + w, y2 = y;
  7475. float x3 = x, y3 = y + h;
  7476. float x4 = x2, y4 = y3;
  7477. transform.transformPoint (x1, y1);
  7478. transform.transformPoint (x2, y2);
  7479. transform.transformPoint (x3, y3);
  7480. transform.transformPoint (x4, y4);
  7481. const float x = jmin (x1, x2, x3, x4);
  7482. const float y = jmin (y1, y2, y3, y4);
  7483. return Rectangle (x, y,
  7484. jmax (x1, x2, x3, x4) - x,
  7485. jmax (y1, y2, y3, y4) - y);
  7486. }
  7487. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7488. {
  7489. const int x1 = (int) floorf ((float) x);
  7490. const int y1 = (int) floorf ((float) y);
  7491. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7492. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7493. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7494. }
  7495. const Rectangle<float> toFloat() const throw()
  7496. {
  7497. return Rectangle<float> (static_cast<float> (x), static_cast<float> (y),
  7498. static_cast<float> (w), static_cast<float> (h));
  7499. }
  7500. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7501. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7502. {
  7503. const ValueType x = jmax (x1, x2);
  7504. w1 = jmin (x1 + w1, x2 + w2) - x;
  7505. if (w1 > 0)
  7506. {
  7507. const ValueType y = jmax (y1, y2);
  7508. h1 = jmin (y1 + h1, y2 + h2) - y;
  7509. if (h1 > 0)
  7510. {
  7511. x1 = x; y1 = y;
  7512. return true;
  7513. }
  7514. }
  7515. return false;
  7516. }
  7517. const String toString() const
  7518. {
  7519. String s;
  7520. s.preallocateStorage (16);
  7521. s << x << ' ' << y << ' ' << w << ' ' << h;
  7522. return s;
  7523. }
  7524. static const Rectangle fromString (const String& stringVersion)
  7525. {
  7526. StringArray toks;
  7527. toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
  7528. return Rectangle (toks[0].trim().getIntValue(),
  7529. toks[1].trim().getIntValue(),
  7530. toks[2].trim().getIntValue(),
  7531. toks[3].trim().getIntValue());
  7532. }
  7533. juce_UseDebuggingNewOperator
  7534. private:
  7535. friend class RectangleList;
  7536. ValueType x, y, w, h;
  7537. };
  7538. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7539. /*** End of inlined file: juce_Rectangle.h ***/
  7540. /*** Start of inlined file: juce_Justification.h ***/
  7541. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7542. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7543. class JUCE_API Justification
  7544. {
  7545. public:
  7546. inline Justification (int flags_) throw() : flags (flags_) {}
  7547. Justification (const Justification& other) throw();
  7548. Justification& operator= (const Justification& other) throw();
  7549. inline int getFlags() const throw() { return flags; }
  7550. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7551. int getOnlyVerticalFlags() const throw();
  7552. int getOnlyHorizontalFlags() const throw();
  7553. void applyToRectangle (int& x, int& y, int w, int h,
  7554. int spaceX, int spaceY, int spaceW, int spaceH) const throw();
  7555. enum
  7556. {
  7557. left = 1,
  7558. right = 2,
  7559. horizontallyCentred = 4,
  7560. top = 8,
  7561. bottom = 16,
  7562. verticallyCentred = 32,
  7563. horizontallyJustified = 64,
  7564. centred = 36,
  7565. centredLeft = 33,
  7566. centredRight = 34,
  7567. centredTop = 12,
  7568. centredBottom = 20,
  7569. topLeft = 9,
  7570. topRight = 10,
  7571. bottomLeft = 17,
  7572. bottomRight = 18
  7573. };
  7574. private:
  7575. int flags;
  7576. };
  7577. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7578. /*** End of inlined file: juce_Justification.h ***/
  7579. /*** Start of inlined file: juce_EdgeTable.h ***/
  7580. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7581. #define __JUCE_EDGETABLE_JUCEHEADER__
  7582. class Path;
  7583. class RectangleList;
  7584. class Image;
  7585. class JUCE_API EdgeTable
  7586. {
  7587. public:
  7588. EdgeTable (const Rectangle<int>& clipLimits,
  7589. const Path& pathToAdd,
  7590. const AffineTransform& transform);
  7591. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7592. EdgeTable (const RectangleList& rectanglesToAdd);
  7593. EdgeTable (float x, float y, float w, float h);
  7594. EdgeTable (const EdgeTable& other);
  7595. EdgeTable& operator= (const EdgeTable& other);
  7596. ~EdgeTable();
  7597. void clipToRectangle (const Rectangle<int>& r) throw();
  7598. void excludeRectangle (const Rectangle<int>& r) throw();
  7599. void clipToEdgeTable (const EdgeTable& other);
  7600. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7601. bool isEmpty() throw();
  7602. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7603. void translate (float dx, int dy) throw();
  7604. void optimiseTable() throw();
  7605. template <class EdgeTableIterationCallback>
  7606. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7607. {
  7608. const int* lineStart = table;
  7609. for (int y = 0; y < bounds.getHeight(); ++y)
  7610. {
  7611. const int* line = lineStart;
  7612. lineStart += lineStrideElements;
  7613. int numPoints = line[0];
  7614. if (--numPoints > 0)
  7615. {
  7616. int x = *++line;
  7617. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7618. int levelAccumulator = 0;
  7619. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7620. while (--numPoints >= 0)
  7621. {
  7622. const int level = *++line;
  7623. jassert (((unsigned int) level) < (unsigned int) 256);
  7624. const int endX = *++line;
  7625. jassert (endX >= x);
  7626. const int endOfRun = (endX >> 8);
  7627. if (endOfRun == (x >> 8))
  7628. {
  7629. // small segment within the same pixel, so just save it for the next
  7630. // time round..
  7631. levelAccumulator += (endX - x) * level;
  7632. }
  7633. else
  7634. {
  7635. // plot the fist pixel of this segment, including any accumulated
  7636. // levels from smaller segments that haven't been drawn yet
  7637. levelAccumulator += (0xff - (x & 0xff)) * level;
  7638. levelAccumulator >>= 8;
  7639. x >>= 8;
  7640. if (levelAccumulator > 0)
  7641. {
  7642. if (levelAccumulator >> 8)
  7643. levelAccumulator = 0xff;
  7644. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7645. }
  7646. // if there's a run of similar pixels, do it all in one go..
  7647. if (level > 0)
  7648. {
  7649. jassert (endOfRun <= bounds.getRight());
  7650. const int numPix = endOfRun - ++x;
  7651. if (numPix > 0)
  7652. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7653. }
  7654. // save the bit at the end to be drawn next time round the loop.
  7655. levelAccumulator = (endX & 0xff) * level;
  7656. }
  7657. x = endX;
  7658. }
  7659. if (levelAccumulator > 0)
  7660. {
  7661. levelAccumulator >>= 8;
  7662. if (levelAccumulator >> 8)
  7663. levelAccumulator = 0xff;
  7664. x >>= 8;
  7665. jassert (x >= bounds.getX() && x < bounds.getRight());
  7666. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7667. }
  7668. }
  7669. }
  7670. }
  7671. juce_UseDebuggingNewOperator
  7672. private:
  7673. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7674. HeapBlock<int> table;
  7675. Rectangle<int> bounds;
  7676. int maxEdgesPerLine, lineStrideElements;
  7677. bool needToCheckEmptinesss;
  7678. void addEdgePoint (int x, int y, int winding) throw();
  7679. void remapTableForNumEdges (int newNumEdgesPerLine) throw();
  7680. void intersectWithEdgeTableLine (int y, const int* otherLine) throw();
  7681. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7682. void sanitiseLevels (bool useNonZeroWinding) throw();
  7683. static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw();
  7684. };
  7685. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7686. /*** End of inlined file: juce_EdgeTable.h ***/
  7687. class Image;
  7688. class JUCE_API Path
  7689. {
  7690. public:
  7691. Path();
  7692. Path (const Path& other);
  7693. ~Path();
  7694. Path& operator= (const Path& other);
  7695. bool isEmpty() const throw();
  7696. const Rectangle<float> getBounds() const throw();
  7697. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7698. bool contains (float x, float y,
  7699. float tolerence = 10.0f) const;
  7700. bool contains (const Point<float>& point,
  7701. float tolerence = 10.0f) const;
  7702. bool intersectsLine (const Line<float>& line,
  7703. float tolerence = 10.0f);
  7704. const Line<float> getClippedLine (const Line<float>& line, bool keepSectionOutsidePath) const;
  7705. void clear() throw();
  7706. void startNewSubPath (float startX, float startY);
  7707. void closeSubPath();
  7708. void lineTo (float endX, float endY);
  7709. void quadraticTo (float controlPointX,
  7710. float controlPointY,
  7711. float endPointX,
  7712. float endPointY);
  7713. void cubicTo (float controlPoint1X,
  7714. float controlPoint1Y,
  7715. float controlPoint2X,
  7716. float controlPoint2Y,
  7717. float endPointX,
  7718. float endPointY);
  7719. const Point<float> getCurrentPosition() const;
  7720. void addRectangle (float x, float y, float width, float height);
  7721. void addRectangle (const Rectangle<int>& rectangle);
  7722. void addRoundedRectangle (float x, float y, float width, float height,
  7723. float cornerSize);
  7724. void addRoundedRectangle (float x, float y, float width, float height,
  7725. float cornerSizeX,
  7726. float cornerSizeY);
  7727. void addTriangle (float x1, float y1,
  7728. float x2, float y2,
  7729. float x3, float y3);
  7730. void addQuadrilateral (float x1, float y1,
  7731. float x2, float y2,
  7732. float x3, float y3,
  7733. float x4, float y4);
  7734. void addEllipse (float x, float y, float width, float height);
  7735. void addArc (float x, float y, float width, float height,
  7736. float fromRadians,
  7737. float toRadians,
  7738. bool startAsNewSubPath = false);
  7739. void addCentredArc (float centreX, float centreY,
  7740. float radiusX, float radiusY,
  7741. float rotationOfEllipse,
  7742. float fromRadians,
  7743. float toRadians,
  7744. bool startAsNewSubPath = false);
  7745. void addPieSegment (float x, float y,
  7746. float width, float height,
  7747. float fromRadians,
  7748. float toRadians,
  7749. float innerCircleProportionalSize);
  7750. void addLineSegment (float startX, float startY,
  7751. float endX, float endY,
  7752. float lineThickness);
  7753. void addArrow (float startX, float startY,
  7754. float endX, float endY,
  7755. float lineThickness,
  7756. float arrowheadWidth,
  7757. float arrowheadLength);
  7758. void addStar (float centreX,
  7759. float centreY,
  7760. int numberOfPoints,
  7761. float innerRadius,
  7762. float outerRadius,
  7763. float startAngle = 0.0f);
  7764. void addBubble (float bodyX, float bodyY,
  7765. float bodyW, float bodyH,
  7766. float cornerSize,
  7767. float arrowTipX,
  7768. float arrowTipY,
  7769. int whichSide,
  7770. float arrowPositionAlongEdgeProportional,
  7771. float arrowWidth);
  7772. void addPath (const Path& pathToAppend);
  7773. void addPath (const Path& pathToAppend,
  7774. const AffineTransform& transformToApply);
  7775. void swapWithPath (Path& other);
  7776. void applyTransform (const AffineTransform& transform) throw();
  7777. void scaleToFit (float x, float y, float width, float height,
  7778. bool preserveProportions) throw();
  7779. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7780. bool preserveProportions,
  7781. const Justification& justificationType = Justification::centred) const;
  7782. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7783. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7784. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7785. class JUCE_API Iterator
  7786. {
  7787. public:
  7788. Iterator (const Path& path);
  7789. ~Iterator();
  7790. bool next();
  7791. enum PathElementType
  7792. {
  7793. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7794. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7795. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7796. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7797. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7798. };
  7799. PathElementType elementType;
  7800. float x1, y1, x2, y2, x3, y3;
  7801. private:
  7802. const Path& path;
  7803. size_t index;
  7804. Iterator (const Iterator&);
  7805. Iterator& operator= (const Iterator&);
  7806. };
  7807. void loadPathFromStream (InputStream& source);
  7808. void loadPathFromData (const void* data, int numberOfBytes);
  7809. void writePathToStream (OutputStream& destination) const;
  7810. const String toString() const;
  7811. void restoreFromString (const String& stringVersion);
  7812. juce_UseDebuggingNewOperator
  7813. private:
  7814. friend class PathFlatteningIterator;
  7815. friend class Path::Iterator;
  7816. ArrayAllocationBase <float, DummyCriticalSection> data;
  7817. size_t numElements;
  7818. float pathXMin, pathXMax, pathYMin, pathYMax;
  7819. bool useNonZeroWinding;
  7820. static const float lineMarker;
  7821. static const float moveMarker;
  7822. static const float quadMarker;
  7823. static const float cubicMarker;
  7824. static const float closeSubPathMarker;
  7825. };
  7826. #endif // __JUCE_PATH_JUCEHEADER__
  7827. /*** End of inlined file: juce_Path.h ***/
  7828. class Font;
  7829. class JUCE_API Typeface : public ReferenceCountedObject
  7830. {
  7831. public:
  7832. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7833. const String getName() const throw() { return name; }
  7834. static const Ptr createSystemTypefaceFor (const Font& font);
  7835. virtual ~Typeface();
  7836. virtual float getAscent() const = 0;
  7837. virtual float getDescent() const = 0;
  7838. virtual float getStringWidth (const String& text) = 0;
  7839. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7840. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7841. juce_UseDebuggingNewOperator
  7842. protected:
  7843. String name;
  7844. explicit Typeface (const String& name) throw();
  7845. private:
  7846. Typeface (const Typeface&);
  7847. Typeface& operator= (const Typeface&);
  7848. };
  7849. class JUCE_API CustomTypeface : public Typeface
  7850. {
  7851. public:
  7852. CustomTypeface();
  7853. explicit CustomTypeface (InputStream& serialisedTypefaceStream);
  7854. ~CustomTypeface();
  7855. void clear();
  7856. void setCharacteristics (const String& name, float ascent,
  7857. bool isBold, bool isItalic,
  7858. juce_wchar defaultCharacter) throw();
  7859. void addGlyph (juce_wchar character, const Path& path, float width) throw();
  7860. void addKerningPair (juce_wchar char1, juce_wchar char2, float extraAmount) throw();
  7861. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7862. bool writeToStream (OutputStream& outputStream);
  7863. // The following methods implement the basic Typeface behaviour.
  7864. float getAscent() const;
  7865. float getDescent() const;
  7866. float getStringWidth (const String& text);
  7867. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7868. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7869. int getGlyphForCharacter (juce_wchar character);
  7870. juce_UseDebuggingNewOperator
  7871. protected:
  7872. juce_wchar defaultCharacter;
  7873. float ascent;
  7874. bool isBold, isItalic;
  7875. virtual bool loadGlyphIfPossible (juce_wchar characterNeeded);
  7876. private:
  7877. class GlyphInfo;
  7878. friend class OwnedArray<GlyphInfo>;
  7879. OwnedArray <GlyphInfo> glyphs;
  7880. short lookupTable [128];
  7881. CustomTypeface (const CustomTypeface&);
  7882. CustomTypeface& operator= (const CustomTypeface&);
  7883. GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) throw();
  7884. GlyphInfo* findGlyphSubstituting (juce_wchar character) throw();
  7885. };
  7886. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7887. /*** End of inlined file: juce_Typeface.h ***/
  7888. class LowLevelGraphicsContext;
  7889. class JUCE_API Font
  7890. {
  7891. public:
  7892. enum FontStyleFlags
  7893. {
  7894. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7895. bold = 1, /**< boldens the font. @see setStyleFlags */
  7896. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7897. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7898. };
  7899. Font (float fontHeight,
  7900. int styleFlags = plain) throw();
  7901. Font (const String& typefaceName,
  7902. float fontHeight,
  7903. int styleFlags) throw();
  7904. Font (const Font& other) throw();
  7905. Font (const Typeface::Ptr& typeface) throw();
  7906. Font() throw();
  7907. Font& operator= (const Font& other) throw();
  7908. bool operator== (const Font& other) const throw();
  7909. bool operator!= (const Font& other) const throw();
  7910. ~Font() throw();
  7911. void setTypefaceName (const String& faceName) throw();
  7912. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7913. static const String getDefaultSansSerifFontName() throw();
  7914. static const String getDefaultSerifFontName() throw();
  7915. static const String getDefaultMonospacedFontName() throw();
  7916. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
  7917. float getHeight() const throw() { return font->height; }
  7918. void setHeight (float newHeight) throw();
  7919. void setHeightWithoutChangingWidth (float newHeight) throw();
  7920. float getAscent() const throw();
  7921. float getDescent() const throw();
  7922. int getStyleFlags() const throw() { return font->styleFlags; }
  7923. void setStyleFlags (const int newFlags) throw();
  7924. void setBold (bool shouldBeBold) throw();
  7925. bool isBold() const throw();
  7926. void setItalic (bool shouldBeItalic) throw();
  7927. bool isItalic() const throw();
  7928. void setUnderline (bool shouldBeUnderlined) throw();
  7929. bool isUnderlined() const throw();
  7930. void setHorizontalScale (float scaleFactor) throw();
  7931. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7932. void setExtraKerningFactor (float extraKerning) throw();
  7933. float getExtraKerningFactor() const throw() { return font->kerning; }
  7934. void setSizeAndStyle (float newHeight,
  7935. int newStyleFlags,
  7936. float newHorizontalScale,
  7937. float newKerningAmount) throw();
  7938. int getStringWidth (const String& text) const throw();
  7939. float getStringWidthFloat (const String& text) const throw();
  7940. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7941. Typeface* getTypeface() const throw();
  7942. static void findFonts (Array<Font>& results) throw();
  7943. static const StringArray findAllTypefaceNames();
  7944. static const String getFallbackFontName() throw();
  7945. static void setFallbackFontName (const String& name) throw();
  7946. juce_UseDebuggingNewOperator
  7947. private:
  7948. friend class FontGlyphAlphaMap;
  7949. friend class TypefaceCache;
  7950. class SharedFontInternal : public ReferenceCountedObject
  7951. {
  7952. public:
  7953. SharedFontInternal (const String& typefaceName, float height, float horizontalScale,
  7954. float kerning, float ascent, int styleFlags,
  7955. Typeface* typeface) throw();
  7956. SharedFontInternal (const SharedFontInternal& other) throw();
  7957. String typefaceName;
  7958. float height, horizontalScale, kerning, ascent;
  7959. int styleFlags;
  7960. Typeface::Ptr typeface;
  7961. };
  7962. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7963. void dupeInternalIfShared() throw();
  7964. };
  7965. #endif // __JUCE_FONT_JUCEHEADER__
  7966. /*** End of inlined file: juce_Font.h ***/
  7967. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7968. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7969. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7970. class JUCE_API PathStrokeType
  7971. {
  7972. public:
  7973. enum JointStyle
  7974. {
  7975. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7976. Note that for angles that curve back on themselves, drawing a
  7977. mitre could require extending the point too far away from the
  7978. path, so a mitre limit is imposed and any corners that exceed it
  7979. are drawn as bevelled instead. */
  7980. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7981. beveled /**< Indicates that corners should be drawn with a line flattening their
  7982. outside edge. */
  7983. };
  7984. enum EndCapStyle
  7985. {
  7986. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7987. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7988. the thickness of the stroke. */
  7989. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7990. };
  7991. PathStrokeType (float strokeThickness,
  7992. JointStyle jointStyle = mitered,
  7993. EndCapStyle endStyle = butt) throw();
  7994. PathStrokeType (const PathStrokeType& other) throw();
  7995. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7996. ~PathStrokeType() throw();
  7997. void createStrokedPath (Path& destPath,
  7998. const Path& sourcePath,
  7999. const AffineTransform& transform = AffineTransform::identity,
  8000. float extraAccuracy = 1.0f) const;
  8001. void createDashedStroke (Path& destPath,
  8002. const Path& sourcePath,
  8003. const float* dashLengths,
  8004. int numDashLengths,
  8005. const AffineTransform& transform = AffineTransform::identity,
  8006. float extraAccuracy = 1.0f) const;
  8007. float getStrokeThickness() const throw() { return thickness; }
  8008. JointStyle getJointStyle() const throw() { return jointStyle; }
  8009. EndCapStyle getEndStyle() const throw() { return endStyle; }
  8010. juce_UseDebuggingNewOperator
  8011. bool operator== (const PathStrokeType& other) const throw();
  8012. bool operator!= (const PathStrokeType& other) const throw();
  8013. private:
  8014. float thickness;
  8015. JointStyle jointStyle;
  8016. EndCapStyle endStyle;
  8017. };
  8018. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  8019. /*** End of inlined file: juce_PathStrokeType.h ***/
  8020. /*** Start of inlined file: juce_Colours.h ***/
  8021. #ifndef __JUCE_COLOURS_JUCEHEADER__
  8022. #define __JUCE_COLOURS_JUCEHEADER__
  8023. /*** Start of inlined file: juce_Colour.h ***/
  8024. #ifndef __JUCE_COLOUR_JUCEHEADER__
  8025. #define __JUCE_COLOUR_JUCEHEADER__
  8026. /*** Start of inlined file: juce_PixelFormats.h ***/
  8027. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  8028. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  8029. #if JUCE_MSVC
  8030. #pragma pack (push, 1)
  8031. #define PACKED
  8032. #elif JUCE_GCC
  8033. #define PACKED __attribute__((packed))
  8034. #else
  8035. #define PACKED
  8036. #endif
  8037. class PixelRGB;
  8038. class PixelAlpha;
  8039. class JUCE_API PixelARGB
  8040. {
  8041. public:
  8042. PixelARGB() throw() {}
  8043. ~PixelARGB() throw() {}
  8044. PixelARGB (const uint32 argb_) throw()
  8045. : argb (argb_)
  8046. {
  8047. }
  8048. forcedinline uint32 getARGB() const throw() { return argb; }
  8049. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  8050. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  8051. forcedinline uint8 getAlpha() const throw() { return components.a; }
  8052. forcedinline uint8 getRed() const throw() { return components.r; }
  8053. forcedinline uint8 getGreen() const throw() { return components.g; }
  8054. forcedinline uint8 getBlue() const throw() { return components.b; }
  8055. forcedinline void blend (const PixelARGB& src) throw()
  8056. {
  8057. uint32 sargb = src.getARGB();
  8058. const uint32 alpha = 0x100 - (sargb >> 24);
  8059. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8060. sargb += 0xff00ff00 & (getAG() * alpha);
  8061. argb = sargb;
  8062. }
  8063. forcedinline void blend (const PixelAlpha& src) throw();
  8064. forcedinline void blend (const PixelRGB& src) throw();
  8065. template <class Pixel>
  8066. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8067. {
  8068. ++extraAlpha;
  8069. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  8070. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  8071. const uint32 alpha = 0x100 - (sargb >> 24);
  8072. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8073. sargb += 0xff00ff00 & (getAG() * alpha);
  8074. argb = sargb;
  8075. }
  8076. template <class Pixel>
  8077. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8078. {
  8079. uint32 drb = getRB();
  8080. drb += (((src.getRB() - drb) * amount) >> 8);
  8081. drb &= 0x00ff00ff;
  8082. uint32 dag = getAG();
  8083. dag += (((src.getAG() - dag) * amount) >> 8);
  8084. dag &= 0x00ff00ff;
  8085. dag <<= 8;
  8086. dag |= drb;
  8087. argb = dag;
  8088. }
  8089. template <class Pixel>
  8090. forcedinline void set (const Pixel& src) throw()
  8091. {
  8092. argb = src.getARGB();
  8093. }
  8094. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8095. {
  8096. components.a = newAlpha;
  8097. }
  8098. forcedinline void multiplyAlpha (int multiplier) throw()
  8099. {
  8100. ++multiplier;
  8101. argb = ((multiplier * getAG()) & 0xff00ff00)
  8102. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  8103. }
  8104. forcedinline void multiplyAlpha (const float multiplier) throw()
  8105. {
  8106. multiplyAlpha ((int) (multiplier * 256.0f));
  8107. }
  8108. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  8109. {
  8110. components.b = b;
  8111. components.g = g;
  8112. components.r = r;
  8113. components.a = a;
  8114. }
  8115. forcedinline void premultiply() throw()
  8116. {
  8117. const uint32 alpha = components.a;
  8118. if (alpha < 0xff)
  8119. {
  8120. if (alpha == 0)
  8121. {
  8122. components.b = 0;
  8123. components.g = 0;
  8124. components.r = 0;
  8125. }
  8126. else
  8127. {
  8128. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  8129. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  8130. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  8131. }
  8132. }
  8133. }
  8134. forcedinline void unpremultiply() throw()
  8135. {
  8136. const uint32 alpha = components.a;
  8137. if (alpha < 0xff)
  8138. {
  8139. if (alpha == 0)
  8140. {
  8141. components.b = 0;
  8142. components.g = 0;
  8143. components.r = 0;
  8144. }
  8145. else
  8146. {
  8147. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  8148. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  8149. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  8150. }
  8151. }
  8152. }
  8153. forcedinline void desaturate() throw()
  8154. {
  8155. if (components.a < 0xff && components.a > 0)
  8156. {
  8157. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  8158. components.r = components.g = components.b
  8159. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  8160. }
  8161. else
  8162. {
  8163. components.r = components.g = components.b
  8164. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  8165. }
  8166. }
  8167. #if JUCE_BIG_ENDIAN
  8168. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  8169. #else
  8170. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  8171. #endif
  8172. private:
  8173. union
  8174. {
  8175. uint32 argb;
  8176. struct
  8177. {
  8178. #if JUCE_BIG_ENDIAN
  8179. uint8 a : 8, r : 8, g : 8, b : 8;
  8180. #else
  8181. uint8 b, g, r, a;
  8182. #endif
  8183. } PACKED components;
  8184. };
  8185. } PACKED;
  8186. class JUCE_API PixelRGB
  8187. {
  8188. public:
  8189. PixelRGB() throw() {}
  8190. ~PixelRGB() throw() {}
  8191. PixelRGB (const uint32 argb) throw()
  8192. {
  8193. r = (uint8) (argb >> 16);
  8194. g = (uint8) (argb >> 8);
  8195. b = (uint8) (argb);
  8196. }
  8197. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  8198. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  8199. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  8200. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  8201. forcedinline uint8 getRed() const throw() { return r; }
  8202. forcedinline uint8 getGreen() const throw() { return g; }
  8203. forcedinline uint8 getBlue() const throw() { return b; }
  8204. forcedinline void blend (const PixelARGB& src) throw()
  8205. {
  8206. uint32 sargb = src.getARGB();
  8207. const uint32 alpha = 0x100 - (sargb >> 24);
  8208. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8209. sargb += 0x0000ff00 & (g * alpha);
  8210. r = (uint8) (sargb >> 16);
  8211. g = (uint8) (sargb >> 8);
  8212. b = (uint8) sargb;
  8213. }
  8214. forcedinline void blend (const PixelRGB& src) throw()
  8215. {
  8216. set (src);
  8217. }
  8218. forcedinline void blend (const PixelAlpha& src) throw();
  8219. template <class Pixel>
  8220. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8221. {
  8222. ++extraAlpha;
  8223. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  8224. const uint32 sag = extraAlpha * src.getAG();
  8225. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  8226. const uint32 alpha = 0x100 - (sargb >> 24);
  8227. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8228. sargb += 0x0000ff00 & (g * alpha);
  8229. b = (uint8) sargb;
  8230. g = (uint8) (sargb >> 8);
  8231. r = (uint8) (sargb >> 16);
  8232. }
  8233. template <class Pixel>
  8234. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8235. {
  8236. uint32 drb = getRB();
  8237. drb += (((src.getRB() - drb) * amount) >> 8);
  8238. uint32 dag = getAG();
  8239. dag += (((src.getAG() - dag) * amount) >> 8);
  8240. b = (uint8) drb;
  8241. g = (uint8) dag;
  8242. r = (uint8) (drb >> 16);
  8243. }
  8244. template <class Pixel>
  8245. forcedinline void set (const Pixel& src) throw()
  8246. {
  8247. b = src.getBlue();
  8248. g = src.getGreen();
  8249. r = src.getRed();
  8250. }
  8251. forcedinline void setAlpha (const uint8) throw() {}
  8252. forcedinline void multiplyAlpha (int) throw() {}
  8253. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  8254. {
  8255. r = r_;
  8256. g = g_;
  8257. b = b_;
  8258. }
  8259. forcedinline void premultiply() throw() {}
  8260. forcedinline void unpremultiply() throw() {}
  8261. forcedinline void desaturate() throw()
  8262. {
  8263. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  8264. }
  8265. #if JUCE_MAC
  8266. enum { indexR = 0, indexG = 1, indexB = 2 };
  8267. #else
  8268. enum { indexR = 2, indexG = 1, indexB = 0 };
  8269. #endif
  8270. private:
  8271. #if JUCE_MAC
  8272. uint8 r, g, b;
  8273. #else
  8274. uint8 b, g, r;
  8275. #endif
  8276. } PACKED;
  8277. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  8278. {
  8279. set (src);
  8280. }
  8281. class JUCE_API PixelAlpha
  8282. {
  8283. public:
  8284. PixelAlpha() throw() {}
  8285. ~PixelAlpha() throw() {}
  8286. PixelAlpha (const uint32 argb) throw()
  8287. {
  8288. a = (uint8) (argb >> 24);
  8289. }
  8290. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8291. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8292. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8293. forcedinline uint8 getAlpha() const throw() { return a; }
  8294. forcedinline uint8 getRed() const throw() { return 0; }
  8295. forcedinline uint8 getGreen() const throw() { return 0; }
  8296. forcedinline uint8 getBlue() const throw() { return 0; }
  8297. template <class Pixel>
  8298. forcedinline void blend (const Pixel& src) throw()
  8299. {
  8300. const int srcA = src.getAlpha();
  8301. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8302. }
  8303. template <class Pixel>
  8304. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8305. {
  8306. ++extraAlpha;
  8307. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8308. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8309. }
  8310. template <class Pixel>
  8311. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8312. {
  8313. a += ((src,getAlpha() - a) * amount) >> 8;
  8314. }
  8315. template <class Pixel>
  8316. forcedinline void set (const Pixel& src) throw()
  8317. {
  8318. a = src.getAlpha();
  8319. }
  8320. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8321. {
  8322. a = newAlpha;
  8323. }
  8324. forcedinline void multiplyAlpha (int multiplier) throw()
  8325. {
  8326. ++multiplier;
  8327. a = (uint8) ((a * multiplier) >> 8);
  8328. }
  8329. forcedinline void multiplyAlpha (const float multiplier) throw()
  8330. {
  8331. a = (uint8) (a * multiplier);
  8332. }
  8333. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8334. {
  8335. a = a_;
  8336. }
  8337. forcedinline void premultiply() throw()
  8338. {
  8339. }
  8340. forcedinline void unpremultiply() throw()
  8341. {
  8342. }
  8343. forcedinline void desaturate() throw()
  8344. {
  8345. }
  8346. enum { indexA = 0 };
  8347. private:
  8348. uint8 a : 8;
  8349. } PACKED;
  8350. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8351. {
  8352. blend (PixelARGB (src.getARGB()));
  8353. }
  8354. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8355. {
  8356. uint32 sargb = src.getARGB();
  8357. const uint32 alpha = 0x100 - (sargb >> 24);
  8358. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8359. sargb += 0xff00ff00 & (getAG() * alpha);
  8360. argb = sargb;
  8361. }
  8362. #if JUCE_MSVC
  8363. #pragma pack (pop)
  8364. #endif
  8365. #undef PACKED
  8366. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8367. /*** End of inlined file: juce_PixelFormats.h ***/
  8368. class JUCE_API Colour
  8369. {
  8370. public:
  8371. Colour() throw();
  8372. Colour (const Colour& other) throw();
  8373. explicit Colour (uint32 argb) throw();
  8374. Colour (uint8 red,
  8375. uint8 green,
  8376. uint8 blue) throw();
  8377. static const Colour fromRGB (uint8 red,
  8378. uint8 green,
  8379. uint8 blue) throw();
  8380. Colour (uint8 red,
  8381. uint8 green,
  8382. uint8 blue,
  8383. uint8 alpha) throw();
  8384. static const Colour fromRGBA (uint8 red,
  8385. uint8 green,
  8386. uint8 blue,
  8387. uint8 alpha) throw();
  8388. Colour (uint8 red,
  8389. uint8 green,
  8390. uint8 blue,
  8391. float alpha) throw();
  8392. static const Colour fromRGBAFloat (uint8 red,
  8393. uint8 green,
  8394. uint8 blue,
  8395. float alpha) throw();
  8396. Colour (float hue,
  8397. float saturation,
  8398. float brightness,
  8399. uint8 alpha) throw();
  8400. Colour (float hue,
  8401. float saturation,
  8402. float brightness,
  8403. float alpha) throw();
  8404. static const Colour fromHSV (float hue,
  8405. float saturation,
  8406. float brightness,
  8407. float alpha) throw();
  8408. ~Colour() throw();
  8409. Colour& operator= (const Colour& other) throw();
  8410. bool operator== (const Colour& other) const throw();
  8411. bool operator!= (const Colour& other) const throw();
  8412. uint8 getRed() const throw() { return argb.getRed(); }
  8413. uint8 getGreen() const throw() { return argb.getGreen(); }
  8414. uint8 getBlue() const throw() { return argb.getBlue(); }
  8415. float getFloatRed() const throw();
  8416. float getFloatGreen() const throw();
  8417. float getFloatBlue() const throw();
  8418. const PixelARGB getPixelARGB() const throw();
  8419. uint32 getARGB() const throw();
  8420. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8421. float getFloatAlpha() const throw();
  8422. bool isOpaque() const throw();
  8423. bool isTransparent() const throw();
  8424. const Colour withAlpha (uint8 newAlpha) const throw();
  8425. const Colour withAlpha (float newAlpha) const throw();
  8426. const Colour withMultipliedAlpha (float alphaMultiplier) const throw();
  8427. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8428. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8429. float getHue() const throw();
  8430. float getSaturation() const throw();
  8431. float getBrightness() const throw();
  8432. void getHSB (float& hue,
  8433. float& saturation,
  8434. float& brightness) const throw();
  8435. const Colour withHue (float newHue) const throw();
  8436. const Colour withSaturation (float newSaturation) const throw();
  8437. const Colour withBrightness (float newBrightness) const throw();
  8438. const Colour withRotatedHue (float amountToRotate) const throw();
  8439. const Colour withMultipliedSaturation (float multiplier) const throw();
  8440. const Colour withMultipliedBrightness (float amount) const throw();
  8441. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8442. const Colour darker (float amountDarker = 0.4f) const throw();
  8443. const Colour contrasting (float amount = 1.0f) const throw();
  8444. static const Colour contrasting (const Colour& colour1,
  8445. const Colour& colour2) throw();
  8446. static const Colour greyLevel (float brightness) throw();
  8447. const String toString() const;
  8448. static const Colour fromString (const String& encodedColourString);
  8449. const String toDisplayString (bool includeAlphaValue) const;
  8450. juce_UseDebuggingNewOperator
  8451. private:
  8452. PixelARGB argb;
  8453. };
  8454. #endif // __JUCE_COLOUR_JUCEHEADER__
  8455. /*** End of inlined file: juce_Colour.h ***/
  8456. class Colours
  8457. {
  8458. public:
  8459. static JUCE_API const Colour
  8460. transparentBlack, /**< ARGB = 0x00000000 */
  8461. transparentWhite, /**< ARGB = 0x00ffffff */
  8462. black, /**< ARGB = 0xff000000 */
  8463. white, /**< ARGB = 0xffffffff */
  8464. blue, /**< ARGB = 0xff0000ff */
  8465. grey, /**< ARGB = 0xff808080 */
  8466. green, /**< ARGB = 0xff008000 */
  8467. red, /**< ARGB = 0xffff0000 */
  8468. yellow, /**< ARGB = 0xffffff00 */
  8469. aliceblue, antiquewhite, aqua, aquamarine,
  8470. azure, beige, bisque, blanchedalmond,
  8471. blueviolet, brown, burlywood, cadetblue,
  8472. chartreuse, chocolate, coral, cornflowerblue,
  8473. cornsilk, crimson, cyan, darkblue,
  8474. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8475. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8476. darkorchid, darkred, darksalmon, darkseagreen,
  8477. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8478. deeppink, deepskyblue, dimgrey, dodgerblue,
  8479. firebrick, floralwhite, forestgreen, fuchsia,
  8480. gainsboro, gold, goldenrod, greenyellow,
  8481. honeydew, hotpink, indianred, indigo,
  8482. ivory, khaki, lavender, lavenderblush,
  8483. lemonchiffon, lightblue, lightcoral, lightcyan,
  8484. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8485. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8486. lightsteelblue, lightyellow, lime, limegreen,
  8487. linen, magenta, maroon, mediumaquamarine,
  8488. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8489. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8490. midnightblue, mintcream, mistyrose, navajowhite,
  8491. navy, oldlace, olive, olivedrab,
  8492. orange, orangered, orchid, palegoldenrod,
  8493. palegreen, paleturquoise, palevioletred, papayawhip,
  8494. peachpuff, peru, pink, plum,
  8495. powderblue, purple, rosybrown, royalblue,
  8496. saddlebrown, salmon, sandybrown, seagreen,
  8497. seashell, sienna, silver, skyblue,
  8498. slateblue, slategrey, snow, springgreen,
  8499. steelblue, tan, teal, thistle,
  8500. tomato, turquoise, violet, wheat,
  8501. whitesmoke, yellowgreen;
  8502. static JUCE_API const Colour findColourForName (const String& colourName,
  8503. const Colour& defaultColour);
  8504. private:
  8505. // this isn't a class you should ever instantiate - it's just here for the
  8506. // static values in it.
  8507. Colours();
  8508. Colours (const Colours&);
  8509. Colours& operator= (const Colours&);
  8510. };
  8511. #endif // __JUCE_COLOURS_JUCEHEADER__
  8512. /*** End of inlined file: juce_Colours.h ***/
  8513. /*** Start of inlined file: juce_FillType.h ***/
  8514. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8515. #define __JUCE_FILLTYPE_JUCEHEADER__
  8516. /*** Start of inlined file: juce_ColourGradient.h ***/
  8517. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8518. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8519. class JUCE_API ColourGradient
  8520. {
  8521. public:
  8522. ColourGradient (const Colour& colour1, float x1, float y1,
  8523. const Colour& colour2, float x2, float y2,
  8524. bool isRadial);
  8525. ColourGradient() throw();
  8526. ~ColourGradient();
  8527. void clearColours();
  8528. void addColour (double proportionAlongGradient,
  8529. const Colour& colour);
  8530. void multiplyOpacity (float multiplier) throw();
  8531. int getNumColours() const throw();
  8532. double getColourPosition (int index) const throw();
  8533. const Colour getColour (int index) const throw();
  8534. const Colour getColourAtPosition (float position) const throw();
  8535. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const;
  8536. bool isOpaque() const throw();
  8537. bool isInvisible() const throw();
  8538. float x1;
  8539. float y1;
  8540. float x2;
  8541. float y2;
  8542. bool isRadial;
  8543. juce_UseDebuggingNewOperator
  8544. private:
  8545. Array <uint32> colours;
  8546. };
  8547. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8548. /*** End of inlined file: juce_ColourGradient.h ***/
  8549. class Image;
  8550. class JUCE_API FillType
  8551. {
  8552. public:
  8553. FillType() throw();
  8554. FillType (const Colour& colour) throw();
  8555. FillType (const ColourGradient& gradient);
  8556. FillType (const Image& image, const AffineTransform& transform) throw();
  8557. FillType (const FillType& other);
  8558. FillType& operator= (const FillType& other);
  8559. ~FillType() throw();
  8560. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8561. bool isGradient() const throw() { return gradient != 0; }
  8562. bool isTiledImage() const throw() { return image != 0; }
  8563. void setColour (const Colour& newColour) throw();
  8564. void setGradient (const ColourGradient& newGradient);
  8565. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8566. void setOpacity (float newOpacity) throw();
  8567. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8568. Colour colour;
  8569. ScopedPointer <ColourGradient> gradient;
  8570. const Image* image;
  8571. AffineTransform transform;
  8572. juce_UseDebuggingNewOperator
  8573. };
  8574. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8575. /*** End of inlined file: juce_FillType.h ***/
  8576. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8577. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8578. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8579. class JUCE_API RectanglePlacement
  8580. {
  8581. public:
  8582. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8583. RectanglePlacement (const RectanglePlacement& other) throw();
  8584. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8585. enum
  8586. {
  8587. xLeft = 1,
  8588. xRight = 2,
  8589. xMid = 4,
  8590. yTop = 8,
  8591. yBottom = 16,
  8592. yMid = 32,
  8593. stretchToFit = 64,
  8594. fillDestination = 128,
  8595. onlyReduceInSize = 256,
  8596. onlyIncreaseInSize = 512,
  8597. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8598. centred = 4 + 32
  8599. };
  8600. inline int getFlags() const throw() { return flags; }
  8601. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8602. void applyTo (double& sourceX,
  8603. double& sourceY,
  8604. double& sourceW,
  8605. double& sourceH,
  8606. double destinationX,
  8607. double destinationY,
  8608. double destinationW,
  8609. double destinationH) const throw();
  8610. const AffineTransform getTransformToFit (float sourceX,
  8611. float sourceY,
  8612. float sourceW,
  8613. float sourceH,
  8614. float destinationX,
  8615. float destinationY,
  8616. float destinationW,
  8617. float destinationH) const throw();
  8618. private:
  8619. int flags;
  8620. };
  8621. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8622. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8623. class LowLevelGraphicsContext;
  8624. class Image;
  8625. class RectangleList;
  8626. class JUCE_API Graphics
  8627. {
  8628. public:
  8629. explicit Graphics (Image& imageToDrawOnto);
  8630. ~Graphics();
  8631. void setColour (const Colour& newColour);
  8632. void setOpacity (const float newOpacity);
  8633. void setGradientFill (const ColourGradient& gradient);
  8634. void setTiledImageFill (const Image& imageToUse,
  8635. int anchorX, int anchorY,
  8636. float opacity);
  8637. void setFillType (const FillType& newFill);
  8638. void setFont (const Font& newFont);
  8639. void setFont (float newFontHeight, int fontStyleFlags = Font::plain);
  8640. void drawSingleLineText (const String& text,
  8641. int startX, int baselineY) const;
  8642. void drawMultiLineText (const String& text,
  8643. int startX, int baselineY,
  8644. int maximumLineWidth) const;
  8645. void drawTextAsPath (const String& text,
  8646. const AffineTransform& transform) const;
  8647. void drawText (const String& text,
  8648. int x, int y, int width, int height,
  8649. const Justification& justificationType,
  8650. bool useEllipsesIfTooBig) const;
  8651. void drawFittedText (const String& text,
  8652. int x, int y, int width, int height,
  8653. const Justification& justificationFlags,
  8654. int maximumNumberOfLines,
  8655. float minimumHorizontalScale = 0.7f) const;
  8656. void fillAll() const;
  8657. void fillAll (const Colour& colourToUse) const;
  8658. void fillRect (int x, int y, int width, int height) const;
  8659. void fillRect (const Rectangle<int>& rectangle) const;
  8660. void fillRect (float x, float y, float width, float height) const;
  8661. void fillRoundedRectangle (float x, float y, float width, float height,
  8662. float cornerSize) const;
  8663. void fillRoundedRectangle (const Rectangle<float>& rectangle,
  8664. float cornerSize) const;
  8665. void fillCheckerBoard (int x, int y, int width, int height,
  8666. int checkWidth, int checkHeight,
  8667. const Colour& colour1, const Colour& colour2) const;
  8668. void drawRect (int x, int y, int width, int height,
  8669. int lineThickness = 1) const;
  8670. void drawRect (float x, float y, float width, float height,
  8671. float lineThickness = 1.0f) const;
  8672. void drawRect (const Rectangle<int>& rectangle,
  8673. int lineThickness = 1) const;
  8674. void drawRoundedRectangle (float x, float y, float width, float height,
  8675. float cornerSize, float lineThickness) const;
  8676. void drawRoundedRectangle (const Rectangle<float>& rectangle,
  8677. float cornerSize, float lineThickness) const;
  8678. void drawBevel (int x, int y, int width, int height,
  8679. int bevelThickness,
  8680. const Colour& topLeftColour = Colours::white,
  8681. const Colour& bottomRightColour = Colours::black,
  8682. bool useGradient = true,
  8683. bool sharpEdgeOnOutside = true) const;
  8684. void setPixel (int x, int y) const;
  8685. void fillEllipse (float x, float y, float width, float height) const;
  8686. void drawEllipse (float x, float y, float width, float height,
  8687. float lineThickness) const;
  8688. void drawLine (float startX, float startY, float endX, float endY) const;
  8689. void drawLine (float startX, float startY, float endX, float endY,
  8690. float lineThickness) const;
  8691. void drawLine (const Line<float>& line) const;
  8692. void drawLine (const Line<float>& line, float lineThickness) const;
  8693. void drawDashedLine (float startX, float startY,
  8694. float endX, float endY,
  8695. const float* dashLengths, int numDashLengths,
  8696. float lineThickness = 1.0f) const;
  8697. void drawVerticalLine (int x, float top, float bottom) const;
  8698. void drawHorizontalLine (int y, float left, float right) const;
  8699. void fillPath (const Path& path,
  8700. const AffineTransform& transform = AffineTransform::identity) const;
  8701. void strokePath (const Path& path,
  8702. const PathStrokeType& strokeType,
  8703. const AffineTransform& transform = AffineTransform::identity) const;
  8704. void drawArrow (float startX, float startY,
  8705. float endX, float endY,
  8706. float lineThickness,
  8707. float arrowheadWidth,
  8708. float arrowheadLength) const;
  8709. enum ResamplingQuality
  8710. {
  8711. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8712. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8713. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8714. };
  8715. void setImageResamplingQuality (const ResamplingQuality newQuality);
  8716. void drawImageAt (const Image* const imageToDraw, int topLeftX, int topLeftY,
  8717. bool fillAlphaChannelWithCurrentBrush = false) const;
  8718. void drawImage (const Image* const imageToDraw,
  8719. int destX, int destY, int destWidth, int destHeight,
  8720. int sourceX, int sourceY, int sourceWidth, int sourceHeight,
  8721. bool fillAlphaChannelWithCurrentBrush = false) const;
  8722. void drawImageTransformed (const Image* imageToDraw,
  8723. const Rectangle<int>& imageSubRegion,
  8724. const AffineTransform& transform,
  8725. bool fillAlphaChannelWithCurrentBrush = false) const;
  8726. void drawImageWithin (const Image* imageToDraw,
  8727. int destX, int destY, int destWidth, int destHeight,
  8728. const RectanglePlacement& placementWithinTarget,
  8729. bool fillAlphaChannelWithCurrentBrush = false) const;
  8730. const Rectangle<int> getClipBounds() const;
  8731. bool clipRegionIntersects (int x, int y, int width, int height) const;
  8732. bool reduceClipRegion (int x, int y, int width, int height);
  8733. bool reduceClipRegion (const RectangleList& clipRegion);
  8734. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity);
  8735. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8736. const AffineTransform& transform);
  8737. void excludeClipRegion (const Rectangle<int>& rectangleToExclude);
  8738. bool isClipEmpty() const;
  8739. void saveState();
  8740. void restoreState();
  8741. void setOrigin (int newOriginX, int newOriginY);
  8742. void resetToDefaultState();
  8743. bool isVectorDevice() const;
  8744. juce_UseDebuggingNewOperator
  8745. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8746. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8747. private:
  8748. LowLevelGraphicsContext* const context;
  8749. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8750. bool saveStatePending;
  8751. void saveStateIfPending();
  8752. Graphics (const Graphics&);
  8753. Graphics& operator= (const Graphics& other);
  8754. };
  8755. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8756. /*** End of inlined file: juce_Graphics.h ***/
  8757. class JUCE_API ImageEffectFilter
  8758. {
  8759. public:
  8760. virtual void applyEffect (Image& sourceImage,
  8761. Graphics& destContext) = 0;
  8762. virtual ~ImageEffectFilter() {}
  8763. };
  8764. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8765. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8766. /*** Start of inlined file: juce_RectangleList.h ***/
  8767. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8768. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8769. class JUCE_API RectangleList
  8770. {
  8771. public:
  8772. RectangleList() throw();
  8773. RectangleList (const RectangleList& other);
  8774. RectangleList (const Rectangle<int>& rect);
  8775. RectangleList& operator= (const RectangleList& other);
  8776. ~RectangleList();
  8777. bool isEmpty() const throw();
  8778. int getNumRectangles() const throw() { return rects.size(); }
  8779. const Rectangle<int> getRectangle (const int index) const throw();
  8780. void clear();
  8781. void add (int x, int y, int width, int height);
  8782. void add (const Rectangle<int>& rect);
  8783. void addWithoutMerging (const Rectangle<int>& rect);
  8784. void add (const RectangleList& other);
  8785. void subtract (const Rectangle<int>& rect);
  8786. void subtract (const RectangleList& otherList);
  8787. bool clipTo (const Rectangle<int>& rect);
  8788. bool clipTo (const RectangleList& other);
  8789. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const;
  8790. void swapWith (RectangleList& otherList) throw();
  8791. bool containsPoint (int x, int y) const throw();
  8792. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const;
  8793. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8794. bool intersects (const RectangleList& other) const throw();
  8795. const Rectangle<int> getBounds() const throw();
  8796. void consolidate();
  8797. void offsetAll (int dx, int dy) throw();
  8798. const Path toPath() const;
  8799. class Iterator
  8800. {
  8801. public:
  8802. Iterator (const RectangleList& list) throw();
  8803. ~Iterator();
  8804. bool next() throw();
  8805. const Rectangle<int>* getRectangle() const throw() { return current; }
  8806. juce_UseDebuggingNewOperator
  8807. private:
  8808. const Rectangle<int>* current;
  8809. const RectangleList& owner;
  8810. int index;
  8811. Iterator (const Iterator&);
  8812. Iterator& operator= (const Iterator&);
  8813. };
  8814. juce_UseDebuggingNewOperator
  8815. private:
  8816. friend class Iterator;
  8817. Array <Rectangle<int> > rects;
  8818. };
  8819. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8820. /*** End of inlined file: juce_RectangleList.h ***/
  8821. /*** Start of inlined file: juce_BorderSize.h ***/
  8822. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8823. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8824. class JUCE_API BorderSize
  8825. {
  8826. public:
  8827. BorderSize() throw();
  8828. BorderSize (const BorderSize& other) throw();
  8829. BorderSize (int topGap,
  8830. int leftGap,
  8831. int bottomGap,
  8832. int rightGap) throw();
  8833. explicit BorderSize (int allGaps) throw();
  8834. ~BorderSize() throw();
  8835. int getTop() const throw() { return top; }
  8836. int getLeft() const throw() { return left; }
  8837. int getBottom() const throw() { return bottom; }
  8838. int getRight() const throw() { return right; }
  8839. int getTopAndBottom() const throw() { return top + bottom; }
  8840. int getLeftAndRight() const throw() { return left + right; }
  8841. void setTop (int newTopGap) throw();
  8842. void setLeft (int newLeftGap) throw();
  8843. void setBottom (int newBottomGap) throw();
  8844. void setRight (int newRightGap) throw();
  8845. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8846. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8847. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8848. void addTo (Rectangle<int>& original) const throw();
  8849. bool operator== (const BorderSize& other) const throw();
  8850. bool operator!= (const BorderSize& other) const throw();
  8851. juce_UseDebuggingNewOperator
  8852. private:
  8853. int top, left, bottom, right;
  8854. };
  8855. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8856. /*** End of inlined file: juce_BorderSize.h ***/
  8857. class LookAndFeel;
  8858. class MouseInputSource;
  8859. class MouseInputSourceInternal;
  8860. class ComponentPeer;
  8861. class JUCE_API Component : public MouseListener,
  8862. protected MessageListener
  8863. {
  8864. public:
  8865. Component();
  8866. virtual ~Component();
  8867. explicit Component (const String& componentName);
  8868. const String& getName() const throw() { return componentName_; }
  8869. virtual void setName (const String& newName);
  8870. bool isValidComponent() const;
  8871. virtual void setVisible (bool shouldBeVisible);
  8872. bool isVisible() const throw() { return flags.visibleFlag; }
  8873. virtual void visibilityChanged();
  8874. bool isShowing() const;
  8875. void fadeOutComponent (int lengthOfFadeOutInMilliseconds,
  8876. int deltaXToMove = 0,
  8877. int deltaYToMove = 0,
  8878. float scaleFactorAtEnd = 1.0f);
  8879. virtual void addToDesktop (int windowStyleFlags,
  8880. void* nativeWindowToAttachTo = 0);
  8881. void removeFromDesktop();
  8882. bool isOnDesktop() const throw();
  8883. ComponentPeer* getPeer() const;
  8884. virtual void userTriedToCloseWindow();
  8885. virtual void minimisationStateChanged (bool isNowMinimised);
  8886. void toFront (bool shouldAlsoGainFocus);
  8887. void toBack();
  8888. void toBehind (Component* other);
  8889. void setAlwaysOnTop (bool shouldStayOnTop);
  8890. bool isAlwaysOnTop() const throw();
  8891. inline int getX() const throw() { return bounds_.getX(); }
  8892. inline int getY() const throw() { return bounds_.getY(); }
  8893. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8894. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8895. int getRight() const throw() { return bounds_.getRight(); }
  8896. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8897. int getBottom() const throw() { return bounds_.getBottom(); }
  8898. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8899. const Rectangle<int> getLocalBounds() const throw();
  8900. void getVisibleArea (RectangleList& result,
  8901. bool includeSiblings) const;
  8902. int getScreenX() const;
  8903. int getScreenY() const;
  8904. const Point<int> getScreenPosition() const;
  8905. const Rectangle<int> getScreenBounds() const;
  8906. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8907. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8908. const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
  8909. const Point<int>& positionRelativeToThis) const;
  8910. void setTopLeftPosition (int x, int y);
  8911. void setTopRightPosition (int x, int y);
  8912. void setSize (int newWidth, int newHeight);
  8913. void setBounds (int x, int y, int width, int height);
  8914. void setBounds (const Rectangle<int>& newBounds);
  8915. void setBoundsRelative (float proportionalX, float proportionalY,
  8916. float proportionalWidth, float proportionalHeight);
  8917. void setBoundsInset (const BorderSize& borders);
  8918. void setBoundsToFit (int x, int y, int width, int height,
  8919. const Justification& justification,
  8920. bool onlyReduceInSize);
  8921. void setCentrePosition (int x, int y);
  8922. void setCentreRelative (float x, float y);
  8923. void centreWithSize (int width, int height);
  8924. int proportionOfWidth (float proportion) const throw();
  8925. int proportionOfHeight (float proportion) const throw();
  8926. int getParentWidth() const throw();
  8927. int getParentHeight() const throw();
  8928. const Rectangle<int> getParentMonitorArea() const;
  8929. int getNumChildComponents() const throw();
  8930. Component* getChildComponent (int index) const throw();
  8931. int getIndexOfChildComponent (const Component* child) const throw();
  8932. void addChildComponent (Component* child, int zOrder = -1);
  8933. void addAndMakeVisible (Component* child, int zOrder = -1);
  8934. void removeChildComponent (Component* childToRemove);
  8935. Component* removeChildComponent (int childIndexToRemove);
  8936. void removeAllChildren();
  8937. void deleteAllChildren();
  8938. Component* getParentComponent() const throw() { return parentComponent_; }
  8939. template <class TargetClass>
  8940. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8941. {
  8942. (void) dummyParameter;
  8943. Component* p = parentComponent_;
  8944. while (p != 0)
  8945. {
  8946. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8947. if (target != 0)
  8948. return target;
  8949. p = p->parentComponent_;
  8950. }
  8951. return 0;
  8952. }
  8953. Component* getTopLevelComponent() const throw();
  8954. bool isParentOf (const Component* possibleChild) const throw();
  8955. virtual void parentHierarchyChanged();
  8956. virtual void childrenChanged();
  8957. virtual bool hitTest (int x, int y);
  8958. void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
  8959. bool allowClicksOnChildComponents) throw();
  8960. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8961. bool& allowsClicksOnChildComponents) const throw();
  8962. virtual bool contains (int x, int y);
  8963. bool reallyContains (int x, int y, bool returnTrueIfWithinAChild);
  8964. Component* getComponentAt (int x, int y);
  8965. Component* getComponentAt (const Point<int>& position);
  8966. void repaint();
  8967. void repaint (int x, int y, int width, int height);
  8968. void setBufferedToImage (bool shouldBeBuffered);
  8969. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8970. bool clipImageToComponentBounds = true);
  8971. void paintEntireComponent (Graphics& context);
  8972. void setComponentEffect (ImageEffectFilter* newEffect);
  8973. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8974. LookAndFeel& getLookAndFeel() const throw();
  8975. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  8976. virtual void lookAndFeelChanged();
  8977. void sendLookAndFeelChange();
  8978. void setOpaque (bool shouldBeOpaque);
  8979. bool isOpaque() const throw();
  8980. void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) throw();
  8981. bool isBroughtToFrontOnMouseClick() const throw();
  8982. // Keyboard focus methods
  8983. void setWantsKeyboardFocus (bool wantsFocus) throw();
  8984. bool getWantsKeyboardFocus() const throw();
  8985. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8986. bool getMouseClickGrabsKeyboardFocus() const throw();
  8987. void grabKeyboardFocus();
  8988. bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
  8989. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8990. void moveKeyboardFocusToSibling (bool moveToNext);
  8991. virtual KeyboardFocusTraverser* createFocusTraverser();
  8992. int getExplicitFocusOrder() const;
  8993. void setExplicitFocusOrder (int newFocusOrderIndex);
  8994. void setFocusContainer (bool shouldBeFocusContainer) throw();
  8995. bool isFocusContainer() const throw();
  8996. bool isEnabled() const throw();
  8997. void setEnabled (bool shouldBeEnabled);
  8998. virtual void enablementChanged();
  8999. void setMouseCursor (const MouseCursor& cursorType);
  9000. virtual const MouseCursor getMouseCursor();
  9001. void updateMouseCursor() const;
  9002. virtual void paint (Graphics& g);
  9003. virtual void paintOverChildren (Graphics& g);
  9004. virtual void mouseMove (const MouseEvent& e);
  9005. virtual void mouseEnter (const MouseEvent& e);
  9006. virtual void mouseExit (const MouseEvent& e);
  9007. virtual void mouseDown (const MouseEvent& e);
  9008. virtual void mouseDrag (const MouseEvent& e);
  9009. virtual void mouseUp (const MouseEvent& e);
  9010. virtual void mouseDoubleClick (const MouseEvent& e);
  9011. virtual void mouseWheelMove (const MouseEvent& e,
  9012. float wheelIncrementX,
  9013. float wheelIncrementY);
  9014. static void beginDragAutoRepeat (int millisecondIntervalBetweenCallbacks);
  9015. void setRepaintsOnMouseActivity (bool shouldRepaint) throw();
  9016. void addMouseListener (MouseListener* newListener,
  9017. bool wantsEventsForAllNestedChildComponents);
  9018. void removeMouseListener (MouseListener* listenerToRemove);
  9019. void addKeyListener (KeyListener* newListener);
  9020. void removeKeyListener (KeyListener* listenerToRemove);
  9021. virtual bool keyPressed (const KeyPress& key);
  9022. virtual bool keyStateChanged (bool isKeyDown);
  9023. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  9024. enum FocusChangeType
  9025. {
  9026. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  9027. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  9028. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  9029. };
  9030. virtual void focusGained (FocusChangeType cause);
  9031. virtual void focusLost (FocusChangeType cause);
  9032. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  9033. bool isMouseOver() const throw();
  9034. bool isMouseButtonDown() const throw();
  9035. bool isMouseOverOrDragging() const throw();
  9036. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  9037. const Point<int> getMouseXYRelative() const;
  9038. virtual void resized();
  9039. virtual void moved();
  9040. virtual void childBoundsChanged (Component* child);
  9041. virtual void parentSizeChanged();
  9042. virtual void broughtToFront();
  9043. void addComponentListener (ComponentListener* newListener);
  9044. void removeComponentListener (ComponentListener* listenerToRemove);
  9045. void postCommandMessage (int commandId);
  9046. virtual void handleCommandMessage (int commandId);
  9047. int runModalLoop();
  9048. void enterModalState (bool takeKeyboardFocus = true);
  9049. void exitModalState (int returnValue);
  9050. bool isCurrentlyModal() const throw();
  9051. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  9052. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  9053. bool isCurrentlyBlockedByAnotherModalComponent() const;
  9054. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  9055. virtual void inputAttemptWhenModal();
  9056. NamedValueSet& getProperties() throw() { return properties; }
  9057. const NamedValueSet& getProperties() const throw() { return properties; }
  9058. const Colour findColour (int colourId, bool inheritFromParent = false) const;
  9059. void setColour (int colourId, const Colour& colour);
  9060. void removeColour (int colourId);
  9061. bool isColourSpecified (int colourId) const;
  9062. void copyAllExplicitColoursTo (Component& target) const;
  9063. virtual void colourChanged();
  9064. void* getWindowHandle() const;
  9065. uint32 getComponentUID() const throw() { return componentUID; }
  9066. template <class ComponentType>
  9067. class SafePointer : private ComponentListener
  9068. {
  9069. public:
  9070. SafePointer() : comp (0) {}
  9071. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  9072. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  9073. ~SafePointer() { detach(); }
  9074. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  9075. SafePointer& operator= (ComponentType* const newComponent)
  9076. {
  9077. detach();
  9078. comp = newComponent;
  9079. attach();
  9080. return *this;
  9081. }
  9082. operator ComponentType*() const throw() { return comp; }
  9083. ComponentType* getComponent() const throw() { return comp; }
  9084. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  9085. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  9086. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  9087. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  9088. juce_UseDebuggingNewOperator
  9089. private:
  9090. ComponentType* comp;
  9091. void attach() { if (comp != 0) comp->addComponentListener (this); }
  9092. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  9093. void componentBeingDeleted (Component&) { comp = 0; }
  9094. };
  9095. class BailOutChecker
  9096. {
  9097. public:
  9098. BailOutChecker (Component* component1,
  9099. Component* component2 = 0);
  9100. bool shouldBailOut() const throw();
  9101. private:
  9102. typedef SafePointer<Component> SafeComponentPtr;
  9103. SafeComponentPtr safePointer1, safePointer2;
  9104. Component* const component2;
  9105. BailOutChecker (const BailOutChecker&);
  9106. BailOutChecker& operator= (const BailOutChecker&);
  9107. };
  9108. juce_UseDebuggingNewOperator
  9109. private:
  9110. friend class ComponentPeer;
  9111. friend class InternalDragRepeater;
  9112. friend class MouseInputSource;
  9113. friend class MouseInputSourceInternal;
  9114. static Component* currentlyFocusedComponent;
  9115. String componentName_;
  9116. Component* parentComponent_;
  9117. uint32 componentUID;
  9118. Rectangle<int> bounds_;
  9119. int numDeepMouseListeners;
  9120. Array <Component*> childComponentList_;
  9121. LookAndFeel* lookAndFeel_;
  9122. MouseCursor cursor_;
  9123. ImageEffectFilter* effect_;
  9124. Image* bufferedImage_;
  9125. Array <MouseListener*>* mouseListeners_;
  9126. VoidArray* keyListeners_;
  9127. ListenerList <ComponentListener> componentListeners;
  9128. NamedValueSet properties;
  9129. struct ComponentFlags
  9130. {
  9131. bool hasHeavyweightPeerFlag : 1;
  9132. bool visibleFlag : 1;
  9133. bool opaqueFlag : 1;
  9134. bool ignoresMouseClicksFlag : 1;
  9135. bool allowChildMouseClicksFlag : 1;
  9136. bool wantsFocusFlag : 1;
  9137. bool isFocusContainerFlag : 1;
  9138. bool dontFocusOnMouseClickFlag : 1;
  9139. bool alwaysOnTopFlag : 1;
  9140. bool bufferToImageFlag : 1;
  9141. bool bringToFrontOnClickFlag : 1;
  9142. bool repaintOnMouseActivityFlag : 1;
  9143. bool draggingFlag : 1;
  9144. bool mouseOverFlag : 1;
  9145. bool mouseInsideFlag : 1;
  9146. bool currentlyModalFlag : 1;
  9147. bool isDisabledFlag : 1;
  9148. bool childCompFocusedFlag : 1;
  9149. #ifdef JUCE_DEBUG
  9150. bool isInsidePaintCall : 1;
  9151. #endif
  9152. };
  9153. union
  9154. {
  9155. uint32 componentFlags_;
  9156. ComponentFlags flags;
  9157. };
  9158. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9159. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9160. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9161. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  9162. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9163. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9164. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, float amountX, float amountY);
  9165. void internalBroughtToFront();
  9166. void internalFocusGain (const FocusChangeType cause);
  9167. void internalFocusLoss (const FocusChangeType cause);
  9168. void internalChildFocusChange (FocusChangeType cause);
  9169. void internalModalInputAttempt();
  9170. void internalModifierKeysChanged();
  9171. void internalChildrenChanged();
  9172. void internalHierarchyChanged();
  9173. void renderComponent (Graphics& context);
  9174. void sendMovedResizedMessages (bool wasMoved, bool wasResized);
  9175. void repaintParent();
  9176. void sendFakeMouseMove() const;
  9177. void takeKeyboardFocus (const FocusChangeType cause);
  9178. void grabFocusInternal (const FocusChangeType cause, bool canTryParent = true);
  9179. static void giveAwayFocus();
  9180. void sendEnablementChangeMessage();
  9181. static void* runModalLoopCallback (void*);
  9182. static void bringModalComponentToFront();
  9183. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  9184. const Rectangle<int>& clipRect,
  9185. const Component* const compToAvoid) const;
  9186. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  9187. int deltaX, int deltaY) const;
  9188. // how much of the component is not off the edges of its parents
  9189. const Rectangle<int> getUnclippedArea() const;
  9190. void sendVisibilityChangeMessage();
  9191. // This is included here just to cause a compile error if your code is still handling
  9192. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  9193. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  9194. // implement its methods instead of this Component method).
  9195. virtual void filesDropped (const StringArray&, int, int) {}
  9196. // components aren't allowed to have copy constructors, as this would mess up parent
  9197. // hierarchies. You might need to give your subclasses a private dummy constructor like
  9198. // this one to avoid compiler warnings.
  9199. Component (const Component&);
  9200. Component& operator= (const Component&);
  9201. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  9202. // subclass to use the new parameters to keyStateChanged)
  9203. virtual void keyStateChanged() {};
  9204. protected:
  9205. virtual void internalRepaint (int x, int y, int w, int h);
  9206. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  9207. void handleMessage (const Message&);
  9208. };
  9209. #endif // __JUCE_COMPONENT_JUCEHEADER__
  9210. /*** End of inlined file: juce_Component.h ***/
  9211. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  9212. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9213. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9214. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9215. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9216. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9217. typedef int CommandID;
  9218. namespace StandardApplicationCommandIDs
  9219. {
  9220. static const CommandID quit = 0x1001;
  9221. static const CommandID del = 0x1002;
  9222. static const CommandID cut = 0x1003;
  9223. static const CommandID copy = 0x1004;
  9224. static const CommandID paste = 0x1005;
  9225. static const CommandID selectAll = 0x1006;
  9226. static const CommandID deselectAll = 0x1007;
  9227. }
  9228. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9229. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9230. struct JUCE_API ApplicationCommandInfo
  9231. {
  9232. explicit ApplicationCommandInfo (CommandID commandID) throw();
  9233. void setInfo (const String& shortName,
  9234. const String& description,
  9235. const String& categoryName,
  9236. int flags) throw();
  9237. void setActive (bool isActive) throw();
  9238. void setTicked (bool isTicked) throw();
  9239. void addDefaultKeypress (int keyCode,
  9240. const ModifierKeys& modifiers) throw();
  9241. CommandID commandID;
  9242. String shortName;
  9243. String description;
  9244. String categoryName;
  9245. Array <KeyPress> defaultKeypresses;
  9246. enum CommandFlags
  9247. {
  9248. isDisabled = 1 << 0,
  9249. isTicked = 1 << 1,
  9250. wantsKeyUpDownCallbacks = 1 << 2,
  9251. hiddenFromKeyEditor = 1 << 3,
  9252. readOnlyInKeyEditor = 1 << 4,
  9253. dontTriggerVisualFeedback = 1 << 5
  9254. };
  9255. int flags;
  9256. };
  9257. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9258. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9259. class JUCE_API ApplicationCommandTarget
  9260. {
  9261. public:
  9262. ApplicationCommandTarget();
  9263. virtual ~ApplicationCommandTarget();
  9264. struct JUCE_API InvocationInfo
  9265. {
  9266. InvocationInfo (const CommandID commandID) throw();
  9267. CommandID commandID;
  9268. int commandFlags;
  9269. enum InvocationMethod
  9270. {
  9271. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9272. fromKeyPress, /**< The command is being invoked by a key-press. */
  9273. fromMenu, /**< The command is being invoked by a menu selection. */
  9274. fromButton /**< The command is being invoked by a button click. */
  9275. };
  9276. InvocationMethod invocationMethod;
  9277. Component* originatingComponent;
  9278. KeyPress keyPress;
  9279. bool isKeyDown;
  9280. int millisecsSinceKeyPressed;
  9281. };
  9282. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9283. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9284. virtual void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) = 0;
  9285. virtual bool perform (const InvocationInfo& info) = 0;
  9286. bool invoke (const InvocationInfo& invocationInfo,
  9287. const bool asynchronously);
  9288. bool invokeDirectly (const CommandID commandID,
  9289. const bool asynchronously);
  9290. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9291. bool isCommandActive (const CommandID commandID);
  9292. ApplicationCommandTarget* findFirstTargetParentComponent();
  9293. juce_UseDebuggingNewOperator
  9294. private:
  9295. // (for async invocation of commands)
  9296. class CommandTargetMessageInvoker : public MessageListener
  9297. {
  9298. public:
  9299. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9300. ~CommandTargetMessageInvoker();
  9301. void handleMessage (const Message& message);
  9302. private:
  9303. ApplicationCommandTarget* const owner;
  9304. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9305. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9306. };
  9307. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9308. friend class CommandTargetMessageInvoker;
  9309. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9310. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9311. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9312. };
  9313. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9314. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9315. /*** Start of inlined file: juce_ActionListener.h ***/
  9316. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9317. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9318. class JUCE_API ActionListener
  9319. {
  9320. public:
  9321. virtual ~ActionListener() {}
  9322. virtual void actionListenerCallback (const String& message) = 0;
  9323. };
  9324. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9325. /*** End of inlined file: juce_ActionListener.h ***/
  9326. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9327. private ActionListener
  9328. {
  9329. protected:
  9330. JUCEApplication();
  9331. public:
  9332. virtual ~JUCEApplication();
  9333. static JUCEApplication* getInstance() throw();
  9334. virtual void initialise (const String& commandLineParameters) = 0;
  9335. bool isInitialising() const throw();
  9336. virtual void shutdown() = 0;
  9337. virtual const String getApplicationName() = 0;
  9338. virtual const String getApplicationVersion();
  9339. virtual bool moreThanOneInstanceAllowed();
  9340. virtual void anotherInstanceStarted (const String& commandLine);
  9341. virtual void systemRequestedQuit();
  9342. virtual void unhandledException (const std::exception* e,
  9343. const String& sourceFilename,
  9344. int lineNumber);
  9345. static void quit();
  9346. void setApplicationReturnValue (int newReturnValue) throw();
  9347. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9348. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9349. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9350. static int main (String& commandLine, JUCEApplication* newApp);
  9351. static int main (int argc, const char* argv[], JUCEApplication* newApp);
  9352. static void sendUnhandledException (const std::exception* e,
  9353. const char* sourceFile,
  9354. int lineNumber);
  9355. ApplicationCommandTarget* getNextCommandTarget();
  9356. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  9357. void getAllCommands (Array <CommandID>& commands);
  9358. bool perform (const InvocationInfo& info);
  9359. void actionListenerCallback (const String& message);
  9360. private:
  9361. String commandLineParameters;
  9362. int appReturnValue;
  9363. bool stillInitialising;
  9364. ScopedPointer<InterProcessLock> appLock;
  9365. JUCEApplication (const JUCEApplication&);
  9366. JUCEApplication& operator= (const JUCEApplication&);
  9367. public:
  9368. bool initialiseApp (String& commandLine);
  9369. static int shutdownAppAndClearUp();
  9370. };
  9371. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9372. /*** End of inlined file: juce_Application.h ***/
  9373. #endif
  9374. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9375. #endif
  9376. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9377. #endif
  9378. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9379. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9380. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9381. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9382. /*** Start of inlined file: juce_Desktop.h ***/
  9383. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9384. #define __JUCE_DESKTOP_JUCEHEADER__
  9385. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9386. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9387. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9388. class JUCE_API DeletedAtShutdown
  9389. {
  9390. protected:
  9391. DeletedAtShutdown();
  9392. virtual ~DeletedAtShutdown();
  9393. public:
  9394. static void deleteAll();
  9395. private:
  9396. DeletedAtShutdown (const DeletedAtShutdown&);
  9397. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9398. };
  9399. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9400. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9401. /*** Start of inlined file: juce_Timer.h ***/
  9402. #ifndef __JUCE_TIMER_JUCEHEADER__
  9403. #define __JUCE_TIMER_JUCEHEADER__
  9404. class InternalTimerThread;
  9405. class JUCE_API Timer
  9406. {
  9407. protected:
  9408. Timer() throw();
  9409. Timer (const Timer& other) throw();
  9410. public:
  9411. virtual ~Timer();
  9412. virtual void timerCallback() = 0;
  9413. void startTimer (int intervalInMilliseconds) throw();
  9414. void stopTimer() throw();
  9415. bool isTimerRunning() const throw() { return periodMs > 0; }
  9416. int getTimerInterval() const throw() { return periodMs; }
  9417. private:
  9418. friend class InternalTimerThread;
  9419. int countdownMs, periodMs;
  9420. Timer* previous;
  9421. Timer* next;
  9422. Timer& operator= (const Timer&);
  9423. };
  9424. #endif // __JUCE_TIMER_JUCEHEADER__
  9425. /*** End of inlined file: juce_Timer.h ***/
  9426. class MouseInputSource;
  9427. class MouseInputSourceInternal;
  9428. class MouseListener;
  9429. class JUCE_API FocusChangeListener
  9430. {
  9431. public:
  9432. virtual ~FocusChangeListener() {}
  9433. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9434. };
  9435. class JUCE_API Desktop : private DeletedAtShutdown,
  9436. private Timer,
  9437. private AsyncUpdater
  9438. {
  9439. public:
  9440. static Desktop& JUCE_CALLTYPE getInstance();
  9441. const RectangleList getAllMonitorDisplayAreas (bool clippedToWorkArea = true) const throw();
  9442. const Rectangle<int> getMainMonitorArea (bool clippedToWorkArea = true) const throw();
  9443. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, bool clippedToWorkArea = true) const;
  9444. static const Point<int> getMousePosition();
  9445. static void setMousePosition (const Point<int>& newPosition);
  9446. static const Point<int> getLastMouseDownPosition() throw();
  9447. static int getMouseButtonClickCounter() throw();
  9448. static void setScreenSaverEnabled (bool isEnabled) throw();
  9449. static bool isScreenSaverEnabled() throw();
  9450. void addGlobalMouseListener (MouseListener* listener);
  9451. void removeGlobalMouseListener (MouseListener* listener);
  9452. void addFocusChangeListener (FocusChangeListener* listener);
  9453. void removeFocusChangeListener (FocusChangeListener* listener);
  9454. void setKioskModeComponent (Component* componentToUse,
  9455. bool allowMenusAndBars = true);
  9456. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9457. int getNumComponents() const throw();
  9458. Component* getComponent (int index) const throw();
  9459. Component* findComponentAt (const Point<int>& screenPosition) const;
  9460. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9461. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9462. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9463. int getNumDraggingMouseSources() const throw();
  9464. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9465. juce_UseDebuggingNewOperator
  9466. void refreshMonitorSizes();
  9467. static bool canUseSemiTransparentWindows() throw();
  9468. private:
  9469. static Desktop* instance;
  9470. friend class Component;
  9471. friend class ComponentPeer;
  9472. friend class MouseInputSource;
  9473. friend class MouseInputSourceInternal;
  9474. friend class DeletedAtShutdown;
  9475. friend class TopLevelWindowManager;
  9476. OwnedArray <MouseInputSource> mouseSources;
  9477. void createMouseInputSources();
  9478. ListenerList <MouseListener> mouseListeners;
  9479. ListenerList <FocusChangeListener> focusListeners;
  9480. Array <Component*> desktopComponents;
  9481. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9482. Point<int> lastFakeMouseMove;
  9483. void sendMouseMove();
  9484. int mouseClickCounter;
  9485. void incrementMouseClickCounter() throw();
  9486. Component* kioskModeComponent;
  9487. Rectangle<int> kioskComponentOriginalBounds;
  9488. void timerCallback();
  9489. void resetTimer();
  9490. int getNumDisplayMonitors() const throw();
  9491. const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const throw();
  9492. void addDesktopComponent (Component* c);
  9493. void removeDesktopComponent (Component* c);
  9494. void componentBroughtToFront (Component* c);
  9495. void triggerFocusCallback();
  9496. void handleAsyncUpdate();
  9497. Desktop();
  9498. ~Desktop();
  9499. Desktop (const Desktop&);
  9500. Desktop& operator= (const Desktop&);
  9501. };
  9502. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9503. /*** End of inlined file: juce_Desktop.h ***/
  9504. class KeyPressMappingSet;
  9505. class ApplicationCommandManagerListener;
  9506. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9507. private FocusChangeListener
  9508. {
  9509. public:
  9510. ApplicationCommandManager();
  9511. virtual ~ApplicationCommandManager();
  9512. void clearCommands();
  9513. void registerCommand (const ApplicationCommandInfo& newCommand);
  9514. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9515. void removeCommand (CommandID commandID);
  9516. void commandStatusChanged();
  9517. int getNumCommands() const throw() { return commands.size(); }
  9518. const ApplicationCommandInfo* getCommandForIndex (int index) const throw() { return commands [index]; }
  9519. const ApplicationCommandInfo* getCommandForID (CommandID commandID) const throw();
  9520. const String getNameOfCommand (CommandID commandID) const throw();
  9521. const String getDescriptionOfCommand (CommandID commandID) const throw();
  9522. const StringArray getCommandCategories() const throw();
  9523. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9524. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9525. bool invokeDirectly (CommandID commandID, bool asynchronously);
  9526. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9527. bool asynchronously);
  9528. virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
  9529. void setFirstCommandTarget (ApplicationCommandTarget* newTarget) throw();
  9530. ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
  9531. ApplicationCommandInfo& upToDateInfo);
  9532. void addListener (ApplicationCommandManagerListener* listener) throw();
  9533. void removeListener (ApplicationCommandManagerListener* listener) throw();
  9534. static ApplicationCommandTarget* findDefaultComponentTarget();
  9535. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9536. juce_UseDebuggingNewOperator
  9537. private:
  9538. OwnedArray <ApplicationCommandInfo> commands;
  9539. ListenerList <ApplicationCommandManagerListener> listeners;
  9540. ScopedPointer <KeyPressMappingSet> keyMappings;
  9541. ApplicationCommandTarget* firstTarget;
  9542. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9543. void handleAsyncUpdate();
  9544. void globalFocusChanged (Component*);
  9545. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9546. // version of this method.
  9547. virtual short getFirstCommandTarget() { return 0; }
  9548. ApplicationCommandManager (const ApplicationCommandManager&);
  9549. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9550. };
  9551. class JUCE_API ApplicationCommandManagerListener
  9552. {
  9553. public:
  9554. virtual ~ApplicationCommandManagerListener() {}
  9555. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9556. virtual void applicationCommandListChanged() = 0;
  9557. };
  9558. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9559. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9560. #endif
  9561. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9562. #endif
  9563. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9564. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9565. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9566. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9567. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9568. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9569. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9570. class JUCE_API PropertiesFile : public PropertySet,
  9571. public ChangeBroadcaster,
  9572. private Timer
  9573. {
  9574. public:
  9575. enum FileFormatOptions
  9576. {
  9577. ignoreCaseOfKeyNames = 1,
  9578. storeAsBinary = 2,
  9579. storeAsCompressedBinary = 4,
  9580. storeAsXML = 8
  9581. };
  9582. PropertiesFile (const File& file,
  9583. int millisecondsBeforeSaving,
  9584. int optionFlags,
  9585. InterProcessLock* processLock = 0);
  9586. ~PropertiesFile();
  9587. bool isValidFile() const throw() { return loadedOk; }
  9588. bool saveIfNeeded();
  9589. bool save();
  9590. bool needsToBeSaved() const;
  9591. void setNeedsToBeSaved (bool needsToBeSaved);
  9592. const File getFile() const { return file; }
  9593. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9594. const String& fileNameSuffix,
  9595. const String& folderName,
  9596. bool commonToAllUsers,
  9597. int millisecondsBeforeSaving,
  9598. int propertiesFileOptions,
  9599. InterProcessLock* processLock = 0);
  9600. static const File getDefaultAppSettingsFile (const String& applicationName,
  9601. const String& fileNameSuffix,
  9602. const String& folderName,
  9603. bool commonToAllUsers);
  9604. juce_UseDebuggingNewOperator
  9605. protected:
  9606. virtual void propertyChanged();
  9607. private:
  9608. File file;
  9609. int timerInterval;
  9610. const int options;
  9611. bool loadedOk, needsWriting;
  9612. InterProcessLock* processLock;
  9613. typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock;
  9614. InterProcessLock::ScopedLockType* createProcessLock() const;
  9615. void timerCallback();
  9616. PropertiesFile (const PropertiesFile&);
  9617. PropertiesFile& operator= (const PropertiesFile&);
  9618. };
  9619. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9620. /*** End of inlined file: juce_PropertiesFile.h ***/
  9621. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9622. {
  9623. public:
  9624. ApplicationProperties() throw();
  9625. ~ApplicationProperties();
  9626. juce_DeclareSingleton (ApplicationProperties, false)
  9627. void setStorageParameters (const String& applicationName,
  9628. const String& fileNameSuffix,
  9629. const String& folderName,
  9630. int millisecondsBeforeSaving,
  9631. int propertiesFileOptions) throw();
  9632. bool testWriteAccess (bool testUserSettings,
  9633. bool testCommonSettings,
  9634. bool showWarningDialogOnFailure);
  9635. PropertiesFile* getUserSettings() throw();
  9636. PropertiesFile* getCommonSettings (bool returnUserPropsIfReadOnly) throw();
  9637. bool saveIfNeeded();
  9638. void closeFiles();
  9639. juce_UseDebuggingNewOperator
  9640. private:
  9641. ScopedPointer <PropertiesFile> userProps, commonProps;
  9642. String appName, fileSuffix, folderName;
  9643. int msBeforeSaving, options;
  9644. int commonSettingsAreReadOnly;
  9645. ApplicationProperties (const ApplicationProperties&);
  9646. ApplicationProperties& operator= (const ApplicationProperties&);
  9647. void openFiles() throw();
  9648. };
  9649. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9650. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9651. #endif
  9652. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9653. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9654. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9655. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9656. /*** Start of inlined file: juce_AudioFormat.h ***/
  9657. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9658. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9659. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9660. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9661. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9662. class AudioFormat;
  9663. class JUCE_API AudioFormatReader
  9664. {
  9665. protected:
  9666. AudioFormatReader (InputStream* sourceStream,
  9667. const String& formatName);
  9668. public:
  9669. virtual ~AudioFormatReader();
  9670. const String getFormatName() const throw() { return formatName; }
  9671. bool read (int** destSamples,
  9672. int numDestChannels,
  9673. int64 startSampleInSource,
  9674. int numSamplesToRead,
  9675. bool fillLeftoverChannelsWithCopies);
  9676. virtual void readMaxLevels (int64 startSample,
  9677. int64 numSamples,
  9678. float& lowestLeft,
  9679. float& highestLeft,
  9680. float& lowestRight,
  9681. float& highestRight);
  9682. int64 searchForLevel (int64 startSample,
  9683. int64 numSamplesToSearch,
  9684. double magnitudeRangeMinimum,
  9685. double magnitudeRangeMaximum,
  9686. int minimumConsecutiveSamples);
  9687. double sampleRate;
  9688. unsigned int bitsPerSample;
  9689. int64 lengthInSamples;
  9690. unsigned int numChannels;
  9691. bool usesFloatingPointData;
  9692. StringPairArray metadataValues;
  9693. InputStream* input;
  9694. virtual bool readSamples (int** destSamples,
  9695. int numDestChannels,
  9696. int startOffsetInDestBuffer,
  9697. int64 startSampleInFile,
  9698. int numSamples) = 0;
  9699. juce_UseDebuggingNewOperator
  9700. private:
  9701. String formatName;
  9702. AudioFormatReader (const AudioFormatReader&);
  9703. AudioFormatReader& operator= (const AudioFormatReader&);
  9704. };
  9705. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9706. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9707. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9708. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9709. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9710. /*** Start of inlined file: juce_AudioSource.h ***/
  9711. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9712. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9713. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9714. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9715. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9716. class AudioFormatReader;
  9717. class AudioFormatWriter;
  9718. class JUCE_API AudioSampleBuffer
  9719. {
  9720. public:
  9721. AudioSampleBuffer (int numChannels,
  9722. int numSamples) throw();
  9723. AudioSampleBuffer (float** dataToReferTo,
  9724. int numChannels,
  9725. int numSamples) throw();
  9726. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9727. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9728. virtual ~AudioSampleBuffer() throw();
  9729. int getNumChannels() const throw() { return numChannels; }
  9730. int getNumSamples() const throw() { return size; }
  9731. float* getSampleData (const int channelNumber) const throw()
  9732. {
  9733. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9734. return channels [channelNumber];
  9735. }
  9736. float* getSampleData (const int channelNumber,
  9737. const int sampleOffset) const throw()
  9738. {
  9739. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9740. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9741. return channels [channelNumber] + sampleOffset;
  9742. }
  9743. float** getArrayOfChannels() const throw() { return channels; }
  9744. void setSize (int newNumChannels,
  9745. int newNumSamples,
  9746. bool keepExistingContent = false,
  9747. bool clearExtraSpace = false,
  9748. bool avoidReallocating = false) throw();
  9749. void setDataToReferTo (float** dataToReferTo,
  9750. int numChannels,
  9751. int numSamples) throw();
  9752. void clear() throw();
  9753. void clear (int startSample,
  9754. int numSamples) throw();
  9755. void clear (int channel,
  9756. int startSample,
  9757. int numSamples) throw();
  9758. void applyGain (int channel,
  9759. int startSample,
  9760. int numSamples,
  9761. float gain) throw();
  9762. void applyGain (int startSample,
  9763. int numSamples,
  9764. float gain) throw();
  9765. void applyGainRamp (int channel,
  9766. int startSample,
  9767. int numSamples,
  9768. float startGain,
  9769. float endGain) throw();
  9770. void addFrom (int destChannel,
  9771. int destStartSample,
  9772. const AudioSampleBuffer& source,
  9773. int sourceChannel,
  9774. int sourceStartSample,
  9775. int numSamples,
  9776. float gainToApplyToSource = 1.0f) throw();
  9777. void addFrom (int destChannel,
  9778. int destStartSample,
  9779. const float* source,
  9780. int numSamples,
  9781. float gainToApplyToSource = 1.0f) throw();
  9782. void addFromWithRamp (int destChannel,
  9783. int destStartSample,
  9784. const float* source,
  9785. int numSamples,
  9786. float startGain,
  9787. float endGain) throw();
  9788. void copyFrom (int destChannel,
  9789. int destStartSample,
  9790. const AudioSampleBuffer& source,
  9791. int sourceChannel,
  9792. int sourceStartSample,
  9793. int numSamples) throw();
  9794. void copyFrom (int destChannel,
  9795. int destStartSample,
  9796. const float* source,
  9797. int numSamples) throw();
  9798. void copyFrom (int destChannel,
  9799. int destStartSample,
  9800. const float* source,
  9801. int numSamples,
  9802. float gain) throw();
  9803. void copyFromWithRamp (int destChannel,
  9804. int destStartSample,
  9805. const float* source,
  9806. int numSamples,
  9807. float startGain,
  9808. float endGain) throw();
  9809. void findMinMax (int channel,
  9810. int startSample,
  9811. int numSamples,
  9812. float& minVal,
  9813. float& maxVal) const throw();
  9814. float getMagnitude (int channel,
  9815. int startSample,
  9816. int numSamples) const throw();
  9817. float getMagnitude (int startSample,
  9818. int numSamples) const throw();
  9819. float getRMSLevel (int channel,
  9820. int startSample,
  9821. int numSamples) const throw();
  9822. void readFromAudioReader (AudioFormatReader* reader,
  9823. int startSample,
  9824. int numSamples,
  9825. int readerStartSample,
  9826. bool useReaderLeftChan,
  9827. bool useReaderRightChan) throw();
  9828. void writeToAudioWriter (AudioFormatWriter* writer,
  9829. int startSample,
  9830. int numSamples) const throw();
  9831. juce_UseDebuggingNewOperator
  9832. private:
  9833. int numChannels, size;
  9834. size_t allocatedBytes;
  9835. float** channels;
  9836. HeapBlock <char> allocatedData;
  9837. float* preallocatedChannelSpace [32];
  9838. void allocateData();
  9839. void allocateChannels (float** dataToReferTo);
  9840. };
  9841. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9842. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9843. struct JUCE_API AudioSourceChannelInfo
  9844. {
  9845. AudioSampleBuffer* buffer;
  9846. int startSample;
  9847. int numSamples;
  9848. void clearActiveBufferRegion() const
  9849. {
  9850. if (buffer != 0)
  9851. buffer->clear (startSample, numSamples);
  9852. }
  9853. };
  9854. class JUCE_API AudioSource
  9855. {
  9856. protected:
  9857. AudioSource() throw() {}
  9858. public:
  9859. virtual ~AudioSource() {}
  9860. virtual void prepareToPlay (int samplesPerBlockExpected,
  9861. double sampleRate) = 0;
  9862. virtual void releaseResources() = 0;
  9863. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9864. };
  9865. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9866. /*** End of inlined file: juce_AudioSource.h ***/
  9867. class JUCE_API AudioFormatWriter
  9868. {
  9869. protected:
  9870. AudioFormatWriter (OutputStream* destStream,
  9871. const String& formatName,
  9872. double sampleRate,
  9873. unsigned int numberOfChannels,
  9874. unsigned int bitsPerSample);
  9875. public:
  9876. virtual ~AudioFormatWriter();
  9877. const String getFormatName() const throw() { return formatName; }
  9878. virtual bool write (const int** samplesToWrite,
  9879. int numSamples) = 0;
  9880. bool writeFromAudioReader (AudioFormatReader& reader,
  9881. int64 startSample,
  9882. int64 numSamplesToRead);
  9883. bool writeFromAudioSource (AudioSource& source,
  9884. int numSamplesToRead,
  9885. int samplesPerBlock = 2048);
  9886. double getSampleRate() const throw() { return sampleRate; }
  9887. int getNumChannels() const throw() { return numChannels; }
  9888. int getBitsPerSample() const throw() { return bitsPerSample; }
  9889. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9890. juce_UseDebuggingNewOperator
  9891. protected:
  9892. double sampleRate;
  9893. unsigned int numChannels;
  9894. unsigned int bitsPerSample;
  9895. bool usesFloatingPointData;
  9896. OutputStream* output;
  9897. private:
  9898. String formatName;
  9899. AudioFormatWriter (const AudioFormatWriter&);
  9900. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9901. };
  9902. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9903. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9904. class JUCE_API AudioFormat
  9905. {
  9906. public:
  9907. virtual ~AudioFormat();
  9908. const String& getFormatName() const;
  9909. const StringArray& getFileExtensions() const;
  9910. virtual bool canHandleFile (const File& fileToTest);
  9911. virtual const Array <int> getPossibleSampleRates() = 0;
  9912. virtual const Array <int> getPossibleBitDepths() = 0;
  9913. virtual bool canDoStereo() = 0;
  9914. virtual bool canDoMono() = 0;
  9915. virtual bool isCompressed();
  9916. virtual const StringArray getQualityOptions();
  9917. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9918. const bool deleteStreamIfOpeningFails) = 0;
  9919. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9920. double sampleRateToUse,
  9921. unsigned int numberOfChannels,
  9922. int bitsPerSample,
  9923. const StringPairArray& metadataValues,
  9924. int qualityOptionIndex) = 0;
  9925. protected:
  9926. AudioFormat (const String& formatName,
  9927. const juce_wchar** const fileExtensions);
  9928. private:
  9929. String formatName;
  9930. StringArray fileExtensions;
  9931. };
  9932. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9933. /*** End of inlined file: juce_AudioFormat.h ***/
  9934. class JUCE_API AiffAudioFormat : public AudioFormat
  9935. {
  9936. public:
  9937. AiffAudioFormat();
  9938. ~AiffAudioFormat();
  9939. const Array <int> getPossibleSampleRates();
  9940. const Array <int> getPossibleBitDepths();
  9941. bool canDoStereo();
  9942. bool canDoMono();
  9943. #if JUCE_MAC
  9944. bool canHandleFile (const File& fileToTest);
  9945. #endif
  9946. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9947. const bool deleteStreamIfOpeningFails);
  9948. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9949. double sampleRateToUse,
  9950. unsigned int numberOfChannels,
  9951. int bitsPerSample,
  9952. const StringPairArray& metadataValues,
  9953. int qualityOptionIndex);
  9954. juce_UseDebuggingNewOperator
  9955. };
  9956. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9957. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9958. #endif
  9959. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9960. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9961. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9962. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9963. #if JUCE_USE_CDBURNER
  9964. class AudioCDBurner : public ChangeBroadcaster
  9965. {
  9966. public:
  9967. static const StringArray findAvailableDevices();
  9968. static AudioCDBurner* openDevice (const int deviceIndex);
  9969. ~AudioCDBurner();
  9970. enum DiskState
  9971. {
  9972. unknown, /**< An error condition, if the device isn't responding. */
  9973. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9974. may seem to be permanently open. */
  9975. noDisc, /**< The drive has no disk in it. */
  9976. writableDiskPresent, /**< The drive contains a writeable disk. */
  9977. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9978. };
  9979. DiskState getDiskState() const;
  9980. bool isDiskPresent() const;
  9981. bool openTray();
  9982. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9983. const Array<int> getAvailableWriteSpeeds() const;
  9984. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9985. int getNumAvailableAudioBlocks() const;
  9986. bool addAudioTrack (AudioSource* source, int numSamples);
  9987. class BurnProgressListener
  9988. {
  9989. public:
  9990. BurnProgressListener() throw() {}
  9991. virtual ~BurnProgressListener() {}
  9992. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9993. };
  9994. const String burn (BurnProgressListener* listener,
  9995. bool ejectDiscAfterwards,
  9996. bool performFakeBurnForTesting,
  9997. int writeSpeed);
  9998. void abortBurn();
  9999. juce_UseDebuggingNewOperator
  10000. private:
  10001. AudioCDBurner (const int deviceIndex);
  10002. class Pimpl;
  10003. friend class ScopedPointer<Pimpl>;
  10004. ScopedPointer<Pimpl> pimpl;
  10005. };
  10006. #endif
  10007. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  10008. /*** End of inlined file: juce_AudioCDBurner.h ***/
  10009. #endif
  10010. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  10011. /*** Start of inlined file: juce_AudioCDReader.h ***/
  10012. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  10013. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  10014. #if JUCE_USE_CDREADER
  10015. #if JUCE_MAC
  10016. #endif
  10017. class JUCE_API AudioCDReader : public AudioFormatReader
  10018. {
  10019. public:
  10020. static const StringArray getAvailableCDNames();
  10021. static AudioCDReader* createReaderForCD (const int index);
  10022. ~AudioCDReader();
  10023. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  10024. int64 startSampleInFile, int numSamples);
  10025. bool isCDStillPresent() const;
  10026. int getNumTracks() const;
  10027. int getPositionOfTrackStart (int trackNum) const;
  10028. bool isTrackAudio (int trackNum) const;
  10029. void refreshTrackLengths();
  10030. void enableIndexScanning (bool enabled);
  10031. int getLastIndex() const;
  10032. const Array <int> findIndexesInTrack (const int trackNumber);
  10033. int getCDDBId();
  10034. void ejectDisk();
  10035. juce_UseDebuggingNewOperator
  10036. private:
  10037. #if JUCE_MAC
  10038. File volumeDir;
  10039. Array<File> tracks;
  10040. Array<int> trackStartSamples;
  10041. int currentReaderTrack;
  10042. ScopedPointer <AudioFormatReader> reader;
  10043. AudioCDReader (const File& volume);
  10044. public:
  10045. static int compareElements (const File&, const File&);
  10046. private:
  10047. #elif JUCE_WINDOWS
  10048. int numTracks;
  10049. int trackStarts[100];
  10050. bool audioTracks [100];
  10051. void* handle;
  10052. bool indexingEnabled;
  10053. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  10054. MemoryBlock buffer;
  10055. AudioCDReader (void* handle);
  10056. int getIndexAt (int samplePos);
  10057. #elif JUCE_LINUX
  10058. AudioCDReader();
  10059. #endif
  10060. AudioCDReader (const AudioCDReader&);
  10061. AudioCDReader& operator= (const AudioCDReader&);
  10062. };
  10063. #endif
  10064. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  10065. /*** End of inlined file: juce_AudioCDReader.h ***/
  10066. #endif
  10067. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  10068. #endif
  10069. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10070. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  10071. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10072. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10073. class JUCE_API AudioFormatManager
  10074. {
  10075. public:
  10076. AudioFormatManager();
  10077. ~AudioFormatManager();
  10078. juce_DeclareSingleton (AudioFormatManager, false);
  10079. void registerFormat (AudioFormat* newFormat,
  10080. bool makeThisTheDefaultFormat);
  10081. void registerBasicFormats();
  10082. void clearFormats();
  10083. int getNumKnownFormats() const;
  10084. AudioFormat* getKnownFormat (int index) const;
  10085. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  10086. AudioFormat* getDefaultFormat() const;
  10087. const String getWildcardForAllFormats() const;
  10088. AudioFormatReader* createReaderFor (const File& audioFile);
  10089. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  10090. juce_UseDebuggingNewOperator
  10091. private:
  10092. OwnedArray<AudioFormat> knownFormats;
  10093. int defaultFormatIndex;
  10094. };
  10095. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  10096. /*** End of inlined file: juce_AudioFormatManager.h ***/
  10097. #endif
  10098. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  10099. #endif
  10100. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  10101. #endif
  10102. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10103. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  10104. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10105. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10106. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  10107. {
  10108. public:
  10109. AudioSubsectionReader (AudioFormatReader* sourceReader,
  10110. int64 subsectionStartSample,
  10111. int64 subsectionLength,
  10112. bool deleteSourceWhenDeleted);
  10113. ~AudioSubsectionReader();
  10114. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  10115. int64 startSampleInFile, int numSamples);
  10116. void readMaxLevels (int64 startSample,
  10117. int64 numSamples,
  10118. float& lowestLeft,
  10119. float& highestLeft,
  10120. float& lowestRight,
  10121. float& highestRight);
  10122. juce_UseDebuggingNewOperator
  10123. private:
  10124. AudioFormatReader* const source;
  10125. int64 startSample, length;
  10126. const bool deleteSourceWhenDeleted;
  10127. AudioSubsectionReader (const AudioSubsectionReader&);
  10128. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  10129. };
  10130. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  10131. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  10132. #endif
  10133. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10134. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  10135. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10136. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10137. class AudioThumbnailCache;
  10138. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  10139. public TimeSliceClient,
  10140. private Timer
  10141. {
  10142. public:
  10143. AudioThumbnail (int sourceSamplesPerThumbnailSample,
  10144. AudioFormatManager& formatManagerToUse,
  10145. AudioThumbnailCache& cacheToUse);
  10146. ~AudioThumbnail();
  10147. void setSource (InputSource* newSource);
  10148. void loadFrom (InputStream& input);
  10149. void saveTo (OutputStream& output) const;
  10150. int getNumChannels() const throw();
  10151. double getTotalLength() const throw();
  10152. void drawChannel (Graphics& g,
  10153. int x, int y, int w, int h,
  10154. double startTimeSeconds,
  10155. double endTimeSeconds,
  10156. int channelNum,
  10157. float verticalZoomFactor);
  10158. bool isFullyLoaded() const throw();
  10159. bool useTimeSlice();
  10160. void timerCallback();
  10161. juce_UseDebuggingNewOperator
  10162. private:
  10163. AudioFormatManager& formatManagerToUse;
  10164. AudioThumbnailCache& cache;
  10165. ScopedPointer <InputSource> source;
  10166. CriticalSection readerLock;
  10167. ScopedPointer <AudioFormatReader> reader;
  10168. MemoryBlock data, cachedLevels;
  10169. int orginalSamplesPerThumbnailSample;
  10170. int numChannelsCached, numSamplesCached;
  10171. double cachedStart, cachedTimePerPixel;
  10172. bool cacheNeedsRefilling;
  10173. void clear();
  10174. AudioFormatReader* createReader() const;
  10175. void generateSection (AudioFormatReader& reader, int64 startSample, int numSamples);
  10176. char* getChannelData (int channel) const;
  10177. void refillCache (int numSamples, double startTime, double timePerPixel);
  10178. friend class AudioThumbnailCache;
  10179. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  10180. bool initialiseFromAudioFile (AudioFormatReader& reader);
  10181. // returns true if more needs to be read
  10182. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  10183. };
  10184. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10185. /*** End of inlined file: juce_AudioThumbnail.h ***/
  10186. #endif
  10187. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10188. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  10189. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10190. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10191. struct ThumbnailCacheEntry;
  10192. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  10193. {
  10194. public:
  10195. explicit AudioThumbnailCache (int maxNumThumbsToStore);
  10196. ~AudioThumbnailCache();
  10197. void clear();
  10198. bool loadThumb (AudioThumbnail& thumb, int64 hashCode);
  10199. void storeThumb (const AudioThumbnail& thumb, int64 hashCode);
  10200. juce_UseDebuggingNewOperator
  10201. private:
  10202. OwnedArray <ThumbnailCacheEntry> thumbs;
  10203. int maxNumThumbsToStore;
  10204. friend class AudioThumbnail;
  10205. void addThumbnail (AudioThumbnail* thumb);
  10206. void removeThumbnail (AudioThumbnail* thumb);
  10207. };
  10208. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10209. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  10210. #endif
  10211. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10212. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10213. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10214. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10215. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10216. class JUCE_API FlacAudioFormat : public AudioFormat
  10217. {
  10218. public:
  10219. FlacAudioFormat();
  10220. ~FlacAudioFormat();
  10221. const Array <int> getPossibleSampleRates();
  10222. const Array <int> getPossibleBitDepths();
  10223. bool canDoStereo();
  10224. bool canDoMono();
  10225. bool isCompressed();
  10226. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10227. const bool deleteStreamIfOpeningFails);
  10228. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10229. double sampleRateToUse,
  10230. unsigned int numberOfChannels,
  10231. int bitsPerSample,
  10232. const StringPairArray& metadataValues,
  10233. int qualityOptionIndex);
  10234. juce_UseDebuggingNewOperator
  10235. };
  10236. #endif
  10237. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10238. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10239. #endif
  10240. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10241. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10242. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10243. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10244. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10245. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10246. {
  10247. public:
  10248. OggVorbisAudioFormat();
  10249. ~OggVorbisAudioFormat();
  10250. const Array <int> getPossibleSampleRates();
  10251. const Array <int> getPossibleBitDepths();
  10252. bool canDoStereo();
  10253. bool canDoMono();
  10254. bool isCompressed();
  10255. const StringArray getQualityOptions();
  10256. int estimateOggFileQuality (const File& source);
  10257. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10258. const bool deleteStreamIfOpeningFails);
  10259. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10260. double sampleRateToUse,
  10261. unsigned int numberOfChannels,
  10262. int bitsPerSample,
  10263. const StringPairArray& metadataValues,
  10264. int qualityOptionIndex);
  10265. juce_UseDebuggingNewOperator
  10266. };
  10267. #endif
  10268. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10269. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10270. #endif
  10271. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10272. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10273. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10274. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10275. #if JUCE_QUICKTIME
  10276. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10277. {
  10278. public:
  10279. QuickTimeAudioFormat();
  10280. ~QuickTimeAudioFormat();
  10281. const Array <int> getPossibleSampleRates();
  10282. const Array <int> getPossibleBitDepths();
  10283. bool canDoStereo();
  10284. bool canDoMono();
  10285. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10286. const bool deleteStreamIfOpeningFails);
  10287. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10288. double sampleRateToUse,
  10289. unsigned int numberOfChannels,
  10290. int bitsPerSample,
  10291. const StringPairArray& metadataValues,
  10292. int qualityOptionIndex);
  10293. juce_UseDebuggingNewOperator
  10294. };
  10295. #endif
  10296. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10297. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10298. #endif
  10299. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10300. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10301. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10302. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10303. class JUCE_API WavAudioFormat : public AudioFormat
  10304. {
  10305. public:
  10306. WavAudioFormat();
  10307. ~WavAudioFormat();
  10308. static const char* const bwavDescription;
  10309. static const char* const bwavOriginator;
  10310. static const char* const bwavOriginatorRef;
  10311. static const char* const bwavOriginationDate;
  10312. static const char* const bwavOriginationTime;
  10313. static const char* const bwavTimeReference;
  10314. static const char* const bwavCodingHistory;
  10315. static const StringPairArray createBWAVMetadata (const String& description,
  10316. const String& originator,
  10317. const String& originatorRef,
  10318. const Time& dateAndTime,
  10319. const int64 timeReferenceSamples,
  10320. const String& codingHistory);
  10321. const Array <int> getPossibleSampleRates();
  10322. const Array <int> getPossibleBitDepths();
  10323. bool canDoStereo();
  10324. bool canDoMono();
  10325. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10326. const bool deleteStreamIfOpeningFails);
  10327. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10328. double sampleRateToUse,
  10329. unsigned int numberOfChannels,
  10330. int bitsPerSample,
  10331. const StringPairArray& metadataValues,
  10332. int qualityOptionIndex);
  10333. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10334. juce_UseDebuggingNewOperator
  10335. };
  10336. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10337. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10338. #endif
  10339. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10340. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10341. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10342. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10343. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10344. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10345. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10346. class JUCE_API PositionableAudioSource : public AudioSource
  10347. {
  10348. protected:
  10349. PositionableAudioSource() throw() {}
  10350. public:
  10351. ~PositionableAudioSource() {}
  10352. virtual void setNextReadPosition (int newPosition) = 0;
  10353. virtual int getNextReadPosition() const = 0;
  10354. virtual int getTotalLength() const = 0;
  10355. virtual bool isLooping() const = 0;
  10356. };
  10357. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10358. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10359. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10360. {
  10361. public:
  10362. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10363. const bool deleteReaderWhenThisIsDeleted);
  10364. ~AudioFormatReaderSource();
  10365. void setLooping (const bool shouldLoop) throw();
  10366. bool isLooping() const { return looping; }
  10367. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10368. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10369. void releaseResources();
  10370. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10371. void setNextReadPosition (int newPosition);
  10372. int getNextReadPosition() const;
  10373. int getTotalLength() const;
  10374. juce_UseDebuggingNewOperator
  10375. private:
  10376. AudioFormatReader* reader;
  10377. bool deleteReader;
  10378. int volatile nextPlayPos;
  10379. bool volatile looping;
  10380. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10381. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10382. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10383. };
  10384. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10385. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10386. #endif
  10387. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10388. #endif
  10389. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10390. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10391. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10392. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10393. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10394. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10395. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10396. class AudioIODevice;
  10397. class JUCE_API AudioIODeviceCallback
  10398. {
  10399. public:
  10400. virtual ~AudioIODeviceCallback() {}
  10401. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10402. int numInputChannels,
  10403. float** outputChannelData,
  10404. int numOutputChannels,
  10405. int numSamples) = 0;
  10406. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10407. virtual void audioDeviceStopped() = 0;
  10408. };
  10409. class JUCE_API AudioIODevice
  10410. {
  10411. public:
  10412. virtual ~AudioIODevice();
  10413. const String& getName() const throw() { return name; }
  10414. const String& getTypeName() const throw() { return typeName; }
  10415. virtual const StringArray getOutputChannelNames() = 0;
  10416. virtual const StringArray getInputChannelNames() = 0;
  10417. virtual int getNumSampleRates() = 0;
  10418. virtual double getSampleRate (int index) = 0;
  10419. virtual int getNumBufferSizesAvailable() = 0;
  10420. virtual int getBufferSizeSamples (int index) = 0;
  10421. virtual int getDefaultBufferSize() = 0;
  10422. virtual const String open (const BigInteger& inputChannels,
  10423. const BigInteger& outputChannels,
  10424. double sampleRate,
  10425. int bufferSizeSamples) = 0;
  10426. virtual void close() = 0;
  10427. virtual bool isOpen() = 0;
  10428. virtual void start (AudioIODeviceCallback* callback) = 0;
  10429. virtual void stop() = 0;
  10430. virtual bool isPlaying() = 0;
  10431. virtual const String getLastError() = 0;
  10432. virtual int getCurrentBufferSizeSamples() = 0;
  10433. virtual double getCurrentSampleRate() = 0;
  10434. virtual int getCurrentBitDepth() = 0;
  10435. virtual const BigInteger getActiveOutputChannels() const = 0;
  10436. virtual const BigInteger getActiveInputChannels() const = 0;
  10437. virtual int getOutputLatencyInSamples() = 0;
  10438. virtual int getInputLatencyInSamples() = 0;
  10439. virtual bool hasControlPanel() const;
  10440. virtual bool showControlPanel();
  10441. protected:
  10442. AudioIODevice (const String& deviceName,
  10443. const String& typeName);
  10444. String name, typeName;
  10445. };
  10446. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10447. /*** End of inlined file: juce_AudioIODevice.h ***/
  10448. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10449. {
  10450. public:
  10451. AudioSourcePlayer();
  10452. virtual ~AudioSourcePlayer();
  10453. void setSource (AudioSource* newSource);
  10454. AudioSource* getCurrentSource() const throw() { return source; }
  10455. void setGain (const float newGain) throw();
  10456. void audioDeviceIOCallback (const float** inputChannelData,
  10457. int totalNumInputChannels,
  10458. float** outputChannelData,
  10459. int totalNumOutputChannels,
  10460. int numSamples);
  10461. void audioDeviceAboutToStart (AudioIODevice* device);
  10462. void audioDeviceStopped();
  10463. juce_UseDebuggingNewOperator
  10464. private:
  10465. CriticalSection readLock;
  10466. AudioSource* source;
  10467. double sampleRate;
  10468. int bufferSize;
  10469. float* channels [128];
  10470. float* outputChans [128];
  10471. const float* inputChans [128];
  10472. AudioSampleBuffer tempBuffer;
  10473. float lastGain, gain;
  10474. AudioSourcePlayer (const AudioSourcePlayer&);
  10475. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10476. };
  10477. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10478. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10479. #endif
  10480. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10481. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10482. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10483. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10484. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10485. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10486. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10487. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10488. {
  10489. public:
  10490. BufferingAudioSource (PositionableAudioSource* source,
  10491. const bool deleteSourceWhenDeleted,
  10492. int numberOfSamplesToBuffer);
  10493. ~BufferingAudioSource();
  10494. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10495. void releaseResources();
  10496. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10497. void setNextReadPosition (int newPosition);
  10498. int getNextReadPosition() const;
  10499. int getTotalLength() const { return source->getTotalLength(); }
  10500. bool isLooping() const { return source->isLooping(); }
  10501. juce_UseDebuggingNewOperator
  10502. private:
  10503. PositionableAudioSource* source;
  10504. bool deleteSourceWhenDeleted;
  10505. int numberOfSamplesToBuffer;
  10506. AudioSampleBuffer buffer;
  10507. CriticalSection bufferStartPosLock;
  10508. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10509. bool wasSourceLooping;
  10510. double volatile sampleRate;
  10511. friend class SharedBufferingAudioSourceThread;
  10512. bool readNextBufferChunk();
  10513. void readBufferSection (int start, int length, int bufferOffset);
  10514. BufferingAudioSource (const BufferingAudioSource&);
  10515. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10516. };
  10517. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10518. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10519. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10520. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10521. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10522. class JUCE_API ResamplingAudioSource : public AudioSource
  10523. {
  10524. public:
  10525. ResamplingAudioSource (AudioSource* const inputSource,
  10526. const bool deleteInputWhenDeleted);
  10527. ~ResamplingAudioSource();
  10528. void setResamplingRatio (const double samplesInPerOutputSample);
  10529. double getResamplingRatio() const throw() { return ratio; }
  10530. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10531. void releaseResources();
  10532. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10533. juce_UseDebuggingNewOperator
  10534. private:
  10535. AudioSource* const input;
  10536. const bool deleteInputWhenDeleted;
  10537. double ratio, lastRatio;
  10538. AudioSampleBuffer buffer;
  10539. int bufferPos, sampsInBuffer;
  10540. double subSampleOffset;
  10541. double coefficients[6];
  10542. CriticalSection ratioLock;
  10543. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10544. void createLowPass (const double proportionalRate);
  10545. struct FilterState
  10546. {
  10547. double x1, x2, y1, y2;
  10548. };
  10549. FilterState filterStates[2];
  10550. void resetFilters();
  10551. void applyFilter (float* samples, int num, FilterState& fs);
  10552. ResamplingAudioSource (const ResamplingAudioSource&);
  10553. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10554. };
  10555. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10556. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10557. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10558. public ChangeBroadcaster
  10559. {
  10560. public:
  10561. AudioTransportSource();
  10562. ~AudioTransportSource();
  10563. void setSource (PositionableAudioSource* const newSource,
  10564. int readAheadBufferSize = 0,
  10565. double sourceSampleRateToCorrectFor = 0.0);
  10566. void setPosition (double newPosition);
  10567. double getCurrentPosition() const;
  10568. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10569. void start();
  10570. void stop();
  10571. bool isPlaying() const throw() { return playing; }
  10572. void setGain (const float newGain) throw();
  10573. float getGain() const throw() { return gain; }
  10574. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10575. void releaseResources();
  10576. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10577. void setNextReadPosition (int newPosition);
  10578. int getNextReadPosition() const;
  10579. int getTotalLength() const;
  10580. bool isLooping() const;
  10581. juce_UseDebuggingNewOperator
  10582. private:
  10583. PositionableAudioSource* source;
  10584. ResamplingAudioSource* resamplerSource;
  10585. BufferingAudioSource* bufferingSource;
  10586. PositionableAudioSource* positionableSource;
  10587. AudioSource* masterSource;
  10588. CriticalSection callbackLock;
  10589. float volatile gain, lastGain;
  10590. bool volatile playing, stopped;
  10591. double sampleRate, sourceSampleRate;
  10592. int blockSize, readAheadBufferSize;
  10593. bool isPrepared, inputStreamEOF;
  10594. AudioTransportSource (const AudioTransportSource&);
  10595. AudioTransportSource& operator= (const AudioTransportSource&);
  10596. };
  10597. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10598. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10599. #endif
  10600. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10601. #endif
  10602. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10603. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10604. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10605. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10606. class ChannelRemappingAudioSource : public AudioSource
  10607. {
  10608. public:
  10609. ChannelRemappingAudioSource (AudioSource* const source,
  10610. const bool deleteSourceWhenDeleted);
  10611. ~ChannelRemappingAudioSource();
  10612. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10613. void clearAllMappings() throw();
  10614. void setInputChannelMapping (const int destChannelIndex,
  10615. const int sourceChannelIndex) throw();
  10616. void setOutputChannelMapping (const int sourceChannelIndex,
  10617. const int destChannelIndex) throw();
  10618. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10619. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10620. XmlElement* createXml() const throw();
  10621. void restoreFromXml (const XmlElement& e) throw();
  10622. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10623. void releaseResources();
  10624. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10625. juce_UseDebuggingNewOperator
  10626. private:
  10627. int requiredNumberOfChannels;
  10628. Array <int> remappedInputs, remappedOutputs;
  10629. AudioSource* const source;
  10630. const bool deleteSourceWhenDeleted;
  10631. AudioSampleBuffer buffer;
  10632. AudioSourceChannelInfo remappedInfo;
  10633. CriticalSection lock;
  10634. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10635. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10636. };
  10637. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10638. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10639. #endif
  10640. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10641. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10642. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10643. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10644. /*** Start of inlined file: juce_IIRFilter.h ***/
  10645. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10646. #define __JUCE_IIRFILTER_JUCEHEADER__
  10647. class JUCE_API IIRFilter
  10648. {
  10649. public:
  10650. IIRFilter();
  10651. IIRFilter (const IIRFilter& other);
  10652. ~IIRFilter();
  10653. void reset() throw();
  10654. void processSamples (float* samples,
  10655. int numSamples) throw();
  10656. float processSingleSampleRaw (float sample) throw();
  10657. void makeLowPass (double sampleRate,
  10658. double frequency) throw();
  10659. void makeHighPass (double sampleRate,
  10660. double frequency) throw();
  10661. void makeLowShelf (double sampleRate,
  10662. double cutOffFrequency,
  10663. double Q,
  10664. float gainFactor) throw();
  10665. void makeHighShelf (double sampleRate,
  10666. double cutOffFrequency,
  10667. double Q,
  10668. float gainFactor) throw();
  10669. void makeBandPass (double sampleRate,
  10670. double centreFrequency,
  10671. double Q,
  10672. float gainFactor) throw();
  10673. void makeInactive() throw();
  10674. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10675. juce_UseDebuggingNewOperator
  10676. protected:
  10677. CriticalSection processLock;
  10678. void setCoefficients (double c1, double c2, double c3,
  10679. double c4, double c5, double c6) throw();
  10680. bool active;
  10681. float coefficients[6];
  10682. float x1, x2, y1, y2;
  10683. // (use the copyCoefficientsFrom() method instead of this operator)
  10684. IIRFilter& operator= (const IIRFilter&);
  10685. };
  10686. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10687. /*** End of inlined file: juce_IIRFilter.h ***/
  10688. class JUCE_API IIRFilterAudioSource : public AudioSource
  10689. {
  10690. public:
  10691. IIRFilterAudioSource (AudioSource* const inputSource,
  10692. const bool deleteInputWhenDeleted);
  10693. ~IIRFilterAudioSource();
  10694. void setFilterParameters (const IIRFilter& newSettings);
  10695. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10696. void releaseResources();
  10697. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10698. juce_UseDebuggingNewOperator
  10699. private:
  10700. AudioSource* const input;
  10701. const bool deleteInputWhenDeleted;
  10702. OwnedArray <IIRFilter> iirFilters;
  10703. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10704. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10705. };
  10706. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10707. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10708. #endif
  10709. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10710. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10711. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10712. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10713. class JUCE_API MixerAudioSource : public AudioSource
  10714. {
  10715. public:
  10716. MixerAudioSource();
  10717. ~MixerAudioSource();
  10718. void addInputSource (AudioSource* newInput,
  10719. const bool deleteWhenRemoved);
  10720. void removeInputSource (AudioSource* input,
  10721. const bool deleteSource);
  10722. void removeAllInputs();
  10723. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10724. void releaseResources();
  10725. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10726. juce_UseDebuggingNewOperator
  10727. private:
  10728. VoidArray inputs;
  10729. BigInteger inputsToDelete;
  10730. CriticalSection lock;
  10731. AudioSampleBuffer tempBuffer;
  10732. double currentSampleRate;
  10733. int bufferSizeExpected;
  10734. MixerAudioSource (const MixerAudioSource&);
  10735. MixerAudioSource& operator= (const MixerAudioSource&);
  10736. };
  10737. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10738. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10739. #endif
  10740. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10741. #endif
  10742. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10743. #endif
  10744. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10745. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10746. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10747. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10748. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10749. {
  10750. public:
  10751. ToneGeneratorAudioSource();
  10752. ~ToneGeneratorAudioSource();
  10753. void setAmplitude (const float newAmplitude);
  10754. void setFrequency (const double newFrequencyHz);
  10755. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10756. void releaseResources();
  10757. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10758. juce_UseDebuggingNewOperator
  10759. private:
  10760. double frequency, sampleRate;
  10761. double currentPhase, phasePerSample;
  10762. float amplitude;
  10763. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10764. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10765. };
  10766. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10767. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10768. #endif
  10769. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10770. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10771. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10772. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10773. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10774. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10775. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10776. class AudioDeviceManager;
  10777. class Component;
  10778. class JUCE_API AudioIODeviceType
  10779. {
  10780. public:
  10781. const String& getTypeName() const throw() { return typeName; }
  10782. virtual void scanForDevices() = 0;
  10783. virtual const StringArray getDeviceNames (bool wantInputNames = false) const = 0;
  10784. virtual int getDefaultDeviceIndex (bool forInput) const = 0;
  10785. virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
  10786. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10787. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10788. const String& inputDeviceName) = 0;
  10789. struct DeviceSetupDetails
  10790. {
  10791. AudioDeviceManager* manager;
  10792. int minNumInputChannels, maxNumInputChannels;
  10793. int minNumOutputChannels, maxNumOutputChannels;
  10794. bool useStereoPairs;
  10795. };
  10796. virtual ~AudioIODeviceType();
  10797. protected:
  10798. explicit AudioIODeviceType (const String& typeName);
  10799. private:
  10800. String typeName;
  10801. AudioIODeviceType (const AudioIODeviceType&);
  10802. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10803. };
  10804. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10805. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10806. /*** Start of inlined file: juce_MidiInput.h ***/
  10807. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10808. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10809. /*** Start of inlined file: juce_MidiMessage.h ***/
  10810. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10811. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10812. class JUCE_API MidiMessage
  10813. {
  10814. public:
  10815. MidiMessage (int byte1, int byte2, int byte3, double timeStamp = 0) throw();
  10816. MidiMessage (int byte1, int byte2, double timeStamp = 0) throw();
  10817. MidiMessage (int byte1, double timeStamp = 0) throw();
  10818. MidiMessage (const void* data, int numBytes, double timeStamp = 0);
  10819. MidiMessage (const void* data, int maxBytesToUse,
  10820. int& numBytesUsed, uint8 lastStatusByte,
  10821. double timeStamp = 0);
  10822. MidiMessage (const MidiMessage& other);
  10823. MidiMessage (const MidiMessage& other, double newTimeStamp);
  10824. ~MidiMessage();
  10825. MidiMessage& operator= (const MidiMessage& other);
  10826. uint8* getRawData() const throw() { return data; }
  10827. int getRawDataSize() const throw() { return size; }
  10828. double getTimeStamp() const throw() { return timeStamp; }
  10829. void setTimeStamp (double newTimestamp) throw() { timeStamp = newTimestamp; }
  10830. void addToTimeStamp (double delta) throw() { timeStamp += delta; }
  10831. int getChannel() const throw();
  10832. bool isForChannel (int channelNumber) const throw();
  10833. void setChannel (int newChannelNumber) throw();
  10834. bool isSysEx() const throw();
  10835. const uint8* getSysExData() const throw();
  10836. int getSysExDataSize() const throw();
  10837. bool isNoteOn (bool returnTrueForVelocity0 = false) const throw();
  10838. static const MidiMessage noteOn (int channel, int noteNumber, float velocity) throw();
  10839. static const MidiMessage noteOn (int channel, int noteNumber, uint8 velocity) throw();
  10840. bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const throw();
  10841. static const MidiMessage noteOff (int channel, int noteNumber) throw();
  10842. bool isNoteOnOrOff() const throw();
  10843. int getNoteNumber() const throw();
  10844. void setNoteNumber (int newNoteNumber) throw();
  10845. uint8 getVelocity() const throw();
  10846. float getFloatVelocity() const throw();
  10847. void setVelocity (float newVelocity) throw();
  10848. void multiplyVelocity (float scaleFactor) throw();
  10849. bool isProgramChange() const throw();
  10850. int getProgramChangeNumber() const throw();
  10851. static const MidiMessage programChange (int channel, int programNumber) throw();
  10852. bool isPitchWheel() const throw();
  10853. int getPitchWheelValue() const throw();
  10854. static const MidiMessage pitchWheel (int channel, int position) throw();
  10855. bool isAftertouch() const throw();
  10856. int getAfterTouchValue() const throw();
  10857. static const MidiMessage aftertouchChange (int channel,
  10858. int noteNumber,
  10859. int aftertouchAmount) throw();
  10860. bool isChannelPressure() const throw();
  10861. int getChannelPressureValue() const throw();
  10862. static const MidiMessage channelPressureChange (int channel, int pressure) throw();
  10863. bool isController() const throw();
  10864. int getControllerNumber() const throw();
  10865. int getControllerValue() const throw();
  10866. static const MidiMessage controllerEvent (int channel,
  10867. int controllerType,
  10868. int value) throw();
  10869. bool isAllNotesOff() const throw();
  10870. bool isAllSoundOff() const throw();
  10871. static const MidiMessage allNotesOff (int channel) throw();
  10872. static const MidiMessage allSoundOff (int channel) throw();
  10873. static const MidiMessage allControllersOff (int channel) throw();
  10874. bool isMetaEvent() const throw();
  10875. int getMetaEventType() const throw();
  10876. const uint8* getMetaEventData() const throw();
  10877. int getMetaEventLength() const throw();
  10878. bool isTrackMetaEvent() const throw();
  10879. bool isEndOfTrackMetaEvent() const throw();
  10880. static const MidiMessage endOfTrack() throw();
  10881. bool isTrackNameEvent() const throw();
  10882. bool isTextMetaEvent() const throw();
  10883. const String getTextFromTextMetaEvent() const;
  10884. bool isTempoMetaEvent() const throw();
  10885. double getTempoMetaEventTickLength (short timeFormat) const throw();
  10886. double getTempoSecondsPerQuarterNote() const throw();
  10887. static const MidiMessage tempoMetaEvent (int microsecondsPerQuarterNote) throw();
  10888. bool isTimeSignatureMetaEvent() const throw();
  10889. void getTimeSignatureInfo (int& numerator, int& denominator) const throw();
  10890. static const MidiMessage timeSignatureMetaEvent (int numerator, int denominator);
  10891. bool isKeySignatureMetaEvent() const throw();
  10892. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10893. bool isMidiChannelMetaEvent() const throw();
  10894. int getMidiChannelMetaEventChannel() const throw();
  10895. static const MidiMessage midiChannelMetaEvent (int channel) throw();
  10896. bool isActiveSense() const throw();
  10897. bool isMidiStart() const throw();
  10898. static const MidiMessage midiStart() throw();
  10899. bool isMidiContinue() const throw();
  10900. static const MidiMessage midiContinue() throw();
  10901. bool isMidiStop() const throw();
  10902. static const MidiMessage midiStop() throw();
  10903. bool isMidiClock() const throw();
  10904. static const MidiMessage midiClock() throw();
  10905. bool isSongPositionPointer() const throw();
  10906. int getSongPositionPointerMidiBeat() const throw();
  10907. static const MidiMessage songPositionPointer (int positionInMidiBeats) throw();
  10908. bool isQuarterFrame() const throw();
  10909. int getQuarterFrameSequenceNumber() const throw();
  10910. int getQuarterFrameValue() const throw();
  10911. static const MidiMessage quarterFrame (int sequenceNumber, int value) throw();
  10912. enum SmpteTimecodeType
  10913. {
  10914. fps24 = 0,
  10915. fps25 = 1,
  10916. fps30drop = 2,
  10917. fps30 = 3
  10918. };
  10919. bool isFullFrame() const throw();
  10920. void getFullFrameParameters (int& hours,
  10921. int& minutes,
  10922. int& seconds,
  10923. int& frames,
  10924. SmpteTimecodeType& timecodeType) const throw();
  10925. static const MidiMessage fullFrame (int hours,
  10926. int minutes,
  10927. int seconds,
  10928. int frames,
  10929. SmpteTimecodeType timecodeType);
  10930. enum MidiMachineControlCommand
  10931. {
  10932. mmc_stop = 1,
  10933. mmc_play = 2,
  10934. mmc_deferredplay = 3,
  10935. mmc_fastforward = 4,
  10936. mmc_rewind = 5,
  10937. mmc_recordStart = 6,
  10938. mmc_recordStop = 7,
  10939. mmc_pause = 9
  10940. };
  10941. bool isMidiMachineControlMessage() const throw();
  10942. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10943. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10944. bool isMidiMachineControlGoto (int& hours,
  10945. int& minutes,
  10946. int& seconds,
  10947. int& frames) const throw();
  10948. static const MidiMessage midiMachineControlGoto (int hours,
  10949. int minutes,
  10950. int seconds,
  10951. int frames);
  10952. static const MidiMessage masterVolume (float volume);
  10953. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10954. int dataSize);
  10955. static int readVariableLengthVal (const uint8* data,
  10956. int& numBytesUsed) throw();
  10957. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10958. static const String getMidiNoteName (int noteNumber,
  10959. bool useSharps,
  10960. bool includeOctaveNumber,
  10961. int octaveNumForMiddleC) throw();
  10962. static const double getMidiNoteInHertz (int noteNumber) throw();
  10963. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10964. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10965. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10966. static const String getControllerName (int controllerNumber) throw();
  10967. juce_UseDebuggingNewOperator
  10968. private:
  10969. double timeStamp;
  10970. uint8* data;
  10971. int size;
  10972. union
  10973. {
  10974. uint8 asBytes[4];
  10975. uint32 asInt32;
  10976. } preallocatedData;
  10977. };
  10978. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10979. /*** End of inlined file: juce_MidiMessage.h ***/
  10980. class MidiInput;
  10981. class JUCE_API MidiInputCallback
  10982. {
  10983. public:
  10984. virtual ~MidiInputCallback() {}
  10985. virtual void handleIncomingMidiMessage (MidiInput* source,
  10986. const MidiMessage& message) = 0;
  10987. virtual void handlePartialSysexMessage (MidiInput* source,
  10988. const uint8* messageData,
  10989. const int numBytesSoFar,
  10990. const double timestamp)
  10991. {
  10992. // (this bit is just to avoid compiler warnings about unused variables)
  10993. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10994. }
  10995. };
  10996. class JUCE_API MidiInput
  10997. {
  10998. public:
  10999. static const StringArray getDevices();
  11000. static int getDefaultDeviceIndex();
  11001. static MidiInput* openDevice (int deviceIndex,
  11002. MidiInputCallback* callback);
  11003. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  11004. static MidiInput* createNewDevice (const String& deviceName,
  11005. MidiInputCallback* callback);
  11006. #endif
  11007. virtual ~MidiInput();
  11008. virtual const String getName() const throw() { return name; }
  11009. virtual void setName (const String& newName) throw() { name = newName; }
  11010. virtual void start();
  11011. virtual void stop();
  11012. juce_UseDebuggingNewOperator
  11013. protected:
  11014. String name;
  11015. void* internal;
  11016. explicit MidiInput (const String& name);
  11017. private:
  11018. MidiInput (const MidiInput&);
  11019. MidiInput& operator= (const MidiInput&);
  11020. };
  11021. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  11022. /*** End of inlined file: juce_MidiInput.h ***/
  11023. /*** Start of inlined file: juce_MidiOutput.h ***/
  11024. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11025. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  11026. /*** Start of inlined file: juce_MidiBuffer.h ***/
  11027. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11028. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  11029. class JUCE_API MidiBuffer
  11030. {
  11031. public:
  11032. MidiBuffer() throw();
  11033. explicit MidiBuffer (const MidiMessage& message) throw();
  11034. MidiBuffer (const MidiBuffer& other) throw();
  11035. MidiBuffer& operator= (const MidiBuffer& other) throw();
  11036. ~MidiBuffer() throw();
  11037. void clear() throw();
  11038. void clear (const int start,
  11039. const int numSamples) throw();
  11040. bool isEmpty() const throw();
  11041. int getNumEvents() const throw();
  11042. void addEvent (const MidiMessage& midiMessage,
  11043. const int sampleNumber) throw();
  11044. void addEvent (const uint8* const rawMidiData,
  11045. const int maxBytesOfMidiData,
  11046. const int sampleNumber) throw();
  11047. void addEvents (const MidiBuffer& otherBuffer,
  11048. const int startSample,
  11049. const int numSamples,
  11050. const int sampleDeltaToAdd) throw();
  11051. int getFirstEventTime() const throw();
  11052. int getLastEventTime() const throw();
  11053. void swapWith (MidiBuffer& other);
  11054. void ensureSize (size_t minimumNumBytes);
  11055. class Iterator
  11056. {
  11057. public:
  11058. Iterator (const MidiBuffer& buffer) throw();
  11059. ~Iterator() throw();
  11060. void setNextSamplePosition (const int samplePosition) throw();
  11061. bool getNextEvent (MidiMessage& result,
  11062. int& samplePosition) throw();
  11063. bool getNextEvent (const uint8* &midiData,
  11064. int& numBytesOfMidiData,
  11065. int& samplePosition) throw();
  11066. juce_UseDebuggingNewOperator
  11067. private:
  11068. const MidiBuffer& buffer;
  11069. const uint8* data;
  11070. Iterator (const Iterator&);
  11071. Iterator& operator= (const Iterator&);
  11072. };
  11073. juce_UseDebuggingNewOperator
  11074. private:
  11075. friend class MidiBuffer::Iterator;
  11076. MemoryBlock data;
  11077. int bytesUsed;
  11078. uint8* getData() const throw();
  11079. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  11080. static int getEventTime (const void* d) throw();
  11081. static uint16 getEventDataSize (const void* d) throw();
  11082. static uint16 getEventTotalSize (const void* d) throw();
  11083. };
  11084. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  11085. /*** End of inlined file: juce_MidiBuffer.h ***/
  11086. class JUCE_API MidiOutput : private Thread
  11087. {
  11088. public:
  11089. static const StringArray getDevices();
  11090. static int getDefaultDeviceIndex();
  11091. static MidiOutput* openDevice (int deviceIndex);
  11092. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  11093. static MidiOutput* createNewDevice (const String& deviceName);
  11094. #endif
  11095. virtual ~MidiOutput();
  11096. virtual void sendMessageNow (const MidiMessage& message);
  11097. virtual void reset();
  11098. virtual bool getVolume (float& leftVol,
  11099. float& rightVol);
  11100. virtual void setVolume (float leftVol,
  11101. float rightVol);
  11102. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  11103. double millisecondCounterToStartAt,
  11104. double samplesPerSecondForBuffer);
  11105. virtual void clearAllPendingMessages();
  11106. virtual void startBackgroundThread();
  11107. virtual void stopBackgroundThread();
  11108. juce_UseDebuggingNewOperator
  11109. protected:
  11110. void* internal;
  11111. struct PendingMessage
  11112. {
  11113. PendingMessage (const uint8* data, int len, double sampleNumber);
  11114. MidiMessage message;
  11115. PendingMessage* next;
  11116. juce_UseDebuggingNewOperator
  11117. };
  11118. CriticalSection lock;
  11119. PendingMessage* firstMessage;
  11120. MidiOutput();
  11121. void run();
  11122. private:
  11123. MidiOutput (const MidiOutput&);
  11124. MidiOutput& operator= (const MidiOutput&);
  11125. };
  11126. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  11127. /*** End of inlined file: juce_MidiOutput.h ***/
  11128. /*** Start of inlined file: juce_ComboBox.h ***/
  11129. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  11130. #define __JUCE_COMBOBOX_JUCEHEADER__
  11131. /*** Start of inlined file: juce_Label.h ***/
  11132. #ifndef __JUCE_LABEL_JUCEHEADER__
  11133. #define __JUCE_LABEL_JUCEHEADER__
  11134. /*** Start of inlined file: juce_TextEditor.h ***/
  11135. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  11136. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  11137. /*** Start of inlined file: juce_Viewport.h ***/
  11138. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  11139. #define __JUCE_VIEWPORT_JUCEHEADER__
  11140. /*** Start of inlined file: juce_ScrollBar.h ***/
  11141. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  11142. #define __JUCE_SCROLLBAR_JUCEHEADER__
  11143. /*** Start of inlined file: juce_Button.h ***/
  11144. #ifndef __JUCE_BUTTON_JUCEHEADER__
  11145. #define __JUCE_BUTTON_JUCEHEADER__
  11146. /*** Start of inlined file: juce_TooltipWindow.h ***/
  11147. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11148. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11149. /*** Start of inlined file: juce_TooltipClient.h ***/
  11150. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11151. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11152. class JUCE_API TooltipClient
  11153. {
  11154. public:
  11155. virtual ~TooltipClient() {}
  11156. virtual const String getTooltip() = 0;
  11157. };
  11158. class JUCE_API SettableTooltipClient : public TooltipClient
  11159. {
  11160. public:
  11161. virtual ~SettableTooltipClient() {}
  11162. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  11163. virtual const String getTooltip() { return tooltipString; }
  11164. juce_UseDebuggingNewOperator
  11165. protected:
  11166. String tooltipString;
  11167. };
  11168. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11169. /*** End of inlined file: juce_TooltipClient.h ***/
  11170. class JUCE_API TooltipWindow : public Component,
  11171. private Timer
  11172. {
  11173. public:
  11174. explicit TooltipWindow (Component* parentComponent = 0,
  11175. int millisecondsBeforeTipAppears = 700);
  11176. ~TooltipWindow();
  11177. void setMillisecondsBeforeTipAppears (int newTimeMs = 700) throw();
  11178. enum ColourIds
  11179. {
  11180. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  11181. textColourId = 0x1001c00, /**< The colour to use for the text. */
  11182. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  11183. };
  11184. juce_UseDebuggingNewOperator
  11185. private:
  11186. int millisecondsBeforeTipAppears;
  11187. Point<int> lastMousePos;
  11188. int mouseClicks;
  11189. unsigned int lastCompChangeTime, lastHideTime;
  11190. Component* lastComponentUnderMouse;
  11191. bool changedCompsSinceShown;
  11192. String tipShowing, lastTipUnderMouse;
  11193. void paint (Graphics& g);
  11194. void mouseEnter (const MouseEvent& e);
  11195. void timerCallback();
  11196. static const String getTipFor (Component* c);
  11197. void showFor (const String& tip);
  11198. void hide();
  11199. TooltipWindow (const TooltipWindow&);
  11200. TooltipWindow& operator= (const TooltipWindow&);
  11201. };
  11202. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11203. /*** End of inlined file: juce_TooltipWindow.h ***/
  11204. class Button;
  11205. class JUCE_API ButtonListener
  11206. {
  11207. public:
  11208. virtual ~ButtonListener() {}
  11209. virtual void buttonClicked (Button* button) = 0;
  11210. virtual void buttonStateChanged (Button*) {}
  11211. };
  11212. class JUCE_API Button : public Component,
  11213. public SettableTooltipClient,
  11214. public ApplicationCommandManagerListener,
  11215. public Value::Listener,
  11216. private KeyListener
  11217. {
  11218. protected:
  11219. explicit Button (const String& buttonName);
  11220. public:
  11221. virtual ~Button();
  11222. void setButtonText (const String& newText);
  11223. const String getButtonText() const { return text; }
  11224. bool isDown() const throw();
  11225. bool isOver() const throw();
  11226. void setToggleState (bool shouldBeOn,
  11227. bool sendChangeNotification);
  11228. bool getToggleState() const throw() { return isOn.getValue(); }
  11229. Value& getToggleStateValue() { return isOn; }
  11230. void setClickingTogglesState (bool shouldToggle) throw();
  11231. bool getClickingTogglesState() const throw();
  11232. void setRadioGroupId (int newGroupId);
  11233. int getRadioGroupId() const throw() { return radioGroupId; }
  11234. void addButtonListener (ButtonListener* newListener);
  11235. void removeButtonListener (ButtonListener* listener);
  11236. virtual void triggerClick();
  11237. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11238. int commandID,
  11239. bool generateTooltip);
  11240. int getCommandID() const throw() { return commandID; }
  11241. void addShortcut (const KeyPress& key);
  11242. void clearShortcuts();
  11243. bool isRegisteredForShortcut (const KeyPress& key) const;
  11244. void setRepeatSpeed (int initialDelayInMillisecs,
  11245. int repeatDelayInMillisecs,
  11246. int minimumDelayInMillisecs = -1) throw();
  11247. void setTriggeredOnMouseDown (bool isTriggeredOnMouseDown) throw();
  11248. uint32 getMillisecondsSinceButtonDown() const throw();
  11249. void setVisible (bool shouldBeVisible);
  11250. void setTooltip (const String& newTooltip);
  11251. // (implementation of the TooltipClient method)
  11252. const String getTooltip();
  11253. enum ConnectedEdgeFlags
  11254. {
  11255. ConnectedOnLeft = 1,
  11256. ConnectedOnRight = 2,
  11257. ConnectedOnTop = 4,
  11258. ConnectedOnBottom = 8
  11259. };
  11260. void setConnectedEdges (int connectedEdgeFlags);
  11261. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11262. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11263. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11264. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11265. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11266. enum ButtonState
  11267. {
  11268. buttonNormal,
  11269. buttonOver,
  11270. buttonDown
  11271. };
  11272. void setState (const ButtonState newState);
  11273. juce_UseDebuggingNewOperator
  11274. protected:
  11275. virtual void clicked();
  11276. virtual void clicked (const ModifierKeys& modifiers);
  11277. virtual void paintButton (Graphics& g,
  11278. bool isMouseOverButton,
  11279. bool isButtonDown) = 0;
  11280. virtual void buttonStateChanged();
  11281. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11282. void handleCommandMessage (int commandId);
  11283. void mouseEnter (const MouseEvent& e);
  11284. void mouseExit (const MouseEvent& e);
  11285. void mouseDown (const MouseEvent& e);
  11286. void mouseDrag (const MouseEvent& e);
  11287. void mouseUp (const MouseEvent& e);
  11288. bool keyPressed (const KeyPress& key);
  11289. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11290. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  11291. void paint (Graphics& g);
  11292. void parentHierarchyChanged();
  11293. void focusGained (FocusChangeType cause);
  11294. void focusLost (FocusChangeType cause);
  11295. void enablementChanged();
  11296. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11297. void applicationCommandListChanged();
  11298. void valueChanged (Value& value);
  11299. private:
  11300. Array <KeyPress> shortcuts;
  11301. Component::SafePointer<Component> keySource;
  11302. String text;
  11303. ListenerList <ButtonListener> buttonListeners;
  11304. class RepeatTimer;
  11305. friend class RepeatTimer;
  11306. friend class ScopedPointer <RepeatTimer>;
  11307. ScopedPointer <RepeatTimer> repeatTimer;
  11308. uint32 buttonPressTime, lastTimeCallbackTime;
  11309. ApplicationCommandManager* commandManagerToUse;
  11310. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11311. int radioGroupId, commandID, connectedEdgeFlags;
  11312. ButtonState buttonState;
  11313. Value isOn;
  11314. bool lastToggleState : 1;
  11315. bool clickTogglesState : 1;
  11316. bool needsToRelease : 1;
  11317. bool needsRepainting : 1;
  11318. bool isKeyDown : 1;
  11319. bool triggerOnMouseDown : 1;
  11320. bool generateTooltip : 1;
  11321. void repeatTimerCallback();
  11322. RepeatTimer& getRepeatTimer();
  11323. ButtonState updateState (const MouseEvent* const e);
  11324. bool isShortcutPressed() const;
  11325. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11326. void flashButtonState();
  11327. void sendClickMessage (const ModifierKeys& modifiers);
  11328. void sendStateMessage();
  11329. Button (const Button&);
  11330. Button& operator= (const Button&);
  11331. };
  11332. #endif // __JUCE_BUTTON_JUCEHEADER__
  11333. /*** End of inlined file: juce_Button.h ***/
  11334. class ScrollBar;
  11335. class JUCE_API ScrollBarListener
  11336. {
  11337. public:
  11338. virtual ~ScrollBarListener() {}
  11339. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11340. double newRangeStart) = 0;
  11341. };
  11342. class JUCE_API ScrollBar : public Component,
  11343. public AsyncUpdater,
  11344. private Timer
  11345. {
  11346. public:
  11347. ScrollBar (bool isVertical,
  11348. bool buttonsAreVisible = true);
  11349. ~ScrollBar();
  11350. bool isVertical() const throw() { return vertical; }
  11351. void setOrientation (bool shouldBeVertical);
  11352. void setButtonVisibility (bool buttonsAreVisible);
  11353. void setAutoHide (bool shouldHideWhenFullRange);
  11354. bool autoHides() const throw();
  11355. void setRangeLimits (const Range<double>& newRangeLimit);
  11356. void setRangeLimits (double minimum, double maximum);
  11357. const Range<double> getRangeLimit() const throw() { return totalRange; }
  11358. double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }
  11359. double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }
  11360. void setCurrentRange (const Range<double>& newRange);
  11361. void setCurrentRange (double newStart, double newSize);
  11362. void setCurrentRangeStart (double newStart);
  11363. const Range<double> getCurrentRange() const throw() { return visibleRange; }
  11364. double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }
  11365. double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }
  11366. void setSingleStepSize (double newSingleStepSize);
  11367. void moveScrollbarInSteps (int howManySteps);
  11368. void moveScrollbarInPages (int howManyPages);
  11369. void scrollToTop();
  11370. void scrollToBottom();
  11371. void setButtonRepeatSpeed (int initialDelayInMillisecs,
  11372. int repeatDelayInMillisecs,
  11373. int minimumDelayInMillisecs = -1);
  11374. enum ColourIds
  11375. {
  11376. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11377. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11378. 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. */
  11379. };
  11380. void addListener (ScrollBarListener* listener);
  11381. void removeListener (ScrollBarListener* listener);
  11382. bool keyPressed (const KeyPress& key);
  11383. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11384. void lookAndFeelChanged();
  11385. void handleAsyncUpdate();
  11386. void mouseDown (const MouseEvent& e);
  11387. void mouseDrag (const MouseEvent& e);
  11388. void mouseUp (const MouseEvent& e);
  11389. void paint (Graphics& g);
  11390. void resized();
  11391. juce_UseDebuggingNewOperator
  11392. private:
  11393. Range <double> totalRange, visibleRange;
  11394. double singleStepSize, dragStartRange;
  11395. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11396. int dragStartMousePos, lastMousePos;
  11397. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11398. bool vertical, isDraggingThumb, autohides;
  11399. class ScrollbarButton;
  11400. ScrollbarButton* upButton;
  11401. ScrollbarButton* downButton;
  11402. ListenerList <ScrollBarListener> listeners;
  11403. void updateThumbPosition();
  11404. void timerCallback();
  11405. ScrollBar (const ScrollBar&);
  11406. ScrollBar& operator= (const ScrollBar&);
  11407. };
  11408. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11409. /*** End of inlined file: juce_ScrollBar.h ***/
  11410. class JUCE_API Viewport : public Component,
  11411. private ComponentListener,
  11412. private ScrollBarListener
  11413. {
  11414. public:
  11415. explicit Viewport (const String& componentName = String::empty);
  11416. ~Viewport();
  11417. void setViewedComponent (Component* newViewedComponent);
  11418. Component* getViewedComponent() const throw() { return contentComp; }
  11419. void setViewPosition (int xPixelsOffset, int yPixelsOffset);
  11420. void setViewPositionProportionately (double proportionX, double proportionY);
  11421. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11422. int getViewPositionX() const throw() { return lastVX; }
  11423. int getViewPositionY() const throw() { return lastVY; }
  11424. int getViewWidth() const throw() { return lastVW; }
  11425. int getViewHeight() const throw() { return lastVH; }
  11426. int getMaximumVisibleWidth() const throw();
  11427. int getMaximumVisibleHeight() const throw();
  11428. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11429. int visibleW, int visibleH);
  11430. void setScrollBarsShown (bool showVerticalScrollbarIfNeeded,
  11431. bool showHorizontalScrollbarIfNeeded);
  11432. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11433. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11434. void setScrollBarThickness (int thickness);
  11435. int getScrollBarThickness() const throw();
  11436. void setSingleStepSizes (int stepX, int stepY);
  11437. void setScrollBarButtonVisibility (bool buttonsVisible);
  11438. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11439. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11440. juce_UseDebuggingNewOperator
  11441. void resized();
  11442. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11443. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11444. bool keyPressed (const KeyPress& key);
  11445. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11446. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11447. private:
  11448. Component::SafePointer<Component> contentComp;
  11449. int lastVX, lastVY, lastVW, lastVH;
  11450. int scrollBarThickness;
  11451. int singleStepX, singleStepY;
  11452. bool showHScrollbar, showVScrollbar;
  11453. Component* contentHolder;
  11454. ScrollBar* verticalScrollBar;
  11455. ScrollBar* horizontalScrollBar;
  11456. void updateVisibleRegion();
  11457. Viewport (const Viewport&);
  11458. Viewport& operator= (const Viewport&);
  11459. };
  11460. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11461. /*** End of inlined file: juce_Viewport.h ***/
  11462. /*** Start of inlined file: juce_PopupMenu.h ***/
  11463. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11464. #define __JUCE_POPUPMENU_JUCEHEADER__
  11465. class PopupMenuCustomComponent;
  11466. class JUCE_API PopupMenu
  11467. {
  11468. public:
  11469. PopupMenu();
  11470. PopupMenu (const PopupMenu& other);
  11471. ~PopupMenu();
  11472. PopupMenu& operator= (const PopupMenu& other);
  11473. void clear();
  11474. void addItem (int itemResultId,
  11475. const String& itemText,
  11476. bool isActive = true,
  11477. bool isTicked = false,
  11478. const Image* iconToUse = 0);
  11479. void addCommandItem (ApplicationCommandManager* commandManager,
  11480. int commandID,
  11481. const String& displayName = String::empty);
  11482. void addColouredItem (int itemResultId,
  11483. const String& itemText,
  11484. const Colour& itemTextColour,
  11485. bool isActive = true,
  11486. bool isTicked = false,
  11487. const Image* iconToUse = 0);
  11488. void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent);
  11489. void addCustomItem (int itemResultId,
  11490. Component* customComponent,
  11491. int idealWidth, int idealHeight,
  11492. bool triggerMenuItemAutomaticallyWhenClicked);
  11493. void addSubMenu (const String& subMenuName,
  11494. const PopupMenu& subMenu,
  11495. bool isActive = true,
  11496. Image* iconToUse = 0,
  11497. bool isTicked = false);
  11498. void addSeparator();
  11499. void addSectionHeader (const String& title);
  11500. int getNumItems() const throw();
  11501. bool containsCommandItem (int commandID) const;
  11502. bool containsAnyActiveItems() const throw();
  11503. int show (int itemIdThatMustBeVisible = 0,
  11504. int minimumWidth = 0,
  11505. int maximumNumColumns = 0,
  11506. int standardItemHeight = 0);
  11507. int showAt (int screenX,
  11508. int screenY,
  11509. int itemIdThatMustBeVisible = 0,
  11510. int minimumWidth = 0,
  11511. int maximumNumColumns = 0,
  11512. int standardItemHeight = 0);
  11513. int showAt (Component* componentToAttachTo,
  11514. int itemIdThatMustBeVisible = 0,
  11515. int minimumWidth = 0,
  11516. int maximumNumColumns = 0,
  11517. int standardItemHeight = 0);
  11518. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11519. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  11520. enum ColourIds
  11521. {
  11522. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11523. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11524. colour is specified when the item is added). */
  11525. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11526. addSectionHeader() method). */
  11527. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11528. highlighted menu item. */
  11529. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11530. highlighted item. */
  11531. };
  11532. class JUCE_API MenuItemIterator
  11533. {
  11534. public:
  11535. MenuItemIterator (const PopupMenu& menu);
  11536. ~MenuItemIterator();
  11537. bool next();
  11538. String itemName;
  11539. const PopupMenu* subMenu;
  11540. int itemId;
  11541. bool isSeparator;
  11542. bool isTicked;
  11543. bool isEnabled;
  11544. bool isCustomComponent;
  11545. bool isSectionHeader;
  11546. const Colour* customColour;
  11547. const Image* customImage;
  11548. ApplicationCommandManager* commandManager;
  11549. juce_UseDebuggingNewOperator
  11550. private:
  11551. const PopupMenu& menu;
  11552. int index;
  11553. MenuItemIterator (const MenuItemIterator&);
  11554. MenuItemIterator& operator= (const MenuItemIterator&);
  11555. };
  11556. juce_UseDebuggingNewOperator
  11557. private:
  11558. class Item;
  11559. class ItemComponent;
  11560. class Window;
  11561. friend class MenuItemIterator;
  11562. friend class ItemComponent;
  11563. friend class Window;
  11564. friend class PopupMenuCustomComponent;
  11565. friend class OwnedArray <Item>;
  11566. friend class ScopedPointer <Window>;
  11567. OwnedArray <Item> items;
  11568. LookAndFeel* lookAndFeel;
  11569. bool separatorPending;
  11570. void addSeparatorIfPending();
  11571. int showMenu (int x, int y, int w, int h,
  11572. int itemIdThatMustBeVisible,
  11573. int minimumWidth,
  11574. int maximumNumColumns,
  11575. int standardItemHeight,
  11576. bool alignToRectangle,
  11577. Component* componentAttachedTo);
  11578. friend class MenuBarComponent;
  11579. Component* createMenuComponent (int x, int y, int w, int h,
  11580. int itemIdThatMustBeVisible,
  11581. int minimumWidth,
  11582. int maximumNumColumns,
  11583. int standardItemHeight,
  11584. bool alignToRectangle,
  11585. Component* menuBarComponent,
  11586. ApplicationCommandManager** managerOfChosenCommand,
  11587. Component* componentAttachedTo);
  11588. };
  11589. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11590. /*** End of inlined file: juce_PopupMenu.h ***/
  11591. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11592. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11593. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11594. class JUCE_API TextInputTarget
  11595. {
  11596. public:
  11597. TextInputTarget() {}
  11598. virtual ~TextInputTarget() {}
  11599. virtual const Range<int> getHighlightedRegion() const = 0;
  11600. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11601. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11602. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11603. };
  11604. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11605. /*** End of inlined file: juce_TextInputTarget.h ***/
  11606. class TextEditor;
  11607. class JUCE_API TextEditorListener
  11608. {
  11609. public:
  11610. virtual ~TextEditorListener() {}
  11611. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11612. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11613. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11614. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11615. };
  11616. class JUCE_API TextEditor : public Component,
  11617. public TextInputTarget,
  11618. public SettableTooltipClient
  11619. {
  11620. public:
  11621. explicit TextEditor (const String& componentName = String::empty,
  11622. juce_wchar passwordCharacter = 0);
  11623. virtual ~TextEditor();
  11624. void setMultiLine (bool shouldBeMultiLine,
  11625. bool shouldWordWrap = true);
  11626. bool isMultiLine() const;
  11627. void setReturnKeyStartsNewLine (bool shouldStartNewLine);
  11628. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11629. void setTabKeyUsedAsCharacter (bool shouldTabKeyBeUsed);
  11630. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11631. void setReadOnly (bool shouldBeReadOnly);
  11632. bool isReadOnly() const;
  11633. void setCaretVisible (bool shouldBeVisible);
  11634. bool isCaretVisible() const { return caretVisible; }
  11635. void setScrollbarsShown (bool shouldBeEnabled);
  11636. bool areScrollbarsShown() const { return scrollbarVisible; }
  11637. void setPasswordCharacter (juce_wchar passwordCharacter);
  11638. juce_wchar getPasswordCharacter() const { return passwordCharacter; }
  11639. void setPopupMenuEnabled (bool menuEnabled);
  11640. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11641. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11642. enum ColourIds
  11643. {
  11644. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11645. transparent if necessary. */
  11646. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11647. that because the editor can contain multiple colours, calling this
  11648. method won't change the colour of existing text - to do that, call
  11649. applyFontToAllText() after calling this method.*/
  11650. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11651. the text - this can be transparent if you don't want to show any
  11652. highlighting.*/
  11653. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11654. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11655. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11656. the edge of the component. */
  11657. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11658. the edge of the component when it has focus. */
  11659. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11660. around the edge of the editor. */
  11661. };
  11662. void setFont (const Font& newFont);
  11663. void applyFontToAllText (const Font& newFont);
  11664. const Font getFont() const;
  11665. void setSelectAllWhenFocused (bool b);
  11666. void setInputRestrictions (int maxTextLength,
  11667. const String& allowedCharacters = String::empty);
  11668. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11669. void setScrollBarThickness (int newThicknessPixels);
  11670. void setScrollBarButtonVisibility (bool buttonsVisible);
  11671. void addListener (TextEditorListener* newListener);
  11672. void removeListener (TextEditorListener* listenerToRemove);
  11673. const String getText() const;
  11674. const String getTextInRange (const Range<int>& textRange) const;
  11675. bool isEmpty() const;
  11676. void setText (const String& newText,
  11677. bool sendTextChangeMessage = true);
  11678. Value& getTextValue();
  11679. void insertTextAtCaret (const String& textToInsert);
  11680. void clear();
  11681. void cut();
  11682. void copy();
  11683. void paste();
  11684. void setCaretPosition (int newIndex);
  11685. int getCaretPosition() const;
  11686. void scrollEditorToPositionCaret (int desiredCaretX, int desiredCaretY);
  11687. const Rectangle<int> getCaretRectangle();
  11688. void setHighlightedRegion (const Range<int>& newSelection);
  11689. const Range<int> getHighlightedRegion() const { return selection; }
  11690. const String getHighlightedText() const;
  11691. int getTextIndexAt (int x, int y);
  11692. int getTotalNumChars() const;
  11693. int getTextWidth() const;
  11694. int getTextHeight() const;
  11695. void setIndents (int newLeftIndent, int newTopIndent);
  11696. void setBorder (const BorderSize& border);
  11697. const BorderSize getBorder() const;
  11698. void setScrollToShowCursor (bool shouldScrollToShowCursor);
  11699. void paint (Graphics& g);
  11700. void paintOverChildren (Graphics& g);
  11701. void mouseDown (const MouseEvent& e);
  11702. void mouseUp (const MouseEvent& e);
  11703. void mouseDrag (const MouseEvent& e);
  11704. void mouseDoubleClick (const MouseEvent& e);
  11705. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11706. bool keyPressed (const KeyPress& key);
  11707. bool keyStateChanged (bool isKeyDown);
  11708. void focusGained (FocusChangeType cause);
  11709. void focusLost (FocusChangeType cause);
  11710. void resized();
  11711. void enablementChanged();
  11712. void colourChanged();
  11713. juce_UseDebuggingNewOperator
  11714. protected:
  11715. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11716. const MouseEvent* mouseClickEvent);
  11717. virtual void performPopupMenuAction (int menuItemID);
  11718. void scrollToMakeSureCursorIsVisible();
  11719. void moveCaret (int newCaretPos);
  11720. void moveCursorTo (int newPosition, bool isSelecting);
  11721. void textChanged();
  11722. void newTransaction();
  11723. void doUndoRedo (bool isRedo);
  11724. virtual void returnPressed();
  11725. virtual void escapePressed();
  11726. void handleCommandMessage (int commandId);
  11727. private:
  11728. class Iterator;
  11729. class UniformTextSection;
  11730. class TextHolderComponent;
  11731. class InsertAction;
  11732. class RemoveAction;
  11733. friend class InsertAction;
  11734. friend class RemoveAction;
  11735. ScopedPointer <Viewport> viewport;
  11736. TextHolderComponent* textHolder;
  11737. BorderSize borderSize;
  11738. bool readOnly : 1;
  11739. bool multiline : 1;
  11740. bool wordWrap : 1;
  11741. bool returnKeyStartsNewLine : 1;
  11742. bool caretVisible : 1;
  11743. bool popupMenuEnabled : 1;
  11744. bool selectAllTextWhenFocused : 1;
  11745. bool scrollbarVisible : 1;
  11746. bool wasFocused : 1;
  11747. bool caretFlashState : 1;
  11748. bool keepCursorOnScreen : 1;
  11749. bool tabKeyUsed : 1;
  11750. bool menuActive : 1;
  11751. bool valueTextNeedsUpdating : 1;
  11752. UndoManager undoManager;
  11753. float cursorX, cursorY, cursorHeight;
  11754. int maxTextLength;
  11755. Range<int> selection;
  11756. int leftIndent, topIndent;
  11757. unsigned int lastTransactionTime;
  11758. Font currentFont;
  11759. mutable int totalNumChars;
  11760. int caretPosition;
  11761. Array <UniformTextSection*> sections;
  11762. String textToShowWhenEmpty;
  11763. Colour colourForTextWhenEmpty;
  11764. juce_wchar passwordCharacter;
  11765. Value textValue;
  11766. enum
  11767. {
  11768. notDragging,
  11769. draggingSelectionStart,
  11770. draggingSelectionEnd
  11771. } dragType;
  11772. String allowedCharacters;
  11773. ListenerList <TextEditorListener> listeners;
  11774. void coalesceSimilarSections();
  11775. void splitSection (int sectionIndex, int charToSplitAt);
  11776. void clearInternal (UndoManager* um);
  11777. void insert (const String& text, int insertIndex, const Font& font,
  11778. const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
  11779. void reinsert (int insertIndex, const Array <UniformTextSection*>& sections);
  11780. void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
  11781. void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
  11782. void updateCaretPosition();
  11783. void textWasChangedByValue();
  11784. int indexAtPosition (float x, float y);
  11785. int findWordBreakAfter (int position) const;
  11786. int findWordBreakBefore (int position) const;
  11787. friend class TextHolderComponent;
  11788. friend class TextEditorViewport;
  11789. void drawContent (Graphics& g);
  11790. void updateTextHolderSize();
  11791. float getWordWrapWidth() const;
  11792. void timerCallbackInt();
  11793. void repaintCaret();
  11794. void repaintText (const Range<int>& range);
  11795. UndoManager* getUndoManager() throw();
  11796. TextEditor (const TextEditor&);
  11797. TextEditor& operator= (const TextEditor&);
  11798. };
  11799. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11800. /*** End of inlined file: juce_TextEditor.h ***/
  11801. class Label;
  11802. class JUCE_API LabelListener
  11803. {
  11804. public:
  11805. virtual ~LabelListener() {}
  11806. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11807. };
  11808. class JUCE_API Label : public Component,
  11809. public SettableTooltipClient,
  11810. protected TextEditorListener,
  11811. private ComponentListener,
  11812. private Value::Listener
  11813. {
  11814. public:
  11815. Label (const String& componentName,
  11816. const String& labelText);
  11817. ~Label();
  11818. void setText (const String& newText,
  11819. bool broadcastChangeMessage);
  11820. const String getText (bool returnActiveEditorContents = false) const throw();
  11821. Value& getTextValue() { return textValue; }
  11822. void setFont (const Font& newFont) throw();
  11823. const Font& getFont() const throw();
  11824. enum ColourIds
  11825. {
  11826. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11827. textColourId = 0x1000281, /**< The colour for the text. */
  11828. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11829. Leave this transparent to not have an outline. */
  11830. };
  11831. void setJustificationType (const Justification& justification) throw();
  11832. const Justification getJustificationType() const throw() { return justification; }
  11833. void setBorderSize (int horizontalBorder, int verticalBorder);
  11834. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11835. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11836. void attachToComponent (Component* owner, bool onLeft);
  11837. Component* getAttachedComponent() const;
  11838. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11839. void setMinimumHorizontalScale (float newScale);
  11840. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11841. void addListener (LabelListener* listener) throw();
  11842. void removeListener (LabelListener* listener) throw();
  11843. void setEditable (bool editOnSingleClick,
  11844. bool editOnDoubleClick = false,
  11845. bool lossOfFocusDiscardsChanges = false) throw();
  11846. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11847. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11848. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11849. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11850. void showEditor();
  11851. void hideEditor (bool discardCurrentEditorContents);
  11852. bool isBeingEdited() const throw();
  11853. juce_UseDebuggingNewOperator
  11854. protected:
  11855. virtual TextEditor* createEditorComponent();
  11856. virtual void textWasEdited();
  11857. virtual void textWasChanged();
  11858. virtual void editorShown (TextEditor* editorComponent);
  11859. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11860. void paint (Graphics& g);
  11861. void resized();
  11862. void mouseUp (const MouseEvent& e);
  11863. void mouseDoubleClick (const MouseEvent& e);
  11864. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11865. void componentParentHierarchyChanged (Component& component);
  11866. void componentVisibilityChanged (Component& component);
  11867. void inputAttemptWhenModal();
  11868. void focusGained (FocusChangeType);
  11869. void enablementChanged();
  11870. KeyboardFocusTraverser* createFocusTraverser();
  11871. void textEditorTextChanged (TextEditor& editor);
  11872. void textEditorReturnKeyPressed (TextEditor& editor);
  11873. void textEditorEscapeKeyPressed (TextEditor& editor);
  11874. void textEditorFocusLost (TextEditor& editor);
  11875. void colourChanged();
  11876. void valueChanged (Value&);
  11877. private:
  11878. Value textValue;
  11879. String lastTextValue;
  11880. Font font;
  11881. Justification justification;
  11882. ScopedPointer <TextEditor> editor;
  11883. ListenerList <LabelListener> listeners;
  11884. Component::SafePointer<Component> ownerComponent;
  11885. int horizontalBorderSize, verticalBorderSize;
  11886. float minimumHorizontalScale;
  11887. bool editSingleClick : 1;
  11888. bool editDoubleClick : 1;
  11889. bool lossOfFocusDiscardsChanges : 1;
  11890. bool leftOfOwnerComp : 1;
  11891. bool updateFromTextEditorContents();
  11892. void callChangeListeners();
  11893. Label (const Label&);
  11894. Label& operator= (const Label&);
  11895. };
  11896. #endif // __JUCE_LABEL_JUCEHEADER__
  11897. /*** End of inlined file: juce_Label.h ***/
  11898. class ComboBox;
  11899. class JUCE_API ComboBoxListener
  11900. {
  11901. public:
  11902. virtual ~ComboBoxListener() {}
  11903. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11904. };
  11905. class JUCE_API ComboBox : public Component,
  11906. public SettableTooltipClient,
  11907. private LabelListener,
  11908. private AsyncUpdater,
  11909. private Value::Listener
  11910. {
  11911. public:
  11912. explicit ComboBox (const String& componentName);
  11913. ~ComboBox();
  11914. void setEditableText (bool isEditable);
  11915. bool isTextEditable() const throw();
  11916. void setJustificationType (const Justification& justification) throw();
  11917. const Justification getJustificationType() const throw();
  11918. void addItem (const String& newItemText,
  11919. int newItemId) throw();
  11920. void addSeparator() throw();
  11921. void addSectionHeading (const String& headingName) throw();
  11922. void setItemEnabled (int itemId,
  11923. bool shouldBeEnabled) throw();
  11924. void changeItemText (int itemId,
  11925. const String& newText) throw();
  11926. void clear (bool dontSendChangeMessage = false);
  11927. int getNumItems() const throw();
  11928. const String getItemText (int index) const throw();
  11929. int getItemId (int index) const throw();
  11930. int indexOfItemId (int itemId) const throw();
  11931. int getSelectedId() const throw();
  11932. Value& getSelectedIdAsValue() throw() { return currentId; }
  11933. void setSelectedId (int newItemId,
  11934. bool dontSendChangeMessage = false) throw();
  11935. int getSelectedItemIndex() const throw();
  11936. void setSelectedItemIndex (int newItemIndex,
  11937. bool dontSendChangeMessage = false) throw();
  11938. const String getText() const throw();
  11939. void setText (const String& newText,
  11940. bool dontSendChangeMessage = false) throw();
  11941. void showEditor();
  11942. void addListener (ComboBoxListener* listener) throw();
  11943. void removeListener (ComboBoxListener* listener) throw();
  11944. void setTextWhenNothingSelected (const String& newMessage) throw();
  11945. const String getTextWhenNothingSelected() const throw();
  11946. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11947. const String getTextWhenNoChoicesAvailable() const throw();
  11948. void setTooltip (const String& newTooltip);
  11949. enum ColourIds
  11950. {
  11951. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11952. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11953. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11954. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11955. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11956. };
  11957. void labelTextChanged (Label*);
  11958. void enablementChanged();
  11959. void colourChanged();
  11960. void focusGained (Component::FocusChangeType cause);
  11961. void focusLost (Component::FocusChangeType cause);
  11962. void handleAsyncUpdate();
  11963. const String getTooltip() { return label->getTooltip(); }
  11964. void mouseDown (const MouseEvent&);
  11965. void mouseDrag (const MouseEvent&);
  11966. void mouseUp (const MouseEvent&);
  11967. void lookAndFeelChanged();
  11968. void paint (Graphics&);
  11969. void resized();
  11970. bool keyStateChanged (bool isKeyDown);
  11971. bool keyPressed (const KeyPress&);
  11972. void valueChanged (Value&);
  11973. juce_UseDebuggingNewOperator
  11974. private:
  11975. struct ItemInfo
  11976. {
  11977. String name;
  11978. int itemId;
  11979. bool isEnabled : 1, isHeading : 1;
  11980. bool isSeparator() const throw();
  11981. bool isRealItem() const throw();
  11982. };
  11983. OwnedArray <ItemInfo> items;
  11984. Value currentId;
  11985. int lastCurrentId;
  11986. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11987. ListenerList <ComboBoxListener> listeners;
  11988. ScopedPointer<Label> label;
  11989. String textWhenNothingSelected, noChoicesMessage;
  11990. void showPopup();
  11991. ItemInfo* getItemForId (int itemId) const throw();
  11992. ItemInfo* getItemForIndex (int index) const throw();
  11993. ComboBox (const ComboBox&);
  11994. ComboBox& operator= (const ComboBox&);
  11995. };
  11996. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11997. /*** End of inlined file: juce_ComboBox.h ***/
  11998. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11999. {
  12000. public:
  12001. AudioDeviceManager();
  12002. ~AudioDeviceManager();
  12003. struct JUCE_API AudioDeviceSetup
  12004. {
  12005. AudioDeviceSetup();
  12006. bool operator== (const AudioDeviceSetup& other) const;
  12007. String outputDeviceName;
  12008. String inputDeviceName;
  12009. double sampleRate;
  12010. int bufferSize;
  12011. BigInteger inputChannels;
  12012. bool useDefaultInputChannels;
  12013. BigInteger outputChannels;
  12014. bool useDefaultOutputChannels;
  12015. };
  12016. const String initialise (int numInputChannelsNeeded,
  12017. int numOutputChannelsNeeded,
  12018. const XmlElement* savedState,
  12019. bool selectDefaultDeviceOnFailure,
  12020. const String& preferredDefaultDeviceName = String::empty,
  12021. const AudioDeviceSetup* preferredSetupOptions = 0);
  12022. XmlElement* createStateXml() const;
  12023. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  12024. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  12025. bool treatAsChosenDevice);
  12026. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  12027. const String getCurrentAudioDeviceType() const { return currentDeviceType; }
  12028. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  12029. void setCurrentAudioDeviceType (const String& type,
  12030. bool treatAsChosenDevice);
  12031. void closeAudioDevice();
  12032. void restartLastAudioDevice();
  12033. void addAudioCallback (AudioIODeviceCallback* newCallback);
  12034. void removeAudioCallback (AudioIODeviceCallback* callback);
  12035. double getCpuUsage() const;
  12036. void setMidiInputEnabled (const String& midiInputDeviceName,
  12037. bool enabled);
  12038. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  12039. void addMidiInputCallback (const String& midiInputDeviceName,
  12040. MidiInputCallback* callback);
  12041. void removeMidiInputCallback (const String& midiInputDeviceName,
  12042. MidiInputCallback* callback);
  12043. void setDefaultMidiOutput (const String& deviceName);
  12044. const String getDefaultMidiOutputName() const { return defaultMidiOutputName; }
  12045. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  12046. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  12047. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  12048. void playTestSound();
  12049. void enableInputLevelMeasurement (bool enableMeasurement);
  12050. double getCurrentInputLevel() const;
  12051. juce_UseDebuggingNewOperator
  12052. private:
  12053. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  12054. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  12055. AudioDeviceSetup currentSetup;
  12056. ScopedPointer <AudioIODevice> currentAudioDevice;
  12057. SortedSet <AudioIODeviceCallback*> callbacks;
  12058. int numInputChansNeeded, numOutputChansNeeded;
  12059. String currentDeviceType;
  12060. BigInteger inputChannels, outputChannels;
  12061. ScopedPointer <XmlElement> lastExplicitSettings;
  12062. mutable bool listNeedsScanning;
  12063. bool useInputNames;
  12064. int inputLevelMeasurementEnabledCount;
  12065. double inputLevel;
  12066. ScopedPointer <AudioSampleBuffer> testSound;
  12067. int testSoundPosition;
  12068. AudioSampleBuffer tempBuffer;
  12069. StringArray midiInsFromXml;
  12070. OwnedArray <MidiInput> enabledMidiInputs;
  12071. Array <MidiInputCallback*> midiCallbacks;
  12072. Array <MidiInput*> midiCallbackDevices;
  12073. String defaultMidiOutputName;
  12074. ScopedPointer <MidiOutput> defaultMidiOutput;
  12075. CriticalSection audioCallbackLock, midiCallbackLock;
  12076. double cpuUsageMs, timeToCpuScale;
  12077. class CallbackHandler : public AudioIODeviceCallback,
  12078. public MidiInputCallback
  12079. {
  12080. public:
  12081. AudioDeviceManager* owner;
  12082. void audioDeviceIOCallback (const float** inputChannelData,
  12083. int totalNumInputChannels,
  12084. float** outputChannelData,
  12085. int totalNumOutputChannels,
  12086. int numSamples);
  12087. void audioDeviceAboutToStart (AudioIODevice*);
  12088. void audioDeviceStopped();
  12089. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12090. };
  12091. CallbackHandler callbackHandler;
  12092. friend class CallbackHandler;
  12093. void audioDeviceIOCallbackInt (const float** inputChannelData,
  12094. int totalNumInputChannels,
  12095. float** outputChannelData,
  12096. int totalNumOutputChannels,
  12097. int numSamples);
  12098. void audioDeviceAboutToStartInt (AudioIODevice* device);
  12099. void audioDeviceStoppedInt();
  12100. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  12101. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  12102. const BigInteger& ins, const BigInteger& outs);
  12103. void stopDevice();
  12104. void updateXml();
  12105. void createDeviceTypesIfNeeded();
  12106. void scanDevicesIfNeeded();
  12107. void deleteCurrentDevice();
  12108. double chooseBestSampleRate (double preferred) const;
  12109. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  12110. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  12111. AudioDeviceManager (const AudioDeviceManager&);
  12112. AudioDeviceManager& operator= (const AudioDeviceManager&);
  12113. };
  12114. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  12115. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  12116. #endif
  12117. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  12118. #endif
  12119. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  12120. #endif
  12121. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  12122. #endif
  12123. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  12124. #endif
  12125. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12126. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  12127. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12128. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12129. class JUCE_API AudioDataConverters
  12130. {
  12131. public:
  12132. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  12133. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  12134. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  12135. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  12136. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12137. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12138. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12139. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  12140. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  12141. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  12142. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  12143. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  12144. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12145. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12146. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12147. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  12148. enum DataFormat
  12149. {
  12150. int16LE,
  12151. int16BE,
  12152. int24LE,
  12153. int24BE,
  12154. int32LE,
  12155. int32BE,
  12156. float32LE,
  12157. float32BE,
  12158. };
  12159. static void convertFloatToFormat (DataFormat destFormat,
  12160. const float* source, void* dest, int numSamples);
  12161. static void convertFormatToFloat (DataFormat sourceFormat,
  12162. const void* source, float* dest, int numSamples);
  12163. static void interleaveSamples (const float** source, float* dest,
  12164. int numSamples, int numChannels);
  12165. static void deinterleaveSamples (const float* source, float** dest,
  12166. int numSamples, int numChannels);
  12167. private:
  12168. AudioDataConverters();
  12169. AudioDataConverters (const AudioDataConverters&);
  12170. AudioDataConverters& operator= (const AudioDataConverters&);
  12171. };
  12172. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12173. /*** End of inlined file: juce_AudioDataConverters.h ***/
  12174. #endif
  12175. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  12176. #endif
  12177. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  12178. #endif
  12179. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  12180. #endif
  12181. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12182. /*** Start of inlined file: juce_MidiFile.h ***/
  12183. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12184. #define __JUCE_MIDIFILE_JUCEHEADER__
  12185. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  12186. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12187. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12188. class JUCE_API MidiMessageSequence
  12189. {
  12190. public:
  12191. MidiMessageSequence();
  12192. MidiMessageSequence (const MidiMessageSequence& other);
  12193. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  12194. ~MidiMessageSequence();
  12195. class MidiEventHolder
  12196. {
  12197. public:
  12198. ~MidiEventHolder();
  12199. MidiMessage message;
  12200. MidiEventHolder* noteOffObject;
  12201. juce_UseDebuggingNewOperator
  12202. private:
  12203. friend class MidiMessageSequence;
  12204. MidiEventHolder (const MidiMessage& message);
  12205. };
  12206. void clear();
  12207. int getNumEvents() const;
  12208. MidiEventHolder* getEventPointer (int index) const;
  12209. double getTimeOfMatchingKeyUp (int index) const;
  12210. int getIndexOfMatchingKeyUp (int index) const;
  12211. int getIndexOf (MidiEventHolder* event) const;
  12212. int getNextIndexAtTime (double timeStamp) const;
  12213. double getStartTime() const;
  12214. double getEndTime() const;
  12215. double getEventTime (int index) const;
  12216. void addEvent (const MidiMessage& newMessage,
  12217. double timeAdjustment = 0);
  12218. void deleteEvent (int index, bool deleteMatchingNoteUp);
  12219. void addSequence (const MidiMessageSequence& other,
  12220. double timeAdjustmentDelta,
  12221. double firstAllowableDestTime,
  12222. double endOfAllowableDestTimes);
  12223. void updateMatchedPairs();
  12224. void extractMidiChannelMessages (int channelNumberToExtract,
  12225. MidiMessageSequence& destSequence,
  12226. bool alsoIncludeMetaEvents) const;
  12227. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12228. void deleteMidiChannelMessages (int channelNumberToRemove);
  12229. void deleteSysExMessages();
  12230. void addTimeToMessages (double deltaTime);
  12231. void createControllerUpdatesForTime (int channelNumber, double time,
  12232. OwnedArray<MidiMessage>& resultMessages);
  12233. void swapWith (MidiMessageSequence& other) throw();
  12234. juce_UseDebuggingNewOperator
  12235. static int compareElements (const MidiMessageSequence::MidiEventHolder* first,
  12236. const MidiMessageSequence::MidiEventHolder* second) throw();
  12237. private:
  12238. friend class MidiFile;
  12239. OwnedArray <MidiEventHolder> list;
  12240. void sort();
  12241. };
  12242. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12243. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12244. class JUCE_API MidiFile
  12245. {
  12246. public:
  12247. MidiFile();
  12248. ~MidiFile();
  12249. int getNumTracks() const throw();
  12250. const MidiMessageSequence* getTrack (const int index) const throw();
  12251. void addTrack (const MidiMessageSequence& trackSequence);
  12252. void clear();
  12253. short getTimeFormat() const throw();
  12254. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12255. void setSmpteTimeFormat (const int framesPerSecond,
  12256. const int subframeResolution) throw();
  12257. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12258. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12259. double getLastTimestamp() const;
  12260. bool readFrom (InputStream& sourceStream);
  12261. bool writeTo (OutputStream& destStream);
  12262. void convertTimestampTicksToSeconds();
  12263. juce_UseDebuggingNewOperator
  12264. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12265. const MidiMessageSequence::MidiEventHolder* const second);
  12266. private:
  12267. OwnedArray <MidiMessageSequence> tracks;
  12268. short timeFormat;
  12269. MidiFile (const MidiFile&);
  12270. MidiFile& operator= (const MidiFile&);
  12271. void readNextTrack (const uint8* data, int size);
  12272. void writeTrack (OutputStream& mainOut, const int trackNum);
  12273. };
  12274. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12275. /*** End of inlined file: juce_MidiFile.h ***/
  12276. #endif
  12277. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12278. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12279. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12280. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12281. class MidiKeyboardState;
  12282. class JUCE_API MidiKeyboardStateListener
  12283. {
  12284. public:
  12285. MidiKeyboardStateListener() throw() {}
  12286. virtual ~MidiKeyboardStateListener() {}
  12287. virtual void handleNoteOn (MidiKeyboardState* source,
  12288. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12289. virtual void handleNoteOff (MidiKeyboardState* source,
  12290. int midiChannel, int midiNoteNumber) = 0;
  12291. };
  12292. class JUCE_API MidiKeyboardState
  12293. {
  12294. public:
  12295. MidiKeyboardState();
  12296. ~MidiKeyboardState();
  12297. void reset();
  12298. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12299. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12300. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12301. void noteOff (const int midiChannel, const int midiNoteNumber);
  12302. void allNotesOff (const int midiChannel);
  12303. void processNextMidiEvent (const MidiMessage& message);
  12304. void processNextMidiBuffer (MidiBuffer& buffer,
  12305. const int startSample,
  12306. const int numSamples,
  12307. const bool injectIndirectEvents);
  12308. void addListener (MidiKeyboardStateListener* const listener) throw();
  12309. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12310. juce_UseDebuggingNewOperator
  12311. private:
  12312. CriticalSection lock;
  12313. uint16 noteStates [128];
  12314. MidiBuffer eventsToAdd;
  12315. Array <MidiKeyboardStateListener*> listeners;
  12316. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12317. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12318. MidiKeyboardState (const MidiKeyboardState&);
  12319. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12320. };
  12321. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12322. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12323. #endif
  12324. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12325. #endif
  12326. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12327. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12328. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12329. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12330. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12331. public MidiInputCallback
  12332. {
  12333. public:
  12334. MidiMessageCollector();
  12335. ~MidiMessageCollector();
  12336. void reset (double sampleRate);
  12337. void addMessageToQueue (const MidiMessage& message);
  12338. void removeNextBlockOfMessages (MidiBuffer& destBuffer, int numSamples);
  12339. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12340. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12341. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12342. juce_UseDebuggingNewOperator
  12343. private:
  12344. double lastCallbackTime;
  12345. CriticalSection midiCallbackLock;
  12346. MidiBuffer incomingMessages;
  12347. double sampleRate;
  12348. MidiMessageCollector (const MidiMessageCollector&);
  12349. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12350. };
  12351. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12352. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12353. #endif
  12354. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12355. #endif
  12356. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12357. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12358. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12359. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12360. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12361. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12362. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12363. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12364. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12365. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12366. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12367. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12368. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12369. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12370. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12371. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12372. class AudioProcessor;
  12373. class JUCE_API AudioProcessorEditor : public Component
  12374. {
  12375. protected:
  12376. AudioProcessorEditor (AudioProcessor* const owner);
  12377. public:
  12378. ~AudioProcessorEditor();
  12379. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12380. private:
  12381. AudioProcessor* const owner;
  12382. AudioProcessorEditor (const AudioProcessorEditor&);
  12383. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12384. };
  12385. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12386. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12387. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12388. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12389. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12390. class AudioProcessor;
  12391. class JUCE_API AudioProcessorListener
  12392. {
  12393. public:
  12394. virtual ~AudioProcessorListener() {}
  12395. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12396. int parameterIndex,
  12397. float newValue) = 0;
  12398. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12399. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12400. int parameterIndex);
  12401. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12402. int parameterIndex);
  12403. };
  12404. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12405. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12406. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12407. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12408. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12409. class JUCE_API AudioPlayHead
  12410. {
  12411. protected:
  12412. AudioPlayHead() {}
  12413. public:
  12414. virtual ~AudioPlayHead() {}
  12415. enum FrameRateType
  12416. {
  12417. fps24 = 0,
  12418. fps25 = 1,
  12419. fps2997 = 2,
  12420. fps30 = 3,
  12421. fps2997drop = 4,
  12422. fps30drop = 5,
  12423. fpsUnknown = 99
  12424. };
  12425. struct CurrentPositionInfo
  12426. {
  12427. double bpm;
  12428. int timeSigNumerator;
  12429. int timeSigDenominator;
  12430. double timeInSeconds;
  12431. double editOriginTime;
  12432. double ppqPosition;
  12433. double ppqPositionOfLastBarStart;
  12434. FrameRateType frameRate;
  12435. bool isPlaying;
  12436. bool isRecording;
  12437. bool operator== (const CurrentPositionInfo& other) const throw();
  12438. bool operator!= (const CurrentPositionInfo& other) const throw();
  12439. void resetToDefault();
  12440. };
  12441. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12442. };
  12443. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12444. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12445. class JUCE_API AudioProcessor
  12446. {
  12447. protected:
  12448. AudioProcessor();
  12449. public:
  12450. virtual ~AudioProcessor();
  12451. virtual const String getName() const = 0;
  12452. virtual void prepareToPlay (double sampleRate,
  12453. int estimatedSamplesPerBlock) = 0;
  12454. virtual void releaseResources() = 0;
  12455. virtual void processBlock (AudioSampleBuffer& buffer,
  12456. MidiBuffer& midiMessages) = 0;
  12457. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12458. double getSampleRate() const throw() { return sampleRate; }
  12459. int getBlockSize() const throw() { return blockSize; }
  12460. int getNumInputChannels() const throw() { return numInputChannels; }
  12461. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12462. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12463. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12464. virtual bool isInputChannelStereoPair (int index) const = 0;
  12465. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12466. int getLatencySamples() const throw() { return latencySamples; }
  12467. void setLatencySamples (const int newLatency);
  12468. virtual bool acceptsMidi() const = 0;
  12469. virtual bool producesMidi() const = 0;
  12470. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12471. void suspendProcessing (const bool shouldBeSuspended);
  12472. bool isSuspended() const throw() { return suspended; }
  12473. virtual void reset();
  12474. bool isNonRealtime() const throw() { return nonRealtime; }
  12475. void setNonRealtime (const bool isNonRealtime) throw();
  12476. virtual AudioProcessorEditor* createEditor() = 0;
  12477. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12478. AudioProcessorEditor* createEditorIfNeeded();
  12479. virtual int getNumParameters() = 0;
  12480. virtual const String getParameterName (int parameterIndex) = 0;
  12481. virtual float getParameter (int parameterIndex) = 0;
  12482. virtual const String getParameterText (int parameterIndex) = 0;
  12483. virtual void setParameter (int parameterIndex,
  12484. float newValue) = 0;
  12485. void setParameterNotifyingHost (int parameterIndex,
  12486. float newValue);
  12487. virtual bool isParameterAutomatable (int parameterIndex) const;
  12488. virtual bool isMetaParameter (int parameterIndex) const;
  12489. void beginParameterChangeGesture (int parameterIndex);
  12490. void endParameterChangeGesture (int parameterIndex);
  12491. void updateHostDisplay();
  12492. virtual int getNumPrograms() = 0;
  12493. virtual int getCurrentProgram() = 0;
  12494. virtual void setCurrentProgram (int index) = 0;
  12495. virtual const String getProgramName (int index) = 0;
  12496. virtual void changeProgramName (int index, const String& newName) = 0;
  12497. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12498. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12499. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12500. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12501. void addListener (AudioProcessorListener* const newListener) throw();
  12502. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12503. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12504. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12505. void setPlayConfigDetails (const int numIns, const int numOuts,
  12506. const double sampleRate,
  12507. const int blockSize) throw();
  12508. juce_UseDebuggingNewOperator
  12509. protected:
  12510. static void copyXmlToBinary (const XmlElement& xml,
  12511. JUCE_NAMESPACE::MemoryBlock& destData);
  12512. static XmlElement* getXmlFromBinary (const void* data,
  12513. const int sizeInBytes);
  12514. AudioPlayHead* playHead;
  12515. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12516. private:
  12517. VoidArray listeners;
  12518. AudioProcessorEditor* activeEditor;
  12519. double sampleRate;
  12520. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12521. bool suspended, nonRealtime;
  12522. CriticalSection callbackLock, listenerLock;
  12523. #ifdef JUCE_DEBUG
  12524. BigInteger changingParams;
  12525. #endif
  12526. AudioProcessor (const AudioProcessor&);
  12527. AudioProcessor& operator= (const AudioProcessor&);
  12528. };
  12529. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12530. /*** End of inlined file: juce_AudioProcessor.h ***/
  12531. /*** Start of inlined file: juce_PluginDescription.h ***/
  12532. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12533. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12534. class JUCE_API PluginDescription
  12535. {
  12536. public:
  12537. PluginDescription() throw();
  12538. PluginDescription (const PluginDescription& other) throw();
  12539. PluginDescription& operator= (const PluginDescription& other) throw();
  12540. ~PluginDescription() throw();
  12541. String name;
  12542. String pluginFormatName;
  12543. String category;
  12544. String manufacturerName;
  12545. String version;
  12546. String fileOrIdentifier;
  12547. Time lastFileModTime;
  12548. int uid;
  12549. bool isInstrument;
  12550. int numInputChannels;
  12551. int numOutputChannels;
  12552. bool isDuplicateOf (const PluginDescription& other) const;
  12553. const String createIdentifierString() const throw();
  12554. XmlElement* createXml() const;
  12555. bool loadFromXml (const XmlElement& xml);
  12556. juce_UseDebuggingNewOperator
  12557. };
  12558. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12559. /*** End of inlined file: juce_PluginDescription.h ***/
  12560. class JUCE_API AudioPluginInstance : public AudioProcessor
  12561. {
  12562. public:
  12563. virtual ~AudioPluginInstance();
  12564. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12565. juce_UseDebuggingNewOperator
  12566. protected:
  12567. AudioPluginInstance();
  12568. AudioPluginInstance (const AudioPluginInstance&);
  12569. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12570. };
  12571. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12572. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12573. class PluginDescription;
  12574. class JUCE_API AudioPluginFormat
  12575. {
  12576. public:
  12577. virtual ~AudioPluginFormat();
  12578. virtual const String getName() const = 0;
  12579. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12580. const String& fileOrIdentifier) = 0;
  12581. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12582. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12583. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12584. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12585. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12586. bool recursive) = 0;
  12587. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12588. juce_UseDebuggingNewOperator
  12589. protected:
  12590. AudioPluginFormat() throw();
  12591. AudioPluginFormat (const AudioPluginFormat&);
  12592. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12593. };
  12594. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12595. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12596. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12597. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12598. {
  12599. public:
  12600. AudioUnitPluginFormat();
  12601. ~AudioUnitPluginFormat();
  12602. const String getName() const { return "AudioUnit"; }
  12603. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12604. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12605. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12606. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12607. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12608. bool doesPluginStillExist (const PluginDescription& desc);
  12609. const FileSearchPath getDefaultLocationsToSearch();
  12610. juce_UseDebuggingNewOperator
  12611. private:
  12612. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12613. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12614. };
  12615. #endif
  12616. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12617. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12618. #endif
  12619. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12620. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12621. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12622. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12623. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12624. // Sorry, this file is just a placeholder at the moment!...
  12625. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12626. {
  12627. public:
  12628. DirectXPluginFormat();
  12629. ~DirectXPluginFormat();
  12630. const String getName() const { return "DirectX"; }
  12631. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12632. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12633. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12634. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12635. const FileSearchPath getDefaultLocationsToSearch();
  12636. juce_UseDebuggingNewOperator
  12637. private:
  12638. DirectXPluginFormat (const DirectXPluginFormat&);
  12639. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12640. };
  12641. #endif
  12642. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12643. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12644. #endif
  12645. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12646. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12647. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12648. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12649. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12650. // Sorry, this file is just a placeholder at the moment!...
  12651. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12652. {
  12653. public:
  12654. LADSPAPluginFormat();
  12655. ~LADSPAPluginFormat();
  12656. const String getName() const { return "LADSPA"; }
  12657. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12658. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12659. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12660. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12661. const FileSearchPath getDefaultLocationsToSearch();
  12662. juce_UseDebuggingNewOperator
  12663. private:
  12664. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12665. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12666. };
  12667. #endif
  12668. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12669. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12670. #endif
  12671. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12672. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12673. #ifdef __aeffect__
  12674. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12675. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12676. class VSTMidiEventList
  12677. {
  12678. public:
  12679. VSTMidiEventList()
  12680. : numEventsUsed (0), numEventsAllocated (0)
  12681. {
  12682. }
  12683. ~VSTMidiEventList()
  12684. {
  12685. freeEvents();
  12686. }
  12687. void clear()
  12688. {
  12689. numEventsUsed = 0;
  12690. if (events != 0)
  12691. events->numEvents = 0;
  12692. }
  12693. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12694. {
  12695. ensureSize (numEventsUsed + 1);
  12696. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12697. events->numEvents = ++numEventsUsed;
  12698. if (numBytes <= 4)
  12699. {
  12700. if (e->type == kVstSysExType)
  12701. {
  12702. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12703. e->type = kVstMidiType;
  12704. e->byteSize = sizeof (VstMidiEvent);
  12705. e->noteLength = 0;
  12706. e->noteOffset = 0;
  12707. e->detune = 0;
  12708. e->noteOffVelocity = 0;
  12709. }
  12710. e->deltaFrames = frameOffset;
  12711. memcpy (e->midiData, midiData, numBytes);
  12712. }
  12713. else
  12714. {
  12715. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12716. if (se->type == kVstSysExType)
  12717. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12718. else
  12719. se->sysexDump = (char*) juce_malloc (numBytes);
  12720. memcpy (se->sysexDump, midiData, numBytes);
  12721. se->type = kVstSysExType;
  12722. se->byteSize = sizeof (VstMidiSysexEvent);
  12723. se->deltaFrames = frameOffset;
  12724. se->flags = 0;
  12725. se->dumpBytes = numBytes;
  12726. se->resvd1 = 0;
  12727. se->resvd2 = 0;
  12728. }
  12729. }
  12730. // Handy method to pull the events out of an event buffer supplied by the host
  12731. // or plugin.
  12732. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12733. {
  12734. for (int i = 0; i < events->numEvents; ++i)
  12735. {
  12736. const VstEvent* const e = events->events[i];
  12737. if (e != 0)
  12738. {
  12739. if (e->type == kVstMidiType)
  12740. {
  12741. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12742. 4, e->deltaFrames);
  12743. }
  12744. else if (e->type == kVstSysExType)
  12745. {
  12746. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12747. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12748. e->deltaFrames);
  12749. }
  12750. }
  12751. }
  12752. }
  12753. void ensureSize (int numEventsNeeded)
  12754. {
  12755. if (numEventsNeeded > numEventsAllocated)
  12756. {
  12757. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12758. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12759. if (events == 0)
  12760. events.calloc (size, 1);
  12761. else
  12762. events.realloc (size, 1);
  12763. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12764. {
  12765. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12766. (int) sizeof (VstMidiSysexEvent)));
  12767. e->type = kVstMidiType;
  12768. e->byteSize = sizeof (VstMidiEvent);
  12769. events->events[i] = (VstEvent*) e;
  12770. }
  12771. numEventsAllocated = numEventsNeeded;
  12772. }
  12773. }
  12774. void freeEvents()
  12775. {
  12776. if (events != 0)
  12777. {
  12778. for (int i = numEventsAllocated; --i >= 0;)
  12779. {
  12780. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12781. if (e->type == kVstSysExType)
  12782. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12783. juce_free (e);
  12784. }
  12785. events.free();
  12786. numEventsUsed = 0;
  12787. numEventsAllocated = 0;
  12788. }
  12789. }
  12790. HeapBlock <VstEvents> events;
  12791. private:
  12792. int numEventsUsed, numEventsAllocated;
  12793. };
  12794. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12795. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12796. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12797. #endif
  12798. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12799. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12800. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12801. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12802. #if JUCE_PLUGINHOST_VST
  12803. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12804. {
  12805. public:
  12806. VSTPluginFormat();
  12807. ~VSTPluginFormat();
  12808. const String getName() const { return "VST"; }
  12809. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12810. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12811. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12812. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12813. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12814. bool doesPluginStillExist (const PluginDescription& desc);
  12815. const FileSearchPath getDefaultLocationsToSearch();
  12816. juce_UseDebuggingNewOperator
  12817. private:
  12818. VSTPluginFormat (const VSTPluginFormat&);
  12819. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12820. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12821. };
  12822. #endif
  12823. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12824. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12825. #endif
  12826. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12827. #endif
  12828. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12829. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12830. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12831. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12832. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12833. {
  12834. public:
  12835. AudioPluginFormatManager() throw();
  12836. ~AudioPluginFormatManager() throw();
  12837. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12838. void addDefaultFormats();
  12839. int getNumFormats() throw();
  12840. AudioPluginFormat* getFormat (const int index) throw();
  12841. void addFormat (AudioPluginFormat* const format) throw();
  12842. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12843. String& errorMessage) const;
  12844. bool doesPluginStillExist (const PluginDescription& description) const;
  12845. juce_UseDebuggingNewOperator
  12846. private:
  12847. OwnedArray <AudioPluginFormat> formats;
  12848. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12849. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12850. };
  12851. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12852. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12853. #endif
  12854. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12855. #endif
  12856. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12857. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12858. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12859. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12860. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12861. {
  12862. public:
  12863. KnownPluginList();
  12864. ~KnownPluginList();
  12865. void clear();
  12866. int getNumTypes() const throw() { return types.size(); }
  12867. PluginDescription* getType (int index) const throw() { return types [index]; }
  12868. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12869. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12870. bool addType (const PluginDescription& type);
  12871. void removeType (int index) throw();
  12872. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12873. bool dontRescanIfAlreadyInList,
  12874. OwnedArray <PluginDescription>& typesFound,
  12875. AudioPluginFormat& formatToUse);
  12876. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12877. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12878. OwnedArray <PluginDescription>& typesFound);
  12879. enum SortMethod
  12880. {
  12881. defaultOrder = 0,
  12882. sortAlphabetically,
  12883. sortByCategory,
  12884. sortByManufacturer,
  12885. sortByFileSystemLocation
  12886. };
  12887. void addToMenu (PopupMenu& menu,
  12888. const SortMethod sortMethod) const;
  12889. int getIndexChosenByMenu (int menuResultCode) const;
  12890. void sort (const SortMethod method);
  12891. XmlElement* createXml() const;
  12892. void recreateFromXml (const XmlElement& xml);
  12893. juce_UseDebuggingNewOperator
  12894. private:
  12895. OwnedArray <PluginDescription> types;
  12896. KnownPluginList (const KnownPluginList&);
  12897. KnownPluginList& operator= (const KnownPluginList&);
  12898. };
  12899. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12900. /*** End of inlined file: juce_KnownPluginList.h ***/
  12901. #endif
  12902. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12903. #endif
  12904. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12905. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12906. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12907. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12908. class JUCE_API PluginDirectoryScanner
  12909. {
  12910. public:
  12911. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12912. AudioPluginFormat& formatToLookFor,
  12913. FileSearchPath directoriesToSearch,
  12914. bool searchRecursively,
  12915. const File& deadMansPedalFile);
  12916. ~PluginDirectoryScanner();
  12917. bool scanNextFile (bool dontRescanIfAlreadyInList);
  12918. const String getNextPluginFileThatWillBeScanned() const throw();
  12919. float getProgress() const { return progress; }
  12920. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12921. juce_UseDebuggingNewOperator
  12922. private:
  12923. KnownPluginList& list;
  12924. AudioPluginFormat& format;
  12925. StringArray filesOrIdentifiersToScan;
  12926. File deadMansPedalFile;
  12927. StringArray failedFiles;
  12928. int nextIndex;
  12929. float progress;
  12930. const StringArray getDeadMansPedalFile() throw();
  12931. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12932. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12933. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12934. };
  12935. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12936. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12937. #endif
  12938. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12939. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12940. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12941. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12942. /*** Start of inlined file: juce_ListBox.h ***/
  12943. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12944. #define __JUCE_LISTBOX_JUCEHEADER__
  12945. class ListViewport;
  12946. class JUCE_API ListBoxModel
  12947. {
  12948. public:
  12949. virtual ~ListBoxModel() {}
  12950. virtual int getNumRows() = 0;
  12951. virtual void paintListBoxItem (int rowNumber,
  12952. Graphics& g,
  12953. int width, int height,
  12954. bool rowIsSelected) = 0;
  12955. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12956. Component* existingComponentToUpdate);
  12957. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12958. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12959. virtual void backgroundClicked();
  12960. virtual void selectedRowsChanged (int lastRowSelected);
  12961. virtual void deleteKeyPressed (int lastRowSelected);
  12962. virtual void returnKeyPressed (int lastRowSelected);
  12963. virtual void listWasScrolled();
  12964. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12965. virtual const String getTooltipForRow (int row);
  12966. };
  12967. class JUCE_API ListBox : public Component,
  12968. public SettableTooltipClient
  12969. {
  12970. public:
  12971. ListBox (const String& componentName,
  12972. ListBoxModel* model);
  12973. ~ListBox();
  12974. void setModel (ListBoxModel* newModel);
  12975. ListBoxModel* getModel() const throw() { return model; }
  12976. void updateContent();
  12977. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12978. void setMouseMoveSelectsRows (bool shouldSelect);
  12979. void selectRow (int rowNumber,
  12980. bool dontScrollToShowThisRow = false,
  12981. bool deselectOthersFirst = true);
  12982. void selectRangeOfRows (int firstRow,
  12983. int lastRow);
  12984. void deselectRow (int rowNumber);
  12985. void deselectAllRows();
  12986. void flipRowSelection (int rowNumber);
  12987. const SparseSet<int> getSelectedRows() const;
  12988. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12989. bool sendNotificationEventToModel = true);
  12990. bool isRowSelected (int rowNumber) const;
  12991. int getNumSelectedRows() const;
  12992. int getSelectedRow (int index = 0) const;
  12993. int getLastRowSelected() const;
  12994. void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn,
  12995. const ModifierKeys& modifiers);
  12996. void setVerticalPosition (double newProportion);
  12997. double getVerticalPosition() const;
  12998. void scrollToEnsureRowIsOnscreen (int row);
  12999. ScrollBar* getVerticalScrollBar() const throw();
  13000. ScrollBar* getHorizontalScrollBar() const throw();
  13001. int getRowContainingPosition (int x, int y) const throw();
  13002. int getInsertionIndexForPosition (int x, int y) const throw();
  13003. const Rectangle<int> getRowPosition (int rowNumber,
  13004. bool relativeToComponentTopLeft) const throw();
  13005. Component* getComponentForRowNumber (int rowNumber) const throw();
  13006. int getRowNumberOfComponent (Component* rowComponent) const throw();
  13007. int getVisibleRowWidth() const throw();
  13008. void setRowHeight (int newHeight);
  13009. int getRowHeight() const throw() { return rowHeight; }
  13010. int getNumRowsOnScreen() const throw();
  13011. enum ColourIds
  13012. {
  13013. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  13014. Make this transparent if you don't want the background to be filled. */
  13015. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  13016. Make this transparent to not have an outline. */
  13017. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  13018. };
  13019. void setOutlineThickness (int outlineThickness);
  13020. int getOutlineThickness() const throw() { return outlineThickness; }
  13021. void setHeaderComponent (Component* newHeaderComponent);
  13022. void setMinimumContentWidth (int newMinimumWidth);
  13023. int getVisibleContentWidth() const throw();
  13024. void repaintRow (int rowNumber) throw();
  13025. Image* createSnapshotOfSelectedRows (int& x, int& y);
  13026. Viewport* getViewport() const throw();
  13027. bool keyPressed (const KeyPress& key);
  13028. bool keyStateChanged (bool isKeyDown);
  13029. void paint (Graphics& g);
  13030. void paintOverChildren (Graphics& g);
  13031. void resized();
  13032. void visibilityChanged();
  13033. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  13034. void mouseMove (const MouseEvent&);
  13035. void mouseExit (const MouseEvent&);
  13036. void mouseUp (const MouseEvent&);
  13037. void colourChanged();
  13038. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  13039. juce_UseDebuggingNewOperator
  13040. private:
  13041. friend class ListViewport;
  13042. friend class TableListBox;
  13043. ListBoxModel* model;
  13044. ListViewport* viewport;
  13045. Component* headerComponent;
  13046. int totalItems, rowHeight, minimumRowWidth;
  13047. int outlineThickness;
  13048. int lastRowSelected;
  13049. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  13050. SparseSet <int> selected;
  13051. void selectRowInternal (int rowNumber,
  13052. bool dontScrollToShowThisRow,
  13053. bool deselectOthersFirst,
  13054. bool isMouseClick);
  13055. ListBox (const ListBox&);
  13056. ListBox& operator= (const ListBox&);
  13057. };
  13058. #endif // __JUCE_LISTBOX_JUCEHEADER__
  13059. /*** End of inlined file: juce_ListBox.h ***/
  13060. /*** Start of inlined file: juce_TextButton.h ***/
  13061. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13062. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  13063. class JUCE_API TextButton : public Button
  13064. {
  13065. public:
  13066. TextButton (const String& buttonName,
  13067. const String& toolTip = String::empty);
  13068. ~TextButton();
  13069. enum ColourIds
  13070. {
  13071. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  13072. 'off'). The look-and-feel class might re-interpret this to add
  13073. effects, etc. */
  13074. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  13075. 'on'). The look-and-feel class might re-interpret this to add
  13076. effects, etc. */
  13077. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  13078. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  13079. };
  13080. void changeWidthToFitText (int newHeight = -1);
  13081. virtual const Font getFont();
  13082. juce_UseDebuggingNewOperator
  13083. protected:
  13084. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  13085. void colourChanged();
  13086. private:
  13087. TextButton (const TextButton&);
  13088. TextButton& operator= (const TextButton&);
  13089. };
  13090. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  13091. /*** End of inlined file: juce_TextButton.h ***/
  13092. class JUCE_API PluginListComponent : public Component,
  13093. public ListBoxModel,
  13094. public ChangeListener,
  13095. public ButtonListener,
  13096. public Timer
  13097. {
  13098. public:
  13099. PluginListComponent (KnownPluginList& listToRepresent,
  13100. const File& deadMansPedalFile,
  13101. PropertiesFile* propertiesToUse);
  13102. ~PluginListComponent();
  13103. void resized();
  13104. bool isInterestedInFileDrag (const StringArray& files);
  13105. void filesDropped (const StringArray& files, int, int);
  13106. int getNumRows();
  13107. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  13108. void deleteKeyPressed (int lastRowSelected);
  13109. void buttonClicked (Button* b);
  13110. void changeListenerCallback (void*);
  13111. void timerCallback();
  13112. juce_UseDebuggingNewOperator
  13113. private:
  13114. KnownPluginList& list;
  13115. File deadMansPedalFile;
  13116. ListBox* listBox;
  13117. TextButton* optionsButton;
  13118. PropertiesFile* propertiesToUse;
  13119. int typeToScan;
  13120. void scanFor (AudioPluginFormat* format);
  13121. PluginListComponent (const PluginListComponent&);
  13122. PluginListComponent& operator= (const PluginListComponent&);
  13123. };
  13124. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  13125. /*** End of inlined file: juce_PluginListComponent.h ***/
  13126. #endif
  13127. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  13128. #endif
  13129. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  13130. #endif
  13131. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  13132. #endif
  13133. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13134. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  13135. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13136. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13137. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  13138. public AsyncUpdater
  13139. {
  13140. public:
  13141. AudioProcessorGraph();
  13142. ~AudioProcessorGraph();
  13143. class JUCE_API Node : public ReferenceCountedObject
  13144. {
  13145. public:
  13146. ~Node();
  13147. const uint32 id;
  13148. AudioProcessor* const processor;
  13149. NamedValueSet properties;
  13150. typedef ReferenceCountedObjectPtr <Node> Ptr;
  13151. juce_UseDebuggingNewOperator
  13152. private:
  13153. friend class AudioProcessorGraph;
  13154. bool isPrepared;
  13155. Node (uint32 id, AudioProcessor* processor);
  13156. void prepare (double sampleRate, int blockSize, AudioProcessorGraph* graph);
  13157. void unprepare();
  13158. Node (const Node&);
  13159. Node& operator= (const Node&);
  13160. };
  13161. struct JUCE_API Connection
  13162. {
  13163. public:
  13164. uint32 sourceNodeId;
  13165. int sourceChannelIndex;
  13166. uint32 destNodeId;
  13167. int destChannelIndex;
  13168. juce_UseDebuggingNewOperator
  13169. private:
  13170. };
  13171. void clear();
  13172. int getNumNodes() const { return nodes.size(); }
  13173. Node* getNode (const int index) const { return nodes [index]; }
  13174. Node* getNodeForId (const uint32 nodeId) const;
  13175. Node* addNode (AudioProcessor* newProcessor, uint32 nodeId = 0);
  13176. bool removeNode (uint32 nodeId);
  13177. int getNumConnections() const { return connections.size(); }
  13178. const Connection* getConnection (int index) const { return connections [index]; }
  13179. const Connection* getConnectionBetween (uint32 sourceNodeId,
  13180. int sourceChannelIndex,
  13181. uint32 destNodeId,
  13182. int destChannelIndex) const;
  13183. bool isConnected (uint32 possibleSourceNodeId,
  13184. uint32 possibleDestNodeId) const;
  13185. bool canConnect (uint32 sourceNodeId, int sourceChannelIndex,
  13186. uint32 destNodeId, int destChannelIndex) const;
  13187. bool addConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13188. uint32 destNodeId, int destChannelIndex);
  13189. void removeConnection (int index);
  13190. bool removeConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13191. uint32 destNodeId, int destChannelIndex);
  13192. bool disconnectNode (uint32 nodeId);
  13193. bool removeIllegalConnections();
  13194. static const int midiChannelIndex;
  13195. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13196. {
  13197. public:
  13198. enum IODeviceType
  13199. {
  13200. audioInputNode, /**< In this mode, the processor has output channels
  13201. representing all the audio input channels that are
  13202. coming into its parent audio graph. */
  13203. audioOutputNode, /**< In this mode, the processor has input channels
  13204. representing all the audio output channels that are
  13205. going out of its parent audio graph. */
  13206. midiInputNode, /**< In this mode, the processor has a midi output which
  13207. delivers the same midi data that is arriving at its
  13208. parent graph. */
  13209. midiOutputNode /**< In this mode, the processor has a midi input and
  13210. any data sent to it will be passed out of the parent
  13211. graph. */
  13212. };
  13213. IODeviceType getType() const { return type; }
  13214. AudioProcessorGraph* getParentGraph() const { return graph; }
  13215. bool isInput() const;
  13216. bool isOutput() const;
  13217. AudioGraphIOProcessor (const IODeviceType type);
  13218. ~AudioGraphIOProcessor();
  13219. const String getName() const;
  13220. void fillInPluginDescription (PluginDescription& d) const;
  13221. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13222. void releaseResources();
  13223. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13224. const String getInputChannelName (const int channelIndex) const;
  13225. const String getOutputChannelName (const int channelIndex) const;
  13226. bool isInputChannelStereoPair (int index) const;
  13227. bool isOutputChannelStereoPair (int index) const;
  13228. bool acceptsMidi() const;
  13229. bool producesMidi() const;
  13230. AudioProcessorEditor* createEditor();
  13231. int getNumParameters();
  13232. const String getParameterName (int);
  13233. float getParameter (int);
  13234. const String getParameterText (int);
  13235. void setParameter (int, float);
  13236. int getNumPrograms();
  13237. int getCurrentProgram();
  13238. void setCurrentProgram (int);
  13239. const String getProgramName (int);
  13240. void changeProgramName (int, const String&);
  13241. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13242. void setStateInformation (const void* data, int sizeInBytes);
  13243. void setParentGraph (AudioProcessorGraph* graph);
  13244. juce_UseDebuggingNewOperator
  13245. private:
  13246. const IODeviceType type;
  13247. AudioProcessorGraph* graph;
  13248. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13249. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13250. };
  13251. // AudioProcessor methods:
  13252. const String getName() const;
  13253. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13254. void releaseResources();
  13255. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13256. const String getInputChannelName (const int channelIndex) const;
  13257. const String getOutputChannelName (const int channelIndex) const;
  13258. bool isInputChannelStereoPair (int index) const;
  13259. bool isOutputChannelStereoPair (int index) const;
  13260. bool acceptsMidi() const;
  13261. bool producesMidi() const;
  13262. AudioProcessorEditor* createEditor() { return 0; }
  13263. int getNumParameters() { return 0; }
  13264. const String getParameterName (int) { return String::empty; }
  13265. float getParameter (int) { return 0; }
  13266. const String getParameterText (int) { return String::empty; }
  13267. void setParameter (int, float) { }
  13268. int getNumPrograms() { return 0; }
  13269. int getCurrentProgram() { return 0; }
  13270. void setCurrentProgram (int) { }
  13271. const String getProgramName (int) { return String::empty; }
  13272. void changeProgramName (int, const String&) { }
  13273. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13274. void setStateInformation (const void* data, int sizeInBytes);
  13275. void handleAsyncUpdate();
  13276. juce_UseDebuggingNewOperator
  13277. private:
  13278. ReferenceCountedArray <Node> nodes;
  13279. OwnedArray <Connection> connections;
  13280. int lastNodeId;
  13281. AudioSampleBuffer renderingBuffers;
  13282. OwnedArray <MidiBuffer> midiBuffers;
  13283. CriticalSection renderLock;
  13284. VoidArray renderingOps;
  13285. friend class AudioGraphIOProcessor;
  13286. AudioSampleBuffer* currentAudioInputBuffer;
  13287. AudioSampleBuffer currentAudioOutputBuffer;
  13288. MidiBuffer* currentMidiInputBuffer;
  13289. MidiBuffer currentMidiOutputBuffer;
  13290. void clearRenderingSequence();
  13291. void buildRenderingSequence();
  13292. bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const;
  13293. AudioProcessorGraph (const AudioProcessorGraph&);
  13294. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13295. };
  13296. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13297. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13298. #endif
  13299. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13300. #endif
  13301. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13302. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13303. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13304. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13305. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13306. public MidiInputCallback
  13307. {
  13308. public:
  13309. AudioProcessorPlayer();
  13310. virtual ~AudioProcessorPlayer();
  13311. void setProcessor (AudioProcessor* const processorToPlay);
  13312. AudioProcessor* getCurrentProcessor() const { return processor; }
  13313. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13314. void audioDeviceIOCallback (const float** inputChannelData,
  13315. int totalNumInputChannels,
  13316. float** outputChannelData,
  13317. int totalNumOutputChannels,
  13318. int numSamples);
  13319. void audioDeviceAboutToStart (AudioIODevice* device);
  13320. void audioDeviceStopped();
  13321. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13322. juce_UseDebuggingNewOperator
  13323. private:
  13324. AudioProcessor* processor;
  13325. CriticalSection lock;
  13326. double sampleRate;
  13327. int blockSize;
  13328. bool isPrepared;
  13329. int numInputChans, numOutputChans;
  13330. float* channels [128];
  13331. AudioSampleBuffer tempBuffer;
  13332. MidiBuffer incomingMidi;
  13333. MidiMessageCollector messageCollector;
  13334. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13335. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13336. };
  13337. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13338. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13339. #endif
  13340. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13341. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13342. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13343. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13344. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13345. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13346. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13347. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13348. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13349. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13350. class EditableProperty;
  13351. class JUCE_API PropertyComponent : public Component,
  13352. public SettableTooltipClient
  13353. {
  13354. public:
  13355. PropertyComponent (const String& propertyName,
  13356. int preferredHeight = 25);
  13357. ~PropertyComponent();
  13358. int getPreferredHeight() const throw() { return preferredHeight; }
  13359. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13360. virtual void refresh() = 0;
  13361. void paint (Graphics& g);
  13362. void resized();
  13363. void enablementChanged();
  13364. juce_UseDebuggingNewOperator
  13365. protected:
  13366. int preferredHeight;
  13367. };
  13368. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13369. /*** End of inlined file: juce_PropertyComponent.h ***/
  13370. class JUCE_API PropertyPanel : public Component
  13371. {
  13372. public:
  13373. PropertyPanel();
  13374. ~PropertyPanel();
  13375. void clear();
  13376. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13377. void addSection (const String& sectionTitle,
  13378. const Array <PropertyComponent*>& newPropertyComponents,
  13379. bool shouldSectionInitiallyBeOpen = true);
  13380. void refreshAll() const;
  13381. const StringArray getSectionNames() const;
  13382. bool isSectionOpen (int sectionIndex) const;
  13383. void setSectionOpen (int sectionIndex, bool shouldBeOpen);
  13384. void setSectionEnabled (int sectionIndex, bool shouldBeEnabled);
  13385. XmlElement* getOpennessState() const;
  13386. void restoreOpennessState (const XmlElement& newState);
  13387. void setMessageWhenEmpty (const String& newMessage);
  13388. const String& getMessageWhenEmpty() const;
  13389. void paint (Graphics& g);
  13390. void resized();
  13391. juce_UseDebuggingNewOperator
  13392. private:
  13393. Viewport* viewport;
  13394. class PropertyHolderComponent;
  13395. PropertyHolderComponent* propertyHolderComponent;
  13396. String messageWhenEmpty;
  13397. void updatePropHolderLayout() const;
  13398. void updatePropHolderLayout (int width) const;
  13399. };
  13400. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13401. /*** End of inlined file: juce_PropertyPanel.h ***/
  13402. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13403. {
  13404. public:
  13405. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13406. ~GenericAudioProcessorEditor();
  13407. void paint (Graphics& g);
  13408. void resized();
  13409. juce_UseDebuggingNewOperator
  13410. private:
  13411. PropertyPanel* panel;
  13412. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13413. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13414. };
  13415. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13416. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13417. #endif
  13418. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13419. /*** Start of inlined file: juce_Sampler.h ***/
  13420. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13421. #define __JUCE_SAMPLER_JUCEHEADER__
  13422. /*** Start of inlined file: juce_Synthesiser.h ***/
  13423. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13424. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13425. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13426. {
  13427. protected:
  13428. SynthesiserSound();
  13429. public:
  13430. virtual ~SynthesiserSound();
  13431. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13432. virtual bool appliesToChannel (const int midiChannel) = 0;
  13433. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13434. juce_UseDebuggingNewOperator
  13435. };
  13436. class JUCE_API SynthesiserVoice
  13437. {
  13438. public:
  13439. SynthesiserVoice();
  13440. virtual ~SynthesiserVoice();
  13441. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13442. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13443. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13444. virtual void startNote (const int midiNoteNumber,
  13445. const float velocity,
  13446. SynthesiserSound* sound,
  13447. const int currentPitchWheelPosition) = 0;
  13448. virtual void stopNote (const bool allowTailOff) = 0;
  13449. virtual void pitchWheelMoved (const int newValue) = 0;
  13450. virtual void controllerMoved (const int controllerNumber,
  13451. const int newValue) = 0;
  13452. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13453. int startSample,
  13454. int numSamples) = 0;
  13455. bool isPlayingChannel (int midiChannel) const;
  13456. void setCurrentPlaybackSampleRate (double newRate);
  13457. juce_UseDebuggingNewOperator
  13458. protected:
  13459. double getSampleRate() const { return currentSampleRate; }
  13460. void clearCurrentNote();
  13461. private:
  13462. friend class Synthesiser;
  13463. double currentSampleRate;
  13464. int currentlyPlayingNote;
  13465. uint32 noteOnTime;
  13466. SynthesiserSound::Ptr currentlyPlayingSound;
  13467. };
  13468. class JUCE_API Synthesiser
  13469. {
  13470. public:
  13471. Synthesiser();
  13472. virtual ~Synthesiser();
  13473. void clearVoices();
  13474. int getNumVoices() const { return voices.size(); }
  13475. SynthesiserVoice* getVoice (int index) const;
  13476. void addVoice (SynthesiserVoice* newVoice);
  13477. void removeVoice (int index);
  13478. void clearSounds();
  13479. int getNumSounds() const { return sounds.size(); }
  13480. SynthesiserSound* getSound (int index) const { return sounds [index]; }
  13481. void addSound (const SynthesiserSound::Ptr& newSound);
  13482. void removeSound (int index);
  13483. void setNoteStealingEnabled (bool shouldStealNotes);
  13484. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13485. virtual void noteOn (const int midiChannel,
  13486. const int midiNoteNumber,
  13487. const float velocity);
  13488. virtual void noteOff (const int midiChannel,
  13489. const int midiNoteNumber,
  13490. const bool allowTailOff);
  13491. virtual void allNotesOff (const int midiChannel,
  13492. const bool allowTailOff);
  13493. virtual void handlePitchWheel (const int midiChannel,
  13494. const int wheelValue);
  13495. virtual void handleController (const int midiChannel,
  13496. const int controllerNumber,
  13497. const int controllerValue);
  13498. void setCurrentPlaybackSampleRate (const double sampleRate);
  13499. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13500. const MidiBuffer& inputMidi,
  13501. int startSample,
  13502. int numSamples);
  13503. juce_UseDebuggingNewOperator
  13504. protected:
  13505. CriticalSection lock;
  13506. OwnedArray <SynthesiserVoice> voices;
  13507. ReferenceCountedArray <SynthesiserSound> sounds;
  13508. int lastPitchWheelValues [16];
  13509. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13510. const bool stealIfNoneAvailable) const;
  13511. void startVoice (SynthesiserVoice* voice,
  13512. SynthesiserSound* sound,
  13513. int midiChannel,
  13514. int midiNoteNumber,
  13515. float velocity);
  13516. int findFreeVoice (const bool) const { return 0; }
  13517. private:
  13518. double sampleRate;
  13519. uint32 lastNoteOnCounter;
  13520. bool shouldStealNotes;
  13521. Synthesiser (const Synthesiser&);
  13522. Synthesiser& operator= (const Synthesiser&);
  13523. };
  13524. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13525. /*** End of inlined file: juce_Synthesiser.h ***/
  13526. class JUCE_API SamplerSound : public SynthesiserSound
  13527. {
  13528. public:
  13529. SamplerSound (const String& name,
  13530. AudioFormatReader& source,
  13531. const BigInteger& midiNotes,
  13532. int midiNoteForNormalPitch,
  13533. double attackTimeSecs,
  13534. double releaseTimeSecs,
  13535. double maxSampleLengthSeconds);
  13536. ~SamplerSound();
  13537. const String& getName() const { return name; }
  13538. AudioSampleBuffer* getAudioData() const { return data; }
  13539. bool appliesToNote (const int midiNoteNumber);
  13540. bool appliesToChannel (const int midiChannel);
  13541. juce_UseDebuggingNewOperator
  13542. private:
  13543. friend class SamplerVoice;
  13544. String name;
  13545. ScopedPointer <AudioSampleBuffer> data;
  13546. double sourceSampleRate;
  13547. BigInteger midiNotes;
  13548. int length, attackSamples, releaseSamples;
  13549. int midiRootNote;
  13550. };
  13551. class JUCE_API SamplerVoice : public SynthesiserVoice
  13552. {
  13553. public:
  13554. SamplerVoice();
  13555. ~SamplerVoice();
  13556. bool canPlaySound (SynthesiserSound* sound);
  13557. void startNote (const int midiNoteNumber,
  13558. const float velocity,
  13559. SynthesiserSound* sound,
  13560. const int currentPitchWheelPosition);
  13561. void stopNote (const bool allowTailOff);
  13562. void pitchWheelMoved (const int newValue);
  13563. void controllerMoved (const int controllerNumber,
  13564. const int newValue);
  13565. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13566. juce_UseDebuggingNewOperator
  13567. private:
  13568. double pitchRatio;
  13569. double sourceSamplePosition;
  13570. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13571. bool isInAttack, isInRelease;
  13572. };
  13573. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13574. /*** End of inlined file: juce_Sampler.h ***/
  13575. #endif
  13576. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13577. #endif
  13578. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13579. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13580. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13581. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13582. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13583. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13584. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13585. class JUCE_API ActionListenerList : public MessageListener
  13586. {
  13587. public:
  13588. ActionListenerList() throw();
  13589. ~ActionListenerList() throw();
  13590. void addActionListener (ActionListener* listener) throw();
  13591. void removeActionListener (ActionListener* listener) throw();
  13592. void removeAllActionListeners() throw();
  13593. void sendActionMessage (const String& message) const;
  13594. void handleMessage (const Message&);
  13595. juce_UseDebuggingNewOperator
  13596. private:
  13597. SortedSet <void*> actionListeners_;
  13598. CriticalSection actionListenerLock_;
  13599. ActionListenerList (const ActionListenerList&);
  13600. ActionListenerList& operator= (const ActionListenerList&);
  13601. };
  13602. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13603. /*** End of inlined file: juce_ActionListenerList.h ***/
  13604. class JUCE_API ActionBroadcaster
  13605. {
  13606. public:
  13607. ActionBroadcaster() throw();
  13608. virtual ~ActionBroadcaster();
  13609. void addActionListener (ActionListener* listener);
  13610. void removeActionListener (ActionListener* listener);
  13611. void removeAllActionListeners();
  13612. void sendActionMessage (const String& message) const;
  13613. private:
  13614. ActionListenerList actionListenerList;
  13615. ActionBroadcaster (const ActionBroadcaster&);
  13616. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13617. };
  13618. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13619. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13620. #endif
  13621. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13622. #endif
  13623. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13624. #endif
  13625. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13626. #endif
  13627. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13628. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13629. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13630. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13631. class JUCE_API CallbackMessage : public Message
  13632. {
  13633. public:
  13634. CallbackMessage() throw();
  13635. ~CallbackMessage() throw();
  13636. virtual void messageCallback() = 0;
  13637. void post();
  13638. juce_UseDebuggingNewOperator
  13639. private:
  13640. CallbackMessage (const CallbackMessage&);
  13641. CallbackMessage& operator= (const CallbackMessage&);
  13642. };
  13643. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13644. /*** End of inlined file: juce_CallbackMessage.h ***/
  13645. #endif
  13646. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13647. #endif
  13648. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13649. #endif
  13650. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13651. #endif
  13652. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13653. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13654. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13655. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13656. class InterprocessConnectionServer;
  13657. class JUCE_API InterprocessConnection : public Thread,
  13658. private MessageListener
  13659. {
  13660. public:
  13661. InterprocessConnection (bool callbacksOnMessageThread = true,
  13662. uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13663. ~InterprocessConnection();
  13664. bool connectToSocket (const String& hostName,
  13665. int portNumber,
  13666. int timeOutMillisecs);
  13667. bool connectToPipe (const String& pipeName,
  13668. int pipeReceiveMessageTimeoutMs = -1);
  13669. bool createPipe (const String& pipeName,
  13670. int pipeReceiveMessageTimeoutMs = -1);
  13671. void disconnect();
  13672. bool isConnected() const;
  13673. StreamingSocket* getSocket() const throw() { return socket; }
  13674. NamedPipe* getPipe() const throw() { return pipe; }
  13675. const String getConnectedHostName() const;
  13676. bool sendMessage (const MemoryBlock& message);
  13677. virtual void connectionMade() = 0;
  13678. virtual void connectionLost() = 0;
  13679. virtual void messageReceived (const MemoryBlock& message) = 0;
  13680. juce_UseDebuggingNewOperator
  13681. private:
  13682. CriticalSection pipeAndSocketLock;
  13683. ScopedPointer <StreamingSocket> socket;
  13684. ScopedPointer <NamedPipe> pipe;
  13685. bool callbackConnectionState;
  13686. const bool useMessageThread;
  13687. const uint32 magicMessageHeader;
  13688. int pipeReceiveMessageTimeout;
  13689. friend class InterprocessConnectionServer;
  13690. void initialiseWithSocket (StreamingSocket* socket_);
  13691. void initialiseWithPipe (NamedPipe* pipe_);
  13692. void handleMessage (const Message& message);
  13693. void connectionMadeInt();
  13694. void connectionLostInt();
  13695. void deliverDataInt (const MemoryBlock& data);
  13696. bool readNextMessageInt();
  13697. void run();
  13698. InterprocessConnection (const InterprocessConnection&);
  13699. InterprocessConnection& operator= (const InterprocessConnection&);
  13700. };
  13701. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13702. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13703. #endif
  13704. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13705. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13706. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13707. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13708. class JUCE_API InterprocessConnectionServer : private Thread
  13709. {
  13710. public:
  13711. InterprocessConnectionServer();
  13712. ~InterprocessConnectionServer();
  13713. bool beginWaitingForSocket (int portNumber);
  13714. void stop();
  13715. protected:
  13716. virtual InterprocessConnection* createConnectionObject() = 0;
  13717. public:
  13718. juce_UseDebuggingNewOperator
  13719. private:
  13720. ScopedPointer <StreamingSocket> socket;
  13721. void run();
  13722. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13723. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13724. };
  13725. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13726. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13727. #endif
  13728. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13729. #endif
  13730. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13731. #endif
  13732. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13733. #endif
  13734. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13735. /*** Start of inlined file: juce_MessageManager.h ***/
  13736. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13737. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13738. class Component;
  13739. class MessageManagerLock;
  13740. typedef void* (MessageCallbackFunction) (void* userData);
  13741. class JUCE_API MessageManager
  13742. {
  13743. public:
  13744. static MessageManager* getInstance() throw();
  13745. void runDispatchLoop();
  13746. void stopDispatchLoop();
  13747. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13748. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13749. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13750. void* userData);
  13751. bool isThisTheMessageThread() const throw();
  13752. void setCurrentThreadAsMessageThread();
  13753. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13754. bool currentThreadHasLockedMessageManager() const throw();
  13755. static void broadcastMessage (const String& messageText) throw();
  13756. void registerBroadcastListener (ActionListener* listener) throw();
  13757. void deregisterBroadcastListener (ActionListener* listener) throw();
  13758. void deliverMessage (void*);
  13759. void deliverBroadcastMessage (const String&);
  13760. ~MessageManager() throw();
  13761. juce_UseDebuggingNewOperator
  13762. private:
  13763. MessageManager() throw();
  13764. friend class MessageListener;
  13765. friend class ChangeBroadcaster;
  13766. friend class ActionBroadcaster;
  13767. friend class CallbackMessage;
  13768. static MessageManager* instance;
  13769. SortedSet <const MessageListener*> messageListeners;
  13770. ScopedPointer <ActionListenerList> broadcastListeners;
  13771. friend class JUCEApplication;
  13772. bool quitMessagePosted, quitMessageReceived;
  13773. Thread::ThreadID messageThreadId;
  13774. VoidArray modalComponents;
  13775. static void* exitModalLoopCallback (void*);
  13776. void postMessageToQueue (Message* message);
  13777. void postCallbackMessage (Message* message);
  13778. static void doPlatformSpecificInitialisation();
  13779. static void doPlatformSpecificShutdown();
  13780. friend class MessageManagerLock;
  13781. Thread::ThreadID volatile threadWithLock;
  13782. CriticalSection lockingLock;
  13783. MessageManager (const MessageManager&);
  13784. MessageManager& operator= (const MessageManager&);
  13785. };
  13786. class JUCE_API MessageManagerLock
  13787. {
  13788. public:
  13789. MessageManagerLock (Thread* threadToCheckForExitSignal = 0) throw();
  13790. MessageManagerLock (ThreadPoolJob* jobToCheckForExitSignal) throw();
  13791. ~MessageManagerLock() throw();
  13792. bool lockWasGained() const throw() { return locked; }
  13793. private:
  13794. class SharedEvents;
  13795. class BlockingMessage;
  13796. friend class SharedEvents;
  13797. friend class BlockingMessage;
  13798. SharedEvents* sharedEvents;
  13799. bool locked;
  13800. void init (Thread* thread, ThreadPoolJob* job) throw();
  13801. MessageManagerLock (const MessageManagerLock&);
  13802. MessageManagerLock& operator= (const MessageManagerLock&);
  13803. };
  13804. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13805. /*** End of inlined file: juce_MessageManager.h ***/
  13806. #endif
  13807. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13808. /*** Start of inlined file: juce_MultiTimer.h ***/
  13809. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13810. #define __JUCE_MULTITIMER_JUCEHEADER__
  13811. class JUCE_API MultiTimer
  13812. {
  13813. protected:
  13814. MultiTimer() throw();
  13815. MultiTimer (const MultiTimer& other) throw();
  13816. public:
  13817. virtual ~MultiTimer();
  13818. virtual void timerCallback (int timerId) = 0;
  13819. void startTimer (int timerId, int intervalInMilliseconds) throw();
  13820. void stopTimer (int timerId) throw();
  13821. bool isTimerRunning (int timerId) const throw();
  13822. int getTimerInterval (int timerId) const throw();
  13823. private:
  13824. class MultiTimerCallback;
  13825. CriticalSection timerListLock;
  13826. OwnedArray <MultiTimerCallback> timers;
  13827. MultiTimer& operator= (const MultiTimer&);
  13828. };
  13829. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13830. /*** End of inlined file: juce_MultiTimer.h ***/
  13831. #endif
  13832. #ifndef __JUCE_TIMER_JUCEHEADER__
  13833. #endif
  13834. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13835. /*** Start of inlined file: juce_ArrowButton.h ***/
  13836. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13837. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13838. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13839. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13840. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13841. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13842. {
  13843. public:
  13844. DropShadowEffect();
  13845. ~DropShadowEffect();
  13846. void setShadowProperties (const float newRadius,
  13847. const float newOpacity,
  13848. const int newShadowOffsetX,
  13849. const int newShadowOffsetY);
  13850. void applyEffect (Image& sourceImage, Graphics& destContext);
  13851. juce_UseDebuggingNewOperator
  13852. private:
  13853. int offsetX, offsetY;
  13854. float radius, opacity;
  13855. };
  13856. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13857. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13858. class JUCE_API ArrowButton : public Button
  13859. {
  13860. public:
  13861. ArrowButton (const String& buttonName,
  13862. float arrowDirection,
  13863. const Colour& arrowColour);
  13864. ~ArrowButton();
  13865. juce_UseDebuggingNewOperator
  13866. protected:
  13867. void paintButton (Graphics& g,
  13868. bool isMouseOverButton,
  13869. bool isButtonDown);
  13870. void buttonStateChanged();
  13871. private:
  13872. Colour colour;
  13873. DropShadowEffect shadow;
  13874. Path path;
  13875. int offset;
  13876. ArrowButton (const ArrowButton&);
  13877. ArrowButton& operator= (const ArrowButton&);
  13878. };
  13879. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13880. /*** End of inlined file: juce_ArrowButton.h ***/
  13881. #endif
  13882. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13883. #endif
  13884. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13885. /*** Start of inlined file: juce_DrawableButton.h ***/
  13886. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13887. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13888. /*** Start of inlined file: juce_Drawable.h ***/
  13889. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13890. #define __JUCE_DRAWABLE_JUCEHEADER__
  13891. class JUCE_API Drawable
  13892. {
  13893. protected:
  13894. Drawable();
  13895. public:
  13896. virtual ~Drawable();
  13897. virtual Drawable* createCopy() const = 0;
  13898. void draw (Graphics& g, float opacity,
  13899. const AffineTransform& transform = AffineTransform::identity) const;
  13900. void drawAt (Graphics& g,
  13901. float x, float y,
  13902. float opacity) const;
  13903. void drawWithin (Graphics& g,
  13904. int destX,
  13905. int destY,
  13906. int destWidth,
  13907. int destHeight,
  13908. const RectanglePlacement& placement,
  13909. float opacity) const;
  13910. class RenderingContext
  13911. {
  13912. public:
  13913. RenderingContext (Graphics& g, const AffineTransform& transform, float opacity) throw();
  13914. Graphics& g;
  13915. AffineTransform transform;
  13916. float opacity;
  13917. private:
  13918. RenderingContext& operator= (const RenderingContext&);
  13919. };
  13920. virtual void render (const RenderingContext& context) const = 0;
  13921. virtual const Rectangle<float> getBounds() const = 0;
  13922. virtual bool hitTest (float x, float y) const = 0;
  13923. const String& getName() const throw() { return name; }
  13924. void setName (const String& newName) throw() { name = newName; }
  13925. static Drawable* createFromImageData (const void* data, size_t numBytes);
  13926. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13927. static Drawable* createFromImageFile (const File& file);
  13928. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13929. static Drawable* createFromValueTree (const ValueTree& tree);
  13930. virtual ValueTree createValueTree() const = 0;
  13931. juce_UseDebuggingNewOperator
  13932. private:
  13933. Drawable (const Drawable&);
  13934. Drawable& operator= (const Drawable&);
  13935. String name;
  13936. };
  13937. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13938. /*** End of inlined file: juce_Drawable.h ***/
  13939. class JUCE_API DrawableButton : public Button
  13940. {
  13941. public:
  13942. enum ButtonStyle
  13943. {
  13944. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13945. ImageRaw, /**< The button will just display the images in their normal size and position.
  13946. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13947. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13948. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13949. };
  13950. DrawableButton (const String& buttonName,
  13951. ButtonStyle buttonStyle);
  13952. ~DrawableButton();
  13953. void setImages (const Drawable* normalImage,
  13954. const Drawable* overImage = 0,
  13955. const Drawable* downImage = 0,
  13956. const Drawable* disabledImage = 0,
  13957. const Drawable* normalImageOn = 0,
  13958. const Drawable* overImageOn = 0,
  13959. const Drawable* downImageOn = 0,
  13960. const Drawable* disabledImageOn = 0);
  13961. void setButtonStyle (ButtonStyle newStyle);
  13962. void setBackgroundColours (const Colour& toggledOffColour,
  13963. const Colour& toggledOnColour);
  13964. const Colour& getBackgroundColour() const throw();
  13965. void setEdgeIndent (int numPixelsIndent);
  13966. const Drawable* getCurrentImage() const throw();
  13967. const Drawable* getNormalImage() const throw();
  13968. const Drawable* getOverImage() const throw();
  13969. const Drawable* getDownImage() const throw();
  13970. juce_UseDebuggingNewOperator
  13971. protected:
  13972. void paintButton (Graphics& g,
  13973. bool isMouseOverButton,
  13974. bool isButtonDown);
  13975. private:
  13976. ButtonStyle style;
  13977. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13978. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13979. Colour backgroundOff, backgroundOn;
  13980. int edgeIndent;
  13981. void deleteImages();
  13982. DrawableButton (const DrawableButton&);
  13983. DrawableButton& operator= (const DrawableButton&);
  13984. };
  13985. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13986. /*** End of inlined file: juce_DrawableButton.h ***/
  13987. #endif
  13988. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13989. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13990. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13991. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13992. class JUCE_API HyperlinkButton : public Button
  13993. {
  13994. public:
  13995. HyperlinkButton (const String& linkText,
  13996. const URL& linkURL);
  13997. ~HyperlinkButton();
  13998. void setFont (const Font& newFont,
  13999. bool resizeToMatchComponentHeight,
  14000. const Justification& justificationType = Justification::horizontallyCentred);
  14001. enum ColourIds
  14002. {
  14003. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  14004. };
  14005. void setURL (const URL& newURL) throw();
  14006. const URL& getURL() const throw() { return url; }
  14007. void changeWidthToFitText();
  14008. juce_UseDebuggingNewOperator
  14009. protected:
  14010. void clicked();
  14011. void colourChanged();
  14012. void paintButton (Graphics& g,
  14013. bool isMouseOverButton,
  14014. bool isButtonDown);
  14015. private:
  14016. URL url;
  14017. Font font;
  14018. bool resizeFont;
  14019. Justification justification;
  14020. const Font getFontToUse() const;
  14021. HyperlinkButton (const HyperlinkButton&);
  14022. HyperlinkButton& operator= (const HyperlinkButton&);
  14023. };
  14024. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  14025. /*** End of inlined file: juce_HyperlinkButton.h ***/
  14026. #endif
  14027. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  14028. /*** Start of inlined file: juce_ImageButton.h ***/
  14029. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  14030. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  14031. class JUCE_API ImageButton : public Button
  14032. {
  14033. public:
  14034. explicit ImageButton (const String& name);
  14035. ~ImageButton();
  14036. void setImages (bool resizeButtonNowToFitThisImage,
  14037. bool rescaleImagesWhenButtonSizeChanges,
  14038. bool preserveImageProportions,
  14039. Image* normalImage,
  14040. float imageOpacityWhenNormal,
  14041. const Colour& overlayColourWhenNormal,
  14042. Image* overImage,
  14043. float imageOpacityWhenOver,
  14044. const Colour& overlayColourWhenOver,
  14045. Image* downImage,
  14046. float imageOpacityWhenDown,
  14047. const Colour& overlayColourWhenDown,
  14048. float hitTestAlphaThreshold = 0.0f);
  14049. Image* getNormalImage() const throw();
  14050. Image* getOverImage() const throw();
  14051. Image* getDownImage() const throw();
  14052. juce_UseDebuggingNewOperator
  14053. protected:
  14054. bool hitTest (int x, int y);
  14055. void paintButton (Graphics& g,
  14056. bool isMouseOverButton,
  14057. bool isButtonDown);
  14058. private:
  14059. bool scaleImageToFit, preserveProportions;
  14060. unsigned char alphaThreshold;
  14061. int imageX, imageY, imageW, imageH;
  14062. Image* normalImage;
  14063. Image* overImage;
  14064. Image* downImage;
  14065. float normalOpacity, overOpacity, downOpacity;
  14066. Colour normalOverlay, overOverlay, downOverlay;
  14067. Image* getCurrentImage() const;
  14068. void deleteImages();
  14069. ImageButton (const ImageButton&);
  14070. ImageButton& operator= (const ImageButton&);
  14071. };
  14072. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  14073. /*** End of inlined file: juce_ImageButton.h ***/
  14074. #endif
  14075. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  14076. /*** Start of inlined file: juce_ShapeButton.h ***/
  14077. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  14078. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  14079. class JUCE_API ShapeButton : public Button
  14080. {
  14081. public:
  14082. ShapeButton (const String& name,
  14083. const Colour& normalColour,
  14084. const Colour& overColour,
  14085. const Colour& downColour);
  14086. ~ShapeButton();
  14087. void setShape (const Path& newShape,
  14088. bool resizeNowToFitThisShape,
  14089. bool maintainShapeProportions,
  14090. bool hasDropShadow);
  14091. void setColours (const Colour& normalColour,
  14092. const Colour& overColour,
  14093. const Colour& downColour);
  14094. void setOutline (const Colour& outlineColour,
  14095. float outlineStrokeWidth);
  14096. juce_UseDebuggingNewOperator
  14097. protected:
  14098. void paintButton (Graphics& g,
  14099. bool isMouseOverButton,
  14100. bool isButtonDown);
  14101. private:
  14102. Colour normalColour, overColour, downColour, outlineColour;
  14103. DropShadowEffect shadow;
  14104. Path shape;
  14105. bool maintainShapeProportions;
  14106. float outlineWidth;
  14107. ShapeButton (const ShapeButton&);
  14108. ShapeButton& operator= (const ShapeButton&);
  14109. };
  14110. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  14111. /*** End of inlined file: juce_ShapeButton.h ***/
  14112. #endif
  14113. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  14114. #endif
  14115. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14116. /*** Start of inlined file: juce_ToggleButton.h ***/
  14117. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14118. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14119. class JUCE_API ToggleButton : public Button
  14120. {
  14121. public:
  14122. ToggleButton (const String& buttonText);
  14123. ~ToggleButton();
  14124. void changeWidthToFitText();
  14125. enum ColourIds
  14126. {
  14127. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  14128. };
  14129. juce_UseDebuggingNewOperator
  14130. protected:
  14131. void paintButton (Graphics& g,
  14132. bool isMouseOverButton,
  14133. bool isButtonDown);
  14134. void colourChanged();
  14135. private:
  14136. ToggleButton (const ToggleButton&);
  14137. ToggleButton& operator= (const ToggleButton&);
  14138. };
  14139. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  14140. /*** End of inlined file: juce_ToggleButton.h ***/
  14141. #endif
  14142. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14143. /*** Start of inlined file: juce_ToolbarButton.h ***/
  14144. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14145. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14146. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  14147. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14148. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14149. /*** Start of inlined file: juce_Toolbar.h ***/
  14150. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14151. #define __JUCE_TOOLBAR_JUCEHEADER__
  14152. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  14153. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14154. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14155. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  14156. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14157. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14158. class JUCE_API DragAndDropTarget
  14159. {
  14160. public:
  14161. virtual ~DragAndDropTarget() {}
  14162. virtual bool isInterestedInDragSource (const String& sourceDescription,
  14163. Component* sourceComponent) = 0;
  14164. virtual void itemDragEnter (const String& sourceDescription,
  14165. Component* sourceComponent,
  14166. int x, int y);
  14167. virtual void itemDragMove (const String& sourceDescription,
  14168. Component* sourceComponent,
  14169. int x, int y);
  14170. virtual void itemDragExit (const String& sourceDescription,
  14171. Component* sourceComponent);
  14172. virtual void itemDropped (const String& sourceDescription,
  14173. Component* sourceComponent,
  14174. int x, int y) = 0;
  14175. virtual bool shouldDrawDragImageWhenOver();
  14176. };
  14177. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14178. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  14179. class JUCE_API DragAndDropContainer
  14180. {
  14181. public:
  14182. DragAndDropContainer();
  14183. virtual ~DragAndDropContainer();
  14184. void startDragging (const String& sourceDescription,
  14185. Component* sourceComponent,
  14186. Image* dragImage = 0,
  14187. bool allowDraggingToOtherJuceWindows = false,
  14188. const Point<int>* imageOffsetFromMouse = 0);
  14189. bool isDragAndDropActive() const;
  14190. const String getCurrentDragDescription() const;
  14191. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14192. static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles);
  14193. static bool performExternalDragDropOfText (const String& text);
  14194. juce_UseDebuggingNewOperator
  14195. protected:
  14196. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14197. Component* dragSourceComponent,
  14198. StringArray& files,
  14199. bool& canMoveFiles);
  14200. private:
  14201. friend class DragImageComponent;
  14202. ScopedPointer <Component> dragImageComponent;
  14203. String currentDragDesc;
  14204. };
  14205. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14206. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14207. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14208. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14209. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14210. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14211. private Timer
  14212. {
  14213. public:
  14214. ComponentAnimator();
  14215. ~ComponentAnimator();
  14216. void animateComponent (Component* component,
  14217. const Rectangle<int>& finalPosition,
  14218. int millisecondsToSpendMoving,
  14219. double startSpeed = 1.0,
  14220. double endSpeed = 1.0);
  14221. void cancelAnimation (Component* component,
  14222. bool moveComponentToItsFinalPosition);
  14223. void cancelAllAnimations (bool moveComponentsToTheirFinalPositions);
  14224. const Rectangle<int> getComponentDestination (Component* component);
  14225. bool isAnimating (Component* component) const;
  14226. juce_UseDebuggingNewOperator
  14227. private:
  14228. class AnimationTask;
  14229. Array <AnimationTask*> tasks;
  14230. uint32 lastTime;
  14231. AnimationTask* findTaskFor (Component* component) const;
  14232. void timerCallback();
  14233. };
  14234. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14235. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14236. class ToolbarItemComponent;
  14237. class ToolbarItemFactory;
  14238. class MissingItemsComponent;
  14239. class JUCE_API Toolbar : public Component,
  14240. public DragAndDropContainer,
  14241. public DragAndDropTarget,
  14242. private ButtonListener
  14243. {
  14244. public:
  14245. Toolbar();
  14246. ~Toolbar();
  14247. void setVertical (bool shouldBeVertical);
  14248. bool isVertical() const throw() { return vertical; }
  14249. int getThickness() const throw();
  14250. int getLength() const throw();
  14251. void clear();
  14252. void addItem (ToolbarItemFactory& factory,
  14253. int itemId,
  14254. int insertIndex = -1);
  14255. void removeToolbarItem (int itemIndex);
  14256. int getNumItems() const throw();
  14257. int getItemId (int itemIndex) const throw();
  14258. ToolbarItemComponent* getItemComponent (int itemIndex) const throw();
  14259. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14260. enum ToolbarItemStyle
  14261. {
  14262. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14263. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14264. textOnly /**< Means that the toolbar only display text labels for each item. */
  14265. };
  14266. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14267. void setStyle (const ToolbarItemStyle& newStyle);
  14268. enum CustomisationFlags
  14269. {
  14270. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14271. show the "icons only" option on its choice of toolbar styles. */
  14272. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14273. show the "icons with text" option on its choice of toolbar styles. */
  14274. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14275. show the "text only" option on its choice of toolbar styles. */
  14276. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14277. show a button to reset the toolbar to its default set of items. */
  14278. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14279. };
  14280. void showCustomisationDialog (ToolbarItemFactory& factory,
  14281. int optionFlags = allCustomisationOptionsEnabled);
  14282. void setEditingActive (bool editingEnabled);
  14283. enum ColourIds
  14284. {
  14285. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14286. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14287. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14288. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14289. over them. */
  14290. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14291. held down on them. */
  14292. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14293. when the style is set to iconsWithText or textOnly. */
  14294. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14295. the customisation dialog is active and the mouse moves over them. */
  14296. };
  14297. const String toString() const;
  14298. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14299. const String& savedVersion);
  14300. void paint (Graphics& g);
  14301. void resized();
  14302. void buttonClicked (Button*);
  14303. void mouseDown (const MouseEvent&);
  14304. bool isInterestedInDragSource (const String&, Component*);
  14305. void itemDragMove (const String&, Component*, int, int);
  14306. void itemDragExit (const String&, Component*);
  14307. void itemDropped (const String&, Component*, int, int);
  14308. void updateAllItemPositions (const bool animate);
  14309. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14310. juce_UseDebuggingNewOperator
  14311. private:
  14312. Button* missingItemsButton;
  14313. bool vertical, isEditingActive;
  14314. ToolbarItemStyle toolbarStyle;
  14315. ComponentAnimator animator;
  14316. friend class MissingItemsComponent;
  14317. Array <ToolbarItemComponent*> items;
  14318. friend class ItemDragAndDropOverlayComponent;
  14319. static const char* const toolbarDragDescriptor;
  14320. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14321. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14322. Toolbar (const Toolbar&);
  14323. Toolbar& operator= (const Toolbar&);
  14324. };
  14325. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14326. /*** End of inlined file: juce_Toolbar.h ***/
  14327. class ItemDragAndDropOverlayComponent;
  14328. class JUCE_API ToolbarItemComponent : public Button
  14329. {
  14330. public:
  14331. ToolbarItemComponent (int itemId,
  14332. const String& labelText,
  14333. bool isBeingUsedAsAButton);
  14334. ~ToolbarItemComponent();
  14335. int getItemId() const throw() { return itemId; }
  14336. Toolbar* getToolbar() const;
  14337. bool isToolbarVertical() const;
  14338. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14339. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14340. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14341. virtual bool getToolbarItemSizes (int toolbarThickness,
  14342. bool isToolbarVertical,
  14343. int& preferredSize,
  14344. int& minSize,
  14345. int& maxSize) = 0;
  14346. virtual void paintButtonArea (Graphics& g,
  14347. int width, int height,
  14348. bool isMouseOver, bool isMouseDown) = 0;
  14349. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14350. enum ToolbarEditingMode
  14351. {
  14352. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14353. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14354. customisation mode, and the items can be dragged around. */
  14355. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14356. dragged onto a toolbar to add it to that bar.*/
  14357. };
  14358. void setEditingMode (const ToolbarEditingMode newMode);
  14359. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14360. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14361. void resized();
  14362. juce_UseDebuggingNewOperator
  14363. private:
  14364. friend class Toolbar;
  14365. friend class ItemDragAndDropOverlayComponent;
  14366. const int itemId;
  14367. ToolbarEditingMode mode;
  14368. Toolbar::ToolbarItemStyle toolbarStyle;
  14369. ScopedPointer <Component> overlayComp;
  14370. int dragOffsetX, dragOffsetY;
  14371. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14372. Rectangle<int> contentArea;
  14373. ToolbarItemComponent (const ToolbarItemComponent&);
  14374. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14375. };
  14376. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14377. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14378. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14379. {
  14380. public:
  14381. ToolbarButton (int itemId,
  14382. const String& labelText,
  14383. Drawable* normalImage,
  14384. Drawable* toggledOnImage);
  14385. ~ToolbarButton();
  14386. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14387. int& minSize, int& maxSize);
  14388. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14389. void contentAreaChanged (const Rectangle<int>& newBounds);
  14390. juce_UseDebuggingNewOperator
  14391. private:
  14392. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14393. ToolbarButton (const ToolbarButton&);
  14394. ToolbarButton& operator= (const ToolbarButton&);
  14395. };
  14396. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14397. /*** End of inlined file: juce_ToolbarButton.h ***/
  14398. #endif
  14399. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14400. /*** Start of inlined file: juce_CodeDocument.h ***/
  14401. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14402. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14403. class CodeDocumentLine;
  14404. class JUCE_API CodeDocument
  14405. {
  14406. public:
  14407. CodeDocument();
  14408. ~CodeDocument();
  14409. class JUCE_API Position
  14410. {
  14411. public:
  14412. Position() throw();
  14413. Position (const CodeDocument* ownerDocument,
  14414. int line, int indexInLine) throw();
  14415. Position (const CodeDocument* ownerDocument,
  14416. int charactersFromStartOfDocument) throw();
  14417. Position (const Position& other) throw();
  14418. ~Position() throw();
  14419. Position& operator= (const Position& other) throw();
  14420. bool operator== (const Position& other) const throw();
  14421. bool operator!= (const Position& other) const throw();
  14422. void setPosition (int charactersFromStartOfDocument) throw();
  14423. int getPosition() const throw() { return characterPos; }
  14424. void setLineAndIndex (int newLine, int newIndexInLine) throw();
  14425. int getLineNumber() const throw() { return line; }
  14426. int getIndexInLine() const throw() { return indexInLine; }
  14427. void setPositionMaintained (bool isMaintained) throw();
  14428. void moveBy (int characterDelta) throw();
  14429. const Position movedBy (int characterDelta) const throw();
  14430. const Position movedByLines (int deltaLines) const throw();
  14431. const juce_wchar getCharacter() const throw();
  14432. const String getLineText() const throw();
  14433. private:
  14434. CodeDocument* owner;
  14435. int characterPos, line, indexInLine;
  14436. bool positionMaintained;
  14437. };
  14438. const String getAllContent() const throw();
  14439. const String getTextBetween (const Position& start, const Position& end) const throw();
  14440. const String getLine (int lineIndex) const throw();
  14441. int getNumCharacters() const throw();
  14442. int getNumLines() const throw() { return lines.size(); }
  14443. int getMaximumLineLength() throw();
  14444. void deleteSection (const Position& startPosition, const Position& endPosition);
  14445. void insertText (const Position& position, const String& text);
  14446. void replaceAllContent (const String& newContent);
  14447. bool loadFromStream (InputStream& stream);
  14448. bool writeToStream (OutputStream& stream);
  14449. const String getNewLineCharacters() const throw() { return newLineChars; }
  14450. void setNewLineCharacters (const String& newLine) throw();
  14451. void newTransaction();
  14452. void undo();
  14453. void redo();
  14454. void clearUndoHistory();
  14455. UndoManager& getUndoManager() throw() { return undoManager; }
  14456. void setSavePoint() throw();
  14457. bool hasChangedSinceSavePoint() const throw();
  14458. const Position findWordBreakAfter (const Position& position) const throw();
  14459. const Position findWordBreakBefore (const Position& position) const throw();
  14460. class JUCE_API Listener
  14461. {
  14462. public:
  14463. Listener() {}
  14464. virtual ~Listener() {}
  14465. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14466. const Position& affectedTextEnd) = 0;
  14467. };
  14468. void addListener (Listener* listener) throw();
  14469. void removeListener (Listener* listener) throw();
  14470. class Iterator
  14471. {
  14472. public:
  14473. Iterator (CodeDocument* document);
  14474. Iterator (const Iterator& other);
  14475. Iterator& operator= (const Iterator& other) throw();
  14476. ~Iterator() throw();
  14477. juce_wchar nextChar();
  14478. juce_wchar peekNextChar() const;
  14479. void skip();
  14480. int getPosition() const throw() { return position; }
  14481. void skipWhitespace();
  14482. void skipToEndOfLine();
  14483. int getLine() const throw() { return line; }
  14484. bool isEOF() const throw();
  14485. private:
  14486. CodeDocument* document;
  14487. CodeDocumentLine* currentLine;
  14488. int line, position;
  14489. };
  14490. juce_UseDebuggingNewOperator
  14491. private:
  14492. friend class CodeDocumentInsertAction;
  14493. friend class CodeDocumentDeleteAction;
  14494. friend class Iterator;
  14495. friend class Position;
  14496. OwnedArray <CodeDocumentLine> lines;
  14497. Array <Position*> positionsToMaintain;
  14498. UndoManager undoManager;
  14499. int currentActionIndex, indexOfSavedState;
  14500. int maximumLineLength;
  14501. ListenerList <Listener> listeners;
  14502. String newLineChars;
  14503. void sendListenerChangeMessage (int startLine, int endLine);
  14504. void insert (const String& text, int insertPos, bool undoable);
  14505. void remove (int startPos, int endPos, bool undoable);
  14506. void checkLastLineStatus();
  14507. CodeDocument (const CodeDocument&);
  14508. CodeDocument& operator= (const CodeDocument&);
  14509. };
  14510. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14511. /*** End of inlined file: juce_CodeDocument.h ***/
  14512. #endif
  14513. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14514. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14515. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14516. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14517. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14518. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14519. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14520. class JUCE_API CodeTokeniser
  14521. {
  14522. public:
  14523. CodeTokeniser() {}
  14524. virtual ~CodeTokeniser() {}
  14525. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14526. virtual const StringArray getTokenTypes() = 0;
  14527. virtual const Colour getDefaultColour (int tokenType) = 0;
  14528. juce_UseDebuggingNewOperator
  14529. };
  14530. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14531. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14532. class JUCE_API CodeEditorComponent : public Component,
  14533. public TextInputTarget,
  14534. public Timer,
  14535. public ScrollBarListener,
  14536. public CodeDocument::Listener,
  14537. public AsyncUpdater
  14538. {
  14539. public:
  14540. CodeEditorComponent (CodeDocument& document,
  14541. CodeTokeniser* codeTokeniser);
  14542. ~CodeEditorComponent();
  14543. CodeDocument& getDocument() const throw() { return document; }
  14544. void loadContent (const String& newContent);
  14545. float getCharWidth() const throw() { return charWidth; }
  14546. int getLineHeight() const throw() { return lineHeight; }
  14547. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14548. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14549. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14550. void moveCaretTo (const CodeDocument::Position& newPos, bool selecting);
  14551. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14552. const CodeDocument::Position getPositionAt (int x, int y);
  14553. void cursorLeft (bool moveInWholeWordSteps, bool selecting);
  14554. void cursorRight (bool moveInWholeWordSteps, bool selecting);
  14555. void cursorDown (bool selecting);
  14556. void cursorUp (bool selecting);
  14557. void pageDown (bool selecting);
  14558. void pageUp (bool selecting);
  14559. void scrollDown();
  14560. void scrollUp();
  14561. void scrollToLine (int newFirstLineOnScreen);
  14562. void scrollBy (int deltaLines);
  14563. void scrollToColumn (int newFirstColumnOnScreen);
  14564. void scrollToKeepCaretOnScreen();
  14565. void goToStartOfDocument (bool selecting);
  14566. void goToStartOfLine (bool selecting);
  14567. void goToEndOfDocument (bool selecting);
  14568. void goToEndOfLine (bool selecting);
  14569. void deselectAll();
  14570. void selectAll();
  14571. void insertTextAtCaret (const String& textToInsert);
  14572. void insertTabAtCaret();
  14573. void cut();
  14574. void copy();
  14575. void copyThenCut();
  14576. void paste();
  14577. void backspace (bool moveInWholeWordSteps);
  14578. void deleteForward (bool moveInWholeWordSteps);
  14579. void undo();
  14580. void redo();
  14581. const Range<int> getHighlightedRegion() const;
  14582. void setHighlightedRegion (const Range<int>& newRange);
  14583. const String getTextInRange (const Range<int>& range) const;
  14584. void setTabSize (int numSpacesPerTab,
  14585. bool insertSpacesInsteadOfTabCharacters) throw();
  14586. int getTabSize() const throw() { return spacesPerTab; }
  14587. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14588. void setFont (const Font& newFont);
  14589. const Font& getFont() const throw() { return font; }
  14590. void resetToDefaultColours();
  14591. void setColourForTokenType (int tokenType, const Colour& colour);
  14592. const Colour getColourForTokenType (int tokenType) const throw();
  14593. enum ColourIds
  14594. {
  14595. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14596. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14597. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14598. selected text. */
  14599. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14600. enabled. */
  14601. };
  14602. void setScrollbarThickness (int thickness) throw();
  14603. int getScrollbarThickness() const throw() { return scrollbarThickness; }
  14604. void resized();
  14605. void paint (Graphics& g);
  14606. bool keyPressed (const KeyPress& key);
  14607. void mouseDown (const MouseEvent& e);
  14608. void mouseDrag (const MouseEvent& e);
  14609. void mouseUp (const MouseEvent& e);
  14610. void mouseDoubleClick (const MouseEvent& e);
  14611. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14612. void focusGained (FocusChangeType cause);
  14613. void focusLost (FocusChangeType cause);
  14614. void timerCallback();
  14615. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14616. void handleAsyncUpdate();
  14617. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14618. const CodeDocument::Position& affectedTextEnd);
  14619. juce_UseDebuggingNewOperator
  14620. private:
  14621. CodeDocument& document;
  14622. Font font;
  14623. int firstLineOnScreen, gutter, spacesPerTab;
  14624. float charWidth;
  14625. int lineHeight, linesOnScreen, columnsOnScreen;
  14626. int scrollbarThickness, columnToTryToMaintain;
  14627. bool useSpacesForTabs;
  14628. double xOffset;
  14629. CodeDocument::Position caretPos;
  14630. CodeDocument::Position selectionStart, selectionEnd;
  14631. class CaretComponent;
  14632. CaretComponent* caret;
  14633. ScrollBar* verticalScrollBar;
  14634. ScrollBar* horizontalScrollBar;
  14635. enum DragType
  14636. {
  14637. notDragging,
  14638. draggingSelectionStart,
  14639. draggingSelectionEnd
  14640. };
  14641. DragType dragType;
  14642. CodeTokeniser* codeTokeniser;
  14643. Array <Colour> coloursForTokenCategories;
  14644. class CodeEditorLine;
  14645. OwnedArray <CodeEditorLine> lines;
  14646. void rebuildLineTokens();
  14647. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14648. void clearCachedIterators (int firstLineToBeInvalid) throw();
  14649. void updateCachedIterators (int maxLineNum);
  14650. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14651. void moveLineDelta (int delta, bool selecting);
  14652. void updateScrollBars();
  14653. void scrollToLineInternal (int line);
  14654. void scrollToColumnInternal (double column);
  14655. void newTransaction();
  14656. int indexToColumn (int line, int index) const throw();
  14657. int columnToIndex (int line, int column) const throw();
  14658. CodeEditorComponent (const CodeEditorComponent&);
  14659. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14660. };
  14661. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14662. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14663. #endif
  14664. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14665. #endif
  14666. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14667. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14668. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14669. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14670. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14671. {
  14672. public:
  14673. CPlusPlusCodeTokeniser();
  14674. ~CPlusPlusCodeTokeniser();
  14675. enum TokenType
  14676. {
  14677. tokenType_error = 0,
  14678. tokenType_comment,
  14679. tokenType_builtInKeyword,
  14680. tokenType_identifier,
  14681. tokenType_integerLiteral,
  14682. tokenType_floatLiteral,
  14683. tokenType_stringLiteral,
  14684. tokenType_operator,
  14685. tokenType_bracket,
  14686. tokenType_punctuation,
  14687. tokenType_preprocessor
  14688. };
  14689. int readNextToken (CodeDocument::Iterator& source);
  14690. const StringArray getTokenTypes();
  14691. const Colour getDefaultColour (int tokenType);
  14692. juce_UseDebuggingNewOperator
  14693. };
  14694. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14695. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14696. #endif
  14697. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14698. #endif
  14699. #ifndef __JUCE_LABEL_JUCEHEADER__
  14700. #endif
  14701. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14702. #endif
  14703. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14704. /*** Start of inlined file: juce_ProgressBar.h ***/
  14705. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14706. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14707. class JUCE_API ProgressBar : public Component,
  14708. public SettableTooltipClient,
  14709. private Timer
  14710. {
  14711. public:
  14712. explicit ProgressBar (double& progress);
  14713. ~ProgressBar();
  14714. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14715. void setTextToDisplay (const String& text);
  14716. enum ColourIds
  14717. {
  14718. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14719. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14720. classes will probably use variations on this colour. */
  14721. };
  14722. juce_UseDebuggingNewOperator
  14723. protected:
  14724. void paint (Graphics& g);
  14725. void lookAndFeelChanged();
  14726. void visibilityChanged();
  14727. void colourChanged();
  14728. private:
  14729. double& progress;
  14730. double currentValue;
  14731. bool displayPercentage;
  14732. String displayedMessage, currentMessage;
  14733. uint32 lastCallbackTime;
  14734. void timerCallback();
  14735. ProgressBar (const ProgressBar&);
  14736. ProgressBar& operator= (const ProgressBar&);
  14737. };
  14738. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14739. /*** End of inlined file: juce_ProgressBar.h ***/
  14740. #endif
  14741. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14742. /*** Start of inlined file: juce_Slider.h ***/
  14743. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14744. #define __JUCE_SLIDER_JUCEHEADER__
  14745. /*** Start of inlined file: juce_SliderListener.h ***/
  14746. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14747. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14748. class Slider;
  14749. class JUCE_API SliderListener
  14750. {
  14751. public:
  14752. virtual ~SliderListener() {}
  14753. virtual void sliderValueChanged (Slider* slider) = 0;
  14754. virtual void sliderDragStarted (Slider* slider);
  14755. virtual void sliderDragEnded (Slider* slider);
  14756. };
  14757. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14758. /*** End of inlined file: juce_SliderListener.h ***/
  14759. class JUCE_API Slider : public Component,
  14760. public SettableTooltipClient,
  14761. private AsyncUpdater,
  14762. private ButtonListener,
  14763. private LabelListener,
  14764. private Value::Listener
  14765. {
  14766. public:
  14767. explicit Slider (const String& componentName);
  14768. ~Slider();
  14769. enum SliderStyle
  14770. {
  14771. LinearHorizontal, /**< A traditional horizontal slider. */
  14772. LinearVertical, /**< A traditional vertical slider. */
  14773. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14774. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14775. @see setRotaryParameters */
  14776. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14777. @see setRotaryParameters */
  14778. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14779. @see setRotaryParameters */
  14780. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14781. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14782. @see setMinValue, setMaxValue */
  14783. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14784. @see setMinValue, setMaxValue */
  14785. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14786. value, with the current value being somewhere between them.
  14787. @see setMinValue, setMaxValue */
  14788. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14789. value, with the current value being somewhere between them.
  14790. @see setMinValue, setMaxValue */
  14791. };
  14792. void setSliderStyle (SliderStyle newStyle);
  14793. SliderStyle getSliderStyle() const { return style; }
  14794. void setRotaryParameters (float startAngleRadians,
  14795. float endAngleRadians,
  14796. bool stopAtEnd);
  14797. void setMouseDragSensitivity (int distanceForFullScaleDrag);
  14798. void setVelocityBasedMode (bool isVelocityBased);
  14799. bool getVelocityBasedMode() const { return isVelocityBased; }
  14800. void setVelocityModeParameters (double sensitivity = 1.0,
  14801. int threshold = 1,
  14802. double offset = 0.0,
  14803. bool userCanPressKeyToSwapMode = true);
  14804. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14805. int getVelocityThreshold() const { return velocityModeThreshold; }
  14806. double getVelocityOffset() const { return velocityModeOffset; }
  14807. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14808. void setSkewFactor (double factor);
  14809. void setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint);
  14810. double getSkewFactor() const { return skewFactor; }
  14811. enum IncDecButtonMode
  14812. {
  14813. incDecButtonsNotDraggable,
  14814. incDecButtonsDraggable_AutoDirection,
  14815. incDecButtonsDraggable_Horizontal,
  14816. incDecButtonsDraggable_Vertical
  14817. };
  14818. void setIncDecButtonsMode (IncDecButtonMode mode);
  14819. enum TextEntryBoxPosition
  14820. {
  14821. NoTextBox, /**< Doesn't display a text box. */
  14822. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14823. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14824. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14825. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14826. };
  14827. void setTextBoxStyle (TextEntryBoxPosition newPosition,
  14828. bool isReadOnly,
  14829. int textEntryBoxWidth,
  14830. int textEntryBoxHeight);
  14831. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14832. int getTextBoxWidth() const { return textBoxWidth; }
  14833. int getTextBoxHeight() const { return textBoxHeight; }
  14834. void setTextBoxIsEditable (bool shouldBeEditable);
  14835. bool isTextBoxEditable() const { return editableText; }
  14836. void showTextBox();
  14837. void hideTextBox (bool discardCurrentEditorContents);
  14838. void setValue (double newValue,
  14839. bool sendUpdateMessage = true,
  14840. bool sendMessageSynchronously = false);
  14841. double getValue() const;
  14842. Value& getValueObject() { return currentValue; }
  14843. void setRange (double newMinimum,
  14844. double newMaximum,
  14845. double newInterval = 0);
  14846. double getMaximum() const { return maximum; }
  14847. double getMinimum() const { return minimum; }
  14848. double getInterval() const { return interval; }
  14849. double getMinValue() const;
  14850. Value& getMinValueObject() { return valueMin; }
  14851. void setMinValue (double newValue,
  14852. bool sendUpdateMessage = true,
  14853. bool sendMessageSynchronously = false,
  14854. bool allowNudgingOfOtherValues = false);
  14855. double getMaxValue() const;
  14856. Value& getMaxValueObject() { return valueMax; }
  14857. void setMaxValue (double newValue,
  14858. bool sendUpdateMessage = true,
  14859. bool sendMessageSynchronously = false,
  14860. bool allowNudgingOfOtherValues = false);
  14861. void addListener (SliderListener* listener);
  14862. void removeListener (SliderListener* listener);
  14863. void setDoubleClickReturnValue (bool isDoubleClickEnabled,
  14864. double valueToSetOnDoubleClick);
  14865. double getDoubleClickReturnValue (bool& isEnabled) const;
  14866. void setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease);
  14867. void setSliderSnapsToMousePosition (bool shouldSnapToMouse);
  14868. void setPopupDisplayEnabled (bool isEnabled,
  14869. Component* parentComponentToUse);
  14870. void setPopupMenuEnabled (bool menuEnabled);
  14871. void setScrollWheelEnabled (bool enabled);
  14872. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14873. virtual void startedDragging();
  14874. virtual void stoppedDragging();
  14875. virtual void valueChanged();
  14876. /** Callback to indicate that the user has just moved the slider.
  14877. Note - the valueChanged() method has changed its format and now no longer has
  14878. any parameters. Update your code to use the new version.
  14879. This version has been left here with an int as its return value to cause
  14880. a syntax error if you've got existing code that uses the old version.
  14881. */
  14882. virtual int valueChanged (double) { jassertfalse; return 0; }
  14883. virtual double getValueFromText (const String& text);
  14884. virtual const String getTextFromValue (double value);
  14885. void setTextValueSuffix (const String& suffix);
  14886. const String getTextValueSuffix() const;
  14887. virtual double proportionOfLengthToValue (double proportion);
  14888. virtual double valueToProportionOfLength (double value);
  14889. float getPositionOfValue (double value);
  14890. virtual double snapValue (double attemptedValue, bool userIsDragging);
  14891. void updateText();
  14892. bool isHorizontal() const;
  14893. bool isVertical() const;
  14894. enum ColourIds
  14895. {
  14896. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14897. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14898. and feel class how this is used. */
  14899. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14900. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14901. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14902. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14903. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14904. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14905. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14906. };
  14907. juce_UseDebuggingNewOperator
  14908. protected:
  14909. void labelTextChanged (Label*);
  14910. void paint (Graphics& g);
  14911. void resized();
  14912. void mouseDown (const MouseEvent& e);
  14913. void mouseUp (const MouseEvent& e);
  14914. void mouseDrag (const MouseEvent& e);
  14915. void mouseDoubleClick (const MouseEvent& e);
  14916. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14917. void modifierKeysChanged (const ModifierKeys& modifiers);
  14918. void buttonClicked (Button* button);
  14919. void lookAndFeelChanged();
  14920. void enablementChanged();
  14921. void focusOfChildComponentChanged (FocusChangeType cause);
  14922. void handleAsyncUpdate();
  14923. void colourChanged();
  14924. void valueChanged (Value& value);
  14925. int getNumDecimalPlacesToDisplay() const throw() { return numDecimalPlaces; }
  14926. private:
  14927. ListenerList <SliderListener> listeners;
  14928. Value currentValue, valueMin, valueMax;
  14929. double lastCurrentValue, lastValueMin, lastValueMax;
  14930. double minimum, maximum, interval, doubleClickReturnValue;
  14931. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14932. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14933. int velocityModeThreshold;
  14934. float rotaryStart, rotaryEnd;
  14935. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14936. int mouseDragStartX, mouseDragStartY;
  14937. int sliderRegionStart, sliderRegionSize;
  14938. int sliderBeingDragged;
  14939. int pixelsForFullDragExtent;
  14940. Rectangle<int> sliderRect;
  14941. String textSuffix;
  14942. SliderStyle style;
  14943. TextEntryBoxPosition textBoxPos;
  14944. int textBoxWidth, textBoxHeight;
  14945. IncDecButtonMode incDecButtonMode;
  14946. bool editableText : 1, doubleClickToValue : 1;
  14947. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14948. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14949. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14950. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14951. Label* valueBox;
  14952. Button* incButton;
  14953. Button* decButton;
  14954. ScopedPointer <Component> popupDisplay;
  14955. Component* parentForPopupDisplay;
  14956. float getLinearSliderPos (double value);
  14957. void restoreMouseIfHidden();
  14958. void sendDragStart();
  14959. void sendDragEnd();
  14960. double constrainedValue (double value) const;
  14961. void triggerChangeMessage (bool synchronous);
  14962. bool incDecDragDirectionIsHorizontal() const;
  14963. Slider (const Slider&);
  14964. Slider& operator= (const Slider&);
  14965. };
  14966. #endif // __JUCE_SLIDER_JUCEHEADER__
  14967. /*** End of inlined file: juce_Slider.h ***/
  14968. #endif
  14969. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14970. #endif
  14971. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14972. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14973. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14974. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14975. class TableHeaderComponent;
  14976. class JUCE_API TableHeaderListener
  14977. {
  14978. public:
  14979. TableHeaderListener() {}
  14980. virtual ~TableHeaderListener() {}
  14981. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14982. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14983. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14984. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14985. int columnIdNowBeingDragged);
  14986. };
  14987. class JUCE_API TableHeaderComponent : public Component,
  14988. private AsyncUpdater
  14989. {
  14990. public:
  14991. TableHeaderComponent();
  14992. ~TableHeaderComponent();
  14993. enum ColumnPropertyFlags
  14994. {
  14995. 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. */
  14996. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14997. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14998. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14999. 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. */
  15000. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  15001. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  15002. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  15003. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  15004. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  15005. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  15006. };
  15007. void addColumn (const String& columnName,
  15008. int columnId,
  15009. int width,
  15010. int minimumWidth = 30,
  15011. int maximumWidth = -1,
  15012. int propertyFlags = defaultFlags,
  15013. int insertIndex = -1);
  15014. void removeColumn (int columnIdToRemove);
  15015. void removeAllColumns();
  15016. int getNumColumns (bool onlyCountVisibleColumns) const;
  15017. const String getColumnName (int columnId) const;
  15018. void setColumnName (int columnId, const String& newName);
  15019. void moveColumn (int columnId, int newVisibleIndex);
  15020. int getColumnWidth (int columnId) const;
  15021. void setColumnWidth (int columnId, int newWidth);
  15022. void setColumnVisible (int columnId, bool shouldBeVisible);
  15023. bool isColumnVisible (int columnId) const;
  15024. void setSortColumnId (int columnId, bool sortForwards);
  15025. int getSortColumnId() const;
  15026. bool isSortedForwards() const;
  15027. void reSortTable();
  15028. int getTotalWidth() const;
  15029. int getIndexOfColumnId (int columnId, bool onlyCountVisibleColumns) const;
  15030. int getColumnIdOfIndex (int index, bool onlyCountVisibleColumns) const;
  15031. const Rectangle<int> getColumnPosition (int index) const;
  15032. int getColumnIdAtX (int xToFind) const;
  15033. void setStretchToFitActive (bool shouldStretchToFit);
  15034. bool isStretchToFitActive() const;
  15035. void resizeAllColumnsToFit (int targetTotalWidth);
  15036. void setPopupMenuActive (bool hasMenu);
  15037. bool isPopupMenuActive() const;
  15038. const String toString() const;
  15039. void restoreFromString (const String& storedVersion);
  15040. void addListener (TableHeaderListener* newListener);
  15041. void removeListener (TableHeaderListener* listenerToRemove);
  15042. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  15043. virtual void addMenuItems (PopupMenu& menu, int columnIdClicked);
  15044. virtual void reactToMenuItem (int menuReturnId, int columnIdClicked);
  15045. void paint (Graphics& g);
  15046. void resized();
  15047. void mouseMove (const MouseEvent&);
  15048. void mouseEnter (const MouseEvent&);
  15049. void mouseExit (const MouseEvent&);
  15050. void mouseDown (const MouseEvent&);
  15051. void mouseDrag (const MouseEvent&);
  15052. void mouseUp (const MouseEvent&);
  15053. const MouseCursor getMouseCursor();
  15054. virtual void showColumnChooserMenu (int columnIdClicked);
  15055. juce_UseDebuggingNewOperator
  15056. private:
  15057. struct ColumnInfo
  15058. {
  15059. String name;
  15060. int id, propertyFlags, width, minimumWidth, maximumWidth;
  15061. double lastDeliberateWidth;
  15062. bool isVisible() const;
  15063. };
  15064. OwnedArray <ColumnInfo> columns;
  15065. Array <TableHeaderListener*> listeners;
  15066. ScopedPointer <Component> dragOverlayComp;
  15067. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  15068. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  15069. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  15070. ColumnInfo* getInfoForId (int columnId) const;
  15071. int visibleIndexToTotalIndex (int visibleIndex) const;
  15072. void sendColumnsChanged();
  15073. void handleAsyncUpdate();
  15074. void beginDrag (const MouseEvent&);
  15075. void endDrag (int finalIndex);
  15076. int getResizeDraggerAt (int mouseX) const;
  15077. void updateColumnUnderMouse (int x, int y);
  15078. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  15079. TableHeaderComponent (const TableHeaderComponent&);
  15080. TableHeaderComponent operator= (const TableHeaderComponent&);
  15081. };
  15082. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  15083. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  15084. #endif
  15085. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  15086. /*** Start of inlined file: juce_TableListBox.h ***/
  15087. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  15088. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  15089. class JUCE_API TableListBoxModel
  15090. {
  15091. public:
  15092. TableListBoxModel() {}
  15093. virtual ~TableListBoxModel() {}
  15094. virtual int getNumRows() = 0;
  15095. virtual void paintRowBackground (Graphics& g,
  15096. int rowNumber,
  15097. int width, int height,
  15098. bool rowIsSelected) = 0;
  15099. virtual void paintCell (Graphics& g,
  15100. int rowNumber,
  15101. int columnId,
  15102. int width, int height,
  15103. bool rowIsSelected) = 0;
  15104. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  15105. Component* existingComponentToUpdate);
  15106. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  15107. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  15108. virtual void backgroundClicked();
  15109. virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
  15110. virtual int getColumnAutoSizeWidth (int columnId);
  15111. virtual const String getCellTooltip (int rowNumber, int columnId);
  15112. virtual void selectedRowsChanged (int lastRowSelected);
  15113. virtual void deleteKeyPressed (int lastRowSelected);
  15114. virtual void returnKeyPressed (int lastRowSelected);
  15115. virtual void listWasScrolled();
  15116. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  15117. };
  15118. class JUCE_API TableListBox : public ListBox,
  15119. private ListBoxModel,
  15120. private TableHeaderListener
  15121. {
  15122. public:
  15123. TableListBox (const String& componentName,
  15124. TableListBoxModel* model);
  15125. ~TableListBox();
  15126. void setModel (TableListBoxModel* newModel);
  15127. TableListBoxModel* getModel() const { return model; }
  15128. TableHeaderComponent* getHeader() const { return header; }
  15129. void setHeaderHeight (int newHeight);
  15130. int getHeaderHeight() const;
  15131. void autoSizeColumn (int columnId);
  15132. void autoSizeAllColumns();
  15133. void setAutoSizeMenuOptionShown (bool shouldBeShown);
  15134. bool isAutoSizeMenuOptionShown() const;
  15135. const Rectangle<int> getCellPosition (int columnId,
  15136. int rowNumber,
  15137. bool relativeToComponentTopLeft) const;
  15138. void scrollToEnsureColumnIsOnscreen (int columnId);
  15139. int getNumRows();
  15140. void paintListBoxItem (int, Graphics&, int, int, bool);
  15141. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15142. void selectedRowsChanged (int lastRowSelected);
  15143. void deleteKeyPressed (int currentSelectedRow);
  15144. void returnKeyPressed (int currentSelectedRow);
  15145. void backgroundClicked();
  15146. void listWasScrolled();
  15147. void tableColumnsChanged (TableHeaderComponent*);
  15148. void tableColumnsResized (TableHeaderComponent*);
  15149. void tableSortOrderChanged (TableHeaderComponent*);
  15150. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  15151. void resized();
  15152. juce_UseDebuggingNewOperator
  15153. private:
  15154. TableHeaderComponent* header;
  15155. TableListBoxModel* model;
  15156. int columnIdNowBeingDragged;
  15157. bool autoSizeOptionsShown;
  15158. void updateColumnComponents() const;
  15159. TableListBox (const TableListBox&);
  15160. TableListBox& operator= (const TableListBox&);
  15161. };
  15162. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  15163. /*** End of inlined file: juce_TableListBox.h ***/
  15164. #endif
  15165. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  15166. #endif
  15167. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  15168. #endif
  15169. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  15170. #endif
  15171. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15172. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  15173. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15174. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15175. class JUCE_API ToolbarItemFactory
  15176. {
  15177. public:
  15178. ToolbarItemFactory();
  15179. virtual ~ToolbarItemFactory();
  15180. enum SpecialItemIds
  15181. {
  15182. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  15183. can be placed between sets of items to break them into groups. */
  15184. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  15185. items.*/
  15186. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  15187. either side of it, filling any available space. */
  15188. };
  15189. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  15190. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  15191. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  15192. };
  15193. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15194. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  15195. #endif
  15196. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15197. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15198. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15199. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15200. class JUCE_API ToolbarItemPalette : public Component,
  15201. public DragAndDropContainer
  15202. {
  15203. public:
  15204. ToolbarItemPalette (ToolbarItemFactory& factory,
  15205. Toolbar* toolbar);
  15206. ~ToolbarItemPalette();
  15207. void resized();
  15208. juce_UseDebuggingNewOperator
  15209. private:
  15210. ToolbarItemFactory& factory;
  15211. Toolbar* toolbar;
  15212. Viewport* viewport;
  15213. friend class Toolbar;
  15214. void replaceComponent (ToolbarItemComponent* comp);
  15215. ToolbarItemPalette (const ToolbarItemPalette&);
  15216. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15217. };
  15218. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15219. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15220. #endif
  15221. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15222. /*** Start of inlined file: juce_TreeView.h ***/
  15223. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15224. #define __JUCE_TREEVIEW_JUCEHEADER__
  15225. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15226. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15227. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15228. class JUCE_API FileDragAndDropTarget
  15229. {
  15230. public:
  15231. virtual ~FileDragAndDropTarget() {}
  15232. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15233. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15234. virtual void fileDragMove (const StringArray& files, int x, int y);
  15235. virtual void fileDragExit (const StringArray& files);
  15236. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15237. };
  15238. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15239. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15240. class TreeView;
  15241. class JUCE_API TreeViewItem
  15242. {
  15243. public:
  15244. TreeViewItem();
  15245. virtual ~TreeViewItem();
  15246. int getNumSubItems() const throw();
  15247. TreeViewItem* getSubItem (int index) const throw();
  15248. void clearSubItems();
  15249. void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
  15250. void removeSubItem (int index, bool deleteItem = true);
  15251. TreeView* getOwnerView() const throw() { return ownerView; }
  15252. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15253. bool isOpen() const throw();
  15254. void setOpen (bool shouldBeOpen);
  15255. bool isSelected() const throw();
  15256. void setSelected (bool shouldBeSelected,
  15257. bool deselectOtherItemsFirst);
  15258. const Rectangle<int> getItemPosition (bool relativeToTreeViewTopLeft) const throw();
  15259. void treeHasChanged() const throw();
  15260. void repaintItem() const;
  15261. int getRowNumberInTree() const throw();
  15262. bool areAllParentsOpen() const throw();
  15263. void setLinesDrawnForSubItems (bool shouldDrawLines) throw();
  15264. virtual bool mightContainSubItems() = 0;
  15265. virtual const String getUniqueName() const;
  15266. virtual void itemOpennessChanged (bool isNowOpen);
  15267. virtual int getItemWidth() const { return -1; }
  15268. virtual int getItemHeight() const { return 20; }
  15269. virtual bool canBeSelected() const { return true; }
  15270. virtual Component* createItemComponent() { return 0; }
  15271. virtual void paintItem (Graphics& g, int width, int height);
  15272. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15273. virtual void itemClicked (const MouseEvent& e);
  15274. virtual void itemDoubleClicked (const MouseEvent& e);
  15275. virtual void itemSelectionChanged (bool isNowSelected);
  15276. virtual const String getTooltip();
  15277. virtual const String getDragSourceDescription();
  15278. virtual bool isInterestedInFileDrag (const StringArray& files);
  15279. virtual void filesDropped (const StringArray& files, int insertIndex);
  15280. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15281. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15282. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15283. XmlElement* getOpennessState() const throw();
  15284. void restoreOpennessState (const XmlElement& xml) throw();
  15285. int getIndexInParent() const throw();
  15286. bool isLastOfSiblings() const throw();
  15287. const String getItemIdentifierString() const;
  15288. juce_UseDebuggingNewOperator
  15289. private:
  15290. TreeView* ownerView;
  15291. TreeViewItem* parentItem;
  15292. OwnedArray <TreeViewItem> subItems;
  15293. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15294. int uid;
  15295. bool selected : 1;
  15296. bool redrawNeeded : 1;
  15297. bool drawLinesInside : 1;
  15298. bool drawsInLeftMargin : 1;
  15299. unsigned int openness : 2;
  15300. friend class TreeView;
  15301. friend class TreeViewContentComponent;
  15302. void updatePositions (int newY);
  15303. int getIndentX() const throw();
  15304. void setOwnerView (TreeView* newOwner) throw();
  15305. void paintRecursively (Graphics& g, int width);
  15306. TreeViewItem* getTopLevelItem() throw();
  15307. TreeViewItem* findItemRecursively (int y) throw();
  15308. TreeViewItem* getDeepestOpenParentItem() throw();
  15309. int getNumRows() const throw();
  15310. TreeViewItem* getItemOnRow (int index) throw();
  15311. void deselectAllRecursively();
  15312. int countSelectedItemsRecursively() const throw();
  15313. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15314. TreeViewItem* getNextVisibleItem (bool recurse) const throw();
  15315. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15316. TreeViewItem (const TreeViewItem&);
  15317. TreeViewItem& operator= (const TreeViewItem&);
  15318. };
  15319. class JUCE_API TreeView : public Component,
  15320. public SettableTooltipClient,
  15321. public FileDragAndDropTarget,
  15322. public DragAndDropTarget,
  15323. private AsyncUpdater
  15324. {
  15325. public:
  15326. TreeView (const String& componentName = String::empty);
  15327. ~TreeView();
  15328. void setRootItem (TreeViewItem* newRootItem);
  15329. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15330. void deleteRootItem();
  15331. void setRootItemVisible (bool shouldBeVisible);
  15332. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15333. void setDefaultOpenness (bool isOpenByDefault);
  15334. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15335. void setMultiSelectEnabled (bool canMultiSelect);
  15336. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15337. void setOpenCloseButtonsVisible (bool shouldBeVisible);
  15338. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15339. void clearSelectedItems();
  15340. int getNumSelectedItems() const throw();
  15341. TreeViewItem* getSelectedItem (int index) const throw();
  15342. int getNumRowsInTree() const;
  15343. TreeViewItem* getItemOnRow (int index) const;
  15344. TreeViewItem* getItemAt (int yPosition) const throw();
  15345. void scrollToKeepItemVisible (TreeViewItem* item);
  15346. Viewport* getViewport() const throw();
  15347. int getIndentSize() const throw() { return indentSize; }
  15348. void setIndentSize (int newIndentSize);
  15349. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15350. XmlElement* getOpennessState (bool alsoIncludeScrollPosition) const;
  15351. void restoreOpennessState (const XmlElement& newState);
  15352. enum ColourIds
  15353. {
  15354. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15355. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15356. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15357. };
  15358. void paint (Graphics& g);
  15359. void resized();
  15360. bool keyPressed (const KeyPress& key);
  15361. void colourChanged();
  15362. void enablementChanged();
  15363. bool isInterestedInFileDrag (const StringArray& files);
  15364. void fileDragEnter (const StringArray& files, int x, int y);
  15365. void fileDragMove (const StringArray& files, int x, int y);
  15366. void fileDragExit (const StringArray& files);
  15367. void filesDropped (const StringArray& files, int x, int y);
  15368. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15369. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15370. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15371. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15372. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15373. juce_UseDebuggingNewOperator
  15374. private:
  15375. friend class TreeViewItem;
  15376. friend class TreeViewContentComponent;
  15377. class TreeViewport;
  15378. TreeViewport* viewport;
  15379. CriticalSection nodeAlterationLock;
  15380. TreeViewItem* rootItem;
  15381. class InsertPointHighlight;
  15382. class TargetGroupHighlight;
  15383. InsertPointHighlight* dragInsertPointHighlight;
  15384. TargetGroupHighlight* dragTargetGroupHighlight;
  15385. int indentSize;
  15386. bool defaultOpenness : 1;
  15387. bool needsRecalculating : 1;
  15388. bool rootItemVisible : 1;
  15389. bool multiSelectEnabled : 1;
  15390. bool openCloseButtonsVisible : 1;
  15391. void itemsChanged() throw();
  15392. void handleAsyncUpdate();
  15393. void moveSelectedRow (int delta);
  15394. void updateButtonUnderMouse (const MouseEvent& e);
  15395. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15396. void hideDragHighlight() throw();
  15397. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15398. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15399. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15400. const StringArray& files, const String& sourceDescription,
  15401. Component* sourceComponent) const throw();
  15402. TreeView (const TreeView&);
  15403. TreeView& operator= (const TreeView&);
  15404. };
  15405. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15406. /*** End of inlined file: juce_TreeView.h ***/
  15407. #endif
  15408. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15409. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15410. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15411. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15412. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15413. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15414. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15415. /*** Start of inlined file: juce_FileFilter.h ***/
  15416. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15417. #define __JUCE_FILEFILTER_JUCEHEADER__
  15418. class JUCE_API FileFilter
  15419. {
  15420. public:
  15421. FileFilter (const String& filterDescription);
  15422. virtual ~FileFilter();
  15423. const String& getDescription() const throw();
  15424. virtual bool isFileSuitable (const File& file) const = 0;
  15425. virtual bool isDirectorySuitable (const File& file) const = 0;
  15426. protected:
  15427. String description;
  15428. };
  15429. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15430. /*** End of inlined file: juce_FileFilter.h ***/
  15431. /*** Start of inlined file: juce_Image.h ***/
  15432. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15433. #define __JUCE_IMAGE_JUCEHEADER__
  15434. class JUCE_API Image
  15435. {
  15436. public:
  15437. enum PixelFormat
  15438. {
  15439. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15440. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15441. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15442. };
  15443. Image (PixelFormat format,
  15444. int imageWidth,
  15445. int imageHeight,
  15446. bool clearImage);
  15447. Image (const Image& other);
  15448. virtual ~Image();
  15449. static Image* createNativeImage (PixelFormat format,
  15450. int imageWidth,
  15451. int imageHeight,
  15452. bool clearImage);
  15453. int getWidth() const throw() { return imageWidth; }
  15454. int getHeight() const throw() { return imageHeight; }
  15455. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15456. PixelFormat getFormat() const throw() { return format; }
  15457. bool isARGB() const throw() { return format == ARGB; }
  15458. bool isRGB() const throw() { return format == RGB; }
  15459. bool hasAlphaChannel() const throw() { return format != RGB; }
  15460. virtual void clear (int x, int y, int w, int h,
  15461. const Colour& colourToClearTo = Colour (0x00000000));
  15462. virtual Image* createCopy (int newWidth = -1,
  15463. int newHeight = -1,
  15464. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15465. virtual Image* createCopyOfAlphaChannel() const;
  15466. virtual const Colour getPixelAt (int x, int y) const;
  15467. virtual void setPixelAt (int x, int y, const Colour& colour);
  15468. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15469. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15470. virtual void desaturate();
  15471. class BitmapData
  15472. {
  15473. public:
  15474. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15475. BitmapData (const Image& image, int x, int y, int w, int h);
  15476. ~BitmapData();
  15477. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15478. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15479. uint8* data;
  15480. int lineStride, pixelStride, width, height;
  15481. private:
  15482. BitmapData (const BitmapData&);
  15483. BitmapData& operator= (const BitmapData&);
  15484. };
  15485. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15486. const uint8* sourcePixelData, int sourceLineStride);
  15487. virtual void moveImageSection (int destX, int destY,
  15488. int sourceX, int sourceY,
  15489. int width, int height);
  15490. void createSolidAreaMask (RectangleList& result,
  15491. float alphaThreshold = 0.5f) const;
  15492. juce_UseDebuggingNewOperator
  15493. virtual LowLevelGraphicsContext* createLowLevelContext();
  15494. protected:
  15495. friend class BitmapData;
  15496. const PixelFormat format;
  15497. const int imageWidth, imageHeight;
  15498. Image (PixelFormat format,
  15499. int imageWidth,
  15500. int imageHeight);
  15501. int pixelStride, lineStride;
  15502. HeapBlock <uint8> imageDataAllocated;
  15503. uint8* imageData;
  15504. private:
  15505. Image& operator= (const Image&);
  15506. };
  15507. #endif // __JUCE_IMAGE_JUCEHEADER__
  15508. /*** End of inlined file: juce_Image.h ***/
  15509. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15510. public TimeSliceClient
  15511. {
  15512. public:
  15513. DirectoryContentsList (const FileFilter* fileFilter,
  15514. TimeSliceThread& threadToUse);
  15515. ~DirectoryContentsList();
  15516. void setDirectory (const File& directory,
  15517. bool includeDirectories,
  15518. bool includeFiles);
  15519. const File& getDirectory() const;
  15520. void clear();
  15521. void refresh();
  15522. bool isStillLoading() const;
  15523. void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
  15524. bool ignoresHiddenFiles() const;
  15525. struct FileInfo
  15526. {
  15527. String filename;
  15528. int64 fileSize;
  15529. Time modificationTime;
  15530. Time creationTime;
  15531. bool isDirectory;
  15532. bool isReadOnly;
  15533. };
  15534. int getNumFiles() const;
  15535. bool getFileInfo (int index, FileInfo& resultInfo) const;
  15536. const File getFile (int index) const;
  15537. const FileFilter* getFilter() const { return fileFilter; }
  15538. bool useTimeSlice();
  15539. TimeSliceThread& getTimeSliceThread() { return thread; }
  15540. static int compareElements (const DirectoryContentsList::FileInfo* first,
  15541. const DirectoryContentsList::FileInfo* second);
  15542. juce_UseDebuggingNewOperator
  15543. private:
  15544. File root;
  15545. const FileFilter* fileFilter;
  15546. TimeSliceThread& thread;
  15547. int fileTypeFlags;
  15548. CriticalSection fileListLock;
  15549. OwnedArray <FileInfo> files;
  15550. ScopedPointer <DirectoryIterator> fileFindHandle;
  15551. bool volatile shouldStop;
  15552. void changed();
  15553. bool checkNextFile (bool& hasChanged);
  15554. bool addFile (const File& file, bool isDir,
  15555. const int64 fileSize, const Time& modTime,
  15556. const Time& creationTime, bool isReadOnly);
  15557. void setTypeFlags (int newFlags);
  15558. DirectoryContentsList (const DirectoryContentsList&);
  15559. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15560. };
  15561. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15562. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15563. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15564. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15565. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15566. class JUCE_API FileBrowserListener
  15567. {
  15568. public:
  15569. virtual ~FileBrowserListener();
  15570. virtual void selectionChanged() = 0;
  15571. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15572. virtual void fileDoubleClicked (const File& file) = 0;
  15573. };
  15574. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15575. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15576. class JUCE_API DirectoryContentsDisplayComponent
  15577. {
  15578. public:
  15579. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15580. virtual ~DirectoryContentsDisplayComponent();
  15581. virtual int getNumSelectedFiles() const = 0;
  15582. virtual const File getSelectedFile (int index) const = 0;
  15583. virtual void scrollToTop() = 0;
  15584. void addListener (FileBrowserListener* listener);
  15585. void removeListener (FileBrowserListener* listener);
  15586. enum ColourIds
  15587. {
  15588. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15589. textColourId = 0x1000541, /**< The colour for the text. */
  15590. };
  15591. void sendSelectionChangeMessage();
  15592. void sendDoubleClickMessage (const File& file);
  15593. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15594. juce_UseDebuggingNewOperator
  15595. protected:
  15596. DirectoryContentsList& fileList;
  15597. ListenerList <FileBrowserListener> listeners;
  15598. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15599. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15600. };
  15601. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15602. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15603. #endif
  15604. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15605. #endif
  15606. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15607. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15608. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15609. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15610. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15611. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15612. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15613. class JUCE_API FilePreviewComponent : public Component
  15614. {
  15615. public:
  15616. FilePreviewComponent();
  15617. ~FilePreviewComponent();
  15618. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15619. juce_UseDebuggingNewOperator
  15620. private:
  15621. FilePreviewComponent (const FilePreviewComponent&);
  15622. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15623. };
  15624. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15625. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15626. class JUCE_API FileBrowserComponent : public Component,
  15627. public ChangeBroadcaster,
  15628. private FileBrowserListener,
  15629. private TextEditorListener,
  15630. private ButtonListener,
  15631. private ComboBoxListener,
  15632. private FileFilter
  15633. {
  15634. public:
  15635. enum FileChooserFlags
  15636. {
  15637. openMode = 1, /**< specifies that the component should allow the user to
  15638. choose an existing file with the intention of opening it. */
  15639. saveMode = 2, /**< specifies that the component should allow the user to specify
  15640. the name of a file that will be used to save something. */
  15641. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15642. conjunction with canSelectDirectories). */
  15643. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15644. conjuction with canSelectFiles). */
  15645. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15646. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15647. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15648. };
  15649. FileBrowserComponent (int flags,
  15650. const File& initialFileOrDirectory,
  15651. const FileFilter* fileFilter,
  15652. FilePreviewComponent* previewComp);
  15653. ~FileBrowserComponent();
  15654. int getNumSelectedFiles() const throw();
  15655. const File getSelectedFile (int index) const throw();
  15656. bool currentFileIsValid() const;
  15657. const File getHighlightedFile() const throw();
  15658. const File getRoot() const;
  15659. void setRoot (const File& newRootDirectory);
  15660. void goUp();
  15661. void refresh();
  15662. virtual const String getActionVerb() const;
  15663. bool isSaveMode() const throw();
  15664. void addListener (FileBrowserListener* listener);
  15665. void removeListener (FileBrowserListener* listener);
  15666. void resized();
  15667. void buttonClicked (Button* b);
  15668. void comboBoxChanged (ComboBox*);
  15669. void textEditorTextChanged (TextEditor& editor);
  15670. void textEditorReturnKeyPressed (TextEditor& editor);
  15671. void textEditorEscapeKeyPressed (TextEditor& editor);
  15672. void textEditorFocusLost (TextEditor& editor);
  15673. bool keyPressed (const KeyPress& key);
  15674. void selectionChanged();
  15675. void fileClicked (const File& f, const MouseEvent& e);
  15676. void fileDoubleClicked (const File& f);
  15677. bool isFileSuitable (const File& file) const;
  15678. bool isDirectorySuitable (const File&) const;
  15679. FilePreviewComponent* getPreviewComponent() const throw();
  15680. juce_UseDebuggingNewOperator
  15681. protected:
  15682. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15683. private:
  15684. ScopedPointer <DirectoryContentsList> fileList;
  15685. const FileFilter* fileFilter;
  15686. int flags;
  15687. File currentRoot;
  15688. Array<File> chosenFiles;
  15689. ListenerList <FileBrowserListener> listeners;
  15690. DirectoryContentsDisplayComponent* fileListComponent;
  15691. FilePreviewComponent* previewComp;
  15692. ComboBox* currentPathBox;
  15693. TextEditor* filenameBox;
  15694. Button* goUpButton;
  15695. TimeSliceThread thread;
  15696. void sendListenerChangeMessage();
  15697. bool isFileOrDirSuitable (const File& f) const;
  15698. FileBrowserComponent (const FileBrowserComponent&);
  15699. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15700. };
  15701. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15702. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15703. #endif
  15704. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15705. #endif
  15706. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15707. /*** Start of inlined file: juce_FileChooser.h ***/
  15708. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15709. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15710. class JUCE_API FileChooser
  15711. {
  15712. public:
  15713. FileChooser (const String& dialogBoxTitle,
  15714. const File& initialFileOrDirectory = File::nonexistent,
  15715. const String& filePatternsAllowed = String::empty,
  15716. bool useOSNativeDialogBox = true);
  15717. ~FileChooser();
  15718. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15719. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15720. bool browseForFileToSave (bool warnAboutOverwritingExistingFiles);
  15721. bool browseForDirectory();
  15722. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15723. const File getResult() const;
  15724. const Array<File>& getResults() const;
  15725. juce_UseDebuggingNewOperator
  15726. private:
  15727. String title, filters;
  15728. File startingFile;
  15729. Array<File> results;
  15730. bool useNativeDialogBox;
  15731. bool showDialog (bool selectsDirectories, bool selectsFiles, bool isSave,
  15732. bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15733. FilePreviewComponent* previewComponent);
  15734. static void showPlatformDialog (Array<File>& results, const String& title, const File& file,
  15735. const String& filters, bool selectsDirectories, bool selectsFiles,
  15736. bool isSave, bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15737. FilePreviewComponent* previewComponent);
  15738. };
  15739. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15740. /*** End of inlined file: juce_FileChooser.h ***/
  15741. #endif
  15742. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15743. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15744. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15745. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15746. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15747. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15748. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15749. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15750. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15751. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15752. /*** Start of inlined file: juce_DropShadower.h ***/
  15753. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15754. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15755. class JUCE_API DropShadower : public ComponentListener
  15756. {
  15757. public:
  15758. DropShadower (float alpha = 0.5f,
  15759. int xOffset = 1,
  15760. int yOffset = 5,
  15761. float blurRadius = 10.0f);
  15762. virtual ~DropShadower();
  15763. void setOwner (Component* componentToFollow);
  15764. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15765. void componentBroughtToFront (Component& component);
  15766. void componentChildrenChanged (Component& component);
  15767. void componentParentHierarchyChanged (Component& component);
  15768. void componentVisibilityChanged (Component& component);
  15769. juce_UseDebuggingNewOperator
  15770. private:
  15771. Component* owner;
  15772. int numShadows;
  15773. Component* shadowWindows[4];
  15774. Image* shadowImageSections[12];
  15775. const int shadowEdge, xOffset, yOffset;
  15776. const float alpha, blurRadius;
  15777. bool inDestructor, reentrant;
  15778. void updateShadows();
  15779. void setShadowImage (Image* const src,
  15780. const int num,
  15781. const int w, const int h,
  15782. const int sx, const int sy);
  15783. void bringShadowWindowsToFront();
  15784. void deleteShadowWindows();
  15785. DropShadower (const DropShadower&);
  15786. DropShadower& operator= (const DropShadower&);
  15787. };
  15788. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15789. /*** End of inlined file: juce_DropShadower.h ***/
  15790. class JUCE_API TopLevelWindow : public Component
  15791. {
  15792. public:
  15793. TopLevelWindow (const String& name, bool addToDesktop);
  15794. ~TopLevelWindow();
  15795. bool isActiveWindow() const throw() { return windowIsActive_; }
  15796. void centreAroundComponent (Component* componentToCentreAround,
  15797. int width, int height);
  15798. void setDropShadowEnabled (bool useShadow);
  15799. void setUsingNativeTitleBar (bool useNativeTitleBar);
  15800. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15801. static int getNumTopLevelWindows() throw();
  15802. static TopLevelWindow* getTopLevelWindow (int index) throw();
  15803. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15804. juce_UseDebuggingNewOperator
  15805. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15806. protected:
  15807. virtual void activeWindowStatusChanged();
  15808. void focusOfChildComponentChanged (FocusChangeType cause);
  15809. void parentHierarchyChanged();
  15810. void visibilityChanged();
  15811. virtual int getDesktopWindowStyleFlags() const;
  15812. void recreateDesktopWindow();
  15813. private:
  15814. friend class TopLevelWindowManager;
  15815. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15816. ScopedPointer <DropShadower> shadower;
  15817. void setWindowActive (bool isNowActive);
  15818. TopLevelWindow (const TopLevelWindow&);
  15819. TopLevelWindow& operator= (const TopLevelWindow&);
  15820. };
  15821. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15822. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15823. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15824. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15825. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15826. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15827. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15828. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15829. class JUCE_API ComponentBoundsConstrainer
  15830. {
  15831. public:
  15832. ComponentBoundsConstrainer() throw();
  15833. virtual ~ComponentBoundsConstrainer();
  15834. void setMinimumWidth (int minimumWidth) throw();
  15835. int getMinimumWidth() const throw() { return minW; }
  15836. void setMaximumWidth (int maximumWidth) throw();
  15837. int getMaximumWidth() const throw() { return maxW; }
  15838. void setMinimumHeight (int minimumHeight) throw();
  15839. int getMinimumHeight() const throw() { return minH; }
  15840. void setMaximumHeight (int maximumHeight) throw();
  15841. int getMaximumHeight() const throw() { return maxH; }
  15842. void setMinimumSize (int minimumWidth,
  15843. int minimumHeight) throw();
  15844. void setMaximumSize (int maximumWidth,
  15845. int maximumHeight) throw();
  15846. void setSizeLimits (int minimumWidth,
  15847. int minimumHeight,
  15848. int maximumWidth,
  15849. int maximumHeight) throw();
  15850. void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
  15851. int minimumWhenOffTheLeft,
  15852. int minimumWhenOffTheBottom,
  15853. int minimumWhenOffTheRight) throw();
  15854. void setFixedAspectRatio (double widthOverHeight) throw();
  15855. double getFixedAspectRatio() const throw();
  15856. virtual void checkBounds (Rectangle<int>& bounds,
  15857. const Rectangle<int>& previousBounds,
  15858. const Rectangle<int>& limits,
  15859. bool isStretchingTop,
  15860. bool isStretchingLeft,
  15861. bool isStretchingBottom,
  15862. bool isStretchingRight);
  15863. virtual void resizeStart();
  15864. virtual void resizeEnd();
  15865. void setBoundsForComponent (Component* const component,
  15866. const Rectangle<int>& bounds,
  15867. bool isStretchingTop,
  15868. bool isStretchingLeft,
  15869. bool isStretchingBottom,
  15870. bool isStretchingRight);
  15871. void checkComponentBounds (Component* component);
  15872. virtual void applyBoundsToComponent (Component* component,
  15873. const Rectangle<int>& bounds);
  15874. juce_UseDebuggingNewOperator
  15875. private:
  15876. int minW, maxW, minH, maxH;
  15877. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15878. double aspectRatio;
  15879. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15880. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15881. };
  15882. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15883. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15884. class JUCE_API ComponentDragger
  15885. {
  15886. public:
  15887. ComponentDragger();
  15888. virtual ~ComponentDragger();
  15889. void startDraggingComponent (Component* const componentToDrag,
  15890. ComponentBoundsConstrainer* constrainer);
  15891. void dragComponent (Component* const componentToDrag,
  15892. const MouseEvent& e);
  15893. juce_UseDebuggingNewOperator
  15894. private:
  15895. ComponentBoundsConstrainer* constrainer;
  15896. Point<int> originalPos;
  15897. ComponentDragger (const ComponentDragger&);
  15898. ComponentDragger& operator= (const ComponentDragger&);
  15899. };
  15900. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15901. /*** End of inlined file: juce_ComponentDragger.h ***/
  15902. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15903. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15904. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15905. class JUCE_API ResizableBorderComponent : public Component
  15906. {
  15907. public:
  15908. ResizableBorderComponent (Component* componentToResize,
  15909. ComponentBoundsConstrainer* constrainer);
  15910. ~ResizableBorderComponent();
  15911. void setBorderThickness (const BorderSize& newBorderSize);
  15912. const BorderSize getBorderThickness() const;
  15913. class Zone
  15914. {
  15915. public:
  15916. enum Zones
  15917. {
  15918. centre = 0,
  15919. left = 1,
  15920. top = 2,
  15921. right = 4,
  15922. bottom = 8
  15923. };
  15924. explicit Zone (int zoneFlags = 0) throw();
  15925. Zone (const Zone& other) throw();
  15926. Zone& operator= (const Zone& other) throw();
  15927. bool operator== (const Zone& other) const throw();
  15928. bool operator!= (const Zone& other) const throw();
  15929. static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
  15930. const BorderSize& border,
  15931. const Point<int>& position);
  15932. const MouseCursor getMouseCursor() const throw();
  15933. bool isDraggingWholeObject() const throw() { return zone == centre; }
  15934. bool isDraggingLeftEdge() const throw() { return (zone & left) != 0; }
  15935. bool isDraggingRightEdge() const throw() { return (zone & right) != 0; }
  15936. bool isDraggingTopEdge() const throw() { return (zone & top) != 0; }
  15937. bool isDraggingBottomEdge() const throw() { return (zone & bottom) != 0; }
  15938. const Rectangle<int> resizeRectangleBy (Rectangle<int> original,
  15939. const Point<int>& distance) const throw();
  15940. int getZoneFlags() const throw() { return zone; }
  15941. private:
  15942. int zone;
  15943. };
  15944. juce_UseDebuggingNewOperator
  15945. protected:
  15946. void paint (Graphics& g);
  15947. void mouseEnter (const MouseEvent& e);
  15948. void mouseMove (const MouseEvent& e);
  15949. void mouseDown (const MouseEvent& e);
  15950. void mouseDrag (const MouseEvent& e);
  15951. void mouseUp (const MouseEvent& e);
  15952. bool hitTest (int x, int y);
  15953. private:
  15954. Component::SafePointer<Component> component;
  15955. ComponentBoundsConstrainer* constrainer;
  15956. BorderSize borderSize;
  15957. Rectangle<int> originalBounds;
  15958. Zone mouseZone;
  15959. void updateMouseZone (const MouseEvent& e);
  15960. ResizableBorderComponent (const ResizableBorderComponent&);
  15961. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15962. };
  15963. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15964. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15965. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15966. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15967. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15968. class JUCE_API ResizableCornerComponent : public Component
  15969. {
  15970. public:
  15971. ResizableCornerComponent (Component* componentToResize,
  15972. ComponentBoundsConstrainer* constrainer);
  15973. ~ResizableCornerComponent();
  15974. juce_UseDebuggingNewOperator
  15975. protected:
  15976. void paint (Graphics& g);
  15977. void mouseDown (const MouseEvent& e);
  15978. void mouseDrag (const MouseEvent& e);
  15979. void mouseUp (const MouseEvent& e);
  15980. bool hitTest (int x, int y);
  15981. private:
  15982. Component::SafePointer<Component> component;
  15983. ComponentBoundsConstrainer* constrainer;
  15984. Rectangle<int> originalBounds;
  15985. ResizableCornerComponent (const ResizableCornerComponent&);
  15986. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15987. };
  15988. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15989. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15990. class JUCE_API ResizableWindow : public TopLevelWindow
  15991. {
  15992. public:
  15993. ResizableWindow (const String& name,
  15994. bool addToDesktop);
  15995. ResizableWindow (const String& name,
  15996. const Colour& backgroundColour,
  15997. bool addToDesktop);
  15998. ~ResizableWindow();
  15999. const Colour getBackgroundColour() const throw();
  16000. void setBackgroundColour (const Colour& newColour);
  16001. void setResizable (bool shouldBeResizable,
  16002. bool useBottomRightCornerResizer);
  16003. bool isResizable() const throw();
  16004. void setResizeLimits (int newMinimumWidth,
  16005. int newMinimumHeight,
  16006. int newMaximumWidth,
  16007. int newMaximumHeight) throw();
  16008. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  16009. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  16010. void setBoundsConstrained (const Rectangle<int>& bounds);
  16011. bool isFullScreen() const;
  16012. void setFullScreen (bool shouldBeFullScreen);
  16013. bool isMinimised() const;
  16014. void setMinimised (bool shouldMinimise);
  16015. const String getWindowStateAsString();
  16016. bool restoreWindowStateFromString (const String& previousState);
  16017. Component* getContentComponent() const throw() { return contentComponent; }
  16018. void setContentComponent (Component* newContentComponent,
  16019. bool deleteOldOne = true,
  16020. bool resizeToFit = false);
  16021. void setContentComponentSize (int width, int height);
  16022. enum ColourIds
  16023. {
  16024. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  16025. };
  16026. juce_UseDebuggingNewOperator
  16027. protected:
  16028. void paint (Graphics& g);
  16029. void moved();
  16030. void resized();
  16031. void mouseDown (const MouseEvent& e);
  16032. void mouseDrag (const MouseEvent& e);
  16033. void lookAndFeelChanged();
  16034. void childBoundsChanged (Component* child);
  16035. void parentSizeChanged();
  16036. void visibilityChanged();
  16037. void activeWindowStatusChanged();
  16038. int getDesktopWindowStyleFlags() const;
  16039. virtual const BorderSize getBorderThickness();
  16040. virtual const BorderSize getContentComponentBorder();
  16041. #ifdef JUCE_DEBUG
  16042. void addChildComponent (Component* child, int zOrder = -1);
  16043. void addAndMakeVisible (Component* child, int zOrder = -1);
  16044. #endif
  16045. ScopedPointer <ResizableCornerComponent> resizableCorner;
  16046. ScopedPointer <ResizableBorderComponent> resizableBorder;
  16047. private:
  16048. ScopedPointer <Component> contentComponent;
  16049. bool resizeToFitContent, fullscreen;
  16050. ComponentDragger dragger;
  16051. Rectangle<int> lastNonFullScreenPos;
  16052. ComponentBoundsConstrainer defaultConstrainer;
  16053. ComponentBoundsConstrainer* constrainer;
  16054. #ifdef JUCE_DEBUG
  16055. bool hasBeenResized;
  16056. #endif
  16057. void updateLastPos();
  16058. ResizableWindow (const ResizableWindow&);
  16059. ResizableWindow& operator= (const ResizableWindow&);
  16060. // (xxx remove these eventually)
  16061. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  16062. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  16063. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  16064. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  16065. };
  16066. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  16067. /*** End of inlined file: juce_ResizableWindow.h ***/
  16068. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  16069. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16070. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16071. class JUCE_API PositionedGlyph
  16072. {
  16073. public:
  16074. juce_wchar getCharacter() const { return character; }
  16075. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  16076. float getLeft() const { return x; }
  16077. float getRight() const { return x + w; }
  16078. float getBaselineY() const { return y; }
  16079. float getTop() const { return y - font.getAscent(); }
  16080. float getBottom() const { return y + font.getDescent(); }
  16081. const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
  16082. void moveBy (float deltaX, float deltaY);
  16083. void draw (const Graphics& g) const;
  16084. void draw (const Graphics& g, const AffineTransform& transform) const;
  16085. void createPath (Path& path) const;
  16086. bool hitTest (float x, float y) const;
  16087. juce_UseDebuggingNewOperator
  16088. private:
  16089. friend class GlyphArrangement;
  16090. float x, y, w;
  16091. Font font;
  16092. juce_wchar character;
  16093. int glyph;
  16094. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  16095. PositionedGlyph (const PositionedGlyph& other);
  16096. };
  16097. class JUCE_API GlyphArrangement
  16098. {
  16099. public:
  16100. GlyphArrangement();
  16101. GlyphArrangement (const GlyphArrangement& other);
  16102. GlyphArrangement& operator= (const GlyphArrangement& other);
  16103. ~GlyphArrangement();
  16104. int getNumGlyphs() const throw() { return glyphs.size(); }
  16105. PositionedGlyph& getGlyph (int index) const;
  16106. void clear();
  16107. void addLineOfText (const Font& font,
  16108. const String& text,
  16109. float x, float y);
  16110. void addCurtailedLineOfText (const Font& font,
  16111. const String& text,
  16112. float x, float y,
  16113. float maxWidthPixels,
  16114. bool useEllipsis);
  16115. void addJustifiedText (const Font& font,
  16116. const String& text,
  16117. float x, float y,
  16118. float maxLineWidth,
  16119. const Justification& horizontalLayout);
  16120. void addFittedText (const Font& font,
  16121. const String& text,
  16122. float x, float y, float width, float height,
  16123. const Justification& layout,
  16124. int maximumLinesToUse,
  16125. float minimumHorizontalScale = 0.7f);
  16126. void addGlyphArrangement (const GlyphArrangement& other);
  16127. void draw (const Graphics& g) const;
  16128. void draw (const Graphics& g, const AffineTransform& transform) const;
  16129. void createPath (Path& path) const;
  16130. int findGlyphIndexAt (float x, float y) const;
  16131. const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
  16132. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  16133. float deltaX, float deltaY);
  16134. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  16135. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  16136. float horizontalScaleFactor);
  16137. void justifyGlyphs (int startIndex, int numGlyphs,
  16138. float x, float y, float width, float height,
  16139. const Justification& justification);
  16140. juce_UseDebuggingNewOperator
  16141. private:
  16142. OwnedArray <PositionedGlyph> glyphs;
  16143. int insertEllipsis (const Font& font, float maxXPos, int startIndex, int endIndex);
  16144. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  16145. const Justification& justification, float minimumHorizontalScale);
  16146. void spreadOutLine (int start, int numGlyphs, float targetWidth);
  16147. };
  16148. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  16149. /*** End of inlined file: juce_GlyphArrangement.h ***/
  16150. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  16151. public ButtonListener,
  16152. public FileBrowserListener
  16153. {
  16154. public:
  16155. FileChooserDialogBox (const String& title,
  16156. const String& instructions,
  16157. FileBrowserComponent& browserComponent,
  16158. bool warnAboutOverwritingExistingFiles,
  16159. const Colour& backgroundColour);
  16160. ~FileChooserDialogBox();
  16161. bool show (int width = 0,int height = 0);
  16162. enum ColourIds
  16163. {
  16164. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  16165. };
  16166. void buttonClicked (Button* button);
  16167. void closeButtonPressed();
  16168. void selectionChanged();
  16169. void fileClicked (const File& file, const MouseEvent& e);
  16170. void fileDoubleClicked (const File& file);
  16171. juce_UseDebuggingNewOperator
  16172. private:
  16173. class ContentComponent : public Component
  16174. {
  16175. public:
  16176. ContentComponent();
  16177. ~ContentComponent();
  16178. void paint (Graphics& g);
  16179. void resized();
  16180. String instructions;
  16181. GlyphArrangement text;
  16182. FileBrowserComponent* chooserComponent;
  16183. FilePreviewComponent* previewComponent;
  16184. TextButton* okButton;
  16185. TextButton* cancelButton;
  16186. };
  16187. ContentComponent* content;
  16188. const bool warnAboutOverwritingExistingFiles;
  16189. FileChooserDialogBox (const FileChooserDialogBox&);
  16190. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  16191. };
  16192. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  16193. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  16194. #endif
  16195. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  16196. #endif
  16197. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16198. /*** Start of inlined file: juce_FileListComponent.h ***/
  16199. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16200. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16201. class JUCE_API FileListComponent : public ListBox,
  16202. public DirectoryContentsDisplayComponent,
  16203. private ListBoxModel,
  16204. private ChangeListener
  16205. {
  16206. public:
  16207. FileListComponent (DirectoryContentsList& listToShow);
  16208. ~FileListComponent();
  16209. int getNumSelectedFiles() const;
  16210. const File getSelectedFile (int index = 0) const;
  16211. void scrollToTop();
  16212. void changeListenerCallback (void*);
  16213. int getNumRows();
  16214. void paintListBoxItem (int, Graphics&, int, int, bool);
  16215. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16216. void selectedRowsChanged (int lastRowSelected);
  16217. void deleteKeyPressed (int currentSelectedRow);
  16218. void returnKeyPressed (int currentSelectedRow);
  16219. juce_UseDebuggingNewOperator
  16220. private:
  16221. FileListComponent (const FileListComponent&);
  16222. FileListComponent& operator= (const FileListComponent&);
  16223. File lastDirectory;
  16224. };
  16225. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16226. /*** End of inlined file: juce_FileListComponent.h ***/
  16227. #endif
  16228. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16229. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16230. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16231. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16232. class FilenameComponent;
  16233. class JUCE_API FilenameComponentListener
  16234. {
  16235. public:
  16236. virtual ~FilenameComponentListener() {}
  16237. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16238. };
  16239. class JUCE_API FilenameComponent : public Component,
  16240. public SettableTooltipClient,
  16241. public FileDragAndDropTarget,
  16242. private AsyncUpdater,
  16243. private ButtonListener,
  16244. private ComboBoxListener
  16245. {
  16246. public:
  16247. FilenameComponent (const String& name,
  16248. const File& currentFile,
  16249. bool canEditFilename,
  16250. bool isDirectory,
  16251. bool isForSaving,
  16252. const String& fileBrowserWildcard,
  16253. const String& enforcedSuffix,
  16254. const String& textWhenNothingSelected);
  16255. ~FilenameComponent();
  16256. const File getCurrentFile() const;
  16257. void setCurrentFile (File newFile,
  16258. bool addToRecentlyUsedList,
  16259. bool sendChangeNotification = true);
  16260. void setFilenameIsEditable (bool shouldBeEditable);
  16261. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16262. const StringArray getRecentlyUsedFilenames() const;
  16263. void setRecentlyUsedFilenames (const StringArray& filenames);
  16264. void addRecentlyUsedFile (const File& file);
  16265. void setMaxNumberOfRecentFiles (int newMaximum);
  16266. void setBrowseButtonText (const String& browseButtonText);
  16267. void addListener (FilenameComponentListener* listener);
  16268. void removeListener (FilenameComponentListener* listener);
  16269. void setTooltip (const String& newTooltip);
  16270. void paintOverChildren (Graphics& g);
  16271. void resized();
  16272. void lookAndFeelChanged();
  16273. bool isInterestedInFileDrag (const StringArray& files);
  16274. void filesDropped (const StringArray& files, int, int);
  16275. void fileDragEnter (const StringArray& files, int, int);
  16276. void fileDragExit (const StringArray& files);
  16277. juce_UseDebuggingNewOperator
  16278. private:
  16279. ComboBox* filenameBox;
  16280. String lastFilename;
  16281. Button* browseButton;
  16282. int maxRecentFiles;
  16283. bool isDir, isSaving, isFileDragOver;
  16284. String wildcard, enforcedSuffix, browseButtonText;
  16285. ListenerList <FilenameComponentListener> listeners;
  16286. File defaultBrowseFile;
  16287. void comboBoxChanged (ComboBox*);
  16288. void buttonClicked (Button* button);
  16289. void handleAsyncUpdate();
  16290. FilenameComponent (const FilenameComponent&);
  16291. FilenameComponent& operator= (const FilenameComponent&);
  16292. };
  16293. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16294. /*** End of inlined file: juce_FilenameComponent.h ***/
  16295. #endif
  16296. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16297. #endif
  16298. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16299. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16300. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16301. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16302. class JUCE_API FileSearchPathListComponent : public Component,
  16303. public SettableTooltipClient,
  16304. public FileDragAndDropTarget,
  16305. private ButtonListener,
  16306. private ListBoxModel
  16307. {
  16308. public:
  16309. FileSearchPathListComponent();
  16310. ~FileSearchPathListComponent();
  16311. const FileSearchPath& getPath() const throw() { return path; }
  16312. void setPath (const FileSearchPath& newPath);
  16313. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16314. enum ColourIds
  16315. {
  16316. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16317. Make this transparent if you don't want the background to be filled. */
  16318. };
  16319. int getNumRows();
  16320. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16321. void deleteKeyPressed (int lastRowSelected);
  16322. void returnKeyPressed (int lastRowSelected);
  16323. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16324. void selectedRowsChanged (int lastRowSelected);
  16325. void resized();
  16326. void paint (Graphics& g);
  16327. bool isInterestedInFileDrag (const StringArray& files);
  16328. void filesDropped (const StringArray& files, int, int);
  16329. void buttonClicked (Button* button);
  16330. juce_UseDebuggingNewOperator
  16331. private:
  16332. FileSearchPath path;
  16333. File defaultBrowseTarget;
  16334. ListBox* listBox;
  16335. Button* addButton;
  16336. Button* removeButton;
  16337. TextButton* changeButton;
  16338. DrawableButton* upButton;
  16339. DrawableButton* downButton;
  16340. void changed();
  16341. void updateButtons();
  16342. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16343. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16344. };
  16345. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16346. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16347. #endif
  16348. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16349. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16350. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16351. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16352. class JUCE_API FileTreeComponent : public TreeView,
  16353. public DirectoryContentsDisplayComponent
  16354. {
  16355. public:
  16356. FileTreeComponent (DirectoryContentsList& listToShow);
  16357. ~FileTreeComponent();
  16358. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16359. const File getSelectedFile (int index = 0) const;
  16360. void scrollToTop();
  16361. void setDragAndDropDescription (const String& description);
  16362. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16363. juce_UseDebuggingNewOperator
  16364. private:
  16365. String dragAndDropDescription;
  16366. FileTreeComponent (const FileTreeComponent&);
  16367. FileTreeComponent& operator= (const FileTreeComponent&);
  16368. };
  16369. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16370. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16371. #endif
  16372. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16373. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16374. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16375. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16376. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16377. private Timer
  16378. {
  16379. public:
  16380. ImagePreviewComponent();
  16381. ~ImagePreviewComponent();
  16382. void selectedFileChanged (const File& newSelectedFile);
  16383. void paint (Graphics& g);
  16384. void timerCallback();
  16385. juce_UseDebuggingNewOperator
  16386. private:
  16387. File fileToLoad;
  16388. ScopedPointer <Image> currentThumbnail;
  16389. String currentDetails;
  16390. void getThumbSize (int& w, int& h) const;
  16391. ImagePreviewComponent (const ImagePreviewComponent&);
  16392. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16393. };
  16394. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16395. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16396. #endif
  16397. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16398. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16399. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16400. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16401. class JUCE_API WildcardFileFilter : public FileFilter
  16402. {
  16403. public:
  16404. WildcardFileFilter (const String& fileWildcardPatterns,
  16405. const String& directoryWildcardPatterns,
  16406. const String& description);
  16407. ~WildcardFileFilter();
  16408. bool isFileSuitable (const File& file) const;
  16409. bool isDirectorySuitable (const File& file) const;
  16410. juce_UseDebuggingNewOperator
  16411. private:
  16412. StringArray fileWildcards, directoryWildcards;
  16413. static void parse (const String& pattern, StringArray& result);
  16414. static bool match (const File& file, const StringArray& wildcards);
  16415. };
  16416. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16417. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16418. #endif
  16419. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16420. #endif
  16421. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16422. #endif
  16423. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16424. #endif
  16425. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16426. #endif
  16427. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16428. #endif
  16429. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16430. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16431. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16432. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16433. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16434. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16435. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16436. class JUCE_API KeyPressMappingSet : public KeyListener,
  16437. public ChangeBroadcaster,
  16438. public FocusChangeListener
  16439. {
  16440. public:
  16441. explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);
  16442. KeyPressMappingSet (const KeyPressMappingSet& other);
  16443. ~KeyPressMappingSet();
  16444. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16445. const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
  16446. void addKeyPress (CommandID commandID,
  16447. const KeyPress& newKeyPress,
  16448. int insertIndex = -1);
  16449. void resetToDefaultMappings();
  16450. void resetToDefaultMapping (CommandID commandID);
  16451. void clearAllKeyPresses();
  16452. void clearAllKeyPresses (CommandID commandID);
  16453. void removeKeyPress (CommandID commandID, int keyPressIndex);
  16454. void removeKeyPress (const KeyPress& keypress);
  16455. bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();
  16456. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16457. bool restoreFromXml (const XmlElement& xmlVersion);
  16458. XmlElement* createXml (bool saveDifferencesFromDefaultSet) const;
  16459. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16460. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  16461. void globalFocusChanged (Component* focusedComponent);
  16462. juce_UseDebuggingNewOperator
  16463. private:
  16464. ApplicationCommandManager* commandManager;
  16465. struct CommandMapping
  16466. {
  16467. CommandID commandID;
  16468. Array <KeyPress> keypresses;
  16469. bool wantsKeyUpDownCallbacks;
  16470. };
  16471. OwnedArray <CommandMapping> mappings;
  16472. struct KeyPressTime
  16473. {
  16474. KeyPress key;
  16475. uint32 timeWhenPressed;
  16476. };
  16477. OwnedArray <KeyPressTime> keysDown;
  16478. void handleMessage (const Message& message);
  16479. void invokeCommand (const CommandID commandID,
  16480. const KeyPress& keyPress,
  16481. const bool isKeyDown,
  16482. const int millisecsSinceKeyPressed,
  16483. Component* const originatingComponent) const;
  16484. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16485. };
  16486. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16487. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16488. class JUCE_API KeyMappingEditorComponent : public Component,
  16489. public TreeViewItem,
  16490. public ChangeListener,
  16491. private ButtonListener
  16492. {
  16493. public:
  16494. KeyMappingEditorComponent (KeyPressMappingSet* mappingSet,
  16495. bool showResetToDefaultButton);
  16496. virtual ~KeyMappingEditorComponent();
  16497. void setColours (const Colour& mainBackground,
  16498. const Colour& textColour);
  16499. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16500. virtual bool shouldCommandBeIncluded (CommandID commandID);
  16501. virtual bool isCommandReadOnly (CommandID commandID);
  16502. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16503. enum ColourIds
  16504. {
  16505. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16506. textColourId = 0x100ad01, /**< The colour for the text. */
  16507. };
  16508. void parentHierarchyChanged();
  16509. void resized();
  16510. void changeListenerCallback (void*);
  16511. bool mightContainSubItems();
  16512. const String getUniqueName() const;
  16513. void buttonClicked (Button* button);
  16514. juce_UseDebuggingNewOperator
  16515. private:
  16516. KeyPressMappingSet* mappings;
  16517. TreeView* tree;
  16518. friend class KeyMappingTreeViewItem;
  16519. friend class KeyCategoryTreeViewItem;
  16520. friend class KeyMappingItemComponent;
  16521. friend class KeyMappingChangeButton;
  16522. TextButton* resetButton;
  16523. void assignNewKey (CommandID commandID, int index);
  16524. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16525. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16526. };
  16527. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16528. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16529. #endif
  16530. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16531. #endif
  16532. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16533. #endif
  16534. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16535. #endif
  16536. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16537. #endif
  16538. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16539. #endif
  16540. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16541. #endif
  16542. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16543. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16544. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16545. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16546. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16547. {
  16548. public:
  16549. ComponentMovementWatcher (Component* component);
  16550. ~ComponentMovementWatcher();
  16551. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16552. virtual void componentPeerChanged() = 0;
  16553. juce_UseDebuggingNewOperator
  16554. void componentParentHierarchyChanged (Component& component);
  16555. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16556. private:
  16557. Component::SafePointer<Component> component;
  16558. ComponentPeer* lastPeer;
  16559. VoidArray registeredParentComps;
  16560. bool reentrant;
  16561. Rectangle<int> lastBounds;
  16562. void unregister() throw();
  16563. void registerWithParentComps() throw();
  16564. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16565. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16566. };
  16567. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16568. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16569. #endif
  16570. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16571. /*** Start of inlined file: juce_GroupComponent.h ***/
  16572. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16573. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16574. class JUCE_API GroupComponent : public Component
  16575. {
  16576. public:
  16577. GroupComponent (const String& componentName,
  16578. const String& labelText);
  16579. ~GroupComponent();
  16580. void setText (const String& newText);
  16581. const String getText() const;
  16582. void setTextLabelPosition (const Justification& justification);
  16583. const Justification getTextLabelPosition() const throw() { return justification; }
  16584. enum ColourIds
  16585. {
  16586. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16587. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16588. };
  16589. void paint (Graphics& g);
  16590. void enablementChanged();
  16591. void colourChanged();
  16592. private:
  16593. String text;
  16594. Justification justification;
  16595. GroupComponent (const GroupComponent&);
  16596. GroupComponent& operator= (const GroupComponent&);
  16597. };
  16598. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16599. /*** End of inlined file: juce_GroupComponent.h ***/
  16600. #endif
  16601. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16602. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16603. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16604. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16605. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16606. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16607. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16608. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16609. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16610. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16611. class TabbedButtonBar;
  16612. class JUCE_API TabBarButton : public Button
  16613. {
  16614. public:
  16615. TabBarButton (const String& name,
  16616. TabbedButtonBar* ownerBar,
  16617. int tabIndex);
  16618. ~TabBarButton();
  16619. virtual int getBestTabLength (int depth);
  16620. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16621. void clicked (const ModifierKeys& mods);
  16622. bool hitTest (int x, int y);
  16623. juce_UseDebuggingNewOperator
  16624. protected:
  16625. friend class TabbedButtonBar;
  16626. TabbedButtonBar* const owner;
  16627. int tabIndex, overlapPixels;
  16628. DropShadowEffect shadow;
  16629. void getActiveArea (int& x, int& y, int& w, int& h);
  16630. private:
  16631. TabBarButton (const TabBarButton&);
  16632. TabBarButton& operator= (const TabBarButton&);
  16633. };
  16634. class JUCE_API TabbedButtonBar : public Component,
  16635. public ChangeBroadcaster,
  16636. public ButtonListener
  16637. {
  16638. public:
  16639. enum Orientation
  16640. {
  16641. TabsAtTop,
  16642. TabsAtBottom,
  16643. TabsAtLeft,
  16644. TabsAtRight
  16645. };
  16646. TabbedButtonBar (Orientation orientation);
  16647. ~TabbedButtonBar();
  16648. void setOrientation (Orientation orientation);
  16649. Orientation getOrientation() const throw() { return orientation; }
  16650. void clearTabs();
  16651. void addTab (const String& tabName,
  16652. const Colour& tabBackgroundColour,
  16653. int insertIndex = -1);
  16654. void setTabName (int tabIndex,
  16655. const String& newName);
  16656. void removeTab (int tabIndex);
  16657. void moveTab (int currentIndex, int newIndex);
  16658. int getNumTabs() const;
  16659. const StringArray getTabNames() const;
  16660. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16661. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16662. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16663. TabBarButton* getTabButton (int index) const;
  16664. virtual void currentTabChanged (int newCurrentTabIndex,
  16665. const String& newCurrentTabName);
  16666. virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
  16667. const Colour getTabBackgroundColour (int tabIndex);
  16668. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16669. enum ColourIds
  16670. {
  16671. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16672. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16673. the look and feel will choose an appropriate colour. */
  16674. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16675. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16676. this isn't specified, the look and feel will choose an appropriate
  16677. colour. */
  16678. };
  16679. void resized();
  16680. void buttonClicked (Button* button);
  16681. void lookAndFeelChanged();
  16682. juce_UseDebuggingNewOperator
  16683. protected:
  16684. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16685. private:
  16686. Orientation orientation;
  16687. StringArray tabs;
  16688. Array <Colour> tabColours;
  16689. int currentTabIndex;
  16690. Component* behindFrontTab;
  16691. Button* extraTabsButton;
  16692. TabbedButtonBar (const TabbedButtonBar&);
  16693. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16694. };
  16695. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16696. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16697. class JUCE_API TabbedComponent : public Component
  16698. {
  16699. public:
  16700. explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
  16701. ~TabbedComponent();
  16702. void setOrientation (TabbedButtonBar::Orientation orientation);
  16703. TabbedButtonBar::Orientation getOrientation() const throw();
  16704. void setTabBarDepth (int newDepth);
  16705. int getTabBarDepth() const throw() { return tabDepth; }
  16706. void setOutline (int newThickness);
  16707. void setIndent (int indentThickness);
  16708. void clearTabs();
  16709. void addTab (const String& tabName,
  16710. const Colour& tabBackgroundColour,
  16711. Component* contentComponent,
  16712. bool deleteComponentWhenNotNeeded,
  16713. int insertIndex = -1);
  16714. void setTabName (int tabIndex, const String& newName);
  16715. void removeTab (int tabIndex);
  16716. int getNumTabs() const;
  16717. const StringArray getTabNames() const;
  16718. Component* getTabContentComponent (int tabIndex) const throw();
  16719. const Colour getTabBackgroundColour (int tabIndex) const throw();
  16720. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16721. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16722. int getCurrentTabIndex() const;
  16723. const String& getCurrentTabName() const;
  16724. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16725. virtual void currentTabChanged (int newCurrentTabIndex,
  16726. const String& newCurrentTabName);
  16727. virtual void popupMenuClickOnTab (int tabIndex,
  16728. const String& tabName);
  16729. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16730. enum ColourIds
  16731. {
  16732. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16733. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16734. (See setOutline) */
  16735. };
  16736. void paint (Graphics& g);
  16737. void resized();
  16738. void lookAndFeelChanged();
  16739. juce_UseDebuggingNewOperator
  16740. protected:
  16741. TabbedButtonBar* tabs;
  16742. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16743. private:
  16744. Array <Component*> contentComponents;
  16745. Component* panelComponent;
  16746. int tabDepth;
  16747. int outlineThickness, edgeIndent;
  16748. friend class TabCompButtonBar;
  16749. void changeCallback (int newCurrentTabIndex, const String& newTabName);
  16750. TabbedComponent (const TabbedComponent&);
  16751. TabbedComponent& operator= (const TabbedComponent&);
  16752. };
  16753. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16754. /*** End of inlined file: juce_TabbedComponent.h ***/
  16755. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16756. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16757. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16758. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16759. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16760. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16761. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16762. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16763. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16764. class MenuBarModel;
  16765. class JUCE_API MenuBarModelListener
  16766. {
  16767. public:
  16768. virtual ~MenuBarModelListener() {}
  16769. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16770. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16771. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16772. };
  16773. class JUCE_API MenuBarModel : private AsyncUpdater,
  16774. private ApplicationCommandManagerListener
  16775. {
  16776. public:
  16777. MenuBarModel() throw();
  16778. virtual ~MenuBarModel();
  16779. void menuItemsChanged();
  16780. void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
  16781. void addListener (MenuBarModelListener* listenerToAdd) throw();
  16782. void removeListener (MenuBarModelListener* listenerToRemove) throw();
  16783. virtual const StringArray getMenuBarNames() = 0;
  16784. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16785. const String& menuName) = 0;
  16786. virtual void menuItemSelected (int menuItemID,
  16787. int topLevelMenuIndex) = 0;
  16788. #if JUCE_MAC || DOXYGEN
  16789. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16790. const PopupMenu* extraAppleMenuItems = 0);
  16791. static MenuBarModel* getMacMainMenu();
  16792. #endif
  16793. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16794. void applicationCommandListChanged();
  16795. void handleAsyncUpdate();
  16796. juce_UseDebuggingNewOperator
  16797. private:
  16798. ApplicationCommandManager* manager;
  16799. ListenerList <MenuBarModelListener> listeners;
  16800. MenuBarModel (const MenuBarModel&);
  16801. MenuBarModel& operator= (const MenuBarModel&);
  16802. };
  16803. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16804. /*** End of inlined file: juce_MenuBarModel.h ***/
  16805. class JUCE_API MenuBarComponent : public Component,
  16806. private MenuBarModelListener,
  16807. private Timer
  16808. {
  16809. public:
  16810. MenuBarComponent (MenuBarModel* model);
  16811. ~MenuBarComponent();
  16812. void setModel (MenuBarModel* newModel);
  16813. void showMenu (int menuIndex);
  16814. void paint (Graphics& g);
  16815. void resized();
  16816. void mouseEnter (const MouseEvent& e);
  16817. void mouseExit (const MouseEvent& e);
  16818. void mouseDown (const MouseEvent& e);
  16819. void mouseDrag (const MouseEvent& e);
  16820. void mouseUp (const MouseEvent& e);
  16821. void mouseMove (const MouseEvent& e);
  16822. void inputAttemptWhenModal();
  16823. void handleCommandMessage (int commandId);
  16824. bool keyPressed (const KeyPress& key);
  16825. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16826. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16827. const ApplicationCommandTarget::InvocationInfo& info);
  16828. juce_UseDebuggingNewOperator
  16829. private:
  16830. MenuBarModel* model;
  16831. StringArray menuNames;
  16832. Array <int> xPositions;
  16833. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16834. int lastMouseX, lastMouseY;
  16835. bool inModalState;
  16836. ScopedPointer <Component> currentPopup;
  16837. int getItemAt (int x, int y);
  16838. void updateItemUnderMouse (int x, int y);
  16839. void hideCurrentMenu();
  16840. void timerCallback();
  16841. void repaintMenuItem (int index);
  16842. MenuBarComponent (const MenuBarComponent&);
  16843. MenuBarComponent& operator= (const MenuBarComponent&);
  16844. };
  16845. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16846. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16847. class JUCE_API DocumentWindow : public ResizableWindow
  16848. {
  16849. public:
  16850. enum TitleBarButtons
  16851. {
  16852. minimiseButton = 1,
  16853. maximiseButton = 2,
  16854. closeButton = 4,
  16855. allButtons = 7
  16856. };
  16857. DocumentWindow (const String& name,
  16858. const Colour& backgroundColour,
  16859. int requiredButtons,
  16860. bool addToDesktop = true);
  16861. ~DocumentWindow();
  16862. void setName (const String& newName);
  16863. void setIcon (const Image* imageToUse);
  16864. void setTitleBarHeight (int newHeight);
  16865. int getTitleBarHeight() const;
  16866. void setTitleBarButtonsRequired (int requiredButtons,
  16867. bool positionTitleBarButtonsOnLeft);
  16868. void setTitleBarTextCentred (bool textShouldBeCentred);
  16869. void setMenuBar (MenuBarModel* menuBarModel,
  16870. int menuBarHeight = 0);
  16871. virtual void closeButtonPressed();
  16872. virtual void minimiseButtonPressed();
  16873. virtual void maximiseButtonPressed();
  16874. Button* getCloseButton() const throw();
  16875. Button* getMinimiseButton() const throw();
  16876. Button* getMaximiseButton() const throw();
  16877. enum ColourIds
  16878. {
  16879. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16880. and feel class how this is used. */
  16881. };
  16882. void paint (Graphics& g);
  16883. void resized();
  16884. void lookAndFeelChanged();
  16885. const BorderSize getBorderThickness();
  16886. const BorderSize getContentComponentBorder();
  16887. void mouseDoubleClick (const MouseEvent& e);
  16888. void userTriedToCloseWindow();
  16889. void activeWindowStatusChanged();
  16890. int getDesktopWindowStyleFlags() const;
  16891. void parentHierarchyChanged();
  16892. const Rectangle<int> getTitleBarArea();
  16893. juce_UseDebuggingNewOperator
  16894. private:
  16895. int titleBarHeight, menuBarHeight, requiredButtons;
  16896. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16897. ScopedPointer <Button> titleBarButtons [3];
  16898. ScopedPointer <Image> titleBarIcon;
  16899. ScopedPointer <MenuBarComponent> menuBar;
  16900. MenuBarModel* menuBarModel;
  16901. class ButtonListenerProxy;
  16902. friend class ScopedPointer <ButtonListenerProxy>;
  16903. ScopedPointer <ButtonListenerProxy> buttonListener;
  16904. void repaintTitleBar();
  16905. DocumentWindow (const DocumentWindow&);
  16906. DocumentWindow& operator= (const DocumentWindow&);
  16907. };
  16908. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16909. /*** End of inlined file: juce_DocumentWindow.h ***/
  16910. class MultiDocumentPanel;
  16911. class MDITabbedComponentInternal;
  16912. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16913. {
  16914. public:
  16915. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16916. ~MultiDocumentPanelWindow();
  16917. void maximiseButtonPressed();
  16918. void closeButtonPressed();
  16919. void activeWindowStatusChanged();
  16920. void broughtToFront();
  16921. juce_UseDebuggingNewOperator
  16922. private:
  16923. void updateOrder();
  16924. MultiDocumentPanel* getOwner() const throw();
  16925. };
  16926. class JUCE_API MultiDocumentPanel : public Component,
  16927. private ComponentListener
  16928. {
  16929. public:
  16930. MultiDocumentPanel();
  16931. ~MultiDocumentPanel();
  16932. bool closeAllDocuments (bool checkItsOkToCloseFirst);
  16933. bool addDocument (Component* component,
  16934. const Colour& backgroundColour,
  16935. bool deleteWhenRemoved);
  16936. bool closeDocument (Component* component,
  16937. bool checkItsOkToCloseFirst);
  16938. int getNumDocuments() const throw();
  16939. Component* getDocument (int index) const throw();
  16940. Component* getActiveDocument() const throw();
  16941. void setActiveDocument (Component* component);
  16942. virtual void activeDocumentChanged();
  16943. void setMaximumNumDocuments (int maximumNumDocuments);
  16944. void useFullscreenWhenOneDocument (bool shouldUseTabs);
  16945. bool isFullscreenWhenOneDocument() const throw();
  16946. enum LayoutMode
  16947. {
  16948. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16949. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16950. };
  16951. void setLayoutMode (LayoutMode newLayoutMode);
  16952. LayoutMode getLayoutMode() const throw() { return mode; }
  16953. void setBackgroundColour (const Colour& newBackgroundColour);
  16954. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16955. virtual bool tryToCloseDocument (Component* component) = 0;
  16956. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16957. void paint (Graphics& g);
  16958. void resized();
  16959. void componentNameChanged (Component&);
  16960. juce_UseDebuggingNewOperator
  16961. private:
  16962. LayoutMode mode;
  16963. Array <Component*> components;
  16964. TabbedComponent* tabComponent;
  16965. Colour backgroundColour;
  16966. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16967. friend class MultiDocumentPanelWindow;
  16968. friend class MDITabbedComponentInternal;
  16969. Component* getContainerComp (Component* c) const;
  16970. void updateOrder();
  16971. void addWindow (Component* component);
  16972. };
  16973. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16974. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16975. #endif
  16976. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16977. #endif
  16978. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16979. #endif
  16980. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16981. #endif
  16982. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16983. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16984. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16985. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16986. class JUCE_API StretchableLayoutManager
  16987. {
  16988. public:
  16989. StretchableLayoutManager();
  16990. ~StretchableLayoutManager();
  16991. void setItemLayout (int itemIndex,
  16992. double minimumSize,
  16993. double maximumSize,
  16994. double preferredSize);
  16995. bool getItemLayout (int itemIndex,
  16996. double& minimumSize,
  16997. double& maximumSize,
  16998. double& preferredSize) const;
  16999. void clearAllItems();
  17000. void layOutComponents (Component** components,
  17001. int numComponents,
  17002. int x, int y, int width, int height,
  17003. bool vertically,
  17004. bool resizeOtherDimension);
  17005. int getItemCurrentPosition (int itemIndex) const;
  17006. int getItemCurrentAbsoluteSize (int itemIndex) const;
  17007. double getItemCurrentRelativeSize (int itemIndex) const;
  17008. void setItemPosition (int itemIndex,
  17009. int newPosition);
  17010. juce_UseDebuggingNewOperator
  17011. private:
  17012. struct ItemLayoutProperties
  17013. {
  17014. int itemIndex;
  17015. int currentSize;
  17016. double minSize, maxSize, preferredSize;
  17017. };
  17018. OwnedArray <ItemLayoutProperties> items;
  17019. int totalSize;
  17020. static int sizeToRealSize (double size, int totalSpace);
  17021. ItemLayoutProperties* getInfoFor (int itemIndex) const;
  17022. void setTotalSize (int newTotalSize);
  17023. int fitComponentsIntoSpace (int startIndex, int endIndex, int availableSpace, int startPos);
  17024. int getMinimumSizeOfItems (int startIndex, int endIndex) const;
  17025. int getMaximumSizeOfItems (int startIndex, int endIndex) const;
  17026. void updatePrefSizesToMatchCurrentPositions();
  17027. StretchableLayoutManager (const StretchableLayoutManager&);
  17028. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  17029. };
  17030. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  17031. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  17032. #endif
  17033. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17034. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  17035. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17036. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17037. class JUCE_API StretchableLayoutResizerBar : public Component
  17038. {
  17039. public:
  17040. StretchableLayoutResizerBar (StretchableLayoutManager* layoutToUse,
  17041. int itemIndexInLayout,
  17042. bool isBarVertical);
  17043. ~StretchableLayoutResizerBar();
  17044. virtual void hasBeenMoved();
  17045. void paint (Graphics& g);
  17046. void mouseDown (const MouseEvent& e);
  17047. void mouseDrag (const MouseEvent& e);
  17048. juce_UseDebuggingNewOperator
  17049. private:
  17050. StretchableLayoutManager* layout;
  17051. int itemIndex, mouseDownPos;
  17052. bool isVertical;
  17053. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  17054. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  17055. };
  17056. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  17057. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  17058. #endif
  17059. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17060. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  17061. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17062. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17063. class StretchableObjectResizer
  17064. {
  17065. public:
  17066. StretchableObjectResizer();
  17067. ~StretchableObjectResizer();
  17068. void addItem (double currentSize,
  17069. double minSize,
  17070. double maxSize,
  17071. int order = 0);
  17072. void resizeToFit (double targetSize);
  17073. int getNumItems() const throw() { return items.size(); }
  17074. double getItemSize (int index) const throw();
  17075. juce_UseDebuggingNewOperator
  17076. private:
  17077. struct Item
  17078. {
  17079. double size;
  17080. double minSize;
  17081. double maxSize;
  17082. int order;
  17083. };
  17084. OwnedArray <Item> items;
  17085. StretchableObjectResizer (const StretchableObjectResizer&);
  17086. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  17087. };
  17088. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  17089. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  17090. #endif
  17091. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  17092. #endif
  17093. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  17094. #endif
  17095. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  17096. #endif
  17097. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  17098. /*** Start of inlined file: juce_LookAndFeel.h ***/
  17099. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  17100. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  17101. /*** Start of inlined file: juce_AlertWindow.h ***/
  17102. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  17103. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  17104. /*** Start of inlined file: juce_TextLayout.h ***/
  17105. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  17106. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  17107. class Graphics;
  17108. class JUCE_API TextLayout
  17109. {
  17110. public:
  17111. TextLayout();
  17112. TextLayout (const TextLayout& other);
  17113. TextLayout (const String& text, const Font& font);
  17114. ~TextLayout();
  17115. TextLayout& operator= (const TextLayout& layoutToCopy);
  17116. void clear();
  17117. void appendText (const String& textToAppend,
  17118. const Font& fontToUse);
  17119. void setText (const String& newText,
  17120. const Font& fontToUse);
  17121. void layout (int maximumWidth,
  17122. const Justification& justification,
  17123. bool attemptToBalanceLineLengths);
  17124. int getWidth() const;
  17125. int getHeight() const;
  17126. int getNumLines() const { return totalLines; }
  17127. int getLineWidth (int lineNumber) const;
  17128. void draw (Graphics& g, int topLeftX, int topLeftY) const;
  17129. void drawWithin (Graphics& g,
  17130. int x, int y, int w, int h,
  17131. const Justification& layoutFlags) const;
  17132. juce_UseDebuggingNewOperator
  17133. private:
  17134. class Token;
  17135. friend class OwnedArray <Token>;
  17136. OwnedArray <Token> tokens;
  17137. int totalLines;
  17138. };
  17139. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  17140. /*** End of inlined file: juce_TextLayout.h ***/
  17141. class JUCE_API AlertWindow : public TopLevelWindow,
  17142. private ButtonListener
  17143. {
  17144. public:
  17145. enum AlertIconType
  17146. {
  17147. NoIcon, /**< No icon will be shown on the dialog box. */
  17148. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  17149. user to answer a question. */
  17150. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  17151. warning about something and shouldn't be ignored. */
  17152. InfoIcon /**< An icon that indicates that the dialog box is just
  17153. giving the user some information, which doesn't require
  17154. a response from them. */
  17155. };
  17156. AlertWindow (const String& title,
  17157. const String& message,
  17158. AlertIconType iconType,
  17159. Component* associatedComponent = 0);
  17160. ~AlertWindow();
  17161. AlertIconType getAlertType() const throw() { return alertIconType; }
  17162. void setMessage (const String& message);
  17163. void addButton (const String& name,
  17164. int returnValue,
  17165. const KeyPress& shortcutKey1 = KeyPress(),
  17166. const KeyPress& shortcutKey2 = KeyPress());
  17167. int getNumButtons() const;
  17168. void addTextEditor (const String& name,
  17169. const String& initialContents,
  17170. const String& onScreenLabel = String::empty,
  17171. bool isPasswordBox = false);
  17172. const String getTextEditorContents (const String& nameOfTextEditor) const;
  17173. void addComboBox (const String& name,
  17174. const StringArray& items,
  17175. const String& onScreenLabel = String::empty);
  17176. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  17177. void addTextBlock (const String& text);
  17178. void addProgressBarComponent (double& progressValue);
  17179. void addCustomComponent (Component* component);
  17180. int getNumCustomComponents() const;
  17181. Component* getCustomComponent (int index) const;
  17182. Component* removeCustomComponent (int index);
  17183. bool containsAnyExtraComponents() const;
  17184. // easy-to-use message box functions:
  17185. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  17186. const String& title,
  17187. const String& message,
  17188. const String& buttonText = String::empty,
  17189. Component* associatedComponent = 0);
  17190. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  17191. const String& title,
  17192. const String& message,
  17193. const String& button1Text = String::empty,
  17194. const String& button2Text = String::empty,
  17195. Component* associatedComponent = 0);
  17196. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17197. const String& title,
  17198. const String& message,
  17199. const String& button1Text = String::empty,
  17200. const String& button2Text = String::empty,
  17201. const String& button3Text = String::empty,
  17202. Component* associatedComponent = 0);
  17203. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17204. const String& bodyText,
  17205. bool isOkCancel);
  17206. enum ColourIds
  17207. {
  17208. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17209. textColourId = 0x1001810, /**< The colour for the text. */
  17210. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17211. };
  17212. juce_UseDebuggingNewOperator
  17213. protected:
  17214. void paint (Graphics& g);
  17215. void mouseDown (const MouseEvent& e);
  17216. void mouseDrag (const MouseEvent& e);
  17217. bool keyPressed (const KeyPress& key);
  17218. void buttonClicked (Button* button);
  17219. void lookAndFeelChanged();
  17220. void userTriedToCloseWindow();
  17221. int getDesktopWindowStyleFlags() const;
  17222. private:
  17223. String text;
  17224. TextLayout textLayout;
  17225. AlertIconType alertIconType;
  17226. ComponentBoundsConstrainer constrainer;
  17227. ComponentDragger dragger;
  17228. Rectangle<int> textArea;
  17229. VoidArray buttons, textBoxes, comboBoxes;
  17230. VoidArray progressBars, customComps, textBlocks, allComps;
  17231. StringArray textboxNames, comboBoxNames;
  17232. Font font;
  17233. Component* associatedComponent;
  17234. void updateLayout (bool onlyIncreaseSize);
  17235. // disable copy constructor
  17236. AlertWindow (const AlertWindow&);
  17237. AlertWindow& operator= (const AlertWindow&);
  17238. };
  17239. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17240. /*** End of inlined file: juce_AlertWindow.h ***/
  17241. class ToggleButton;
  17242. class TextButton;
  17243. class AlertWindow;
  17244. class TextLayout;
  17245. class ScrollBar;
  17246. class BubbleComponent;
  17247. class ComboBox;
  17248. class Button;
  17249. class FilenameComponent;
  17250. class DocumentWindow;
  17251. class ResizableWindow;
  17252. class GroupComponent;
  17253. class MenuBarComponent;
  17254. class DropShadower;
  17255. class GlyphArrangement;
  17256. class PropertyComponent;
  17257. class TableHeaderComponent;
  17258. class Toolbar;
  17259. class ToolbarItemComponent;
  17260. class PopupMenu;
  17261. class ProgressBar;
  17262. class FileBrowserComponent;
  17263. class DirectoryContentsDisplayComponent;
  17264. class FilePreviewComponent;
  17265. class ImageButton;
  17266. class JUCE_API LookAndFeel
  17267. {
  17268. public:
  17269. LookAndFeel();
  17270. virtual ~LookAndFeel();
  17271. static LookAndFeel& getDefaultLookAndFeel() throw();
  17272. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17273. const Colour findColour (int colourId) const throw();
  17274. void setColour (int colourId, const Colour& colour) throw();
  17275. bool isColourSpecified (int colourId) const throw();
  17276. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17277. void setDefaultSansSerifTypefaceName (const String& newName);
  17278. virtual const MouseCursor getMouseCursorFor (Component& component);
  17279. virtual void drawButtonBackground (Graphics& g,
  17280. Button& button,
  17281. const Colour& backgroundColour,
  17282. bool isMouseOverButton,
  17283. bool isButtonDown);
  17284. virtual const Font getFontForTextButton (TextButton& button);
  17285. virtual void drawButtonText (Graphics& g,
  17286. TextButton& button,
  17287. bool isMouseOverButton,
  17288. bool isButtonDown);
  17289. virtual void drawToggleButton (Graphics& g,
  17290. ToggleButton& button,
  17291. bool isMouseOverButton,
  17292. bool isButtonDown);
  17293. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17294. virtual void drawTickBox (Graphics& g,
  17295. Component& component,
  17296. float x, float y, float w, float h,
  17297. bool ticked,
  17298. bool isEnabled,
  17299. bool isMouseOverButton,
  17300. bool isButtonDown);
  17301. virtual AlertWindow* createAlertWindow (const String& title,
  17302. const String& message,
  17303. const String& button1,
  17304. const String& button2,
  17305. const String& button3,
  17306. AlertWindow::AlertIconType iconType,
  17307. int numButtons,
  17308. Component* associatedComponent);
  17309. virtual void drawAlertBox (Graphics& g,
  17310. AlertWindow& alert,
  17311. const Rectangle<int>& textArea,
  17312. TextLayout& textLayout);
  17313. virtual int getAlertBoxWindowFlags();
  17314. virtual int getAlertWindowButtonHeight();
  17315. virtual const Font getAlertWindowFont();
  17316. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17317. int width, int height,
  17318. double progress, const String& textToShow);
  17319. // Draws a small image that spins to indicate that something's happening..
  17320. // This method should use the current time to animate itself, so just keep
  17321. // repainting it every so often.
  17322. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17323. int x, int y, int w, int h);
  17324. virtual void drawScrollbarButton (Graphics& g,
  17325. ScrollBar& scrollbar,
  17326. int width, int height,
  17327. int buttonDirection,
  17328. bool isScrollbarVertical,
  17329. bool isMouseOverButton,
  17330. bool isButtonDown);
  17331. virtual void drawScrollbar (Graphics& g,
  17332. ScrollBar& scrollbar,
  17333. int x, int y,
  17334. int width, int height,
  17335. bool isScrollbarVertical,
  17336. int thumbStartPosition,
  17337. int thumbSize,
  17338. bool isMouseOver,
  17339. bool isMouseDown);
  17340. virtual ImageEffectFilter* getScrollbarEffect();
  17341. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17342. virtual int getDefaultScrollbarWidth();
  17343. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17344. virtual const Path getTickShape (float height);
  17345. virtual const Path getCrossShape (float height);
  17346. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17347. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17348. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17349. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17350. virtual Image* getDefaultFolderImage();
  17351. virtual Image* getDefaultDocumentFileImage();
  17352. virtual void createFileChooserHeaderText (const String& title,
  17353. const String& instructions,
  17354. GlyphArrangement& destArrangement,
  17355. int width);
  17356. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17357. const String& filename, Image* icon,
  17358. const String& fileSizeDescription,
  17359. const String& fileTimeDescription,
  17360. bool isDirectory,
  17361. bool isItemSelected,
  17362. int itemIndex);
  17363. virtual Button* createFileBrowserGoUpButton();
  17364. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17365. DirectoryContentsDisplayComponent* fileListComponent,
  17366. FilePreviewComponent* previewComp,
  17367. ComboBox* currentPathBox,
  17368. TextEditor* filenameBox,
  17369. Button* goUpButton);
  17370. virtual void drawBubble (Graphics& g,
  17371. float tipX, float tipY,
  17372. float boxX, float boxY, float boxW, float boxH);
  17373. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17374. virtual void drawPopupMenuItem (Graphics& g,
  17375. int width, int height,
  17376. bool isSeparator,
  17377. bool isActive,
  17378. bool isHighlighted,
  17379. bool isTicked,
  17380. bool hasSubMenu,
  17381. const String& text,
  17382. const String& shortcutKeyText,
  17383. Image* image,
  17384. const Colour* const textColour);
  17385. virtual const Font getPopupMenuFont();
  17386. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17387. int width, int height,
  17388. bool isScrollUpArrow);
  17389. virtual void getIdealPopupMenuItemSize (const String& text,
  17390. bool isSeparator,
  17391. int standardMenuItemHeight,
  17392. int& idealWidth,
  17393. int& idealHeight);
  17394. virtual int getMenuWindowFlags();
  17395. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17396. bool isMouseOverBar,
  17397. MenuBarComponent& menuBar);
  17398. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17399. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17400. virtual void drawMenuBarItem (Graphics& g,
  17401. int width, int height,
  17402. int itemIndex,
  17403. const String& itemText,
  17404. bool isMouseOverItem,
  17405. bool isMenuOpen,
  17406. bool isMouseOverBar,
  17407. MenuBarComponent& menuBar);
  17408. virtual void drawComboBox (Graphics& g, int width, int height,
  17409. bool isButtonDown,
  17410. int buttonX, int buttonY,
  17411. int buttonW, int buttonH,
  17412. ComboBox& box);
  17413. virtual const Font getComboBoxFont (ComboBox& box);
  17414. virtual Label* createComboBoxTextBox (ComboBox& box);
  17415. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17416. virtual void drawLabel (Graphics& g, Label& label);
  17417. virtual void drawLinearSlider (Graphics& g,
  17418. int x, int y,
  17419. int width, int height,
  17420. float sliderPos,
  17421. float minSliderPos,
  17422. float maxSliderPos,
  17423. const Slider::SliderStyle style,
  17424. Slider& slider);
  17425. virtual void drawLinearSliderBackground (Graphics& g,
  17426. int x, int y,
  17427. int width, int height,
  17428. float sliderPos,
  17429. float minSliderPos,
  17430. float maxSliderPos,
  17431. const Slider::SliderStyle style,
  17432. Slider& slider);
  17433. virtual void drawLinearSliderThumb (Graphics& g,
  17434. int x, int y,
  17435. int width, int height,
  17436. float sliderPos,
  17437. float minSliderPos,
  17438. float maxSliderPos,
  17439. const Slider::SliderStyle style,
  17440. Slider& slider);
  17441. virtual int getSliderThumbRadius (Slider& slider);
  17442. virtual void drawRotarySlider (Graphics& g,
  17443. int x, int y,
  17444. int width, int height,
  17445. float sliderPosProportional,
  17446. float rotaryStartAngle,
  17447. float rotaryEndAngle,
  17448. Slider& slider);
  17449. virtual Button* createSliderButton (bool isIncrement);
  17450. virtual Label* createSliderTextBox (Slider& slider);
  17451. virtual ImageEffectFilter* getSliderEffect();
  17452. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17453. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17454. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17455. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17456. ComboBox* filenameBox, Button* browseButton);
  17457. virtual void drawCornerResizer (Graphics& g,
  17458. int w, int h,
  17459. bool isMouseOver,
  17460. bool isMouseDragging);
  17461. virtual void drawResizableFrame (Graphics& g,
  17462. int w, int h,
  17463. const BorderSize& borders);
  17464. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17465. const BorderSize& border,
  17466. ResizableWindow& window);
  17467. virtual void drawResizableWindowBorder (Graphics& g,
  17468. int w, int h,
  17469. const BorderSize& border,
  17470. ResizableWindow& window);
  17471. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17472. Graphics& g, int w, int h,
  17473. int titleSpaceX, int titleSpaceW,
  17474. const Image* icon,
  17475. bool drawTitleTextOnLeft);
  17476. virtual Button* createDocumentWindowButton (int buttonType);
  17477. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17478. int titleBarX, int titleBarY,
  17479. int titleBarW, int titleBarH,
  17480. Button* minimiseButton,
  17481. Button* maximiseButton,
  17482. Button* closeButton,
  17483. bool positionTitleBarButtonsOnLeft);
  17484. virtual int getDefaultMenuBarHeight();
  17485. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17486. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17487. int w, int h,
  17488. bool isVerticalBar,
  17489. bool isMouseOver,
  17490. bool isMouseDragging);
  17491. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17492. const String& text,
  17493. const Justification& position,
  17494. GroupComponent& group);
  17495. virtual void createTabButtonShape (Path& p,
  17496. int width, int height,
  17497. int tabIndex,
  17498. const String& text,
  17499. Button& button,
  17500. TabbedButtonBar::Orientation orientation,
  17501. bool isMouseOver,
  17502. bool isMouseDown,
  17503. bool isFrontTab);
  17504. virtual void fillTabButtonShape (Graphics& g,
  17505. const Path& path,
  17506. const Colour& preferredBackgroundColour,
  17507. int tabIndex,
  17508. const String& text,
  17509. Button& button,
  17510. TabbedButtonBar::Orientation orientation,
  17511. bool isMouseOver,
  17512. bool isMouseDown,
  17513. bool isFrontTab);
  17514. virtual void drawTabButtonText (Graphics& g,
  17515. int x, int y, int w, int h,
  17516. const Colour& preferredBackgroundColour,
  17517. int tabIndex,
  17518. const String& text,
  17519. Button& button,
  17520. TabbedButtonBar::Orientation orientation,
  17521. bool isMouseOver,
  17522. bool isMouseDown,
  17523. bool isFrontTab);
  17524. virtual int getTabButtonOverlap (int tabDepth);
  17525. virtual int getTabButtonSpaceAroundImage();
  17526. virtual int getTabButtonBestWidth (int tabIndex,
  17527. const String& text,
  17528. int tabDepth,
  17529. Button& button);
  17530. virtual void drawTabButton (Graphics& g,
  17531. int w, int h,
  17532. const Colour& preferredColour,
  17533. int tabIndex,
  17534. const String& text,
  17535. Button& button,
  17536. TabbedButtonBar::Orientation orientation,
  17537. bool isMouseOver,
  17538. bool isMouseDown,
  17539. bool isFrontTab);
  17540. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17541. int w, int h,
  17542. TabbedButtonBar& tabBar,
  17543. TabbedButtonBar::Orientation orientation);
  17544. virtual Button* createTabBarExtrasButton();
  17545. virtual void drawImageButton (Graphics& g, Image* image,
  17546. int imageX, int imageY, int imageW, int imageH,
  17547. const Colour& overlayColour,
  17548. float imageOpacity,
  17549. ImageButton& button);
  17550. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17551. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17552. int width, int height,
  17553. bool isMouseOver, bool isMouseDown,
  17554. int columnFlags);
  17555. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17556. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17557. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17558. bool isMouseOver, bool isMouseDown,
  17559. ToolbarItemComponent& component);
  17560. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17561. const String& text, ToolbarItemComponent& component);
  17562. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17563. bool isOpen, int width, int height);
  17564. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17565. PropertyComponent& component);
  17566. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17567. PropertyComponent& component);
  17568. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17569. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17570. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17571. virtual void playAlertSound();
  17572. static void drawGlassSphere (Graphics& g,
  17573. float x, float y,
  17574. float diameter,
  17575. const Colour& colour,
  17576. float outlineThickness) throw();
  17577. static void drawGlassPointer (Graphics& g,
  17578. float x, float y,
  17579. float diameter,
  17580. const Colour& colour, float outlineThickness,
  17581. int direction) throw();
  17582. static void drawGlassLozenge (Graphics& g,
  17583. float x, float y,
  17584. float width, float height,
  17585. const Colour& colour,
  17586. float outlineThickness,
  17587. float cornerSize,
  17588. bool flatOnLeft, bool flatOnRight,
  17589. bool flatOnTop, bool flatOnBottom) throw();
  17590. juce_UseDebuggingNewOperator
  17591. private:
  17592. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17593. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17594. Array <int> colourIds;
  17595. Array <Colour> colours;
  17596. // default typeface names
  17597. String defaultSans, defaultSerif, defaultFixed;
  17598. void drawShinyButtonShape (Graphics& g,
  17599. float x, float y, float w, float h, float maxCornerSize,
  17600. const Colour& baseColour,
  17601. float strokeWidth,
  17602. bool flatOnLeft,
  17603. bool flatOnRight,
  17604. bool flatOnTop,
  17605. bool flatOnBottom) throw();
  17606. LookAndFeel (const LookAndFeel&);
  17607. LookAndFeel& operator= (const LookAndFeel&);
  17608. };
  17609. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17610. /*** End of inlined file: juce_LookAndFeel.h ***/
  17611. #endif
  17612. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17613. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17614. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17615. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17616. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17617. {
  17618. public:
  17619. OldSchoolLookAndFeel();
  17620. virtual ~OldSchoolLookAndFeel();
  17621. virtual void drawButtonBackground (Graphics& g,
  17622. Button& button,
  17623. const Colour& backgroundColour,
  17624. bool isMouseOverButton,
  17625. bool isButtonDown);
  17626. virtual void drawToggleButton (Graphics& g,
  17627. ToggleButton& button,
  17628. bool isMouseOverButton,
  17629. bool isButtonDown);
  17630. virtual void drawTickBox (Graphics& g,
  17631. Component& component,
  17632. float x, float y, float w, float h,
  17633. bool ticked,
  17634. bool isEnabled,
  17635. bool isMouseOverButton,
  17636. bool isButtonDown);
  17637. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17638. int width, int height,
  17639. double progress, const String& textToShow);
  17640. virtual void drawScrollbarButton (Graphics& g,
  17641. ScrollBar& scrollbar,
  17642. int width, int height,
  17643. int buttonDirection,
  17644. bool isScrollbarVertical,
  17645. bool isMouseOverButton,
  17646. bool isButtonDown);
  17647. virtual void drawScrollbar (Graphics& g,
  17648. ScrollBar& scrollbar,
  17649. int x, int y,
  17650. int width, int height,
  17651. bool isScrollbarVertical,
  17652. int thumbStartPosition,
  17653. int thumbSize,
  17654. bool isMouseOver,
  17655. bool isMouseDown);
  17656. virtual ImageEffectFilter* getScrollbarEffect();
  17657. virtual void drawTextEditorOutline (Graphics& g,
  17658. int width, int height,
  17659. TextEditor& textEditor);
  17660. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17661. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17662. bool isMouseOverBar,
  17663. MenuBarComponent& menuBar);
  17664. virtual void drawComboBox (Graphics& g, int width, int height,
  17665. bool isButtonDown,
  17666. int buttonX, int buttonY,
  17667. int buttonW, int buttonH,
  17668. ComboBox& box);
  17669. virtual const Font getComboBoxFont (ComboBox& box);
  17670. virtual void drawLinearSlider (Graphics& g,
  17671. int x, int y,
  17672. int width, int height,
  17673. float sliderPos,
  17674. float minSliderPos,
  17675. float maxSliderPos,
  17676. const Slider::SliderStyle style,
  17677. Slider& slider);
  17678. virtual int getSliderThumbRadius (Slider& slider);
  17679. virtual Button* createSliderButton (bool isIncrement);
  17680. virtual ImageEffectFilter* getSliderEffect();
  17681. virtual void drawCornerResizer (Graphics& g,
  17682. int w, int h,
  17683. bool isMouseOver,
  17684. bool isMouseDragging);
  17685. virtual Button* createDocumentWindowButton (int buttonType);
  17686. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17687. int titleBarX, int titleBarY,
  17688. int titleBarW, int titleBarH,
  17689. Button* minimiseButton,
  17690. Button* maximiseButton,
  17691. Button* closeButton,
  17692. bool positionTitleBarButtonsOnLeft);
  17693. juce_UseDebuggingNewOperator
  17694. private:
  17695. DropShadowEffect scrollbarShadow;
  17696. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17697. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17698. };
  17699. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17700. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17701. #endif
  17702. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17703. #endif
  17704. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17705. #endif
  17706. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17707. #endif
  17708. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17709. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17710. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17711. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17712. class JUCE_API PopupMenuCustomComponent : public Component,
  17713. public ReferenceCountedObject
  17714. {
  17715. public:
  17716. ~PopupMenuCustomComponent();
  17717. virtual void getIdealSize (int& idealWidth,
  17718. int& idealHeight) = 0;
  17719. void triggerMenuItem();
  17720. bool isItemHighlighted() const throw() { return isHighlighted; }
  17721. protected:
  17722. PopupMenuCustomComponent (bool isTriggeredAutomatically = true);
  17723. private:
  17724. friend class PopupMenu;
  17725. friend class PopupMenu::ItemComponent;
  17726. friend class PopupMenu::Window;
  17727. bool isHighlighted, isTriggeredAutomatically;
  17728. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17729. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17730. };
  17731. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17732. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17733. #endif
  17734. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17735. #endif
  17736. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17737. #endif
  17738. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17739. #endif
  17740. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17741. #endif
  17742. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17743. /*** Start of inlined file: juce_LassoComponent.h ***/
  17744. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17745. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17746. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17747. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17748. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17749. template <class SelectableItemType>
  17750. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17751. {
  17752. public:
  17753. typedef SelectableItemType ItemType;
  17754. SelectedItemSet()
  17755. {
  17756. }
  17757. explicit SelectedItemSet (const Array <SelectableItemType>& items)
  17758. : selectedItems (items)
  17759. {
  17760. }
  17761. SelectedItemSet (const SelectedItemSet& other)
  17762. : selectedItems (other.selectedItems)
  17763. {
  17764. }
  17765. SelectedItemSet& operator= (const SelectedItemSet& other)
  17766. {
  17767. if (selectedItems != other.selectedItems)
  17768. {
  17769. selectedItems = other.selectedItems;
  17770. changed();
  17771. }
  17772. return *this;
  17773. }
  17774. ~SelectedItemSet()
  17775. {
  17776. }
  17777. void selectOnly (SelectableItemType item)
  17778. {
  17779. if (isSelected (item))
  17780. {
  17781. for (int i = selectedItems.size(); --i >= 0;)
  17782. {
  17783. if (selectedItems.getUnchecked(i) != item)
  17784. {
  17785. deselect (selectedItems.getUnchecked(i));
  17786. i = jmin (i, selectedItems.size());
  17787. }
  17788. }
  17789. }
  17790. else
  17791. {
  17792. deselectAll();
  17793. changed();
  17794. selectedItems.add (item);
  17795. itemSelected (item);
  17796. }
  17797. }
  17798. void addToSelection (SelectableItemType item)
  17799. {
  17800. if (! isSelected (item))
  17801. {
  17802. changed();
  17803. selectedItems.add (item);
  17804. itemSelected (item);
  17805. }
  17806. }
  17807. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17808. const ModifierKeys& modifiers)
  17809. {
  17810. if (modifiers.isShiftDown())
  17811. {
  17812. addToSelection (item);
  17813. }
  17814. else if (modifiers.isCommandDown())
  17815. {
  17816. if (isSelected (item))
  17817. deselect (item);
  17818. else
  17819. addToSelection (item);
  17820. }
  17821. else
  17822. {
  17823. selectOnly (item);
  17824. }
  17825. }
  17826. bool addToSelectionOnMouseDown (SelectableItemType item,
  17827. const ModifierKeys& modifiers)
  17828. {
  17829. if (isSelected (item))
  17830. {
  17831. return ! modifiers.isPopupMenu();
  17832. }
  17833. else
  17834. {
  17835. addToSelectionBasedOnModifiers (item, modifiers);
  17836. return false;
  17837. }
  17838. }
  17839. void addToSelectionOnMouseUp (SelectableItemType item,
  17840. const ModifierKeys& modifiers,
  17841. const bool wasItemDragged,
  17842. const bool resultOfMouseDownSelectMethod)
  17843. {
  17844. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17845. addToSelectionBasedOnModifiers (item, modifiers);
  17846. }
  17847. void deselect (SelectableItemType item)
  17848. {
  17849. const int i = selectedItems.indexOf (item);
  17850. if (i >= 0)
  17851. {
  17852. changed();
  17853. itemDeselected (selectedItems.remove (i));
  17854. }
  17855. }
  17856. void deselectAll()
  17857. {
  17858. if (selectedItems.size() > 0)
  17859. {
  17860. changed();
  17861. for (int i = selectedItems.size(); --i >= 0;)
  17862. {
  17863. itemDeselected (selectedItems.remove (i));
  17864. i = jmin (i, selectedItems.size());
  17865. }
  17866. }
  17867. }
  17868. int getNumSelected() const throw()
  17869. {
  17870. return selectedItems.size();
  17871. }
  17872. SelectableItemType getSelectedItem (const int index) const throw()
  17873. {
  17874. return selectedItems [index];
  17875. }
  17876. bool isSelected (const SelectableItemType item) const throw()
  17877. {
  17878. return selectedItems.contains (item);
  17879. }
  17880. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17881. virtual void itemSelected (SelectableItemType item) {}
  17882. virtual void itemDeselected (SelectableItemType item) {}
  17883. void changed (const bool synchronous = false)
  17884. {
  17885. if (synchronous)
  17886. sendSynchronousChangeMessage (this);
  17887. else
  17888. sendChangeMessage (this);
  17889. }
  17890. juce_UseDebuggingNewOperator
  17891. private:
  17892. Array <SelectableItemType> selectedItems;
  17893. };
  17894. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17895. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17896. template <class SelectableItemType>
  17897. class LassoSource
  17898. {
  17899. public:
  17900. virtual ~LassoSource() {}
  17901. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17902. int x, int y, int width, int height) = 0;
  17903. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17904. };
  17905. template <class SelectableItemType>
  17906. class LassoComponent : public Component
  17907. {
  17908. public:
  17909. explicit LassoComponent (const int outlineThickness_ = 1)
  17910. : source (0),
  17911. outlineThickness (outlineThickness_)
  17912. {
  17913. }
  17914. ~LassoComponent()
  17915. {
  17916. }
  17917. void beginLasso (const MouseEvent& e,
  17918. LassoSource <SelectableItemType>* const lassoSource)
  17919. {
  17920. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17921. jassert (lassoSource != 0); // the source can't be null!
  17922. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17923. source = lassoSource;
  17924. if (lassoSource != 0)
  17925. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17926. setSize (0, 0);
  17927. }
  17928. void dragLasso (const MouseEvent& e)
  17929. {
  17930. if (source != 0)
  17931. {
  17932. setBounds (Rectangle<int> (e.getMouseDownPosition(), e.getPosition()));
  17933. setVisible (true);
  17934. Array <SelectableItemType> itemsInLasso;
  17935. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17936. if (e.mods.isShiftDown())
  17937. {
  17938. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17939. itemsInLasso.addArray (originalSelection);
  17940. }
  17941. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17942. {
  17943. Array <SelectableItemType> originalMinusNew (originalSelection);
  17944. originalMinusNew.removeValuesIn (itemsInLasso);
  17945. itemsInLasso.removeValuesIn (originalSelection);
  17946. itemsInLasso.addArray (originalMinusNew);
  17947. }
  17948. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17949. }
  17950. }
  17951. void endLasso()
  17952. {
  17953. source = 0;
  17954. originalSelection.clear();
  17955. setVisible (false);
  17956. }
  17957. enum ColourIds
  17958. {
  17959. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17960. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17961. };
  17962. void paint (Graphics& g)
  17963. {
  17964. g.fillAll (findColour (lassoFillColourId));
  17965. g.setColour (findColour (lassoOutlineColourId));
  17966. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17967. // this suggests that you've left a lasso comp lying around after the
  17968. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17969. // mouse-up event.
  17970. jassert (isMouseButtonDownAnywhere());
  17971. }
  17972. bool hitTest (int x, int y) { return false; }
  17973. juce_UseDebuggingNewOperator
  17974. private:
  17975. Array <SelectableItemType> originalSelection;
  17976. LassoSource <SelectableItemType>* source;
  17977. int outlineThickness;
  17978. };
  17979. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17980. /*** End of inlined file: juce_LassoComponent.h ***/
  17981. #endif
  17982. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17983. #endif
  17984. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17985. #endif
  17986. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17987. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17988. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17989. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17990. class JUCE_API MouseHoverDetector
  17991. {
  17992. public:
  17993. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17994. virtual ~MouseHoverDetector();
  17995. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17996. void setHoverComponent (Component* const newSourceComponent);
  17997. protected:
  17998. virtual void mouseHovered (int mouseX,
  17999. int mouseY) = 0;
  18000. virtual void mouseMovedAfterHover() = 0;
  18001. private:
  18002. class JUCE_API HoverDetectorInternal : public MouseListener,
  18003. public Timer
  18004. {
  18005. public:
  18006. MouseHoverDetector* owner;
  18007. int lastX, lastY;
  18008. void timerCallback();
  18009. void mouseEnter (const MouseEvent&);
  18010. void mouseExit (const MouseEvent&);
  18011. void mouseDown (const MouseEvent&);
  18012. void mouseUp (const MouseEvent&);
  18013. void mouseMove (const MouseEvent&);
  18014. void mouseWheelMove (const MouseEvent&, float, float);
  18015. } internalTimer;
  18016. friend class HoverDetectorInternal;
  18017. Component* source;
  18018. int hoverTimeMillisecs;
  18019. bool hasJustHovered;
  18020. void hoverTimerCallback();
  18021. void checkJustHoveredCallback();
  18022. MouseHoverDetector (const MouseHoverDetector&);
  18023. MouseHoverDetector& operator= (const MouseHoverDetector&);
  18024. };
  18025. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  18026. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  18027. #endif
  18028. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18029. /*** Start of inlined file: juce_MouseInputSource.h ***/
  18030. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18031. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18032. class Component;
  18033. class ComponentPeer;
  18034. class MouseInputSourceInternal;
  18035. class JUCE_API MouseInputSource
  18036. {
  18037. public:
  18038. MouseInputSource (int index, bool isMouseDevice);
  18039. ~MouseInputSource();
  18040. bool isMouse() const;
  18041. bool isTouch() const;
  18042. bool canHover() const;
  18043. bool hasMouseWheel() const;
  18044. int getIndex() const;
  18045. bool isDragging() const;
  18046. const Point<int> getScreenPosition() const;
  18047. const ModifierKeys getCurrentModifiers() const;
  18048. Component* getComponentUnderMouse() const;
  18049. void triggerFakeMove() const;
  18050. int getNumberOfMultipleClicks() const throw();
  18051. const Time getLastMouseDownTime() const throw();
  18052. const Point<int> getLastMouseDownPosition() const throw();
  18053. bool hasMouseMovedSignificantlySincePressed() const throw();
  18054. bool hasMouseCursor() const throw();
  18055. void showMouseCursor (const MouseCursor& cursor);
  18056. void hideCursor();
  18057. void revealCursor();
  18058. void forceMouseCursorUpdate();
  18059. bool canDoUnboundedMovement() const throw();
  18060. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  18061. juce_UseDebuggingNewOperator
  18062. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  18063. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18064. private:
  18065. friend class Desktop;
  18066. friend class ComponentPeer;
  18067. friend class MouseInputSourceInternal;
  18068. ScopedPointer<MouseInputSourceInternal> pimpl;
  18069. MouseInputSource (const MouseInputSource&);
  18070. MouseInputSource& operator= (const MouseInputSource&);
  18071. };
  18072. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  18073. /*** End of inlined file: juce_MouseInputSource.h ***/
  18074. #endif
  18075. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  18076. #endif
  18077. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  18078. #endif
  18079. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18080. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  18081. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18082. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18083. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  18084. private ButtonListener
  18085. {
  18086. protected:
  18087. BooleanPropertyComponent (const String& propertyName,
  18088. const String& buttonTextWhenTrue,
  18089. const String& buttonTextWhenFalse);
  18090. public:
  18091. BooleanPropertyComponent (const Value& valueToControl,
  18092. const String& propertyName,
  18093. const String& buttonText);
  18094. ~BooleanPropertyComponent();
  18095. virtual void setState (bool newState);
  18096. virtual bool getState() const;
  18097. void paint (Graphics& g);
  18098. void refresh();
  18099. void buttonClicked (Button*);
  18100. juce_UseDebuggingNewOperator
  18101. private:
  18102. ToggleButton* button;
  18103. String onText, offText;
  18104. void createButton();
  18105. BooleanPropertyComponent (const BooleanPropertyComponent&);
  18106. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  18107. };
  18108. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  18109. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  18110. #endif
  18111. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18112. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  18113. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18114. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18115. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  18116. private ButtonListener
  18117. {
  18118. public:
  18119. ButtonPropertyComponent (const String& propertyName,
  18120. bool triggerOnMouseDown);
  18121. ~ButtonPropertyComponent();
  18122. virtual void buttonClicked() = 0;
  18123. virtual const String getButtonText() const = 0;
  18124. void refresh();
  18125. void buttonClicked (Button*);
  18126. juce_UseDebuggingNewOperator
  18127. private:
  18128. TextButton* button;
  18129. ButtonPropertyComponent (const ButtonPropertyComponent&);
  18130. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  18131. };
  18132. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  18133. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  18134. #endif
  18135. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18136. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  18137. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18138. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18139. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  18140. private ComboBoxListener
  18141. {
  18142. protected:
  18143. ChoicePropertyComponent (const String& propertyName);
  18144. public:
  18145. ChoicePropertyComponent (const Value& valueToControl,
  18146. const String& propertyName,
  18147. const StringArray& choices,
  18148. const Array <int>* choiceIDs = 0);
  18149. ~ChoicePropertyComponent();
  18150. virtual void setIndex (int newIndex);
  18151. virtual int getIndex() const;
  18152. const StringArray& getChoices() const;
  18153. void refresh();
  18154. void comboBoxChanged (ComboBox*);
  18155. juce_UseDebuggingNewOperator
  18156. protected:
  18157. StringArray choices;
  18158. private:
  18159. ComboBox* comboBox;
  18160. void createComboBox (const Array <int>* choiceIDs);
  18161. ChoicePropertyComponent (const ChoicePropertyComponent&);
  18162. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  18163. };
  18164. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18165. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  18166. #endif
  18167. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  18168. #endif
  18169. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  18170. #endif
  18171. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18172. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  18173. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18174. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18175. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  18176. private SliderListener
  18177. {
  18178. protected:
  18179. SliderPropertyComponent (const String& propertyName,
  18180. double rangeMin,
  18181. double rangeMax,
  18182. double interval,
  18183. double skewFactor = 1.0);
  18184. public:
  18185. SliderPropertyComponent (const Value& valueToControl,
  18186. const String& propertyName,
  18187. double rangeMin,
  18188. double rangeMax,
  18189. double interval,
  18190. double skewFactor = 1.0);
  18191. ~SliderPropertyComponent();
  18192. virtual void setValue (double newValue);
  18193. virtual double getValue() const;
  18194. void refresh();
  18195. void changeListenerCallback (void*);
  18196. void sliderValueChanged (Slider*);
  18197. juce_UseDebuggingNewOperator
  18198. protected:
  18199. Slider* slider;
  18200. SliderPropertyComponent (const SliderPropertyComponent&);
  18201. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18202. };
  18203. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18204. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18205. #endif
  18206. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18207. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18208. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18209. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18210. class JUCE_API TextPropertyComponent : public PropertyComponent
  18211. {
  18212. protected:
  18213. TextPropertyComponent (const String& propertyName,
  18214. int maxNumChars,
  18215. bool isMultiLine);
  18216. public:
  18217. TextPropertyComponent (const Value& valueToControl,
  18218. const String& propertyName,
  18219. int maxNumChars,
  18220. bool isMultiLine);
  18221. ~TextPropertyComponent();
  18222. virtual void setText (const String& newText);
  18223. virtual const String getText() const;
  18224. void refresh();
  18225. void textWasEdited();
  18226. juce_UseDebuggingNewOperator
  18227. private:
  18228. Label* textEditor;
  18229. void createEditor (int maxNumChars, bool isMultiLine);
  18230. TextPropertyComponent (const TextPropertyComponent&);
  18231. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18232. };
  18233. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18234. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18235. #endif
  18236. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18237. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18238. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18239. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18240. #if JUCE_WINDOWS || DOXYGEN
  18241. class JUCE_API ActiveXControlComponent : public Component
  18242. {
  18243. public:
  18244. ActiveXControlComponent();
  18245. ~ActiveXControlComponent();
  18246. bool createControl (const void* controlIID);
  18247. void deleteControl();
  18248. bool isControlOpen() const throw() { return control != 0; }
  18249. void* queryInterface (const void* iid) const;
  18250. void setMouseEventsAllowed (bool eventsCanReachControl);
  18251. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18252. void paint (Graphics& g);
  18253. void* originalWndProc;
  18254. juce_UseDebuggingNewOperator
  18255. private:
  18256. class Pimpl;
  18257. friend class Pimpl;
  18258. friend class ScopedPointer <Pimpl>;
  18259. ScopedPointer <Pimpl> control;
  18260. bool mouseEventsAllowed;
  18261. void setControlBounds (const Rectangle<int>& bounds) const;
  18262. void setControlVisible (bool b) const;
  18263. ActiveXControlComponent (const ActiveXControlComponent&);
  18264. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18265. };
  18266. #endif
  18267. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18268. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18269. #endif
  18270. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18271. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18272. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18273. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18274. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18275. public ComboBoxListener,
  18276. public ButtonListener,
  18277. public ChangeListener
  18278. {
  18279. public:
  18280. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18281. const int minAudioInputChannels,
  18282. const int maxAudioInputChannels,
  18283. const int minAudioOutputChannels,
  18284. const int maxAudioOutputChannels,
  18285. const bool showMidiInputOptions,
  18286. const bool showMidiOutputSelector,
  18287. const bool showChannelsAsStereoPairs,
  18288. const bool hideAdvancedOptionsWithButton);
  18289. ~AudioDeviceSelectorComponent();
  18290. void resized();
  18291. void comboBoxChanged (ComboBox*);
  18292. void buttonClicked (Button*);
  18293. void changeListenerCallback (void*);
  18294. void childBoundsChanged (Component*);
  18295. juce_UseDebuggingNewOperator
  18296. private:
  18297. AudioDeviceManager& deviceManager;
  18298. ComboBox* deviceTypeDropDown;
  18299. Label* deviceTypeDropDownLabel;
  18300. Component* audioDeviceSettingsComp;
  18301. String audioDeviceSettingsCompType;
  18302. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18303. const bool showChannelsAsStereoPairs;
  18304. const bool hideAdvancedOptionsWithButton;
  18305. class MidiInputSelectorComponentListBox;
  18306. MidiInputSelectorComponentListBox* midiInputsList;
  18307. Label* midiInputsLabel;
  18308. ComboBox* midiOutputSelector;
  18309. Label* midiOutputLabel;
  18310. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18311. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18312. };
  18313. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18314. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18315. #endif
  18316. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18317. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18318. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18319. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18320. class JUCE_API BubbleComponent : public Component
  18321. {
  18322. protected:
  18323. BubbleComponent();
  18324. public:
  18325. ~BubbleComponent();
  18326. enum BubblePlacement
  18327. {
  18328. above = 1,
  18329. below = 2,
  18330. left = 4,
  18331. right = 8
  18332. };
  18333. void setAllowedPlacement (int newPlacement);
  18334. void setPosition (Component* componentToPointTo);
  18335. void setPosition (int arrowTipX,
  18336. int arrowTipY);
  18337. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18338. protected:
  18339. virtual void getContentSize (int& width, int& height) = 0;
  18340. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18341. public:
  18342. void paint (Graphics& g);
  18343. juce_UseDebuggingNewOperator
  18344. private:
  18345. Rectangle<int> content;
  18346. int side, allowablePlacements;
  18347. float arrowTipX, arrowTipY;
  18348. DropShadowEffect shadow;
  18349. BubbleComponent (const BubbleComponent&);
  18350. BubbleComponent& operator= (const BubbleComponent&);
  18351. };
  18352. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18353. /*** End of inlined file: juce_BubbleComponent.h ***/
  18354. #endif
  18355. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18356. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18357. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18358. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18359. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18360. private Timer
  18361. {
  18362. public:
  18363. BubbleMessageComponent (int fadeOutLengthMs = 150);
  18364. ~BubbleMessageComponent();
  18365. void showAt (int x, int y,
  18366. const String& message,
  18367. int numMillisecondsBeforeRemoving,
  18368. bool removeWhenMouseClicked = true,
  18369. bool deleteSelfAfterUse = false);
  18370. void showAt (Component* component,
  18371. const String& message,
  18372. int numMillisecondsBeforeRemoving,
  18373. bool removeWhenMouseClicked = true,
  18374. bool deleteSelfAfterUse = false);
  18375. void getContentSize (int& w, int& h);
  18376. void paintContent (Graphics& g, int w, int h);
  18377. void timerCallback();
  18378. juce_UseDebuggingNewOperator
  18379. private:
  18380. int fadeOutLength, mouseClickCounter;
  18381. TextLayout textLayout;
  18382. int64 expiryTime;
  18383. bool deleteAfterUse;
  18384. void init (int numMillisecondsBeforeRemoving,
  18385. bool removeWhenMouseClicked,
  18386. bool deleteSelfAfterUse);
  18387. BubbleMessageComponent (const BubbleMessageComponent&);
  18388. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18389. };
  18390. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18391. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18392. #endif
  18393. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18394. /*** Start of inlined file: juce_ColourSelector.h ***/
  18395. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18396. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18397. class JUCE_API ColourSelector : public Component,
  18398. public ChangeBroadcaster,
  18399. protected SliderListener
  18400. {
  18401. public:
  18402. enum ColourSelectorOptions
  18403. {
  18404. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18405. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18406. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18407. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18408. };
  18409. ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18410. int edgeGap = 4,
  18411. int gapAroundColourSpaceComponent = 7);
  18412. ~ColourSelector();
  18413. const Colour getCurrentColour() const;
  18414. void setCurrentColour (const Colour& newColour);
  18415. virtual int getNumSwatches() const;
  18416. virtual const Colour getSwatchColour (int index) const;
  18417. virtual void setSwatchColour (int index, const Colour& newColour) const;
  18418. enum ColourIds
  18419. {
  18420. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18421. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18422. };
  18423. juce_UseDebuggingNewOperator
  18424. private:
  18425. class ColourSpaceView;
  18426. class HueSelectorComp;
  18427. class SwatchComponent;
  18428. friend class ColourSpaceView;
  18429. friend class HueSelectorComp;
  18430. Colour colour;
  18431. float h, s, v;
  18432. Slider* sliders[4];
  18433. ColourSpaceView* colourSpace;
  18434. HueSelectorComp* hueSelector;
  18435. OwnedArray <SwatchComponent> swatchComponents;
  18436. const int flags;
  18437. int topSpace, edgeGap;
  18438. void setHue (float newH);
  18439. void setSV (float newS, float newV);
  18440. void updateHSV();
  18441. void update();
  18442. void sliderValueChanged (Slider*);
  18443. void paint (Graphics& g);
  18444. void resized();
  18445. ColourSelector (const ColourSelector&);
  18446. ColourSelector& operator= (const ColourSelector&);
  18447. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18448. // have changed - if you get an error here, update your code to use the new constructor instead..
  18449. // (xxx - note to self: remember to remove this at some point in the future)
  18450. ColourSelector (bool);
  18451. };
  18452. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18453. /*** End of inlined file: juce_ColourSelector.h ***/
  18454. #endif
  18455. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18456. #endif
  18457. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18458. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18459. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18460. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18461. class JUCE_API MagnifierComponent : public Component
  18462. {
  18463. public:
  18464. MagnifierComponent (Component* contentComponent,
  18465. bool deleteContentCompWhenNoLongerNeeded);
  18466. ~MagnifierComponent();
  18467. Component* getContentComponent() const { return content; }
  18468. void setScaleFactor (double newScaleFactor);
  18469. double getScaleFactor() const { return scaleFactor; }
  18470. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18471. juce_UseDebuggingNewOperator
  18472. void childBoundsChanged (Component*);
  18473. private:
  18474. Component* content;
  18475. Component* holderComp;
  18476. double scaleFactor;
  18477. ComponentPeer* peer;
  18478. bool deleteContent;
  18479. Graphics::ResamplingQuality quality;
  18480. MouseInputSource mouseSource;
  18481. void paint (Graphics& g);
  18482. void mouseDown (const MouseEvent& e);
  18483. void mouseUp (const MouseEvent& e);
  18484. void mouseDrag (const MouseEvent& e);
  18485. void mouseMove (const MouseEvent& e);
  18486. void mouseEnter (const MouseEvent& e);
  18487. void mouseExit (const MouseEvent& e);
  18488. void mouseWheelMove (const MouseEvent& e, float, float);
  18489. void passOnMouseEventToPeer (const MouseEvent& e);
  18490. int scaleInt (int n) const;
  18491. MagnifierComponent (const MagnifierComponent&);
  18492. MagnifierComponent& operator= (const MagnifierComponent&);
  18493. };
  18494. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18495. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18496. #endif
  18497. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18498. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18499. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18500. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18501. class JUCE_API MidiKeyboardComponent : public Component,
  18502. public MidiKeyboardStateListener,
  18503. public ChangeBroadcaster,
  18504. private Timer,
  18505. private AsyncUpdater
  18506. {
  18507. public:
  18508. enum Orientation
  18509. {
  18510. horizontalKeyboard,
  18511. verticalKeyboardFacingLeft,
  18512. verticalKeyboardFacingRight,
  18513. };
  18514. MidiKeyboardComponent (MidiKeyboardState& state,
  18515. Orientation orientation);
  18516. ~MidiKeyboardComponent();
  18517. void setVelocity (float velocity, bool useMousePositionForVelocity);
  18518. void setMidiChannel (int midiChannelNumber);
  18519. int getMidiChannel() const throw() { return midiChannel; }
  18520. void setMidiChannelsToDisplay (int midiChannelMask);
  18521. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18522. void setKeyWidth (float widthInPixels);
  18523. float getKeyWidth() const throw() { return keyWidth; }
  18524. void setOrientation (Orientation newOrientation);
  18525. const Orientation getOrientation() const throw() { return orientation; }
  18526. void setAvailableRange (int lowestNote,
  18527. int highestNote);
  18528. int getRangeStart() const throw() { return rangeStart; }
  18529. int getRangeEnd() const throw() { return rangeEnd; }
  18530. void setLowestVisibleKey (int noteNumber);
  18531. int getLowestVisibleKey() const throw() { return firstKey; }
  18532. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18533. void setScrollButtonsVisible (bool canScroll);
  18534. enum ColourIds
  18535. {
  18536. whiteNoteColourId = 0x1005000,
  18537. blackNoteColourId = 0x1005001,
  18538. keySeparatorLineColourId = 0x1005002,
  18539. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18540. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18541. textLabelColourId = 0x1005005,
  18542. upDownButtonBackgroundColourId = 0x1005006,
  18543. upDownButtonArrowColourId = 0x1005007
  18544. };
  18545. int getKeyStartPosition (const int midiNoteNumber) const;
  18546. void clearKeyMappings();
  18547. void setKeyPressForNote (const KeyPress& key,
  18548. int midiNoteOffsetFromC);
  18549. void removeKeyPressForNote (int midiNoteOffsetFromC);
  18550. void setKeyPressBaseOctave (int newOctaveNumber);
  18551. void setOctaveForMiddleC (int octaveNumForMiddleC);
  18552. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18553. void paint (Graphics& g);
  18554. void resized();
  18555. void mouseMove (const MouseEvent& e);
  18556. void mouseDrag (const MouseEvent& e);
  18557. void mouseDown (const MouseEvent& e);
  18558. void mouseUp (const MouseEvent& e);
  18559. void mouseEnter (const MouseEvent& e);
  18560. void mouseExit (const MouseEvent& e);
  18561. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18562. void timerCallback();
  18563. bool keyStateChanged (bool isKeyDown);
  18564. void focusLost (FocusChangeType cause);
  18565. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18566. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18567. void handleAsyncUpdate();
  18568. void colourChanged();
  18569. juce_UseDebuggingNewOperator
  18570. protected:
  18571. friend class MidiKeyboardUpDownButton;
  18572. virtual void drawWhiteNote (int midiNoteNumber,
  18573. Graphics& g,
  18574. int x, int y, int w, int h,
  18575. bool isDown, bool isOver,
  18576. const Colour& lineColour,
  18577. const Colour& textColour);
  18578. virtual void drawBlackNote (int midiNoteNumber,
  18579. Graphics& g,
  18580. int x, int y, int w, int h,
  18581. bool isDown, bool isOver,
  18582. const Colour& noteFillColour);
  18583. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18584. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18585. const bool isMouseOver,
  18586. const bool isButtonPressed,
  18587. const bool movesOctavesUp);
  18588. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18589. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18590. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18591. int& x, int& w) const;
  18592. private:
  18593. MidiKeyboardState& state;
  18594. int xOffset, blackNoteLength;
  18595. float keyWidth;
  18596. Orientation orientation;
  18597. int midiChannel, midiInChannelMask;
  18598. float velocity;
  18599. int noteUnderMouse, mouseDownNote;
  18600. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18601. int rangeStart, rangeEnd, firstKey;
  18602. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18603. Button* scrollDown;
  18604. Button* scrollUp;
  18605. Array <KeyPress> keyPresses;
  18606. Array <int> keyPressNotes;
  18607. int keyMappingOctave;
  18608. int octaveNumForMiddleC;
  18609. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18610. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18611. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18612. void resetAnyKeysInUse();
  18613. void updateNoteUnderMouse (const Point<int>& pos);
  18614. void repaintNote (const int midiNoteNumber);
  18615. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18616. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18617. };
  18618. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18619. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18620. #endif
  18621. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18622. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18623. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18624. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18625. #if ! DOXYGEN
  18626. class NSViewComponentInternal;
  18627. #endif
  18628. #if JUCE_MAC || DOXYGEN
  18629. class JUCE_API NSViewComponent : public Component
  18630. {
  18631. public:
  18632. NSViewComponent();
  18633. ~NSViewComponent();
  18634. void setView (void* nsView);
  18635. void* getView() const;
  18636. void paint (Graphics& g);
  18637. juce_UseDebuggingNewOperator
  18638. private:
  18639. friend class NSViewComponentInternal;
  18640. ScopedPointer <NSViewComponentInternal> info;
  18641. NSViewComponent (const NSViewComponent&);
  18642. NSViewComponent& operator= (const NSViewComponent&);
  18643. };
  18644. #endif
  18645. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18646. /*** End of inlined file: juce_NSViewComponent.h ***/
  18647. #endif
  18648. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18649. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18650. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18651. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18652. // this is used to disable OpenGL, and is defined in juce_Config.h
  18653. #if JUCE_OPENGL || DOXYGEN
  18654. class JUCE_API OpenGLPixelFormat
  18655. {
  18656. public:
  18657. OpenGLPixelFormat (int bitsPerRGBComponent = 8,
  18658. int alphaBits = 8,
  18659. int depthBufferBits = 16,
  18660. int stencilBufferBits = 0);
  18661. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18662. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18663. bool operator== (const OpenGLPixelFormat&) const;
  18664. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18665. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18666. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18667. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18668. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18669. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18670. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18671. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18672. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18673. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18674. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18675. static void getAvailablePixelFormats (Component* component,
  18676. OwnedArray <OpenGLPixelFormat>& results);
  18677. juce_UseDebuggingNewOperator
  18678. };
  18679. class JUCE_API OpenGLContext
  18680. {
  18681. public:
  18682. virtual ~OpenGLContext();
  18683. virtual bool makeActive() const throw() = 0;
  18684. virtual bool makeInactive() const throw() = 0;
  18685. virtual bool isActive() const throw() = 0;
  18686. virtual void swapBuffers() = 0;
  18687. virtual bool setSwapInterval (int numFramesPerSwap) = 0;
  18688. virtual int getSwapInterval() const = 0;
  18689. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18690. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18691. virtual void repaint() = 0;
  18692. virtual void* getRawContext() const throw() = 0;
  18693. static OpenGLContext* getCurrentContext();
  18694. juce_UseDebuggingNewOperator
  18695. protected:
  18696. OpenGLContext() throw();
  18697. };
  18698. class JUCE_API OpenGLComponent : public Component
  18699. {
  18700. public:
  18701. enum OpenGLType
  18702. {
  18703. openGLDefault = 0,
  18704. #if JUCE_IPHONE
  18705. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18706. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18707. #endif
  18708. };
  18709. OpenGLComponent (OpenGLType type = openGLDefault);
  18710. ~OpenGLComponent();
  18711. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18712. const OpenGLPixelFormat getPixelFormat() const;
  18713. void shareWith (OpenGLContext* contextToShareListsWith);
  18714. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18715. void swapBuffers();
  18716. virtual void renderOpenGL() = 0;
  18717. virtual void newOpenGLContextCreated() = 0;
  18718. OpenGLContext* getCurrentContext() const throw() { return context; }
  18719. bool makeCurrentContextActive();
  18720. void makeCurrentContextInactive();
  18721. bool isActiveContext() const throw();
  18722. virtual bool renderAndSwapBuffers();
  18723. CriticalSection& getContextLock() throw() { return contextLock; }
  18724. void paint (Graphics& g);
  18725. void* getNativeWindowHandle() const;
  18726. juce_UseDebuggingNewOperator
  18727. private:
  18728. const OpenGLType type;
  18729. class OpenGLComponentWatcher;
  18730. friend class OpenGLComponentWatcher;
  18731. friend class ScopedPointer <OpenGLComponentWatcher>;
  18732. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18733. ScopedPointer <OpenGLContext> context;
  18734. OpenGLContext* contextToShareListsWith;
  18735. CriticalSection contextLock;
  18736. OpenGLPixelFormat preferredPixelFormat;
  18737. bool needToUpdateViewport;
  18738. OpenGLContext* createContext();
  18739. void deleteContext();
  18740. void updateContextPosition();
  18741. void internalRepaint (int x, int y, int w, int h);
  18742. OpenGLComponent (const OpenGLComponent&);
  18743. OpenGLComponent& operator= (const OpenGLComponent&);
  18744. };
  18745. #endif
  18746. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18747. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18748. #endif
  18749. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18750. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18751. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18752. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18753. class JUCE_API PreferencesPanel : public Component,
  18754. private ButtonListener
  18755. {
  18756. public:
  18757. PreferencesPanel();
  18758. ~PreferencesPanel();
  18759. void addSettingsPage (const String& pageTitle,
  18760. const Drawable* normalIcon,
  18761. const Drawable* overIcon,
  18762. const Drawable* downIcon);
  18763. void addSettingsPage (const String& pageTitle,
  18764. const char* imageData,
  18765. int imageDataSize);
  18766. void showInDialogBox (const String& dialogtitle,
  18767. int dialogWidth,
  18768. int dialogHeight,
  18769. const Colour& backgroundColour = Colours::white);
  18770. virtual Component* createComponentForPage (const String& pageName) = 0;
  18771. void setCurrentPage (const String& pageName);
  18772. void resized();
  18773. void paint (Graphics& g);
  18774. void buttonClicked (Button* button);
  18775. juce_UseDebuggingNewOperator
  18776. private:
  18777. String currentPageName;
  18778. ScopedPointer <Component> currentPage;
  18779. int buttonSize;
  18780. PreferencesPanel (const PreferencesPanel&);
  18781. PreferencesPanel& operator= (const PreferencesPanel&);
  18782. };
  18783. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18784. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18785. #endif
  18786. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18787. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18788. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18789. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18790. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18791. // amalgamated build)
  18792. #if JUCE_WINDOWS
  18793. typedef ActiveXControlComponent QTCompBaseClass;
  18794. #elif JUCE_MAC
  18795. typedef NSViewComponent QTCompBaseClass;
  18796. #endif
  18797. // this is used to disable QuickTime, and is defined in juce_Config.h
  18798. #if JUCE_QUICKTIME || DOXYGEN
  18799. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18800. {
  18801. public:
  18802. QuickTimeMovieComponent();
  18803. ~QuickTimeMovieComponent();
  18804. static bool isQuickTimeAvailable() throw();
  18805. bool loadMovie (const File& movieFile,
  18806. bool isControllerVisible);
  18807. bool loadMovie (const URL& movieURL,
  18808. bool isControllerVisible);
  18809. bool loadMovie (InputStream* movieStream,
  18810. bool isControllerVisible);
  18811. void closeMovie();
  18812. const File getCurrentMovieFile() const;
  18813. bool isMovieOpen() const;
  18814. double getMovieDuration() const;
  18815. void getMovieNormalSize (int& width, int& height) const;
  18816. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18817. const RectanglePlacement& placement);
  18818. void play();
  18819. void stop();
  18820. bool isPlaying() const;
  18821. void goToStart();
  18822. void setPosition (double seconds);
  18823. double getPosition() const;
  18824. void setSpeed (float newSpeed);
  18825. void setMovieVolume (float newVolume);
  18826. float getMovieVolume() const;
  18827. void setLooping (bool shouldLoop);
  18828. bool isLooping() const;
  18829. bool isControllerVisible() const;
  18830. void paint (Graphics& g);
  18831. juce_UseDebuggingNewOperator
  18832. private:
  18833. File movieFile;
  18834. bool movieLoaded, controllerVisible, looping;
  18835. #if JUCE_WINDOWS
  18836. void parentHierarchyChanged();
  18837. void visibilityChanged();
  18838. void createControlIfNeeded();
  18839. bool isControlCreated() const;
  18840. class Pimpl;
  18841. friend class ScopedPointer <Pimpl>;
  18842. ScopedPointer <Pimpl> pimpl;
  18843. #else
  18844. void* movie;
  18845. #endif
  18846. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18847. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18848. };
  18849. #endif
  18850. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18851. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18852. #endif
  18853. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18854. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18855. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18856. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18857. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18858. class JUCE_API SystemTrayIconComponent : public Component
  18859. {
  18860. public:
  18861. SystemTrayIconComponent();
  18862. ~SystemTrayIconComponent();
  18863. void setIconImage (const Image& newImage);
  18864. void setIconTooltip (const String& tooltip);
  18865. #if JUCE_LINUX
  18866. void paint (Graphics& g);
  18867. #endif
  18868. juce_UseDebuggingNewOperator
  18869. private:
  18870. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18871. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18872. };
  18873. #endif
  18874. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18875. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18876. #endif
  18877. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18878. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18879. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18880. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18881. #if JUCE_WEB_BROWSER || DOXYGEN
  18882. #if ! DOXYGEN
  18883. class WebBrowserComponentInternal;
  18884. #endif
  18885. class JUCE_API WebBrowserComponent : public Component
  18886. {
  18887. public:
  18888. explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true);
  18889. ~WebBrowserComponent();
  18890. void goToURL (const String& url,
  18891. const StringArray* headers = 0,
  18892. const MemoryBlock* postData = 0);
  18893. void stop();
  18894. void goBack();
  18895. void goForward();
  18896. void refresh();
  18897. virtual bool pageAboutToLoad (const String& newURL);
  18898. void paint (Graphics& g);
  18899. void resized();
  18900. void parentHierarchyChanged();
  18901. void visibilityChanged();
  18902. juce_UseDebuggingNewOperator
  18903. private:
  18904. WebBrowserComponentInternal* browser;
  18905. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18906. String lastURL;
  18907. StringArray lastHeaders;
  18908. MemoryBlock lastPostData;
  18909. void reloadLastURL();
  18910. void checkWindowAssociation();
  18911. WebBrowserComponent (const WebBrowserComponent&);
  18912. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18913. };
  18914. #endif
  18915. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18916. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18917. #endif
  18918. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18919. #endif
  18920. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18921. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18922. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18923. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18924. class ComponentBoundsConstrainer;
  18925. class JUCE_API ComponentPeer
  18926. {
  18927. public:
  18928. enum StyleFlags
  18929. {
  18930. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18931. entry on the taskbar (ignored on MacOSX) */
  18932. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18933. tooltip, etc. */
  18934. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18935. through it (may not be possible on some platforms). */
  18936. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18937. title bar and frame\. if not specified, the window will be
  18938. borderless. */
  18939. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18940. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18941. minimise button on it. */
  18942. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18943. maximise button on it. */
  18944. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18945. close button on it. */
  18946. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18947. not be possible on all platforms). */
  18948. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18949. do its own repainting, but only to repaint when the
  18950. performAnyPendingRepaintsNow() method is called. */
  18951. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18952. be used for things like plugin windows, to stop them interfering
  18953. with the host's shortcut keys */
  18954. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18955. };
  18956. ComponentPeer (Component* component, int styleFlags);
  18957. virtual ~ComponentPeer();
  18958. Component* getComponent() const throw() { return component; }
  18959. int getStyleFlags() const throw() { return styleFlags; }
  18960. virtual void* getNativeHandle() const = 0;
  18961. virtual void setVisible (bool shouldBeVisible) = 0;
  18962. virtual void setTitle (const String& title) = 0;
  18963. virtual void setPosition (int x, int y) = 0;
  18964. virtual void setSize (int w, int h) = 0;
  18965. virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0;
  18966. virtual const Rectangle<int> getBounds() const = 0;
  18967. virtual const Point<int> getScreenPosition() const = 0;
  18968. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18969. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18970. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18971. virtual bool isMinimised() const = 0;
  18972. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18973. virtual bool isFullScreen() const = 0;
  18974. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18975. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18976. virtual void setIcon (const Image& newIcon) = 0;
  18977. void setConstrainer (ComponentBoundsConstrainer* newConstrainer) throw();
  18978. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18979. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18980. virtual const BorderSize getFrameSize() const = 0;
  18981. void handleMovedOrResized();
  18982. void handleScreenSizeChange();
  18983. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18984. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18985. virtual void toFront (bool makeActive) = 0;
  18986. virtual void toBehind (ComponentPeer* other) = 0;
  18987. void handleBroughtToFront();
  18988. virtual bool isFocused() const = 0;
  18989. virtual void grabFocus() = 0;
  18990. virtual void textInputRequired (const Point<int>& position) = 0;
  18991. void handleFocusGain();
  18992. void handleFocusLoss();
  18993. Component* getLastFocusedSubcomponent() const throw();
  18994. bool handleKeyPress (int keyCode,
  18995. juce_wchar textCharacter);
  18996. bool handleKeyUpOrDown (bool isKeyDown);
  18997. void handleModifierKeysChange();
  18998. TextInputTarget* findCurrentTextInputTarget();
  18999. virtual void repaint (int x, int y, int w, int h) = 0;
  19000. virtual void performAnyPendingRepaintsNow() = 0;
  19001. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
  19002. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  19003. void handleUserClosingWindow();
  19004. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  19005. void handleFileDragExit (const StringArray& files);
  19006. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  19007. void clearMaskedRegion();
  19008. void addMaskedRegion (int x, int y, int w, int h);
  19009. static int getNumPeers() throw();
  19010. static ComponentPeer* getPeer (int index) throw();
  19011. static bool isValidPeer (const ComponentPeer* peer) throw();
  19012. static void bringModalComponentToFront();
  19013. virtual const StringArray getAvailableRenderingEngines() throw();
  19014. virtual int getCurrentRenderingEngine() throw();
  19015. virtual void setCurrentRenderingEngine (int index) throw();
  19016. juce_UseDebuggingNewOperator
  19017. protected:
  19018. Component* const component;
  19019. const int styleFlags;
  19020. RectangleList maskedRegion;
  19021. Rectangle<int> lastNonFullscreenBounds;
  19022. uint32 lastPaintTime;
  19023. ComponentBoundsConstrainer* constrainer;
  19024. static void updateCurrentModifiers() throw();
  19025. private:
  19026. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  19027. Component* lastDragAndDropCompUnderMouse;
  19028. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  19029. friend class Component;
  19030. static ComponentPeer* getPeerFor (const Component* component) throw();
  19031. void setLastDragDropTarget (Component* comp);
  19032. ComponentPeer (const ComponentPeer&);
  19033. ComponentPeer& operator= (const ComponentPeer&);
  19034. };
  19035. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  19036. /*** End of inlined file: juce_ComponentPeer.h ***/
  19037. #endif
  19038. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  19039. /*** Start of inlined file: juce_DialogWindow.h ***/
  19040. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  19041. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  19042. class JUCE_API DialogWindow : public DocumentWindow
  19043. {
  19044. public:
  19045. DialogWindow (const String& name,
  19046. const Colour& backgroundColour,
  19047. bool escapeKeyTriggersCloseButton,
  19048. bool addToDesktop = true);
  19049. ~DialogWindow();
  19050. static int showModalDialog (const String& dialogTitle,
  19051. Component* contentComponent,
  19052. Component* componentToCentreAround,
  19053. const Colour& backgroundColour,
  19054. bool escapeKeyTriggersCloseButton,
  19055. bool shouldBeResizable = false,
  19056. bool useBottomRightCornerResizer = false);
  19057. juce_UseDebuggingNewOperator
  19058. protected:
  19059. void resized();
  19060. private:
  19061. bool escapeKeyTriggersCloseButton;
  19062. DialogWindow (const DialogWindow&);
  19063. DialogWindow& operator= (const DialogWindow&);
  19064. };
  19065. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  19066. /*** End of inlined file: juce_DialogWindow.h ***/
  19067. #endif
  19068. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  19069. #endif
  19070. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  19071. #endif
  19072. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  19073. /*** Start of inlined file: juce_SplashScreen.h ***/
  19074. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  19075. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  19076. class JUCE_API SplashScreen : public Component,
  19077. public Timer,
  19078. private DeletedAtShutdown
  19079. {
  19080. public:
  19081. SplashScreen();
  19082. ~SplashScreen();
  19083. void show (const String& title,
  19084. Image* backgroundImage,
  19085. int minimumTimeToDisplayFor,
  19086. bool useDropShadow,
  19087. bool removeOnMouseClick = true);
  19088. void show (const String& title,
  19089. int width,
  19090. int height,
  19091. int minimumTimeToDisplayFor,
  19092. bool useDropShadow,
  19093. bool removeOnMouseClick = true);
  19094. void paint (Graphics& g);
  19095. void timerCallback();
  19096. juce_UseDebuggingNewOperator
  19097. private:
  19098. Image* backgroundImage;
  19099. Time earliestTimeToDelete;
  19100. int originalClickCounter;
  19101. SplashScreen (const SplashScreen&);
  19102. SplashScreen& operator= (const SplashScreen&);
  19103. };
  19104. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  19105. /*** End of inlined file: juce_SplashScreen.h ***/
  19106. #endif
  19107. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19108. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  19109. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19110. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19111. class JUCE_API ThreadWithProgressWindow : public Thread,
  19112. private Timer
  19113. {
  19114. public:
  19115. ThreadWithProgressWindow (const String& windowTitle,
  19116. bool hasProgressBar,
  19117. bool hasCancelButton,
  19118. int timeOutMsWhenCancelling = 10000,
  19119. const String& cancelButtonText = "Cancel");
  19120. ~ThreadWithProgressWindow();
  19121. bool runThread (int threadPriority = 5);
  19122. void setProgress (double newProgress);
  19123. void setStatusMessage (const String& newStatusMessage);
  19124. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  19125. juce_UseDebuggingNewOperator
  19126. private:
  19127. void timerCallback();
  19128. double progress;
  19129. ScopedPointer <AlertWindow> alertWindow;
  19130. String message;
  19131. CriticalSection messageLock;
  19132. const int timeOutMsWhenCancelling;
  19133. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  19134. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  19135. };
  19136. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  19137. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  19138. #endif
  19139. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  19140. #endif
  19141. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  19142. #endif
  19143. #ifndef __JUCE_COLOUR_JUCEHEADER__
  19144. #endif
  19145. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  19146. #endif
  19147. #ifndef __JUCE_COLOURS_JUCEHEADER__
  19148. #endif
  19149. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  19150. #endif
  19151. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  19152. #endif
  19153. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  19154. #endif
  19155. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  19156. #endif
  19157. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  19158. #endif
  19159. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19160. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  19161. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19162. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19163. class JUCE_API LowLevelGraphicsContext
  19164. {
  19165. protected:
  19166. LowLevelGraphicsContext();
  19167. public:
  19168. virtual ~LowLevelGraphicsContext();
  19169. virtual bool isVectorDevice() const = 0;
  19170. virtual void setOrigin (int x, int y) = 0;
  19171. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  19172. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  19173. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  19174. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  19175. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  19176. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  19177. virtual const Rectangle<int> getClipBounds() const = 0;
  19178. virtual bool isClipEmpty() const = 0;
  19179. virtual void saveState() = 0;
  19180. virtual void restoreState() = 0;
  19181. virtual void setFill (const FillType& fillType) = 0;
  19182. virtual void setOpacity (float newOpacity) = 0;
  19183. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  19184. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  19185. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  19186. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19187. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  19188. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  19189. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  19190. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  19191. virtual void setFont (const Font& newFont) = 0;
  19192. virtual const Font getFont() = 0;
  19193. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  19194. };
  19195. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19196. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  19197. #endif
  19198. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19199. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19200. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19201. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19202. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  19203. {
  19204. public:
  19205. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19206. const String& documentTitle,
  19207. int totalWidth,
  19208. int totalHeight);
  19209. ~LowLevelGraphicsPostScriptRenderer();
  19210. bool isVectorDevice() const;
  19211. void setOrigin (int x, int y);
  19212. bool clipToRectangle (const Rectangle<int>& r);
  19213. bool clipToRectangleList (const RectangleList& clipRegion);
  19214. void excludeClipRectangle (const Rectangle<int>& r);
  19215. void clipToPath (const Path& path, const AffineTransform& transform);
  19216. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19217. void saveState();
  19218. void restoreState();
  19219. bool clipRegionIntersects (const Rectangle<int>& r);
  19220. const Rectangle<int> getClipBounds() const;
  19221. bool isClipEmpty() const;
  19222. void setFill (const FillType& fillType);
  19223. void setOpacity (float opacity);
  19224. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19225. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19226. void fillPath (const Path& path, const AffineTransform& transform);
  19227. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19228. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19229. void drawLine (double x1, double y1, double x2, double y2);
  19230. void drawVerticalLine (int x, double top, double bottom);
  19231. void drawHorizontalLine (int x, double top, double bottom);
  19232. const Font getFont();
  19233. void setFont (const Font& newFont);
  19234. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19235. juce_UseDebuggingNewOperator
  19236. protected:
  19237. OutputStream& out;
  19238. int totalWidth, totalHeight;
  19239. bool needToClip;
  19240. Colour lastColour;
  19241. struct SavedState
  19242. {
  19243. SavedState();
  19244. ~SavedState();
  19245. RectangleList clip;
  19246. int xOffset, yOffset;
  19247. FillType fillType;
  19248. Font font;
  19249. private:
  19250. SavedState& operator= (const SavedState&);
  19251. };
  19252. OwnedArray <SavedState> stateStack;
  19253. void writeClip();
  19254. void writeColour (const Colour& colour);
  19255. void writePath (const Path& path) const;
  19256. void writeXY (float x, float y) const;
  19257. void writeTransform (const AffineTransform& trans) const;
  19258. void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
  19259. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19260. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19261. };
  19262. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19263. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19264. #endif
  19265. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19266. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19267. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19268. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19269. class LLGCSavedState;
  19270. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19271. {
  19272. public:
  19273. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19274. ~LowLevelGraphicsSoftwareRenderer();
  19275. bool isVectorDevice() const;
  19276. void setOrigin (int x, int y);
  19277. bool clipToRectangle (const Rectangle<int>& r);
  19278. bool clipToRectangleList (const RectangleList& clipRegion);
  19279. void excludeClipRectangle (const Rectangle<int>& r);
  19280. void clipToPath (const Path& path, const AffineTransform& transform);
  19281. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19282. bool clipRegionIntersects (const Rectangle<int>& r);
  19283. const Rectangle<int> getClipBounds() const;
  19284. bool isClipEmpty() const;
  19285. void saveState();
  19286. void restoreState();
  19287. void setFill (const FillType& fillType);
  19288. void setOpacity (float opacity);
  19289. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19290. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19291. void fillPath (const Path& path, const AffineTransform& transform);
  19292. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19293. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19294. void drawLine (double x1, double y1, double x2, double y2);
  19295. void drawVerticalLine (int x, double top, double bottom);
  19296. void drawHorizontalLine (int x, double top, double bottom);
  19297. void setFont (const Font& newFont);
  19298. const Font getFont();
  19299. void drawGlyph (int glyphNumber, float x, float y);
  19300. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19301. juce_UseDebuggingNewOperator
  19302. protected:
  19303. Image& image;
  19304. ScopedPointer <LLGCSavedState> currentState;
  19305. OwnedArray <LLGCSavedState> stateStack;
  19306. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19307. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19308. };
  19309. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19310. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19311. #endif
  19312. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19313. #endif
  19314. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19315. #endif
  19316. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19317. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19318. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19319. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19320. class JUCE_API DrawableComposite : public Drawable
  19321. {
  19322. public:
  19323. DrawableComposite();
  19324. virtual ~DrawableComposite();
  19325. void insertDrawable (Drawable* drawable,
  19326. const AffineTransform& transform = AffineTransform::identity,
  19327. int index = -1);
  19328. void insertDrawable (const Drawable& drawable,
  19329. const AffineTransform& transform = AffineTransform::identity,
  19330. int index = -1);
  19331. void removeDrawable (int index, bool deleteDrawable = true);
  19332. int getNumDrawables() const throw() { return drawables.size(); }
  19333. Drawable* getDrawable (int index) const throw() { return drawables [index]; }
  19334. const AffineTransform* getDrawableTransform (int index) const throw() { return transforms [index]; }
  19335. void bringToFront (int index);
  19336. void render (const Drawable::RenderingContext& context) const;
  19337. const Rectangle<float> getBounds() const;
  19338. bool hitTest (float x, float y) const;
  19339. Drawable* createCopy() const;
  19340. ValueTree createValueTree() const;
  19341. static DrawableComposite* createFromValueTree (const ValueTree& tree);
  19342. juce_UseDebuggingNewOperator
  19343. private:
  19344. OwnedArray <Drawable> drawables;
  19345. OwnedArray <AffineTransform> transforms;
  19346. DrawableComposite (const DrawableComposite&);
  19347. DrawableComposite& operator= (const DrawableComposite&);
  19348. };
  19349. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19350. /*** End of inlined file: juce_DrawableComposite.h ***/
  19351. #endif
  19352. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19353. /*** Start of inlined file: juce_DrawableImage.h ***/
  19354. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19355. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19356. class JUCE_API DrawableImage : public Drawable
  19357. {
  19358. public:
  19359. DrawableImage();
  19360. virtual ~DrawableImage();
  19361. void setImage (const Image& imageToCopy);
  19362. void setImage (Image* imageToUse,
  19363. bool releaseWhenNotNeeded);
  19364. Image* getImage() const throw() { return image; }
  19365. void clearImage();
  19366. void setOpacity (float newOpacity);
  19367. float getOpacity() const throw() { return opacity; }
  19368. void setOverlayColour (const Colour& newOverlayColour);
  19369. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19370. void render (const Drawable::RenderingContext& context) const;
  19371. const Rectangle<float> getBounds() const;
  19372. bool hitTest (float x, float y) const;
  19373. Drawable* createCopy() const;
  19374. ValueTree createValueTree() const;
  19375. static DrawableImage* createFromValueTree (const ValueTree& tree);
  19376. juce_UseDebuggingNewOperator
  19377. private:
  19378. Image* image;
  19379. bool canDeleteImage;
  19380. float opacity;
  19381. Colour overlayColour;
  19382. DrawableImage (const DrawableImage&);
  19383. DrawableImage& operator= (const DrawableImage&);
  19384. };
  19385. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19386. /*** End of inlined file: juce_DrawableImage.h ***/
  19387. #endif
  19388. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19389. /*** Start of inlined file: juce_DrawablePath.h ***/
  19390. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19391. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19392. class JUCE_API DrawablePath : public Drawable
  19393. {
  19394. public:
  19395. DrawablePath();
  19396. virtual ~DrawablePath();
  19397. void setPath (const Path& newPath);
  19398. const Path& getPath() const throw() { return path; }
  19399. void setFill (const FillType& newFill);
  19400. const FillType& getFill() const throw() { return mainFill; }
  19401. void setStrokeFill (const FillType& newStrokeFill);
  19402. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19403. void setStrokeType (const PathStrokeType& newStrokeType);
  19404. void setStrokeThickness (float newThickness);
  19405. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19406. void render (const Drawable::RenderingContext& context) const;
  19407. const Rectangle<float> getBounds() const;
  19408. bool hitTest (float x, float y) const;
  19409. Drawable* createCopy() const;
  19410. ValueTree createValueTree() const;
  19411. static DrawablePath* createFromValueTree (const ValueTree& tree);
  19412. juce_UseDebuggingNewOperator
  19413. private:
  19414. Path path, stroke;
  19415. FillType mainFill, strokeFill;
  19416. PathStrokeType strokeType;
  19417. void updateOutline();
  19418. DrawablePath (const DrawablePath&);
  19419. DrawablePath& operator= (const DrawablePath&);
  19420. };
  19421. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19422. /*** End of inlined file: juce_DrawablePath.h ***/
  19423. #endif
  19424. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19425. /*** Start of inlined file: juce_DrawableText.h ***/
  19426. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19427. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19428. class JUCE_API DrawableText : public Drawable
  19429. {
  19430. public:
  19431. DrawableText();
  19432. virtual ~DrawableText();
  19433. void setText (const GlyphArrangement& newText);
  19434. void setText (const String& newText, const Font& fontToUse);
  19435. const GlyphArrangement& getText() const throw() { return text; }
  19436. void setColour (const Colour& newColour);
  19437. const Colour& getColour() const throw() { return colour; }
  19438. void render (const Drawable::RenderingContext& context) const;
  19439. const Rectangle<float> getBounds() const;
  19440. bool hitTest (float x, float y) const;
  19441. Drawable* createCopy() const;
  19442. ValueTree createValueTree() const;
  19443. static DrawableText* createFromValueTree (const ValueTree& tree);
  19444. juce_UseDebuggingNewOperator
  19445. private:
  19446. GlyphArrangement text;
  19447. Colour colour;
  19448. DrawableText (const DrawableText&);
  19449. DrawableText& operator= (const DrawableText&);
  19450. };
  19451. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19452. /*** End of inlined file: juce_DrawableText.h ***/
  19453. #endif
  19454. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19455. #endif
  19456. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19457. /*** Start of inlined file: juce_GlowEffect.h ***/
  19458. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19459. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19460. class JUCE_API GlowEffect : public ImageEffectFilter
  19461. {
  19462. public:
  19463. GlowEffect();
  19464. ~GlowEffect();
  19465. void setGlowProperties (const float newRadius,
  19466. const Colour& newColour);
  19467. void applyEffect (Image& sourceImage, Graphics& destContext);
  19468. juce_UseDebuggingNewOperator
  19469. private:
  19470. float radius;
  19471. Colour colour;
  19472. };
  19473. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19474. /*** End of inlined file: juce_GlowEffect.h ***/
  19475. #endif
  19476. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19477. #endif
  19478. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19479. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19480. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19481. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19482. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19483. {
  19484. public:
  19485. ReduceOpacityEffect (const float opacity = 1.0f);
  19486. ~ReduceOpacityEffect();
  19487. void setOpacity (const float newOpacity);
  19488. void applyEffect (Image& sourceImage, Graphics& destContext);
  19489. juce_UseDebuggingNewOperator
  19490. private:
  19491. float opacity;
  19492. };
  19493. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19494. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19495. #endif
  19496. #ifndef __JUCE_FONT_JUCEHEADER__
  19497. #endif
  19498. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19499. #endif
  19500. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19501. #endif
  19502. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19503. #endif
  19504. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19505. #endif
  19506. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19507. #endif
  19508. #ifndef __JUCE_LINE_JUCEHEADER__
  19509. #endif
  19510. #ifndef __JUCE_PATH_JUCEHEADER__
  19511. #endif
  19512. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19513. /*** Start of inlined file: juce_PathIterator.h ***/
  19514. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19515. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19516. class JUCE_API PathFlatteningIterator
  19517. {
  19518. public:
  19519. PathFlatteningIterator (const Path& path,
  19520. const AffineTransform& transform = AffineTransform::identity,
  19521. float tolerence = 6.0f);
  19522. ~PathFlatteningIterator();
  19523. bool next();
  19524. float x1;
  19525. float y1;
  19526. float x2;
  19527. float y2;
  19528. bool closesSubPath;
  19529. int subPathIndex;
  19530. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19531. && (index >= path.numElements
  19532. || points [index] == Path::moveMarker); }
  19533. juce_UseDebuggingNewOperator
  19534. private:
  19535. const Path& path;
  19536. const AffineTransform transform;
  19537. float* points;
  19538. float tolerence, subPathCloseX, subPathCloseY;
  19539. const bool isIdentityTransform;
  19540. HeapBlock <float> stackBase;
  19541. float* stackPos;
  19542. size_t index, stackSize;
  19543. PathFlatteningIterator (const PathFlatteningIterator&);
  19544. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19545. };
  19546. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19547. /*** End of inlined file: juce_PathIterator.h ***/
  19548. #endif
  19549. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19550. #endif
  19551. #ifndef __JUCE_POINT_JUCEHEADER__
  19552. #endif
  19553. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19554. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19555. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19556. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19557. class JUCE_API PositionedRectangle
  19558. {
  19559. public:
  19560. PositionedRectangle() throw();
  19561. PositionedRectangle (const String& stringVersion) throw();
  19562. PositionedRectangle (const PositionedRectangle& other) throw();
  19563. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19564. ~PositionedRectangle() throw();
  19565. const String toString() const throw();
  19566. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19567. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19568. double& x,
  19569. double& y,
  19570. double& width,
  19571. double& height) const throw();
  19572. void applyToComponent (Component& comp) const throw();
  19573. void updateFrom (const Rectangle<int>& newPosition,
  19574. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19575. void updateFromDouble (double x, double y, double width, double height,
  19576. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19577. void updateFromComponent (const Component& comp) throw();
  19578. enum AnchorPoint
  19579. {
  19580. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19581. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19582. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19583. };
  19584. enum PositionMode
  19585. {
  19586. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19587. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19588. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19589. 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. */
  19590. };
  19591. enum SizeMode
  19592. {
  19593. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19594. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19595. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19596. };
  19597. void setModes (const AnchorPoint xAnchorMode,
  19598. const PositionMode xPositionMode,
  19599. const AnchorPoint yAnchorMode,
  19600. const PositionMode yPositionMode,
  19601. const SizeMode widthMode,
  19602. const SizeMode heightMode,
  19603. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19604. AnchorPoint getAnchorPointX() const throw();
  19605. PositionMode getPositionModeX() const throw();
  19606. double getX() const throw() { return x; }
  19607. void setX (const double newX) throw() { x = newX; }
  19608. AnchorPoint getAnchorPointY() const throw();
  19609. PositionMode getPositionModeY() const throw();
  19610. double getY() const throw() { return y; }
  19611. void setY (const double newY) throw() { y = newY; }
  19612. SizeMode getWidthMode() const throw();
  19613. double getWidth() const throw() { return w; }
  19614. void setWidth (const double newWidth) throw() { w = newWidth; }
  19615. SizeMode getHeightMode() const throw();
  19616. double getHeight() const throw() { return h; }
  19617. void setHeight (const double newHeight) throw() { h = newHeight; }
  19618. bool isPositionAbsolute() const throw();
  19619. bool operator== (const PositionedRectangle& other) const throw();
  19620. bool operator!= (const PositionedRectangle& other) const throw();
  19621. juce_UseDebuggingNewOperator
  19622. private:
  19623. double x, y, w, h;
  19624. uint8 xMode, yMode, wMode, hMode;
  19625. void addPosDescription (String& result, uint8 mode, double value) const throw();
  19626. void addSizeDescription (String& result, uint8 mode, double value) const throw();
  19627. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19628. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19629. void applyPosAndSize (double& xOut, double& wOut, double x, double w,
  19630. uint8 xMode, uint8 wMode,
  19631. int parentPos, int parentSize) const throw();
  19632. void updatePosAndSize (double& xOut, double& wOut, double x, double w,
  19633. uint8 xMode, uint8 wMode,
  19634. int parentPos, int parentSize) const throw();
  19635. };
  19636. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19637. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19638. #endif
  19639. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19640. #endif
  19641. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19642. #endif
  19643. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19644. /*** Start of inlined file: juce_CameraDevice.h ***/
  19645. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19646. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19647. #if JUCE_USE_CAMERA
  19648. class CameraImageListener
  19649. {
  19650. public:
  19651. CameraImageListener() {}
  19652. virtual ~CameraImageListener() {}
  19653. virtual void imageReceived (Image& image) = 0;
  19654. };
  19655. class JUCE_API CameraDevice
  19656. {
  19657. public:
  19658. virtual ~CameraDevice();
  19659. static const StringArray getAvailableDevices();
  19660. static CameraDevice* openDevice (int deviceIndex,
  19661. int minWidth = 128, int minHeight = 64,
  19662. int maxWidth = 1024, int maxHeight = 768);
  19663. const String getName() const { return name; }
  19664. Component* createViewerComponent();
  19665. void startRecordingToFile (const File& file, int quality = 2);
  19666. void stopRecording();
  19667. static const String getFileExtension();
  19668. const Time getTimeOfFirstRecordedFrame() const;
  19669. void addListener (CameraImageListener* listenerToAdd);
  19670. void removeListener (CameraImageListener* listenerToRemove);
  19671. juce_UseDebuggingNewOperator
  19672. protected:
  19673. CameraDevice (const String& name, int index);
  19674. private:
  19675. void* internal;
  19676. bool isRecording;
  19677. String name;
  19678. CameraDevice (const CameraDevice&);
  19679. CameraDevice& operator= (const CameraDevice&);
  19680. };
  19681. #endif
  19682. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19683. /*** End of inlined file: juce_CameraDevice.h ***/
  19684. #endif
  19685. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19686. #endif
  19687. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19688. /*** Start of inlined file: juce_ImageCache.h ***/
  19689. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19690. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19691. class JUCE_API ImageCache : private DeletedAtShutdown,
  19692. private Timer
  19693. {
  19694. public:
  19695. static Image* getFromFile (const File& file);
  19696. static Image* getFromMemory (const void* imageData, int dataSize);
  19697. static void release (Image* imageToRelease);
  19698. static void releaseOrDelete (Image* imageToRelease);
  19699. static bool isImageInCache (Image* imageToLookFor);
  19700. static void incReferenceCount (Image* image);
  19701. static Image* getFromHashCode (int64 hashCode);
  19702. static void addImageToCache (Image* image, int64 hashCode);
  19703. static void setCacheTimeout (int millisecs);
  19704. juce_UseDebuggingNewOperator
  19705. private:
  19706. CriticalSection lock;
  19707. struct Item;
  19708. friend class ScopedPointer<Item>;
  19709. friend class OwnedArray<Item>;
  19710. OwnedArray<Item> images;
  19711. static ImageCache* instance;
  19712. static int cacheTimeout;
  19713. ImageCache();
  19714. ImageCache (const ImageCache&);
  19715. ImageCache& operator= (const ImageCache&);
  19716. ~ImageCache();
  19717. void timerCallback();
  19718. };
  19719. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19720. /*** End of inlined file: juce_ImageCache.h ***/
  19721. #endif
  19722. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19723. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19724. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19725. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19726. class JUCE_API ImageConvolutionKernel
  19727. {
  19728. public:
  19729. ImageConvolutionKernel (int size);
  19730. ~ImageConvolutionKernel();
  19731. void clear();
  19732. float getKernelValue (int x, int y) const throw();
  19733. void setKernelValue (int x, int y, float value) throw();
  19734. void setOverallSum (float desiredTotalSum);
  19735. void rescaleAllValues (float multiplier);
  19736. void createGaussianBlur (float blurRadius);
  19737. int getKernelSize() const { return size; }
  19738. void applyToImage (Image& destImage,
  19739. const Image* sourceImage,
  19740. const Rectangle<int>& destinationArea) const;
  19741. juce_UseDebuggingNewOperator
  19742. private:
  19743. HeapBlock <float> values;
  19744. const int size;
  19745. // no reason not to implement these one day..
  19746. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19747. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19748. };
  19749. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19750. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19751. #endif
  19752. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19753. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19754. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19755. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19756. class JUCE_API ImageFileFormat
  19757. {
  19758. protected:
  19759. ImageFileFormat() {}
  19760. public:
  19761. virtual ~ImageFileFormat() {}
  19762. virtual const String getFormatName() = 0;
  19763. virtual bool canUnderstand (InputStream& input) = 0;
  19764. virtual Image* decodeImage (InputStream& input) = 0;
  19765. virtual bool writeImageToStream (const Image& sourceImage,
  19766. OutputStream& destStream) = 0;
  19767. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19768. static Image* loadFrom (InputStream& input);
  19769. static Image* loadFrom (const File& file);
  19770. static Image* loadFrom (const void* rawData,
  19771. const int numBytesOfData);
  19772. };
  19773. class JUCE_API PNGImageFormat : public ImageFileFormat
  19774. {
  19775. public:
  19776. PNGImageFormat();
  19777. ~PNGImageFormat();
  19778. const String getFormatName();
  19779. bool canUnderstand (InputStream& input);
  19780. Image* decodeImage (InputStream& input);
  19781. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19782. };
  19783. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19784. {
  19785. public:
  19786. JPEGImageFormat();
  19787. ~JPEGImageFormat();
  19788. void setQuality (const float newQuality);
  19789. const String getFormatName();
  19790. bool canUnderstand (InputStream& input);
  19791. Image* decodeImage (InputStream& input);
  19792. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19793. private:
  19794. float quality;
  19795. };
  19796. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19797. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19798. #endif
  19799. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19800. #endif
  19801. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19802. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19803. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19804. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19805. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19806. {
  19807. public:
  19808. FileBasedDocument (const String& fileExtension,
  19809. const String& fileWildCard,
  19810. const String& openFileDialogTitle,
  19811. const String& saveFileDialogTitle);
  19812. virtual ~FileBasedDocument();
  19813. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19814. virtual void changed();
  19815. void setChangedFlag (bool hasChanged);
  19816. bool loadFrom (const File& fileToLoadFrom,
  19817. bool showMessageOnFailure);
  19818. bool loadFromUserSpecifiedFile (bool showMessageOnFailure);
  19819. enum SaveResult
  19820. {
  19821. savedOk = 0, /**< indicates that a file was saved successfully. */
  19822. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19823. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19824. };
  19825. SaveResult save (bool askUserForFileIfNotSpecified,
  19826. bool showMessageOnFailure);
  19827. SaveResult saveIfNeededAndUserAgrees();
  19828. SaveResult saveAs (const File& newFile,
  19829. bool warnAboutOverwritingExistingFiles,
  19830. bool askUserForFileIfNotSpecified,
  19831. bool showMessageOnFailure);
  19832. SaveResult saveAsInteractive (bool warnAboutOverwritingExistingFiles);
  19833. const File getFile() const { return documentFile; }
  19834. void setFile (const File& newFile);
  19835. protected:
  19836. virtual const String getDocumentTitle() = 0;
  19837. virtual const String loadDocument (const File& file) = 0;
  19838. virtual const String saveDocument (const File& file) = 0;
  19839. virtual const File getLastDocumentOpened() = 0;
  19840. virtual void setLastDocumentOpened (const File& file) = 0;
  19841. public:
  19842. juce_UseDebuggingNewOperator
  19843. private:
  19844. File documentFile;
  19845. bool changedSinceSave;
  19846. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19847. FileBasedDocument (const FileBasedDocument&);
  19848. FileBasedDocument& operator= (const FileBasedDocument&);
  19849. };
  19850. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19851. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19852. #endif
  19853. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19854. #endif
  19855. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19856. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19857. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19858. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19859. class JUCE_API RecentlyOpenedFilesList
  19860. {
  19861. public:
  19862. RecentlyOpenedFilesList();
  19863. ~RecentlyOpenedFilesList();
  19864. void setMaxNumberOfItems (int newMaxNumber);
  19865. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19866. int getNumFiles() const;
  19867. const File getFile (int index) const;
  19868. const StringArray& getAllFilenames() const throw() { return files; }
  19869. void clear();
  19870. void addFile (const File& file);
  19871. void removeNonExistentFiles();
  19872. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19873. int baseItemId,
  19874. bool showFullPaths,
  19875. bool dontAddNonExistentFiles,
  19876. const File** filesToAvoid = 0);
  19877. const String toString() const;
  19878. void restoreFromString (const String& stringifiedVersion);
  19879. juce_UseDebuggingNewOperator
  19880. private:
  19881. StringArray files;
  19882. int maxNumberOfItems;
  19883. };
  19884. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19885. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19886. #endif
  19887. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19888. #endif
  19889. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19890. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19891. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19892. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19893. class JUCE_API SystemClipboard
  19894. {
  19895. public:
  19896. static void copyTextToClipboard (const String& text);
  19897. static const String getTextFromClipboard();
  19898. };
  19899. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19900. /*** End of inlined file: juce_SystemClipboard.h ***/
  19901. #endif
  19902. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19903. #endif
  19904. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19905. #endif
  19906. #endif
  19907. /*** End of inlined file: juce_app_includes.h ***/
  19908. #endif
  19909. #if JUCE_MSVC
  19910. #pragma warning (pop)
  19911. #pragma pack (pop)
  19912. #endif
  19913. END_JUCE_NAMESPACE
  19914. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19915. #ifdef JUCE_NAMESPACE
  19916. // this will obviously save a lot of typing, but can be disabled by
  19917. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19918. using namespace JUCE_NAMESPACE;
  19919. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19920. #define Component JUCE_NAMESPACE::Component
  19921. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19922. #define Point JUCE_NAMESPACE::Point
  19923. #define Button JUCE_NAMESPACE::Button
  19924. #endif
  19925. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19926. #define Rectangle JUCE_NAMESPACE::Rectangle
  19927. #endif
  19928. #endif
  19929. #endif
  19930. #if JUCE_MSVC
  19931. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19932. #ifdef JUCE_DLL
  19933. #ifdef JUCE_DEBUG
  19934. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19935. #else
  19936. #define AUTOLINKEDLIB "JUCE.lib"
  19937. #endif
  19938. #else
  19939. #ifdef JUCE_DEBUG
  19940. #ifdef _WIN64
  19941. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19942. #else
  19943. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19944. #endif
  19945. #else
  19946. #ifdef _WIN64
  19947. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19948. #else
  19949. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19950. #endif
  19951. #endif
  19952. #endif
  19953. #pragma comment(lib, AUTOLINKEDLIB)
  19954. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19955. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19956. #endif
  19957. // Auto-link the other win32 libs that are needed by library calls..
  19958. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19959. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19960. // Auto-links to various win32 libs that are needed by library calls..
  19961. #pragma comment(lib, "kernel32.lib")
  19962. #pragma comment(lib, "user32.lib")
  19963. #pragma comment(lib, "shell32.lib")
  19964. #pragma comment(lib, "gdi32.lib")
  19965. #pragma comment(lib, "vfw32.lib")
  19966. #pragma comment(lib, "comdlg32.lib")
  19967. #pragma comment(lib, "winmm.lib")
  19968. #pragma comment(lib, "wininet.lib")
  19969. #pragma comment(lib, "ole32.lib")
  19970. #pragma comment(lib, "oleaut32.lib")
  19971. #pragma comment(lib, "advapi32.lib")
  19972. #pragma comment(lib, "ws2_32.lib")
  19973. #pragma comment(lib, "comsupp.lib")
  19974. #pragma comment(lib, "version.lib")
  19975. #if JUCE_OPENGL
  19976. #pragma comment(lib, "OpenGL32.Lib")
  19977. #pragma comment(lib, "GlU32.Lib")
  19978. #endif
  19979. #if JUCE_QUICKTIME
  19980. #pragma comment (lib, "QTMLClient.lib")
  19981. #endif
  19982. #if JUCE_USE_CAMERA
  19983. #pragma comment (lib, "Strmiids.lib")
  19984. #pragma comment (lib, "wmvcore.lib")
  19985. #endif
  19986. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19987. #endif
  19988. #endif
  19989. #endif
  19990. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19991. #define START_JUCE_APPLICATION(AppClass) \
  19992. int main (int argc, char* argv[]) \
  19993. { \
  19994. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19995. }
  19996. #elif JUCE_WINDOWS
  19997. #ifdef _CONSOLE
  19998. #define START_JUCE_APPLICATION(AppClass) \
  19999. int main (int, char* argv[]) \
  20000. { \
  20001. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20002. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20003. }
  20004. #elif ! defined (_AFXDLL)
  20005. #ifdef _WINDOWS_
  20006. #define START_JUCE_APPLICATION(AppClass) \
  20007. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  20008. { \
  20009. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20010. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20011. }
  20012. #else
  20013. #define START_JUCE_APPLICATION(AppClass) \
  20014. int __stdcall WinMain (int, int, const char*, int) \
  20015. { \
  20016. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  20017. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  20018. }
  20019. #endif
  20020. #endif
  20021. #endif
  20022. #endif // __JUCE_JUCEHEADER__
  20023. /*** End of inlined file: juce.h ***/
  20024. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__