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.

28806 lines
738KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  19. #define __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  20. #define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
  21. /*** Start of inlined file: juce.h ***/
  22. #ifndef __JUCE_JUCEHEADER__
  23. #define __JUCE_JUCEHEADER__
  24. #define JUCE_PUBLIC_INCLUDES 1
  25. // (this includes things that need defining outside of the JUCE namespace)
  26. /*** Start of inlined file: juce_StandardHeader.h ***/
  27. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  28. #define __JUCE_STANDARDHEADER_JUCEHEADER__
  29. #define JUCE_MAJOR_VERSION 1
  30. #define JUCE_MINOR_VERSION 51
  31. #define JUCE_BUILDNUMBER 15
  32. #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
  33. /*** Start of inlined file: juce_TargetPlatform.h ***/
  34. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  35. #define __JUCE_TARGETPLATFORM_JUCEHEADER__
  36. #if (defined (_WIN32) || defined (_WIN64))
  37. #define JUCE_WIN32 1
  38. #define JUCE_WINDOWS 1
  39. #elif defined (LINUX) || defined (__linux__)
  40. #define JUCE_LINUX 1
  41. #elif defined(__APPLE_CPP__) || defined(__APPLE_CC__)
  42. #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
  43. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
  44. #define JUCE_IPHONE 1
  45. #else
  46. #define JUCE_MAC 1
  47. #endif
  48. #else
  49. #error "Unknown platform!"
  50. #endif
  51. #if JUCE_WINDOWS
  52. #ifdef _MSC_VER
  53. #ifdef _WIN64
  54. #define JUCE_64BIT 1
  55. #else
  56. #define JUCE_32BIT 1
  57. #endif
  58. #endif
  59. #ifdef _DEBUG
  60. #define JUCE_DEBUG 1
  61. #endif
  62. #ifdef __MINGW32__
  63. #define JUCE_MINGW 1
  64. #endif
  65. #define JUCE_LITTLE_ENDIAN 1
  66. #define JUCE_INTEL 1
  67. #endif
  68. #if JUCE_MAC
  69. #ifndef NDEBUG
  70. #define JUCE_DEBUG 1
  71. #endif
  72. #ifdef __LITTLE_ENDIAN__
  73. #define JUCE_LITTLE_ENDIAN 1
  74. #else
  75. #define JUCE_BIG_ENDIAN 1
  76. #endif
  77. #if defined (__ppc__) || defined (__ppc64__)
  78. #define JUCE_PPC 1
  79. #undef MAC_OS_X_VERSION_MAX_ALLOWED
  80. #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_4
  81. #else
  82. #define JUCE_INTEL 1
  83. #endif
  84. #ifdef __LP64__
  85. #define JUCE_64BIT 1
  86. #else
  87. #define JUCE_32BIT 1
  88. #endif
  89. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  90. #error "Building for OSX 10.3 is no longer supported!"
  91. #endif
  92. #ifndef MAC_OS_X_VERSION_10_5
  93. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  94. #endif
  95. #endif
  96. #if JUCE_IPHONE
  97. #ifndef NDEBUG
  98. #define JUCE_DEBUG 1
  99. #endif
  100. #ifdef __LITTLE_ENDIAN__
  101. #define JUCE_LITTLE_ENDIAN 1
  102. #else
  103. #define JUCE_BIG_ENDIAN 1
  104. #endif
  105. #endif
  106. #if JUCE_LINUX
  107. #ifdef _DEBUG
  108. #define JUCE_DEBUG 1
  109. #endif
  110. // Allow override for big-endian Linux platforms
  111. #ifndef JUCE_BIG_ENDIAN
  112. #define JUCE_LITTLE_ENDIAN 1
  113. #endif
  114. #if defined (__LP64__) || defined (_LP64)
  115. #define JUCE_64BIT 1
  116. #else
  117. #define JUCE_32BIT 1
  118. #endif
  119. #define JUCE_INTEL 1
  120. #endif
  121. // Compiler type macros.
  122. #ifdef __GNUC__
  123. #define JUCE_GCC 1
  124. #elif defined (_MSC_VER)
  125. #define JUCE_MSVC 1
  126. #if _MSC_VER >= 1400
  127. #define JUCE_USE_INTRINSICS 1
  128. #endif
  129. #else
  130. #error unknown compiler
  131. #endif
  132. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  133. /*** End of inlined file: juce_TargetPlatform.h ***/
  134. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  135. /*** Start of inlined file: juce_Config.h ***/
  136. #ifndef __JUCE_CONFIG_JUCEHEADER__
  137. #define __JUCE_CONFIG_JUCEHEADER__
  138. #ifndef JUCE_NAMESPACE
  139. #define JUCE_NAMESPACE juce
  140. #endif
  141. #ifndef JUCE_FORCE_DEBUG
  142. //#define JUCE_FORCE_DEBUG 1
  143. #endif
  144. #ifndef JUCE_LOG_ASSERTIONS
  145. // #define JUCE_LOG_ASSERTIONS 1
  146. #endif
  147. #ifndef JUCE_ASIO
  148. #define JUCE_ASIO 0
  149. #endif
  150. #ifndef JUCE_WASAPI
  151. // #define JUCE_WASAPI 1
  152. #endif
  153. #ifndef JUCE_DIRECTSOUND
  154. #define JUCE_DIRECTSOUND 1
  155. #endif
  156. #ifndef JUCE_ALSA
  157. #define JUCE_ALSA 1
  158. #endif
  159. #ifndef JUCE_JACK
  160. #define JUCE_JACK 1
  161. #endif
  162. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  163. #define JUCE_QUICKTIME 0
  164. #endif
  165. #if (JUCE_IPHONE || JUCE_LINUX) && JUCE_QUICKTIME
  166. #undef JUCE_QUICKTIME
  167. #endif
  168. #ifndef JUCE_OPENGL
  169. #define JUCE_OPENGL 1
  170. #endif
  171. #ifndef JUCE_USE_FLAC
  172. #define JUCE_USE_FLAC 1
  173. #endif
  174. #ifndef JUCE_USE_OGGVORBIS
  175. #define JUCE_USE_OGGVORBIS 1
  176. #endif
  177. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  178. #define JUCE_USE_CDBURNER 0
  179. #endif
  180. #ifndef JUCE_USE_CDREADER
  181. #define JUCE_USE_CDREADER 1
  182. #endif
  183. #if (JUCE_QUICKTIME || JUCE_WINDOWS) && ! defined (JUCE_USE_CAMERA)
  184. // #define JUCE_USE_CAMERA 1
  185. #endif
  186. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  187. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  188. #endif
  189. #ifndef JUCE_USE_XINERAMA
  190. #define JUCE_USE_XINERAMA 1
  191. #endif
  192. #ifndef JUCE_USE_XSHM
  193. #define JUCE_USE_XSHM 1
  194. #endif
  195. #ifndef JUCE_USE_XRENDER
  196. //#define JUCE_USE_XRENDER 1
  197. #endif
  198. #ifndef JUCE_USE_XCURSOR
  199. #define JUCE_USE_XCURSOR 1
  200. #endif
  201. #ifndef JUCE_PLUGINHOST_VST
  202. // #define JUCE_PLUGINHOST_VST 1
  203. #endif
  204. #ifndef JUCE_PLUGINHOST_AU
  205. // #define JUCE_PLUGINHOST_AU 1
  206. #endif
  207. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  208. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  209. #endif
  210. #ifndef JUCE_WEB_BROWSER
  211. #define JUCE_WEB_BROWSER 0
  212. #endif
  213. #ifndef JUCE_SUPPORT_CARBON
  214. #define JUCE_SUPPORT_CARBON 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_ZLIB_CODE
  217. #define JUCE_INCLUDE_ZLIB_CODE 1
  218. #endif
  219. #ifndef JUCE_INCLUDE_FLAC_CODE
  220. #define JUCE_INCLUDE_FLAC_CODE 1
  221. #endif
  222. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  223. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  224. #endif
  225. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  226. #define JUCE_INCLUDE_PNGLIB_CODE 1
  227. #endif
  228. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  229. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  230. #endif
  231. #ifndef JUCE_CHECK_MEMORY_LEAKS
  232. #define JUCE_CHECK_MEMORY_LEAKS 1
  233. #endif
  234. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  235. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  236. #endif
  237. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  238. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  239. #undef JUCE_QUICKTIME
  240. #define JUCE_QUICKTIME 0
  241. #undef JUCE_OPENGL
  242. #define JUCE_OPENGL 0
  243. #undef JUCE_USE_CDBURNER
  244. #define JUCE_USE_CDBURNER 0
  245. #undef JUCE_USE_CDREADER
  246. #define JUCE_USE_CDREADER 0
  247. #undef JUCE_WEB_BROWSER
  248. #define JUCE_WEB_BROWSER 0
  249. #undef JUCE_PLUGINHOST_AU
  250. #define JUCE_PLUGINHOST_AU 0
  251. #undef JUCE_PLUGINHOST_VST
  252. #define JUCE_PLUGINHOST_VST 0
  253. #endif
  254. #endif
  255. /*** End of inlined file: juce_Config.h ***/
  256. #ifdef JUCE_NAMESPACE
  257. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  258. #define END_JUCE_NAMESPACE }
  259. #else
  260. #define BEGIN_JUCE_NAMESPACE
  261. #define END_JUCE_NAMESPACE
  262. #endif
  263. /*** Start of inlined file: juce_PlatformDefs.h ***/
  264. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  265. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  266. #ifdef JUCE_FORCE_DEBUG
  267. #undef JUCE_DEBUG
  268. #if JUCE_FORCE_DEBUG
  269. #define JUCE_DEBUG 1
  270. #endif
  271. #endif
  272. #if JUCE_MSVC
  273. #define JUCE_CALLTYPE __stdcall
  274. #else
  275. #define JUCE_CALLTYPE
  276. #endif
  277. // Debugging and assertion macros
  278. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  279. #if JUCE_LOG_ASSERTIONS
  280. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  281. #elif defined (JUCE_DEBUG)
  282. #define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
  283. #else
  284. #define juce_LogCurrentAssertion
  285. #endif
  286. #ifdef JUCE_DEBUG
  287. // If debugging is enabled..
  288. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  289. // Assertions..
  290. #if JUCE_WINDOWS || DOXYGEN
  291. #if JUCE_USE_INTRINSICS
  292. #pragma intrinsic (__debugbreak)
  293. #define juce_breakDebugger __debugbreak();
  294. #elif JUCE_GCC
  295. #define juce_breakDebugger asm("int $3");
  296. #else
  297. #define juce_breakDebugger { __asm int 3 }
  298. #endif
  299. #elif JUCE_MAC
  300. #define juce_breakDebugger Debugger();
  301. #elif JUCE_IPHONE
  302. #define juce_breakDebugger kill (0, SIGTRAP);
  303. #elif JUCE_LINUX
  304. #define juce_breakDebugger kill (0, SIGTRAP);
  305. #endif
  306. /** This will always cause an assertion failure.
  307. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  308. in juce_Config.h).
  309. @see jassert()
  310. */
  311. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  312. /** Platform-independent assertion macro.
  313. This gets optimised out when not being built with debugging turned on.
  314. Be careful not to call any functions within its arguments that are vital to
  315. the behaviour of the program, because these won't get called in the release
  316. build.
  317. @see jassertfalse
  318. */
  319. #define jassert(expression) { if (! (expression)) jassertfalse }
  320. #else
  321. // If debugging is disabled, these dummy debug and assertion macros are used..
  322. #define DBG(dbgtext)
  323. #define jassertfalse { juce_LogCurrentAssertion }
  324. #if JUCE_LOG_ASSERTIONS
  325. #define jassert(expression) { if (! (expression)) jassertfalse }
  326. #else
  327. #define jassert(a) { }
  328. #endif
  329. #endif
  330. #ifndef DOXYGEN
  331. template <bool b> struct JuceStaticAssert;
  332. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  333. #endif
  334. /** A compile-time assertion macro.
  335. If the expression parameter is false, the macro will cause a compile error.
  336. */
  337. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  338. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  339. #define JUCE_TRY try
  340. #define JUCE_CATCH_EXCEPTION \
  341. catch (const std::exception& e) \
  342. { \
  343. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  344. } \
  345. catch (...) \
  346. { \
  347. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  348. }
  349. #define JUCE_CATCH_ALL catch (...) {}
  350. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  351. #else
  352. #define JUCE_TRY
  353. #define JUCE_CATCH_EXCEPTION
  354. #define JUCE_CATCH_ALL
  355. #define JUCE_CATCH_ALL_ASSERT
  356. #endif
  357. // Macros for inlining.
  358. #if JUCE_MSVC
  359. #ifndef JUCE_DEBUG
  360. #define forcedinline __forceinline
  361. #else
  362. #define forcedinline inline
  363. #endif
  364. #else
  365. #ifndef JUCE_DEBUG
  366. #define forcedinline inline __attribute__((always_inline))
  367. #else
  368. #define forcedinline inline
  369. #endif
  370. #endif
  371. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  372. /*** End of inlined file: juce_PlatformDefs.h ***/
  373. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  374. #if JUCE_MSVC
  375. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  376. #pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
  377. #endif
  378. #pragma warning (push)
  379. #pragma warning (disable: 4514 4245 4100)
  380. #endif
  381. #include <cstdlib>
  382. #include <cstdarg>
  383. #include <climits>
  384. #include <limits>
  385. #include <cmath>
  386. #include <cwchar>
  387. #include <stdexcept>
  388. #include <typeinfo>
  389. #include <cstring>
  390. #include <cstdio>
  391. #include <iostream>
  392. #if JUCE_USE_INTRINSICS
  393. #include <intrin.h>
  394. #endif
  395. #if JUCE_MAC || JUCE_IPHONE
  396. #include <libkern/OSAtomic.h>
  397. #endif
  398. #if JUCE_LINUX
  399. #include <signal.h>
  400. #if __INTEL_COMPILER
  401. #if __ia64__
  402. #include <ia64intrin.h>
  403. #else
  404. #include <ia32intrin.h>
  405. #endif
  406. #endif
  407. #endif
  408. #if JUCE_MSVC && JUCE_DEBUG
  409. #include <crtdbg.h>
  410. #endif
  411. #if JUCE_MSVC
  412. #include <malloc.h>
  413. #pragma warning (pop)
  414. #if ! JUCE_PUBLIC_INCLUDES
  415. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  416. #endif
  417. #endif
  418. // DLL building settings on Win32
  419. #if JUCE_MSVC
  420. #ifdef JUCE_DLL_BUILD
  421. #define JUCE_API __declspec (dllexport)
  422. #pragma warning (disable: 4251)
  423. #elif defined (JUCE_DLL)
  424. #define JUCE_API __declspec (dllimport)
  425. #pragma warning (disable: 4251)
  426. #endif
  427. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  428. #ifdef JUCE_DLL_BUILD
  429. #define JUCE_API __attribute__ ((visibility("default")))
  430. #endif
  431. #endif
  432. #ifndef JUCE_API
  433. #define JUCE_API
  434. #endif
  435. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  436. // Now include some basics that are needed by most of the Juce classes...
  437. BEGIN_JUCE_NAMESPACE
  438. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  439. #if JUCE_LOG_ASSERTIONS
  440. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  441. #endif
  442. /*** Start of inlined file: juce_Memory.h ***/
  443. #ifndef __JUCE_MEMORY_JUCEHEADER__
  444. #define __JUCE_MEMORY_JUCEHEADER__
  445. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  446. #ifndef JUCE_DLL
  447. // Win32 debug non-DLL versions..
  448. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  449. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  450. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  451. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  452. #else
  453. // Win32 debug DLL versions..
  454. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  455. // way all juce calls in the DLL and in the host API will all use the same allocator.
  456. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  457. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  458. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  459. extern JUCE_API void juce_DebugFree (void* const block);
  460. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  461. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  462. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  463. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  464. #endif
  465. #if ! defined (_AFXDLL)
  466. #define juce_UseDebuggingNewOperator \
  467. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  468. static void* operator new (size_t, void* p) { return p; } \
  469. static void operator delete (void* p) { juce_free (p); } \
  470. static void operator delete (void*, void*) { }
  471. #endif
  472. #elif defined (JUCE_DLL)
  473. // Win32 DLL (release) versions..
  474. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  475. // way all juce calls in the DLL and in the host API will all use the same allocator.
  476. extern JUCE_API void* juce_Malloc (const int size);
  477. extern JUCE_API void* juce_Calloc (const int size);
  478. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  479. extern JUCE_API void juce_Free (void* const block);
  480. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  481. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  482. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  483. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  484. #define juce_UseDebuggingNewOperator \
  485. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  486. static void* operator new (size_t, void* p) { return p; } \
  487. static void operator delete (void* p) { juce_free (p); } \
  488. static void operator delete (void*, void*) { }
  489. #else
  490. // Mac, Linux and Win32 (release) versions..
  491. #define juce_malloc(numBytes) malloc (numBytes)
  492. #define juce_calloc(numBytes) calloc (1, numBytes)
  493. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  494. #define juce_free(location) free (location)
  495. #endif
  496. #ifndef juce_UseDebuggingNewOperator
  497. #define juce_UseDebuggingNewOperator
  498. #endif
  499. #if JUCE_MSVC
  500. #define juce_ThreadLocal __declspec(thread)
  501. #else
  502. #define juce_ThreadLocal __thread
  503. #endif
  504. #if JUCE_MINGW
  505. #define alloca __builtin_alloca
  506. #endif
  507. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  508. template <typename Type>
  509. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  510. template <typename Type>
  511. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  512. #endif // __JUCE_MEMORY_JUCEHEADER__
  513. /*** End of inlined file: juce_Memory.h ***/
  514. /*** Start of inlined file: juce_MathsFunctions.h ***/
  515. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  516. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  517. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  518. typedef signed char int8;
  519. typedef unsigned char uint8;
  520. typedef signed short int16;
  521. typedef unsigned short uint16;
  522. typedef signed int int32;
  523. typedef unsigned int uint32;
  524. #if JUCE_MSVC
  525. typedef __int64 int64;
  526. typedef unsigned __int64 uint64;
  527. #define literal64bit(longLiteral) ((__int64) longLiteral)
  528. #else
  529. typedef long long int64;
  530. typedef unsigned long long uint64;
  531. #define literal64bit(longLiteral) (longLiteral##LL)
  532. #endif
  533. #if JUCE_64BIT
  534. typedef int64 pointer_sized_int;
  535. typedef uint64 pointer_sized_uint;
  536. #elif _MSC_VER >= 1300
  537. typedef _W64 int pointer_sized_int;
  538. typedef _W64 unsigned int pointer_sized_uint;
  539. #else
  540. typedef int pointer_sized_int;
  541. typedef unsigned int pointer_sized_uint;
  542. #endif
  543. typedef wchar_t juce_wchar;
  544. // Some indispensible min/max functions
  545. template <typename Type>
  546. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  547. template <typename Type>
  548. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  549. template <typename Type>
  550. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  551. template <typename Type>
  552. inline Type jmin (const Type a, const Type b) { return (b < a) ? b : a; }
  553. template <typename Type>
  554. inline Type jmin (const Type a, const Type b, const Type c) { return (b < a) ? ((c < b) ? c : b) : ((c < a) ? c : a); }
  555. template <typename Type>
  556. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  557. template <typename Type>
  558. inline Type jlimit (const Type lowerLimit,
  559. const Type upperLimit,
  560. const Type valueToConstrain) throw()
  561. {
  562. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  563. return (valueToConstrain < lowerLimit) ? lowerLimit
  564. : ((upperLimit < valueToConstrain) ? upperLimit
  565. : valueToConstrain);
  566. }
  567. template <typename Type>
  568. inline void swapVariables (Type& variable1, Type& variable2)
  569. {
  570. const Type tempVal = variable1;
  571. variable1 = variable2;
  572. variable2 = tempVal;
  573. }
  574. template <typename Type>
  575. inline int numElementsInArray (Type& array) { return static_cast<int> (sizeof (array) / sizeof (array[0])); }
  576. // Some useful maths functions that aren't always present with all compilers and build settings.
  577. inline double juce_hypot (double a, double b)
  578. {
  579. #if JUCE_WINDOWS
  580. return _hypot (a, b);
  581. #else
  582. return hypot (a, b);
  583. #endif
  584. }
  585. inline float juce_hypotf (float a, float b)
  586. {
  587. #if JUCE_WINDOWS
  588. return (float) _hypot (a, b);
  589. #else
  590. return hypotf (a, b);
  591. #endif
  592. }
  593. inline int64 abs64 (const int64 n)
  594. {
  595. return (n >= 0) ? n : -n;
  596. }
  597. const double double_Pi = 3.1415926535897932384626433832795;
  598. const float float_Pi = 3.14159265358979323846f;
  599. template <typename FloatingPointType>
  600. inline bool juce_isfinite (FloatingPointType value)
  601. {
  602. #if JUCE_WINDOWS
  603. return _finite (value);
  604. #else
  605. return std::isfinite (value);
  606. #endif
  607. }
  608. template <typename FloatType>
  609. inline int roundToInt (const FloatType value) throw()
  610. {
  611. union { int asInt[2]; double asDouble; } n;
  612. n.asDouble = ((double) value) + 6755399441055744.0;
  613. #if JUCE_BIG_ENDIAN
  614. return n.asInt [1];
  615. #else
  616. return n.asInt [0];
  617. #endif
  618. }
  619. inline int roundToIntAccurate (const double value) throw()
  620. {
  621. return roundToInt (value + 1.5e-8);
  622. }
  623. inline int roundDoubleToInt (const double value) throw()
  624. {
  625. return roundToInt (value);
  626. }
  627. inline int roundFloatToInt (const float value) throw()
  628. {
  629. return roundToInt (value);
  630. }
  631. namespace TypeHelpers
  632. {
  633. #if defined (_MSC_VER) && _MSC_VER <= 1400
  634. #define PARAMETER_TYPE(a) a
  635. #else
  636. template <typename Type> struct ParameterType { typedef const Type& type; };
  637. template <typename Type> struct ParameterType <Type&> { typedef Type& type; };
  638. template <typename Type> struct ParameterType <Type*> { typedef Type* type; };
  639. template <> struct ParameterType <char> { typedef char type; };
  640. template <> struct ParameterType <unsigned char> { typedef unsigned char type; };
  641. template <> struct ParameterType <short> { typedef short type; };
  642. template <> struct ParameterType <unsigned short> { typedef unsigned short type; };
  643. template <> struct ParameterType <int> { typedef int type; };
  644. template <> struct ParameterType <unsigned int> { typedef unsigned int type; };
  645. template <> struct ParameterType <long> { typedef long type; };
  646. template <> struct ParameterType <unsigned long> { typedef unsigned long type; };
  647. template <> struct ParameterType <int64> { typedef int64 type; };
  648. template <> struct ParameterType <uint64> { typedef uint64 type; };
  649. template <> struct ParameterType <bool> { typedef bool type; };
  650. template <> struct ParameterType <float> { typedef float type; };
  651. template <> struct ParameterType <double> { typedef double type; };
  652. #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type
  653. #endif
  654. }
  655. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  656. /*** End of inlined file: juce_MathsFunctions.h ***/
  657. /*** Start of inlined file: juce_ByteOrder.h ***/
  658. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  659. #define __JUCE_BYTEORDER_JUCEHEADER__
  660. class JUCE_API ByteOrder
  661. {
  662. public:
  663. static uint16 swap (uint16 value);
  664. static uint32 swap (uint32 value);
  665. static uint64 swap (uint64 value);
  666. static uint16 swapIfBigEndian (uint16 value);
  667. static uint32 swapIfBigEndian (uint32 value);
  668. static uint64 swapIfBigEndian (uint64 value);
  669. static uint16 swapIfLittleEndian (uint16 value);
  670. static uint32 swapIfLittleEndian (uint32 value);
  671. static uint64 swapIfLittleEndian (uint64 value);
  672. static uint32 littleEndianInt (const void* bytes);
  673. static uint16 littleEndianShort (const void* bytes);
  674. static uint32 bigEndianInt (const void* bytes);
  675. static uint16 bigEndianShort (const void* bytes);
  676. static int littleEndian24Bit (const char* bytes);
  677. static int bigEndian24Bit (const char* bytes);
  678. static void littleEndian24BitToChars (int value, char* destBytes);
  679. static void bigEndian24BitToChars (int value, char* destBytes);
  680. static bool isBigEndian();
  681. private:
  682. ByteOrder();
  683. ByteOrder (const ByteOrder&);
  684. ByteOrder& operator= (const ByteOrder&);
  685. };
  686. #if JUCE_USE_INTRINSICS
  687. #pragma intrinsic (_byteswap_ulong)
  688. #endif
  689. inline uint16 ByteOrder::swap (uint16 n)
  690. {
  691. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  692. return static_cast <uint16> (_byteswap_ushort (n));
  693. #else
  694. return static_cast <uint16> ((n << 8) | (n >> 8));
  695. #endif
  696. }
  697. inline uint32 ByteOrder::swap (uint32 n)
  698. {
  699. #if JUCE_MAC || JUCE_IPHONE
  700. return OSSwapInt32 (n);
  701. #elif JUCE_GCC
  702. asm("bswap %%eax" : "=a"(n) : "a"(n));
  703. return n;
  704. #elif JUCE_USE_INTRINSICS
  705. return _byteswap_ulong (n);
  706. #else
  707. __asm {
  708. mov eax, n
  709. bswap eax
  710. mov n, eax
  711. }
  712. return n;
  713. #endif
  714. }
  715. inline uint64 ByteOrder::swap (uint64 value)
  716. {
  717. #if JUCE_MAC || JUCE_IPHONE
  718. return OSSwapInt64 (value);
  719. #elif JUCE_USE_INTRINSICS
  720. return _byteswap_uint64 (value);
  721. #else
  722. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  723. #endif
  724. }
  725. #if JUCE_LITTLE_ENDIAN
  726. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  727. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  728. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  729. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  730. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  731. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  732. inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); }
  733. inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); }
  734. inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); }
  735. inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); }
  736. inline bool ByteOrder::isBigEndian() { return false; }
  737. #else
  738. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  739. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  740. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  741. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  742. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  743. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  744. inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); }
  745. inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); }
  746. inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); }
  747. inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); }
  748. inline bool ByteOrder::isBigEndian() { return true; }
  749. #endif
  750. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  751. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  752. 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); }
  753. 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); }
  754. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  755. /*** End of inlined file: juce_ByteOrder.h ***/
  756. /*** Start of inlined file: juce_Logger.h ***/
  757. #ifndef __JUCE_LOGGER_JUCEHEADER__
  758. #define __JUCE_LOGGER_JUCEHEADER__
  759. /*** Start of inlined file: juce_String.h ***/
  760. #ifndef __JUCE_STRING_JUCEHEADER__
  761. #define __JUCE_STRING_JUCEHEADER__
  762. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  763. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  764. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  765. #define JUCE_T(stringLiteral) (L##stringLiteral)
  766. typedef juce_wchar tchar;
  767. #if ! JUCE_DONT_DEFINE_MACROS
  768. #define T(stringLiteral) JUCE_T(stringLiteral)
  769. #endif
  770. class JUCE_API CharacterFunctions
  771. {
  772. public:
  773. static int length (const char* const s) throw();
  774. static int length (const juce_wchar* const s) throw();
  775. static void copy (char* dest, const char* src, const int maxBytes) throw();
  776. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  777. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  778. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  779. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  780. static void append (char* dest, const char* src) throw();
  781. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  782. static int compare (const char* const s1, const char* const s2) throw();
  783. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  784. static int compare (const juce_wchar* s1, const char* s2) throw();
  785. static int compare (const char* s1, const juce_wchar* s2) throw();
  786. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  787. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  788. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  789. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  790. static int compareIgnoreCase (const juce_wchar* s1, const char* s2) throw();
  791. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  792. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  793. static const char* find (const char* const haystack, const char* const needle) throw();
  794. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  795. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  796. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  797. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  798. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  799. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  800. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  801. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  802. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  803. static int getIntValue (const char* const s) throw();
  804. static int getIntValue (const juce_wchar* s) throw();
  805. static int64 getInt64Value (const char* s) throw();
  806. static int64 getInt64Value (const juce_wchar* s) throw();
  807. static double getDoubleValue (const char* const s) throw();
  808. static double getDoubleValue (const juce_wchar* const s) throw();
  809. static char toUpperCase (const char character) throw();
  810. static juce_wchar toUpperCase (const juce_wchar character) throw();
  811. static void toUpperCase (char* s) throw();
  812. static void toUpperCase (juce_wchar* s) throw();
  813. static bool isUpperCase (const char character) throw();
  814. static bool isUpperCase (const juce_wchar character) throw();
  815. static char toLowerCase (const char character) throw();
  816. static juce_wchar toLowerCase (const juce_wchar character) throw();
  817. static void toLowerCase (char* s) throw();
  818. static void toLowerCase (juce_wchar* s) throw();
  819. static bool isLowerCase (const char character) throw();
  820. static bool isLowerCase (const juce_wchar character) throw();
  821. static bool isWhitespace (const char character) throw();
  822. static bool isWhitespace (const juce_wchar character) throw();
  823. static bool isDigit (const char character) throw();
  824. static bool isDigit (const juce_wchar character) throw();
  825. static bool isLetter (const char character) throw();
  826. static bool isLetter (const juce_wchar character) throw();
  827. static bool isLetterOrDigit (const char character) throw();
  828. static bool isLetterOrDigit (const juce_wchar character) throw();
  829. static int getHexDigitValue (const juce_wchar digit) throw();
  830. };
  831. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  832. /*** End of inlined file: juce_CharacterFunctions.h ***/
  833. class OutputStream;
  834. class JUCE_API String
  835. {
  836. public:
  837. String() throw();
  838. String (const String& other) throw();
  839. String (const char* text);
  840. String (const char* text, size_t maxChars);
  841. String (const juce_wchar* unicodeText);
  842. String (const juce_wchar* unicodeText, size_t maxChars);
  843. static const String charToString (juce_wchar character);
  844. ~String() throw();
  845. //========================juce_wchar======================================================
  846. static const String empty;
  847. int hashCode() const throw();
  848. int64 hashCode64() const throw();
  849. int length() const throw();
  850. // Assignment and concatenation operators..
  851. String& operator= (const String& other) throw();
  852. String& operator+= (const juce_wchar* textToAppend);
  853. String& operator+= (const String& stringToAppend);
  854. String& operator+= (char characterToAppend);
  855. String& operator+= (juce_wchar characterToAppend);
  856. String& operator+= (int numberToAppend);
  857. String& operator+= (unsigned int numberToAppend);
  858. void append (const juce_wchar* textToAppend, int maxCharsToTake);
  859. // Comparison methods..
  860. inline bool isEmpty() const throw() { return text[0] == 0; }
  861. inline bool isNotEmpty() const throw() { return text[0] != 0; }
  862. bool equalsIgnoreCase (const String& other) const throw();
  863. bool equalsIgnoreCase (const juce_wchar* other) const throw();
  864. bool equalsIgnoreCase (const char* other) const throw();
  865. int compare (const String& other) const throw();
  866. int compare (const char* other) const throw();
  867. int compare (const juce_wchar* other) const throw();
  868. int compareIgnoreCase (const String& other) const throw();
  869. int compareLexicographically (const String& other) const throw();
  870. bool startsWith (const String& text) const throw();
  871. bool startsWithChar (juce_wchar character) const throw();
  872. bool startsWithIgnoreCase (const String& text) const throw();
  873. bool endsWith (const String& text) const throw();
  874. bool endsWithChar (juce_wchar character) const throw();
  875. bool endsWithIgnoreCase (const String& text) const throw();
  876. bool contains (const String& text) const throw();
  877. bool containsChar (juce_wchar character) const throw();
  878. bool containsIgnoreCase (const String& text) const throw();
  879. bool containsWholeWord (const String& wordToLookFor) const throw();
  880. bool containsWholeWordIgnoreCase (const String& wordToLookFor) const throw();
  881. int indexOfWholeWord (const String& wordToLookFor) const throw();
  882. int indexOfWholeWordIgnoreCase (const String& wordToLookFor) const throw();
  883. bool containsAnyOf (const String& charactersItMightContain) const throw();
  884. bool containsOnly (const String& charactersItMightContain) const throw();
  885. bool containsNonWhitespaceChars() const throw();
  886. bool matchesWildcard (const String& wildcard, bool ignoreCase) const throw();
  887. // Substring location methods..
  888. int indexOfChar (juce_wchar characterToLookFor) const throw();
  889. int indexOfChar (int startIndex, juce_wchar characterToLookFor) const throw();
  890. int indexOfAnyOf (const String& charactersToLookFor,
  891. int startIndex = 0,
  892. bool ignoreCase = false) const throw();
  893. int indexOf (const String& text) const throw();
  894. int indexOf (int startIndex,
  895. const String& textToLookFor) const throw();
  896. int indexOfIgnoreCase (const String& textToLookFor) const throw();
  897. int indexOfIgnoreCase (int startIndex,
  898. const String& textToLookFor) const throw();
  899. int lastIndexOfChar (juce_wchar character) const throw();
  900. int lastIndexOf (const String& textToLookFor) const throw();
  901. int lastIndexOfIgnoreCase (const String& textToLookFor) const throw();
  902. int lastIndexOfAnyOf (const String& charactersToLookFor,
  903. bool ignoreCase = false) const throw();
  904. // Substring extraction and manipulation methods..
  905. /** Returns the character at this index in the string.
  906. No checks are made to see if the index is within a valid range, so be careful!
  907. */
  908. inline const juce_wchar& operator[] (int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text [index]; }
  909. juce_wchar& operator[] (int index);
  910. juce_wchar getLastCharacter() const throw();
  911. const String substring (int startIndex, int endIndex) const;
  912. const String substring (int startIndex) const;
  913. const String dropLastCharacters (int numberToDrop) const;
  914. const String getLastCharacters (int numCharacters) const;
  915. const String fromFirstOccurrenceOf (const String& substringToStartFrom,
  916. bool includeSubStringInResult,
  917. bool ignoreCase) const;
  918. const String fromLastOccurrenceOf (const String& substringToFind,
  919. bool includeSubStringInResult,
  920. bool ignoreCase) const;
  921. const String upToFirstOccurrenceOf (const String& substringToEndWith,
  922. bool includeSubStringInResult,
  923. bool ignoreCase) const;
  924. const String upToLastOccurrenceOf (const String& substringToFind,
  925. bool includeSubStringInResult,
  926. bool ignoreCase) const;
  927. const String trim() const;
  928. const String trimStart() const;
  929. const String trimEnd() const;
  930. const String trimCharactersAtStart (const String& charactersToTrim) const;
  931. const String trimCharactersAtEnd (const String& charactersToTrim) const;
  932. const String toUpperCase() const;
  933. const String toLowerCase() const;
  934. const String replaceSection (int startIndex,
  935. int numCharactersToReplace,
  936. const String& stringToInsert) const;
  937. const String replace (const String& stringToReplace,
  938. const String& stringToInsertInstead,
  939. bool ignoreCase = false) const;
  940. const String replaceCharacter (juce_wchar characterToReplace,
  941. juce_wchar characterToInsertInstead) const;
  942. const String replaceCharacters (const String& charactersToReplace,
  943. const String& charactersToInsertInstead) const;
  944. const String retainCharacters (const String& charactersToRetain) const;
  945. const String removeCharacters (const String& charactersToRemove) const;
  946. const String initialSectionContainingOnly (const String& permittedCharacters) const;
  947. const String initialSectionNotContaining (const String& charactersToStopAt) const;
  948. bool isQuotedString() const;
  949. const String unquoted() const;
  950. const String quoted (juce_wchar quoteCharacter = '"') const;
  951. static const String repeatedString (const String& stringToRepeat,
  952. int numberOfTimesToRepeat);
  953. const String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
  954. const String paddedRight (juce_wchar padCharacter, int minimumLength) const;
  955. static const String createStringFromData (const void* data, int size);
  956. static const String formatted (const juce_wchar* formatString, ... );
  957. // Numeric conversions..
  958. explicit String (int decimalInteger);
  959. explicit String (unsigned int decimalInteger);
  960. explicit String (short decimalInteger);
  961. explicit String (unsigned short decimalInteger);
  962. explicit String (int64 largeIntegerValue);
  963. explicit String (uint64 largeIntegerValue);
  964. explicit String (float floatValue,
  965. int numberOfDecimalPlaces = 0);
  966. explicit String (double doubleValue,
  967. int numberOfDecimalPlaces = 0);
  968. int getIntValue() const throw();
  969. int64 getLargeIntValue() const throw();
  970. int getTrailingIntValue() const throw();
  971. float getFloatValue() const throw();
  972. double getDoubleValue() const throw();
  973. int getHexValue32() const throw();
  974. int64 getHexValue64() const throw();
  975. static const String toHexString (int number);
  976. static const String toHexString (int64 number);
  977. static const String toHexString (short number);
  978. static const String toHexString (const unsigned char* data,
  979. int size,
  980. int groupSize = 1);
  981. inline operator const juce_wchar*() const throw() { return text; }
  982. inline operator juce_wchar*() throw() { return text; }
  983. const char* toUTF8() const;
  984. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  985. int getNumBytesAsUTF8() const throw();
  986. int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw();
  987. const char* toCString() const;
  988. int getNumBytesAsCString() const throw();
  989. int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw();
  990. void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
  991. void preallocateStorage (size_t numCharsNeeded);
  992. void swapWith (String& other) throw();
  993. class JUCE_API Concatenator
  994. {
  995. public:
  996. Concatenator (String& stringToAppendTo);
  997. ~Concatenator();
  998. void append (const String& s);
  999. private:
  1000. String& result;
  1001. int nextIndex;
  1002. Concatenator (const Concatenator&);
  1003. Concatenator& operator= (const Concatenator&);
  1004. };
  1005. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  1006. private:
  1007. juce_wchar* text;
  1008. // internal constructor that preallocates a certain amount of memory
  1009. String (size_t numChars, int dummyVariable);
  1010. String (const String& stringToCopy, size_t charsToAllocate);
  1011. void createInternal (const juce_wchar* text, size_t numChars);
  1012. void appendInternal (const juce_wchar* text, int numExtraChars);
  1013. };
  1014. const String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
  1015. const String JUCE_CALLTYPE operator+ (const juce_wchar* string1, const String& string2);
  1016. const String JUCE_CALLTYPE operator+ (char string1, const String& string2);
  1017. const String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
  1018. const String JUCE_CALLTYPE operator+ (String string1, const String& string2);
  1019. const String JUCE_CALLTYPE operator+ (String string1, const char* string2);
  1020. const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar* string2);
  1021. const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
  1022. const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
  1023. String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
  1024. String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
  1025. String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
  1026. String& JUCE_CALLTYPE operator<< (String& string1, const juce_wchar* string2);
  1027. String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
  1028. String& JUCE_CALLTYPE operator<< (String& string1, short number);
  1029. String& JUCE_CALLTYPE operator<< (String& string1, int number);
  1030. String& JUCE_CALLTYPE operator<< (String& string1, unsigned int number);
  1031. String& JUCE_CALLTYPE operator<< (String& string1, long number);
  1032. String& JUCE_CALLTYPE operator<< (String& string1, unsigned long number);
  1033. String& JUCE_CALLTYPE operator<< (String& string1, float number);
  1034. String& JUCE_CALLTYPE operator<< (String& string1, double number);
  1035. bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) throw();
  1036. bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw();
  1037. bool JUCE_CALLTYPE operator== (const String& string1, const juce_wchar* string2) throw();
  1038. bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw();
  1039. bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw();
  1040. bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* 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. bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) throw();
  1044. bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) throw();
  1045. template <class charT, class traits>
  1046. std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1047. {
  1048. return stream << stringToWrite.toUTF8();
  1049. }
  1050. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text);
  1051. #endif // __JUCE_STRING_JUCEHEADER__
  1052. /*** End of inlined file: juce_String.h ***/
  1053. class JUCE_API Logger
  1054. {
  1055. public:
  1056. virtual ~Logger();
  1057. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1058. const bool deleteOldLogger = false);
  1059. static void JUCE_CALLTYPE writeToLog (const String& message);
  1060. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1061. protected:
  1062. Logger();
  1063. virtual void logMessage (const String& message) = 0;
  1064. };
  1065. #endif // __JUCE_LOGGER_JUCEHEADER__
  1066. /*** End of inlined file: juce_Logger.h ***/
  1067. END_JUCE_NAMESPACE
  1068. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1069. /*** End of inlined file: juce_StandardHeader.h ***/
  1070. BEGIN_JUCE_NAMESPACE
  1071. #if JUCE_MSVC
  1072. // this is set explicitly in case the app is using a different packing size.
  1073. #pragma pack (push, 8)
  1074. #pragma warning (push)
  1075. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1076. #endif
  1077. // this is where all the class header files get brought in..
  1078. /*** Start of inlined file: juce_core_includes.h ***/
  1079. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1080. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1081. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1082. /*** Start of inlined file: juce_Array.h ***/
  1083. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1084. #define __JUCE_ARRAY_JUCEHEADER__
  1085. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1086. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1087. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1088. /*** Start of inlined file: juce_HeapBlock.h ***/
  1089. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1090. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1091. template <class ElementType>
  1092. class HeapBlock
  1093. {
  1094. public:
  1095. HeapBlock() throw() : data (0)
  1096. {
  1097. }
  1098. explicit HeapBlock (const size_t numElements)
  1099. : data (static_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType))))
  1100. {
  1101. }
  1102. ~HeapBlock()
  1103. {
  1104. ::juce_free (data);
  1105. }
  1106. inline operator ElementType*() const throw() { return data; }
  1107. inline ElementType* getData() const throw() { return data; }
  1108. inline operator void*() const throw() { return static_cast <void*> (data); }
  1109. inline ElementType* operator->() const throw() { return data; }
  1110. template <typename IndexType>
  1111. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1112. template <typename IndexType>
  1113. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1114. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1115. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1116. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1117. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1118. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1119. {
  1120. ::juce_free (data);
  1121. data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1122. }
  1123. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1124. {
  1125. ::juce_free (data);
  1126. data = static_cast <ElementType*> (::juce_calloc (newNumElements * elementSize));
  1127. }
  1128. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1129. {
  1130. ::juce_free (data);
  1131. if (initialiseToZero)
  1132. data = static_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType)));
  1133. else
  1134. data = static_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType)));
  1135. }
  1136. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1137. {
  1138. if (data == 0)
  1139. data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize));
  1140. else
  1141. data = static_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize));
  1142. }
  1143. void free()
  1144. {
  1145. ::juce_free (data);
  1146. data = 0;
  1147. }
  1148. void swapWith (HeapBlock <ElementType>& other) throw()
  1149. {
  1150. swapVariables (data, other.data);
  1151. }
  1152. private:
  1153. ElementType* data;
  1154. HeapBlock (const HeapBlock&);
  1155. HeapBlock& operator= (const HeapBlock&);
  1156. };
  1157. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1158. /*** End of inlined file: juce_HeapBlock.h ***/
  1159. template <class ElementType, class TypeOfCriticalSectionToUse>
  1160. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1161. {
  1162. public:
  1163. ArrayAllocationBase() throw()
  1164. : numAllocated (0)
  1165. {
  1166. }
  1167. ~ArrayAllocationBase()
  1168. {
  1169. }
  1170. void setAllocatedSize (const int numElements)
  1171. {
  1172. if (numAllocated != numElements)
  1173. {
  1174. if (numElements > 0)
  1175. elements.realloc (numElements);
  1176. else
  1177. elements.free();
  1178. numAllocated = numElements;
  1179. }
  1180. }
  1181. void ensureAllocatedSize (const int minNumElements)
  1182. {
  1183. if (minNumElements > numAllocated)
  1184. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1185. }
  1186. void shrinkToNoMoreThan (const int maxNumElements)
  1187. {
  1188. if (maxNumElements < numAllocated)
  1189. setAllocatedSize (maxNumElements);
  1190. }
  1191. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1192. {
  1193. elements.swapWith (other.elements);
  1194. swapVariables (numAllocated, other.numAllocated);
  1195. }
  1196. HeapBlock <ElementType> elements;
  1197. int numAllocated;
  1198. private:
  1199. ArrayAllocationBase (const ArrayAllocationBase&);
  1200. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1201. };
  1202. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1203. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1204. /*** Start of inlined file: juce_ElementComparator.h ***/
  1205. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1206. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1207. template <class ElementType, class ElementComparator>
  1208. static void sortArray (ElementComparator& comparator,
  1209. ElementType* const array,
  1210. int firstElement,
  1211. int lastElement,
  1212. const bool retainOrderOfEquivalentItems)
  1213. {
  1214. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1215. // avoids getting warning messages about the parameter being unused
  1216. if (lastElement > firstElement)
  1217. {
  1218. if (retainOrderOfEquivalentItems)
  1219. {
  1220. for (int i = firstElement; i < lastElement; ++i)
  1221. {
  1222. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1223. {
  1224. const ElementType temp = array [i];
  1225. array [i] = array[i + 1];
  1226. array [i + 1] = temp;
  1227. if (i > firstElement)
  1228. i -= 2;
  1229. }
  1230. }
  1231. }
  1232. else
  1233. {
  1234. int fromStack[30], toStack[30];
  1235. int stackIndex = 0;
  1236. for (;;)
  1237. {
  1238. const int size = (lastElement - firstElement) + 1;
  1239. if (size <= 8)
  1240. {
  1241. int j = lastElement;
  1242. int maxIndex;
  1243. while (j > firstElement)
  1244. {
  1245. maxIndex = firstElement;
  1246. for (int k = firstElement + 1; k <= j; ++k)
  1247. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1248. maxIndex = k;
  1249. const ElementType temp = array [maxIndex];
  1250. array [maxIndex] = array[j];
  1251. array [j] = temp;
  1252. --j;
  1253. }
  1254. }
  1255. else
  1256. {
  1257. const int mid = firstElement + (size >> 1);
  1258. ElementType temp = array [mid];
  1259. array [mid] = array [firstElement];
  1260. array [firstElement] = temp;
  1261. int i = firstElement;
  1262. int j = lastElement + 1;
  1263. for (;;)
  1264. {
  1265. while (++i <= lastElement
  1266. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1267. {}
  1268. while (--j > firstElement
  1269. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1270. {}
  1271. if (j < i)
  1272. break;
  1273. temp = array[i];
  1274. array[i] = array[j];
  1275. array[j] = temp;
  1276. }
  1277. temp = array [firstElement];
  1278. array [firstElement] = array[j];
  1279. array [j] = temp;
  1280. if (j - 1 - firstElement >= lastElement - i)
  1281. {
  1282. if (firstElement + 1 < j)
  1283. {
  1284. fromStack [stackIndex] = firstElement;
  1285. toStack [stackIndex] = j - 1;
  1286. ++stackIndex;
  1287. }
  1288. if (i < lastElement)
  1289. {
  1290. firstElement = i;
  1291. continue;
  1292. }
  1293. }
  1294. else
  1295. {
  1296. if (i < lastElement)
  1297. {
  1298. fromStack [stackIndex] = i;
  1299. toStack [stackIndex] = lastElement;
  1300. ++stackIndex;
  1301. }
  1302. if (firstElement + 1 < j)
  1303. {
  1304. lastElement = j - 1;
  1305. continue;
  1306. }
  1307. }
  1308. }
  1309. if (--stackIndex < 0)
  1310. break;
  1311. jassert (stackIndex < numElementsInArray (fromStack));
  1312. firstElement = fromStack [stackIndex];
  1313. lastElement = toStack [stackIndex];
  1314. }
  1315. }
  1316. }
  1317. }
  1318. template <class ElementType, class ElementComparator>
  1319. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1320. ElementType* const array,
  1321. const ElementType newElement,
  1322. int firstElement,
  1323. int lastElement)
  1324. {
  1325. jassert (firstElement <= lastElement);
  1326. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1327. // avoids getting warning messages about the parameter being unused
  1328. while (firstElement < lastElement)
  1329. {
  1330. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1331. {
  1332. ++firstElement;
  1333. break;
  1334. }
  1335. else
  1336. {
  1337. const int halfway = (firstElement + lastElement) >> 1;
  1338. if (halfway == firstElement)
  1339. {
  1340. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1341. ++firstElement;
  1342. break;
  1343. }
  1344. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1345. {
  1346. firstElement = halfway;
  1347. }
  1348. else
  1349. {
  1350. lastElement = halfway;
  1351. }
  1352. }
  1353. }
  1354. return firstElement;
  1355. }
  1356. template <class ElementType>
  1357. class IntegerElementComparator
  1358. {
  1359. public:
  1360. static int compareElements (const ElementType first,
  1361. const ElementType second) throw()
  1362. {
  1363. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1364. }
  1365. };
  1366. template <class ElementType>
  1367. class FloatElementComparator
  1368. {
  1369. public:
  1370. static int compareElements (const ElementType first,
  1371. const ElementType second) throw()
  1372. {
  1373. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1374. }
  1375. };
  1376. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1377. /*** End of inlined file: juce_ElementComparator.h ***/
  1378. /*** Start of inlined file: juce_CriticalSection.h ***/
  1379. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1380. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1381. class JUCE_API ScopedLock;
  1382. class JUCE_API ScopedUnlock;
  1383. class JUCE_API CriticalSection
  1384. {
  1385. public:
  1386. CriticalSection() throw();
  1387. ~CriticalSection() throw();
  1388. void enter() const throw();
  1389. bool tryEnter() const throw();
  1390. void exit() const throw();
  1391. typedef ScopedLock ScopedLockType;
  1392. typedef ScopedUnlock ScopedUnlockType;
  1393. juce_UseDebuggingNewOperator
  1394. private:
  1395. #if JUCE_WIN32
  1396. #if JUCE_64BIT
  1397. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1398. // block of memory here that's big enough to be used internally as a windows critical
  1399. // section object.
  1400. uint8 internal [44];
  1401. #else
  1402. uint8 internal [24];
  1403. #endif
  1404. #else
  1405. mutable pthread_mutex_t internal;
  1406. #endif
  1407. CriticalSection (const CriticalSection&);
  1408. CriticalSection& operator= (const CriticalSection&);
  1409. };
  1410. class JUCE_API DummyCriticalSection
  1411. {
  1412. public:
  1413. inline DummyCriticalSection() throw() {}
  1414. inline ~DummyCriticalSection() throw() {}
  1415. inline void enter() const throw() {}
  1416. inline void exit() const throw() {}
  1417. struct ScopedLockType
  1418. {
  1419. ScopedLockType (const DummyCriticalSection&) throw() {}
  1420. };
  1421. typedef ScopedLockType ScopedUnlockType;
  1422. private:
  1423. DummyCriticalSection (const DummyCriticalSection&);
  1424. DummyCriticalSection& operator= (const DummyCriticalSection&);
  1425. };
  1426. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1427. /*** End of inlined file: juce_CriticalSection.h ***/
  1428. template <typename ElementType,
  1429. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1430. class Array
  1431. {
  1432. private:
  1433. #if defined (_MSC_VER) && _MSC_VER <= 1400
  1434. typedef const ElementType& ParameterType;
  1435. #else
  1436. typedef PARAMETER_TYPE (ElementType) ParameterType;
  1437. #endif
  1438. public:
  1439. Array() throw()
  1440. : numUsed (0)
  1441. {
  1442. }
  1443. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1444. {
  1445. const ScopedLockType lock (other.getLock());
  1446. numUsed = other.numUsed;
  1447. data.setAllocatedSize (other.numUsed);
  1448. for (int i = 0; i < numUsed; ++i)
  1449. new (data.elements + i) ElementType (other.data.elements[i]);
  1450. }
  1451. explicit Array (const ElementType* values)
  1452. : numUsed (0)
  1453. {
  1454. while (*values != 0)
  1455. add (*values++);
  1456. }
  1457. Array (const ElementType* values, int numValues)
  1458. : numUsed (numValues)
  1459. {
  1460. data.setAllocatedSize (numValues);
  1461. for (int i = 0; i < numValues; ++i)
  1462. new (data.elements + i) ElementType (values[i]);
  1463. }
  1464. ~Array()
  1465. {
  1466. for (int i = 0; i < numUsed; ++i)
  1467. data.elements[i].~ElementType();
  1468. }
  1469. Array& operator= (const Array& other)
  1470. {
  1471. if (this != &other)
  1472. {
  1473. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1474. swapWithArray (otherCopy);
  1475. }
  1476. return *this;
  1477. }
  1478. template <class OtherArrayType>
  1479. bool operator== (const OtherArrayType& other) const
  1480. {
  1481. const ScopedLockType lock (getLock());
  1482. if (numUsed != other.numUsed)
  1483. return false;
  1484. for (int i = numUsed; --i >= 0;)
  1485. if (data.elements [i] != other.data.elements [i])
  1486. return false;
  1487. return true;
  1488. }
  1489. template <class OtherArrayType>
  1490. bool operator!= (const OtherArrayType& other) const
  1491. {
  1492. return ! operator== (other);
  1493. }
  1494. void clear()
  1495. {
  1496. const ScopedLockType lock (getLock());
  1497. for (int i = 0; i < numUsed; ++i)
  1498. data.elements[i].~ElementType();
  1499. data.setAllocatedSize (0);
  1500. numUsed = 0;
  1501. }
  1502. void clearQuick()
  1503. {
  1504. const ScopedLockType lock (getLock());
  1505. for (int i = 0; i < numUsed; ++i)
  1506. data.elements[i].~ElementType();
  1507. numUsed = 0;
  1508. }
  1509. inline int size() const throw()
  1510. {
  1511. return numUsed;
  1512. }
  1513. inline ElementType operator[] (const int index) const
  1514. {
  1515. const ScopedLockType lock (getLock());
  1516. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1517. : ElementType();
  1518. }
  1519. inline const ElementType getUnchecked (const int index) const
  1520. {
  1521. const ScopedLockType lock (getLock());
  1522. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1523. return data.elements [index];
  1524. }
  1525. inline ElementType& getReference (const int index) const throw()
  1526. {
  1527. const ScopedLockType lock (getLock());
  1528. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1529. return data.elements [index];
  1530. }
  1531. inline ElementType getFirst() const
  1532. {
  1533. const ScopedLockType lock (getLock());
  1534. return (numUsed > 0) ? data.elements [0]
  1535. : ElementType();
  1536. }
  1537. inline ElementType getLast() const
  1538. {
  1539. const ScopedLockType lock (getLock());
  1540. return (numUsed > 0) ? data.elements [numUsed - 1]
  1541. : ElementType();
  1542. }
  1543. int indexOf (ParameterType elementToLookFor) const
  1544. {
  1545. const ScopedLockType lock (getLock());
  1546. const ElementType* e = data.elements.getData();
  1547. const ElementType* const end = e + numUsed;
  1548. while (e != end)
  1549. {
  1550. if (elementToLookFor == *e)
  1551. return static_cast <int> (e - data.elements.getData());
  1552. ++e;
  1553. }
  1554. return -1;
  1555. }
  1556. bool contains (ParameterType elementToLookFor) const
  1557. {
  1558. const ScopedLockType lock (getLock());
  1559. const ElementType* e = data.elements.getData();
  1560. const ElementType* const end = e + numUsed;
  1561. while (e != end)
  1562. {
  1563. if (elementToLookFor == *e)
  1564. return true;
  1565. ++e;
  1566. }
  1567. return false;
  1568. }
  1569. void add (ParameterType newElement)
  1570. {
  1571. const ScopedLockType lock (getLock());
  1572. data.ensureAllocatedSize (numUsed + 1);
  1573. new (data.elements + numUsed++) ElementType (newElement);
  1574. }
  1575. void insert (int indexToInsertAt, ParameterType newElement)
  1576. {
  1577. const ScopedLockType lock (getLock());
  1578. data.ensureAllocatedSize (numUsed + 1);
  1579. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1580. {
  1581. ElementType* const insertPos = data.elements + indexToInsertAt;
  1582. const int numberToMove = numUsed - indexToInsertAt;
  1583. if (numberToMove > 0)
  1584. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1585. new (insertPos) ElementType (newElement);
  1586. ++numUsed;
  1587. }
  1588. else
  1589. {
  1590. new (data.elements + numUsed++) ElementType (newElement);
  1591. }
  1592. }
  1593. void insertMultiple (int indexToInsertAt, ParameterType newElement,
  1594. int numberOfTimesToInsertIt)
  1595. {
  1596. if (numberOfTimesToInsertIt > 0)
  1597. {
  1598. const ScopedLockType lock (getLock());
  1599. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1600. ElementType* insertPos;
  1601. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1602. {
  1603. insertPos = data.elements + indexToInsertAt;
  1604. const int numberToMove = numUsed - indexToInsertAt;
  1605. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1606. }
  1607. else
  1608. {
  1609. insertPos = data.elements + numUsed;
  1610. }
  1611. numUsed += numberOfTimesToInsertIt;
  1612. while (--numberOfTimesToInsertIt >= 0)
  1613. new (insertPos++) ElementType (newElement);
  1614. }
  1615. }
  1616. void insertArray (int indexToInsertAt,
  1617. const ElementType* newElements,
  1618. int numberOfElements)
  1619. {
  1620. if (numberOfElements > 0)
  1621. {
  1622. const ScopedLockType lock (getLock());
  1623. data.ensureAllocatedSize (numUsed + numberOfElements);
  1624. ElementType* insertPos;
  1625. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1626. {
  1627. insertPos = data.elements + indexToInsertAt;
  1628. const int numberToMove = numUsed - indexToInsertAt;
  1629. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1630. }
  1631. else
  1632. {
  1633. insertPos = data.elements + numUsed;
  1634. }
  1635. numUsed += numberOfElements;
  1636. while (--numberOfElements >= 0)
  1637. new (insertPos++) ElementType (*newElements++);
  1638. }
  1639. }
  1640. void addIfNotAlreadyThere (ParameterType newElement)
  1641. {
  1642. const ScopedLockType lock (getLock());
  1643. if (! contains (newElement))
  1644. add (newElement);
  1645. }
  1646. void set (const int indexToChange, ParameterType newValue)
  1647. {
  1648. jassert (indexToChange >= 0);
  1649. const ScopedLockType lock (getLock());
  1650. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1651. {
  1652. data.elements [indexToChange] = newValue;
  1653. }
  1654. else if (indexToChange >= 0)
  1655. {
  1656. data.ensureAllocatedSize (numUsed + 1);
  1657. new (data.elements + numUsed++) ElementType (newValue);
  1658. }
  1659. }
  1660. void setUnchecked (const int indexToChange, ParameterType newValue)
  1661. {
  1662. const ScopedLockType lock (getLock());
  1663. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1664. data.elements [indexToChange] = newValue;
  1665. }
  1666. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1667. {
  1668. const ScopedLockType lock (getLock());
  1669. if (numElementsToAdd > 0)
  1670. {
  1671. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1672. while (--numElementsToAdd >= 0)
  1673. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1674. }
  1675. }
  1676. void swapWithArray (Array& otherArray) throw()
  1677. {
  1678. const ScopedLockType lock1 (getLock());
  1679. const ScopedLockType lock2 (otherArray.getLock());
  1680. data.swapWith (otherArray.data);
  1681. swapVariables (numUsed, otherArray.numUsed);
  1682. }
  1683. template <class OtherArrayType>
  1684. void addArray (const OtherArrayType& arrayToAddFrom,
  1685. int startIndex = 0,
  1686. int numElementsToAdd = -1)
  1687. {
  1688. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1689. const ScopedLockType lock2 (getLock());
  1690. if (startIndex < 0)
  1691. {
  1692. jassertfalse
  1693. startIndex = 0;
  1694. }
  1695. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1696. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1697. while (--numElementsToAdd >= 0)
  1698. add (arrayToAddFrom.getUnchecked (startIndex++));
  1699. }
  1700. template <class ElementComparator>
  1701. void addSorted (ElementComparator& comparator, ParameterType newElement)
  1702. {
  1703. const ScopedLockType lock (getLock());
  1704. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
  1705. }
  1706. template <class ElementComparator>
  1707. int indexOfSorted (ElementComparator& comparator, ParameterType elementToLookFor) const
  1708. {
  1709. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1710. // avoids getting warning messages about the parameter being unused
  1711. const ScopedLockType lock (getLock());
  1712. int start = 0;
  1713. int end = numUsed;
  1714. for (;;)
  1715. {
  1716. if (start >= end)
  1717. {
  1718. return -1;
  1719. }
  1720. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1721. {
  1722. return start;
  1723. }
  1724. else
  1725. {
  1726. const int halfway = (start + end) >> 1;
  1727. if (halfway == start)
  1728. return -1;
  1729. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1730. start = halfway;
  1731. else
  1732. end = halfway;
  1733. }
  1734. }
  1735. }
  1736. ElementType remove (const int indexToRemove)
  1737. {
  1738. const ScopedLockType lock (getLock());
  1739. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1740. {
  1741. --numUsed;
  1742. ElementType* const e = data.elements + indexToRemove;
  1743. ElementType removed (*e);
  1744. e->~ElementType();
  1745. const int numberToShift = numUsed - indexToRemove;
  1746. if (numberToShift > 0)
  1747. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1748. if ((numUsed << 1) < data.numAllocated)
  1749. minimiseStorageOverheads();
  1750. return removed;
  1751. }
  1752. else
  1753. {
  1754. return ElementType();
  1755. }
  1756. }
  1757. void removeValue (ParameterType valueToRemove)
  1758. {
  1759. const ScopedLockType lock (getLock());
  1760. ElementType* e = data.elements;
  1761. for (int i = numUsed; --i >= 0;)
  1762. {
  1763. if (valueToRemove == *e)
  1764. {
  1765. remove (static_cast <int> (e - data.elements.getData()));
  1766. break;
  1767. }
  1768. ++e;
  1769. }
  1770. }
  1771. void removeRange (int startIndex, int numberToRemove)
  1772. {
  1773. const ScopedLockType lock (getLock());
  1774. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1775. startIndex = jlimit (0, numUsed, startIndex);
  1776. if (endIndex > startIndex)
  1777. {
  1778. ElementType* const e = data.elements + startIndex;
  1779. numberToRemove = endIndex - startIndex;
  1780. for (int i = 0; i < numberToRemove; ++i)
  1781. e[i].~ElementType();
  1782. const int numToShift = numUsed - endIndex;
  1783. if (numToShift > 0)
  1784. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1785. numUsed -= numberToRemove;
  1786. if ((numUsed << 1) < data.numAllocated)
  1787. minimiseStorageOverheads();
  1788. }
  1789. }
  1790. void removeLast (int howManyToRemove = 1)
  1791. {
  1792. const ScopedLockType lock (getLock());
  1793. if (howManyToRemove > numUsed)
  1794. howManyToRemove = numUsed;
  1795. for (int i = 0; i < howManyToRemove; ++i)
  1796. data.elements [numUsed - i].~ElementType();
  1797. numUsed -= howManyToRemove;
  1798. if ((numUsed << 1) < data.numAllocated)
  1799. minimiseStorageOverheads();
  1800. }
  1801. template <class OtherArrayType>
  1802. void removeValuesIn (const OtherArrayType& otherArray)
  1803. {
  1804. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1805. const ScopedLockType lock2 (getLock());
  1806. if (this == &otherArray)
  1807. {
  1808. clear();
  1809. }
  1810. else
  1811. {
  1812. if (otherArray.size() > 0)
  1813. {
  1814. for (int i = numUsed; --i >= 0;)
  1815. if (otherArray.contains (data.elements [i]))
  1816. remove (i);
  1817. }
  1818. }
  1819. }
  1820. template <class OtherArrayType>
  1821. void removeValuesNotIn (const OtherArrayType& otherArray)
  1822. {
  1823. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1824. const ScopedLockType lock2 (getLock());
  1825. if (this != &otherArray)
  1826. {
  1827. if (otherArray.size() <= 0)
  1828. {
  1829. clear();
  1830. }
  1831. else
  1832. {
  1833. for (int i = numUsed; --i >= 0;)
  1834. if (! otherArray.contains (data.elements [i]))
  1835. remove (i);
  1836. }
  1837. }
  1838. }
  1839. void swap (const int index1,
  1840. const int index2)
  1841. {
  1842. const ScopedLockType lock (getLock());
  1843. if (((unsigned int) index1) < (unsigned int) numUsed
  1844. && ((unsigned int) index2) < (unsigned int) numUsed)
  1845. {
  1846. swapVariables (data.elements [index1],
  1847. data.elements [index2]);
  1848. }
  1849. }
  1850. void move (const int currentIndex, int newIndex) throw()
  1851. {
  1852. if (currentIndex != newIndex)
  1853. {
  1854. const ScopedLockType lock (getLock());
  1855. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1856. {
  1857. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1858. newIndex = numUsed - 1;
  1859. char tempCopy [sizeof (ElementType)];
  1860. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1861. if (newIndex > currentIndex)
  1862. {
  1863. memmove (data.elements + currentIndex,
  1864. data.elements + currentIndex + 1,
  1865. (newIndex - currentIndex) * sizeof (ElementType));
  1866. }
  1867. else
  1868. {
  1869. memmove (data.elements + newIndex + 1,
  1870. data.elements + newIndex,
  1871. (currentIndex - newIndex) * sizeof (ElementType));
  1872. }
  1873. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1874. }
  1875. }
  1876. }
  1877. void minimiseStorageOverheads()
  1878. {
  1879. const ScopedLockType lock (getLock());
  1880. data.shrinkToNoMoreThan (numUsed);
  1881. }
  1882. void ensureStorageAllocated (const int minNumElements)
  1883. {
  1884. const ScopedLockType lock (getLock());
  1885. data.ensureAllocatedSize (minNumElements);
  1886. }
  1887. template <class ElementComparator>
  1888. void sort (ElementComparator& comparator,
  1889. const bool retainOrderOfEquivalentItems = false) const
  1890. {
  1891. const ScopedLockType lock (getLock());
  1892. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1893. // avoids getting warning messages about the parameter being unused
  1894. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  1895. }
  1896. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1897. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1898. juce_UseDebuggingNewOperator
  1899. private:
  1900. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1901. int numUsed;
  1902. };
  1903. #endif // __JUCE_ARRAY_JUCEHEADER__
  1904. /*** End of inlined file: juce_Array.h ***/
  1905. #endif
  1906. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1907. #endif
  1908. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1909. /*** Start of inlined file: juce_BitArray.h ***/
  1910. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1911. #define __JUCE_BITARRAY_JUCEHEADER__
  1912. class MemoryBlock;
  1913. class JUCE_API BigInteger
  1914. {
  1915. public:
  1916. BigInteger();
  1917. BigInteger (unsigned int value);
  1918. BigInteger (int value);
  1919. BigInteger (int64 value);
  1920. BigInteger (const BigInteger& other);
  1921. ~BigInteger();
  1922. BigInteger& operator= (const BigInteger& other);
  1923. void swapWith (BigInteger& other) throw();
  1924. bool operator[] (int bit) const throw();
  1925. bool isZero() const throw();
  1926. bool isOne() const throw();
  1927. int toInteger() const throw();
  1928. void clear();
  1929. void clearBit (int bitNumber) throw();
  1930. void setBit (int bitNumber);
  1931. void setBit (int bitNumber, bool shouldBeSet);
  1932. void setRange (int startBit, int numBits, bool shouldBeSet);
  1933. void insertBit (int bitNumber, bool shouldBeSet);
  1934. const BigInteger getBitRange (int startBit, int numBits) const;
  1935. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1936. void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
  1937. void shiftBits (int howManyBitsLeft, int startBit);
  1938. int countNumberOfSetBits() const throw();
  1939. int findNextSetBit (int startIndex = 0) const throw();
  1940. int findNextClearBit (int startIndex = 0) const throw();
  1941. int getHighestBit() const throw();
  1942. // All the standard arithmetic ops...
  1943. BigInteger& operator+= (const BigInteger& other);
  1944. BigInteger& operator-= (const BigInteger& other);
  1945. BigInteger& operator*= (const BigInteger& other);
  1946. BigInteger& operator/= (const BigInteger& other);
  1947. BigInteger& operator|= (const BigInteger& other);
  1948. BigInteger& operator&= (const BigInteger& other);
  1949. BigInteger& operator^= (const BigInteger& other);
  1950. BigInteger& operator%= (const BigInteger& other);
  1951. BigInteger& operator<<= (int numBitsToShift);
  1952. BigInteger& operator>>= (int numBitsToShift);
  1953. BigInteger& operator++();
  1954. BigInteger& operator--();
  1955. const BigInteger operator++ (int);
  1956. const BigInteger operator-- (int);
  1957. const BigInteger operator-() const;
  1958. const BigInteger operator+ (const BigInteger& other) const;
  1959. const BigInteger operator- (const BigInteger& other) const;
  1960. const BigInteger operator* (const BigInteger& other) const;
  1961. const BigInteger operator/ (const BigInteger& other) const;
  1962. const BigInteger operator| (const BigInteger& other) const;
  1963. const BigInteger operator& (const BigInteger& other) const;
  1964. const BigInteger operator^ (const BigInteger& other) const;
  1965. const BigInteger operator% (const BigInteger& other) const;
  1966. const BigInteger operator<< (int numBitsToShift) const;
  1967. const BigInteger operator>> (int numBitsToShift) const;
  1968. bool operator== (const BigInteger& other) const throw();
  1969. bool operator!= (const BigInteger& other) const throw();
  1970. bool operator< (const BigInteger& other) const throw();
  1971. bool operator<= (const BigInteger& other) const throw();
  1972. bool operator> (const BigInteger& other) const throw();
  1973. bool operator>= (const BigInteger& other) const throw();
  1974. int compare (const BigInteger& other) const throw();
  1975. int compareAbsolute (const BigInteger& other) const throw();
  1976. void divideBy (const BigInteger& divisor, BigInteger& remainder);
  1977. const BigInteger findGreatestCommonDivisor (BigInteger other) const;
  1978. void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
  1979. void inverseModulo (const BigInteger& modulus);
  1980. bool isNegative() const throw();
  1981. void setNegative (const bool shouldBeNegative) throw();
  1982. void negate() throw();
  1983. const String toString (int base, int minimumNumCharacters = 1) const;
  1984. void parseString (const String& text, int base);
  1985. const MemoryBlock toMemoryBlock() const;
  1986. void loadFromMemoryBlock (const MemoryBlock& data);
  1987. juce_UseDebuggingNewOperator
  1988. private:
  1989. HeapBlock <unsigned int> values;
  1990. int numValues, highestBit;
  1991. bool negative;
  1992. void ensureSize (int numVals);
  1993. static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
  1994. };
  1995. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
  1996. typedef BigInteger BitArray;
  1997. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1998. /*** End of inlined file: juce_BitArray.h ***/
  1999. #endif
  2000. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2001. /*** Start of inlined file: juce_DynamicObject.h ***/
  2002. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2003. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2004. /*** Start of inlined file: juce_NamedValueSet.h ***/
  2005. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2006. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  2007. /*** Start of inlined file: juce_Variant.h ***/
  2008. #ifndef __JUCE_VARIANT_JUCEHEADER__
  2009. #define __JUCE_VARIANT_JUCEHEADER__
  2010. /*** Start of inlined file: juce_OutputStream.h ***/
  2011. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2012. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2013. /*** Start of inlined file: juce_InputStream.h ***/
  2014. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2015. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2016. /*** Start of inlined file: juce_MemoryBlock.h ***/
  2017. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2018. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2019. class JUCE_API MemoryBlock
  2020. {
  2021. public:
  2022. MemoryBlock() throw();
  2023. MemoryBlock (const size_t initialSize,
  2024. const bool initialiseToZero = false) throw();
  2025. MemoryBlock (const MemoryBlock& other) throw();
  2026. MemoryBlock (const void* const dataToInitialiseFrom,
  2027. const size_t sizeInBytes) throw();
  2028. ~MemoryBlock() throw();
  2029. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2030. bool operator== (const MemoryBlock& other) const throw();
  2031. bool operator!= (const MemoryBlock& other) const throw();
  2032. bool matches (const void* data, size_t dataSize) const throw();
  2033. void* getData() const throw() { return data; }
  2034. template <typename Type>
  2035. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2036. size_t getSize() const throw() { return size; }
  2037. void setSize (const size_t newSize,
  2038. const bool initialiseNewSpaceToZero = false) throw();
  2039. void ensureSize (const size_t minimumSize,
  2040. const bool initialiseNewSpaceToZero = false) throw();
  2041. void fillWith (const uint8 valueToUse) throw();
  2042. void append (const void* const data,
  2043. const size_t numBytes) throw();
  2044. void swapWith (MemoryBlock& other) throw();
  2045. void copyFrom (const void* srcData,
  2046. int destinationOffset,
  2047. size_t numBytes) throw();
  2048. void copyTo (void* destData,
  2049. int sourceOffset,
  2050. size_t numBytes) const throw();
  2051. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2052. const String toString() const throw();
  2053. void loadFromHexString (const String& sourceHexString) throw();
  2054. void setBitRange (size_t bitRangeStart,
  2055. size_t numBits,
  2056. int binaryNumberToApply) throw();
  2057. int getBitRange (size_t bitRangeStart,
  2058. size_t numBitsToRead) const throw();
  2059. const String toBase64Encoding() const throw();
  2060. bool fromBase64Encoding (const String& encodedString) throw();
  2061. juce_UseDebuggingNewOperator
  2062. private:
  2063. HeapBlock <char> data;
  2064. size_t size;
  2065. };
  2066. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2067. /*** End of inlined file: juce_MemoryBlock.h ***/
  2068. class JUCE_API InputStream
  2069. {
  2070. public:
  2071. virtual ~InputStream() {}
  2072. virtual int64 getTotalLength() = 0;
  2073. virtual bool isExhausted() = 0;
  2074. virtual int read (void* destBuffer, int maxBytesToRead) = 0;
  2075. virtual char readByte();
  2076. virtual bool readBool();
  2077. virtual short readShort();
  2078. virtual short readShortBigEndian();
  2079. virtual int readInt();
  2080. virtual int readIntBigEndian();
  2081. virtual int64 readInt64();
  2082. virtual int64 readInt64BigEndian();
  2083. virtual float readFloat();
  2084. virtual float readFloatBigEndian();
  2085. virtual double readDouble();
  2086. virtual double readDoubleBigEndian();
  2087. virtual int readCompressedInt();
  2088. virtual const String readNextLine();
  2089. virtual const String readString();
  2090. virtual const String readEntireStreamAsString();
  2091. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2092. int maxNumBytesToRead = -1);
  2093. virtual int64 getPosition() = 0;
  2094. virtual bool setPosition (int64 newPosition) = 0;
  2095. virtual void skipNextBytes (int64 numBytesToSkip);
  2096. juce_UseDebuggingNewOperator
  2097. protected:
  2098. InputStream() throw() {}
  2099. };
  2100. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2101. /*** End of inlined file: juce_InputStream.h ***/
  2102. class JUCE_API OutputStream
  2103. {
  2104. protected:
  2105. OutputStream();
  2106. public:
  2107. virtual ~OutputStream();
  2108. virtual void flush() = 0;
  2109. virtual bool setPosition (int64 newPosition) = 0;
  2110. virtual int64 getPosition() = 0;
  2111. virtual bool write (const void* dataToWrite,
  2112. int howManyBytes) = 0;
  2113. virtual void writeByte (char byte);
  2114. virtual void writeBool (bool boolValue);
  2115. virtual void writeShort (short value);
  2116. virtual void writeShortBigEndian (short value);
  2117. virtual void writeInt (int value);
  2118. virtual void writeIntBigEndian (int value);
  2119. virtual void writeInt64 (int64 value);
  2120. virtual void writeInt64BigEndian (int64 value);
  2121. virtual void writeFloat (float value);
  2122. virtual void writeFloatBigEndian (float value);
  2123. virtual void writeDouble (double value);
  2124. virtual void writeDoubleBigEndian (double value);
  2125. virtual void writeCompressedInt (int value);
  2126. virtual void writeString (const String& text);
  2127. virtual void writeText (const String& text,
  2128. bool asUnicode,
  2129. bool writeUnicodeHeaderBytes);
  2130. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2131. juce_UseDebuggingNewOperator
  2132. };
  2133. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
  2134. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
  2135. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
  2136. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
  2137. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2138. /*** End of inlined file: juce_OutputStream.h ***/
  2139. class JUCE_API DynamicObject;
  2140. class JUCE_API var
  2141. {
  2142. public:
  2143. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2144. var() throw();
  2145. ~var() throw();
  2146. static const var null;
  2147. var (const var& valueToCopy);
  2148. var (int value) throw();
  2149. var (bool value) throw();
  2150. var (double value) throw();
  2151. var (const char* value);
  2152. var (const juce_wchar* value);
  2153. var (const String& value);
  2154. var (DynamicObject* object);
  2155. var (MethodFunction method) throw();
  2156. var& operator= (const var& valueToCopy);
  2157. var& operator= (int value);
  2158. var& operator= (bool value);
  2159. var& operator= (double value);
  2160. var& operator= (const char* value);
  2161. var& operator= (const juce_wchar* value);
  2162. var& operator= (const String& value);
  2163. var& operator= (DynamicObject* object);
  2164. var& operator= (MethodFunction method);
  2165. void swapWith (var& other) throw();
  2166. operator int() const;
  2167. operator bool() const;
  2168. operator float() const;
  2169. operator double() const;
  2170. operator const String() const;
  2171. const String toString() const;
  2172. DynamicObject* getObject() const;
  2173. bool isVoid() const throw() { return type == voidType; }
  2174. bool isInt() const throw() { return type == intType; }
  2175. bool isBool() const throw() { return type == boolType; }
  2176. bool isDouble() const throw() { return type == doubleType; }
  2177. bool isString() const throw() { return type == stringType; }
  2178. bool isObject() const throw() { return type == objectType; }
  2179. bool isMethod() const throw() { return type == methodType; }
  2180. void writeToStream (OutputStream& output) const;
  2181. static const var readFromStream (InputStream& input);
  2182. class JUCE_API identifier
  2183. {
  2184. public:
  2185. identifier() throw();
  2186. identifier (const char* name);
  2187. identifier (const String& name);
  2188. ~identifier();
  2189. bool operator== (const identifier& other) const throw()
  2190. {
  2191. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2192. return hashCode == other.hashCode;
  2193. }
  2194. String name;
  2195. int hashCode;
  2196. };
  2197. const var operator[] (const identifier& propertyName) const;
  2198. const var call (const identifier& method) const;
  2199. const var call (const identifier& method, const var& arg1) const;
  2200. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2201. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2202. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2203. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2204. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2205. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2206. juce_UseDebuggingNewOperator
  2207. bool equals (const var& other) const throw();
  2208. private:
  2209. enum Type
  2210. {
  2211. voidType = 0,
  2212. intType,
  2213. boolType,
  2214. doubleType,
  2215. stringType,
  2216. objectType,
  2217. methodType
  2218. };
  2219. union ValueUnion
  2220. {
  2221. int intValue;
  2222. bool boolValue;
  2223. double doubleValue;
  2224. String* stringValue;
  2225. DynamicObject* objectValue;
  2226. MethodFunction methodValue;
  2227. };
  2228. Type type;
  2229. ValueUnion value;
  2230. };
  2231. bool operator== (const var& v1, const var& v2) throw();
  2232. bool operator!= (const var& v1, const var& v2) throw();
  2233. bool operator== (const var& v1, const String& v2) throw();
  2234. bool operator!= (const var& v1, const String& v2) throw();
  2235. #endif // __JUCE_VARIANT_JUCEHEADER__
  2236. /*** End of inlined file: juce_Variant.h ***/
  2237. class JUCE_API NamedValueSet
  2238. {
  2239. public:
  2240. NamedValueSet() throw();
  2241. NamedValueSet (const NamedValueSet& other);
  2242. NamedValueSet& operator= (const NamedValueSet& other);
  2243. ~NamedValueSet();
  2244. int size() const throw();
  2245. const var& operator[] (const var::identifier& name) const;
  2246. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2247. var* getItem (const var::identifier& name) const;
  2248. bool set (const var::identifier& name, const var& newValue);
  2249. bool contains (const var::identifier& name) const;
  2250. bool remove (const var::identifier& name);
  2251. const var::identifier getName (int index) const;
  2252. void clear();
  2253. juce_UseDebuggingNewOperator
  2254. private:
  2255. struct NamedValue
  2256. {
  2257. NamedValue() throw();
  2258. NamedValue (const var::identifier& name, const var& value);
  2259. var::identifier name;
  2260. var value;
  2261. };
  2262. Array <NamedValue> values;
  2263. };
  2264. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2265. /*** End of inlined file: juce_NamedValueSet.h ***/
  2266. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2267. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2268. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2269. /*** Start of inlined file: juce_Atomic.h ***/
  2270. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2271. #define __JUCE_ATOMIC_JUCEHEADER__
  2272. class JUCE_API Atomic
  2273. {
  2274. public:
  2275. static void increment (int32& variable);
  2276. static int32 incrementAndReturn (int32& variable);
  2277. static void decrement (int32& variable);
  2278. static int32 decrementAndReturn (int32& variable);
  2279. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2280. static void* swapPointers (void* volatile* value1, void* value2);
  2281. private:
  2282. Atomic();
  2283. Atomic (const Atomic&);
  2284. Atomic& operator= (const Atomic&);
  2285. };
  2286. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2287. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 (static_cast <int32_t*> (&variable)); }
  2288. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 (static_cast <int32_t*> (&variable)); }
  2289. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 (static_cast <int32_t*> (&variable)); }
  2290. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 (static_cast <int32_t*> (&variable)); }
  2291. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2292. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, static_cast <int32_t*> (&destination)); }
  2293. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2294. {
  2295. void* currentVal = *value1;
  2296. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2297. while (! OSAtomicCompareAndSwap32 (reinterpret_cast <int32_t> (currentVal), reinterpret_cast <int32_t> (value2),
  2298. const_cast <int32_t*> (reinterpret_cast <volatile int32_t*> (value1)))) { currentVal = *value1; }
  2299. #else
  2300. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2301. #endif
  2302. return currentVal;
  2303. }
  2304. #elif JUCE_LINUX // Linux...
  2305. #if __INTEL_COMPILER
  2306. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (&variable); }
  2307. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (&variable); }
  2308. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (&variable); }
  2309. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (&variable); }
  2310. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2311. { return _InterlockedCompareExchange (&destination, newValue, oldValue); }
  2312. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2313. {
  2314. #if __ia64__
  2315. return reinterpret_cast<void*> (_InterlockedExchange64 (const_cast<void**> (value1), reinterpret_cast<__int64> (value2)));
  2316. #else
  2317. return reinterpret_cast<void*> (_InterlockedExchange (const_cast<void**> (value1), reinterpret_cast<long> (value2)));
  2318. #endif
  2319. }
  2320. #else
  2321. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2322. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2323. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2324. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2325. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2326. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2327. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2328. {
  2329. void* currentVal = *value1;
  2330. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2331. return currentVal;
  2332. }
  2333. #endif
  2334. #elif JUCE_USE_INTRINSICS // Windows...
  2335. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is declared in juce_win32_Threads.cpp)
  2336. #pragma intrinsic (_InterlockedIncrement)
  2337. #pragma intrinsic (_InterlockedDecrement)
  2338. #pragma intrinsic (_InterlockedCompareExchange)
  2339. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2340. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2341. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2342. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2343. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2344. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2345. #endif
  2346. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2347. /*** End of inlined file: juce_Atomic.h ***/
  2348. class JUCE_API ReferenceCountedObject
  2349. {
  2350. public:
  2351. inline void incReferenceCount() throw()
  2352. {
  2353. Atomic::increment (refCounts);
  2354. jassert (refCounts > 0);
  2355. }
  2356. inline void decReferenceCount() throw()
  2357. {
  2358. jassert (refCounts > 0);
  2359. if (Atomic::decrementAndReturn (refCounts) == 0)
  2360. delete this;
  2361. }
  2362. inline int getReferenceCount() const throw()
  2363. {
  2364. return refCounts;
  2365. }
  2366. protected:
  2367. ReferenceCountedObject()
  2368. : refCounts (0)
  2369. {
  2370. }
  2371. virtual ~ReferenceCountedObject()
  2372. {
  2373. // it's dangerous to delete an object that's still referenced by something else!
  2374. jassert (refCounts == 0);
  2375. }
  2376. private:
  2377. int32 refCounts;
  2378. };
  2379. template <class ReferenceCountedObjectClass>
  2380. class ReferenceCountedObjectPtr
  2381. {
  2382. public:
  2383. inline ReferenceCountedObjectPtr() throw()
  2384. : referencedObject (0)
  2385. {
  2386. }
  2387. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2388. : referencedObject (refCountedObject)
  2389. {
  2390. if (refCountedObject != 0)
  2391. refCountedObject->incReferenceCount();
  2392. }
  2393. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2394. : referencedObject (other.referencedObject)
  2395. {
  2396. if (referencedObject != 0)
  2397. referencedObject->incReferenceCount();
  2398. }
  2399. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2400. {
  2401. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2402. if (newObject != referencedObject)
  2403. {
  2404. if (newObject != 0)
  2405. newObject->incReferenceCount();
  2406. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2407. referencedObject = newObject;
  2408. if (oldObject != 0)
  2409. oldObject->decReferenceCount();
  2410. }
  2411. return *this;
  2412. }
  2413. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2414. {
  2415. if (referencedObject != newObject)
  2416. {
  2417. if (newObject != 0)
  2418. newObject->incReferenceCount();
  2419. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2420. referencedObject = newObject;
  2421. if (oldObject != 0)
  2422. oldObject->decReferenceCount();
  2423. }
  2424. return *this;
  2425. }
  2426. inline ~ReferenceCountedObjectPtr()
  2427. {
  2428. if (referencedObject != 0)
  2429. referencedObject->decReferenceCount();
  2430. }
  2431. inline operator ReferenceCountedObjectClass*() const throw()
  2432. {
  2433. return referencedObject;
  2434. }
  2435. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2436. {
  2437. return referencedObject == object;
  2438. }
  2439. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2440. {
  2441. return referencedObject != object;
  2442. }
  2443. // the -> operator is called on the referenced object
  2444. inline ReferenceCountedObjectClass* operator->() const throw()
  2445. {
  2446. return referencedObject;
  2447. }
  2448. inline ReferenceCountedObjectClass* getObject() const throw()
  2449. {
  2450. return referencedObject;
  2451. }
  2452. private:
  2453. ReferenceCountedObjectClass* referencedObject;
  2454. };
  2455. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2456. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2457. class JUCE_API DynamicObject : public ReferenceCountedObject
  2458. {
  2459. public:
  2460. DynamicObject();
  2461. virtual ~DynamicObject();
  2462. virtual bool hasProperty (const var::identifier& propertyName) const;
  2463. virtual const var getProperty (const var::identifier& propertyName) const;
  2464. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2465. virtual void removeProperty (const var::identifier& propertyName);
  2466. virtual bool hasMethod (const var::identifier& methodName) const;
  2467. virtual const var invokeMethod (const var::identifier& methodName,
  2468. const var* parameters,
  2469. int numParameters);
  2470. void setMethod (const var::identifier& methodName,
  2471. var::MethodFunction methodFunction);
  2472. void clear();
  2473. juce_UseDebuggingNewOperator
  2474. private:
  2475. NamedValueSet properties;
  2476. };
  2477. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2478. /*** End of inlined file: juce_DynamicObject.h ***/
  2479. #endif
  2480. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2481. #endif
  2482. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2483. #endif
  2484. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2485. #endif
  2486. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2487. #endif
  2488. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2489. /*** Start of inlined file: juce_OwnedArray.h ***/
  2490. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2491. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2492. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2493. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2494. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2495. template <class ObjectType>
  2496. class JUCE_API ScopedPointer
  2497. {
  2498. public:
  2499. inline ScopedPointer() throw() : object (0)
  2500. {
  2501. }
  2502. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2503. : object (objectToTakePossessionOf)
  2504. {
  2505. }
  2506. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2507. : object (objectToTransferFrom.object)
  2508. {
  2509. objectToTransferFrom.object = 0;
  2510. }
  2511. inline ~ScopedPointer() { delete object; }
  2512. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2513. {
  2514. if (this != objectToTransferFrom.getAddress())
  2515. {
  2516. // Two ScopedPointers should never be able to refer to the same object - if
  2517. // this happens, you must have done something dodgy!
  2518. jassert (object == 0 || object != objectToTransferFrom.object);
  2519. ObjectType* const oldObject = object;
  2520. object = objectToTransferFrom.object;
  2521. objectToTransferFrom.object = 0;
  2522. delete oldObject;
  2523. }
  2524. return *this;
  2525. }
  2526. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2527. {
  2528. if (object != newObjectToTakePossessionOf)
  2529. {
  2530. ObjectType* const oldObject = object;
  2531. object = newObjectToTakePossessionOf;
  2532. delete oldObject;
  2533. }
  2534. return *this;
  2535. }
  2536. inline operator ObjectType*() const throw() { return object; }
  2537. inline ObjectType& operator*() const throw() { return *object; }
  2538. inline ObjectType* operator->() const throw() { return object; }
  2539. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2540. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2541. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2542. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2543. {
  2544. // Two ScopedPointers should never be able to refer to the same object - if
  2545. // this happens, you must have done something dodgy!
  2546. jassert (object != other.object);
  2547. swapVariables (object, other.object);
  2548. }
  2549. private:
  2550. ObjectType* object;
  2551. // (Required as an alternative to the overloaded & operator).
  2552. const ScopedPointer* getAddress() const throw() { return this; }
  2553. #if ! JUCE_MSVC // (MSVC can't deal with multiple copy constructors)
  2554. // This is private to stop people accidentally copying a const ScopedPointer (the compiler
  2555. // will let you do so by implicitly casting the source to its raw object pointer).
  2556. ScopedPointer (const ScopedPointer&);
  2557. #endif
  2558. };
  2559. template <class ObjectType>
  2560. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2561. {
  2562. return static_cast <ObjectType*> (pointer1) == pointer2;
  2563. }
  2564. template <class ObjectType>
  2565. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2566. {
  2567. return static_cast <ObjectType*> (pointer1) != pointer2;
  2568. }
  2569. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2570. /*** End of inlined file: juce_ScopedPointer.h ***/
  2571. template <class ObjectClass,
  2572. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2573. class OwnedArray
  2574. {
  2575. public:
  2576. OwnedArray() throw()
  2577. : numUsed (0)
  2578. {
  2579. }
  2580. ~OwnedArray()
  2581. {
  2582. clear (true);
  2583. }
  2584. void clear (const bool deleteObjects = true)
  2585. {
  2586. const ScopedLockType lock (getLock());
  2587. if (deleteObjects)
  2588. {
  2589. while (numUsed > 0)
  2590. delete data.elements [--numUsed];
  2591. }
  2592. data.setAllocatedSize (0);
  2593. numUsed = 0;
  2594. }
  2595. inline int size() const throw()
  2596. {
  2597. return numUsed;
  2598. }
  2599. inline ObjectClass* operator[] (const int index) const throw()
  2600. {
  2601. const ScopedLockType lock (getLock());
  2602. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2603. : static_cast <ObjectClass*> (0);
  2604. }
  2605. inline ObjectClass* getUnchecked (const int index) const throw()
  2606. {
  2607. const ScopedLockType lock (getLock());
  2608. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2609. return data.elements [index];
  2610. }
  2611. inline ObjectClass* getFirst() const throw()
  2612. {
  2613. const ScopedLockType lock (getLock());
  2614. return numUsed > 0 ? data.elements [0]
  2615. : static_cast <ObjectClass*> (0);
  2616. }
  2617. inline ObjectClass* getLast() const throw()
  2618. {
  2619. const ScopedLockType lock (getLock());
  2620. return numUsed > 0 ? data.elements [numUsed - 1]
  2621. : static_cast <ObjectClass*> (0);
  2622. }
  2623. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2624. {
  2625. const ScopedLockType lock (getLock());
  2626. ObjectClass* const* e = data.elements.getData();
  2627. ObjectClass* const* const end = e + numUsed;
  2628. while (e != end)
  2629. {
  2630. if (objectToLookFor == *e)
  2631. return static_cast <int> (e - data.elements.getData());
  2632. ++e;
  2633. }
  2634. return -1;
  2635. }
  2636. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2637. {
  2638. const ScopedLockType lock (getLock());
  2639. ObjectClass* const* e = data.elements.getData();
  2640. ObjectClass* const* const end = e + numUsed;
  2641. while (e != end)
  2642. {
  2643. if (objectToLookFor == *e)
  2644. return true;
  2645. ++e;
  2646. }
  2647. return false;
  2648. }
  2649. void add (const ObjectClass* const newObject) throw()
  2650. {
  2651. const ScopedLockType lock (getLock());
  2652. data.ensureAllocatedSize (numUsed + 1);
  2653. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2654. }
  2655. void insert (int indexToInsertAt,
  2656. const ObjectClass* const newObject) throw()
  2657. {
  2658. if (indexToInsertAt >= 0)
  2659. {
  2660. const ScopedLockType lock (getLock());
  2661. if (indexToInsertAt > numUsed)
  2662. indexToInsertAt = numUsed;
  2663. data.ensureAllocatedSize (numUsed + 1);
  2664. ObjectClass** const e = data.elements + indexToInsertAt;
  2665. const int numToMove = numUsed - indexToInsertAt;
  2666. if (numToMove > 0)
  2667. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2668. *e = const_cast <ObjectClass*> (newObject);
  2669. ++numUsed;
  2670. }
  2671. else
  2672. {
  2673. add (newObject);
  2674. }
  2675. }
  2676. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2677. {
  2678. const ScopedLockType lock (getLock());
  2679. if (! contains (newObject))
  2680. add (newObject);
  2681. }
  2682. void set (const int indexToChange,
  2683. const ObjectClass* const newObject,
  2684. const bool deleteOldElement = true)
  2685. {
  2686. if (indexToChange >= 0)
  2687. {
  2688. ScopedPointer <ObjectClass> toDelete;
  2689. const ScopedLockType lock (getLock());
  2690. if (indexToChange < numUsed)
  2691. {
  2692. if (deleteOldElement)
  2693. {
  2694. toDelete = data.elements [indexToChange];
  2695. if (toDelete == newObject)
  2696. toDelete = 0;
  2697. }
  2698. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2699. }
  2700. else
  2701. {
  2702. data.ensureAllocatedSize (numUsed + 1);
  2703. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2704. }
  2705. }
  2706. }
  2707. template <class OtherArrayType>
  2708. void addArray (const OtherArrayType& arrayToAddFrom,
  2709. int startIndex = 0,
  2710. int numElementsToAdd = -1)
  2711. {
  2712. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2713. const ScopedLockType lock2 (getLock());
  2714. if (startIndex < 0)
  2715. {
  2716. jassertfalse
  2717. startIndex = 0;
  2718. }
  2719. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2720. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2721. while (--numElementsToAdd >= 0)
  2722. add (arrayToAddFrom.getUnchecked (startIndex++));
  2723. }
  2724. template <class ElementComparator>
  2725. void addSorted (ElementComparator& comparator,
  2726. ObjectClass* const newObject) throw()
  2727. {
  2728. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2729. // avoids getting warning messages about the parameter being unused
  2730. const ScopedLockType lock (getLock());
  2731. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2732. }
  2733. template <class ElementComparator>
  2734. int indexOfSorted (ElementComparator& comparator,
  2735. const ObjectClass* const objectToLookFor) const throw()
  2736. {
  2737. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2738. // avoids getting warning messages about the parameter being unused
  2739. const ScopedLockType lock (getLock());
  2740. int start = 0;
  2741. int end = numUsed;
  2742. for (;;)
  2743. {
  2744. if (start >= end)
  2745. {
  2746. return -1;
  2747. }
  2748. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2749. {
  2750. return start;
  2751. }
  2752. else
  2753. {
  2754. const int halfway = (start + end) >> 1;
  2755. if (halfway == start)
  2756. return -1;
  2757. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2758. start = halfway;
  2759. else
  2760. end = halfway;
  2761. }
  2762. }
  2763. }
  2764. void remove (const int indexToRemove,
  2765. const bool deleteObject = true)
  2766. {
  2767. ScopedPointer <ObjectClass> toDelete;
  2768. const ScopedLockType lock (getLock());
  2769. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2770. {
  2771. ObjectClass** const e = data.elements + indexToRemove;
  2772. if (deleteObject)
  2773. toDelete = *e;
  2774. --numUsed;
  2775. const int numToShift = numUsed - indexToRemove;
  2776. if (numToShift > 0)
  2777. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2778. if ((numUsed << 1) < data.numAllocated)
  2779. minimiseStorageOverheads();
  2780. }
  2781. }
  2782. void removeObject (const ObjectClass* const objectToRemove,
  2783. const bool deleteObject = true)
  2784. {
  2785. const ScopedLockType lock (getLock());
  2786. ObjectClass** e = data.elements.getData();
  2787. for (int i = numUsed; --i >= 0;)
  2788. {
  2789. if (objectToRemove == *e)
  2790. {
  2791. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2792. break;
  2793. }
  2794. ++e;
  2795. }
  2796. }
  2797. void removeRange (int startIndex,
  2798. const int numberToRemove,
  2799. const bool deleteObjects = true)
  2800. {
  2801. const ScopedLockType lock (getLock());
  2802. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2803. startIndex = jlimit (0, numUsed, startIndex);
  2804. if (endIndex > startIndex)
  2805. {
  2806. if (deleteObjects)
  2807. {
  2808. for (int i = startIndex; i < endIndex; ++i)
  2809. {
  2810. delete data.elements [i];
  2811. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2812. }
  2813. }
  2814. const int rangeSize = endIndex - startIndex;
  2815. ObjectClass** e = data.elements + startIndex;
  2816. int numToShift = numUsed - endIndex;
  2817. numUsed -= rangeSize;
  2818. while (--numToShift >= 0)
  2819. {
  2820. *e = e [rangeSize];
  2821. ++e;
  2822. }
  2823. if ((numUsed << 1) < data.numAllocated)
  2824. minimiseStorageOverheads();
  2825. }
  2826. }
  2827. void removeLast (int howManyToRemove = 1,
  2828. const bool deleteObjects = true)
  2829. {
  2830. const ScopedLockType lock (getLock());
  2831. if (howManyToRemove >= numUsed)
  2832. {
  2833. clear (deleteObjects);
  2834. }
  2835. else
  2836. {
  2837. while (--howManyToRemove >= 0)
  2838. remove (numUsed - 1, deleteObjects);
  2839. }
  2840. }
  2841. void swap (const int index1,
  2842. const int index2) throw()
  2843. {
  2844. const ScopedLockType lock (getLock());
  2845. if (((unsigned int) index1) < (unsigned int) numUsed
  2846. && ((unsigned int) index2) < (unsigned int) numUsed)
  2847. {
  2848. swapVariables (data.elements [index1],
  2849. data.elements [index2]);
  2850. }
  2851. }
  2852. void move (const int currentIndex,
  2853. int newIndex) throw()
  2854. {
  2855. if (currentIndex != newIndex)
  2856. {
  2857. const ScopedLockType lock (getLock());
  2858. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2859. {
  2860. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2861. newIndex = numUsed - 1;
  2862. ObjectClass* const value = data.elements [currentIndex];
  2863. if (newIndex > currentIndex)
  2864. {
  2865. memmove (data.elements + currentIndex,
  2866. data.elements + currentIndex + 1,
  2867. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2868. }
  2869. else
  2870. {
  2871. memmove (data.elements + newIndex + 1,
  2872. data.elements + newIndex,
  2873. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2874. }
  2875. data.elements [newIndex] = value;
  2876. }
  2877. }
  2878. }
  2879. void swapWithArray (OwnedArray& otherArray) throw()
  2880. {
  2881. const ScopedLockType lock1 (getLock());
  2882. const ScopedLockType lock2 (otherArray.getLock());
  2883. data.swapWith (otherArray.data);
  2884. swapVariables (numUsed, otherArray.numUsed);
  2885. }
  2886. void minimiseStorageOverheads() throw()
  2887. {
  2888. const ScopedLockType lock (getLock());
  2889. data.shrinkToNoMoreThan (numUsed);
  2890. }
  2891. void ensureStorageAllocated (const int minNumElements) throw()
  2892. {
  2893. const ScopedLockType lock (getLock());
  2894. data.ensureAllocatedSize (minNumElements);
  2895. }
  2896. template <class ElementComparator>
  2897. void sort (ElementComparator& comparator,
  2898. const bool retainOrderOfEquivalentItems = false) const throw()
  2899. {
  2900. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2901. // avoids getting warning messages about the parameter being unused
  2902. const ScopedLockType lock (getLock());
  2903. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2904. }
  2905. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2906. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2907. juce_UseDebuggingNewOperator
  2908. private:
  2909. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2910. int numUsed;
  2911. // disallow copy constructor and assignment
  2912. OwnedArray (const OwnedArray&);
  2913. OwnedArray& operator= (const OwnedArray&);
  2914. };
  2915. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2916. /*** End of inlined file: juce_OwnedArray.h ***/
  2917. #endif
  2918. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2919. /*** Start of inlined file: juce_PropertySet.h ***/
  2920. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2921. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2922. /*** Start of inlined file: juce_StringPairArray.h ***/
  2923. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2924. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2925. /*** Start of inlined file: juce_StringArray.h ***/
  2926. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2927. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2928. class JUCE_API StringArray
  2929. {
  2930. public:
  2931. StringArray() throw();
  2932. StringArray (const StringArray& other);
  2933. explicit StringArray (const String& firstValue);
  2934. StringArray (const juce_wchar** strings, int numberOfStrings);
  2935. StringArray (const char** strings, int numberOfStrings);
  2936. explicit StringArray (const juce_wchar** strings);
  2937. explicit StringArray (const char** strings);
  2938. ~StringArray();
  2939. StringArray& operator= (const StringArray& other);
  2940. bool operator== (const StringArray& other) const throw();
  2941. bool operator!= (const StringArray& other) const throw();
  2942. inline int size() const throw() { return strings.size(); };
  2943. const String& operator[] (int index) const throw();
  2944. bool contains (const String& stringToLookFor,
  2945. bool ignoreCase = false) const;
  2946. int indexOf (const String& stringToLookFor,
  2947. bool ignoreCase = false,
  2948. int startIndex = 0) const;
  2949. void add (const String& stringToAdd);
  2950. void insert (int index, const String& stringToAdd);
  2951. void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
  2952. void set (int index, const String& newString);
  2953. void addArray (const StringArray& other,
  2954. int startIndex = 0,
  2955. int numElementsToAdd = -1);
  2956. int addTokens (const String& stringToTokenise,
  2957. bool preserveQuotedStrings);
  2958. int addTokens (const String& stringToTokenise,
  2959. const String& breakCharacters,
  2960. const String& quoteCharacters);
  2961. int addLines (const String& stringToBreakUp);
  2962. void clear();
  2963. void remove (int index);
  2964. void removeString (const String& stringToRemove,
  2965. bool ignoreCase = false);
  2966. void removeDuplicates (bool ignoreCase);
  2967. void removeEmptyStrings (bool removeWhitespaceStrings = true);
  2968. void move (int currentIndex, int newIndex) throw();
  2969. void trim();
  2970. void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
  2971. bool appendNumberToFirstInstance,
  2972. const juce_wchar* preNumberString = 0,
  2973. const juce_wchar* postNumberString = 0);
  2974. const String joinIntoString (const String& separatorString,
  2975. int startIndex = 0,
  2976. int numberOfElements = -1) const;
  2977. void sort (bool ignoreCase);
  2978. void minimiseStorageOverheads();
  2979. juce_UseDebuggingNewOperator
  2980. private:
  2981. Array <String> strings;
  2982. };
  2983. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2984. /*** End of inlined file: juce_StringArray.h ***/
  2985. class JUCE_API StringPairArray
  2986. {
  2987. public:
  2988. StringPairArray (bool ignoreCaseWhenComparingKeys = true);
  2989. StringPairArray (const StringPairArray& other);
  2990. ~StringPairArray();
  2991. StringPairArray& operator= (const StringPairArray& other);
  2992. bool operator== (const StringPairArray& other) const;
  2993. bool operator!= (const StringPairArray& other) const;
  2994. const String& operator[] (const String& key) const;
  2995. const String getValue (const String& key, const String& defaultReturnValue) const;
  2996. const StringArray& getAllKeys() const throw() { return keys; }
  2997. const StringArray& getAllValues() const throw() { return values; }
  2998. inline int size() const throw() { return keys.size(); };
  2999. void set (const String& key, const String& value);
  3000. void addArray (const StringPairArray& other);
  3001. void clear();
  3002. void remove (const String& key);
  3003. void remove (int index);
  3004. void setIgnoresCase (bool shouldIgnoreCase);
  3005. const String getDescription() const;
  3006. void minimiseStorageOverheads();
  3007. juce_UseDebuggingNewOperator
  3008. private:
  3009. StringArray keys, values;
  3010. bool ignoreCase;
  3011. };
  3012. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3013. /*** End of inlined file: juce_StringPairArray.h ***/
  3014. /*** Start of inlined file: juce_XmlElement.h ***/
  3015. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3016. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3017. /*** Start of inlined file: juce_File.h ***/
  3018. #ifndef __JUCE_FILE_JUCEHEADER__
  3019. #define __JUCE_FILE_JUCEHEADER__
  3020. /*** Start of inlined file: juce_Time.h ***/
  3021. #ifndef __JUCE_TIME_JUCEHEADER__
  3022. #define __JUCE_TIME_JUCEHEADER__
  3023. /*** Start of inlined file: juce_RelativeTime.h ***/
  3024. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3025. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3026. class JUCE_API RelativeTime
  3027. {
  3028. public:
  3029. explicit RelativeTime (double seconds = 0.0) throw();
  3030. RelativeTime (const RelativeTime& other) throw();
  3031. RelativeTime& operator= (const RelativeTime& other) throw();
  3032. ~RelativeTime() throw();
  3033. static const RelativeTime milliseconds (int milliseconds) throw();
  3034. static const RelativeTime milliseconds (int64 milliseconds) throw();
  3035. static const RelativeTime minutes (double numberOfMinutes) throw();
  3036. static const RelativeTime hours (double numberOfHours) throw();
  3037. static const RelativeTime days (double numberOfDays) throw();
  3038. static const RelativeTime weeks (double numberOfWeeks) throw();
  3039. int64 inMilliseconds() const throw();
  3040. double inSeconds() const throw() { return seconds; }
  3041. double inMinutes() const throw();
  3042. double inHours() const throw();
  3043. double inDays() const throw();
  3044. double inWeeks() const throw();
  3045. const String getDescription (const String& returnValueForZeroTime = "0") const throw();
  3046. bool operator== (const RelativeTime& other) const throw();
  3047. bool operator!= (const RelativeTime& other) const throw();
  3048. bool operator> (const RelativeTime& other) const throw();
  3049. bool operator< (const RelativeTime& other) const throw();
  3050. bool operator>= (const RelativeTime& other) const throw();
  3051. bool operator<= (const RelativeTime& other) const throw();
  3052. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3053. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3054. const RelativeTime operator+ (double secondsToAdd) const throw();
  3055. const RelativeTime operator- (double secondsToSubtract) const throw();
  3056. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3057. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3058. const RelativeTime& operator+= (double secondsToAdd) throw();
  3059. const RelativeTime& operator-= (double secondsToSubtract) throw();
  3060. juce_UseDebuggingNewOperator
  3061. private:
  3062. double seconds;
  3063. };
  3064. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3065. /*** End of inlined file: juce_RelativeTime.h ***/
  3066. class JUCE_API Time
  3067. {
  3068. public:
  3069. Time() throw();
  3070. Time (const Time& other) throw();
  3071. Time (int64 millisecondsSinceEpoch) throw();
  3072. Time (int year,
  3073. int month,
  3074. int day,
  3075. int hours,
  3076. int minutes,
  3077. int seconds = 0,
  3078. int milliseconds = 0,
  3079. bool useLocalTime = true) throw();
  3080. ~Time() throw();
  3081. Time& operator= (const Time& other) throw();
  3082. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3083. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3084. int getYear() const throw();
  3085. int getMonth() const throw();
  3086. const String getMonthName (bool threeLetterVersion) const throw();
  3087. int getDayOfMonth() const throw();
  3088. int getDayOfWeek() const throw();
  3089. const String getWeekdayName (bool threeLetterVersion) const throw();
  3090. int getHours() const throw();
  3091. bool isAfternoon() const throw();
  3092. int getHoursInAmPmFormat() const throw();
  3093. int getMinutes() const throw();
  3094. int getSeconds() const throw();
  3095. int getMilliseconds() const throw();
  3096. bool isDaylightSavingTime() const throw();
  3097. const String getTimeZone() const throw();
  3098. const String toString (bool includeDate,
  3099. bool includeTime,
  3100. bool includeSeconds = true,
  3101. bool use24HourClock = false) const throw();
  3102. const String formatted (const juce_wchar* format) const throw();
  3103. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3104. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3105. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3106. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3107. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3108. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3109. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3110. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3111. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3112. bool setSystemTimeToThisTime() const throw();
  3113. static const String getWeekdayName (int dayNumber,
  3114. bool threeLetterVersion) throw();
  3115. static const String getMonthName (int monthNumber,
  3116. bool threeLetterVersion) throw();
  3117. // Static methods for getting system timers directly..
  3118. static int64 currentTimeMillis() throw();
  3119. static uint32 getMillisecondCounter() throw();
  3120. static double getMillisecondCounterHiRes() throw();
  3121. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3122. static uint32 getApproximateMillisecondCounter() throw();
  3123. // High-resolution timers..
  3124. static int64 getHighResolutionTicks() throw();
  3125. static int64 getHighResolutionTicksPerSecond() throw();
  3126. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3127. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3128. private:
  3129. int64 millisSinceEpoch;
  3130. };
  3131. #endif // __JUCE_TIME_JUCEHEADER__
  3132. /*** End of inlined file: juce_Time.h ***/
  3133. class FileInputStream;
  3134. class FileOutputStream;
  3135. class JUCE_API File
  3136. {
  3137. public:
  3138. File() {}
  3139. File (const String& path);
  3140. File (const File& other);
  3141. ~File() {}
  3142. File& operator= (const String& newFilePath);
  3143. File& operator= (const File& otherFile);
  3144. static const File nonexistent;
  3145. bool exists() const;
  3146. bool existsAsFile() const;
  3147. bool isDirectory() const;
  3148. int64 getSize() const;
  3149. static const String descriptionOfSizeInBytes (int64 bytes);
  3150. const String& getFullPathName() const throw() { return fullPath; }
  3151. const String getFileName() const;
  3152. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3153. const String getFileExtension() const;
  3154. bool hasFileExtension (const String& extensionToTest) const;
  3155. const File withFileExtension (const String& newExtension) const;
  3156. const String getFileNameWithoutExtension() const;
  3157. int hashCode() const;
  3158. int64 hashCode64() const;
  3159. const File getChildFile (String relativePath) const;
  3160. const File getSiblingFile (const String& siblingFileName) const;
  3161. const File getParentDirectory() const;
  3162. bool isAChildOf (const File& potentialParentDirectory) const;
  3163. const File getNonexistentChildFile (const String& prefix,
  3164. const String& suffix,
  3165. bool putNumbersInBrackets = true) const;
  3166. const File getNonexistentSibling (bool putNumbersInBrackets = true) const;
  3167. bool operator== (const File& otherFile) const;
  3168. bool operator!= (const File& otherFile) const;
  3169. bool hasWriteAccess() const;
  3170. bool setReadOnly (bool shouldBeReadOnly,
  3171. bool applyRecursively = false) const;
  3172. bool isHidden() const;
  3173. const File getLinkedTarget() const;
  3174. const Time getLastModificationTime() const;
  3175. const Time getLastAccessTime() const;
  3176. const Time getCreationTime() const;
  3177. bool setLastModificationTime (const Time& newTime) const;
  3178. bool setLastAccessTime (const Time& newTime) const;
  3179. bool setCreationTime (const Time& newTime) const;
  3180. const String getVersion() const;
  3181. bool create() const;
  3182. bool createDirectory() const;
  3183. bool deleteFile() const;
  3184. bool deleteRecursively() const;
  3185. bool moveToTrash() const;
  3186. bool moveFileTo (const File& targetLocation) const;
  3187. bool copyFileTo (const File& targetLocation) const;
  3188. bool copyDirectoryTo (const File& newDirectory) const;
  3189. enum TypesOfFileToFind
  3190. {
  3191. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3192. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3193. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3194. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3195. };
  3196. int findChildFiles (Array<File>& results,
  3197. int whatToLookFor,
  3198. bool searchRecursively,
  3199. const String& wildCardPattern = "*") const;
  3200. int getNumberOfChildFiles (int whatToLookFor,
  3201. const String& wildCardPattern = "*") const;
  3202. bool containsSubDirectories() const;
  3203. FileInputStream* createInputStream() const;
  3204. FileOutputStream* createOutputStream (int bufferSize = 0x8000) const;
  3205. bool loadFileAsData (MemoryBlock& result) const;
  3206. const String loadFileAsString() const;
  3207. bool appendData (const void* dataToAppend,
  3208. int numberOfBytes) const;
  3209. bool replaceWithData (const void* dataToWrite,
  3210. int numberOfBytes) const;
  3211. bool appendText (const String& textToAppend,
  3212. bool asUnicode = false,
  3213. bool writeUnicodeHeaderBytes = false) const;
  3214. bool replaceWithText (const String& textToWrite,
  3215. bool asUnicode = false,
  3216. bool writeUnicodeHeaderBytes = false) const;
  3217. static void findFileSystemRoots (Array<File>& results);
  3218. const String getVolumeLabel() const;
  3219. int getVolumeSerialNumber() const;
  3220. int64 getBytesFreeOnVolume() const;
  3221. int64 getVolumeTotalSize() const;
  3222. bool isOnCDRomDrive() const;
  3223. bool isOnHardDisk() const;
  3224. bool isOnRemovableDrive() const;
  3225. bool startAsProcess (const String& parameters = String::empty) const;
  3226. void revealToUser() const;
  3227. enum SpecialLocationType
  3228. {
  3229. userHomeDirectory,
  3230. userDocumentsDirectory,
  3231. userDesktopDirectory,
  3232. userApplicationDataDirectory,
  3233. commonApplicationDataDirectory,
  3234. tempDirectory,
  3235. currentExecutableFile,
  3236. currentApplicationFile,
  3237. invokedExecutableFile,
  3238. globalApplicationsDirectory,
  3239. userMusicDirectory,
  3240. userMoviesDirectory,
  3241. };
  3242. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3243. static const File createTempFile (const String& fileNameEnding);
  3244. static const File getCurrentWorkingDirectory();
  3245. bool setAsCurrentWorkingDirectory() const;
  3246. static const juce_wchar separator;
  3247. static const juce_wchar* separatorString;
  3248. static const String createLegalFileName (const String& fileNameToFix);
  3249. static const String createLegalPathName (const String& pathNameToFix);
  3250. static bool areFileNamesCaseSensitive();
  3251. static bool isAbsolutePath (const String& path);
  3252. static const File createFileWithoutCheckingPath (const String& path);
  3253. juce_UseDebuggingNewOperator
  3254. private:
  3255. String fullPath;
  3256. // internal way of contructing a file without checking the path
  3257. friend class DirectoryIterator;
  3258. File (const String&, int);
  3259. const String getPathUpToLastSlash() const;
  3260. };
  3261. #endif // __JUCE_FILE_JUCEHEADER__
  3262. /*** End of inlined file: juce_File.h ***/
  3263. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3264. \
  3265. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3266. childElementVariableName != 0; \
  3267. childElementVariableName = childElementVariableName->getNextElement())
  3268. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3269. \
  3270. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3271. childElementVariableName != 0; \
  3272. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3273. class JUCE_API XmlElement
  3274. {
  3275. public:
  3276. explicit XmlElement (const String& tagName) throw();
  3277. XmlElement (const XmlElement& other) throw();
  3278. XmlElement& operator= (const XmlElement& other) throw();
  3279. ~XmlElement() throw();
  3280. bool isEquivalentTo (const XmlElement* other,
  3281. bool ignoreOrderOfAttributes) const throw();
  3282. const String createDocument (const String& dtdToUse,
  3283. bool allOnOneLine = false,
  3284. bool includeXmlHeader = true,
  3285. const String& encodingType = "UTF-8",
  3286. int lineWrapLength = 60) const;
  3287. void writeToStream (OutputStream& output,
  3288. const String& dtdToUse,
  3289. bool allOnOneLine = false,
  3290. bool includeXmlHeader = true,
  3291. const String& encodingType = "UTF-8",
  3292. int lineWrapLength = 60) const;
  3293. bool writeToFile (const File& destinationFile,
  3294. const String& dtdToUse,
  3295. const String& encodingType = "UTF-8",
  3296. int lineWrapLength = 60) const;
  3297. inline const String& getTagName() const throw() { return tagName; }
  3298. bool hasTagName (const String& possibleTagName) const throw();
  3299. int getNumAttributes() const throw();
  3300. const String& getAttributeName (int attributeIndex) const throw();
  3301. const String& getAttributeValue (int attributeIndex) const throw();
  3302. // Attribute-handling methods..
  3303. bool hasAttribute (const String& attributeName) const throw();
  3304. const String& getStringAttribute (const String& attributeName) const throw();
  3305. const String getStringAttribute (const String& attributeName,
  3306. const String& defaultReturnValue) const;
  3307. bool compareAttribute (const String& attributeName,
  3308. const String& stringToCompareAgainst,
  3309. bool ignoreCase = false) const throw();
  3310. int getIntAttribute (const String& attributeName,
  3311. int defaultReturnValue = 0) const;
  3312. double getDoubleAttribute (const String& attributeName,
  3313. double defaultReturnValue = 0.0) const;
  3314. bool getBoolAttribute (const String& attributeName,
  3315. bool defaultReturnValue = false) const;
  3316. void setAttribute (const String& attributeName,
  3317. const String& newValue);
  3318. void setAttribute (const String& attributeName,
  3319. int newValue);
  3320. void setAttribute (const String& attributeName,
  3321. double newValue);
  3322. void removeAttribute (const String& attributeName) throw();
  3323. void removeAllAttributes() throw();
  3324. // Child element methods..
  3325. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3326. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3327. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3328. int getNumChildElements() const throw();
  3329. XmlElement* getChildElement (int index) const throw();
  3330. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3331. void addChildElement (XmlElement* const newChildElement) throw();
  3332. void insertChildElement (XmlElement* newChildNode,
  3333. int indexToInsertAt) throw();
  3334. XmlElement* createNewChildElement (const String& tagName);
  3335. bool replaceChildElement (XmlElement* currentChildElement,
  3336. XmlElement* newChildNode) throw();
  3337. void removeChildElement (XmlElement* childToRemove,
  3338. bool shouldDeleteTheChild) throw();
  3339. void deleteAllChildElements() throw();
  3340. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3341. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3342. XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
  3343. template <class ElementComparator>
  3344. void sortChildElements (ElementComparator& comparator,
  3345. const bool retainOrderOfEquivalentItems = false) throw()
  3346. {
  3347. const int num = getNumChildElements();
  3348. if (num > 1)
  3349. {
  3350. HeapBlock <XmlElement*> elems (num);
  3351. getChildElementsAsArray (elems);
  3352. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3353. reorderChildElements (elems, num);
  3354. }
  3355. }
  3356. bool isTextElement() const throw();
  3357. const String getText() const throw();
  3358. void setText (const String& newText) throw();
  3359. const String getAllSubText() const throw();
  3360. const String getChildElementAllSubText (const String& childTagName,
  3361. const String& defaultReturnValue) const throw();
  3362. void addTextElement (const String& text) throw();
  3363. void deleteAllTextElements() throw();
  3364. static XmlElement* createTextElement (const String& text) throw();
  3365. juce_UseDebuggingNewOperator
  3366. private:
  3367. friend class XmlDocument;
  3368. String tagName;
  3369. XmlElement* firstChildElement;
  3370. XmlElement* nextElement;
  3371. struct XmlAttributeNode
  3372. {
  3373. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3374. XmlAttributeNode (const String& name, const String& value) throw();
  3375. String name, value;
  3376. XmlAttributeNode* next;
  3377. private:
  3378. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3379. };
  3380. XmlAttributeNode* attributes;
  3381. XmlElement (int) throw();
  3382. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3383. void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
  3384. void getChildElementsAsArray (XmlElement**) const throw();
  3385. void reorderChildElements (XmlElement** const, const int) throw();
  3386. };
  3387. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3388. /*** End of inlined file: juce_XmlElement.h ***/
  3389. class JUCE_API PropertySet
  3390. {
  3391. public:
  3392. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3393. PropertySet (const PropertySet& other) throw();
  3394. PropertySet& operator= (const PropertySet& other) throw();
  3395. virtual ~PropertySet();
  3396. const String getValue (const String& keyName,
  3397. const String& defaultReturnValue = String::empty) const throw();
  3398. int getIntValue (const String& keyName,
  3399. const int defaultReturnValue = 0) const throw();
  3400. double getDoubleValue (const String& keyName,
  3401. const double defaultReturnValue = 0.0) const throw();
  3402. bool getBoolValue (const String& keyName,
  3403. const bool defaultReturnValue = false) const throw();
  3404. XmlElement* getXmlValue (const String& keyName) const;
  3405. void setValue (const String& keyName, const String& value) throw();
  3406. void setValue (const String& keyName, const int value) throw();
  3407. void setValue (const String& keyName, const double value) throw();
  3408. void setValue (const String& keyName, const bool value) throw();
  3409. void setValue (const String& keyName, const XmlElement* const xml);
  3410. void removeValue (const String& keyName) throw();
  3411. bool containsKey (const String& keyName) const throw();
  3412. void clear();
  3413. StringPairArray& getAllProperties() throw() { return properties; }
  3414. const CriticalSection& getLock() const throw() { return lock; }
  3415. XmlElement* createXml (const String& nodeName) const throw();
  3416. void restoreFromXml (const XmlElement& xml) throw();
  3417. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3418. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3419. juce_UseDebuggingNewOperator
  3420. protected:
  3421. virtual void propertyChanged();
  3422. private:
  3423. StringPairArray properties;
  3424. PropertySet* fallbackProperties;
  3425. CriticalSection lock;
  3426. bool ignoreCaseOfKeys;
  3427. };
  3428. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3429. /*** End of inlined file: juce_PropertySet.h ***/
  3430. #endif
  3431. #ifndef __JUCE_RANGE_JUCEHEADER__
  3432. /*** Start of inlined file: juce_Range.h ***/
  3433. #ifndef __JUCE_RANGE_JUCEHEADER__
  3434. #define __JUCE_RANGE_JUCEHEADER__
  3435. template <typename ValueType>
  3436. class Range
  3437. {
  3438. public:
  3439. Range() throw()
  3440. : start (ValueType()), end (ValueType())
  3441. {
  3442. }
  3443. Range (const ValueType start_, const ValueType end_) throw()
  3444. : start (start_), end (jmax (start_, end_))
  3445. {
  3446. }
  3447. Range (const Range& other) throw()
  3448. : start (other.start), end (other.end)
  3449. {
  3450. }
  3451. Range& operator= (const Range& other) throw()
  3452. {
  3453. start = other.start;
  3454. end = other.end;
  3455. return *this;
  3456. }
  3457. ~Range() throw()
  3458. {
  3459. }
  3460. static const Range between (const ValueType position1, const ValueType position2) throw()
  3461. {
  3462. return (position1 < position2) ? Range (position1, position2)
  3463. : Range (position2, position1);
  3464. }
  3465. static const Range emptyRange (const ValueType start) throw()
  3466. {
  3467. return Range (start, start);
  3468. }
  3469. inline ValueType getStart() const throw() { return start; }
  3470. inline ValueType getLength() const throw() { return end - start; }
  3471. inline ValueType getEnd() const throw() { return end; }
  3472. inline bool isEmpty() const throw() { return start == end; }
  3473. void setStart (const ValueType newStart) throw()
  3474. {
  3475. start = newStart;
  3476. if (newStart > end)
  3477. end = newStart;
  3478. }
  3479. const Range withStart (const ValueType newStart) const throw()
  3480. {
  3481. return Range (newStart, jmax (newStart, end));
  3482. }
  3483. const Range movedToStartAt (const ValueType newStart) const throw()
  3484. {
  3485. return Range (newStart, newStart + getLength());
  3486. }
  3487. void setEnd (const ValueType newEnd) throw()
  3488. {
  3489. end = newEnd;
  3490. if (newEnd < start)
  3491. start = newEnd;
  3492. }
  3493. const Range withEnd (const ValueType newEnd) const throw()
  3494. {
  3495. return Range (jmin (start, newEnd), newEnd);
  3496. }
  3497. const Range movedToEndAt (const ValueType newEnd) const throw()
  3498. {
  3499. return Range (newEnd - getLength(), newEnd);
  3500. }
  3501. void setLength (const ValueType newLength) throw()
  3502. {
  3503. end = start + jmax (ValueType(), newLength);
  3504. }
  3505. const Range withLength (const ValueType newLength) const throw()
  3506. {
  3507. return Range (start, start + newLength);
  3508. }
  3509. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3510. {
  3511. start += amountToAdd;
  3512. end += amountToAdd;
  3513. return *this;
  3514. }
  3515. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3516. {
  3517. start -= amountToSubtract;
  3518. end -= amountToSubtract;
  3519. return *this;
  3520. }
  3521. const Range operator+ (const ValueType amountToAdd) const throw()
  3522. {
  3523. return Range (start + amountToAdd, end + amountToAdd);
  3524. }
  3525. const Range operator- (const ValueType amountToSubtract) const throw()
  3526. {
  3527. return Range (start - amountToSubtract, end - amountToSubtract);
  3528. }
  3529. bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
  3530. bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }
  3531. bool contains (const ValueType position) const throw()
  3532. {
  3533. return position >= start && position < end;
  3534. }
  3535. ValueType clipValue (const ValueType value) const throw()
  3536. {
  3537. return jlimit (start, end, value);
  3538. }
  3539. bool intersects (const Range& other) const throw()
  3540. {
  3541. return other.start < end && other.end > start;
  3542. }
  3543. const Range getIntersectionWith (const Range& other) const throw()
  3544. {
  3545. return Range (jmax (start, other.start),
  3546. jmin (end, other.end));
  3547. }
  3548. const Range getUnionWith (const Range& other) const throw()
  3549. {
  3550. return Range (jmin (start, other.start),
  3551. jmax (end, other.end));
  3552. }
  3553. const Range constrainRange (const Range& rangeToConstrain) const throw()
  3554. {
  3555. const ValueType otherLen = rangeToConstrain.getLength();
  3556. return otherLen >= getLength()
  3557. ? *this
  3558. : rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
  3559. }
  3560. juce_UseDebuggingNewOperator
  3561. private:
  3562. ValueType start, end;
  3563. };
  3564. #endif // __JUCE_RANGE_JUCEHEADER__
  3565. /*** End of inlined file: juce_Range.h ***/
  3566. #endif
  3567. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3568. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3569. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3570. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3571. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3572. class ReferenceCountedArray
  3573. {
  3574. public:
  3575. ReferenceCountedArray() throw()
  3576. : numUsed (0)
  3577. {
  3578. }
  3579. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3580. {
  3581. const ScopedLockType lock (other.getLock());
  3582. numUsed = other.numUsed;
  3583. data.setAllocatedSize (numUsed);
  3584. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3585. for (int i = numUsed; --i >= 0;)
  3586. if (data.elements[i] != 0)
  3587. data.elements[i]->incReferenceCount();
  3588. }
  3589. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3590. {
  3591. if (this != &other)
  3592. {
  3593. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3594. swapWithArray (other);
  3595. }
  3596. return *this;
  3597. }
  3598. ~ReferenceCountedArray()
  3599. {
  3600. clear();
  3601. }
  3602. void clear()
  3603. {
  3604. const ScopedLockType lock (getLock());
  3605. while (numUsed > 0)
  3606. if (data.elements [--numUsed] != 0)
  3607. data.elements [numUsed]->decReferenceCount();
  3608. jassert (numUsed == 0);
  3609. data.setAllocatedSize (0);
  3610. }
  3611. inline int size() const throw()
  3612. {
  3613. return numUsed;
  3614. }
  3615. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3616. {
  3617. const ScopedLockType lock (getLock());
  3618. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3619. : static_cast <ObjectClass*> (0);
  3620. }
  3621. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3622. {
  3623. const ScopedLockType lock (getLock());
  3624. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3625. return data.elements [index];
  3626. }
  3627. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3628. {
  3629. const ScopedLockType lock (getLock());
  3630. return numUsed > 0 ? data.elements [0]
  3631. : static_cast <ObjectClass*> (0);
  3632. }
  3633. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3634. {
  3635. const ScopedLockType lock (getLock());
  3636. return numUsed > 0 ? data.elements [numUsed - 1]
  3637. : static_cast <ObjectClass*> (0);
  3638. }
  3639. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3640. {
  3641. const ScopedLockType lock (getLock());
  3642. ObjectClass** e = data.elements.getData();
  3643. ObjectClass** const end = e + numUsed;
  3644. while (e != end)
  3645. {
  3646. if (objectToLookFor == *e)
  3647. return static_cast <int> (e - data.elements.getData());
  3648. ++e;
  3649. }
  3650. return -1;
  3651. }
  3652. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3653. {
  3654. const ScopedLockType lock (getLock());
  3655. ObjectClass** e = data.elements.getData();
  3656. ObjectClass** const end = e + numUsed;
  3657. while (e != end)
  3658. {
  3659. if (objectToLookFor == *e)
  3660. return true;
  3661. ++e;
  3662. }
  3663. return false;
  3664. }
  3665. void add (ObjectClass* const newObject) throw()
  3666. {
  3667. const ScopedLockType lock (getLock());
  3668. data.ensureAllocatedSize (numUsed + 1);
  3669. data.elements [numUsed++] = newObject;
  3670. if (newObject != 0)
  3671. newObject->incReferenceCount();
  3672. }
  3673. void insert (int indexToInsertAt,
  3674. ObjectClass* const newObject) throw()
  3675. {
  3676. if (indexToInsertAt >= 0)
  3677. {
  3678. const ScopedLockType lock (getLock());
  3679. if (indexToInsertAt > numUsed)
  3680. indexToInsertAt = numUsed;
  3681. data.ensureAllocatedSize (numUsed + 1);
  3682. ObjectClass** const e = data.elements + indexToInsertAt;
  3683. const int numToMove = numUsed - indexToInsertAt;
  3684. if (numToMove > 0)
  3685. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3686. *e = newObject;
  3687. if (newObject != 0)
  3688. newObject->incReferenceCount();
  3689. ++numUsed;
  3690. }
  3691. else
  3692. {
  3693. add (newObject);
  3694. }
  3695. }
  3696. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3697. {
  3698. const ScopedLockType lock (getLock());
  3699. if (! contains (newObject))
  3700. add (newObject);
  3701. }
  3702. void set (const int indexToChange,
  3703. ObjectClass* const newObject)
  3704. {
  3705. if (indexToChange >= 0)
  3706. {
  3707. const ScopedLockType lock (getLock());
  3708. if (newObject != 0)
  3709. newObject->incReferenceCount();
  3710. if (indexToChange < numUsed)
  3711. {
  3712. if (data.elements [indexToChange] != 0)
  3713. data.elements [indexToChange]->decReferenceCount();
  3714. data.elements [indexToChange] = newObject;
  3715. }
  3716. else
  3717. {
  3718. data.ensureAllocatedSize (numUsed + 1);
  3719. data.elements [numUsed++] = newObject;
  3720. }
  3721. }
  3722. }
  3723. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3724. int startIndex = 0,
  3725. int numElementsToAdd = -1) throw()
  3726. {
  3727. arrayToAddFrom.lockArray();
  3728. const ScopedLockType lock (getLock());
  3729. if (startIndex < 0)
  3730. {
  3731. jassertfalse
  3732. startIndex = 0;
  3733. }
  3734. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3735. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3736. if (numElementsToAdd > 0)
  3737. {
  3738. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3739. while (--numElementsToAdd >= 0)
  3740. add (arrayToAddFrom.getUnchecked (startIndex++));
  3741. }
  3742. arrayToAddFrom.unlockArray();
  3743. }
  3744. template <class ElementComparator>
  3745. void addSorted (ElementComparator& comparator,
  3746. ObjectClass* newObject) throw()
  3747. {
  3748. const ScopedLockType lock (getLock());
  3749. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3750. }
  3751. template <class ElementComparator>
  3752. void addOrReplaceSorted (ElementComparator& comparator,
  3753. ObjectClass* newObject) throw()
  3754. {
  3755. const ScopedLockType lock (getLock());
  3756. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3757. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3758. set (index - 1, newObject); // replace an existing object that matches
  3759. else
  3760. insert (index, newObject); // no match, so insert the new one
  3761. }
  3762. void remove (const int indexToRemove)
  3763. {
  3764. const ScopedLockType lock (getLock());
  3765. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3766. {
  3767. ObjectClass** const e = data.elements + indexToRemove;
  3768. if (*e != 0)
  3769. (*e)->decReferenceCount();
  3770. --numUsed;
  3771. const int numberToShift = numUsed - indexToRemove;
  3772. if (numberToShift > 0)
  3773. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3774. if ((numUsed << 1) < data.numAllocated)
  3775. minimiseStorageOverheads();
  3776. }
  3777. }
  3778. void removeObject (ObjectClass* const objectToRemove)
  3779. {
  3780. const ScopedLockType lock (getLock());
  3781. remove (indexOf (objectToRemove));
  3782. }
  3783. void removeRange (const int startIndex,
  3784. const int numberToRemove)
  3785. {
  3786. const ScopedLockType lock (getLock());
  3787. const int start = jlimit (0, numUsed, startIndex);
  3788. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3789. if (end > start)
  3790. {
  3791. int i;
  3792. for (i = start; i < end; ++i)
  3793. {
  3794. if (data.elements[i] != 0)
  3795. {
  3796. data.elements[i]->decReferenceCount();
  3797. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3798. }
  3799. }
  3800. const int rangeSize = end - start;
  3801. ObjectClass** e = data.elements + start;
  3802. i = numUsed - end;
  3803. numUsed -= rangeSize;
  3804. while (--i >= 0)
  3805. {
  3806. *e = e [rangeSize];
  3807. ++e;
  3808. }
  3809. if ((numUsed << 1) < data.numAllocated)
  3810. minimiseStorageOverheads();
  3811. }
  3812. }
  3813. void removeLast (int howManyToRemove = 1)
  3814. {
  3815. const ScopedLockType lock (getLock());
  3816. if (howManyToRemove > numUsed)
  3817. howManyToRemove = numUsed;
  3818. while (--howManyToRemove >= 0)
  3819. remove (numUsed - 1);
  3820. }
  3821. void swap (const int index1,
  3822. const int index2) throw()
  3823. {
  3824. const ScopedLockType lock (getLock());
  3825. if (((unsigned int) index1) < (unsigned int) numUsed
  3826. && ((unsigned int) index2) < (unsigned int) numUsed)
  3827. {
  3828. swapVariables (data.elements [index1],
  3829. data.elements [index2]);
  3830. }
  3831. }
  3832. void move (const int currentIndex,
  3833. int newIndex) throw()
  3834. {
  3835. if (currentIndex != newIndex)
  3836. {
  3837. const ScopedLockType lock (getLock());
  3838. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3839. {
  3840. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3841. newIndex = numUsed - 1;
  3842. ObjectClass* const value = data.elements [currentIndex];
  3843. if (newIndex > currentIndex)
  3844. {
  3845. memmove (data.elements + currentIndex,
  3846. data.elements + currentIndex + 1,
  3847. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3848. }
  3849. else
  3850. {
  3851. memmove (data.elements + newIndex + 1,
  3852. data.elements + newIndex,
  3853. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3854. }
  3855. data.elements [newIndex] = value;
  3856. }
  3857. }
  3858. }
  3859. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3860. {
  3861. const ScopedLockType lock1 (getLock());
  3862. const ScopedLockType lock2 (otherArray.getLock());
  3863. data.swapWith (otherArray.data);
  3864. swapVariables (numUsed, otherArray.numUsed);
  3865. }
  3866. bool operator== (const ReferenceCountedArray& other) const throw()
  3867. {
  3868. const ScopedLockType lock2 (other.getLock());
  3869. const ScopedLockType lock1 (getLock());
  3870. if (numUsed != other.numUsed)
  3871. return false;
  3872. for (int i = numUsed; --i >= 0;)
  3873. if (data.elements [i] != other.data.elements [i])
  3874. return false;
  3875. return true;
  3876. }
  3877. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3878. {
  3879. return ! operator== (other);
  3880. }
  3881. template <class ElementComparator>
  3882. void sort (ElementComparator& comparator,
  3883. const bool retainOrderOfEquivalentItems = false) const throw()
  3884. {
  3885. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3886. // avoids getting warning messages about the parameter being unused
  3887. const ScopedLockType lock (getLock());
  3888. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3889. }
  3890. void minimiseStorageOverheads() throw()
  3891. {
  3892. const ScopedLockType lock (getLock());
  3893. data.shrinkToNoMoreThan (numUsed);
  3894. }
  3895. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3896. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3897. juce_UseDebuggingNewOperator
  3898. private:
  3899. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3900. int numUsed;
  3901. };
  3902. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3903. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3904. #endif
  3905. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3906. #endif
  3907. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3908. #endif
  3909. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3910. /*** Start of inlined file: juce_SortedSet.h ***/
  3911. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3912. #define __JUCE_SORTEDSET_JUCEHEADER__
  3913. #if JUCE_MSVC
  3914. #pragma warning (push)
  3915. #pragma warning (disable: 4512)
  3916. #endif
  3917. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3918. class SortedSet
  3919. {
  3920. public:
  3921. SortedSet() throw()
  3922. : numUsed (0)
  3923. {
  3924. }
  3925. SortedSet (const SortedSet& other) throw()
  3926. {
  3927. const ScopedLockType lock (other.getLock());
  3928. numUsed = other.numUsed;
  3929. data.setAllocatedSize (other.numUsed);
  3930. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3931. }
  3932. ~SortedSet() throw()
  3933. {
  3934. }
  3935. SortedSet& operator= (const SortedSet& other) throw()
  3936. {
  3937. if (this != &other)
  3938. {
  3939. const ScopedLockType lock1 (other.getLock());
  3940. const ScopedLockType lock2 (getLock());
  3941. data.ensureAllocatedSize (other.size());
  3942. numUsed = other.numUsed;
  3943. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3944. minimiseStorageOverheads();
  3945. }
  3946. return *this;
  3947. }
  3948. bool operator== (const SortedSet<ElementType>& other) const throw()
  3949. {
  3950. const ScopedLockType lock (getLock());
  3951. if (numUsed != other.numUsed)
  3952. return false;
  3953. for (int i = numUsed; --i >= 0;)
  3954. if (data.elements[i] != other.data.elements[i])
  3955. return false;
  3956. return true;
  3957. }
  3958. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3959. {
  3960. return ! operator== (other);
  3961. }
  3962. void clear() throw()
  3963. {
  3964. const ScopedLockType lock (getLock());
  3965. data.setAllocatedSize (0);
  3966. numUsed = 0;
  3967. }
  3968. void clearQuick() throw()
  3969. {
  3970. const ScopedLockType lock (getLock());
  3971. numUsed = 0;
  3972. }
  3973. inline int size() const throw()
  3974. {
  3975. return numUsed;
  3976. }
  3977. inline ElementType operator[] (const int index) const throw()
  3978. {
  3979. const ScopedLockType lock (getLock());
  3980. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3981. : ElementType();
  3982. }
  3983. inline ElementType getUnchecked (const int index) const throw()
  3984. {
  3985. const ScopedLockType lock (getLock());
  3986. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3987. return data.elements [index];
  3988. }
  3989. inline ElementType getFirst() const throw()
  3990. {
  3991. const ScopedLockType lock (getLock());
  3992. return numUsed > 0 ? data.elements [0] : ElementType();
  3993. }
  3994. inline ElementType getLast() const throw()
  3995. {
  3996. const ScopedLockType lock (getLock());
  3997. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3998. }
  3999. int indexOf (const ElementType elementToLookFor) const throw()
  4000. {
  4001. const ScopedLockType lock (getLock());
  4002. int start = 0;
  4003. int end = numUsed;
  4004. for (;;)
  4005. {
  4006. if (start >= end)
  4007. {
  4008. return -1;
  4009. }
  4010. else if (elementToLookFor == data.elements [start])
  4011. {
  4012. return start;
  4013. }
  4014. else
  4015. {
  4016. const int halfway = (start + end) >> 1;
  4017. if (halfway == start)
  4018. return -1;
  4019. else if (elementToLookFor >= data.elements [halfway])
  4020. start = halfway;
  4021. else
  4022. end = halfway;
  4023. }
  4024. }
  4025. }
  4026. bool contains (const ElementType elementToLookFor) const throw()
  4027. {
  4028. const ScopedLockType lock (getLock());
  4029. int start = 0;
  4030. int end = numUsed;
  4031. for (;;)
  4032. {
  4033. if (start >= end)
  4034. {
  4035. return false;
  4036. }
  4037. else if (elementToLookFor == data.elements [start])
  4038. {
  4039. return true;
  4040. }
  4041. else
  4042. {
  4043. const int halfway = (start + end) >> 1;
  4044. if (halfway == start)
  4045. return false;
  4046. else if (elementToLookFor >= data.elements [halfway])
  4047. start = halfway;
  4048. else
  4049. end = halfway;
  4050. }
  4051. }
  4052. }
  4053. void add (const ElementType newElement) throw()
  4054. {
  4055. const ScopedLockType lock (getLock());
  4056. int start = 0;
  4057. int end = numUsed;
  4058. for (;;)
  4059. {
  4060. if (start >= end)
  4061. {
  4062. jassert (start <= end);
  4063. insertInternal (start, newElement);
  4064. break;
  4065. }
  4066. else if (newElement == data.elements [start])
  4067. {
  4068. break;
  4069. }
  4070. else
  4071. {
  4072. const int halfway = (start + end) >> 1;
  4073. if (halfway == start)
  4074. {
  4075. if (newElement >= data.elements [halfway])
  4076. insertInternal (start + 1, newElement);
  4077. else
  4078. insertInternal (start, newElement);
  4079. break;
  4080. }
  4081. else if (newElement >= data.elements [halfway])
  4082. start = halfway;
  4083. else
  4084. end = halfway;
  4085. }
  4086. }
  4087. }
  4088. void addArray (const ElementType* elementsToAdd,
  4089. int numElementsToAdd) throw()
  4090. {
  4091. const ScopedLockType lock (getLock());
  4092. while (--numElementsToAdd >= 0)
  4093. add (*elementsToAdd++);
  4094. }
  4095. template <class OtherSetType>
  4096. void addSet (const OtherSetType& setToAddFrom,
  4097. int startIndex = 0,
  4098. int numElementsToAdd = -1) throw()
  4099. {
  4100. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4101. const ScopedLockType lock2 (getLock());
  4102. jassert (this != &setToAddFrom);
  4103. if (this != &setToAddFrom)
  4104. {
  4105. if (startIndex < 0)
  4106. {
  4107. jassertfalse
  4108. startIndex = 0;
  4109. }
  4110. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4111. numElementsToAdd = setToAddFrom.size() - startIndex;
  4112. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4113. }
  4114. }
  4115. ElementType remove (const int indexToRemove) throw()
  4116. {
  4117. const ScopedLockType lock (getLock());
  4118. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4119. {
  4120. --numUsed;
  4121. ElementType* const e = data.elements + indexToRemove;
  4122. ElementType const removed = *e;
  4123. const int numberToShift = numUsed - indexToRemove;
  4124. if (numberToShift > 0)
  4125. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4126. if ((numUsed << 1) < data.numAllocated)
  4127. minimiseStorageOverheads();
  4128. return removed;
  4129. }
  4130. return 0;
  4131. }
  4132. void removeValue (const ElementType valueToRemove) throw()
  4133. {
  4134. const ScopedLockType lock (getLock());
  4135. remove (indexOf (valueToRemove));
  4136. }
  4137. template <class OtherSetType>
  4138. void removeValuesIn (const OtherSetType& otherSet) throw()
  4139. {
  4140. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4141. const ScopedLockType lock2 (getLock());
  4142. if (this == &otherSet)
  4143. {
  4144. clear();
  4145. }
  4146. else
  4147. {
  4148. if (otherSet.size() > 0)
  4149. {
  4150. for (int i = numUsed; --i >= 0;)
  4151. if (otherSet.contains (data.elements [i]))
  4152. remove (i);
  4153. }
  4154. }
  4155. }
  4156. template <class OtherSetType>
  4157. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4158. {
  4159. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4160. const ScopedLockType lock2 (getLock());
  4161. if (this != &otherSet)
  4162. {
  4163. if (otherSet.size() <= 0)
  4164. {
  4165. clear();
  4166. }
  4167. else
  4168. {
  4169. for (int i = numUsed; --i >= 0;)
  4170. if (! otherSet.contains (data.elements [i]))
  4171. remove (i);
  4172. }
  4173. }
  4174. }
  4175. void minimiseStorageOverheads() throw()
  4176. {
  4177. const ScopedLockType lock (getLock());
  4178. data.shrinkToNoMoreThan (numUsed);
  4179. }
  4180. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4181. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4182. juce_UseDebuggingNewOperator
  4183. private:
  4184. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4185. int numUsed;
  4186. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4187. {
  4188. data.ensureAllocatedSize (numUsed + 1);
  4189. ElementType* const insertPos = data.elements + indexToInsertAt;
  4190. const int numberToMove = numUsed - indexToInsertAt;
  4191. if (numberToMove > 0)
  4192. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4193. *insertPos = newElement;
  4194. ++numUsed;
  4195. }
  4196. };
  4197. #if JUCE_MSVC
  4198. #pragma warning (pop)
  4199. #endif
  4200. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4201. /*** End of inlined file: juce_SortedSet.h ***/
  4202. #endif
  4203. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4204. /*** Start of inlined file: juce_SparseSet.h ***/
  4205. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4206. #define __JUCE_SPARSESET_JUCEHEADER__
  4207. template <class Type>
  4208. class SparseSet
  4209. {
  4210. public:
  4211. SparseSet() throw()
  4212. {
  4213. }
  4214. SparseSet (const SparseSet<Type>& other) throw()
  4215. : values (other.values)
  4216. {
  4217. }
  4218. ~SparseSet() throw()
  4219. {
  4220. }
  4221. void clear() throw()
  4222. {
  4223. values.clear();
  4224. }
  4225. bool isEmpty() const throw()
  4226. {
  4227. return values.size() == 0;
  4228. }
  4229. Type size() const throw()
  4230. {
  4231. Type num = 0;
  4232. for (int i = 0; i < values.size(); i += 2)
  4233. num += values[i + 1] - values[i];
  4234. return num;
  4235. }
  4236. Type operator[] (int index) const throw()
  4237. {
  4238. for (int i = 0; i < values.size(); i += 2)
  4239. {
  4240. const Type s = values.getUnchecked(i);
  4241. const Type e = values.getUnchecked(i + 1);
  4242. if (index < e - s)
  4243. return s + index;
  4244. index -= e - s;
  4245. }
  4246. return (Type) 0;
  4247. }
  4248. bool contains (const Type valueToLookFor) const throw()
  4249. {
  4250. bool on = false;
  4251. for (int i = 0; i < values.size(); ++i)
  4252. {
  4253. if (values.getUnchecked(i) > valueToLookFor)
  4254. return on;
  4255. on = ! on;
  4256. }
  4257. return false;
  4258. }
  4259. int getNumRanges() const throw()
  4260. {
  4261. return values.size() >> 1;
  4262. }
  4263. bool getRange (const int rangeIndex,
  4264. Type& startValue,
  4265. Type& numValues) const throw()
  4266. {
  4267. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4268. {
  4269. startValue = values [rangeIndex << 1];
  4270. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4271. return true;
  4272. }
  4273. return false;
  4274. }
  4275. bool getTotalRange (Type& lowestValue,
  4276. Type& highestValue) const throw()
  4277. {
  4278. if (values.size() > 0)
  4279. {
  4280. lowestValue = values.getUnchecked (0);
  4281. highestValue = values.getUnchecked (values.size() - 1);
  4282. return true;
  4283. }
  4284. return false;
  4285. }
  4286. void addRange (const Type firstValue,
  4287. const Type numValuesToAdd) throw()
  4288. {
  4289. jassert (numValuesToAdd >= 0);
  4290. if (numValuesToAdd > 0)
  4291. {
  4292. removeRange (firstValue, numValuesToAdd);
  4293. IntegerElementComparator<Type> sorter;
  4294. values.addSorted (sorter, firstValue);
  4295. values.addSorted (sorter, firstValue + numValuesToAdd);
  4296. simplify();
  4297. }
  4298. }
  4299. void removeRange (const Type firstValue,
  4300. const Type numValuesToRemove) throw()
  4301. {
  4302. jassert (numValuesToRemove >= 0);
  4303. if (numValuesToRemove >= 0
  4304. && firstValue < values.getLast())
  4305. {
  4306. const bool onAtStart = contains (firstValue - 1);
  4307. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4308. const bool onAtEnd = contains (lastValue);
  4309. for (int i = values.size(); --i >= 0;)
  4310. {
  4311. if (values.getUnchecked(i) <= lastValue)
  4312. {
  4313. while (values.getUnchecked(i) >= firstValue)
  4314. {
  4315. values.remove (i);
  4316. if (--i < 0)
  4317. break;
  4318. }
  4319. break;
  4320. }
  4321. }
  4322. IntegerElementComparator<Type> sorter;
  4323. if (onAtStart)
  4324. values.addSorted (sorter, firstValue);
  4325. if (onAtEnd)
  4326. values.addSorted (sorter, lastValue);
  4327. simplify();
  4328. }
  4329. }
  4330. void invertRange (const Type firstValue,
  4331. const Type numValues)
  4332. {
  4333. SparseSet newItems;
  4334. newItems.addRange (firstValue, numValues);
  4335. int i;
  4336. for (i = getNumRanges(); --i >= 0;)
  4337. {
  4338. const int start = values [i << 1];
  4339. const int end = values [(i << 1) + 1];
  4340. newItems.removeRange (start, end);
  4341. }
  4342. removeRange (firstValue, numValues);
  4343. for (i = newItems.getNumRanges(); --i >= 0;)
  4344. {
  4345. const int start = newItems.values [i << 1];
  4346. const int end = newItems.values [(i << 1) + 1];
  4347. addRange (start, end);
  4348. }
  4349. }
  4350. bool overlapsRange (const Type firstValue,
  4351. const Type numValues) throw()
  4352. {
  4353. jassert (numValues >= 0);
  4354. if (numValues > 0)
  4355. {
  4356. for (int i = getNumRanges(); --i >= 0;)
  4357. {
  4358. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4359. return false;
  4360. if (firstValue + numValues > values.getUnchecked (i << 1))
  4361. return true;
  4362. }
  4363. }
  4364. return false;
  4365. }
  4366. bool containsRange (const Type firstValue,
  4367. const Type numValues) throw()
  4368. {
  4369. jassert (numValues >= 0);
  4370. if (numValues > 0)
  4371. {
  4372. for (int i = getNumRanges(); --i >= 0;)
  4373. {
  4374. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4375. return false;
  4376. if (firstValue >= values.getUnchecked (i << 1)
  4377. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4378. return true;
  4379. }
  4380. }
  4381. return false;
  4382. }
  4383. bool operator== (const SparseSet<Type>& other) throw()
  4384. {
  4385. return values == other.values;
  4386. }
  4387. bool operator!= (const SparseSet<Type>& other) throw()
  4388. {
  4389. return values != other.values;
  4390. }
  4391. juce_UseDebuggingNewOperator
  4392. private:
  4393. // alternating start/end values of ranges of values that are present.
  4394. Array<Type, DummyCriticalSection> values;
  4395. void simplify() throw()
  4396. {
  4397. jassert ((values.size() & 1) == 0);
  4398. for (int i = values.size(); --i > 0;)
  4399. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4400. values.removeRange (i - 1, 2);
  4401. }
  4402. };
  4403. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4404. /*** End of inlined file: juce_SparseSet.h ***/
  4405. #endif
  4406. #ifndef __JUCE_VALUE_JUCEHEADER__
  4407. /*** Start of inlined file: juce_Value.h ***/
  4408. #ifndef __JUCE_VALUE_JUCEHEADER__
  4409. #define __JUCE_VALUE_JUCEHEADER__
  4410. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4411. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4412. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4413. /*** Start of inlined file: juce_MessageListener.h ***/
  4414. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4415. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4416. /*** Start of inlined file: juce_Message.h ***/
  4417. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4418. #define __JUCE_MESSAGE_JUCEHEADER__
  4419. class MessageListener;
  4420. class MessageManager;
  4421. class JUCE_API Message
  4422. {
  4423. public:
  4424. Message() throw();
  4425. Message (int intParameter1,
  4426. int intParameter2,
  4427. int intParameter3,
  4428. void* pointerParameter) throw();
  4429. virtual ~Message() throw();
  4430. // These values can be used for carrying simple data that the application needs to
  4431. // pass around. For more complex messages, just create a subclass.
  4432. int intParameter1; /**< user-defined integer value. */
  4433. int intParameter2; /**< user-defined integer value. */
  4434. int intParameter3; /**< user-defined integer value. */
  4435. void* pointerParameter; /**< user-defined pointer value. */
  4436. juce_UseDebuggingNewOperator
  4437. private:
  4438. friend class MessageListener;
  4439. friend class MessageManager;
  4440. MessageListener* messageRecipient;
  4441. Message (const Message&);
  4442. Message& operator= (const Message&);
  4443. };
  4444. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4445. /*** End of inlined file: juce_Message.h ***/
  4446. class JUCE_API MessageListener
  4447. {
  4448. protected:
  4449. MessageListener() throw();
  4450. public:
  4451. virtual ~MessageListener();
  4452. virtual void handleMessage (const Message& message) = 0;
  4453. void postMessage (Message* message) const throw();
  4454. bool isValidMessageListener() const throw();
  4455. };
  4456. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4457. /*** End of inlined file: juce_MessageListener.h ***/
  4458. class JUCE_API AsyncUpdater
  4459. {
  4460. public:
  4461. AsyncUpdater() throw();
  4462. virtual ~AsyncUpdater();
  4463. void triggerAsyncUpdate() throw();
  4464. void cancelPendingUpdate() throw();
  4465. void handleUpdateNowIfNeeded();
  4466. virtual void handleAsyncUpdate() = 0;
  4467. private:
  4468. class AsyncUpdaterInternal : public MessageListener
  4469. {
  4470. public:
  4471. AsyncUpdaterInternal() throw() {}
  4472. ~AsyncUpdaterInternal() {}
  4473. void handleMessage (const Message&);
  4474. AsyncUpdater* owner;
  4475. private:
  4476. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4477. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4478. };
  4479. AsyncUpdaterInternal internalAsyncHandler;
  4480. bool asyncMessagePending;
  4481. };
  4482. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4483. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4484. /*** Start of inlined file: juce_ListenerList.h ***/
  4485. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4486. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4487. template <class ListenerClass,
  4488. class ArrayType = Array <ListenerClass*> >
  4489. class ListenerList
  4490. {
  4491. // Horrible macros required to support VC6/7..
  4492. #if defined (_MSC_VER) && _MSC_VER <= 1400
  4493. #define LL_TEMPLATE(a) typename P##a, typename Q##a
  4494. #define LL_PARAM(a) Q##a& param##a
  4495. #else
  4496. #define LL_TEMPLATE(a) typename P##a
  4497. #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a
  4498. #endif
  4499. public:
  4500. ListenerList()
  4501. {
  4502. }
  4503. ~ListenerList()
  4504. {
  4505. }
  4506. void add (ListenerClass* const listenerToAdd)
  4507. {
  4508. // Listeners can't be null pointers!
  4509. jassert (listenerToAdd != 0);
  4510. if (listenerToAdd != 0)
  4511. listeners.addIfNotAlreadyThere (listenerToAdd);
  4512. }
  4513. void remove (ListenerClass* const listenerToRemove)
  4514. {
  4515. // Listeners can't be null pointers!
  4516. jassert (listenerToRemove != 0);
  4517. listeners.removeValue (listenerToRemove);
  4518. }
  4519. int size() const throw()
  4520. {
  4521. return listeners.size();
  4522. }
  4523. bool isEmpty() const throw()
  4524. {
  4525. return listeners.size() == 0;
  4526. }
  4527. bool contains (ListenerClass* const listener) const throw()
  4528. {
  4529. return listeners.contains (listener);
  4530. }
  4531. void call (void (ListenerClass::*callbackFunction) ())
  4532. {
  4533. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4534. }
  4535. template <class BailOutCheckerType>
  4536. void callChecked (const BailOutCheckerType& bailOutChecker,
  4537. void (ListenerClass::*callbackFunction) ())
  4538. {
  4539. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4540. (iter.getListener()->*callbackFunction) ();
  4541. }
  4542. template <LL_TEMPLATE(1)>
  4543. void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
  4544. {
  4545. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4546. (iter.getListener()->*callbackFunction) (param1);
  4547. }
  4548. template <class BailOutCheckerType, LL_TEMPLATE(1)>
  4549. void callChecked (const BailOutCheckerType& bailOutChecker,
  4550. void (ListenerClass::*callbackFunction) (P1),
  4551. LL_PARAM(1))
  4552. {
  4553. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4554. (iter.getListener()->*callbackFunction) (param1);
  4555. }
  4556. template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4557. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4558. LL_PARAM(1), LL_PARAM(2))
  4559. {
  4560. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4561. (iter.getListener()->*callbackFunction) (param1, param2);
  4562. }
  4563. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4564. void callChecked (const BailOutCheckerType& bailOutChecker,
  4565. void (ListenerClass::*callbackFunction) (P1, P2),
  4566. LL_PARAM(1), LL_PARAM(2))
  4567. {
  4568. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4569. (iter.getListener()->*callbackFunction) (param1, param2);
  4570. }
  4571. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4572. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4573. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4574. {
  4575. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4576. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4577. }
  4578. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4579. void callChecked (const BailOutCheckerType& bailOutChecker,
  4580. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4581. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4582. {
  4583. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4584. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4585. }
  4586. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4587. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4588. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4589. {
  4590. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4591. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4592. }
  4593. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4594. void callChecked (const BailOutCheckerType& bailOutChecker,
  4595. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4596. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4597. {
  4598. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4599. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4600. }
  4601. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4602. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4603. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4604. {
  4605. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4606. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4607. }
  4608. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4609. void callChecked (const BailOutCheckerType& bailOutChecker,
  4610. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4611. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4612. {
  4613. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4614. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4615. }
  4616. class DummyBailOutChecker
  4617. {
  4618. public:
  4619. inline bool shouldBailOut() const throw() { return false; }
  4620. };
  4621. template <class BailOutCheckerType, class ListType>
  4622. class Iterator
  4623. {
  4624. public:
  4625. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4626. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4627. {}
  4628. ~Iterator() {}
  4629. bool next()
  4630. {
  4631. if (index <= 0 || bailOutChecker.shouldBailOut())
  4632. return false;
  4633. const int listSize = list.size();
  4634. if (--index < listSize)
  4635. return true;
  4636. index = listSize - 1;
  4637. return index >= 0;
  4638. }
  4639. typename ListType::ListenerType* getListener() const throw()
  4640. {
  4641. return list.getListeners().getUnchecked (index);
  4642. }
  4643. private:
  4644. const ListType& list;
  4645. const BailOutCheckerType& bailOutChecker;
  4646. int index;
  4647. Iterator (const Iterator&);
  4648. Iterator& operator= (const Iterator&);
  4649. };
  4650. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4651. typedef ListenerClass ListenerType;
  4652. const ArrayType& getListeners() const throw() { return listeners; }
  4653. private:
  4654. ArrayType listeners;
  4655. ListenerList (const ListenerList&);
  4656. ListenerList& operator= (const ListenerList&);
  4657. #undef LL_TEMPLATE
  4658. #undef LL_PARAM
  4659. };
  4660. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4661. /*** End of inlined file: juce_ListenerList.h ***/
  4662. class JUCE_API Value
  4663. {
  4664. public:
  4665. Value();
  4666. Value (const Value& other);
  4667. Value (const var& initialValue);
  4668. ~Value();
  4669. const var getValue() const;
  4670. operator const var() const;
  4671. const String toString() const;
  4672. void setValue (const var& newValue);
  4673. Value& operator= (const var& newValue);
  4674. void referTo (const Value& valueToReferTo);
  4675. bool refersToSameSourceAs (const Value& other) const;
  4676. bool operator== (const Value& other) const;
  4677. bool operator!= (const Value& other) const;
  4678. class JUCE_API Listener
  4679. {
  4680. public:
  4681. Listener() {}
  4682. virtual ~Listener() {}
  4683. virtual void valueChanged (Value& value) = 0;
  4684. };
  4685. void addListener (Listener* const listener);
  4686. void removeListener (Listener* const listener);
  4687. class JUCE_API ValueSource : public ReferenceCountedObject,
  4688. public AsyncUpdater
  4689. {
  4690. public:
  4691. ValueSource();
  4692. virtual ~ValueSource();
  4693. virtual const var getValue() const = 0;
  4694. virtual void setValue (const var& newValue) = 0;
  4695. void sendChangeMessage (const bool dispatchSynchronously);
  4696. juce_UseDebuggingNewOperator
  4697. protected:
  4698. friend class Value;
  4699. SortedSet <Value*> valuesWithListeners;
  4700. void handleAsyncUpdate();
  4701. ValueSource (const ValueSource&);
  4702. ValueSource& operator= (const ValueSource&);
  4703. };
  4704. explicit Value (ValueSource* const valueSource);
  4705. ValueSource& getValueSource() { return *value; }
  4706. juce_UseDebuggingNewOperator
  4707. private:
  4708. friend class ValueSource;
  4709. ReferenceCountedObjectPtr <ValueSource> value;
  4710. ListenerList <Listener> listeners;
  4711. void callListeners();
  4712. // This is disallowed to avoid confusion about whether it should
  4713. // do a by-value or by-reference copy.
  4714. Value& operator= (const Value& other);
  4715. };
  4716. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4717. #endif // __JUCE_VALUE_JUCEHEADER__
  4718. /*** End of inlined file: juce_Value.h ***/
  4719. #endif
  4720. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4721. /*** Start of inlined file: juce_ValueTree.h ***/
  4722. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4723. #define __JUCE_VALUETREE_JUCEHEADER__
  4724. /*** Start of inlined file: juce_UndoManager.h ***/
  4725. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4726. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4727. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4728. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4729. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4730. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4731. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4732. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4733. /*** Start of inlined file: juce_ChangeListener.h ***/
  4734. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4735. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4736. class JUCE_API ChangeListener
  4737. {
  4738. public:
  4739. virtual ~ChangeListener() {}
  4740. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4741. };
  4742. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4743. /*** End of inlined file: juce_ChangeListener.h ***/
  4744. /*** Start of inlined file: juce_ScopedLock.h ***/
  4745. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4746. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4747. class JUCE_API ScopedLock
  4748. {
  4749. public:
  4750. inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4751. inline ~ScopedLock() throw() { lock_.exit(); }
  4752. private:
  4753. const CriticalSection& lock_;
  4754. ScopedLock (const ScopedLock&);
  4755. ScopedLock& operator= (const ScopedLock&);
  4756. };
  4757. class ScopedUnlock
  4758. {
  4759. public:
  4760. inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4761. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4762. private:
  4763. const CriticalSection& lock_;
  4764. ScopedUnlock (const ScopedLock&);
  4765. ScopedUnlock& operator= (const ScopedUnlock&);
  4766. };
  4767. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4768. /*** End of inlined file: juce_ScopedLock.h ***/
  4769. class JUCE_API ChangeListenerList : public MessageListener
  4770. {
  4771. public:
  4772. ChangeListenerList() throw();
  4773. ~ChangeListenerList() throw();
  4774. void addChangeListener (ChangeListener* listener) throw();
  4775. void removeChangeListener (ChangeListener* listener) throw();
  4776. void removeAllChangeListeners() throw();
  4777. void sendChangeMessage (void* objectThatHasChanged) throw();
  4778. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4779. void dispatchPendingMessages();
  4780. void handleMessage (const Message&);
  4781. juce_UseDebuggingNewOperator
  4782. private:
  4783. SortedSet <void*> listeners;
  4784. CriticalSection lock;
  4785. void* lastChangedObject;
  4786. bool messagePending;
  4787. ChangeListenerList (const ChangeListenerList&);
  4788. ChangeListenerList& operator= (const ChangeListenerList&);
  4789. };
  4790. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4791. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4792. class JUCE_API ChangeBroadcaster
  4793. {
  4794. public:
  4795. ChangeBroadcaster() throw();
  4796. virtual ~ChangeBroadcaster();
  4797. void addChangeListener (ChangeListener* listener) throw();
  4798. void removeChangeListener (ChangeListener* listener) throw();
  4799. void removeAllChangeListeners() throw();
  4800. void sendChangeMessage (void* objectThatHasChanged) throw();
  4801. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4802. void dispatchPendingMessages();
  4803. private:
  4804. ChangeListenerList changeListenerList;
  4805. ChangeBroadcaster (const ChangeBroadcaster&);
  4806. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4807. };
  4808. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4809. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4810. /*** Start of inlined file: juce_UndoableAction.h ***/
  4811. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4812. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4813. class JUCE_API UndoableAction
  4814. {
  4815. protected:
  4816. UndoableAction() throw() {}
  4817. public:
  4818. virtual ~UndoableAction() {}
  4819. virtual bool perform() = 0;
  4820. virtual bool undo() = 0;
  4821. virtual int getSizeInUnits() { return 10; }
  4822. };
  4823. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4824. /*** End of inlined file: juce_UndoableAction.h ***/
  4825. class JUCE_API UndoManager : public ChangeBroadcaster
  4826. {
  4827. public:
  4828. UndoManager (int maxNumberOfUnitsToKeep = 30000,
  4829. int minimumTransactionsToKeep = 30);
  4830. ~UndoManager();
  4831. void clearUndoHistory();
  4832. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4833. void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
  4834. int minimumTransactionsToKeep);
  4835. bool perform (UndoableAction* action,
  4836. const String& actionName = String::empty);
  4837. void beginNewTransaction (const String& actionName = String::empty);
  4838. void setCurrentTransactionName (const String& newName);
  4839. bool canUndo() const;
  4840. const String getUndoDescription() const;
  4841. bool undo();
  4842. bool undoCurrentTransactionOnly();
  4843. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4844. int getNumActionsInCurrentTransaction() const;
  4845. bool canRedo() const;
  4846. const String getRedoDescription() const;
  4847. bool redo();
  4848. juce_UseDebuggingNewOperator
  4849. private:
  4850. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4851. StringArray transactionNames;
  4852. String currentTransactionName;
  4853. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4854. bool newTransaction, reentrancyCheck;
  4855. // disallow copy constructor
  4856. UndoManager (const UndoManager&);
  4857. UndoManager& operator= (const UndoManager&);
  4858. };
  4859. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4860. /*** End of inlined file: juce_UndoManager.h ***/
  4861. class JUCE_API ValueTree
  4862. {
  4863. public:
  4864. explicit ValueTree (const String& type);
  4865. ValueTree (const ValueTree& other);
  4866. ValueTree& operator= (const ValueTree& other);
  4867. ~ValueTree();
  4868. bool operator== (const ValueTree& other) const;
  4869. bool operator!= (const ValueTree& other) const;
  4870. bool isValid() const { return object != 0; }
  4871. ValueTree createCopy() const;
  4872. const String getType() const;
  4873. bool hasType (const String& typeName) const;
  4874. const var& getProperty (const var::identifier& name) const;
  4875. const var& operator[] (const var::identifier& name) const;
  4876. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4877. bool hasProperty (const var::identifier& name) const;
  4878. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4879. void removeAllProperties (UndoManager* const undoManager);
  4880. int getNumProperties() const;
  4881. const var::identifier getPropertyName (int index) const;
  4882. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4883. int getNumChildren() const;
  4884. ValueTree getChild (int index) const;
  4885. ValueTree getChildWithName (const String& type) const;
  4886. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4887. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4888. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4889. void removeChild (const int childIndex, UndoManager* const undoManager);
  4890. void removeAllChildren (UndoManager* const undoManager);
  4891. bool isAChildOf (const ValueTree& possibleParent) const;
  4892. ValueTree getParent() const;
  4893. XmlElement* createXml() const;
  4894. static ValueTree fromXml (const XmlElement& xml);
  4895. void writeToStream (OutputStream& output);
  4896. static ValueTree readFromStream (InputStream& input);
  4897. class JUCE_API Listener
  4898. {
  4899. public:
  4900. virtual ~Listener() {}
  4901. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4902. const var::identifier& property) = 0;
  4903. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4904. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4905. };
  4906. void addListener (Listener* listener);
  4907. void removeListener (Listener* listener);
  4908. template <typename ElementComparator>
  4909. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4910. {
  4911. if (object != 0)
  4912. {
  4913. ComparatorAdapter <ElementComparator> adapter (comparator);
  4914. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4915. object->sendChildChangeMessage();
  4916. }
  4917. }
  4918. static ValueTree invalid;
  4919. juce_UseDebuggingNewOperator
  4920. private:
  4921. friend class ValueTreeSetPropertyAction;
  4922. friend class ValueTreeChildChangeAction;
  4923. class JUCE_API SharedObject : public ReferenceCountedObject
  4924. {
  4925. public:
  4926. SharedObject (const String& type);
  4927. SharedObject (const SharedObject& other);
  4928. ~SharedObject();
  4929. const String type;
  4930. NamedValueSet properties;
  4931. ReferenceCountedArray <SharedObject> children;
  4932. SortedSet <ValueTree*> valueTreesWithListeners;
  4933. SharedObject* parent;
  4934. void sendPropertyChangeMessage (const var::identifier& property);
  4935. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4936. void sendChildChangeMessage();
  4937. void sendChildChangeMessage (ValueTree& tree);
  4938. void sendParentChangeMessage();
  4939. const var& getProperty (const var::identifier& name) const;
  4940. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4941. bool hasProperty (const var::identifier& name) const;
  4942. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4943. void removeAllProperties (UndoManager* const undoManager);
  4944. bool isAChildOf (const SharedObject* const possibleParent) const;
  4945. ValueTree getChildWithName (const String& type) const;
  4946. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4947. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4948. void removeChild (const int childIndex, UndoManager* const undoManager);
  4949. void removeAllChildren (UndoManager* const undoManager);
  4950. XmlElement* createXml() const;
  4951. juce_UseDebuggingNewOperator
  4952. private:
  4953. SharedObject& operator= (const SharedObject&);
  4954. };
  4955. template <typename ElementComparator>
  4956. class ComparatorAdapter
  4957. {
  4958. public:
  4959. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4960. int compareElements (SharedObject* const first, SharedObject* const second)
  4961. {
  4962. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4963. }
  4964. private:
  4965. ElementComparator& comparator;
  4966. };
  4967. friend class SharedObject;
  4968. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4969. ReferenceCountedObjectPtr <SharedObject> object;
  4970. ListenerList <Listener> listeners;
  4971. public:
  4972. explicit ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
  4973. };
  4974. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4975. /*** End of inlined file: juce_ValueTree.h ***/
  4976. #endif
  4977. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4978. #endif
  4979. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4980. /*** Start of inlined file: juce_VoidArray.h ***/
  4981. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4982. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4983. typedef Array <void*> VoidArray;
  4984. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4985. /*** End of inlined file: juce_VoidArray.h ***/
  4986. #endif
  4987. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4988. #endif
  4989. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4990. #endif
  4991. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4992. /*** Start of inlined file: juce_FileLogger.h ***/
  4993. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4994. #define __JUCE_FILELOGGER_JUCEHEADER__
  4995. class JUCE_API FileLogger : public Logger
  4996. {
  4997. public:
  4998. FileLogger (const File& fileToWriteTo,
  4999. const String& welcomeMessage,
  5000. const int maxInitialFileSizeBytes = 128 * 1024);
  5001. ~FileLogger();
  5002. void logMessage (const String& message);
  5003. const File getLogFile() const { return logFile; }
  5004. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  5005. const String& logFileName,
  5006. const String& welcomeMessage,
  5007. const int maxInitialFileSizeBytes = 128 * 1024);
  5008. juce_UseDebuggingNewOperator
  5009. private:
  5010. File logFile;
  5011. CriticalSection logLock;
  5012. ScopedPointer <FileOutputStream> logStream;
  5013. void trimFileSize (int maxFileSizeBytes) const;
  5014. FileLogger (const FileLogger&);
  5015. FileLogger& operator= (const FileLogger&);
  5016. };
  5017. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  5018. /*** End of inlined file: juce_FileLogger.h ***/
  5019. #endif
  5020. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5021. /*** Start of inlined file: juce_Initialisation.h ***/
  5022. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5023. #define __JUCE_INITIALISATION_JUCEHEADER__
  5024. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  5025. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  5026. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  5027. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  5028. class ScopedJuceInitialiser_NonGUI
  5029. {
  5030. public:
  5031. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  5032. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  5033. };
  5034. class ScopedJuceInitialiser_GUI
  5035. {
  5036. public:
  5037. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  5038. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  5039. };
  5040. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  5041. /*** End of inlined file: juce_Initialisation.h ***/
  5042. #endif
  5043. #ifndef __JUCE_LOGGER_JUCEHEADER__
  5044. #endif
  5045. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  5046. #endif
  5047. #ifndef __JUCE_MEMORY_JUCEHEADER__
  5048. #endif
  5049. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5050. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  5051. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5052. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5053. class JUCE_API PerformanceCounter
  5054. {
  5055. public:
  5056. PerformanceCounter (const String& counterName,
  5057. int runsPerPrintout = 100,
  5058. const File& loggingFile = File::nonexistent);
  5059. ~PerformanceCounter();
  5060. void start();
  5061. void stop();
  5062. void printStatistics();
  5063. juce_UseDebuggingNewOperator
  5064. private:
  5065. String name;
  5066. int numRuns, runsPerPrint;
  5067. double totalTime;
  5068. int64 started;
  5069. File outputFile;
  5070. };
  5071. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5072. /*** End of inlined file: juce_PerformanceCounter.h ***/
  5073. #endif
  5074. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  5075. #endif
  5076. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5077. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  5078. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5079. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5080. class JUCE_API PlatformUtilities
  5081. {
  5082. public:
  5083. static void beep();
  5084. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  5085. const String& emailSubject,
  5086. const String& bodyText,
  5087. const StringArray& filesToAttach);
  5088. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  5089. static const String cfStringToJuceString (CFStringRef cfString);
  5090. static CFStringRef juceStringToCFString (const String& s);
  5091. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5092. static const String makePathFromFSRef (FSRef* file);
  5093. static const String convertToPrecomposedUnicode (const String& s);
  5094. static OSType getTypeOfFile (const String& filename);
  5095. static bool isBundle (const String& filename);
  5096. static void addItemToDock (const File& file);
  5097. static int getOSXMinorVersionNumber();
  5098. #endif
  5099. #if JUCE_WINDOWS || DOXYGEN
  5100. // Some registry helper functions:
  5101. static const String getRegistryValue (const String& regValuePath,
  5102. const String& defaultValue = String::empty);
  5103. static void setRegistryValue (const String& regValuePath,
  5104. const String& value);
  5105. static bool registryValueExists (const String& regValuePath);
  5106. static void deleteRegistryValue (const String& regValuePath);
  5107. static void deleteRegistryKey (const String& regKeyPath);
  5108. static void registerFileAssociation (const String& fileExtension,
  5109. const String& symbolicDescription,
  5110. const String& fullDescription,
  5111. const File& targetExecutable,
  5112. int iconResourceNumber);
  5113. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5114. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5115. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5116. #endif
  5117. static void fpuReset();
  5118. #if JUCE_LINUX || JUCE_WINDOWS
  5119. static void* loadDynamicLibrary (const String& pathOrFilename);
  5120. static void freeDynamicLibrary (void* libraryHandle);
  5121. static void* getProcedureEntryPoint (void* libraryHandle,
  5122. const String& procedureName);
  5123. #endif
  5124. #if JUCE_LINUX || DOXYGEN
  5125. #endif
  5126. private:
  5127. PlatformUtilities();
  5128. PlatformUtilities (const PlatformUtilities&);
  5129. PlatformUtilities& operator= (const PlatformUtilities&);
  5130. };
  5131. #if JUCE_MAC || JUCE_IPHONE
  5132. class ScopedAutoReleasePool
  5133. {
  5134. public:
  5135. ScopedAutoReleasePool();
  5136. ~ScopedAutoReleasePool();
  5137. private:
  5138. void* pool;
  5139. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5140. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5141. };
  5142. #endif
  5143. #if JUCE_LINUX
  5144. class ScopedXLock
  5145. {
  5146. public:
  5147. ScopedXLock();
  5148. ~ScopedXLock();
  5149. };
  5150. #endif
  5151. #if JUCE_MAC
  5152. class JUCE_API AppleRemoteDevice
  5153. {
  5154. public:
  5155. AppleRemoteDevice();
  5156. virtual ~AppleRemoteDevice();
  5157. enum ButtonType
  5158. {
  5159. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5160. playButton, /**< The play button. */
  5161. plusButton, /**< The plus or volume-up button. */
  5162. minusButton, /**< The minus or volume-down button. */
  5163. rightButton, /**< The right button (if it's held for a short time). */
  5164. leftButton, /**< The left button (if it's held for a short time). */
  5165. rightButton_Long, /**< The right button (if it's held for a long time). */
  5166. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5167. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5168. playButtonSleepMode,
  5169. switched
  5170. };
  5171. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5172. bool start (const bool inExclusiveMode);
  5173. void stop();
  5174. bool isActive() const;
  5175. int getRemoteId() const { return remoteId; }
  5176. juce_UseDebuggingNewOperator
  5177. void handleCallbackInternal();
  5178. private:
  5179. void* device;
  5180. void* queue;
  5181. int remoteId;
  5182. bool open (const bool openInExclusiveMode);
  5183. AppleRemoteDevice (const AppleRemoteDevice&);
  5184. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5185. };
  5186. #endif
  5187. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5188. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5189. #endif
  5190. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5191. /*** Start of inlined file: juce_Random.h ***/
  5192. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5193. #define __JUCE_RANDOM_JUCEHEADER__
  5194. class JUCE_API Random
  5195. {
  5196. public:
  5197. explicit Random (int64 seedValue) throw();
  5198. ~Random() throw();
  5199. int nextInt() throw();
  5200. int nextInt (int maxValue) throw();
  5201. int64 nextInt64() throw();
  5202. float nextFloat() throw();
  5203. double nextDouble() throw();
  5204. bool nextBool() throw();
  5205. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5206. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5207. static Random& getSystemRandom() throw();
  5208. void setSeed (int64 newSeed) throw();
  5209. void combineSeed (int64 seedValue) throw();
  5210. void setSeedRandomly();
  5211. juce_UseDebuggingNewOperator
  5212. private:
  5213. int64 seed;
  5214. };
  5215. #endif // __JUCE_RANDOM_JUCEHEADER__
  5216. /*** End of inlined file: juce_Random.h ***/
  5217. #endif
  5218. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5219. #endif
  5220. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5221. /*** Start of inlined file: juce_Singleton.h ***/
  5222. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5223. #define __JUCE_SINGLETON_JUCEHEADER__
  5224. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5225. \
  5226. static classname* _singletonInstance; \
  5227. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5228. \
  5229. static classname* getInstance() \
  5230. { \
  5231. if (_singletonInstance == 0) \
  5232. {\
  5233. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5234. \
  5235. if (_singletonInstance == 0) \
  5236. { \
  5237. static bool alreadyInside = false; \
  5238. static bool createdOnceAlready = false; \
  5239. \
  5240. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5241. jassert (! problem); \
  5242. if (! problem) \
  5243. { \
  5244. createdOnceAlready = true; \
  5245. alreadyInside = true; \
  5246. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5247. alreadyInside = false; \
  5248. \
  5249. _singletonInstance = newObject; \
  5250. } \
  5251. } \
  5252. } \
  5253. \
  5254. return _singletonInstance; \
  5255. } \
  5256. \
  5257. static inline classname* getInstanceWithoutCreating() throw() \
  5258. { \
  5259. return _singletonInstance; \
  5260. } \
  5261. \
  5262. static void deleteInstance() \
  5263. { \
  5264. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5265. if (_singletonInstance != 0) \
  5266. { \
  5267. classname* const old = _singletonInstance; \
  5268. _singletonInstance = 0; \
  5269. delete old; \
  5270. } \
  5271. } \
  5272. \
  5273. void clearSingletonInstance() throw() \
  5274. { \
  5275. if (_singletonInstance == this) \
  5276. _singletonInstance = 0; \
  5277. }
  5278. #define juce_ImplementSingleton(classname) \
  5279. \
  5280. classname* classname::_singletonInstance = 0; \
  5281. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5282. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5283. \
  5284. static classname* _singletonInstance; \
  5285. \
  5286. static classname* getInstance() \
  5287. { \
  5288. if (_singletonInstance == 0) \
  5289. { \
  5290. static bool alreadyInside = false; \
  5291. static bool createdOnceAlready = false; \
  5292. \
  5293. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5294. jassert (! problem); \
  5295. if (! problem) \
  5296. { \
  5297. createdOnceAlready = true; \
  5298. alreadyInside = true; \
  5299. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5300. alreadyInside = false; \
  5301. \
  5302. _singletonInstance = newObject; \
  5303. } \
  5304. } \
  5305. \
  5306. return _singletonInstance; \
  5307. } \
  5308. \
  5309. static inline classname* getInstanceWithoutCreating() throw() \
  5310. { \
  5311. return _singletonInstance; \
  5312. } \
  5313. \
  5314. static void deleteInstance() \
  5315. { \
  5316. if (_singletonInstance != 0) \
  5317. { \
  5318. classname* const old = _singletonInstance; \
  5319. _singletonInstance = 0; \
  5320. delete old; \
  5321. } \
  5322. } \
  5323. \
  5324. void clearSingletonInstance() throw() \
  5325. { \
  5326. if (_singletonInstance == this) \
  5327. _singletonInstance = 0; \
  5328. }
  5329. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5330. \
  5331. static classname* _singletonInstance; \
  5332. \
  5333. static classname* getInstance() \
  5334. { \
  5335. if (_singletonInstance == 0) \
  5336. _singletonInstance = new classname(); \
  5337. \
  5338. return _singletonInstance; \
  5339. } \
  5340. \
  5341. static inline classname* getInstanceWithoutCreating() throw() \
  5342. { \
  5343. return _singletonInstance; \
  5344. } \
  5345. \
  5346. static void deleteInstance() \
  5347. { \
  5348. if (_singletonInstance != 0) \
  5349. { \
  5350. classname* const old = _singletonInstance; \
  5351. _singletonInstance = 0; \
  5352. delete old; \
  5353. } \
  5354. } \
  5355. \
  5356. void clearSingletonInstance() throw() \
  5357. { \
  5358. if (_singletonInstance == this) \
  5359. _singletonInstance = 0; \
  5360. }
  5361. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5362. \
  5363. classname* classname::_singletonInstance = 0;
  5364. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5365. /*** End of inlined file: juce_Singleton.h ***/
  5366. #endif
  5367. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5368. #endif
  5369. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5370. /*** Start of inlined file: juce_SystemStats.h ***/
  5371. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5372. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5373. class JUCE_API SystemStats
  5374. {
  5375. public:
  5376. static const String getJUCEVersion() throw();
  5377. enum OperatingSystemType
  5378. {
  5379. UnknownOS = 0,
  5380. MacOSX = 0x1000,
  5381. Linux = 0x2000,
  5382. Win95 = 0x4001,
  5383. Win98 = 0x4002,
  5384. WinNT351 = 0x4103,
  5385. WinNT40 = 0x4104,
  5386. Win2000 = 0x4105,
  5387. WinXP = 0x4106,
  5388. WinVista = 0x4107,
  5389. Windows7 = 0x4108,
  5390. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5391. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5392. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5393. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5394. };
  5395. static OperatingSystemType getOperatingSystemType() throw();
  5396. static const String getOperatingSystemName() throw();
  5397. static bool isOperatingSystem64Bit() throw();
  5398. static const String getLogonName();
  5399. static const String getFullUserName();
  5400. // CPU and memory information..
  5401. static int getCpuSpeedInMegaherz() throw();
  5402. static const String getCpuVendor() throw();
  5403. static bool hasMMX() throw();
  5404. static bool hasSSE() throw();
  5405. static bool hasSSE2() throw();
  5406. static bool has3DNow() throw();
  5407. static int getNumCpus() throw();
  5408. static int64 getClockCycleCounter() throw();
  5409. static int getMemorySizeInMegabytes() throw();
  5410. static int getPageSize() throw();
  5411. static int getMACAddresses (int64* addresses, int maxNum,
  5412. #if JUCE_MAC
  5413. bool littleEndian = true);
  5414. #else
  5415. bool littleEndian = false);
  5416. #endif
  5417. static const StringArray getMACAddressStrings();
  5418. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5419. static void initialiseStats() throw();
  5420. private:
  5421. SystemStats();
  5422. SystemStats (const SystemStats&);
  5423. SystemStats& operator= (const SystemStats&);
  5424. };
  5425. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5426. /*** End of inlined file: juce_SystemStats.h ***/
  5427. #endif
  5428. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5429. #endif
  5430. #ifndef __JUCE_TIME_JUCEHEADER__
  5431. #endif
  5432. #ifndef __JUCE_UUID_JUCEHEADER__
  5433. /*** Start of inlined file: juce_Uuid.h ***/
  5434. #ifndef __JUCE_UUID_JUCEHEADER__
  5435. #define __JUCE_UUID_JUCEHEADER__
  5436. class JUCE_API Uuid
  5437. {
  5438. public:
  5439. Uuid();
  5440. ~Uuid() throw();
  5441. Uuid (const Uuid& other);
  5442. Uuid& operator= (const Uuid& other);
  5443. bool isNull() const throw();
  5444. bool operator== (const Uuid& other) const;
  5445. bool operator!= (const Uuid& other) const;
  5446. const String toString() const;
  5447. Uuid (const String& uuidString);
  5448. Uuid& operator= (const String& uuidString);
  5449. const uint8* getRawData() const throw() { return value.asBytes; }
  5450. Uuid (const uint8* const rawData);
  5451. Uuid& operator= (const uint8* const rawData);
  5452. juce_UseDebuggingNewOperator
  5453. private:
  5454. union
  5455. {
  5456. uint8 asBytes [16];
  5457. int asInt[4];
  5458. int64 asInt64[2];
  5459. } value;
  5460. };
  5461. #endif // __JUCE_UUID_JUCEHEADER__
  5462. /*** End of inlined file: juce_Uuid.h ***/
  5463. #endif
  5464. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5465. /*** Start of inlined file: juce_BlowFish.h ***/
  5466. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5467. #define __JUCE_BLOWFISH_JUCEHEADER__
  5468. class JUCE_API BlowFish
  5469. {
  5470. public:
  5471. BlowFish (const void* keyData, int keyBytes);
  5472. BlowFish (const BlowFish& other);
  5473. BlowFish& operator= (const BlowFish& other);
  5474. ~BlowFish();
  5475. void encrypt (uint32& data1, uint32& data2) const throw();
  5476. void decrypt (uint32& data1, uint32& data2) const throw();
  5477. juce_UseDebuggingNewOperator
  5478. private:
  5479. uint32 p[18];
  5480. HeapBlock <uint32> s[4];
  5481. uint32 F (uint32 x) const throw();
  5482. };
  5483. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5484. /*** End of inlined file: juce_BlowFish.h ***/
  5485. #endif
  5486. #ifndef __JUCE_MD5_JUCEHEADER__
  5487. /*** Start of inlined file: juce_MD5.h ***/
  5488. #ifndef __JUCE_MD5_JUCEHEADER__
  5489. #define __JUCE_MD5_JUCEHEADER__
  5490. class JUCE_API MD5
  5491. {
  5492. public:
  5493. MD5();
  5494. MD5 (const MD5& other);
  5495. MD5& operator= (const MD5& other);
  5496. explicit MD5 (const MemoryBlock& data);
  5497. MD5 (const void* data, const size_t numBytes);
  5498. explicit MD5 (const String& text);
  5499. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5500. explicit MD5 (const File& file);
  5501. ~MD5();
  5502. const MemoryBlock getRawChecksumData() const;
  5503. const String toHexString() const;
  5504. bool operator== (const MD5& other) const;
  5505. bool operator!= (const MD5& other) const;
  5506. juce_UseDebuggingNewOperator
  5507. private:
  5508. uint8 result [16];
  5509. struct ProcessContext
  5510. {
  5511. uint8 buffer [64];
  5512. uint32 state [4];
  5513. uint32 count [2];
  5514. ProcessContext();
  5515. void processBlock (const void* data, size_t dataSize);
  5516. void transform (const void* buffer);
  5517. void finish (void* const result);
  5518. };
  5519. void processStream (InputStream& input, int64 numBytesToRead);
  5520. };
  5521. #endif // __JUCE_MD5_JUCEHEADER__
  5522. /*** End of inlined file: juce_MD5.h ***/
  5523. #endif
  5524. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5525. /*** Start of inlined file: juce_Primes.h ***/
  5526. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5527. #define __JUCE_PRIMES_JUCEHEADER__
  5528. class JUCE_API Primes
  5529. {
  5530. public:
  5531. static const BigInteger createProbablePrime (int bitLength,
  5532. int certainty,
  5533. const int* randomSeeds = 0,
  5534. int numRandomSeeds = 0);
  5535. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5536. private:
  5537. Primes();
  5538. Primes (const Primes&);
  5539. Primes& operator= (const Primes&);
  5540. };
  5541. #endif // __JUCE_PRIMES_JUCEHEADER__
  5542. /*** End of inlined file: juce_Primes.h ***/
  5543. #endif
  5544. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5545. /*** Start of inlined file: juce_RSAKey.h ***/
  5546. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5547. #define __JUCE_RSAKEY_JUCEHEADER__
  5548. class JUCE_API RSAKey
  5549. {
  5550. public:
  5551. RSAKey();
  5552. explicit RSAKey (const String& stringRepresentation);
  5553. ~RSAKey();
  5554. const String toString() const;
  5555. bool applyToValue (BigInteger& value) const;
  5556. static void createKeyPair (RSAKey& publicKey,
  5557. RSAKey& privateKey,
  5558. int numBits,
  5559. const int* randomSeeds = 0,
  5560. int numRandomSeeds = 0);
  5561. juce_UseDebuggingNewOperator
  5562. protected:
  5563. BigInteger part1, part2;
  5564. };
  5565. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5566. /*** End of inlined file: juce_RSAKey.h ***/
  5567. #endif
  5568. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5569. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5570. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5571. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5572. class JUCE_API DirectoryIterator
  5573. {
  5574. public:
  5575. DirectoryIterator (const File& directory,
  5576. bool isRecursive,
  5577. const String& wildCard = "*",
  5578. int whatToLookFor = File::findFiles);
  5579. ~DirectoryIterator();
  5580. bool next();
  5581. const File getFile() const;
  5582. float getEstimatedProgress() const;
  5583. juce_UseDebuggingNewOperator
  5584. private:
  5585. Array <File> filesFound;
  5586. Array <File> dirsFound;
  5587. String wildCard;
  5588. int index;
  5589. const int whatToLookFor;
  5590. ScopedPointer <DirectoryIterator> subIterator;
  5591. DirectoryIterator (const DirectoryIterator&);
  5592. DirectoryIterator& operator= (const DirectoryIterator&);
  5593. };
  5594. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5595. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5596. #endif
  5597. #ifndef __JUCE_FILE_JUCEHEADER__
  5598. #endif
  5599. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5600. /*** Start of inlined file: juce_FileInputStream.h ***/
  5601. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5602. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5603. class JUCE_API FileInputStream : public InputStream
  5604. {
  5605. public:
  5606. explicit FileInputStream (const File& fileToRead);
  5607. ~FileInputStream();
  5608. const File& getFile() const throw() { return file; }
  5609. int64 getTotalLength();
  5610. int read (void* destBuffer, int maxBytesToRead);
  5611. bool isExhausted();
  5612. int64 getPosition();
  5613. bool setPosition (int64 pos);
  5614. juce_UseDebuggingNewOperator
  5615. private:
  5616. File file;
  5617. void* fileHandle;
  5618. int64 currentPosition, totalSize;
  5619. bool needToSeek;
  5620. FileInputStream (const FileInputStream&);
  5621. FileInputStream& operator= (const FileInputStream&);
  5622. };
  5623. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5624. /*** End of inlined file: juce_FileInputStream.h ***/
  5625. #endif
  5626. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5627. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5628. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5629. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5630. class JUCE_API FileOutputStream : public OutputStream
  5631. {
  5632. public:
  5633. FileOutputStream (const File& fileToWriteTo,
  5634. int bufferSizeToUse = 16384);
  5635. ~FileOutputStream();
  5636. const File& getFile() const { return file; }
  5637. bool failedToOpen() const { return fileHandle == 0; }
  5638. void flush();
  5639. int64 getPosition();
  5640. bool setPosition (int64 pos);
  5641. bool write (const void* data, int numBytes);
  5642. juce_UseDebuggingNewOperator
  5643. private:
  5644. File file;
  5645. void* fileHandle;
  5646. int64 currentPosition;
  5647. int bufferSize, bytesInBuffer;
  5648. HeapBlock <char> buffer;
  5649. FileOutputStream (const FileOutputStream&);
  5650. FileOutputStream& operator= (const FileOutputStream&);
  5651. };
  5652. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5653. /*** End of inlined file: juce_FileOutputStream.h ***/
  5654. #endif
  5655. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5656. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5657. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5658. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5659. class JUCE_API FileSearchPath
  5660. {
  5661. public:
  5662. FileSearchPath();
  5663. FileSearchPath (const String& path);
  5664. FileSearchPath (const FileSearchPath& other);
  5665. ~FileSearchPath();
  5666. FileSearchPath& operator= (const String& path);
  5667. int getNumPaths() const;
  5668. const File operator[] (int index) const;
  5669. const String toString() const;
  5670. void add (const File& directoryToAdd,
  5671. int insertIndex = -1);
  5672. void addIfNotAlreadyThere (const File& directoryToAdd);
  5673. void remove (int indexToRemove);
  5674. void addPath (const FileSearchPath& other);
  5675. void removeRedundantPaths();
  5676. void removeNonExistentPaths();
  5677. int findChildFiles (Array<File>& results,
  5678. int whatToLookFor,
  5679. bool searchRecursively,
  5680. const String& wildCardPattern = "*") const;
  5681. bool isFileInPath (const File& fileToCheck,
  5682. bool checkRecursively) const;
  5683. juce_UseDebuggingNewOperator
  5684. private:
  5685. StringArray directories;
  5686. void init (const String& path);
  5687. };
  5688. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5689. /*** End of inlined file: juce_FileSearchPath.h ***/
  5690. #endif
  5691. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5692. /*** Start of inlined file: juce_NamedPipe.h ***/
  5693. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5694. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5695. class JUCE_API NamedPipe
  5696. {
  5697. public:
  5698. NamedPipe();
  5699. ~NamedPipe();
  5700. bool openExisting (const String& pipeName);
  5701. bool createNewPipe (const String& pipeName);
  5702. void close();
  5703. bool isOpen() const;
  5704. const String getName() const;
  5705. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5706. int write (const void* sourceBuffer, int numBytesToWrite,
  5707. int timeOutMilliseconds = 2000);
  5708. void cancelPendingReads();
  5709. juce_UseDebuggingNewOperator
  5710. private:
  5711. void* internal;
  5712. String currentPipeName;
  5713. CriticalSection lock;
  5714. NamedPipe (const NamedPipe&);
  5715. NamedPipe& operator= (const NamedPipe&);
  5716. bool openInternal (const String& pipeName, const bool createPipe);
  5717. };
  5718. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5719. /*** End of inlined file: juce_NamedPipe.h ***/
  5720. #endif
  5721. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5722. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5723. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5724. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5725. class JUCE_API TemporaryFile
  5726. {
  5727. public:
  5728. enum OptionFlags
  5729. {
  5730. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5731. i.e. its name should start with a dot. */
  5732. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5733. the file is unique, they should go in brackets rather
  5734. than just being appended (see File::getNonexistentSibling() )*/
  5735. };
  5736. TemporaryFile (const String& suffix = String::empty,
  5737. int optionFlags = 0);
  5738. TemporaryFile (const File& targetFile,
  5739. int optionFlags = 0);
  5740. ~TemporaryFile();
  5741. const File getFile() const { return temporaryFile; }
  5742. const File getTargetFile() const { return targetFile; }
  5743. bool overwriteTargetFileWithTemporary() const;
  5744. juce_UseDebuggingNewOperator
  5745. private:
  5746. File temporaryFile, targetFile;
  5747. void createTempFile (const File& parentDirectory, String name, const String& suffix, int optionFlags);
  5748. TemporaryFile (const TemporaryFile&);
  5749. TemporaryFile& operator= (const TemporaryFile&);
  5750. };
  5751. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5752. /*** End of inlined file: juce_TemporaryFile.h ***/
  5753. #endif
  5754. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5755. /*** Start of inlined file: juce_ZipFile.h ***/
  5756. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5757. #define __JUCE_ZIPFILE_JUCEHEADER__
  5758. /*** Start of inlined file: juce_InputSource.h ***/
  5759. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5760. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5761. class JUCE_API InputSource
  5762. {
  5763. public:
  5764. InputSource() throw() {}
  5765. virtual ~InputSource() {}
  5766. virtual InputStream* createInputStream() = 0;
  5767. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5768. virtual int64 hashCode() const = 0;
  5769. juce_UseDebuggingNewOperator
  5770. };
  5771. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5772. /*** End of inlined file: juce_InputSource.h ***/
  5773. class JUCE_API ZipFile
  5774. {
  5775. public:
  5776. ZipFile (InputStream* inputStream,
  5777. bool deleteStreamWhenDestroyed) throw();
  5778. ZipFile (const File& file);
  5779. ZipFile (InputSource* inputSource);
  5780. ~ZipFile() throw();
  5781. struct ZipEntry
  5782. {
  5783. String filename;
  5784. unsigned int uncompressedSize;
  5785. Time fileTime;
  5786. };
  5787. int getNumEntries() const throw();
  5788. const ZipEntry* getEntry (int index) const throw();
  5789. int getIndexOfFileName (const String& fileName) const throw();
  5790. const ZipEntry* getEntry (const String& fileName) const throw();
  5791. void sortEntriesByFilename();
  5792. InputStream* createStreamForEntry (int index);
  5793. void uncompressTo (const File& targetDirectory,
  5794. bool shouldOverwriteFiles = true);
  5795. juce_UseDebuggingNewOperator
  5796. private:
  5797. class ZipInputStream;
  5798. class ZipFilenameComparator;
  5799. class ZipEntryInfo;
  5800. friend class ZipInputStream;
  5801. friend class ZipFilenameComparator;
  5802. friend class ZipEntryInfo;
  5803. OwnedArray <ZipEntryInfo> entries;
  5804. CriticalSection lock;
  5805. InputStream* inputStream;
  5806. ScopedPointer <InputStream> streamToDelete;
  5807. ScopedPointer <InputSource> inputSource;
  5808. #ifdef JUCE_DEBUG
  5809. int numOpenStreams;
  5810. #endif
  5811. void init();
  5812. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5813. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5814. ZipFile (const ZipFile&);
  5815. ZipFile& operator= (const ZipFile&);
  5816. };
  5817. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5818. /*** End of inlined file: juce_ZipFile.h ***/
  5819. #endif
  5820. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5821. /*** Start of inlined file: juce_Socket.h ***/
  5822. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5823. #define __JUCE_SOCKET_JUCEHEADER__
  5824. class JUCE_API StreamingSocket
  5825. {
  5826. public:
  5827. StreamingSocket();
  5828. ~StreamingSocket();
  5829. bool bindToPort (int localPortNumber);
  5830. bool connect (const String& remoteHostname,
  5831. int remotePortNumber,
  5832. int timeOutMillisecs = 3000);
  5833. bool isConnected() const throw() { return connected; }
  5834. void close();
  5835. const String& getHostName() const throw() { return hostName; }
  5836. int getPort() const throw() { return portNumber; }
  5837. bool isLocal() const throw();
  5838. int waitUntilReady (bool readyForReading,
  5839. int timeoutMsecs) const;
  5840. int read (void* destBuffer, int maxBytesToRead,
  5841. bool blockUntilSpecifiedAmountHasArrived);
  5842. int write (const void* sourceBuffer, int numBytesToWrite);
  5843. bool createListener (int portNumber, const String& localHostName = String::empty);
  5844. StreamingSocket* waitForNextConnection() const;
  5845. juce_UseDebuggingNewOperator
  5846. private:
  5847. String hostName;
  5848. int volatile portNumber, handle;
  5849. bool connected, isListener;
  5850. StreamingSocket (const String& hostname, int portNumber, int handle);
  5851. StreamingSocket (const StreamingSocket&);
  5852. StreamingSocket& operator= (const StreamingSocket&);
  5853. };
  5854. class JUCE_API DatagramSocket
  5855. {
  5856. public:
  5857. DatagramSocket (int localPortNumber,
  5858. bool enableBroadcasting = false);
  5859. ~DatagramSocket();
  5860. bool bindToPort (int localPortNumber);
  5861. bool connect (const String& remoteHostname,
  5862. int remotePortNumber,
  5863. int timeOutMillisecs = 3000);
  5864. bool isConnected() const throw() { return connected; }
  5865. void close();
  5866. const String& getHostName() const throw() { return hostName; }
  5867. int getPort() const throw() { return portNumber; }
  5868. bool isLocal() const throw();
  5869. int waitUntilReady (bool readyForReading,
  5870. int timeoutMsecs) const;
  5871. int read (void* destBuffer, int maxBytesToRead,
  5872. bool blockUntilSpecifiedAmountHasArrived);
  5873. int write (const void* sourceBuffer, int numBytesToWrite);
  5874. DatagramSocket* waitForNextConnection() const;
  5875. juce_UseDebuggingNewOperator
  5876. private:
  5877. String hostName;
  5878. int volatile portNumber, handle;
  5879. bool connected, allowBroadcast;
  5880. void* serverAddress;
  5881. DatagramSocket (const String& hostname, int portNumber, int handle, int localPortNumber);
  5882. DatagramSocket (const DatagramSocket&);
  5883. DatagramSocket& operator= (const DatagramSocket&);
  5884. };
  5885. #endif // __JUCE_SOCKET_JUCEHEADER__
  5886. /*** End of inlined file: juce_Socket.h ***/
  5887. #endif
  5888. #ifndef __JUCE_URL_JUCEHEADER__
  5889. /*** Start of inlined file: juce_URL.h ***/
  5890. #ifndef __JUCE_URL_JUCEHEADER__
  5891. #define __JUCE_URL_JUCEHEADER__
  5892. class JUCE_API URL
  5893. {
  5894. public:
  5895. URL();
  5896. URL (const String& url);
  5897. URL (const URL& other);
  5898. ~URL();
  5899. URL& operator= (const URL& other);
  5900. const String toString (bool includeGetParameters) const;
  5901. bool isWellFormed() const;
  5902. const String getDomain() const;
  5903. const String getSubPath() const;
  5904. const String getScheme() const;
  5905. const URL withNewSubPath (const String& newPath) const;
  5906. const URL withParameter (const String& parameterName,
  5907. const String& parameterValue) const;
  5908. const URL withFileToUpload (const String& parameterName,
  5909. const File& fileToUpload,
  5910. const String& mimeType) const;
  5911. const StringPairArray& getParameters() const;
  5912. const StringPairArray& getFilesToUpload() const;
  5913. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5914. const URL withPOSTData (const String& postData) const;
  5915. const String getPostData() const { return postData; }
  5916. bool launchInDefaultBrowser() const;
  5917. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5918. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5919. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5920. InputStream* createInputStream (bool usePostCommand,
  5921. OpenStreamProgressCallback* progressCallback = 0,
  5922. void* progressCallbackContext = 0,
  5923. const String& extraHeaders = String::empty,
  5924. int connectionTimeOutMs = 0) const;
  5925. bool readEntireBinaryStream (MemoryBlock& destData,
  5926. bool usePostCommand = false) const;
  5927. const String readEntireTextStream (bool usePostCommand = false) const;
  5928. XmlElement* readEntireXmlStream (bool usePostCommand = false) const;
  5929. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5930. bool isParameter);
  5931. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5932. juce_UseDebuggingNewOperator
  5933. private:
  5934. String url, postData;
  5935. StringPairArray parameters, filesToUpload, mimeTypes;
  5936. };
  5937. #endif // __JUCE_URL_JUCEHEADER__
  5938. /*** End of inlined file: juce_URL.h ***/
  5939. #endif
  5940. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5941. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5942. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5943. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5944. class JUCE_API BufferedInputStream : public InputStream
  5945. {
  5946. public:
  5947. BufferedInputStream (InputStream* sourceStream,
  5948. int bufferSize,
  5949. bool deleteSourceWhenDestroyed);
  5950. ~BufferedInputStream();
  5951. int64 getTotalLength();
  5952. int64 getPosition();
  5953. bool setPosition (int64 newPosition);
  5954. int read (void* destBuffer, int maxBytesToRead);
  5955. const String readString();
  5956. bool isExhausted();
  5957. juce_UseDebuggingNewOperator
  5958. private:
  5959. InputStream* const source;
  5960. ScopedPointer <InputStream> sourceToDelete;
  5961. int bufferSize;
  5962. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5963. HeapBlock <char> buffer;
  5964. void ensureBuffered();
  5965. BufferedInputStream (const BufferedInputStream&);
  5966. BufferedInputStream& operator= (const BufferedInputStream&);
  5967. };
  5968. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5969. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5970. #endif
  5971. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5972. /*** Start of inlined file: juce_FileInputSource.h ***/
  5973. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5974. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5975. class JUCE_API FileInputSource : public InputSource
  5976. {
  5977. public:
  5978. FileInputSource (const File& file);
  5979. ~FileInputSource();
  5980. InputStream* createInputStream();
  5981. InputStream* createInputStreamFor (const String& relatedItemPath);
  5982. int64 hashCode() const;
  5983. juce_UseDebuggingNewOperator
  5984. private:
  5985. const File file;
  5986. FileInputSource (const FileInputSource&);
  5987. FileInputSource& operator= (const FileInputSource&);
  5988. };
  5989. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5990. /*** End of inlined file: juce_FileInputSource.h ***/
  5991. #endif
  5992. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5993. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5994. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5995. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5996. class GZIPCompressorHelper;
  5997. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5998. {
  5999. public:
  6000. GZIPCompressorOutputStream (OutputStream* destStream,
  6001. int compressionLevel = 0,
  6002. bool deleteDestStreamWhenDestroyed = false,
  6003. bool noWrap = false);
  6004. ~GZIPCompressorOutputStream();
  6005. void flush();
  6006. int64 getPosition();
  6007. bool setPosition (int64 newPosition);
  6008. bool write (const void* destBuffer, int howMany);
  6009. juce_UseDebuggingNewOperator
  6010. private:
  6011. OutputStream* const destStream;
  6012. ScopedPointer <OutputStream> streamToDelete;
  6013. HeapBlock <uint8> buffer;
  6014. ScopedPointer <GZIPCompressorHelper> helper;
  6015. bool doNextBlock();
  6016. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  6017. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  6018. };
  6019. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6020. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6021. #endif
  6022. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6023. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6024. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6025. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6026. class GZIPDecompressHelper;
  6027. class JUCE_API GZIPDecompressorInputStream : public InputStream
  6028. {
  6029. public:
  6030. GZIPDecompressorInputStream (InputStream* sourceStream,
  6031. bool deleteSourceWhenDestroyed,
  6032. bool noWrap = false,
  6033. int64 uncompressedStreamLength = -1);
  6034. ~GZIPDecompressorInputStream();
  6035. int64 getPosition();
  6036. bool setPosition (int64 pos);
  6037. int64 getTotalLength();
  6038. bool isExhausted();
  6039. int read (void* destBuffer, int maxBytesToRead);
  6040. juce_UseDebuggingNewOperator
  6041. private:
  6042. InputStream* const sourceStream;
  6043. ScopedPointer <InputStream> streamToDelete;
  6044. const int64 uncompressedStreamLength;
  6045. const bool noWrap;
  6046. bool isEof;
  6047. int activeBufferSize;
  6048. int64 originalSourcePos, currentPos;
  6049. HeapBlock <uint8> buffer;
  6050. ScopedPointer <GZIPDecompressHelper> helper;
  6051. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  6052. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  6053. };
  6054. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6055. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6056. #endif
  6057. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  6058. #endif
  6059. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  6060. #endif
  6061. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6062. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  6063. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6064. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6065. class JUCE_API MemoryInputStream : public InputStream
  6066. {
  6067. public:
  6068. MemoryInputStream (const void* sourceData,
  6069. size_t sourceDataSize,
  6070. bool keepInternalCopyOfData);
  6071. MemoryInputStream (const MemoryBlock& data,
  6072. bool keepInternalCopyOfData);
  6073. ~MemoryInputStream();
  6074. int64 getPosition();
  6075. bool setPosition (int64 pos);
  6076. int64 getTotalLength();
  6077. bool isExhausted();
  6078. int read (void* destBuffer, int maxBytesToRead);
  6079. juce_UseDebuggingNewOperator
  6080. private:
  6081. const char* data;
  6082. size_t dataSize, position;
  6083. MemoryBlock internalCopy;
  6084. MemoryInputStream (const MemoryInputStream&);
  6085. MemoryInputStream& operator= (const MemoryInputStream&);
  6086. };
  6087. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6088. /*** End of inlined file: juce_MemoryInputStream.h ***/
  6089. #endif
  6090. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6091. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  6092. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6093. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6094. class JUCE_API MemoryOutputStream : public OutputStream
  6095. {
  6096. public:
  6097. MemoryOutputStream (size_t initialSize = 256,
  6098. size_t granularity = 256,
  6099. MemoryBlock* memoryBlockToWriteTo = 0);
  6100. ~MemoryOutputStream();
  6101. const char* getData() const throw();
  6102. size_t getDataSize() const throw() { return size; }
  6103. void reset() throw();
  6104. const String toUTF8() const;
  6105. void flush();
  6106. bool write (const void* buffer, int howMany);
  6107. int64 getPosition() { return position; }
  6108. bool setPosition (int64 newPosition);
  6109. juce_UseDebuggingNewOperator
  6110. private:
  6111. MemoryBlock* data;
  6112. ScopedPointer <MemoryBlock> dataToDelete;
  6113. size_t position, size, blockSize;
  6114. MemoryOutputStream (const MemoryOutputStream&);
  6115. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6116. };
  6117. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6118. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6119. #endif
  6120. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6121. #endif
  6122. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6123. /*** Start of inlined file: juce_SubregionStream.h ***/
  6124. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6125. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6126. class JUCE_API SubregionStream : public InputStream
  6127. {
  6128. public:
  6129. SubregionStream (InputStream* sourceStream,
  6130. int64 startPositionInSourceStream,
  6131. int64 lengthOfSourceStream,
  6132. bool deleteSourceWhenDestroyed) throw();
  6133. ~SubregionStream() throw();
  6134. int64 getTotalLength();
  6135. int64 getPosition();
  6136. bool setPosition (int64 newPosition);
  6137. int read (void* destBuffer, int maxBytesToRead);
  6138. bool isExhausted();
  6139. juce_UseDebuggingNewOperator
  6140. private:
  6141. InputStream* const source;
  6142. ScopedPointer <InputStream> sourceToDelete;
  6143. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6144. SubregionStream (const SubregionStream&);
  6145. SubregionStream& operator= (const SubregionStream&);
  6146. };
  6147. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6148. /*** End of inlined file: juce_SubregionStream.h ***/
  6149. #endif
  6150. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6151. #endif
  6152. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6153. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6154. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6155. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6156. #define TRANS(stringLiteral) \
  6157. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6158. class JUCE_API LocalisedStrings
  6159. {
  6160. public:
  6161. LocalisedStrings (const String& fileContents);
  6162. LocalisedStrings (const File& fileToLoad);
  6163. ~LocalisedStrings();
  6164. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6165. static LocalisedStrings* getCurrentMappings();
  6166. static const String translateWithCurrentMappings (const String& text);
  6167. static const String translateWithCurrentMappings (const char* text);
  6168. const String translate (const String& text) const;
  6169. const String getLanguageName() const { return languageName; }
  6170. const StringArray getCountryCodes() const { return countryCodes; }
  6171. void setIgnoresCase (const bool shouldIgnoreCase);
  6172. juce_UseDebuggingNewOperator
  6173. private:
  6174. String languageName;
  6175. StringArray countryCodes;
  6176. StringPairArray translations;
  6177. void loadFromText (const String& fileContents);
  6178. };
  6179. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6180. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6181. #endif
  6182. #ifndef __JUCE_STRING_JUCEHEADER__
  6183. #endif
  6184. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6185. #endif
  6186. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6187. #endif
  6188. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6189. /*** Start of inlined file: juce_XmlDocument.h ***/
  6190. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6191. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6192. class JUCE_API XmlDocument
  6193. {
  6194. public:
  6195. XmlDocument (const String& documentText);
  6196. XmlDocument (const File& file);
  6197. ~XmlDocument();
  6198. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6199. const String& getLastParseError() const throw();
  6200. void setInputSource (InputSource* const newSource) throw();
  6201. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6202. juce_UseDebuggingNewOperator
  6203. private:
  6204. String originalText;
  6205. const juce_wchar* input;
  6206. bool outOfData, errorOccurred;
  6207. bool identifierLookupTable [128];
  6208. String lastError, dtdText;
  6209. StringArray tokenisedDTD;
  6210. bool needToLoadDTD, ignoreEmptyTextElements;
  6211. ScopedPointer <InputSource> inputSource;
  6212. void setLastError (const String& desc, const bool carryOn);
  6213. void skipHeader();
  6214. void skipNextWhiteSpace();
  6215. juce_wchar readNextChar() throw();
  6216. XmlElement* readNextElement (const bool alsoParseSubElements);
  6217. void readChildElements (XmlElement* parent);
  6218. int findNextTokenLength() throw();
  6219. void readQuotedString (String& result);
  6220. void readEntity (String& result);
  6221. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6222. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6223. const String getFileContents (const String& filename) const;
  6224. const String expandEntity (const String& entity);
  6225. const String expandExternalEntity (const String& entity);
  6226. const String getParameterEntity (const String& entity);
  6227. XmlDocument (const XmlDocument&);
  6228. XmlDocument& operator= (const XmlDocument&);
  6229. };
  6230. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6231. /*** End of inlined file: juce_XmlDocument.h ***/
  6232. #endif
  6233. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6234. #endif
  6235. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6236. #endif
  6237. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6238. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6239. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6240. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6241. class JUCE_API InterProcessLock
  6242. {
  6243. public:
  6244. explicit InterProcessLock (const String& name);
  6245. ~InterProcessLock();
  6246. bool enter (int timeOutMillisecs = -1);
  6247. void exit();
  6248. class ScopedLockType
  6249. {
  6250. public:
  6251. explicit ScopedLockType (InterProcessLock& lock) : lock_ (lock) { lockWasSuccessful = lock.enter(); }
  6252. inline ~ScopedLockType() { lock_.exit(); }
  6253. bool isLocked() const throw() { return lockWasSuccessful; }
  6254. private:
  6255. InterProcessLock& lock_;
  6256. bool lockWasSuccessful;
  6257. ScopedLockType (const ScopedLockType&);
  6258. ScopedLockType& operator= (const ScopedLockType&);
  6259. };
  6260. juce_UseDebuggingNewOperator
  6261. private:
  6262. class Pimpl;
  6263. friend class ScopedPointer <Pimpl>;
  6264. ScopedPointer <Pimpl> pimpl;
  6265. CriticalSection lock;
  6266. String name;
  6267. InterProcessLock (const InterProcessLock&);
  6268. InterProcessLock& operator= (const InterProcessLock&);
  6269. };
  6270. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6271. /*** End of inlined file: juce_InterProcessLock.h ***/
  6272. #endif
  6273. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6274. /*** Start of inlined file: juce_Process.h ***/
  6275. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6276. #define __JUCE_PROCESS_JUCEHEADER__
  6277. class JUCE_API Process
  6278. {
  6279. public:
  6280. enum ProcessPriority
  6281. {
  6282. LowPriority = 0,
  6283. NormalPriority = 1,
  6284. HighPriority = 2,
  6285. RealtimePriority = 3
  6286. };
  6287. static void setPriority (const ProcessPriority priority);
  6288. static void terminate();
  6289. static bool isForegroundProcess();
  6290. static void raisePrivilege();
  6291. static void lowerPrivilege();
  6292. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6293. private:
  6294. Process();
  6295. Process (const Process&);
  6296. Process& operator= (const Process&);
  6297. };
  6298. #endif // __JUCE_PROCESS_JUCEHEADER__
  6299. /*** End of inlined file: juce_Process.h ***/
  6300. #endif
  6301. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6302. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6303. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6304. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6305. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6306. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6307. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6308. class JUCE_API WaitableEvent
  6309. {
  6310. public:
  6311. WaitableEvent (bool manualReset = false) throw();
  6312. ~WaitableEvent() throw();
  6313. bool wait (int timeOutMilliseconds = -1) const throw();
  6314. void signal() const throw();
  6315. void reset() const throw();
  6316. juce_UseDebuggingNewOperator
  6317. private:
  6318. void* internal;
  6319. WaitableEvent (const WaitableEvent&);
  6320. WaitableEvent& operator= (const WaitableEvent&);
  6321. };
  6322. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6323. /*** End of inlined file: juce_WaitableEvent.h ***/
  6324. /*** Start of inlined file: juce_Thread.h ***/
  6325. #ifndef __JUCE_THREAD_JUCEHEADER__
  6326. #define __JUCE_THREAD_JUCEHEADER__
  6327. class JUCE_API Thread
  6328. {
  6329. public:
  6330. explicit Thread (const String& threadName);
  6331. virtual ~Thread();
  6332. virtual void run() = 0;
  6333. // Thread control functions..
  6334. void startThread();
  6335. void startThread (int priority);
  6336. void stopThread (int timeOutMilliseconds);
  6337. bool isThreadRunning() const;
  6338. void signalThreadShouldExit();
  6339. inline bool threadShouldExit() const { return threadShouldExit_; }
  6340. bool waitForThreadToExit (int timeOutMilliseconds) const;
  6341. bool setPriority (int priority);
  6342. static bool setCurrentThreadPriority (int priority);
  6343. void setAffinityMask (uint32 affinityMask);
  6344. static void setCurrentThreadAffinityMask (uint32 affinityMask);
  6345. // this can be called from any thread that needs to pause..
  6346. static void JUCE_CALLTYPE sleep (int milliseconds);
  6347. static void JUCE_CALLTYPE yield();
  6348. bool wait (int timeOutMilliseconds) const;
  6349. void notify() const;
  6350. typedef void* ThreadID;
  6351. static ThreadID getCurrentThreadId();
  6352. static Thread* getCurrentThread();
  6353. ThreadID getThreadId() const throw() { return threadId_; }
  6354. const String getThreadName() const { return threadName_; }
  6355. static int getNumRunningThreads();
  6356. static void stopAllThreads (int timeoutInMillisecs);
  6357. juce_UseDebuggingNewOperator
  6358. private:
  6359. const String threadName_;
  6360. void* volatile threadHandle_;
  6361. CriticalSection startStopLock;
  6362. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6363. int threadPriority_;
  6364. ThreadID threadId_;
  6365. uint32 affinityMask_;
  6366. bool volatile threadShouldExit_;
  6367. friend void JUCE_API juce_threadEntryPoint (void*);
  6368. static void threadEntryPoint (Thread* thread);
  6369. static Array<Thread*> runningThreads;
  6370. static CriticalSection runningThreadsLock;
  6371. Thread (const Thread&);
  6372. Thread& operator= (const Thread&);
  6373. };
  6374. #endif // __JUCE_THREAD_JUCEHEADER__
  6375. /*** End of inlined file: juce_Thread.h ***/
  6376. class JUCE_API ReadWriteLock
  6377. {
  6378. public:
  6379. ReadWriteLock() throw();
  6380. ~ReadWriteLock() throw();
  6381. void enterRead() const throw();
  6382. void exitRead() const throw();
  6383. void enterWrite() const throw();
  6384. bool tryEnterWrite() const throw();
  6385. void exitWrite() const throw();
  6386. juce_UseDebuggingNewOperator
  6387. private:
  6388. CriticalSection accessLock;
  6389. WaitableEvent waitEvent;
  6390. mutable int numWaitingWriters, numWriters;
  6391. mutable Thread::ThreadID writerThreadId;
  6392. mutable Array <Thread::ThreadID> readerThreads;
  6393. ReadWriteLock (const ReadWriteLock&);
  6394. ReadWriteLock& operator= (const ReadWriteLock&);
  6395. };
  6396. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6397. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6398. #endif
  6399. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6400. #endif
  6401. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6402. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6403. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6404. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6405. class JUCE_API ScopedReadLock
  6406. {
  6407. public:
  6408. inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6409. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6410. private:
  6411. const ReadWriteLock& lock_;
  6412. ScopedReadLock (const ScopedReadLock&);
  6413. ScopedReadLock& operator= (const ScopedReadLock&);
  6414. };
  6415. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6416. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6417. #endif
  6418. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6419. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6420. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6421. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6422. class JUCE_API ScopedTryLock
  6423. {
  6424. public:
  6425. inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6426. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6427. bool isLocked() const throw() { return lockWasSuccessful; }
  6428. private:
  6429. const CriticalSection& lock_;
  6430. const bool lockWasSuccessful;
  6431. ScopedTryLock (const ScopedTryLock&);
  6432. ScopedTryLock& operator= (const ScopedTryLock&);
  6433. };
  6434. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6435. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6436. #endif
  6437. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6438. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6439. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6440. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6441. class JUCE_API ScopedWriteLock
  6442. {
  6443. public:
  6444. inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6445. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6446. private:
  6447. const ReadWriteLock& lock_;
  6448. ScopedWriteLock (const ScopedWriteLock&);
  6449. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6450. };
  6451. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6452. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6453. #endif
  6454. #ifndef __JUCE_THREAD_JUCEHEADER__
  6455. #endif
  6456. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6457. /*** Start of inlined file: juce_ThreadPool.h ***/
  6458. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6459. #define __JUCE_THREADPOOL_JUCEHEADER__
  6460. class ThreadPool;
  6461. class ThreadPoolThread;
  6462. class JUCE_API ThreadPoolJob
  6463. {
  6464. public:
  6465. explicit ThreadPoolJob (const String& name);
  6466. virtual ~ThreadPoolJob();
  6467. const String getJobName() const;
  6468. void setJobName (const String& newName);
  6469. enum JobStatus
  6470. {
  6471. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6472. removed from the pool. */
  6473. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6474. should be automatically deleted by the pool. */
  6475. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6476. again when a thread is free. */
  6477. };
  6478. virtual JobStatus runJob() = 0;
  6479. bool isRunning() const { return isActive; }
  6480. bool shouldExit() const { return shouldStop; }
  6481. void signalJobShouldExit();
  6482. juce_UseDebuggingNewOperator
  6483. private:
  6484. friend class ThreadPool;
  6485. friend class ThreadPoolThread;
  6486. String jobName;
  6487. ThreadPool* pool;
  6488. bool shouldStop, isActive, shouldBeDeleted;
  6489. ThreadPoolJob (const ThreadPoolJob&);
  6490. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6491. };
  6492. class JUCE_API ThreadPool
  6493. {
  6494. public:
  6495. ThreadPool (int numberOfThreads,
  6496. bool startThreadsOnlyWhenNeeded = true,
  6497. int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6498. ~ThreadPool();
  6499. class JUCE_API JobSelector
  6500. {
  6501. public:
  6502. virtual ~JobSelector() {}
  6503. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6504. };
  6505. void addJob (ThreadPoolJob* job);
  6506. bool removeJob (ThreadPoolJob* job,
  6507. bool interruptIfRunning,
  6508. int timeOutMilliseconds);
  6509. bool removeAllJobs (bool interruptRunningJobs,
  6510. int timeOutMilliseconds,
  6511. bool deleteInactiveJobs = false,
  6512. JobSelector* selectedJobsToRemove = 0);
  6513. int getNumJobs() const;
  6514. ThreadPoolJob* getJob (int index) const;
  6515. bool contains (const ThreadPoolJob* job) const;
  6516. bool isJobRunning (const ThreadPoolJob* job) const;
  6517. bool waitForJobToFinish (const ThreadPoolJob* job,
  6518. int timeOutMilliseconds) const;
  6519. const StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const;
  6520. bool setThreadPriorities (int newPriority);
  6521. juce_UseDebuggingNewOperator
  6522. private:
  6523. const int threadStopTimeout;
  6524. int priority;
  6525. class ThreadPoolThread;
  6526. OwnedArray <ThreadPoolThread> threads;
  6527. Array <ThreadPoolJob*> jobs;
  6528. CriticalSection lock;
  6529. uint32 lastJobEndTime;
  6530. WaitableEvent jobFinishedSignal;
  6531. friend class ThreadPoolThread;
  6532. bool runNextJob();
  6533. ThreadPool (const ThreadPool&);
  6534. ThreadPool& operator= (const ThreadPool&);
  6535. };
  6536. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6537. /*** End of inlined file: juce_ThreadPool.h ***/
  6538. #endif
  6539. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6540. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6541. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6542. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6543. class JUCE_API TimeSliceClient
  6544. {
  6545. public:
  6546. virtual ~TimeSliceClient() {}
  6547. virtual bool useTimeSlice() = 0;
  6548. };
  6549. class JUCE_API TimeSliceThread : public Thread
  6550. {
  6551. public:
  6552. explicit TimeSliceThread (const String& threadName);
  6553. ~TimeSliceThread();
  6554. void addTimeSliceClient (TimeSliceClient* client);
  6555. void removeTimeSliceClient (TimeSliceClient* client);
  6556. int getNumClients() const;
  6557. TimeSliceClient* getClient (int index) const;
  6558. void run();
  6559. juce_UseDebuggingNewOperator
  6560. private:
  6561. CriticalSection callbackLock, listLock;
  6562. Array <TimeSliceClient*> clients;
  6563. int index;
  6564. TimeSliceClient* clientBeingCalled;
  6565. bool clientsChanged;
  6566. TimeSliceThread (const TimeSliceThread&);
  6567. TimeSliceThread& operator= (const TimeSliceThread&);
  6568. };
  6569. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6570. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6571. #endif
  6572. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6573. #endif
  6574. #endif
  6575. /*** End of inlined file: juce_core_includes.h ***/
  6576. // if you're compiling a command-line app, you might want to just include the core headers,
  6577. // so you can set this macro before including juce.h
  6578. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6579. /*** Start of inlined file: juce_app_includes.h ***/
  6580. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6581. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6582. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6583. /*** Start of inlined file: juce_Application.h ***/
  6584. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6585. #define __JUCE_APPLICATION_JUCEHEADER__
  6586. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6587. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6588. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6589. /*** Start of inlined file: juce_Component.h ***/
  6590. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6591. #define __JUCE_COMPONENT_JUCEHEADER__
  6592. /*** Start of inlined file: juce_MouseCursor.h ***/
  6593. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6594. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6595. class Image;
  6596. class ComponentPeer;
  6597. class Component;
  6598. class JUCE_API MouseCursor
  6599. {
  6600. public:
  6601. enum StandardCursorType
  6602. {
  6603. NoCursor = 0, /**< An invisible cursor. */
  6604. NormalCursor, /**< The stardard arrow cursor. */
  6605. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6606. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6607. CrosshairCursor, /**< A pair of crosshairs. */
  6608. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6609. that you're dragging a copy of something. */
  6610. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6611. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6612. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6613. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6614. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6615. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6616. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6617. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6618. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6619. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6620. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6621. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6622. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6623. };
  6624. MouseCursor();
  6625. MouseCursor (StandardCursorType type);
  6626. MouseCursor (const Image& image, int hotSpotX, int hotSpotY);
  6627. MouseCursor (const MouseCursor& other);
  6628. MouseCursor& operator= (const MouseCursor& other);
  6629. ~MouseCursor();
  6630. bool operator== (const MouseCursor& other) const throw();
  6631. bool operator!= (const MouseCursor& other) const throw();
  6632. static void showWaitCursor() throw();
  6633. static void hideWaitCursor() throw();
  6634. juce_UseDebuggingNewOperator
  6635. private:
  6636. class SharedCursorHandle;
  6637. SharedCursorHandle* cursorHandle;
  6638. friend class MouseInputSourceInternal;
  6639. void showInWindow (ComponentPeer* window) const;
  6640. void showInAllWindows() const;
  6641. void* getHandle() const throw();
  6642. };
  6643. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6644. /*** End of inlined file: juce_MouseCursor.h ***/
  6645. /*** Start of inlined file: juce_MouseListener.h ***/
  6646. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6647. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6648. class MouseEvent;
  6649. class JUCE_API MouseListener
  6650. {
  6651. public:
  6652. virtual ~MouseListener() {}
  6653. virtual void mouseMove (const MouseEvent& e);
  6654. virtual void mouseEnter (const MouseEvent& e);
  6655. virtual void mouseExit (const MouseEvent& e);
  6656. virtual void mouseDown (const MouseEvent& e);
  6657. virtual void mouseDrag (const MouseEvent& e);
  6658. virtual void mouseUp (const MouseEvent& e);
  6659. virtual void mouseDoubleClick (const MouseEvent& e);
  6660. virtual void mouseWheelMove (const MouseEvent& e,
  6661. float wheelIncrementX,
  6662. float wheelIncrementY);
  6663. };
  6664. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6665. /*** End of inlined file: juce_MouseListener.h ***/
  6666. /*** Start of inlined file: juce_MouseEvent.h ***/
  6667. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6668. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6669. class Component;
  6670. class MouseInputSource;
  6671. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6672. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6673. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6674. class JUCE_API ModifierKeys
  6675. {
  6676. public:
  6677. ModifierKeys (int flags = 0) throw();
  6678. ModifierKeys (const ModifierKeys& other) throw();
  6679. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6680. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6681. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6682. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6683. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6684. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6685. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6686. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6687. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6688. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6689. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6690. enum Flags
  6691. {
  6692. shiftModifier = 1,
  6693. ctrlModifier = 2,
  6694. altModifier = 4,
  6695. leftButtonModifier = 16,
  6696. rightButtonModifier = 32,
  6697. middleButtonModifier = 64,
  6698. #if JUCE_MAC
  6699. commandModifier = 8,
  6700. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6701. #else
  6702. commandModifier = ctrlModifier,
  6703. popupMenuClickModifier = rightButtonModifier,
  6704. #endif
  6705. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6706. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6707. };
  6708. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6709. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6710. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6711. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6712. inline int getRawFlags() const throw() { return flags; }
  6713. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6714. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6715. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6716. int getNumMouseButtonsDown() const throw();
  6717. static const ModifierKeys getCurrentModifiers() throw();
  6718. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6719. private:
  6720. int flags;
  6721. static ModifierKeys currentModifiers;
  6722. friend class ComponentPeer;
  6723. friend class MouseInputSource;
  6724. friend class MouseInputSourceInternal;
  6725. static void updateCurrentModifiers() throw();
  6726. };
  6727. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6728. /*** End of inlined file: juce_ModifierKeys.h ***/
  6729. /*** Start of inlined file: juce_Point.h ***/
  6730. #ifndef __JUCE_POINT_JUCEHEADER__
  6731. #define __JUCE_POINT_JUCEHEADER__
  6732. /*** Start of inlined file: juce_AffineTransform.h ***/
  6733. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6734. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6735. class JUCE_API AffineTransform
  6736. {
  6737. public:
  6738. AffineTransform() throw();
  6739. AffineTransform (const AffineTransform& other) throw();
  6740. AffineTransform (const float mat00, const float mat01, const float mat02,
  6741. const float mat10, const float mat11, const float mat12) throw();
  6742. AffineTransform& operator= (const AffineTransform& other) throw();
  6743. bool operator== (const AffineTransform& other) const throw();
  6744. bool operator!= (const AffineTransform& other) const throw();
  6745. static const AffineTransform identity;
  6746. void transformPoint (float& x,
  6747. float& y) const throw();
  6748. void transformPoint (double& x,
  6749. double& y) const throw();
  6750. const AffineTransform translated (const float deltaX,
  6751. const float deltaY) const throw();
  6752. static const AffineTransform translation (const float deltaX,
  6753. const float deltaY) throw();
  6754. const AffineTransform rotated (const float angleInRadians) const throw();
  6755. const AffineTransform rotated (const float angleInRadians,
  6756. const float pivotX,
  6757. const float pivotY) const throw();
  6758. static const AffineTransform rotation (const float angleInRadians) throw();
  6759. static const AffineTransform rotation (const float angleInRadians,
  6760. const float pivotX,
  6761. const float pivotY) throw();
  6762. const AffineTransform scaled (const float factorX,
  6763. const float factorY) const throw();
  6764. static const AffineTransform scale (const float factorX,
  6765. const float factorY) throw();
  6766. const AffineTransform sheared (const float shearX,
  6767. const float shearY) const throw();
  6768. const AffineTransform inverted() const throw();
  6769. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6770. bool isIdentity() const throw();
  6771. bool isSingularity() const throw();
  6772. bool isOnlyTranslation() const throw();
  6773. float getTranslationX() const throw() { return mat02; }
  6774. float getTranslationY() const throw() { return mat12; }
  6775. juce_UseDebuggingNewOperator
  6776. float mat00, mat01, mat02;
  6777. float mat10, mat11, mat12;
  6778. private:
  6779. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6780. const float mat10, const float mat11, const float mat12) const throw();
  6781. };
  6782. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6783. /*** End of inlined file: juce_AffineTransform.h ***/
  6784. template <typename ValueType>
  6785. class Point
  6786. {
  6787. public:
  6788. Point() throw() : x (0), y (0) {}
  6789. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6790. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6791. ~Point() throw() {}
  6792. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6793. inline ValueType getX() const throw() { return x; }
  6794. inline ValueType getY() const throw() { return y; }
  6795. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6796. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6797. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6798. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6799. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6800. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6801. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6802. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6803. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6804. const Point operator-() const throw() { return Point (-x, -y); }
  6805. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6806. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6807. const String toString() const { return String (x) + ", " + String (y); }
  6808. juce_UseDebuggingNewOperator
  6809. private:
  6810. ValueType x, y;
  6811. };
  6812. #endif // __JUCE_POINT_JUCEHEADER__
  6813. /*** End of inlined file: juce_Point.h ***/
  6814. class JUCE_API MouseEvent
  6815. {
  6816. public:
  6817. MouseEvent (MouseInputSource& source,
  6818. const Point<int>& position,
  6819. const ModifierKeys& modifiers,
  6820. Component* originator,
  6821. const Time& eventTime,
  6822. const Point<int> mouseDownPos,
  6823. const Time& mouseDownTime,
  6824. int numberOfClicks,
  6825. bool mouseWasDragged) throw();
  6826. ~MouseEvent() throw();
  6827. const int x;
  6828. const int y;
  6829. const ModifierKeys mods;
  6830. Component* const eventComponent;
  6831. Component* const originalComponent;
  6832. const Time eventTime;
  6833. MouseInputSource& source;
  6834. int getMouseDownX() const throw();
  6835. int getMouseDownY() const throw();
  6836. const Point<int> getMouseDownPosition() const throw();
  6837. int getDistanceFromDragStart() const throw();
  6838. int getDistanceFromDragStartX() const throw();
  6839. int getDistanceFromDragStartY() const throw();
  6840. const Point<int> getOffsetFromDragStart() const throw();
  6841. bool mouseWasClicked() const throw();
  6842. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6843. int getLengthOfMousePress() const throw();
  6844. const Point<int> getPosition() const throw();
  6845. int getScreenX() const;
  6846. int getScreenY() const;
  6847. const Point<int> getScreenPosition() const;
  6848. int getMouseDownScreenX() const;
  6849. int getMouseDownScreenY() const;
  6850. const Point<int> getMouseDownScreenPosition() const;
  6851. const MouseEvent getEventRelativeTo (Component* otherComponent) const throw();
  6852. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6853. static void setDoubleClickTimeout (int timeOutMilliseconds) throw();
  6854. static int getDoubleClickTimeout() throw();
  6855. juce_UseDebuggingNewOperator
  6856. private:
  6857. const Point<int> mouseDownPos;
  6858. const Time mouseDownTime;
  6859. const int numberOfClicks;
  6860. const bool wasMovedSinceMouseDown;
  6861. MouseEvent& operator= (const MouseEvent&);
  6862. };
  6863. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6864. /*** End of inlined file: juce_MouseEvent.h ***/
  6865. /*** Start of inlined file: juce_ComponentListener.h ***/
  6866. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6867. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6868. class Component;
  6869. class JUCE_API ComponentListener
  6870. {
  6871. public:
  6872. virtual ~ComponentListener() {}
  6873. virtual void componentMovedOrResized (Component& component,
  6874. bool wasMoved,
  6875. bool wasResized);
  6876. virtual void componentBroughtToFront (Component& component);
  6877. virtual void componentVisibilityChanged (Component& component);
  6878. virtual void componentChildrenChanged (Component& component);
  6879. virtual void componentParentHierarchyChanged (Component& component);
  6880. virtual void componentNameChanged (Component& component);
  6881. virtual void componentBeingDeleted (Component& component);
  6882. };
  6883. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6884. /*** End of inlined file: juce_ComponentListener.h ***/
  6885. /*** Start of inlined file: juce_KeyListener.h ***/
  6886. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6887. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6888. /*** Start of inlined file: juce_KeyPress.h ***/
  6889. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6890. #define __JUCE_KEYPRESS_JUCEHEADER__
  6891. class JUCE_API KeyPress
  6892. {
  6893. public:
  6894. KeyPress() throw();
  6895. KeyPress (int keyCode,
  6896. const ModifierKeys& modifiers,
  6897. juce_wchar textCharacter) throw();
  6898. KeyPress (int keyCode) throw();
  6899. KeyPress (const KeyPress& other) throw();
  6900. KeyPress& operator= (const KeyPress& other) throw();
  6901. bool operator== (const KeyPress& other) const throw();
  6902. bool operator!= (const KeyPress& other) const throw();
  6903. bool isValid() const throw() { return keyCode != 0; }
  6904. int getKeyCode() const throw() { return keyCode; }
  6905. const ModifierKeys getModifiers() const throw() { return mods; }
  6906. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6907. bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6908. static const KeyPress createFromDescription (const String& textVersion);
  6909. const String getTextDescription() const;
  6910. bool isCurrentlyDown() const;
  6911. static bool isKeyCurrentlyDown (int keyCode);
  6912. // Key codes
  6913. //
  6914. // Note that the actual values of these are platform-specific and may change
  6915. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6916. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6917. //
  6918. static const int spaceKey; /**< key-code for the space bar */
  6919. static const int escapeKey; /**< key-code for the escape key */
  6920. static const int returnKey; /**< key-code for the return key*/
  6921. static const int tabKey; /**< key-code for the tab key*/
  6922. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6923. static const int backspaceKey; /**< key-code for the backspace key */
  6924. static const int insertKey; /**< key-code for the insert key */
  6925. static const int upKey; /**< key-code for the cursor-up key */
  6926. static const int downKey; /**< key-code for the cursor-down key */
  6927. static const int leftKey; /**< key-code for the cursor-left key */
  6928. static const int rightKey; /**< key-code for the cursor-right key */
  6929. static const int pageUpKey; /**< key-code for the page-up key */
  6930. static const int pageDownKey; /**< key-code for the page-down key */
  6931. static const int homeKey; /**< key-code for the home key */
  6932. static const int endKey; /**< key-code for the end key */
  6933. static const int F1Key; /**< key-code for the F1 key */
  6934. static const int F2Key; /**< key-code for the F2 key */
  6935. static const int F3Key; /**< key-code for the F3 key */
  6936. static const int F4Key; /**< key-code for the F4 key */
  6937. static const int F5Key; /**< key-code for the F5 key */
  6938. static const int F6Key; /**< key-code for the F6 key */
  6939. static const int F7Key; /**< key-code for the F7 key */
  6940. static const int F8Key; /**< key-code for the F8 key */
  6941. static const int F9Key; /**< key-code for the F9 key */
  6942. static const int F10Key; /**< key-code for the F10 key */
  6943. static const int F11Key; /**< key-code for the F11 key */
  6944. static const int F12Key; /**< key-code for the F12 key */
  6945. static const int F13Key; /**< key-code for the F13 key */
  6946. static const int F14Key; /**< key-code for the F14 key */
  6947. static const int F15Key; /**< key-code for the F15 key */
  6948. static const int F16Key; /**< key-code for the F16 key */
  6949. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6950. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6951. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6952. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6953. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6954. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6955. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6956. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6957. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6958. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6959. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6960. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6961. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6962. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6963. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6964. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6965. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6966. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6967. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6968. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6969. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6970. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6971. juce_UseDebuggingNewOperator
  6972. private:
  6973. int keyCode;
  6974. ModifierKeys mods;
  6975. juce_wchar textCharacter;
  6976. };
  6977. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6978. /*** End of inlined file: juce_KeyPress.h ***/
  6979. class Component;
  6980. class JUCE_API KeyListener
  6981. {
  6982. public:
  6983. virtual ~KeyListener() {}
  6984. virtual bool keyPressed (const KeyPress& key,
  6985. Component* originatingComponent) = 0;
  6986. virtual bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  6987. };
  6988. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6989. /*** End of inlined file: juce_KeyListener.h ***/
  6990. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6991. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6992. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6993. class Component;
  6994. class JUCE_API KeyboardFocusTraverser
  6995. {
  6996. public:
  6997. KeyboardFocusTraverser();
  6998. virtual ~KeyboardFocusTraverser();
  6999. virtual Component* getNextComponent (Component* current);
  7000. virtual Component* getPreviousComponent (Component* current);
  7001. virtual Component* getDefaultComponent (Component* parentComponent);
  7002. };
  7003. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7004. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  7005. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  7006. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7007. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7008. /*** Start of inlined file: juce_Graphics.h ***/
  7009. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  7010. #define __JUCE_GRAPHICS_JUCEHEADER__
  7011. /*** Start of inlined file: juce_Font.h ***/
  7012. #ifndef __JUCE_FONT_JUCEHEADER__
  7013. #define __JUCE_FONT_JUCEHEADER__
  7014. /*** Start of inlined file: juce_Typeface.h ***/
  7015. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  7016. #define __JUCE_TYPEFACE_JUCEHEADER__
  7017. /*** Start of inlined file: juce_Path.h ***/
  7018. #ifndef __JUCE_PATH_JUCEHEADER__
  7019. #define __JUCE_PATH_JUCEHEADER__
  7020. /*** Start of inlined file: juce_Rectangle.h ***/
  7021. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  7022. #define __JUCE_RECTANGLE_JUCEHEADER__
  7023. class RectangleList;
  7024. template <typename ValueType>
  7025. class Rectangle
  7026. {
  7027. public:
  7028. Rectangle() throw()
  7029. : x (0), y (0), w (0), h (0)
  7030. {
  7031. }
  7032. Rectangle (const Rectangle& other) throw()
  7033. : x (other.x), y (other.y),
  7034. w (other.w), h (other.h)
  7035. {
  7036. }
  7037. Rectangle (const ValueType initialX, const ValueType initialY,
  7038. const ValueType width, const ValueType height) throw()
  7039. : x (initialX), y (initialY),
  7040. w (width), h (height)
  7041. {
  7042. }
  7043. Rectangle (const ValueType width, const ValueType height) throw()
  7044. : x (0), y (0), w (width), h (height)
  7045. {
  7046. }
  7047. Rectangle (const Point<ValueType>& corner1, const Point<ValueType>& corner2) throw()
  7048. : x (jmin (corner1.getX(), corner2.getX())),
  7049. y (jmin (corner1.getY(), corner2.getY())),
  7050. w (corner1.getX() - corner2.getX()),
  7051. h (corner1.getY() - corner2.getY())
  7052. {
  7053. if (w < 0) w = -w;
  7054. if (h < 0) h = -h;
  7055. }
  7056. Rectangle& operator= (const Rectangle& other) throw()
  7057. {
  7058. x = other.x; y = other.y;
  7059. w = other.w; h = other.h;
  7060. return *this;
  7061. }
  7062. ~Rectangle() throw() {}
  7063. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  7064. inline ValueType getX() const throw() { return x; }
  7065. inline ValueType getY() const throw() { return y; }
  7066. inline ValueType getWidth() const throw() { return w; }
  7067. inline ValueType getHeight() const throw() { return h; }
  7068. inline ValueType getRight() const throw() { return x + w; }
  7069. inline ValueType getBottom() const throw() { return y + h; }
  7070. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  7071. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  7072. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  7073. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  7074. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  7075. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  7076. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  7077. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  7078. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  7079. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  7080. void setBounds (const ValueType newX, const ValueType newY,
  7081. const ValueType newWidth, const ValueType newHeight) throw()
  7082. {
  7083. x = newX; y = newY; w = newWidth; h = newHeight;
  7084. }
  7085. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  7086. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  7087. void setLeft (const ValueType newLeft) throw()
  7088. {
  7089. w = jmax (ValueType(), x + w - newLeft);
  7090. x = newLeft;
  7091. }
  7092. void setTop (const ValueType newTop) throw()
  7093. {
  7094. h = jmax (ValueType(), y + h - newTop);
  7095. y = newTop;
  7096. }
  7097. void setRight (const ValueType newRight) throw()
  7098. {
  7099. x = jmin (x, newRight);
  7100. w = newRight - x;
  7101. }
  7102. void setBottom (const ValueType newBottom) throw()
  7103. {
  7104. y = jmin (y, newBottom);
  7105. h = newBottom - y;
  7106. }
  7107. void translate (const ValueType deltaX,
  7108. const ValueType deltaY) throw()
  7109. {
  7110. x += deltaX;
  7111. y += deltaY;
  7112. }
  7113. const Rectangle translated (const ValueType deltaX,
  7114. const ValueType deltaY) const throw()
  7115. {
  7116. return Rectangle (x + deltaX, y + deltaY, w, h);
  7117. }
  7118. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  7119. {
  7120. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  7121. }
  7122. const Rectangle operator- (const Point<ValueType>& deltaPosition) const throw()
  7123. {
  7124. return Rectangle (x - deltaPosition.getX(), y - deltaPosition.getY(), w, h);
  7125. }
  7126. void expand (const ValueType deltaX,
  7127. const ValueType deltaY) throw()
  7128. {
  7129. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7130. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7131. setBounds (x - deltaX, y - deltaY, nw, nh);
  7132. }
  7133. const Rectangle expanded (const ValueType deltaX,
  7134. const ValueType deltaY) const throw()
  7135. {
  7136. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7137. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7138. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7139. }
  7140. void reduce (const ValueType deltaX,
  7141. const ValueType deltaY) throw()
  7142. {
  7143. expand (-deltaX, -deltaY);
  7144. }
  7145. const Rectangle reduced (const ValueType deltaX,
  7146. const ValueType deltaY) const throw()
  7147. {
  7148. return expanded (-deltaX, -deltaY);
  7149. }
  7150. bool operator== (const Rectangle& other) const throw()
  7151. {
  7152. return x == other.x && y == other.y
  7153. && w == other.w && h == other.h;
  7154. }
  7155. bool operator!= (const Rectangle& other) const throw()
  7156. {
  7157. return x != other.x || y != other.y
  7158. || w != other.w || h != other.h;
  7159. }
  7160. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7161. {
  7162. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7163. }
  7164. bool contains (const Point<ValueType>& point) const throw()
  7165. {
  7166. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7167. }
  7168. bool contains (const Rectangle& other) const throw()
  7169. {
  7170. return x <= other.x && y <= other.y
  7171. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7172. }
  7173. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7174. {
  7175. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7176. jlimit (y, y + h, point.getY()));
  7177. }
  7178. bool intersects (const Rectangle& other) const throw()
  7179. {
  7180. return x + w > other.x
  7181. && y + h > other.y
  7182. && x < other.x + other.w
  7183. && y < other.y + other.h
  7184. && w > ValueType() && h > ValueType();
  7185. }
  7186. const Rectangle getIntersection (const Rectangle& other) const throw()
  7187. {
  7188. const ValueType nx = jmax (x, other.x);
  7189. const ValueType ny = jmax (y, other.y);
  7190. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7191. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7192. if (nw >= ValueType() && nh >= ValueType())
  7193. return Rectangle (nx, ny, nw, nh);
  7194. return Rectangle();
  7195. }
  7196. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7197. {
  7198. const int maxX = jmax (otherX, x);
  7199. otherW = jmin (otherX + otherW, x + w) - maxX;
  7200. if (otherW > 0)
  7201. {
  7202. const int maxY = jmax (otherY, y);
  7203. otherH = jmin (otherY + otherH, y + h) - maxY;
  7204. if (otherH > 0)
  7205. {
  7206. otherX = maxX; otherY = maxY;
  7207. return true;
  7208. }
  7209. }
  7210. return false;
  7211. }
  7212. const Rectangle getUnion (const Rectangle& other) const throw()
  7213. {
  7214. const ValueType newX = jmin (x, other.x);
  7215. const ValueType newY = jmin (y, other.y);
  7216. return Rectangle (newX, newY,
  7217. jmax (x + w, other.x + other.w) - newX,
  7218. jmax (y + h, other.y + other.h) - newY);
  7219. }
  7220. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7221. {
  7222. if (x == other.x && getRight() == other.getRight()
  7223. && (other.getBottom() >= y && other.y <= getBottom()))
  7224. {
  7225. const ValueType newY = jmin (y, other.y);
  7226. h = jmax (getBottom(), other.getBottom()) - newY;
  7227. y = newY;
  7228. return true;
  7229. }
  7230. else if (y == other.y && getBottom() == other.getBottom()
  7231. && (other.getRight() >= x && other.x <= getRight()))
  7232. {
  7233. const ValueType newX = jmin (x, other.x);
  7234. w = jmax (getRight(), other.getRight()) - newX;
  7235. x = newX;
  7236. return true;
  7237. }
  7238. return false;
  7239. }
  7240. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7241. {
  7242. int inside = 0;
  7243. const int otherR = other.getRight();
  7244. if (x >= other.x && x < otherR) inside = 1;
  7245. const int otherB = other.getBottom();
  7246. if (y >= other.y && y < otherB) inside |= 2;
  7247. const int r = x + w;
  7248. if (r >= other.x && r < otherR) inside |= 4;
  7249. const int b = y + h;
  7250. if (b >= other.y && b < otherB) inside |= 8;
  7251. switch (inside)
  7252. {
  7253. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7254. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7255. case 2 + 4 + 8: w = other.x - x; return true;
  7256. case 1 + 4 + 8: h = other.y - y; return true;
  7257. }
  7258. return false;
  7259. }
  7260. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7261. {
  7262. float x1 = x, y1 = y;
  7263. float x2 = x + w, y2 = y;
  7264. float x3 = x, y3 = y + h;
  7265. float x4 = x2, y4 = y3;
  7266. transform.transformPoint (x1, y1);
  7267. transform.transformPoint (x2, y2);
  7268. transform.transformPoint (x3, y3);
  7269. transform.transformPoint (x4, y4);
  7270. const float x = jmin (x1, x2, x3, x4);
  7271. const float y = jmin (y1, y2, y3, y4);
  7272. return Rectangle (x, y,
  7273. jmax (x1, x2, x3, x4) - x,
  7274. jmax (y1, y2, y3, y4) - y);
  7275. }
  7276. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7277. {
  7278. const int x1 = (int) floorf ((float) x);
  7279. const int y1 = (int) floorf ((float) y);
  7280. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7281. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7282. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7283. }
  7284. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7285. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7286. {
  7287. const ValueType x = jmax (x1, x2);
  7288. w1 = jmin (x1 + w1, x2 + w2) - x;
  7289. if (w1 > 0)
  7290. {
  7291. const ValueType y = jmax (y1, y2);
  7292. h1 = jmin (y1 + h1, y2 + h2) - y;
  7293. if (h1 > 0)
  7294. {
  7295. x1 = x; y1 = y;
  7296. return true;
  7297. }
  7298. }
  7299. return false;
  7300. }
  7301. const String toString() const
  7302. {
  7303. String s;
  7304. s.preallocateStorage (16);
  7305. s << x << ' ' << y << ' ' << w << ' ' << h;
  7306. return s;
  7307. }
  7308. static const Rectangle fromString (const String& stringVersion)
  7309. {
  7310. StringArray toks;
  7311. toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
  7312. return Rectangle (toks[0].trim().getIntValue(),
  7313. toks[1].trim().getIntValue(),
  7314. toks[2].trim().getIntValue(),
  7315. toks[3].trim().getIntValue());
  7316. }
  7317. juce_UseDebuggingNewOperator
  7318. private:
  7319. friend class RectangleList;
  7320. ValueType x, y, w, h;
  7321. };
  7322. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7323. /*** End of inlined file: juce_Rectangle.h ***/
  7324. /*** Start of inlined file: juce_Justification.h ***/
  7325. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7326. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7327. class JUCE_API Justification
  7328. {
  7329. public:
  7330. inline Justification (int flags_) throw() : flags (flags_) {}
  7331. Justification (const Justification& other) throw();
  7332. Justification& operator= (const Justification& other) throw();
  7333. inline int getFlags() const throw() { return flags; }
  7334. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7335. int getOnlyVerticalFlags() const throw();
  7336. int getOnlyHorizontalFlags() const throw();
  7337. void applyToRectangle (int& x, int& y, int w, int h,
  7338. int spaceX, int spaceY, int spaceW, int spaceH) const throw();
  7339. enum
  7340. {
  7341. left = 1,
  7342. right = 2,
  7343. horizontallyCentred = 4,
  7344. top = 8,
  7345. bottom = 16,
  7346. verticallyCentred = 32,
  7347. horizontallyJustified = 64,
  7348. centred = 36,
  7349. centredLeft = 33,
  7350. centredRight = 34,
  7351. centredTop = 12,
  7352. centredBottom = 20,
  7353. topLeft = 9,
  7354. topRight = 10,
  7355. bottomLeft = 17,
  7356. bottomRight = 18
  7357. };
  7358. private:
  7359. int flags;
  7360. };
  7361. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7362. /*** End of inlined file: juce_Justification.h ***/
  7363. /*** Start of inlined file: juce_EdgeTable.h ***/
  7364. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7365. #define __JUCE_EDGETABLE_JUCEHEADER__
  7366. class Path;
  7367. class RectangleList;
  7368. class Image;
  7369. class JUCE_API EdgeTable
  7370. {
  7371. public:
  7372. EdgeTable (const Rectangle<int>& clipLimits,
  7373. const Path& pathToAdd,
  7374. const AffineTransform& transform);
  7375. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7376. EdgeTable (const RectangleList& rectanglesToAdd);
  7377. EdgeTable (float x, float y, float w, float h);
  7378. EdgeTable (const EdgeTable& other);
  7379. EdgeTable& operator= (const EdgeTable& other);
  7380. ~EdgeTable();
  7381. void clipToRectangle (const Rectangle<int>& r) throw();
  7382. void excludeRectangle (const Rectangle<int>& r) throw();
  7383. void clipToEdgeTable (const EdgeTable& other);
  7384. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7385. bool isEmpty() throw();
  7386. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7387. void translate (float dx, int dy) throw();
  7388. void optimiseTable() throw();
  7389. template <class EdgeTableIterationCallback>
  7390. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7391. {
  7392. const int* lineStart = table;
  7393. for (int y = 0; y < bounds.getHeight(); ++y)
  7394. {
  7395. const int* line = lineStart;
  7396. lineStart += lineStrideElements;
  7397. int numPoints = line[0];
  7398. if (--numPoints > 0)
  7399. {
  7400. int x = *++line;
  7401. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7402. int levelAccumulator = 0;
  7403. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7404. while (--numPoints >= 0)
  7405. {
  7406. const int level = *++line;
  7407. jassert (((unsigned int) level) < (unsigned int) 256);
  7408. const int endX = *++line;
  7409. jassert (endX >= x);
  7410. const int endOfRun = (endX >> 8);
  7411. if (endOfRun == (x >> 8))
  7412. {
  7413. // small segment within the same pixel, so just save it for the next
  7414. // time round..
  7415. levelAccumulator += (endX - x) * level;
  7416. }
  7417. else
  7418. {
  7419. // plot the fist pixel of this segment, including any accumulated
  7420. // levels from smaller segments that haven't been drawn yet
  7421. levelAccumulator += (0xff - (x & 0xff)) * level;
  7422. levelAccumulator >>= 8;
  7423. x >>= 8;
  7424. if (levelAccumulator > 0)
  7425. {
  7426. if (levelAccumulator >> 8)
  7427. levelAccumulator = 0xff;
  7428. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7429. }
  7430. // if there's a run of similar pixels, do it all in one go..
  7431. if (level > 0)
  7432. {
  7433. jassert (endOfRun <= bounds.getRight());
  7434. const int numPix = endOfRun - ++x;
  7435. if (numPix > 0)
  7436. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7437. }
  7438. // save the bit at the end to be drawn next time round the loop.
  7439. levelAccumulator = (endX & 0xff) * level;
  7440. }
  7441. x = endX;
  7442. }
  7443. if (levelAccumulator > 0)
  7444. {
  7445. levelAccumulator >>= 8;
  7446. if (levelAccumulator >> 8)
  7447. levelAccumulator = 0xff;
  7448. x >>= 8;
  7449. jassert (x >= bounds.getX() && x < bounds.getRight());
  7450. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7451. }
  7452. }
  7453. }
  7454. }
  7455. juce_UseDebuggingNewOperator
  7456. private:
  7457. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7458. HeapBlock<int> table;
  7459. Rectangle<int> bounds;
  7460. int maxEdgesPerLine, lineStrideElements;
  7461. bool needToCheckEmptinesss;
  7462. void addEdgePoint (int x, int y, int winding) throw();
  7463. void remapTableForNumEdges (int newNumEdgesPerLine) throw();
  7464. void intersectWithEdgeTableLine (int y, const int* otherLine) throw();
  7465. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7466. void sanitiseLevels (bool useNonZeroWinding) throw();
  7467. static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw();
  7468. };
  7469. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7470. /*** End of inlined file: juce_EdgeTable.h ***/
  7471. class Image;
  7472. class JUCE_API Path
  7473. {
  7474. public:
  7475. Path();
  7476. Path (const Path& other);
  7477. ~Path();
  7478. Path& operator= (const Path& other);
  7479. bool isEmpty() const throw();
  7480. const Rectangle<float> getBounds() const throw();
  7481. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7482. bool contains (float x, float y,
  7483. float tolerence = 10.0f) const;
  7484. bool intersectsLine (float x1, float y1,
  7485. float x2, float y2,
  7486. float tolerence = 10.0f);
  7487. void clear() throw();
  7488. void startNewSubPath (float startX, float startY);
  7489. void closeSubPath();
  7490. void lineTo (float endX, float endY);
  7491. void quadraticTo (float controlPointX,
  7492. float controlPointY,
  7493. float endPointX,
  7494. float endPointY);
  7495. void cubicTo (float controlPoint1X,
  7496. float controlPoint1Y,
  7497. float controlPoint2X,
  7498. float controlPoint2Y,
  7499. float endPointX,
  7500. float endPointY);
  7501. const Point<float> getCurrentPosition() const;
  7502. void addRectangle (float x, float y, float width, float height);
  7503. void addRectangle (const Rectangle<int>& rectangle);
  7504. void addRoundedRectangle (float x, float y, float width, float height,
  7505. float cornerSize);
  7506. void addRoundedRectangle (float x, float y, float width, float height,
  7507. float cornerSizeX,
  7508. float cornerSizeY);
  7509. void addTriangle (float x1, float y1,
  7510. float x2, float y2,
  7511. float x3, float y3);
  7512. void addQuadrilateral (float x1, float y1,
  7513. float x2, float y2,
  7514. float x3, float y3,
  7515. float x4, float y4);
  7516. void addEllipse (float x, float y, float width, float height);
  7517. void addArc (float x, float y, float width, float height,
  7518. float fromRadians,
  7519. float toRadians,
  7520. bool startAsNewSubPath = false);
  7521. void addCentredArc (float centreX, float centreY,
  7522. float radiusX, float radiusY,
  7523. float rotationOfEllipse,
  7524. float fromRadians,
  7525. float toRadians,
  7526. bool startAsNewSubPath = false);
  7527. void addPieSegment (float x, float y,
  7528. float width, float height,
  7529. float fromRadians,
  7530. float toRadians,
  7531. float innerCircleProportionalSize);
  7532. void addLineSegment (float startX, float startY,
  7533. float endX, float endY,
  7534. float lineThickness);
  7535. void addArrow (float startX, float startY,
  7536. float endX, float endY,
  7537. float lineThickness,
  7538. float arrowheadWidth,
  7539. float arrowheadLength);
  7540. void addStar (float centreX,
  7541. float centreY,
  7542. int numberOfPoints,
  7543. float innerRadius,
  7544. float outerRadius,
  7545. float startAngle = 0.0f);
  7546. void addBubble (float bodyX, float bodyY,
  7547. float bodyW, float bodyH,
  7548. float cornerSize,
  7549. float arrowTipX,
  7550. float arrowTipY,
  7551. int whichSide,
  7552. float arrowPositionAlongEdgeProportional,
  7553. float arrowWidth);
  7554. void addPath (const Path& pathToAppend);
  7555. void addPath (const Path& pathToAppend,
  7556. const AffineTransform& transformToApply);
  7557. void swapWithPath (Path& other);
  7558. void applyTransform (const AffineTransform& transform) throw();
  7559. void scaleToFit (float x, float y, float width, float height,
  7560. bool preserveProportions) throw();
  7561. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7562. bool preserveProportions,
  7563. const Justification& justificationType = Justification::centred) const;
  7564. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7565. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7566. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7567. class JUCE_API Iterator
  7568. {
  7569. public:
  7570. Iterator (const Path& path);
  7571. ~Iterator();
  7572. bool next();
  7573. enum PathElementType
  7574. {
  7575. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7576. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7577. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7578. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7579. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7580. };
  7581. PathElementType elementType;
  7582. float x1, y1, x2, y2, x3, y3;
  7583. private:
  7584. const Path& path;
  7585. size_t index;
  7586. Iterator (const Iterator&);
  7587. Iterator& operator= (const Iterator&);
  7588. };
  7589. void loadPathFromStream (InputStream& source);
  7590. void loadPathFromData (const void* data, int numberOfBytes);
  7591. void writePathToStream (OutputStream& destination) const;
  7592. const String toString() const;
  7593. void restoreFromString (const String& stringVersion);
  7594. juce_UseDebuggingNewOperator
  7595. private:
  7596. friend class PathFlatteningIterator;
  7597. friend class Path::Iterator;
  7598. ArrayAllocationBase <float, DummyCriticalSection> data;
  7599. size_t numElements;
  7600. float pathXMin, pathXMax, pathYMin, pathYMax;
  7601. bool useNonZeroWinding;
  7602. static const float lineMarker;
  7603. static const float moveMarker;
  7604. static const float quadMarker;
  7605. static const float cubicMarker;
  7606. static const float closeSubPathMarker;
  7607. };
  7608. #endif // __JUCE_PATH_JUCEHEADER__
  7609. /*** End of inlined file: juce_Path.h ***/
  7610. class Font;
  7611. class JUCE_API Typeface : public ReferenceCountedObject
  7612. {
  7613. public:
  7614. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7615. const String getName() const throw() { return name; }
  7616. static const Ptr createSystemTypefaceFor (const Font& font);
  7617. virtual ~Typeface();
  7618. virtual float getAscent() const = 0;
  7619. virtual float getDescent() const = 0;
  7620. virtual float getStringWidth (const String& text) = 0;
  7621. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7622. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7623. juce_UseDebuggingNewOperator
  7624. protected:
  7625. String name;
  7626. explicit Typeface (const String& name) throw();
  7627. private:
  7628. Typeface (const Typeface&);
  7629. Typeface& operator= (const Typeface&);
  7630. };
  7631. class JUCE_API CustomTypeface : public Typeface
  7632. {
  7633. public:
  7634. CustomTypeface();
  7635. explicit CustomTypeface (InputStream& serialisedTypefaceStream);
  7636. ~CustomTypeface();
  7637. void clear();
  7638. void setCharacteristics (const String& name, float ascent,
  7639. bool isBold, bool isItalic,
  7640. juce_wchar defaultCharacter) throw();
  7641. void addGlyph (juce_wchar character, const Path& path, float width) throw();
  7642. void addKerningPair (juce_wchar char1, juce_wchar char2, float extraAmount) throw();
  7643. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7644. bool writeToStream (OutputStream& outputStream);
  7645. // The following methods implement the basic Typeface behaviour.
  7646. float getAscent() const;
  7647. float getDescent() const;
  7648. float getStringWidth (const String& text);
  7649. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7650. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7651. int getGlyphForCharacter (juce_wchar character);
  7652. juce_UseDebuggingNewOperator
  7653. protected:
  7654. juce_wchar defaultCharacter;
  7655. float ascent;
  7656. bool isBold, isItalic;
  7657. virtual bool loadGlyphIfPossible (juce_wchar characterNeeded);
  7658. private:
  7659. class GlyphInfo;
  7660. friend class OwnedArray<GlyphInfo>;
  7661. OwnedArray <GlyphInfo> glyphs;
  7662. short lookupTable [128];
  7663. CustomTypeface (const CustomTypeface&);
  7664. CustomTypeface& operator= (const CustomTypeface&);
  7665. GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) throw();
  7666. GlyphInfo* findGlyphSubstituting (juce_wchar character) throw();
  7667. };
  7668. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7669. /*** End of inlined file: juce_Typeface.h ***/
  7670. class LowLevelGraphicsContext;
  7671. class JUCE_API Font
  7672. {
  7673. public:
  7674. enum FontStyleFlags
  7675. {
  7676. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7677. bold = 1, /**< boldens the font. @see setStyleFlags */
  7678. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7679. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7680. };
  7681. Font (float fontHeight,
  7682. int styleFlags = plain) throw();
  7683. Font (const String& typefaceName,
  7684. float fontHeight,
  7685. int styleFlags) throw();
  7686. Font (const Font& other) throw();
  7687. Font (const Typeface::Ptr& typeface) throw();
  7688. Font() throw();
  7689. Font& operator= (const Font& other) throw();
  7690. bool operator== (const Font& other) const throw();
  7691. bool operator!= (const Font& other) const throw();
  7692. ~Font() throw();
  7693. void setTypefaceName (const String& faceName) throw();
  7694. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7695. static const String getDefaultSansSerifFontName() throw();
  7696. static const String getDefaultSerifFontName() throw();
  7697. static const String getDefaultMonospacedFontName() throw();
  7698. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
  7699. float getHeight() const throw() { return font->height; }
  7700. void setHeight (float newHeight) throw();
  7701. void setHeightWithoutChangingWidth (float newHeight) throw();
  7702. float getAscent() const throw();
  7703. float getDescent() const throw();
  7704. int getStyleFlags() const throw() { return font->styleFlags; }
  7705. void setStyleFlags (const int newFlags) throw();
  7706. void setBold (bool shouldBeBold) throw();
  7707. bool isBold() const throw();
  7708. void setItalic (bool shouldBeItalic) throw();
  7709. bool isItalic() const throw();
  7710. void setUnderline (bool shouldBeUnderlined) throw();
  7711. bool isUnderlined() const throw();
  7712. void setHorizontalScale (float scaleFactor) throw();
  7713. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7714. void setExtraKerningFactor (float extraKerning) throw();
  7715. float getExtraKerningFactor() const throw() { return font->kerning; }
  7716. void setSizeAndStyle (float newHeight,
  7717. int newStyleFlags,
  7718. float newHorizontalScale,
  7719. float newKerningAmount) throw();
  7720. int getStringWidth (const String& text) const throw();
  7721. float getStringWidthFloat (const String& text) const throw();
  7722. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7723. Typeface* getTypeface() const throw();
  7724. static void findFonts (Array<Font>& results) throw();
  7725. static const StringArray findAllTypefaceNames();
  7726. static const String getFallbackFontName() throw();
  7727. static void setFallbackFontName (const String& name) throw();
  7728. juce_UseDebuggingNewOperator
  7729. private:
  7730. friend class FontGlyphAlphaMap;
  7731. friend class TypefaceCache;
  7732. class SharedFontInternal : public ReferenceCountedObject
  7733. {
  7734. public:
  7735. SharedFontInternal (const String& typefaceName, float height, float horizontalScale,
  7736. float kerning, float ascent, int styleFlags,
  7737. Typeface* typeface) throw();
  7738. SharedFontInternal (const SharedFontInternal& other) throw();
  7739. String typefaceName;
  7740. float height, horizontalScale, kerning, ascent;
  7741. int styleFlags;
  7742. Typeface::Ptr typeface;
  7743. };
  7744. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7745. void dupeInternalIfShared() throw();
  7746. };
  7747. #endif // __JUCE_FONT_JUCEHEADER__
  7748. /*** End of inlined file: juce_Font.h ***/
  7749. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7750. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7751. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7752. class JUCE_API PathStrokeType
  7753. {
  7754. public:
  7755. enum JointStyle
  7756. {
  7757. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7758. Note that for angles that curve back on themselves, drawing a
  7759. mitre could require extending the point too far away from the
  7760. path, so a mitre limit is imposed and any corners that exceed it
  7761. are drawn as bevelled instead. */
  7762. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7763. beveled /**< Indicates that corners should be drawn with a line flattening their
  7764. outside edge. */
  7765. };
  7766. enum EndCapStyle
  7767. {
  7768. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7769. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7770. the thickness of the stroke. */
  7771. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7772. };
  7773. PathStrokeType (float strokeThickness,
  7774. JointStyle jointStyle = mitered,
  7775. EndCapStyle endStyle = butt) throw();
  7776. PathStrokeType (const PathStrokeType& other) throw();
  7777. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7778. ~PathStrokeType() throw();
  7779. void createStrokedPath (Path& destPath,
  7780. const Path& sourcePath,
  7781. const AffineTransform& transform = AffineTransform::identity,
  7782. float extraAccuracy = 1.0f) const;
  7783. void createDashedStroke (Path& destPath,
  7784. const Path& sourcePath,
  7785. const float* dashLengths,
  7786. int numDashLengths,
  7787. const AffineTransform& transform = AffineTransform::identity,
  7788. float extraAccuracy = 1.0f) const;
  7789. float getStrokeThickness() const throw() { return thickness; }
  7790. JointStyle getJointStyle() const throw() { return jointStyle; }
  7791. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7792. juce_UseDebuggingNewOperator
  7793. bool operator== (const PathStrokeType& other) const throw();
  7794. bool operator!= (const PathStrokeType& other) const throw();
  7795. private:
  7796. float thickness;
  7797. JointStyle jointStyle;
  7798. EndCapStyle endStyle;
  7799. };
  7800. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7801. /*** End of inlined file: juce_PathStrokeType.h ***/
  7802. /*** Start of inlined file: juce_Line.h ***/
  7803. #ifndef __JUCE_LINE_JUCEHEADER__
  7804. #define __JUCE_LINE_JUCEHEADER__
  7805. class JUCE_API Line
  7806. {
  7807. public:
  7808. Line() throw();
  7809. Line (const Line& other) throw();
  7810. Line (float startX,
  7811. float startY,
  7812. float endX,
  7813. float endY) throw();
  7814. Line (const Point<float>& start,
  7815. const Point<float>& end) throw();
  7816. Line& operator= (const Line& other) throw();
  7817. ~Line() throw();
  7818. inline float getStartX() const throw() { return startX; }
  7819. inline float getStartY() const throw() { return startY; }
  7820. inline float getEndX() const throw() { return endX; }
  7821. inline float getEndY() const throw() { return endY; }
  7822. const Point<float> getStart() const throw();
  7823. const Point<float> getEnd() const throw();
  7824. void setStart (float newStartX,
  7825. float newStartY) throw();
  7826. void setEnd (float newEndX,
  7827. float newEndY) throw();
  7828. void setStart (const Point<float>& newStart) throw();
  7829. void setEnd (const Point<float>& newEnd) throw();
  7830. void applyTransform (const AffineTransform& transform) throw();
  7831. float getLength() const throw();
  7832. bool isVertical() const throw();
  7833. bool isHorizontal() const throw();
  7834. float getAngle() const throw();
  7835. bool operator== (const Line& other) const throw();
  7836. bool operator!= (const Line& other) const throw();
  7837. bool intersects (const Line& line,
  7838. float& intersectionX,
  7839. float& intersectionY) const throw();
  7840. const Point<float> getPointAlongLine (float distanceFromStart) const throw();
  7841. const Point<float> getPointAlongLine (float distanceFromStart,
  7842. float perpendicularDistance) const throw();
  7843. const Point<float> getPointAlongLineProportionally (float proportionOfLength) const throw();
  7844. float getDistanceFromLine (float x, float y) const throw();
  7845. float findNearestPointTo (float x, float y) const throw();
  7846. bool isPointAbove (float x, float y) const throw();
  7847. const Line withShortenedStart (float distanceToShortenBy) const throw();
  7848. const Line withShortenedEnd (float distanceToShortenBy) const throw();
  7849. bool clipToPath (const Path& path, bool keepSectionOutsidePath) throw();
  7850. juce_UseDebuggingNewOperator
  7851. private:
  7852. float startX, startY, endX, endY;
  7853. };
  7854. #endif // __JUCE_LINE_JUCEHEADER__
  7855. /*** End of inlined file: juce_Line.h ***/
  7856. /*** Start of inlined file: juce_Colours.h ***/
  7857. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7858. #define __JUCE_COLOURS_JUCEHEADER__
  7859. /*** Start of inlined file: juce_Colour.h ***/
  7860. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7861. #define __JUCE_COLOUR_JUCEHEADER__
  7862. /*** Start of inlined file: juce_PixelFormats.h ***/
  7863. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7864. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7865. #if JUCE_MSVC
  7866. #pragma pack (push, 1)
  7867. #define PACKED
  7868. #elif JUCE_GCC
  7869. #define PACKED __attribute__((packed))
  7870. #else
  7871. #define PACKED
  7872. #endif
  7873. class PixelRGB;
  7874. class PixelAlpha;
  7875. class JUCE_API PixelARGB
  7876. {
  7877. public:
  7878. PixelARGB() throw() {}
  7879. ~PixelARGB() throw() {}
  7880. PixelARGB (const uint32 argb_) throw()
  7881. : argb (argb_)
  7882. {
  7883. }
  7884. forcedinline uint32 getARGB() const throw() { return argb; }
  7885. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7886. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7887. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7888. forcedinline uint8 getRed() const throw() { return components.r; }
  7889. forcedinline uint8 getGreen() const throw() { return components.g; }
  7890. forcedinline uint8 getBlue() const throw() { return components.b; }
  7891. forcedinline void blend (const PixelARGB& src) throw()
  7892. {
  7893. uint32 sargb = src.getARGB();
  7894. const uint32 alpha = 0x100 - (sargb >> 24);
  7895. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7896. sargb += 0xff00ff00 & (getAG() * alpha);
  7897. argb = sargb;
  7898. }
  7899. forcedinline void blend (const PixelAlpha& src) throw();
  7900. forcedinline void blend (const PixelRGB& src) throw();
  7901. template <class Pixel>
  7902. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7903. {
  7904. ++extraAlpha;
  7905. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7906. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7907. const uint32 alpha = 0x100 - (sargb >> 24);
  7908. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7909. sargb += 0xff00ff00 & (getAG() * alpha);
  7910. argb = sargb;
  7911. }
  7912. template <class Pixel>
  7913. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7914. {
  7915. uint32 drb = getRB();
  7916. drb += (((src.getRB() - drb) * amount) >> 8);
  7917. drb &= 0x00ff00ff;
  7918. uint32 dag = getAG();
  7919. dag += (((src.getAG() - dag) * amount) >> 8);
  7920. dag &= 0x00ff00ff;
  7921. dag <<= 8;
  7922. dag |= drb;
  7923. argb = dag;
  7924. }
  7925. template <class Pixel>
  7926. forcedinline void set (const Pixel& src) throw()
  7927. {
  7928. argb = src.getARGB();
  7929. }
  7930. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7931. {
  7932. components.a = newAlpha;
  7933. }
  7934. forcedinline void multiplyAlpha (int multiplier) throw()
  7935. {
  7936. ++multiplier;
  7937. argb = ((multiplier * getAG()) & 0xff00ff00)
  7938. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7939. }
  7940. forcedinline void multiplyAlpha (const float multiplier) throw()
  7941. {
  7942. multiplyAlpha ((int) (multiplier * 256.0f));
  7943. }
  7944. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7945. {
  7946. components.b = b;
  7947. components.g = g;
  7948. components.r = r;
  7949. components.a = a;
  7950. }
  7951. forcedinline void premultiply() throw()
  7952. {
  7953. const uint32 alpha = components.a;
  7954. if (alpha < 0xff)
  7955. {
  7956. if (alpha == 0)
  7957. {
  7958. components.b = 0;
  7959. components.g = 0;
  7960. components.r = 0;
  7961. }
  7962. else
  7963. {
  7964. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7965. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7966. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7967. }
  7968. }
  7969. }
  7970. forcedinline void unpremultiply() throw()
  7971. {
  7972. const uint32 alpha = components.a;
  7973. if (alpha < 0xff)
  7974. {
  7975. if (alpha == 0)
  7976. {
  7977. components.b = 0;
  7978. components.g = 0;
  7979. components.r = 0;
  7980. }
  7981. else
  7982. {
  7983. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7984. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7985. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7986. }
  7987. }
  7988. }
  7989. forcedinline void desaturate() throw()
  7990. {
  7991. if (components.a < 0xff && components.a > 0)
  7992. {
  7993. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7994. components.r = components.g = components.b
  7995. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7996. }
  7997. else
  7998. {
  7999. components.r = components.g = components.b
  8000. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  8001. }
  8002. }
  8003. #if JUCE_BIG_ENDIAN
  8004. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  8005. #else
  8006. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  8007. #endif
  8008. private:
  8009. union
  8010. {
  8011. uint32 argb;
  8012. struct
  8013. {
  8014. #if JUCE_BIG_ENDIAN
  8015. uint8 a : 8, r : 8, g : 8, b : 8;
  8016. #else
  8017. uint8 b, g, r, a;
  8018. #endif
  8019. } PACKED components;
  8020. };
  8021. } PACKED;
  8022. class JUCE_API PixelRGB
  8023. {
  8024. public:
  8025. PixelRGB() throw() {}
  8026. ~PixelRGB() throw() {}
  8027. PixelRGB (const uint32 argb) throw()
  8028. {
  8029. r = (uint8) (argb >> 16);
  8030. g = (uint8) (argb >> 8);
  8031. b = (uint8) (argb);
  8032. }
  8033. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  8034. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  8035. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  8036. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  8037. forcedinline uint8 getRed() const throw() { return r; }
  8038. forcedinline uint8 getGreen() const throw() { return g; }
  8039. forcedinline uint8 getBlue() const throw() { return b; }
  8040. forcedinline void blend (const PixelARGB& src) throw()
  8041. {
  8042. uint32 sargb = src.getARGB();
  8043. const uint32 alpha = 0x100 - (sargb >> 24);
  8044. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8045. sargb += 0x0000ff00 & (g * alpha);
  8046. r = (uint8) (sargb >> 16);
  8047. g = (uint8) (sargb >> 8);
  8048. b = (uint8) sargb;
  8049. }
  8050. forcedinline void blend (const PixelRGB& src) throw()
  8051. {
  8052. set (src);
  8053. }
  8054. forcedinline void blend (const PixelAlpha& src) throw();
  8055. template <class Pixel>
  8056. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8057. {
  8058. ++extraAlpha;
  8059. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  8060. const uint32 sag = extraAlpha * src.getAG();
  8061. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  8062. const uint32 alpha = 0x100 - (sargb >> 24);
  8063. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8064. sargb += 0x0000ff00 & (g * alpha);
  8065. b = (uint8) sargb;
  8066. g = (uint8) (sargb >> 8);
  8067. r = (uint8) (sargb >> 16);
  8068. }
  8069. template <class Pixel>
  8070. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8071. {
  8072. uint32 drb = getRB();
  8073. drb += (((src.getRB() - drb) * amount) >> 8);
  8074. uint32 dag = getAG();
  8075. dag += (((src.getAG() - dag) * amount) >> 8);
  8076. b = (uint8) drb;
  8077. g = (uint8) dag;
  8078. r = (uint8) (drb >> 16);
  8079. }
  8080. template <class Pixel>
  8081. forcedinline void set (const Pixel& src) throw()
  8082. {
  8083. b = src.getBlue();
  8084. g = src.getGreen();
  8085. r = src.getRed();
  8086. }
  8087. forcedinline void setAlpha (const uint8) throw() {}
  8088. forcedinline void multiplyAlpha (int) throw() {}
  8089. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  8090. {
  8091. r = r_;
  8092. g = g_;
  8093. b = b_;
  8094. }
  8095. forcedinline void premultiply() throw() {}
  8096. forcedinline void unpremultiply() throw() {}
  8097. forcedinline void desaturate() throw()
  8098. {
  8099. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  8100. }
  8101. #if JUCE_MAC
  8102. enum { indexR = 0, indexG = 1, indexB = 2 };
  8103. #else
  8104. enum { indexR = 2, indexG = 1, indexB = 0 };
  8105. #endif
  8106. private:
  8107. #if JUCE_MAC
  8108. uint8 r, g, b;
  8109. #else
  8110. uint8 b, g, r;
  8111. #endif
  8112. } PACKED;
  8113. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  8114. {
  8115. set (src);
  8116. }
  8117. class JUCE_API PixelAlpha
  8118. {
  8119. public:
  8120. PixelAlpha() throw() {}
  8121. ~PixelAlpha() throw() {}
  8122. PixelAlpha (const uint32 argb) throw()
  8123. {
  8124. a = (uint8) (argb >> 24);
  8125. }
  8126. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8127. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8128. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8129. forcedinline uint8 getAlpha() const throw() { return a; }
  8130. forcedinline uint8 getRed() const throw() { return 0; }
  8131. forcedinline uint8 getGreen() const throw() { return 0; }
  8132. forcedinline uint8 getBlue() const throw() { return 0; }
  8133. template <class Pixel>
  8134. forcedinline void blend (const Pixel& src) throw()
  8135. {
  8136. const int srcA = src.getAlpha();
  8137. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8138. }
  8139. template <class Pixel>
  8140. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8141. {
  8142. ++extraAlpha;
  8143. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8144. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8145. }
  8146. template <class Pixel>
  8147. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8148. {
  8149. a += ((src,getAlpha() - a) * amount) >> 8;
  8150. }
  8151. template <class Pixel>
  8152. forcedinline void set (const Pixel& src) throw()
  8153. {
  8154. a = src.getAlpha();
  8155. }
  8156. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8157. {
  8158. a = newAlpha;
  8159. }
  8160. forcedinline void multiplyAlpha (int multiplier) throw()
  8161. {
  8162. ++multiplier;
  8163. a = (uint8) ((a * multiplier) >> 8);
  8164. }
  8165. forcedinline void multiplyAlpha (const float multiplier) throw()
  8166. {
  8167. a = (uint8) (a * multiplier);
  8168. }
  8169. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8170. {
  8171. a = a_;
  8172. }
  8173. forcedinline void premultiply() throw()
  8174. {
  8175. }
  8176. forcedinline void unpremultiply() throw()
  8177. {
  8178. }
  8179. forcedinline void desaturate() throw()
  8180. {
  8181. }
  8182. enum { indexA = 0 };
  8183. private:
  8184. uint8 a : 8;
  8185. } PACKED;
  8186. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8187. {
  8188. blend (PixelARGB (src.getARGB()));
  8189. }
  8190. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8191. {
  8192. uint32 sargb = src.getARGB();
  8193. const uint32 alpha = 0x100 - (sargb >> 24);
  8194. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8195. sargb += 0xff00ff00 & (getAG() * alpha);
  8196. argb = sargb;
  8197. }
  8198. #if JUCE_MSVC
  8199. #pragma pack (pop)
  8200. #endif
  8201. #undef PACKED
  8202. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8203. /*** End of inlined file: juce_PixelFormats.h ***/
  8204. class JUCE_API Colour
  8205. {
  8206. public:
  8207. Colour() throw();
  8208. Colour (const Colour& other) throw();
  8209. explicit Colour (uint32 argb) throw();
  8210. Colour (uint8 red,
  8211. uint8 green,
  8212. uint8 blue) throw();
  8213. static const Colour fromRGB (uint8 red,
  8214. uint8 green,
  8215. uint8 blue) throw();
  8216. Colour (uint8 red,
  8217. uint8 green,
  8218. uint8 blue,
  8219. uint8 alpha) throw();
  8220. static const Colour fromRGBA (uint8 red,
  8221. uint8 green,
  8222. uint8 blue,
  8223. uint8 alpha) throw();
  8224. Colour (uint8 red,
  8225. uint8 green,
  8226. uint8 blue,
  8227. float alpha) throw();
  8228. static const Colour fromRGBAFloat (uint8 red,
  8229. uint8 green,
  8230. uint8 blue,
  8231. float alpha) throw();
  8232. Colour (float hue,
  8233. float saturation,
  8234. float brightness,
  8235. uint8 alpha) throw();
  8236. Colour (float hue,
  8237. float saturation,
  8238. float brightness,
  8239. float alpha) throw();
  8240. static const Colour fromHSV (float hue,
  8241. float saturation,
  8242. float brightness,
  8243. float alpha) throw();
  8244. ~Colour() throw();
  8245. Colour& operator= (const Colour& other) throw();
  8246. bool operator== (const Colour& other) const throw();
  8247. bool operator!= (const Colour& other) const throw();
  8248. uint8 getRed() const throw() { return argb.getRed(); }
  8249. uint8 getGreen() const throw() { return argb.getGreen(); }
  8250. uint8 getBlue() const throw() { return argb.getBlue(); }
  8251. float getFloatRed() const throw();
  8252. float getFloatGreen() const throw();
  8253. float getFloatBlue() const throw();
  8254. const PixelARGB getPixelARGB() const throw();
  8255. uint32 getARGB() const throw();
  8256. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8257. float getFloatAlpha() const throw();
  8258. bool isOpaque() const throw();
  8259. bool isTransparent() const throw();
  8260. const Colour withAlpha (uint8 newAlpha) const throw();
  8261. const Colour withAlpha (float newAlpha) const throw();
  8262. const Colour withMultipliedAlpha (float alphaMultiplier) const throw();
  8263. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8264. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8265. float getHue() const throw();
  8266. float getSaturation() const throw();
  8267. float getBrightness() const throw();
  8268. void getHSB (float& hue,
  8269. float& saturation,
  8270. float& brightness) const throw();
  8271. const Colour withHue (float newHue) const throw();
  8272. const Colour withSaturation (float newSaturation) const throw();
  8273. const Colour withBrightness (float newBrightness) const throw();
  8274. const Colour withRotatedHue (float amountToRotate) const throw();
  8275. const Colour withMultipliedSaturation (float multiplier) const throw();
  8276. const Colour withMultipliedBrightness (float amount) const throw();
  8277. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8278. const Colour darker (float amountDarker = 0.4f) const throw();
  8279. const Colour contrasting (float amount = 1.0f) const throw();
  8280. static const Colour contrasting (const Colour& colour1,
  8281. const Colour& colour2) throw();
  8282. static const Colour greyLevel (float brightness) throw();
  8283. const String toString() const;
  8284. static const Colour fromString (const String& encodedColourString);
  8285. const String toDisplayString (bool includeAlphaValue) const;
  8286. juce_UseDebuggingNewOperator
  8287. private:
  8288. PixelARGB argb;
  8289. };
  8290. #endif // __JUCE_COLOUR_JUCEHEADER__
  8291. /*** End of inlined file: juce_Colour.h ***/
  8292. class Colours
  8293. {
  8294. public:
  8295. static JUCE_API const Colour
  8296. transparentBlack, /**< ARGB = 0x00000000 */
  8297. transparentWhite, /**< ARGB = 0x00ffffff */
  8298. black, /**< ARGB = 0xff000000 */
  8299. white, /**< ARGB = 0xffffffff */
  8300. blue, /**< ARGB = 0xff0000ff */
  8301. grey, /**< ARGB = 0xff808080 */
  8302. green, /**< ARGB = 0xff008000 */
  8303. red, /**< ARGB = 0xffff0000 */
  8304. yellow, /**< ARGB = 0xffffff00 */
  8305. aliceblue, antiquewhite, aqua, aquamarine,
  8306. azure, beige, bisque, blanchedalmond,
  8307. blueviolet, brown, burlywood, cadetblue,
  8308. chartreuse, chocolate, coral, cornflowerblue,
  8309. cornsilk, crimson, cyan, darkblue,
  8310. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8311. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8312. darkorchid, darkred, darksalmon, darkseagreen,
  8313. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8314. deeppink, deepskyblue, dimgrey, dodgerblue,
  8315. firebrick, floralwhite, forestgreen, fuchsia,
  8316. gainsboro, gold, goldenrod, greenyellow,
  8317. honeydew, hotpink, indianred, indigo,
  8318. ivory, khaki, lavender, lavenderblush,
  8319. lemonchiffon, lightblue, lightcoral, lightcyan,
  8320. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8321. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8322. lightsteelblue, lightyellow, lime, limegreen,
  8323. linen, magenta, maroon, mediumaquamarine,
  8324. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8325. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8326. midnightblue, mintcream, mistyrose, navajowhite,
  8327. navy, oldlace, olive, olivedrab,
  8328. orange, orangered, orchid, palegoldenrod,
  8329. palegreen, paleturquoise, palevioletred, papayawhip,
  8330. peachpuff, peru, pink, plum,
  8331. powderblue, purple, rosybrown, royalblue,
  8332. saddlebrown, salmon, sandybrown, seagreen,
  8333. seashell, sienna, silver, skyblue,
  8334. slateblue, slategrey, snow, springgreen,
  8335. steelblue, tan, teal, thistle,
  8336. tomato, turquoise, violet, wheat,
  8337. whitesmoke, yellowgreen;
  8338. static JUCE_API const Colour findColourForName (const String& colourName,
  8339. const Colour& defaultColour);
  8340. private:
  8341. // this isn't a class you should ever instantiate - it's just here for the
  8342. // static values in it.
  8343. Colours();
  8344. Colours (const Colours&);
  8345. Colours& operator= (const Colours&);
  8346. };
  8347. #endif // __JUCE_COLOURS_JUCEHEADER__
  8348. /*** End of inlined file: juce_Colours.h ***/
  8349. /*** Start of inlined file: juce_FillType.h ***/
  8350. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8351. #define __JUCE_FILLTYPE_JUCEHEADER__
  8352. /*** Start of inlined file: juce_ColourGradient.h ***/
  8353. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8354. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8355. class JUCE_API ColourGradient
  8356. {
  8357. public:
  8358. ColourGradient (const Colour& colour1, float x1, float y1,
  8359. const Colour& colour2, float x2, float y2,
  8360. bool isRadial) throw();
  8361. ColourGradient() throw();
  8362. ~ColourGradient() throw();
  8363. void clearColours() throw();
  8364. void addColour (double proportionAlongGradient,
  8365. const Colour& colour) throw();
  8366. void multiplyOpacity (float multiplier) throw();
  8367. int getNumColours() const throw();
  8368. double getColourPosition (int index) const throw();
  8369. const Colour getColour (int index) const throw();
  8370. const Colour getColourAtPosition (float position) const throw();
  8371. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8372. bool isOpaque() const throw();
  8373. bool isInvisible() const throw();
  8374. float x1;
  8375. float y1;
  8376. float x2;
  8377. float y2;
  8378. bool isRadial;
  8379. juce_UseDebuggingNewOperator
  8380. private:
  8381. Array <uint32> colours;
  8382. };
  8383. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8384. /*** End of inlined file: juce_ColourGradient.h ***/
  8385. class Image;
  8386. class JUCE_API FillType
  8387. {
  8388. public:
  8389. FillType() throw();
  8390. FillType (const Colour& colour) throw();
  8391. FillType (const ColourGradient& gradient) throw();
  8392. FillType (const Image& image, const AffineTransform& transform) throw();
  8393. FillType (const FillType& other) throw();
  8394. FillType& operator= (const FillType& other) throw();
  8395. ~FillType() throw();
  8396. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8397. bool isGradient() const throw() { return gradient != 0; }
  8398. bool isTiledImage() const throw() { return image != 0; }
  8399. void setColour (const Colour& newColour) throw();
  8400. void setGradient (const ColourGradient& newGradient) throw();
  8401. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8402. void setOpacity (float newOpacity) throw();
  8403. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8404. Colour colour;
  8405. ScopedPointer <ColourGradient> gradient;
  8406. const Image* image;
  8407. AffineTransform transform;
  8408. juce_UseDebuggingNewOperator
  8409. };
  8410. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8411. /*** End of inlined file: juce_FillType.h ***/
  8412. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8413. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8414. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8415. class JUCE_API RectanglePlacement
  8416. {
  8417. public:
  8418. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8419. RectanglePlacement (const RectanglePlacement& other) throw();
  8420. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8421. enum
  8422. {
  8423. xLeft = 1,
  8424. xRight = 2,
  8425. xMid = 4,
  8426. yTop = 8,
  8427. yBottom = 16,
  8428. yMid = 32,
  8429. stretchToFit = 64,
  8430. fillDestination = 128,
  8431. onlyReduceInSize = 256,
  8432. onlyIncreaseInSize = 512,
  8433. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8434. centred = 4 + 32
  8435. };
  8436. inline int getFlags() const throw() { return flags; }
  8437. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8438. void applyTo (double& sourceX,
  8439. double& sourceY,
  8440. double& sourceW,
  8441. double& sourceH,
  8442. double destinationX,
  8443. double destinationY,
  8444. double destinationW,
  8445. double destinationH) const throw();
  8446. const AffineTransform getTransformToFit (float sourceX,
  8447. float sourceY,
  8448. float sourceW,
  8449. float sourceH,
  8450. float destinationX,
  8451. float destinationY,
  8452. float destinationW,
  8453. float destinationH) const throw();
  8454. private:
  8455. int flags;
  8456. };
  8457. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8458. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8459. class LowLevelGraphicsContext;
  8460. class Image;
  8461. class RectangleList;
  8462. class JUCE_API Graphics
  8463. {
  8464. public:
  8465. explicit Graphics (Image& imageToDrawOnto);
  8466. ~Graphics();
  8467. void setColour (const Colour& newColour);
  8468. void setOpacity (const float newOpacity);
  8469. void setGradientFill (const ColourGradient& gradient);
  8470. void setTiledImageFill (const Image& imageToUse,
  8471. int anchorX, int anchorY,
  8472. float opacity);
  8473. void setFillType (const FillType& newFill);
  8474. void setFont (const Font& newFont);
  8475. void setFont (float newFontHeight, int fontStyleFlags = Font::plain);
  8476. void drawSingleLineText (const String& text,
  8477. int startX, int baselineY) const;
  8478. void drawMultiLineText (const String& text,
  8479. int startX, int baselineY,
  8480. int maximumLineWidth) const;
  8481. void drawTextAsPath (const String& text,
  8482. const AffineTransform& transform) const;
  8483. void drawText (const String& text,
  8484. int x, int y, int width, int height,
  8485. const Justification& justificationType,
  8486. bool useEllipsesIfTooBig) const;
  8487. void drawFittedText (const String& text,
  8488. int x, int y, int width, int height,
  8489. const Justification& justificationFlags,
  8490. int maximumNumberOfLines,
  8491. float minimumHorizontalScale = 0.7f) const;
  8492. void fillAll() const;
  8493. void fillAll (const Colour& colourToUse) const;
  8494. void fillRect (int x, int y, int width, int height) const;
  8495. void fillRect (const Rectangle<int>& rectangle) const;
  8496. void fillRect (float x, float y, float width, float height) const;
  8497. void fillRoundedRectangle (float x, float y, float width, float height,
  8498. float cornerSize) const;
  8499. void fillRoundedRectangle (const Rectangle<float>& rectangle,
  8500. float cornerSize) const;
  8501. void fillCheckerBoard (int x, int y, int width, int height,
  8502. int checkWidth, int checkHeight,
  8503. const Colour& colour1, const Colour& colour2) const;
  8504. void drawRect (int x, int y, int width, int height,
  8505. int lineThickness = 1) const;
  8506. void drawRect (float x, float y, float width, float height,
  8507. float lineThickness = 1.0f) const;
  8508. void drawRect (const Rectangle<int>& rectangle,
  8509. int lineThickness = 1) const;
  8510. void drawRoundedRectangle (float x, float y, float width, float height,
  8511. float cornerSize, float lineThickness) const;
  8512. void drawRoundedRectangle (const Rectangle<float>& rectangle,
  8513. float cornerSize, float lineThickness) const;
  8514. void drawBevel (int x, int y, int width, int height,
  8515. int bevelThickness,
  8516. const Colour& topLeftColour = Colours::white,
  8517. const Colour& bottomRightColour = Colours::black,
  8518. bool useGradient = true,
  8519. bool sharpEdgeOnOutside = true) const;
  8520. void setPixel (int x, int y) const;
  8521. void fillEllipse (float x, float y, float width, float height) const;
  8522. void drawEllipse (float x, float y, float width, float height,
  8523. float lineThickness) const;
  8524. void drawLine (float startX, float startY, float endX, float endY) const;
  8525. void drawLine (float startX, float startY, float endX, float endY,
  8526. float lineThickness) const;
  8527. void drawLine (const Line& line) const;
  8528. void drawLine (const Line& line, float lineThickness) const;
  8529. void drawDashedLine (float startX, float startY,
  8530. float endX, float endY,
  8531. const float* dashLengths, int numDashLengths,
  8532. float lineThickness = 1.0f) const;
  8533. void drawVerticalLine (int x, float top, float bottom) const;
  8534. void drawHorizontalLine (int y, float left, float right) const;
  8535. void fillPath (const Path& path,
  8536. const AffineTransform& transform = AffineTransform::identity) const;
  8537. void strokePath (const Path& path,
  8538. const PathStrokeType& strokeType,
  8539. const AffineTransform& transform = AffineTransform::identity) const;
  8540. void drawArrow (float startX, float startY,
  8541. float endX, float endY,
  8542. float lineThickness,
  8543. float arrowheadWidth,
  8544. float arrowheadLength) const;
  8545. enum ResamplingQuality
  8546. {
  8547. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8548. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8549. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8550. };
  8551. void setImageResamplingQuality (const ResamplingQuality newQuality);
  8552. void drawImageAt (const Image* const imageToDraw, int topLeftX, int topLeftY,
  8553. bool fillAlphaChannelWithCurrentBrush = false) const;
  8554. void drawImage (const Image* const imageToDraw,
  8555. int destX, int destY, int destWidth, int destHeight,
  8556. int sourceX, int sourceY, int sourceWidth, int sourceHeight,
  8557. bool fillAlphaChannelWithCurrentBrush = false) const;
  8558. void drawImageTransformed (const Image* imageToDraw,
  8559. const Rectangle<int>& imageSubRegion,
  8560. const AffineTransform& transform,
  8561. bool fillAlphaChannelWithCurrentBrush = false) const;
  8562. void drawImageWithin (const Image* imageToDraw,
  8563. int destX, int destY, int destWidth, int destHeight,
  8564. const RectanglePlacement& placementWithinTarget,
  8565. bool fillAlphaChannelWithCurrentBrush = false) const;
  8566. const Rectangle<int> getClipBounds() const;
  8567. bool clipRegionIntersects (int x, int y, int width, int height) const;
  8568. bool reduceClipRegion (int x, int y, int width, int height);
  8569. bool reduceClipRegion (const RectangleList& clipRegion);
  8570. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity);
  8571. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8572. const AffineTransform& transform);
  8573. void excludeClipRegion (const Rectangle<int>& rectangleToExclude);
  8574. bool isClipEmpty() const;
  8575. void saveState();
  8576. void restoreState();
  8577. void setOrigin (int newOriginX, int newOriginY);
  8578. void resetToDefaultState();
  8579. bool isVectorDevice() const;
  8580. juce_UseDebuggingNewOperator
  8581. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8582. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8583. private:
  8584. LowLevelGraphicsContext* const context;
  8585. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8586. bool saveStatePending;
  8587. void saveStateIfPending();
  8588. Graphics (const Graphics&);
  8589. Graphics& operator= (const Graphics& other);
  8590. };
  8591. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8592. /*** End of inlined file: juce_Graphics.h ***/
  8593. class JUCE_API ImageEffectFilter
  8594. {
  8595. public:
  8596. virtual void applyEffect (Image& sourceImage,
  8597. Graphics& destContext) = 0;
  8598. virtual ~ImageEffectFilter() {}
  8599. };
  8600. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8601. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8602. /*** Start of inlined file: juce_RectangleList.h ***/
  8603. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8604. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8605. class JUCE_API RectangleList
  8606. {
  8607. public:
  8608. RectangleList() throw();
  8609. RectangleList (const RectangleList& other) throw();
  8610. RectangleList (const Rectangle<int>& rect) throw();
  8611. RectangleList& operator= (const RectangleList& other) throw();
  8612. ~RectangleList() throw();
  8613. bool isEmpty() const throw();
  8614. int getNumRectangles() const throw() { return rects.size(); }
  8615. const Rectangle<int> getRectangle (const int index) const throw();
  8616. void clear() throw();
  8617. void add (int x, int y, int width, int height) throw();
  8618. void add (const Rectangle<int>& rect) throw();
  8619. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8620. void add (const RectangleList& other) throw();
  8621. void subtract (const Rectangle<int>& rect) throw();
  8622. void subtract (const RectangleList& otherList) throw();
  8623. bool clipTo (const Rectangle<int>& rect) throw();
  8624. bool clipTo (const RectangleList& other) throw();
  8625. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8626. void swapWith (RectangleList& otherList) throw();
  8627. bool containsPoint (int x, int y) const throw();
  8628. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8629. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8630. bool intersects (const RectangleList& other) const throw();
  8631. const Rectangle<int> getBounds() const throw();
  8632. void consolidate() throw();
  8633. void offsetAll (int dx, int dy) throw();
  8634. const Path toPath() const throw();
  8635. class Iterator
  8636. {
  8637. public:
  8638. Iterator (const RectangleList& list) throw();
  8639. ~Iterator() throw();
  8640. bool next() throw();
  8641. const Rectangle<int>* getRectangle() const throw() { return current; }
  8642. juce_UseDebuggingNewOperator
  8643. private:
  8644. const Rectangle<int>* current;
  8645. const RectangleList& owner;
  8646. int index;
  8647. Iterator (const Iterator&);
  8648. Iterator& operator= (const Iterator&);
  8649. };
  8650. juce_UseDebuggingNewOperator
  8651. private:
  8652. friend class Iterator;
  8653. Array <Rectangle<int> > rects;
  8654. };
  8655. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8656. /*** End of inlined file: juce_RectangleList.h ***/
  8657. /*** Start of inlined file: juce_BorderSize.h ***/
  8658. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8659. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8660. class JUCE_API BorderSize
  8661. {
  8662. public:
  8663. BorderSize() throw();
  8664. BorderSize (const BorderSize& other) throw();
  8665. BorderSize (int topGap,
  8666. int leftGap,
  8667. int bottomGap,
  8668. int rightGap) throw();
  8669. explicit BorderSize (int allGaps) throw();
  8670. ~BorderSize() throw();
  8671. int getTop() const throw() { return top; }
  8672. int getLeft() const throw() { return left; }
  8673. int getBottom() const throw() { return bottom; }
  8674. int getRight() const throw() { return right; }
  8675. int getTopAndBottom() const throw() { return top + bottom; }
  8676. int getLeftAndRight() const throw() { return left + right; }
  8677. void setTop (int newTopGap) throw();
  8678. void setLeft (int newLeftGap) throw();
  8679. void setBottom (int newBottomGap) throw();
  8680. void setRight (int newRightGap) throw();
  8681. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8682. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8683. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8684. void addTo (Rectangle<int>& original) const throw();
  8685. bool operator== (const BorderSize& other) const throw();
  8686. bool operator!= (const BorderSize& other) const throw();
  8687. juce_UseDebuggingNewOperator
  8688. private:
  8689. int top, left, bottom, right;
  8690. };
  8691. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8692. /*** End of inlined file: juce_BorderSize.h ***/
  8693. class LookAndFeel;
  8694. class MouseInputSource;
  8695. class MouseInputSourceInternal;
  8696. class ComponentPeer;
  8697. class JUCE_API Component : public MouseListener,
  8698. protected MessageListener
  8699. {
  8700. public:
  8701. Component();
  8702. virtual ~Component();
  8703. explicit Component (const String& componentName);
  8704. const String& getName() const throw() { return componentName_; }
  8705. virtual void setName (const String& newName);
  8706. bool isValidComponent() const;
  8707. virtual void setVisible (bool shouldBeVisible);
  8708. bool isVisible() const throw() { return flags.visibleFlag; }
  8709. virtual void visibilityChanged();
  8710. bool isShowing() const;
  8711. void fadeOutComponent (int lengthOfFadeOutInMilliseconds,
  8712. int deltaXToMove = 0,
  8713. int deltaYToMove = 0,
  8714. float scaleFactorAtEnd = 1.0f);
  8715. virtual void addToDesktop (int windowStyleFlags,
  8716. void* nativeWindowToAttachTo = 0);
  8717. void removeFromDesktop();
  8718. bool isOnDesktop() const throw();
  8719. ComponentPeer* getPeer() const;
  8720. virtual void userTriedToCloseWindow();
  8721. virtual void minimisationStateChanged (bool isNowMinimised);
  8722. void toFront (bool shouldAlsoGainFocus);
  8723. void toBack();
  8724. void toBehind (Component* other);
  8725. void setAlwaysOnTop (bool shouldStayOnTop);
  8726. bool isAlwaysOnTop() const throw();
  8727. inline int getX() const throw() { return bounds_.getX(); }
  8728. inline int getY() const throw() { return bounds_.getY(); }
  8729. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8730. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8731. int getRight() const throw() { return bounds_.getRight(); }
  8732. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8733. int getBottom() const throw() { return bounds_.getBottom(); }
  8734. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8735. const Rectangle<int> getLocalBounds() const throw();
  8736. void getVisibleArea (RectangleList& result,
  8737. bool includeSiblings) const;
  8738. int getScreenX() const;
  8739. int getScreenY() const;
  8740. const Point<int> getScreenPosition() const;
  8741. const Rectangle<int> getScreenBounds() const;
  8742. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8743. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8744. const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
  8745. const Point<int>& positionRelativeToThis) const;
  8746. void setTopLeftPosition (int x, int y);
  8747. void setTopRightPosition (int x, int y);
  8748. void setSize (int newWidth, int newHeight);
  8749. void setBounds (int x, int y, int width, int height);
  8750. void setBounds (const Rectangle<int>& newBounds);
  8751. void setBoundsRelative (float proportionalX, float proportionalY,
  8752. float proportionalWidth, float proportionalHeight);
  8753. void setBoundsInset (const BorderSize& borders);
  8754. void setBoundsToFit (int x, int y, int width, int height,
  8755. const Justification& justification,
  8756. bool onlyReduceInSize);
  8757. void setCentrePosition (int x, int y);
  8758. void setCentreRelative (float x, float y);
  8759. void centreWithSize (int width, int height);
  8760. int proportionOfWidth (float proportion) const throw();
  8761. int proportionOfHeight (float proportion) const throw();
  8762. int getParentWidth() const throw();
  8763. int getParentHeight() const throw();
  8764. const Rectangle<int> getParentMonitorArea() const;
  8765. int getNumChildComponents() const throw();
  8766. Component* getChildComponent (int index) const throw();
  8767. int getIndexOfChildComponent (const Component* child) const throw();
  8768. void addChildComponent (Component* child, int zOrder = -1);
  8769. void addAndMakeVisible (Component* child, int zOrder = -1);
  8770. void removeChildComponent (Component* childToRemove);
  8771. Component* removeChildComponent (int childIndexToRemove);
  8772. void removeAllChildren();
  8773. void deleteAllChildren();
  8774. Component* getParentComponent() const throw() { return parentComponent_; }
  8775. template <class TargetClass>
  8776. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8777. {
  8778. (void) dummyParameter;
  8779. Component* p = parentComponent_;
  8780. while (p != 0)
  8781. {
  8782. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8783. if (target != 0)
  8784. return target;
  8785. p = p->parentComponent_;
  8786. }
  8787. return 0;
  8788. }
  8789. Component* getTopLevelComponent() const throw();
  8790. bool isParentOf (const Component* possibleChild) const throw();
  8791. virtual void parentHierarchyChanged();
  8792. virtual void childrenChanged();
  8793. virtual bool hitTest (int x, int y);
  8794. void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
  8795. bool allowClicksOnChildComponents) throw();
  8796. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8797. bool& allowsClicksOnChildComponents) const throw();
  8798. virtual bool contains (int x, int y);
  8799. bool reallyContains (int x, int y, bool returnTrueIfWithinAChild);
  8800. Component* getComponentAt (int x, int y);
  8801. Component* getComponentAt (const Point<int>& position);
  8802. void repaint();
  8803. void repaint (int x, int y, int width, int height);
  8804. void setBufferedToImage (bool shouldBeBuffered);
  8805. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8806. bool clipImageToComponentBounds = true);
  8807. void paintEntireComponent (Graphics& context);
  8808. void setComponentEffect (ImageEffectFilter* newEffect);
  8809. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8810. LookAndFeel& getLookAndFeel() const throw();
  8811. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  8812. virtual void lookAndFeelChanged();
  8813. void sendLookAndFeelChange();
  8814. void setOpaque (bool shouldBeOpaque);
  8815. bool isOpaque() const throw();
  8816. void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) throw();
  8817. bool isBroughtToFrontOnMouseClick() const throw();
  8818. // Keyboard focus methods
  8819. void setWantsKeyboardFocus (bool wantsFocus) throw();
  8820. bool getWantsKeyboardFocus() const throw();
  8821. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8822. bool getMouseClickGrabsKeyboardFocus() const throw();
  8823. void grabKeyboardFocus();
  8824. bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
  8825. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8826. void moveKeyboardFocusToSibling (bool moveToNext);
  8827. virtual KeyboardFocusTraverser* createFocusTraverser();
  8828. int getExplicitFocusOrder() const;
  8829. void setExplicitFocusOrder (int newFocusOrderIndex);
  8830. void setFocusContainer (bool shouldBeFocusContainer) throw();
  8831. bool isFocusContainer() const throw();
  8832. bool isEnabled() const throw();
  8833. void setEnabled (bool shouldBeEnabled);
  8834. virtual void enablementChanged();
  8835. void setMouseCursor (const MouseCursor& cursorType);
  8836. virtual const MouseCursor getMouseCursor();
  8837. void updateMouseCursor() const;
  8838. virtual void paint (Graphics& g);
  8839. virtual void paintOverChildren (Graphics& g);
  8840. virtual void mouseMove (const MouseEvent& e);
  8841. virtual void mouseEnter (const MouseEvent& e);
  8842. virtual void mouseExit (const MouseEvent& e);
  8843. virtual void mouseDown (const MouseEvent& e);
  8844. virtual void mouseDrag (const MouseEvent& e);
  8845. virtual void mouseUp (const MouseEvent& e);
  8846. virtual void mouseDoubleClick (const MouseEvent& e);
  8847. virtual void mouseWheelMove (const MouseEvent& e,
  8848. float wheelIncrementX,
  8849. float wheelIncrementY);
  8850. static void beginDragAutoRepeat (int millisecondIntervalBetweenCallbacks);
  8851. void setRepaintsOnMouseActivity (bool shouldRepaint) throw();
  8852. void addMouseListener (MouseListener* newListener,
  8853. bool wantsEventsForAllNestedChildComponents);
  8854. void removeMouseListener (MouseListener* listenerToRemove);
  8855. void addKeyListener (KeyListener* newListener);
  8856. void removeKeyListener (KeyListener* listenerToRemove);
  8857. virtual bool keyPressed (const KeyPress& key);
  8858. virtual bool keyStateChanged (bool isKeyDown);
  8859. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8860. enum FocusChangeType
  8861. {
  8862. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8863. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8864. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8865. };
  8866. virtual void focusGained (FocusChangeType cause);
  8867. virtual void focusLost (FocusChangeType cause);
  8868. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8869. bool isMouseOver() const throw();
  8870. bool isMouseButtonDown() const throw();
  8871. bool isMouseOverOrDragging() const throw();
  8872. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8873. const Point<int> getMouseXYRelative() const;
  8874. virtual void resized();
  8875. virtual void moved();
  8876. virtual void childBoundsChanged (Component* child);
  8877. virtual void parentSizeChanged();
  8878. virtual void broughtToFront();
  8879. void addComponentListener (ComponentListener* newListener);
  8880. void removeComponentListener (ComponentListener* listenerToRemove);
  8881. void postCommandMessage (int commandId);
  8882. virtual void handleCommandMessage (int commandId);
  8883. int runModalLoop();
  8884. void enterModalState (bool takeKeyboardFocus = true);
  8885. void exitModalState (int returnValue);
  8886. bool isCurrentlyModal() const throw();
  8887. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8888. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8889. bool isCurrentlyBlockedByAnotherModalComponent() const;
  8890. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8891. virtual void inputAttemptWhenModal();
  8892. NamedValueSet& getProperties() throw() { return properties; }
  8893. const NamedValueSet& getProperties() const throw() { return properties; }
  8894. const Colour findColour (int colourId, bool inheritFromParent = false) const;
  8895. void setColour (int colourId, const Colour& colour);
  8896. void removeColour (int colourId);
  8897. bool isColourSpecified (int colourId) const;
  8898. void copyAllExplicitColoursTo (Component& target) const;
  8899. virtual void colourChanged();
  8900. void* getWindowHandle() const;
  8901. uint32 getComponentUID() const throw() { return componentUID; }
  8902. template <class ComponentType>
  8903. class SafePointer : private ComponentListener
  8904. {
  8905. public:
  8906. SafePointer() : comp (0) {}
  8907. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8908. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8909. ~SafePointer() { detach(); }
  8910. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8911. SafePointer& operator= (ComponentType* const newComponent)
  8912. {
  8913. detach();
  8914. comp = newComponent;
  8915. attach();
  8916. return *this;
  8917. }
  8918. operator ComponentType*() const throw() { return comp; }
  8919. ComponentType* getComponent() const throw() { return comp; }
  8920. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8921. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8922. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8923. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8924. juce_UseDebuggingNewOperator
  8925. private:
  8926. ComponentType* comp;
  8927. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8928. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8929. void componentBeingDeleted (Component&) { comp = 0; }
  8930. };
  8931. class BailOutChecker
  8932. {
  8933. public:
  8934. BailOutChecker (Component* component1,
  8935. Component* component2 = 0);
  8936. bool shouldBailOut() const throw();
  8937. private:
  8938. typedef SafePointer<Component> SafeComponentPtr;
  8939. SafeComponentPtr safePointer1, safePointer2;
  8940. Component* const component2;
  8941. BailOutChecker (const BailOutChecker&);
  8942. BailOutChecker& operator= (const BailOutChecker&);
  8943. };
  8944. juce_UseDebuggingNewOperator
  8945. private:
  8946. friend class ComponentPeer;
  8947. friend class InternalDragRepeater;
  8948. friend class MouseInputSource;
  8949. friend class MouseInputSourceInternal;
  8950. static Component* currentlyFocusedComponent;
  8951. String componentName_;
  8952. Component* parentComponent_;
  8953. uint32 componentUID;
  8954. Rectangle<int> bounds_;
  8955. int numDeepMouseListeners;
  8956. Array <Component*> childComponentList_;
  8957. LookAndFeel* lookAndFeel_;
  8958. MouseCursor cursor_;
  8959. ImageEffectFilter* effect_;
  8960. Image* bufferedImage_;
  8961. Array <MouseListener*>* mouseListeners_;
  8962. VoidArray* keyListeners_;
  8963. ListenerList <ComponentListener> componentListeners;
  8964. NamedValueSet properties;
  8965. struct ComponentFlags
  8966. {
  8967. bool hasHeavyweightPeerFlag : 1;
  8968. bool visibleFlag : 1;
  8969. bool opaqueFlag : 1;
  8970. bool ignoresMouseClicksFlag : 1;
  8971. bool allowChildMouseClicksFlag : 1;
  8972. bool wantsFocusFlag : 1;
  8973. bool isFocusContainerFlag : 1;
  8974. bool dontFocusOnMouseClickFlag : 1;
  8975. bool alwaysOnTopFlag : 1;
  8976. bool bufferToImageFlag : 1;
  8977. bool bringToFrontOnClickFlag : 1;
  8978. bool repaintOnMouseActivityFlag : 1;
  8979. bool draggingFlag : 1;
  8980. bool mouseOverFlag : 1;
  8981. bool mouseInsideFlag : 1;
  8982. bool currentlyModalFlag : 1;
  8983. bool isDisabledFlag : 1;
  8984. bool childCompFocusedFlag : 1;
  8985. #ifdef JUCE_DEBUG
  8986. bool isInsidePaintCall : 1;
  8987. #endif
  8988. };
  8989. union
  8990. {
  8991. uint32 componentFlags_;
  8992. ComponentFlags flags;
  8993. };
  8994. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8995. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8996. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8997. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8998. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8999. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9000. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, float amountX, float amountY);
  9001. void internalBroughtToFront();
  9002. void internalFocusGain (const FocusChangeType cause);
  9003. void internalFocusLoss (const FocusChangeType cause);
  9004. void internalChildFocusChange (FocusChangeType cause);
  9005. void internalModalInputAttempt();
  9006. void internalModifierKeysChanged();
  9007. void internalChildrenChanged();
  9008. void internalHierarchyChanged();
  9009. void renderComponent (Graphics& context);
  9010. void sendMovedResizedMessages (bool wasMoved, bool wasResized);
  9011. void repaintParent();
  9012. void sendFakeMouseMove() const;
  9013. void takeKeyboardFocus (const FocusChangeType cause);
  9014. void grabFocusInternal (const FocusChangeType cause, bool canTryParent = true);
  9015. static void giveAwayFocus();
  9016. void sendEnablementChangeMessage();
  9017. static void* runModalLoopCallback (void*);
  9018. static void bringModalComponentToFront();
  9019. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  9020. const Rectangle<int>& clipRect,
  9021. const Component* const compToAvoid) const;
  9022. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  9023. int deltaX, int deltaY) const;
  9024. // how much of the component is not off the edges of its parents
  9025. const Rectangle<int> getUnclippedArea() const;
  9026. void sendVisibilityChangeMessage();
  9027. // This is included here just to cause a compile error if your code is still handling
  9028. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  9029. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  9030. // implement its methods instead of this Component method).
  9031. virtual void filesDropped (const StringArray&, int, int) {}
  9032. // components aren't allowed to have copy constructors, as this would mess up parent
  9033. // hierarchies. You might need to give your subclasses a private dummy constructor like
  9034. // this one to avoid compiler warnings.
  9035. Component (const Component&);
  9036. Component& operator= (const Component&);
  9037. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  9038. // subclass to use the new parameters to keyStateChanged)
  9039. virtual void keyStateChanged() {};
  9040. protected:
  9041. virtual void internalRepaint (int x, int y, int w, int h);
  9042. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  9043. void handleMessage (const Message&);
  9044. };
  9045. #endif // __JUCE_COMPONENT_JUCEHEADER__
  9046. /*** End of inlined file: juce_Component.h ***/
  9047. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  9048. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9049. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9050. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9051. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9052. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9053. typedef int CommandID;
  9054. namespace StandardApplicationCommandIDs
  9055. {
  9056. static const CommandID quit = 0x1001;
  9057. static const CommandID del = 0x1002;
  9058. static const CommandID cut = 0x1003;
  9059. static const CommandID copy = 0x1004;
  9060. static const CommandID paste = 0x1005;
  9061. static const CommandID selectAll = 0x1006;
  9062. static const CommandID deselectAll = 0x1007;
  9063. }
  9064. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9065. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9066. struct JUCE_API ApplicationCommandInfo
  9067. {
  9068. explicit ApplicationCommandInfo (CommandID commandID) throw();
  9069. void setInfo (const String& shortName,
  9070. const String& description,
  9071. const String& categoryName,
  9072. int flags) throw();
  9073. void setActive (bool isActive) throw();
  9074. void setTicked (bool isTicked) throw();
  9075. void addDefaultKeypress (int keyCode,
  9076. const ModifierKeys& modifiers) throw();
  9077. CommandID commandID;
  9078. String shortName;
  9079. String description;
  9080. String categoryName;
  9081. Array <KeyPress> defaultKeypresses;
  9082. enum CommandFlags
  9083. {
  9084. isDisabled = 1 << 0,
  9085. isTicked = 1 << 1,
  9086. wantsKeyUpDownCallbacks = 1 << 2,
  9087. hiddenFromKeyEditor = 1 << 3,
  9088. readOnlyInKeyEditor = 1 << 4,
  9089. dontTriggerVisualFeedback = 1 << 5
  9090. };
  9091. int flags;
  9092. };
  9093. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9094. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9095. class JUCE_API ApplicationCommandTarget
  9096. {
  9097. public:
  9098. ApplicationCommandTarget();
  9099. virtual ~ApplicationCommandTarget();
  9100. struct JUCE_API InvocationInfo
  9101. {
  9102. InvocationInfo (const CommandID commandID) throw();
  9103. CommandID commandID;
  9104. int commandFlags;
  9105. enum InvocationMethod
  9106. {
  9107. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9108. fromKeyPress, /**< The command is being invoked by a key-press. */
  9109. fromMenu, /**< The command is being invoked by a menu selection. */
  9110. fromButton /**< The command is being invoked by a button click. */
  9111. };
  9112. InvocationMethod invocationMethod;
  9113. Component* originatingComponent;
  9114. KeyPress keyPress;
  9115. bool isKeyDown;
  9116. int millisecsSinceKeyPressed;
  9117. };
  9118. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9119. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9120. virtual void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) = 0;
  9121. virtual bool perform (const InvocationInfo& info) = 0;
  9122. bool invoke (const InvocationInfo& invocationInfo,
  9123. const bool asynchronously);
  9124. bool invokeDirectly (const CommandID commandID,
  9125. const bool asynchronously);
  9126. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9127. bool isCommandActive (const CommandID commandID);
  9128. ApplicationCommandTarget* findFirstTargetParentComponent();
  9129. juce_UseDebuggingNewOperator
  9130. private:
  9131. // (for async invocation of commands)
  9132. class CommandTargetMessageInvoker : public MessageListener
  9133. {
  9134. public:
  9135. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9136. ~CommandTargetMessageInvoker();
  9137. void handleMessage (const Message& message);
  9138. private:
  9139. ApplicationCommandTarget* const owner;
  9140. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9141. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9142. };
  9143. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9144. friend class CommandTargetMessageInvoker;
  9145. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9146. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9147. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9148. };
  9149. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9150. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9151. /*** Start of inlined file: juce_ActionListener.h ***/
  9152. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9153. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9154. class JUCE_API ActionListener
  9155. {
  9156. public:
  9157. virtual ~ActionListener() {}
  9158. virtual void actionListenerCallback (const String& message) = 0;
  9159. };
  9160. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9161. /*** End of inlined file: juce_ActionListener.h ***/
  9162. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9163. private ActionListener
  9164. {
  9165. protected:
  9166. JUCEApplication();
  9167. public:
  9168. virtual ~JUCEApplication();
  9169. static JUCEApplication* getInstance() throw();
  9170. virtual void initialise (const String& commandLineParameters) = 0;
  9171. bool isInitialising() const throw();
  9172. virtual void shutdown() = 0;
  9173. virtual const String getApplicationName() = 0;
  9174. virtual const String getApplicationVersion();
  9175. virtual bool moreThanOneInstanceAllowed();
  9176. virtual void anotherInstanceStarted (const String& commandLine);
  9177. virtual void systemRequestedQuit();
  9178. virtual void unhandledException (const std::exception* e,
  9179. const String& sourceFilename,
  9180. int lineNumber);
  9181. static void quit();
  9182. void setApplicationReturnValue (int newReturnValue) throw();
  9183. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9184. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9185. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9186. static int main (String& commandLine, JUCEApplication* newApp);
  9187. static int main (int argc, const char* argv[], JUCEApplication* newApp);
  9188. static void sendUnhandledException (const std::exception* e,
  9189. const char* sourceFile,
  9190. int lineNumber);
  9191. ApplicationCommandTarget* getNextCommandTarget();
  9192. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  9193. void getAllCommands (Array <CommandID>& commands);
  9194. bool perform (const InvocationInfo& info);
  9195. void actionListenerCallback (const String& message);
  9196. private:
  9197. String commandLineParameters;
  9198. int appReturnValue;
  9199. bool stillInitialising;
  9200. ScopedPointer<InterProcessLock> appLock;
  9201. JUCEApplication (const JUCEApplication&);
  9202. JUCEApplication& operator= (const JUCEApplication&);
  9203. public:
  9204. bool initialiseApp (String& commandLine);
  9205. static int shutdownAppAndClearUp();
  9206. };
  9207. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9208. /*** End of inlined file: juce_Application.h ***/
  9209. #endif
  9210. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9211. #endif
  9212. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9213. #endif
  9214. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9215. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9216. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9217. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9218. /*** Start of inlined file: juce_Desktop.h ***/
  9219. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9220. #define __JUCE_DESKTOP_JUCEHEADER__
  9221. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9222. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9223. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9224. class JUCE_API DeletedAtShutdown
  9225. {
  9226. protected:
  9227. DeletedAtShutdown();
  9228. virtual ~DeletedAtShutdown();
  9229. public:
  9230. static void deleteAll();
  9231. private:
  9232. DeletedAtShutdown (const DeletedAtShutdown&);
  9233. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9234. };
  9235. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9236. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9237. /*** Start of inlined file: juce_Timer.h ***/
  9238. #ifndef __JUCE_TIMER_JUCEHEADER__
  9239. #define __JUCE_TIMER_JUCEHEADER__
  9240. class InternalTimerThread;
  9241. class JUCE_API Timer
  9242. {
  9243. protected:
  9244. Timer() throw();
  9245. Timer (const Timer& other) throw();
  9246. public:
  9247. virtual ~Timer();
  9248. virtual void timerCallback() = 0;
  9249. void startTimer (int intervalInMilliseconds) throw();
  9250. void stopTimer() throw();
  9251. bool isTimerRunning() const throw() { return periodMs > 0; }
  9252. int getTimerInterval() const throw() { return periodMs; }
  9253. private:
  9254. friend class InternalTimerThread;
  9255. int countdownMs, periodMs;
  9256. Timer* previous;
  9257. Timer* next;
  9258. Timer& operator= (const Timer&);
  9259. };
  9260. #endif // __JUCE_TIMER_JUCEHEADER__
  9261. /*** End of inlined file: juce_Timer.h ***/
  9262. class MouseInputSource;
  9263. class MouseInputSourceInternal;
  9264. class MouseListener;
  9265. class JUCE_API FocusChangeListener
  9266. {
  9267. public:
  9268. virtual ~FocusChangeListener() {}
  9269. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9270. };
  9271. class JUCE_API Desktop : private DeletedAtShutdown,
  9272. private Timer,
  9273. private AsyncUpdater
  9274. {
  9275. public:
  9276. static Desktop& JUCE_CALLTYPE getInstance();
  9277. const RectangleList getAllMonitorDisplayAreas (bool clippedToWorkArea = true) const throw();
  9278. const Rectangle<int> getMainMonitorArea (bool clippedToWorkArea = true) const throw();
  9279. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, bool clippedToWorkArea = true) const;
  9280. static const Point<int> getMousePosition();
  9281. static void setMousePosition (const Point<int>& newPosition);
  9282. static const Point<int> getLastMouseDownPosition() throw();
  9283. static int getMouseButtonClickCounter() throw();
  9284. static void setScreenSaverEnabled (bool isEnabled) throw();
  9285. static bool isScreenSaverEnabled() throw();
  9286. void addGlobalMouseListener (MouseListener* listener);
  9287. void removeGlobalMouseListener (MouseListener* listener);
  9288. void addFocusChangeListener (FocusChangeListener* listener);
  9289. void removeFocusChangeListener (FocusChangeListener* listener);
  9290. void setKioskModeComponent (Component* componentToUse,
  9291. bool allowMenusAndBars = true);
  9292. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9293. int getNumComponents() const throw();
  9294. Component* getComponent (int index) const throw();
  9295. Component* findComponentAt (const Point<int>& screenPosition) const;
  9296. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9297. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9298. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9299. int getNumDraggingMouseSources() const throw();
  9300. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9301. juce_UseDebuggingNewOperator
  9302. void refreshMonitorSizes();
  9303. static bool canUseSemiTransparentWindows() throw();
  9304. private:
  9305. static Desktop* instance;
  9306. friend class Component;
  9307. friend class ComponentPeer;
  9308. friend class MouseInputSource;
  9309. friend class MouseInputSourceInternal;
  9310. friend class DeletedAtShutdown;
  9311. friend class TopLevelWindowManager;
  9312. OwnedArray <MouseInputSource> mouseSources;
  9313. void createMouseInputSources();
  9314. ListenerList <MouseListener> mouseListeners;
  9315. ListenerList <FocusChangeListener> focusListeners;
  9316. Array <Component*> desktopComponents;
  9317. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9318. Point<int> lastFakeMouseMove;
  9319. void sendMouseMove();
  9320. int mouseClickCounter;
  9321. void incrementMouseClickCounter() throw();
  9322. Component* kioskModeComponent;
  9323. Rectangle<int> kioskComponentOriginalBounds;
  9324. void timerCallback();
  9325. void resetTimer();
  9326. int getNumDisplayMonitors() const throw();
  9327. const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const throw();
  9328. void addDesktopComponent (Component* c);
  9329. void removeDesktopComponent (Component* c);
  9330. void componentBroughtToFront (Component* c);
  9331. void triggerFocusCallback();
  9332. void handleAsyncUpdate();
  9333. Desktop();
  9334. ~Desktop();
  9335. Desktop (const Desktop&);
  9336. Desktop& operator= (const Desktop&);
  9337. };
  9338. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9339. /*** End of inlined file: juce_Desktop.h ***/
  9340. class KeyPressMappingSet;
  9341. class ApplicationCommandManagerListener;
  9342. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9343. private FocusChangeListener
  9344. {
  9345. public:
  9346. ApplicationCommandManager();
  9347. virtual ~ApplicationCommandManager();
  9348. void clearCommands();
  9349. void registerCommand (const ApplicationCommandInfo& newCommand);
  9350. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9351. void removeCommand (CommandID commandID);
  9352. void commandStatusChanged();
  9353. int getNumCommands() const throw() { return commands.size(); }
  9354. const ApplicationCommandInfo* getCommandForIndex (int index) const throw() { return commands [index]; }
  9355. const ApplicationCommandInfo* getCommandForID (CommandID commandID) const throw();
  9356. const String getNameOfCommand (CommandID commandID) const throw();
  9357. const String getDescriptionOfCommand (CommandID commandID) const throw();
  9358. const StringArray getCommandCategories() const throw();
  9359. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9360. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9361. bool invokeDirectly (CommandID commandID, bool asynchronously);
  9362. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9363. bool asynchronously);
  9364. virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
  9365. void setFirstCommandTarget (ApplicationCommandTarget* newTarget) throw();
  9366. ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
  9367. ApplicationCommandInfo& upToDateInfo);
  9368. void addListener (ApplicationCommandManagerListener* listener) throw();
  9369. void removeListener (ApplicationCommandManagerListener* listener) throw();
  9370. static ApplicationCommandTarget* findDefaultComponentTarget();
  9371. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9372. juce_UseDebuggingNewOperator
  9373. private:
  9374. OwnedArray <ApplicationCommandInfo> commands;
  9375. ListenerList <ApplicationCommandManagerListener> listeners;
  9376. ScopedPointer <KeyPressMappingSet> keyMappings;
  9377. ApplicationCommandTarget* firstTarget;
  9378. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9379. void handleAsyncUpdate();
  9380. void globalFocusChanged (Component*);
  9381. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9382. // version of this method.
  9383. virtual short getFirstCommandTarget() { return 0; }
  9384. ApplicationCommandManager (const ApplicationCommandManager&);
  9385. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9386. };
  9387. class JUCE_API ApplicationCommandManagerListener
  9388. {
  9389. public:
  9390. virtual ~ApplicationCommandManagerListener() {}
  9391. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9392. virtual void applicationCommandListChanged() = 0;
  9393. };
  9394. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9395. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9396. #endif
  9397. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9398. #endif
  9399. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9400. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9401. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9402. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9403. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9404. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9405. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9406. class JUCE_API PropertiesFile : public PropertySet,
  9407. public ChangeBroadcaster,
  9408. private Timer
  9409. {
  9410. public:
  9411. enum FileFormatOptions
  9412. {
  9413. ignoreCaseOfKeyNames = 1,
  9414. storeAsBinary = 2,
  9415. storeAsCompressedBinary = 4,
  9416. storeAsXML = 8
  9417. };
  9418. PropertiesFile (const File& file,
  9419. int millisecondsBeforeSaving,
  9420. int optionFlags,
  9421. InterProcessLock* processLock = 0);
  9422. ~PropertiesFile();
  9423. bool isValidFile() const throw() { return loadedOk; }
  9424. bool saveIfNeeded();
  9425. bool save();
  9426. bool needsToBeSaved() const;
  9427. void setNeedsToBeSaved (bool needsToBeSaved);
  9428. const File getFile() const { return file; }
  9429. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9430. const String& fileNameSuffix,
  9431. const String& folderName,
  9432. bool commonToAllUsers,
  9433. int millisecondsBeforeSaving,
  9434. int propertiesFileOptions,
  9435. InterProcessLock* processLock = 0);
  9436. static const File getDefaultAppSettingsFile (const String& applicationName,
  9437. const String& fileNameSuffix,
  9438. const String& folderName,
  9439. bool commonToAllUsers);
  9440. juce_UseDebuggingNewOperator
  9441. protected:
  9442. virtual void propertyChanged();
  9443. private:
  9444. File file;
  9445. int timerInterval;
  9446. const int options;
  9447. bool loadedOk, needsWriting;
  9448. InterProcessLock* processLock;
  9449. typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock;
  9450. InterProcessLock::ScopedLockType* createProcessLock() const;
  9451. void timerCallback();
  9452. PropertiesFile (const PropertiesFile&);
  9453. PropertiesFile& operator= (const PropertiesFile&);
  9454. };
  9455. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9456. /*** End of inlined file: juce_PropertiesFile.h ***/
  9457. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9458. {
  9459. public:
  9460. ApplicationProperties() throw();
  9461. ~ApplicationProperties();
  9462. juce_DeclareSingleton (ApplicationProperties, false)
  9463. void setStorageParameters (const String& applicationName,
  9464. const String& fileNameSuffix,
  9465. const String& folderName,
  9466. int millisecondsBeforeSaving,
  9467. int propertiesFileOptions) throw();
  9468. bool testWriteAccess (bool testUserSettings,
  9469. bool testCommonSettings,
  9470. bool showWarningDialogOnFailure);
  9471. PropertiesFile* getUserSettings() throw();
  9472. PropertiesFile* getCommonSettings (bool returnUserPropsIfReadOnly) throw();
  9473. bool saveIfNeeded();
  9474. void closeFiles();
  9475. juce_UseDebuggingNewOperator
  9476. private:
  9477. ScopedPointer <PropertiesFile> userProps, commonProps;
  9478. String appName, fileSuffix, folderName;
  9479. int msBeforeSaving, options;
  9480. int commonSettingsAreReadOnly;
  9481. ApplicationProperties (const ApplicationProperties&);
  9482. ApplicationProperties& operator= (const ApplicationProperties&);
  9483. void openFiles() throw();
  9484. };
  9485. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9486. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9487. #endif
  9488. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9489. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9490. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9491. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9492. /*** Start of inlined file: juce_AudioFormat.h ***/
  9493. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9494. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9495. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9496. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9497. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9498. class AudioFormat;
  9499. class JUCE_API AudioFormatReader
  9500. {
  9501. protected:
  9502. AudioFormatReader (InputStream* sourceStream,
  9503. const String& formatName);
  9504. public:
  9505. virtual ~AudioFormatReader();
  9506. const String getFormatName() const throw() { return formatName; }
  9507. bool read (int** destSamples,
  9508. int numDestChannels,
  9509. int64 startSampleInSource,
  9510. int numSamplesToRead,
  9511. bool fillLeftoverChannelsWithCopies);
  9512. virtual void readMaxLevels (int64 startSample,
  9513. int64 numSamples,
  9514. float& lowestLeft,
  9515. float& highestLeft,
  9516. float& lowestRight,
  9517. float& highestRight);
  9518. int64 searchForLevel (int64 startSample,
  9519. int64 numSamplesToSearch,
  9520. double magnitudeRangeMinimum,
  9521. double magnitudeRangeMaximum,
  9522. int minimumConsecutiveSamples);
  9523. double sampleRate;
  9524. unsigned int bitsPerSample;
  9525. int64 lengthInSamples;
  9526. unsigned int numChannels;
  9527. bool usesFloatingPointData;
  9528. StringPairArray metadataValues;
  9529. InputStream* input;
  9530. virtual bool readSamples (int** destSamples,
  9531. int numDestChannels,
  9532. int startOffsetInDestBuffer,
  9533. int64 startSampleInFile,
  9534. int numSamples) = 0;
  9535. juce_UseDebuggingNewOperator
  9536. private:
  9537. String formatName;
  9538. AudioFormatReader (const AudioFormatReader&);
  9539. AudioFormatReader& operator= (const AudioFormatReader&);
  9540. };
  9541. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9542. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9543. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9544. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9545. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9546. /*** Start of inlined file: juce_AudioSource.h ***/
  9547. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9548. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9549. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9550. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9551. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9552. class AudioFormatReader;
  9553. class AudioFormatWriter;
  9554. class JUCE_API AudioSampleBuffer
  9555. {
  9556. public:
  9557. AudioSampleBuffer (int numChannels,
  9558. int numSamples) throw();
  9559. AudioSampleBuffer (float** dataToReferTo,
  9560. int numChannels,
  9561. int numSamples) throw();
  9562. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9563. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9564. virtual ~AudioSampleBuffer() throw();
  9565. int getNumChannels() const throw() { return numChannels; }
  9566. int getNumSamples() const throw() { return size; }
  9567. float* getSampleData (const int channelNumber) const throw()
  9568. {
  9569. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9570. return channels [channelNumber];
  9571. }
  9572. float* getSampleData (const int channelNumber,
  9573. const int sampleOffset) const throw()
  9574. {
  9575. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9576. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9577. return channels [channelNumber] + sampleOffset;
  9578. }
  9579. float** getArrayOfChannels() const throw() { return channels; }
  9580. void setSize (int newNumChannels,
  9581. int newNumSamples,
  9582. bool keepExistingContent = false,
  9583. bool clearExtraSpace = false,
  9584. bool avoidReallocating = false) throw();
  9585. void setDataToReferTo (float** dataToReferTo,
  9586. int numChannels,
  9587. int numSamples) throw();
  9588. void clear() throw();
  9589. void clear (int startSample,
  9590. int numSamples) throw();
  9591. void clear (int channel,
  9592. int startSample,
  9593. int numSamples) throw();
  9594. void applyGain (int channel,
  9595. int startSample,
  9596. int numSamples,
  9597. float gain) throw();
  9598. void applyGain (int startSample,
  9599. int numSamples,
  9600. float gain) throw();
  9601. void applyGainRamp (int channel,
  9602. int startSample,
  9603. int numSamples,
  9604. float startGain,
  9605. float endGain) throw();
  9606. void addFrom (int destChannel,
  9607. int destStartSample,
  9608. const AudioSampleBuffer& source,
  9609. int sourceChannel,
  9610. int sourceStartSample,
  9611. int numSamples,
  9612. float gainToApplyToSource = 1.0f) throw();
  9613. void addFrom (int destChannel,
  9614. int destStartSample,
  9615. const float* source,
  9616. int numSamples,
  9617. float gainToApplyToSource = 1.0f) throw();
  9618. void addFromWithRamp (int destChannel,
  9619. int destStartSample,
  9620. const float* source,
  9621. int numSamples,
  9622. float startGain,
  9623. float endGain) throw();
  9624. void copyFrom (int destChannel,
  9625. int destStartSample,
  9626. const AudioSampleBuffer& source,
  9627. int sourceChannel,
  9628. int sourceStartSample,
  9629. int numSamples) throw();
  9630. void copyFrom (int destChannel,
  9631. int destStartSample,
  9632. const float* source,
  9633. int numSamples) throw();
  9634. void copyFrom (int destChannel,
  9635. int destStartSample,
  9636. const float* source,
  9637. int numSamples,
  9638. float gain) throw();
  9639. void copyFromWithRamp (int destChannel,
  9640. int destStartSample,
  9641. const float* source,
  9642. int numSamples,
  9643. float startGain,
  9644. float endGain) throw();
  9645. void findMinMax (int channel,
  9646. int startSample,
  9647. int numSamples,
  9648. float& minVal,
  9649. float& maxVal) const throw();
  9650. float getMagnitude (int channel,
  9651. int startSample,
  9652. int numSamples) const throw();
  9653. float getMagnitude (int startSample,
  9654. int numSamples) const throw();
  9655. float getRMSLevel (int channel,
  9656. int startSample,
  9657. int numSamples) const throw();
  9658. void readFromAudioReader (AudioFormatReader* reader,
  9659. int startSample,
  9660. int numSamples,
  9661. int readerStartSample,
  9662. bool useReaderLeftChan,
  9663. bool useReaderRightChan) throw();
  9664. void writeToAudioWriter (AudioFormatWriter* writer,
  9665. int startSample,
  9666. int numSamples) const throw();
  9667. juce_UseDebuggingNewOperator
  9668. private:
  9669. int numChannels, size;
  9670. size_t allocatedBytes;
  9671. float** channels;
  9672. HeapBlock <char> allocatedData;
  9673. float* preallocatedChannelSpace [32];
  9674. void allocateData();
  9675. void allocateChannels (float** dataToReferTo);
  9676. };
  9677. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9678. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9679. struct JUCE_API AudioSourceChannelInfo
  9680. {
  9681. AudioSampleBuffer* buffer;
  9682. int startSample;
  9683. int numSamples;
  9684. void clearActiveBufferRegion() const
  9685. {
  9686. if (buffer != 0)
  9687. buffer->clear (startSample, numSamples);
  9688. }
  9689. };
  9690. class JUCE_API AudioSource
  9691. {
  9692. protected:
  9693. AudioSource() throw() {}
  9694. public:
  9695. virtual ~AudioSource() {}
  9696. virtual void prepareToPlay (int samplesPerBlockExpected,
  9697. double sampleRate) = 0;
  9698. virtual void releaseResources() = 0;
  9699. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9700. };
  9701. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9702. /*** End of inlined file: juce_AudioSource.h ***/
  9703. class JUCE_API AudioFormatWriter
  9704. {
  9705. protected:
  9706. AudioFormatWriter (OutputStream* destStream,
  9707. const String& formatName,
  9708. double sampleRate,
  9709. unsigned int numberOfChannels,
  9710. unsigned int bitsPerSample);
  9711. public:
  9712. virtual ~AudioFormatWriter();
  9713. const String getFormatName() const throw() { return formatName; }
  9714. virtual bool write (const int** samplesToWrite,
  9715. int numSamples) = 0;
  9716. bool writeFromAudioReader (AudioFormatReader& reader,
  9717. int64 startSample,
  9718. int64 numSamplesToRead);
  9719. bool writeFromAudioSource (AudioSource& source,
  9720. int numSamplesToRead,
  9721. int samplesPerBlock = 2048);
  9722. double getSampleRate() const throw() { return sampleRate; }
  9723. int getNumChannels() const throw() { return numChannels; }
  9724. int getBitsPerSample() const throw() { return bitsPerSample; }
  9725. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9726. juce_UseDebuggingNewOperator
  9727. protected:
  9728. double sampleRate;
  9729. unsigned int numChannels;
  9730. unsigned int bitsPerSample;
  9731. bool usesFloatingPointData;
  9732. OutputStream* output;
  9733. private:
  9734. String formatName;
  9735. AudioFormatWriter (const AudioFormatWriter&);
  9736. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9737. };
  9738. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9739. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9740. class JUCE_API AudioFormat
  9741. {
  9742. public:
  9743. virtual ~AudioFormat();
  9744. const String& getFormatName() const;
  9745. const StringArray& getFileExtensions() const;
  9746. virtual bool canHandleFile (const File& fileToTest);
  9747. virtual const Array <int> getPossibleSampleRates() = 0;
  9748. virtual const Array <int> getPossibleBitDepths() = 0;
  9749. virtual bool canDoStereo() = 0;
  9750. virtual bool canDoMono() = 0;
  9751. virtual bool isCompressed();
  9752. virtual const StringArray getQualityOptions();
  9753. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9754. const bool deleteStreamIfOpeningFails) = 0;
  9755. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9756. double sampleRateToUse,
  9757. unsigned int numberOfChannels,
  9758. int bitsPerSample,
  9759. const StringPairArray& metadataValues,
  9760. int qualityOptionIndex) = 0;
  9761. protected:
  9762. AudioFormat (const String& formatName,
  9763. const juce_wchar** const fileExtensions);
  9764. private:
  9765. String formatName;
  9766. StringArray fileExtensions;
  9767. };
  9768. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9769. /*** End of inlined file: juce_AudioFormat.h ***/
  9770. class JUCE_API AiffAudioFormat : public AudioFormat
  9771. {
  9772. public:
  9773. AiffAudioFormat();
  9774. ~AiffAudioFormat();
  9775. const Array <int> getPossibleSampleRates();
  9776. const Array <int> getPossibleBitDepths();
  9777. bool canDoStereo();
  9778. bool canDoMono();
  9779. #if JUCE_MAC
  9780. bool canHandleFile (const File& fileToTest);
  9781. #endif
  9782. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9783. const bool deleteStreamIfOpeningFails);
  9784. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9785. double sampleRateToUse,
  9786. unsigned int numberOfChannels,
  9787. int bitsPerSample,
  9788. const StringPairArray& metadataValues,
  9789. int qualityOptionIndex);
  9790. juce_UseDebuggingNewOperator
  9791. };
  9792. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9793. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9794. #endif
  9795. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9796. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9797. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9798. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9799. #if JUCE_USE_CDBURNER
  9800. class AudioCDBurner : public ChangeBroadcaster
  9801. {
  9802. public:
  9803. static const StringArray findAvailableDevices();
  9804. static AudioCDBurner* openDevice (const int deviceIndex);
  9805. ~AudioCDBurner();
  9806. enum DiskState
  9807. {
  9808. unknown, /**< An error condition, if the device isn't responding. */
  9809. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9810. may seem to be permanently open. */
  9811. noDisc, /**< The drive has no disk in it. */
  9812. writableDiskPresent, /**< The drive contains a writeable disk. */
  9813. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9814. };
  9815. DiskState getDiskState() const;
  9816. bool isDiskPresent() const;
  9817. bool openTray();
  9818. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9819. const Array<int> getAvailableWriteSpeeds() const;
  9820. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9821. int getNumAvailableAudioBlocks() const;
  9822. bool addAudioTrack (AudioSource* source, int numSamples);
  9823. class BurnProgressListener
  9824. {
  9825. public:
  9826. BurnProgressListener() throw() {}
  9827. virtual ~BurnProgressListener() {}
  9828. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9829. };
  9830. const String burn (BurnProgressListener* listener,
  9831. bool ejectDiscAfterwards,
  9832. bool performFakeBurnForTesting,
  9833. int writeSpeed);
  9834. void abortBurn();
  9835. juce_UseDebuggingNewOperator
  9836. private:
  9837. AudioCDBurner (const int deviceIndex);
  9838. class Pimpl;
  9839. friend class ScopedPointer<Pimpl>;
  9840. ScopedPointer<Pimpl> pimpl;
  9841. };
  9842. #endif
  9843. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9844. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9845. #endif
  9846. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9847. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9848. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9849. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9850. #if JUCE_USE_CDREADER
  9851. #if JUCE_MAC
  9852. #endif
  9853. class JUCE_API AudioCDReader : public AudioFormatReader
  9854. {
  9855. public:
  9856. static const StringArray getAvailableCDNames();
  9857. static AudioCDReader* createReaderForCD (const int index);
  9858. ~AudioCDReader();
  9859. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9860. int64 startSampleInFile, int numSamples);
  9861. bool isCDStillPresent() const;
  9862. int getNumTracks() const;
  9863. int getPositionOfTrackStart (int trackNum) const;
  9864. bool isTrackAudio (int trackNum) const;
  9865. void refreshTrackLengths();
  9866. void enableIndexScanning (bool enabled);
  9867. int getLastIndex() const;
  9868. const Array <int> findIndexesInTrack (const int trackNumber);
  9869. int getCDDBId();
  9870. void ejectDisk();
  9871. juce_UseDebuggingNewOperator
  9872. private:
  9873. #if JUCE_MAC
  9874. File volumeDir;
  9875. Array<File> tracks;
  9876. Array<int> trackStartSamples;
  9877. int currentReaderTrack;
  9878. ScopedPointer <AudioFormatReader> reader;
  9879. AudioCDReader (const File& volume);
  9880. public:
  9881. static int compareElements (const File&, const File&);
  9882. private:
  9883. #elif JUCE_WINDOWS
  9884. int numTracks;
  9885. int trackStarts[100];
  9886. bool audioTracks [100];
  9887. void* handle;
  9888. bool indexingEnabled;
  9889. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9890. MemoryBlock buffer;
  9891. AudioCDReader (void* handle);
  9892. int getIndexAt (int samplePos);
  9893. #elif JUCE_LINUX
  9894. AudioCDReader();
  9895. #endif
  9896. AudioCDReader (const AudioCDReader&);
  9897. AudioCDReader& operator= (const AudioCDReader&);
  9898. };
  9899. #endif
  9900. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9901. /*** End of inlined file: juce_AudioCDReader.h ***/
  9902. #endif
  9903. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9904. #endif
  9905. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9906. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9907. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9908. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9909. class JUCE_API AudioFormatManager
  9910. {
  9911. public:
  9912. AudioFormatManager();
  9913. ~AudioFormatManager();
  9914. juce_DeclareSingleton (AudioFormatManager, false);
  9915. void registerFormat (AudioFormat* newFormat,
  9916. bool makeThisTheDefaultFormat);
  9917. void registerBasicFormats();
  9918. void clearFormats();
  9919. int getNumKnownFormats() const;
  9920. AudioFormat* getKnownFormat (int index) const;
  9921. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9922. AudioFormat* getDefaultFormat() const;
  9923. const String getWildcardForAllFormats() const;
  9924. AudioFormatReader* createReaderFor (const File& audioFile);
  9925. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9926. juce_UseDebuggingNewOperator
  9927. private:
  9928. VoidArray knownFormats;
  9929. int defaultFormatIndex;
  9930. };
  9931. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9932. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9933. #endif
  9934. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9935. #endif
  9936. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9937. #endif
  9938. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9939. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9940. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9941. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9942. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9943. {
  9944. public:
  9945. AudioSubsectionReader (AudioFormatReader* sourceReader,
  9946. int64 subsectionStartSample,
  9947. int64 subsectionLength,
  9948. bool deleteSourceWhenDeleted);
  9949. ~AudioSubsectionReader();
  9950. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9951. int64 startSampleInFile, int numSamples);
  9952. void readMaxLevels (int64 startSample,
  9953. int64 numSamples,
  9954. float& lowestLeft,
  9955. float& highestLeft,
  9956. float& lowestRight,
  9957. float& highestRight);
  9958. juce_UseDebuggingNewOperator
  9959. private:
  9960. AudioFormatReader* const source;
  9961. int64 startSample, length;
  9962. const bool deleteSourceWhenDeleted;
  9963. AudioSubsectionReader (const AudioSubsectionReader&);
  9964. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9965. };
  9966. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9967. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9968. #endif
  9969. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9970. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9971. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9972. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9973. class AudioThumbnailCache;
  9974. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9975. public TimeSliceClient,
  9976. private Timer
  9977. {
  9978. public:
  9979. AudioThumbnail (int sourceSamplesPerThumbnailSample,
  9980. AudioFormatManager& formatManagerToUse,
  9981. AudioThumbnailCache& cacheToUse);
  9982. ~AudioThumbnail();
  9983. void setSource (InputSource* newSource);
  9984. void loadFrom (InputStream& input);
  9985. void saveTo (OutputStream& output) const;
  9986. int getNumChannels() const throw();
  9987. double getTotalLength() const throw();
  9988. void drawChannel (Graphics& g,
  9989. int x, int y, int w, int h,
  9990. double startTimeSeconds,
  9991. double endTimeSeconds,
  9992. int channelNum,
  9993. float verticalZoomFactor);
  9994. bool isFullyLoaded() const throw();
  9995. bool useTimeSlice();
  9996. void timerCallback();
  9997. juce_UseDebuggingNewOperator
  9998. private:
  9999. AudioFormatManager& formatManagerToUse;
  10000. AudioThumbnailCache& cache;
  10001. ScopedPointer <InputSource> source;
  10002. CriticalSection readerLock;
  10003. ScopedPointer <AudioFormatReader> reader;
  10004. MemoryBlock data, cachedLevels;
  10005. int orginalSamplesPerThumbnailSample;
  10006. int numChannelsCached, numSamplesCached;
  10007. double cachedStart, cachedTimePerPixel;
  10008. bool cacheNeedsRefilling;
  10009. void clear();
  10010. AudioFormatReader* createReader() const;
  10011. void generateSection (AudioFormatReader& reader, int64 startSample, int numSamples);
  10012. char* getChannelData (int channel) const;
  10013. void refillCache (int numSamples, double startTime, double timePerPixel);
  10014. friend class AudioThumbnailCache;
  10015. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  10016. bool initialiseFromAudioFile (AudioFormatReader& reader);
  10017. // returns true if more needs to be read
  10018. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  10019. };
  10020. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10021. /*** End of inlined file: juce_AudioThumbnail.h ***/
  10022. #endif
  10023. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10024. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  10025. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10026. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10027. struct ThumbnailCacheEntry;
  10028. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  10029. {
  10030. public:
  10031. explicit AudioThumbnailCache (int maxNumThumbsToStore);
  10032. ~AudioThumbnailCache();
  10033. void clear();
  10034. bool loadThumb (AudioThumbnail& thumb, int64 hashCode);
  10035. void storeThumb (const AudioThumbnail& thumb, int64 hashCode);
  10036. juce_UseDebuggingNewOperator
  10037. private:
  10038. OwnedArray <ThumbnailCacheEntry> thumbs;
  10039. int maxNumThumbsToStore;
  10040. friend class AudioThumbnail;
  10041. void addThumbnail (AudioThumbnail* thumb);
  10042. void removeThumbnail (AudioThumbnail* thumb);
  10043. };
  10044. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10045. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  10046. #endif
  10047. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10048. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10049. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10050. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10051. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10052. class JUCE_API FlacAudioFormat : public AudioFormat
  10053. {
  10054. public:
  10055. FlacAudioFormat();
  10056. ~FlacAudioFormat();
  10057. const Array <int> getPossibleSampleRates();
  10058. const Array <int> getPossibleBitDepths();
  10059. bool canDoStereo();
  10060. bool canDoMono();
  10061. bool isCompressed();
  10062. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10063. const bool deleteStreamIfOpeningFails);
  10064. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10065. double sampleRateToUse,
  10066. unsigned int numberOfChannels,
  10067. int bitsPerSample,
  10068. const StringPairArray& metadataValues,
  10069. int qualityOptionIndex);
  10070. juce_UseDebuggingNewOperator
  10071. };
  10072. #endif
  10073. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10074. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10075. #endif
  10076. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10077. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10078. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10079. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10080. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10081. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10082. {
  10083. public:
  10084. OggVorbisAudioFormat();
  10085. ~OggVorbisAudioFormat();
  10086. const Array <int> getPossibleSampleRates();
  10087. const Array <int> getPossibleBitDepths();
  10088. bool canDoStereo();
  10089. bool canDoMono();
  10090. bool isCompressed();
  10091. const StringArray getQualityOptions();
  10092. int estimateOggFileQuality (const File& source);
  10093. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10094. const bool deleteStreamIfOpeningFails);
  10095. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10096. double sampleRateToUse,
  10097. unsigned int numberOfChannels,
  10098. int bitsPerSample,
  10099. const StringPairArray& metadataValues,
  10100. int qualityOptionIndex);
  10101. juce_UseDebuggingNewOperator
  10102. };
  10103. #endif
  10104. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10105. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10106. #endif
  10107. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10108. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10109. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10110. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10111. #if JUCE_QUICKTIME
  10112. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10113. {
  10114. public:
  10115. QuickTimeAudioFormat();
  10116. ~QuickTimeAudioFormat();
  10117. const Array <int> getPossibleSampleRates();
  10118. const Array <int> getPossibleBitDepths();
  10119. bool canDoStereo();
  10120. bool canDoMono();
  10121. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10122. const bool deleteStreamIfOpeningFails);
  10123. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10124. double sampleRateToUse,
  10125. unsigned int numberOfChannels,
  10126. int bitsPerSample,
  10127. const StringPairArray& metadataValues,
  10128. int qualityOptionIndex);
  10129. juce_UseDebuggingNewOperator
  10130. };
  10131. #endif
  10132. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10133. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10134. #endif
  10135. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10136. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10137. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10138. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10139. class JUCE_API WavAudioFormat : public AudioFormat
  10140. {
  10141. public:
  10142. WavAudioFormat();
  10143. ~WavAudioFormat();
  10144. static const char* const bwavDescription;
  10145. static const char* const bwavOriginator;
  10146. static const char* const bwavOriginatorRef;
  10147. static const char* const bwavOriginationDate;
  10148. static const char* const bwavOriginationTime;
  10149. static const char* const bwavTimeReference;
  10150. static const char* const bwavCodingHistory;
  10151. static const StringPairArray createBWAVMetadata (const String& description,
  10152. const String& originator,
  10153. const String& originatorRef,
  10154. const Time& dateAndTime,
  10155. const int64 timeReferenceSamples,
  10156. const String& codingHistory);
  10157. const Array <int> getPossibleSampleRates();
  10158. const Array <int> getPossibleBitDepths();
  10159. bool canDoStereo();
  10160. bool canDoMono();
  10161. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10162. const bool deleteStreamIfOpeningFails);
  10163. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10164. double sampleRateToUse,
  10165. unsigned int numberOfChannels,
  10166. int bitsPerSample,
  10167. const StringPairArray& metadataValues,
  10168. int qualityOptionIndex);
  10169. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10170. juce_UseDebuggingNewOperator
  10171. };
  10172. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10173. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10174. #endif
  10175. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10176. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10177. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10178. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10179. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10180. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10181. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10182. class JUCE_API PositionableAudioSource : public AudioSource
  10183. {
  10184. protected:
  10185. PositionableAudioSource() throw() {}
  10186. public:
  10187. ~PositionableAudioSource() {}
  10188. virtual void setNextReadPosition (int newPosition) = 0;
  10189. virtual int getNextReadPosition() const = 0;
  10190. virtual int getTotalLength() const = 0;
  10191. virtual bool isLooping() const = 0;
  10192. };
  10193. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10194. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10195. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10196. {
  10197. public:
  10198. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10199. const bool deleteReaderWhenThisIsDeleted);
  10200. ~AudioFormatReaderSource();
  10201. void setLooping (const bool shouldLoop) throw();
  10202. bool isLooping() const { return looping; }
  10203. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10204. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10205. void releaseResources();
  10206. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10207. void setNextReadPosition (int newPosition);
  10208. int getNextReadPosition() const;
  10209. int getTotalLength() const;
  10210. juce_UseDebuggingNewOperator
  10211. private:
  10212. AudioFormatReader* reader;
  10213. bool deleteReader;
  10214. int volatile nextPlayPos;
  10215. bool volatile looping;
  10216. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10217. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10218. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10219. };
  10220. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10221. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10222. #endif
  10223. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10224. #endif
  10225. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10226. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10227. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10228. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10229. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10230. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10231. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10232. class AudioIODevice;
  10233. class JUCE_API AudioIODeviceCallback
  10234. {
  10235. public:
  10236. virtual ~AudioIODeviceCallback() {}
  10237. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10238. int numInputChannels,
  10239. float** outputChannelData,
  10240. int numOutputChannels,
  10241. int numSamples) = 0;
  10242. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10243. virtual void audioDeviceStopped() = 0;
  10244. };
  10245. class JUCE_API AudioIODevice
  10246. {
  10247. public:
  10248. virtual ~AudioIODevice();
  10249. const String& getName() const throw() { return name; }
  10250. const String& getTypeName() const throw() { return typeName; }
  10251. virtual const StringArray getOutputChannelNames() = 0;
  10252. virtual const StringArray getInputChannelNames() = 0;
  10253. virtual int getNumSampleRates() = 0;
  10254. virtual double getSampleRate (int index) = 0;
  10255. virtual int getNumBufferSizesAvailable() = 0;
  10256. virtual int getBufferSizeSamples (int index) = 0;
  10257. virtual int getDefaultBufferSize() = 0;
  10258. virtual const String open (const BigInteger& inputChannels,
  10259. const BigInteger& outputChannels,
  10260. double sampleRate,
  10261. int bufferSizeSamples) = 0;
  10262. virtual void close() = 0;
  10263. virtual bool isOpen() = 0;
  10264. virtual void start (AudioIODeviceCallback* callback) = 0;
  10265. virtual void stop() = 0;
  10266. virtual bool isPlaying() = 0;
  10267. virtual const String getLastError() = 0;
  10268. virtual int getCurrentBufferSizeSamples() = 0;
  10269. virtual double getCurrentSampleRate() = 0;
  10270. virtual int getCurrentBitDepth() = 0;
  10271. virtual const BigInteger getActiveOutputChannels() const = 0;
  10272. virtual const BigInteger getActiveInputChannels() const = 0;
  10273. virtual int getOutputLatencyInSamples() = 0;
  10274. virtual int getInputLatencyInSamples() = 0;
  10275. virtual bool hasControlPanel() const;
  10276. virtual bool showControlPanel();
  10277. protected:
  10278. AudioIODevice (const String& deviceName,
  10279. const String& typeName);
  10280. String name, typeName;
  10281. };
  10282. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10283. /*** End of inlined file: juce_AudioIODevice.h ***/
  10284. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10285. {
  10286. public:
  10287. AudioSourcePlayer();
  10288. virtual ~AudioSourcePlayer();
  10289. void setSource (AudioSource* newSource);
  10290. AudioSource* getCurrentSource() const throw() { return source; }
  10291. void setGain (const float newGain) throw();
  10292. void audioDeviceIOCallback (const float** inputChannelData,
  10293. int totalNumInputChannels,
  10294. float** outputChannelData,
  10295. int totalNumOutputChannels,
  10296. int numSamples);
  10297. void audioDeviceAboutToStart (AudioIODevice* device);
  10298. void audioDeviceStopped();
  10299. juce_UseDebuggingNewOperator
  10300. private:
  10301. CriticalSection readLock;
  10302. AudioSource* source;
  10303. double sampleRate;
  10304. int bufferSize;
  10305. float* channels [128];
  10306. float* outputChans [128];
  10307. const float* inputChans [128];
  10308. AudioSampleBuffer tempBuffer;
  10309. float lastGain, gain;
  10310. AudioSourcePlayer (const AudioSourcePlayer&);
  10311. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10312. };
  10313. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10314. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10315. #endif
  10316. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10317. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10318. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10319. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10320. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10321. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10322. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10323. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10324. {
  10325. public:
  10326. BufferingAudioSource (PositionableAudioSource* source,
  10327. const bool deleteSourceWhenDeleted,
  10328. int numberOfSamplesToBuffer);
  10329. ~BufferingAudioSource();
  10330. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10331. void releaseResources();
  10332. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10333. void setNextReadPosition (int newPosition);
  10334. int getNextReadPosition() const;
  10335. int getTotalLength() const { return source->getTotalLength(); }
  10336. bool isLooping() const { return source->isLooping(); }
  10337. juce_UseDebuggingNewOperator
  10338. private:
  10339. PositionableAudioSource* source;
  10340. bool deleteSourceWhenDeleted;
  10341. int numberOfSamplesToBuffer;
  10342. AudioSampleBuffer buffer;
  10343. CriticalSection bufferStartPosLock;
  10344. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10345. bool wasSourceLooping;
  10346. double volatile sampleRate;
  10347. friend class SharedBufferingAudioSourceThread;
  10348. bool readNextBufferChunk();
  10349. void readBufferSection (int start, int length, int bufferOffset);
  10350. BufferingAudioSource (const BufferingAudioSource&);
  10351. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10352. };
  10353. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10354. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10355. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10356. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10357. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10358. class JUCE_API ResamplingAudioSource : public AudioSource
  10359. {
  10360. public:
  10361. ResamplingAudioSource (AudioSource* const inputSource,
  10362. const bool deleteInputWhenDeleted);
  10363. ~ResamplingAudioSource();
  10364. void setResamplingRatio (const double samplesInPerOutputSample);
  10365. double getResamplingRatio() const throw() { return ratio; }
  10366. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10367. void releaseResources();
  10368. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10369. juce_UseDebuggingNewOperator
  10370. private:
  10371. AudioSource* const input;
  10372. const bool deleteInputWhenDeleted;
  10373. double ratio, lastRatio;
  10374. AudioSampleBuffer buffer;
  10375. int bufferPos, sampsInBuffer;
  10376. double subSampleOffset;
  10377. double coefficients[6];
  10378. CriticalSection ratioLock;
  10379. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10380. void createLowPass (const double proportionalRate);
  10381. struct FilterState
  10382. {
  10383. double x1, x2, y1, y2;
  10384. };
  10385. FilterState filterStates[2];
  10386. void resetFilters();
  10387. void applyFilter (float* samples, int num, FilterState& fs);
  10388. ResamplingAudioSource (const ResamplingAudioSource&);
  10389. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10390. };
  10391. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10392. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10393. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10394. public ChangeBroadcaster
  10395. {
  10396. public:
  10397. AudioTransportSource();
  10398. ~AudioTransportSource();
  10399. void setSource (PositionableAudioSource* const newSource,
  10400. int readAheadBufferSize = 0,
  10401. double sourceSampleRateToCorrectFor = 0.0);
  10402. void setPosition (double newPosition);
  10403. double getCurrentPosition() const;
  10404. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10405. void start();
  10406. void stop();
  10407. bool isPlaying() const throw() { return playing; }
  10408. void setGain (const float newGain) throw();
  10409. float getGain() const throw() { return gain; }
  10410. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10411. void releaseResources();
  10412. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10413. void setNextReadPosition (int newPosition);
  10414. int getNextReadPosition() const;
  10415. int getTotalLength() const;
  10416. bool isLooping() const;
  10417. juce_UseDebuggingNewOperator
  10418. private:
  10419. PositionableAudioSource* source;
  10420. ResamplingAudioSource* resamplerSource;
  10421. BufferingAudioSource* bufferingSource;
  10422. PositionableAudioSource* positionableSource;
  10423. AudioSource* masterSource;
  10424. CriticalSection callbackLock;
  10425. float volatile gain, lastGain;
  10426. bool volatile playing, stopped;
  10427. double sampleRate, sourceSampleRate;
  10428. int blockSize, readAheadBufferSize;
  10429. bool isPrepared, inputStreamEOF;
  10430. AudioTransportSource (const AudioTransportSource&);
  10431. AudioTransportSource& operator= (const AudioTransportSource&);
  10432. };
  10433. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10434. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10435. #endif
  10436. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10437. #endif
  10438. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10439. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10440. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10441. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10442. class ChannelRemappingAudioSource : public AudioSource
  10443. {
  10444. public:
  10445. ChannelRemappingAudioSource (AudioSource* const source,
  10446. const bool deleteSourceWhenDeleted);
  10447. ~ChannelRemappingAudioSource();
  10448. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10449. void clearAllMappings() throw();
  10450. void setInputChannelMapping (const int destChannelIndex,
  10451. const int sourceChannelIndex) throw();
  10452. void setOutputChannelMapping (const int sourceChannelIndex,
  10453. const int destChannelIndex) throw();
  10454. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10455. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10456. XmlElement* createXml() const throw();
  10457. void restoreFromXml (const XmlElement& e) throw();
  10458. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10459. void releaseResources();
  10460. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10461. juce_UseDebuggingNewOperator
  10462. private:
  10463. int requiredNumberOfChannels;
  10464. Array <int> remappedInputs, remappedOutputs;
  10465. AudioSource* const source;
  10466. const bool deleteSourceWhenDeleted;
  10467. AudioSampleBuffer buffer;
  10468. AudioSourceChannelInfo remappedInfo;
  10469. CriticalSection lock;
  10470. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10471. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10472. };
  10473. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10474. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10475. #endif
  10476. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10477. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10478. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10479. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10480. /*** Start of inlined file: juce_IIRFilter.h ***/
  10481. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10482. #define __JUCE_IIRFILTER_JUCEHEADER__
  10483. class JUCE_API IIRFilter
  10484. {
  10485. public:
  10486. IIRFilter();
  10487. IIRFilter (const IIRFilter& other);
  10488. ~IIRFilter();
  10489. void reset() throw();
  10490. void processSamples (float* samples,
  10491. int numSamples) throw();
  10492. float processSingleSampleRaw (float sample) throw();
  10493. void makeLowPass (double sampleRate,
  10494. double frequency) throw();
  10495. void makeHighPass (double sampleRate,
  10496. double frequency) throw();
  10497. void makeLowShelf (double sampleRate,
  10498. double cutOffFrequency,
  10499. double Q,
  10500. float gainFactor) throw();
  10501. void makeHighShelf (double sampleRate,
  10502. double cutOffFrequency,
  10503. double Q,
  10504. float gainFactor) throw();
  10505. void makeBandPass (double sampleRate,
  10506. double centreFrequency,
  10507. double Q,
  10508. float gainFactor) throw();
  10509. void makeInactive() throw();
  10510. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10511. juce_UseDebuggingNewOperator
  10512. protected:
  10513. CriticalSection processLock;
  10514. void setCoefficients (double c1, double c2, double c3,
  10515. double c4, double c5, double c6) throw();
  10516. bool active;
  10517. float coefficients[6];
  10518. float x1, x2, y1, y2;
  10519. // (use the copyCoefficientsFrom() method instead of this operator)
  10520. IIRFilter& operator= (const IIRFilter&);
  10521. };
  10522. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10523. /*** End of inlined file: juce_IIRFilter.h ***/
  10524. class JUCE_API IIRFilterAudioSource : public AudioSource
  10525. {
  10526. public:
  10527. IIRFilterAudioSource (AudioSource* const inputSource,
  10528. const bool deleteInputWhenDeleted);
  10529. ~IIRFilterAudioSource();
  10530. void setFilterParameters (const IIRFilter& newSettings);
  10531. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10532. void releaseResources();
  10533. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10534. juce_UseDebuggingNewOperator
  10535. private:
  10536. AudioSource* const input;
  10537. const bool deleteInputWhenDeleted;
  10538. OwnedArray <IIRFilter> iirFilters;
  10539. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10540. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10541. };
  10542. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10543. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10544. #endif
  10545. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10546. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10547. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10548. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10549. class JUCE_API MixerAudioSource : public AudioSource
  10550. {
  10551. public:
  10552. MixerAudioSource();
  10553. ~MixerAudioSource();
  10554. void addInputSource (AudioSource* newInput,
  10555. const bool deleteWhenRemoved);
  10556. void removeInputSource (AudioSource* input,
  10557. const bool deleteSource);
  10558. void removeAllInputs();
  10559. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10560. void releaseResources();
  10561. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10562. juce_UseDebuggingNewOperator
  10563. private:
  10564. VoidArray inputs;
  10565. BigInteger inputsToDelete;
  10566. CriticalSection lock;
  10567. AudioSampleBuffer tempBuffer;
  10568. double currentSampleRate;
  10569. int bufferSizeExpected;
  10570. MixerAudioSource (const MixerAudioSource&);
  10571. MixerAudioSource& operator= (const MixerAudioSource&);
  10572. };
  10573. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10574. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10575. #endif
  10576. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10577. #endif
  10578. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10579. #endif
  10580. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10581. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10582. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10583. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10584. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10585. {
  10586. public:
  10587. ToneGeneratorAudioSource();
  10588. ~ToneGeneratorAudioSource();
  10589. void setAmplitude (const float newAmplitude);
  10590. void setFrequency (const double newFrequencyHz);
  10591. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10592. void releaseResources();
  10593. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10594. juce_UseDebuggingNewOperator
  10595. private:
  10596. double frequency, sampleRate;
  10597. double currentPhase, phasePerSample;
  10598. float amplitude;
  10599. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10600. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10601. };
  10602. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10603. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10604. #endif
  10605. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10606. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10607. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10608. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10609. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10610. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10611. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10612. class AudioDeviceManager;
  10613. class Component;
  10614. class JUCE_API AudioIODeviceType
  10615. {
  10616. public:
  10617. const String& getTypeName() const throw() { return typeName; }
  10618. virtual void scanForDevices() = 0;
  10619. virtual const StringArray getDeviceNames (bool wantInputNames = false) const = 0;
  10620. virtual int getDefaultDeviceIndex (bool forInput) const = 0;
  10621. virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
  10622. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10623. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10624. const String& inputDeviceName) = 0;
  10625. struct DeviceSetupDetails
  10626. {
  10627. AudioDeviceManager* manager;
  10628. int minNumInputChannels, maxNumInputChannels;
  10629. int minNumOutputChannels, maxNumOutputChannels;
  10630. bool useStereoPairs;
  10631. };
  10632. virtual ~AudioIODeviceType();
  10633. protected:
  10634. explicit AudioIODeviceType (const String& typeName);
  10635. private:
  10636. String typeName;
  10637. AudioIODeviceType (const AudioIODeviceType&);
  10638. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10639. };
  10640. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10641. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10642. /*** Start of inlined file: juce_MidiInput.h ***/
  10643. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10644. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10645. /*** Start of inlined file: juce_MidiMessage.h ***/
  10646. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10647. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10648. class JUCE_API MidiMessage
  10649. {
  10650. public:
  10651. MidiMessage (int byte1, int byte2, int byte3, double timeStamp = 0) throw();
  10652. MidiMessage (int byte1, int byte2, double timeStamp = 0) throw();
  10653. MidiMessage (int byte1, double timeStamp = 0) throw();
  10654. MidiMessage (const void* data, int numBytes, double timeStamp = 0);
  10655. MidiMessage (const void* data, int maxBytesToUse,
  10656. int& numBytesUsed, uint8 lastStatusByte,
  10657. double timeStamp = 0);
  10658. MidiMessage (const MidiMessage& other);
  10659. MidiMessage (const MidiMessage& other, double newTimeStamp);
  10660. ~MidiMessage();
  10661. MidiMessage& operator= (const MidiMessage& other);
  10662. uint8* getRawData() const throw() { return data; }
  10663. int getRawDataSize() const throw() { return size; }
  10664. double getTimeStamp() const throw() { return timeStamp; }
  10665. void setTimeStamp (double newTimestamp) throw() { timeStamp = newTimestamp; }
  10666. void addToTimeStamp (double delta) throw() { timeStamp += delta; }
  10667. int getChannel() const throw();
  10668. bool isForChannel (int channelNumber) const throw();
  10669. void setChannel (int newChannelNumber) throw();
  10670. bool isSysEx() const throw();
  10671. const uint8* getSysExData() const throw();
  10672. int getSysExDataSize() const throw();
  10673. bool isNoteOn (bool returnTrueForVelocity0 = false) const throw();
  10674. static const MidiMessage noteOn (int channel, int noteNumber, float velocity) throw();
  10675. static const MidiMessage noteOn (int channel, int noteNumber, uint8 velocity) throw();
  10676. bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const throw();
  10677. static const MidiMessage noteOff (int channel, int noteNumber) throw();
  10678. bool isNoteOnOrOff() const throw();
  10679. int getNoteNumber() const throw();
  10680. void setNoteNumber (int newNoteNumber) throw();
  10681. uint8 getVelocity() const throw();
  10682. float getFloatVelocity() const throw();
  10683. void setVelocity (float newVelocity) throw();
  10684. void multiplyVelocity (float scaleFactor) throw();
  10685. bool isProgramChange() const throw();
  10686. int getProgramChangeNumber() const throw();
  10687. static const MidiMessage programChange (int channel, int programNumber) throw();
  10688. bool isPitchWheel() const throw();
  10689. int getPitchWheelValue() const throw();
  10690. static const MidiMessage pitchWheel (int channel, int position) throw();
  10691. bool isAftertouch() const throw();
  10692. int getAfterTouchValue() const throw();
  10693. static const MidiMessage aftertouchChange (int channel,
  10694. int noteNumber,
  10695. int aftertouchAmount) throw();
  10696. bool isChannelPressure() const throw();
  10697. int getChannelPressureValue() const throw();
  10698. static const MidiMessage channelPressureChange (int channel, int pressure) throw();
  10699. bool isController() const throw();
  10700. int getControllerNumber() const throw();
  10701. int getControllerValue() const throw();
  10702. static const MidiMessage controllerEvent (int channel,
  10703. int controllerType,
  10704. int value) throw();
  10705. bool isAllNotesOff() const throw();
  10706. bool isAllSoundOff() const throw();
  10707. static const MidiMessage allNotesOff (int channel) throw();
  10708. static const MidiMessage allSoundOff (int channel) throw();
  10709. static const MidiMessage allControllersOff (int channel) throw();
  10710. bool isMetaEvent() const throw();
  10711. int getMetaEventType() const throw();
  10712. const uint8* getMetaEventData() const throw();
  10713. int getMetaEventLength() const throw();
  10714. bool isTrackMetaEvent() const throw();
  10715. bool isEndOfTrackMetaEvent() const throw();
  10716. static const MidiMessage endOfTrack() throw();
  10717. bool isTrackNameEvent() const throw();
  10718. bool isTextMetaEvent() const throw();
  10719. const String getTextFromTextMetaEvent() const;
  10720. bool isTempoMetaEvent() const throw();
  10721. double getTempoMetaEventTickLength (short timeFormat) const throw();
  10722. double getTempoSecondsPerQuarterNote() const throw();
  10723. static const MidiMessage tempoMetaEvent (int microsecondsPerQuarterNote) throw();
  10724. bool isTimeSignatureMetaEvent() const throw();
  10725. void getTimeSignatureInfo (int& numerator, int& denominator) const throw();
  10726. static const MidiMessage timeSignatureMetaEvent (int numerator, int denominator);
  10727. bool isKeySignatureMetaEvent() const throw();
  10728. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10729. bool isMidiChannelMetaEvent() const throw();
  10730. int getMidiChannelMetaEventChannel() const throw();
  10731. static const MidiMessage midiChannelMetaEvent (int channel) throw();
  10732. bool isActiveSense() const throw();
  10733. bool isMidiStart() const throw();
  10734. static const MidiMessage midiStart() throw();
  10735. bool isMidiContinue() const throw();
  10736. static const MidiMessage midiContinue() throw();
  10737. bool isMidiStop() const throw();
  10738. static const MidiMessage midiStop() throw();
  10739. bool isMidiClock() const throw();
  10740. static const MidiMessage midiClock() throw();
  10741. bool isSongPositionPointer() const throw();
  10742. int getSongPositionPointerMidiBeat() const throw();
  10743. static const MidiMessage songPositionPointer (int positionInMidiBeats) throw();
  10744. bool isQuarterFrame() const throw();
  10745. int getQuarterFrameSequenceNumber() const throw();
  10746. int getQuarterFrameValue() const throw();
  10747. static const MidiMessage quarterFrame (int sequenceNumber, int value) throw();
  10748. enum SmpteTimecodeType
  10749. {
  10750. fps24 = 0,
  10751. fps25 = 1,
  10752. fps30drop = 2,
  10753. fps30 = 3
  10754. };
  10755. bool isFullFrame() const throw();
  10756. void getFullFrameParameters (int& hours,
  10757. int& minutes,
  10758. int& seconds,
  10759. int& frames,
  10760. SmpteTimecodeType& timecodeType) const throw();
  10761. static const MidiMessage fullFrame (int hours,
  10762. int minutes,
  10763. int seconds,
  10764. int frames,
  10765. SmpteTimecodeType timecodeType);
  10766. enum MidiMachineControlCommand
  10767. {
  10768. mmc_stop = 1,
  10769. mmc_play = 2,
  10770. mmc_deferredplay = 3,
  10771. mmc_fastforward = 4,
  10772. mmc_rewind = 5,
  10773. mmc_recordStart = 6,
  10774. mmc_recordStop = 7,
  10775. mmc_pause = 9
  10776. };
  10777. bool isMidiMachineControlMessage() const throw();
  10778. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10779. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10780. bool isMidiMachineControlGoto (int& hours,
  10781. int& minutes,
  10782. int& seconds,
  10783. int& frames) const throw();
  10784. static const MidiMessage midiMachineControlGoto (int hours,
  10785. int minutes,
  10786. int seconds,
  10787. int frames);
  10788. static const MidiMessage masterVolume (float volume);
  10789. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10790. int dataSize);
  10791. static int readVariableLengthVal (const uint8* data,
  10792. int& numBytesUsed) throw();
  10793. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10794. static const String getMidiNoteName (int noteNumber,
  10795. bool useSharps,
  10796. bool includeOctaveNumber,
  10797. int octaveNumForMiddleC) throw();
  10798. static const double getMidiNoteInHertz (int noteNumber) throw();
  10799. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10800. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10801. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10802. static const String getControllerName (int controllerNumber) throw();
  10803. juce_UseDebuggingNewOperator
  10804. private:
  10805. double timeStamp;
  10806. uint8* data;
  10807. int size;
  10808. union
  10809. {
  10810. uint8 asBytes[4];
  10811. uint32 asInt32;
  10812. } preallocatedData;
  10813. };
  10814. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10815. /*** End of inlined file: juce_MidiMessage.h ***/
  10816. class MidiInput;
  10817. class JUCE_API MidiInputCallback
  10818. {
  10819. public:
  10820. virtual ~MidiInputCallback() {}
  10821. virtual void handleIncomingMidiMessage (MidiInput* source,
  10822. const MidiMessage& message) = 0;
  10823. virtual void handlePartialSysexMessage (MidiInput* source,
  10824. const uint8* messageData,
  10825. const int numBytesSoFar,
  10826. const double timestamp)
  10827. {
  10828. // (this bit is just to avoid compiler warnings about unused variables)
  10829. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10830. }
  10831. };
  10832. class JUCE_API MidiInput
  10833. {
  10834. public:
  10835. static const StringArray getDevices();
  10836. static int getDefaultDeviceIndex();
  10837. static MidiInput* openDevice (int deviceIndex,
  10838. MidiInputCallback* callback);
  10839. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10840. static MidiInput* createNewDevice (const String& deviceName,
  10841. MidiInputCallback* callback);
  10842. #endif
  10843. virtual ~MidiInput();
  10844. virtual const String getName() const throw() { return name; }
  10845. virtual void setName (const String& newName) throw() { name = newName; }
  10846. virtual void start();
  10847. virtual void stop();
  10848. juce_UseDebuggingNewOperator
  10849. protected:
  10850. String name;
  10851. void* internal;
  10852. explicit MidiInput (const String& name);
  10853. private:
  10854. MidiInput (const MidiInput&);
  10855. MidiInput& operator= (const MidiInput&);
  10856. };
  10857. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10858. /*** End of inlined file: juce_MidiInput.h ***/
  10859. /*** Start of inlined file: juce_MidiOutput.h ***/
  10860. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10861. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10862. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10863. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10864. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10865. class JUCE_API MidiBuffer
  10866. {
  10867. public:
  10868. MidiBuffer() throw();
  10869. explicit MidiBuffer (const MidiMessage& message) throw();
  10870. MidiBuffer (const MidiBuffer& other) throw();
  10871. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10872. ~MidiBuffer() throw();
  10873. void clear() throw();
  10874. void clear (const int start,
  10875. const int numSamples) throw();
  10876. bool isEmpty() const throw();
  10877. int getNumEvents() const throw();
  10878. void addEvent (const MidiMessage& midiMessage,
  10879. const int sampleNumber) throw();
  10880. void addEvent (const uint8* const rawMidiData,
  10881. const int maxBytesOfMidiData,
  10882. const int sampleNumber) throw();
  10883. void addEvents (const MidiBuffer& otherBuffer,
  10884. const int startSample,
  10885. const int numSamples,
  10886. const int sampleDeltaToAdd) throw();
  10887. int getFirstEventTime() const throw();
  10888. int getLastEventTime() const throw();
  10889. void swapWith (MidiBuffer& other);
  10890. class Iterator
  10891. {
  10892. public:
  10893. Iterator (const MidiBuffer& buffer) throw();
  10894. ~Iterator() throw();
  10895. void setNextSamplePosition (const int samplePosition) throw();
  10896. bool getNextEvent (MidiMessage& result,
  10897. int& samplePosition) throw();
  10898. bool getNextEvent (const uint8* &midiData,
  10899. int& numBytesOfMidiData,
  10900. int& samplePosition) throw();
  10901. juce_UseDebuggingNewOperator
  10902. private:
  10903. const MidiBuffer& buffer;
  10904. const uint8* data;
  10905. Iterator (const Iterator&);
  10906. Iterator& operator= (const Iterator&);
  10907. };
  10908. juce_UseDebuggingNewOperator
  10909. private:
  10910. friend class MidiBuffer::Iterator;
  10911. MemoryBlock data;
  10912. int bytesUsed;
  10913. uint8* getData() const throw();
  10914. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10915. static int getEventTime (const void* d) throw();
  10916. static uint16 getEventDataSize (const void* d) throw();
  10917. static uint16 getEventTotalSize (const void* d) throw();
  10918. };
  10919. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10920. /*** End of inlined file: juce_MidiBuffer.h ***/
  10921. class JUCE_API MidiOutput : private Thread
  10922. {
  10923. public:
  10924. static const StringArray getDevices();
  10925. static int getDefaultDeviceIndex();
  10926. static MidiOutput* openDevice (int deviceIndex);
  10927. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10928. static MidiOutput* createNewDevice (const String& deviceName);
  10929. #endif
  10930. virtual ~MidiOutput();
  10931. virtual void sendMessageNow (const MidiMessage& message);
  10932. virtual void reset();
  10933. virtual bool getVolume (float& leftVol,
  10934. float& rightVol);
  10935. virtual void setVolume (float leftVol,
  10936. float rightVol);
  10937. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10938. double millisecondCounterToStartAt,
  10939. double samplesPerSecondForBuffer);
  10940. virtual void clearAllPendingMessages();
  10941. virtual void startBackgroundThread();
  10942. virtual void stopBackgroundThread();
  10943. juce_UseDebuggingNewOperator
  10944. protected:
  10945. void* internal;
  10946. struct PendingMessage
  10947. {
  10948. PendingMessage (const uint8* data, int len, double sampleNumber);
  10949. MidiMessage message;
  10950. PendingMessage* next;
  10951. juce_UseDebuggingNewOperator
  10952. };
  10953. CriticalSection lock;
  10954. PendingMessage* firstMessage;
  10955. MidiOutput();
  10956. void run();
  10957. private:
  10958. MidiOutput (const MidiOutput&);
  10959. MidiOutput& operator= (const MidiOutput&);
  10960. };
  10961. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10962. /*** End of inlined file: juce_MidiOutput.h ***/
  10963. /*** Start of inlined file: juce_ComboBox.h ***/
  10964. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10965. #define __JUCE_COMBOBOX_JUCEHEADER__
  10966. /*** Start of inlined file: juce_Label.h ***/
  10967. #ifndef __JUCE_LABEL_JUCEHEADER__
  10968. #define __JUCE_LABEL_JUCEHEADER__
  10969. /*** Start of inlined file: juce_TextEditor.h ***/
  10970. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10971. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10972. /*** Start of inlined file: juce_Viewport.h ***/
  10973. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10974. #define __JUCE_VIEWPORT_JUCEHEADER__
  10975. /*** Start of inlined file: juce_ScrollBar.h ***/
  10976. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10977. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10978. /*** Start of inlined file: juce_Button.h ***/
  10979. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10980. #define __JUCE_BUTTON_JUCEHEADER__
  10981. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10982. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10983. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10984. /*** Start of inlined file: juce_TooltipClient.h ***/
  10985. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10986. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10987. class JUCE_API TooltipClient
  10988. {
  10989. public:
  10990. virtual ~TooltipClient() {}
  10991. virtual const String getTooltip() = 0;
  10992. };
  10993. class JUCE_API SettableTooltipClient : public TooltipClient
  10994. {
  10995. public:
  10996. virtual ~SettableTooltipClient() {}
  10997. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10998. virtual const String getTooltip() { return tooltipString; }
  10999. juce_UseDebuggingNewOperator
  11000. protected:
  11001. String tooltipString;
  11002. };
  11003. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11004. /*** End of inlined file: juce_TooltipClient.h ***/
  11005. class JUCE_API TooltipWindow : public Component,
  11006. private Timer
  11007. {
  11008. public:
  11009. explicit TooltipWindow (Component* parentComponent = 0,
  11010. int millisecondsBeforeTipAppears = 700);
  11011. ~TooltipWindow();
  11012. void setMillisecondsBeforeTipAppears (int newTimeMs = 700) throw();
  11013. enum ColourIds
  11014. {
  11015. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  11016. textColourId = 0x1001c00, /**< The colour to use for the text. */
  11017. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  11018. };
  11019. juce_UseDebuggingNewOperator
  11020. private:
  11021. int millisecondsBeforeTipAppears;
  11022. Point<int> lastMousePos;
  11023. int mouseClicks;
  11024. unsigned int lastCompChangeTime, lastHideTime;
  11025. Component* lastComponentUnderMouse;
  11026. bool changedCompsSinceShown;
  11027. String tipShowing, lastTipUnderMouse;
  11028. void paint (Graphics& g);
  11029. void mouseEnter (const MouseEvent& e);
  11030. void timerCallback();
  11031. static const String getTipFor (Component* c);
  11032. void showFor (const String& tip);
  11033. void hide();
  11034. TooltipWindow (const TooltipWindow&);
  11035. TooltipWindow& operator= (const TooltipWindow&);
  11036. };
  11037. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11038. /*** End of inlined file: juce_TooltipWindow.h ***/
  11039. class Button;
  11040. class JUCE_API ButtonListener
  11041. {
  11042. public:
  11043. virtual ~ButtonListener() {}
  11044. virtual void buttonClicked (Button* button) = 0;
  11045. virtual void buttonStateChanged (Button*) {}
  11046. };
  11047. class JUCE_API Button : public Component,
  11048. public SettableTooltipClient,
  11049. public ApplicationCommandManagerListener,
  11050. public Value::Listener,
  11051. private KeyListener
  11052. {
  11053. protected:
  11054. explicit Button (const String& buttonName);
  11055. public:
  11056. virtual ~Button();
  11057. void setButtonText (const String& newText);
  11058. const String getButtonText() const { return text; }
  11059. bool isDown() const throw();
  11060. bool isOver() const throw();
  11061. void setToggleState (bool shouldBeOn,
  11062. bool sendChangeNotification);
  11063. bool getToggleState() const throw() { return isOn.getValue(); }
  11064. Value& getToggleStateValue() { return isOn; }
  11065. void setClickingTogglesState (bool shouldToggle) throw();
  11066. bool getClickingTogglesState() const throw();
  11067. void setRadioGroupId (int newGroupId);
  11068. int getRadioGroupId() const throw() { return radioGroupId; }
  11069. void addButtonListener (ButtonListener* newListener);
  11070. void removeButtonListener (ButtonListener* listener);
  11071. virtual void triggerClick();
  11072. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11073. int commandID,
  11074. bool generateTooltip);
  11075. int getCommandID() const throw() { return commandID; }
  11076. void addShortcut (const KeyPress& key);
  11077. void clearShortcuts();
  11078. bool isRegisteredForShortcut (const KeyPress& key) const;
  11079. void setRepeatSpeed (int initialDelayInMillisecs,
  11080. int repeatDelayInMillisecs,
  11081. int minimumDelayInMillisecs = -1) throw();
  11082. void setTriggeredOnMouseDown (bool isTriggeredOnMouseDown) throw();
  11083. uint32 getMillisecondsSinceButtonDown() const throw();
  11084. void setVisible (bool shouldBeVisible);
  11085. void setTooltip (const String& newTooltip);
  11086. // (implementation of the TooltipClient method)
  11087. const String getTooltip();
  11088. enum ConnectedEdgeFlags
  11089. {
  11090. ConnectedOnLeft = 1,
  11091. ConnectedOnRight = 2,
  11092. ConnectedOnTop = 4,
  11093. ConnectedOnBottom = 8
  11094. };
  11095. void setConnectedEdges (int connectedEdgeFlags);
  11096. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11097. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11098. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11099. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11100. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11101. enum ButtonState
  11102. {
  11103. buttonNormal,
  11104. buttonOver,
  11105. buttonDown
  11106. };
  11107. void setState (const ButtonState newState);
  11108. juce_UseDebuggingNewOperator
  11109. protected:
  11110. virtual void clicked();
  11111. virtual void clicked (const ModifierKeys& modifiers);
  11112. virtual void paintButton (Graphics& g,
  11113. bool isMouseOverButton,
  11114. bool isButtonDown) = 0;
  11115. virtual void buttonStateChanged();
  11116. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11117. void handleCommandMessage (int commandId);
  11118. void mouseEnter (const MouseEvent& e);
  11119. void mouseExit (const MouseEvent& e);
  11120. void mouseDown (const MouseEvent& e);
  11121. void mouseDrag (const MouseEvent& e);
  11122. void mouseUp (const MouseEvent& e);
  11123. bool keyPressed (const KeyPress& key);
  11124. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11125. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  11126. void paint (Graphics& g);
  11127. void parentHierarchyChanged();
  11128. void focusGained (FocusChangeType cause);
  11129. void focusLost (FocusChangeType cause);
  11130. void enablementChanged();
  11131. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11132. void applicationCommandListChanged();
  11133. void valueChanged (Value& value);
  11134. private:
  11135. Array <KeyPress> shortcuts;
  11136. Component::SafePointer<Component> keySource;
  11137. String text;
  11138. ListenerList <ButtonListener> buttonListeners;
  11139. class RepeatTimer;
  11140. friend class RepeatTimer;
  11141. friend class ScopedPointer <RepeatTimer>;
  11142. ScopedPointer <RepeatTimer> repeatTimer;
  11143. uint32 buttonPressTime, lastTimeCallbackTime;
  11144. ApplicationCommandManager* commandManagerToUse;
  11145. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11146. int radioGroupId, commandID, connectedEdgeFlags;
  11147. ButtonState buttonState;
  11148. Value isOn;
  11149. bool lastToggleState : 1;
  11150. bool clickTogglesState : 1;
  11151. bool needsToRelease : 1;
  11152. bool needsRepainting : 1;
  11153. bool isKeyDown : 1;
  11154. bool triggerOnMouseDown : 1;
  11155. bool generateTooltip : 1;
  11156. void repeatTimerCallback();
  11157. RepeatTimer& getRepeatTimer();
  11158. ButtonState updateState (const MouseEvent* const e);
  11159. bool isShortcutPressed() const;
  11160. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11161. void flashButtonState();
  11162. void sendClickMessage (const ModifierKeys& modifiers);
  11163. void sendStateMessage();
  11164. Button (const Button&);
  11165. Button& operator= (const Button&);
  11166. };
  11167. #endif // __JUCE_BUTTON_JUCEHEADER__
  11168. /*** End of inlined file: juce_Button.h ***/
  11169. class ScrollBar;
  11170. class JUCE_API ScrollBarListener
  11171. {
  11172. public:
  11173. virtual ~ScrollBarListener() {}
  11174. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11175. double newRangeStart) = 0;
  11176. };
  11177. class JUCE_API ScrollBar : public Component,
  11178. public AsyncUpdater,
  11179. private Timer
  11180. {
  11181. public:
  11182. ScrollBar (bool isVertical,
  11183. bool buttonsAreVisible = true);
  11184. ~ScrollBar();
  11185. bool isVertical() const throw() { return vertical; }
  11186. void setOrientation (bool shouldBeVertical);
  11187. void setButtonVisibility (bool buttonsAreVisible);
  11188. void setAutoHide (bool shouldHideWhenFullRange);
  11189. void setRangeLimits (const Range<double>& newRangeLimit);
  11190. void setRangeLimits (double minimum, double maximum);
  11191. const Range<double> getRangeLimit() const throw() { return totalRange; }
  11192. double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }
  11193. double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }
  11194. void setCurrentRange (const Range<double>& newRange);
  11195. void setCurrentRange (double newStart, double newSize);
  11196. void setCurrentRangeStart (double newStart);
  11197. const Range<double> getCurrentRange() const throw() { return visibleRange; }
  11198. double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }
  11199. double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }
  11200. void setSingleStepSize (double newSingleStepSize);
  11201. void moveScrollbarInSteps (int howManySteps);
  11202. void moveScrollbarInPages (int howManyPages);
  11203. void scrollToTop();
  11204. void scrollToBottom();
  11205. void setButtonRepeatSpeed (int initialDelayInMillisecs,
  11206. int repeatDelayInMillisecs,
  11207. int minimumDelayInMillisecs = -1);
  11208. enum ColourIds
  11209. {
  11210. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11211. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11212. 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. */
  11213. };
  11214. void addListener (ScrollBarListener* listener);
  11215. void removeListener (ScrollBarListener* listener);
  11216. bool keyPressed (const KeyPress& key);
  11217. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11218. void lookAndFeelChanged();
  11219. void handleAsyncUpdate();
  11220. void mouseDown (const MouseEvent& e);
  11221. void mouseDrag (const MouseEvent& e);
  11222. void mouseUp (const MouseEvent& e);
  11223. void paint (Graphics& g);
  11224. void resized();
  11225. juce_UseDebuggingNewOperator
  11226. private:
  11227. Range <double> totalRange, visibleRange;
  11228. double singleStepSize, dragStartRange;
  11229. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11230. int dragStartMousePos, lastMousePos;
  11231. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11232. bool vertical, isDraggingThumb, alwaysVisible;
  11233. class ScrollbarButton;
  11234. ScrollbarButton* upButton;
  11235. ScrollbarButton* downButton;
  11236. ListenerList <ScrollBarListener> listeners;
  11237. void updateThumbPosition();
  11238. void timerCallback();
  11239. ScrollBar (const ScrollBar&);
  11240. ScrollBar& operator= (const ScrollBar&);
  11241. };
  11242. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11243. /*** End of inlined file: juce_ScrollBar.h ***/
  11244. class JUCE_API Viewport : public Component,
  11245. private ComponentListener,
  11246. private ScrollBarListener
  11247. {
  11248. public:
  11249. explicit Viewport (const String& componentName = String::empty);
  11250. ~Viewport();
  11251. void setViewedComponent (Component* newViewedComponent);
  11252. Component* getViewedComponent() const throw() { return contentComp; }
  11253. void setViewPosition (int xPixelsOffset, int yPixelsOffset);
  11254. void setViewPositionProportionately (double proportionX, double proportionY);
  11255. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11256. int getViewPositionX() const throw() { return lastVX; }
  11257. int getViewPositionY() const throw() { return lastVY; }
  11258. int getViewWidth() const throw() { return lastVW; }
  11259. int getViewHeight() const throw() { return lastVH; }
  11260. int getMaximumVisibleWidth() const throw();
  11261. int getMaximumVisibleHeight() const throw();
  11262. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11263. int visibleW, int visibleH);
  11264. void setScrollBarsShown (bool showVerticalScrollbarIfNeeded,
  11265. bool showHorizontalScrollbarIfNeeded);
  11266. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11267. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11268. void setScrollBarThickness (int thickness);
  11269. int getScrollBarThickness() const throw();
  11270. void setSingleStepSizes (int stepX, int stepY);
  11271. void setScrollBarButtonVisibility (bool buttonsVisible);
  11272. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11273. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11274. juce_UseDebuggingNewOperator
  11275. void resized();
  11276. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11277. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11278. bool keyPressed (const KeyPress& key);
  11279. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11280. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11281. private:
  11282. Component::SafePointer<Component> contentComp;
  11283. int lastVX, lastVY, lastVW, lastVH;
  11284. int scrollBarThickness;
  11285. int singleStepX, singleStepY;
  11286. bool showHScrollbar, showVScrollbar;
  11287. Component* contentHolder;
  11288. ScrollBar* verticalScrollBar;
  11289. ScrollBar* horizontalScrollBar;
  11290. void updateVisibleRegion();
  11291. Viewport (const Viewport&);
  11292. Viewport& operator= (const Viewport&);
  11293. };
  11294. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11295. /*** End of inlined file: juce_Viewport.h ***/
  11296. /*** Start of inlined file: juce_PopupMenu.h ***/
  11297. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11298. #define __JUCE_POPUPMENU_JUCEHEADER__
  11299. class PopupMenuCustomComponent;
  11300. class JUCE_API PopupMenu
  11301. {
  11302. public:
  11303. PopupMenu();
  11304. PopupMenu (const PopupMenu& other);
  11305. ~PopupMenu();
  11306. PopupMenu& operator= (const PopupMenu& other);
  11307. void clear();
  11308. void addItem (int itemResultId,
  11309. const String& itemText,
  11310. bool isActive = true,
  11311. bool isTicked = false,
  11312. const Image* iconToUse = 0);
  11313. void addCommandItem (ApplicationCommandManager* commandManager,
  11314. int commandID,
  11315. const String& displayName = String::empty);
  11316. void addColouredItem (int itemResultId,
  11317. const String& itemText,
  11318. const Colour& itemTextColour,
  11319. bool isActive = true,
  11320. bool isTicked = false,
  11321. const Image* iconToUse = 0);
  11322. void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent);
  11323. void addCustomItem (int itemResultId,
  11324. Component* customComponent,
  11325. int idealWidth, int idealHeight,
  11326. bool triggerMenuItemAutomaticallyWhenClicked);
  11327. void addSubMenu (const String& subMenuName,
  11328. const PopupMenu& subMenu,
  11329. bool isActive = true,
  11330. Image* iconToUse = 0,
  11331. bool isTicked = false);
  11332. void addSeparator();
  11333. void addSectionHeader (const String& title);
  11334. int getNumItems() const throw();
  11335. bool containsCommandItem (int commandID) const;
  11336. bool containsAnyActiveItems() const throw();
  11337. int show (int itemIdThatMustBeVisible = 0,
  11338. int minimumWidth = 0,
  11339. int maximumNumColumns = 0,
  11340. int standardItemHeight = 0);
  11341. int showAt (int screenX,
  11342. int screenY,
  11343. int itemIdThatMustBeVisible = 0,
  11344. int minimumWidth = 0,
  11345. int maximumNumColumns = 0,
  11346. int standardItemHeight = 0);
  11347. int showAt (Component* componentToAttachTo,
  11348. int itemIdThatMustBeVisible = 0,
  11349. int minimumWidth = 0,
  11350. int maximumNumColumns = 0,
  11351. int standardItemHeight = 0);
  11352. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11353. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  11354. enum ColourIds
  11355. {
  11356. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11357. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11358. colour is specified when the item is added). */
  11359. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11360. addSectionHeader() method). */
  11361. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11362. highlighted menu item. */
  11363. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11364. highlighted item. */
  11365. };
  11366. class JUCE_API MenuItemIterator
  11367. {
  11368. public:
  11369. MenuItemIterator (const PopupMenu& menu);
  11370. ~MenuItemIterator();
  11371. bool next();
  11372. String itemName;
  11373. const PopupMenu* subMenu;
  11374. int itemId;
  11375. bool isSeparator;
  11376. bool isTicked;
  11377. bool isEnabled;
  11378. bool isCustomComponent;
  11379. bool isSectionHeader;
  11380. const Colour* customColour;
  11381. const Image* customImage;
  11382. ApplicationCommandManager* commandManager;
  11383. juce_UseDebuggingNewOperator
  11384. private:
  11385. const PopupMenu& menu;
  11386. int index;
  11387. MenuItemIterator (const MenuItemIterator&);
  11388. MenuItemIterator& operator= (const MenuItemIterator&);
  11389. };
  11390. juce_UseDebuggingNewOperator
  11391. private:
  11392. class Item;
  11393. class ItemComponent;
  11394. class Window;
  11395. friend class MenuItemIterator;
  11396. friend class ItemComponent;
  11397. friend class Window;
  11398. friend class PopupMenuCustomComponent;
  11399. friend class OwnedArray <Item>;
  11400. friend class ScopedPointer <Window>;
  11401. OwnedArray <Item> items;
  11402. LookAndFeel* lookAndFeel;
  11403. bool separatorPending;
  11404. void addSeparatorIfPending();
  11405. int showMenu (int x, int y, int w, int h,
  11406. int itemIdThatMustBeVisible,
  11407. int minimumWidth,
  11408. int maximumNumColumns,
  11409. int standardItemHeight,
  11410. bool alignToRectangle,
  11411. Component* componentAttachedTo);
  11412. friend class MenuBarComponent;
  11413. Component* createMenuComponent (int x, int y, int w, int h,
  11414. int itemIdThatMustBeVisible,
  11415. int minimumWidth,
  11416. int maximumNumColumns,
  11417. int standardItemHeight,
  11418. bool alignToRectangle,
  11419. Component* menuBarComponent,
  11420. ApplicationCommandManager** managerOfChosenCommand,
  11421. Component* componentAttachedTo);
  11422. };
  11423. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11424. /*** End of inlined file: juce_PopupMenu.h ***/
  11425. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11426. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11427. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11428. class JUCE_API TextInputTarget
  11429. {
  11430. public:
  11431. TextInputTarget() {}
  11432. virtual ~TextInputTarget() {}
  11433. virtual const Range<int> getHighlightedRegion() const = 0;
  11434. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11435. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11436. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11437. };
  11438. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11439. /*** End of inlined file: juce_TextInputTarget.h ***/
  11440. class TextEditor;
  11441. class JUCE_API TextEditorListener
  11442. {
  11443. public:
  11444. virtual ~TextEditorListener() {}
  11445. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11446. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11447. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11448. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11449. };
  11450. class JUCE_API TextEditor : public Component,
  11451. public TextInputTarget,
  11452. public SettableTooltipClient
  11453. {
  11454. public:
  11455. explicit TextEditor (const String& componentName = String::empty,
  11456. juce_wchar passwordCharacter = 0);
  11457. virtual ~TextEditor();
  11458. void setMultiLine (bool shouldBeMultiLine,
  11459. bool shouldWordWrap = true);
  11460. bool isMultiLine() const;
  11461. void setReturnKeyStartsNewLine (bool shouldStartNewLine);
  11462. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11463. void setTabKeyUsedAsCharacter (bool shouldTabKeyBeUsed);
  11464. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11465. void setReadOnly (bool shouldBeReadOnly);
  11466. bool isReadOnly() const;
  11467. void setCaretVisible (bool shouldBeVisible);
  11468. bool isCaretVisible() const { return caretVisible; }
  11469. void setScrollbarsShown (bool shouldBeEnabled);
  11470. bool areScrollbarsShown() const { return scrollbarVisible; }
  11471. void setPasswordCharacter (juce_wchar passwordCharacter);
  11472. juce_wchar getPasswordCharacter() const { return passwordCharacter; }
  11473. void setPopupMenuEnabled (bool menuEnabled);
  11474. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11475. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11476. enum ColourIds
  11477. {
  11478. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11479. transparent if necessary. */
  11480. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11481. that because the editor can contain multiple colours, calling this
  11482. method won't change the colour of existing text - to do that, call
  11483. applyFontToAllText() after calling this method.*/
  11484. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11485. the text - this can be transparent if you don't want to show any
  11486. highlighting.*/
  11487. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11488. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11489. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11490. the edge of the component. */
  11491. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11492. the edge of the component when it has focus. */
  11493. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11494. around the edge of the editor. */
  11495. };
  11496. void setFont (const Font& newFont);
  11497. void applyFontToAllText (const Font& newFont);
  11498. const Font getFont() const;
  11499. void setSelectAllWhenFocused (bool b);
  11500. void setInputRestrictions (int maxTextLength,
  11501. const String& allowedCharacters = String::empty);
  11502. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11503. void setScrollBarThickness (int newThicknessPixels);
  11504. void setScrollBarButtonVisibility (bool buttonsVisible);
  11505. void addListener (TextEditorListener* newListener);
  11506. void removeListener (TextEditorListener* listenerToRemove);
  11507. const String getText() const;
  11508. const String getTextInRange (const Range<int>& textRange) const;
  11509. bool isEmpty() const;
  11510. void setText (const String& newText,
  11511. bool sendTextChangeMessage = true);
  11512. Value& getTextValue();
  11513. void insertTextAtCaret (const String& textToInsert);
  11514. void clear();
  11515. void cut();
  11516. void copy();
  11517. void paste();
  11518. void setCaretPosition (int newIndex);
  11519. int getCaretPosition() const;
  11520. void scrollEditorToPositionCaret (int desiredCaretX, int desiredCaretY);
  11521. const Rectangle<int> getCaretRectangle();
  11522. void setHighlightedRegion (const Range<int>& newSelection);
  11523. const Range<int> getHighlightedRegion() const { return selection; }
  11524. const String getHighlightedText() const;
  11525. int getTextIndexAt (int x, int y);
  11526. int getTotalNumChars() const;
  11527. int getTextWidth() const;
  11528. int getTextHeight() const;
  11529. void setIndents (int newLeftIndent, int newTopIndent);
  11530. void setBorder (const BorderSize& border);
  11531. const BorderSize getBorder() const;
  11532. void setScrollToShowCursor (bool shouldScrollToShowCursor);
  11533. void paint (Graphics& g);
  11534. void paintOverChildren (Graphics& g);
  11535. void mouseDown (const MouseEvent& e);
  11536. void mouseUp (const MouseEvent& e);
  11537. void mouseDrag (const MouseEvent& e);
  11538. void mouseDoubleClick (const MouseEvent& e);
  11539. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11540. bool keyPressed (const KeyPress& key);
  11541. bool keyStateChanged (bool isKeyDown);
  11542. void focusGained (FocusChangeType cause);
  11543. void focusLost (FocusChangeType cause);
  11544. void resized();
  11545. void enablementChanged();
  11546. void colourChanged();
  11547. juce_UseDebuggingNewOperator
  11548. protected:
  11549. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11550. const MouseEvent* mouseClickEvent);
  11551. virtual void performPopupMenuAction (int menuItemID);
  11552. void scrollToMakeSureCursorIsVisible();
  11553. void moveCaret (int newCaretPos);
  11554. void moveCursorTo (int newPosition, bool isSelecting);
  11555. void textChanged();
  11556. void newTransaction();
  11557. void doUndoRedo (bool isRedo);
  11558. virtual void returnPressed();
  11559. virtual void escapePressed();
  11560. void handleCommandMessage (int commandId);
  11561. private:
  11562. class Iterator;
  11563. class UniformTextSection;
  11564. class TextHolderComponent;
  11565. class InsertAction;
  11566. class RemoveAction;
  11567. friend class InsertAction;
  11568. friend class RemoveAction;
  11569. ScopedPointer <Viewport> viewport;
  11570. TextHolderComponent* textHolder;
  11571. BorderSize borderSize;
  11572. bool readOnly : 1;
  11573. bool multiline : 1;
  11574. bool wordWrap : 1;
  11575. bool returnKeyStartsNewLine : 1;
  11576. bool caretVisible : 1;
  11577. bool popupMenuEnabled : 1;
  11578. bool selectAllTextWhenFocused : 1;
  11579. bool scrollbarVisible : 1;
  11580. bool wasFocused : 1;
  11581. bool caretFlashState : 1;
  11582. bool keepCursorOnScreen : 1;
  11583. bool tabKeyUsed : 1;
  11584. bool menuActive : 1;
  11585. bool valueTextNeedsUpdating : 1;
  11586. UndoManager undoManager;
  11587. float cursorX, cursorY, cursorHeight;
  11588. int maxTextLength;
  11589. Range<int> selection;
  11590. int leftIndent, topIndent;
  11591. unsigned int lastTransactionTime;
  11592. Font currentFont;
  11593. mutable int totalNumChars;
  11594. int caretPosition;
  11595. Array <UniformTextSection*> sections;
  11596. String textToShowWhenEmpty;
  11597. Colour colourForTextWhenEmpty;
  11598. juce_wchar passwordCharacter;
  11599. Value textValue;
  11600. enum
  11601. {
  11602. notDragging,
  11603. draggingSelectionStart,
  11604. draggingSelectionEnd
  11605. } dragType;
  11606. String allowedCharacters;
  11607. ListenerList <TextEditorListener> listeners;
  11608. void coalesceSimilarSections();
  11609. void splitSection (int sectionIndex, int charToSplitAt);
  11610. void clearInternal (UndoManager* um);
  11611. void insert (const String& text, int insertIndex, const Font& font,
  11612. const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
  11613. void reinsert (int insertIndex, const Array <UniformTextSection*>& sections);
  11614. void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
  11615. void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
  11616. void updateCaretPosition();
  11617. void textWasChangedByValue();
  11618. int indexAtPosition (float x, float y);
  11619. int findWordBreakAfter (int position) const;
  11620. int findWordBreakBefore (int position) const;
  11621. friend class TextHolderComponent;
  11622. friend class TextEditorViewport;
  11623. void drawContent (Graphics& g);
  11624. void updateTextHolderSize();
  11625. float getWordWrapWidth() const;
  11626. void timerCallbackInt();
  11627. void repaintCaret();
  11628. void repaintText (const Range<int>& range);
  11629. UndoManager* getUndoManager() throw();
  11630. TextEditor (const TextEditor&);
  11631. TextEditor& operator= (const TextEditor&);
  11632. };
  11633. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11634. /*** End of inlined file: juce_TextEditor.h ***/
  11635. class Label;
  11636. class JUCE_API LabelListener
  11637. {
  11638. public:
  11639. virtual ~LabelListener() {}
  11640. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11641. };
  11642. class JUCE_API Label : public Component,
  11643. public SettableTooltipClient,
  11644. protected TextEditorListener,
  11645. private ComponentListener,
  11646. private Value::Listener
  11647. {
  11648. public:
  11649. Label (const String& componentName,
  11650. const String& labelText);
  11651. ~Label();
  11652. void setText (const String& newText,
  11653. bool broadcastChangeMessage);
  11654. const String getText (bool returnActiveEditorContents = false) const throw();
  11655. Value& getTextValue() { return textValue; }
  11656. void setFont (const Font& newFont) throw();
  11657. const Font& getFont() const throw();
  11658. enum ColourIds
  11659. {
  11660. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11661. textColourId = 0x1000281, /**< The colour for the text. */
  11662. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11663. Leave this transparent to not have an outline. */
  11664. };
  11665. void setJustificationType (const Justification& justification) throw();
  11666. const Justification getJustificationType() const throw() { return justification; }
  11667. void setBorderSize (int horizontalBorder, int verticalBorder);
  11668. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11669. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11670. void attachToComponent (Component* owner, bool onLeft);
  11671. Component* getAttachedComponent() const;
  11672. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11673. void setMinimumHorizontalScale (float newScale);
  11674. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11675. void addListener (LabelListener* listener) throw();
  11676. void removeListener (LabelListener* listener) throw();
  11677. void setEditable (bool editOnSingleClick,
  11678. bool editOnDoubleClick = false,
  11679. bool lossOfFocusDiscardsChanges = false) throw();
  11680. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11681. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11682. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11683. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11684. void showEditor();
  11685. void hideEditor (bool discardCurrentEditorContents);
  11686. bool isBeingEdited() const throw();
  11687. juce_UseDebuggingNewOperator
  11688. protected:
  11689. virtual TextEditor* createEditorComponent();
  11690. virtual void textWasEdited();
  11691. virtual void textWasChanged();
  11692. virtual void editorShown (TextEditor* editorComponent);
  11693. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11694. void paint (Graphics& g);
  11695. void resized();
  11696. void mouseUp (const MouseEvent& e);
  11697. void mouseDoubleClick (const MouseEvent& e);
  11698. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11699. void componentParentHierarchyChanged (Component& component);
  11700. void componentVisibilityChanged (Component& component);
  11701. void inputAttemptWhenModal();
  11702. void focusGained (FocusChangeType);
  11703. void enablementChanged();
  11704. KeyboardFocusTraverser* createFocusTraverser();
  11705. void textEditorTextChanged (TextEditor& editor);
  11706. void textEditorReturnKeyPressed (TextEditor& editor);
  11707. void textEditorEscapeKeyPressed (TextEditor& editor);
  11708. void textEditorFocusLost (TextEditor& editor);
  11709. void colourChanged();
  11710. void valueChanged (Value&);
  11711. private:
  11712. Value textValue;
  11713. String lastTextValue;
  11714. Font font;
  11715. Justification justification;
  11716. ScopedPointer <TextEditor> editor;
  11717. ListenerList <LabelListener> listeners;
  11718. Component::SafePointer<Component> ownerComponent;
  11719. int horizontalBorderSize, verticalBorderSize;
  11720. float minimumHorizontalScale;
  11721. bool editSingleClick : 1;
  11722. bool editDoubleClick : 1;
  11723. bool lossOfFocusDiscardsChanges : 1;
  11724. bool leftOfOwnerComp : 1;
  11725. bool updateFromTextEditorContents();
  11726. void callChangeListeners();
  11727. Label (const Label&);
  11728. Label& operator= (const Label&);
  11729. };
  11730. #endif // __JUCE_LABEL_JUCEHEADER__
  11731. /*** End of inlined file: juce_Label.h ***/
  11732. class ComboBox;
  11733. class JUCE_API ComboBoxListener
  11734. {
  11735. public:
  11736. virtual ~ComboBoxListener() {}
  11737. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11738. };
  11739. class JUCE_API ComboBox : public Component,
  11740. public SettableTooltipClient,
  11741. private LabelListener,
  11742. private AsyncUpdater,
  11743. private Value::Listener
  11744. {
  11745. public:
  11746. explicit ComboBox (const String& componentName);
  11747. ~ComboBox();
  11748. void setEditableText (bool isEditable);
  11749. bool isTextEditable() const throw();
  11750. void setJustificationType (const Justification& justification) throw();
  11751. const Justification getJustificationType() const throw();
  11752. void addItem (const String& newItemText,
  11753. int newItemId) throw();
  11754. void addSeparator() throw();
  11755. void addSectionHeading (const String& headingName) throw();
  11756. void setItemEnabled (int itemId,
  11757. bool shouldBeEnabled) throw();
  11758. void changeItemText (int itemId,
  11759. const String& newText) throw();
  11760. void clear (bool dontSendChangeMessage = false);
  11761. int getNumItems() const throw();
  11762. const String getItemText (int index) const throw();
  11763. int getItemId (int index) const throw();
  11764. int indexOfItemId (int itemId) const throw();
  11765. int getSelectedId() const throw();
  11766. Value& getSelectedIdAsValue() throw() { return currentId; }
  11767. void setSelectedId (int newItemId,
  11768. bool dontSendChangeMessage = false) throw();
  11769. int getSelectedItemIndex() const throw();
  11770. void setSelectedItemIndex (int newItemIndex,
  11771. bool dontSendChangeMessage = false) throw();
  11772. const String getText() const throw();
  11773. void setText (const String& newText,
  11774. bool dontSendChangeMessage = false) throw();
  11775. void showEditor();
  11776. void addListener (ComboBoxListener* listener) throw();
  11777. void removeListener (ComboBoxListener* listener) throw();
  11778. void setTextWhenNothingSelected (const String& newMessage) throw();
  11779. const String getTextWhenNothingSelected() const throw();
  11780. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11781. const String getTextWhenNoChoicesAvailable() const throw();
  11782. void setTooltip (const String& newTooltip);
  11783. enum ColourIds
  11784. {
  11785. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11786. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11787. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11788. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11789. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11790. };
  11791. void labelTextChanged (Label*);
  11792. void enablementChanged();
  11793. void colourChanged();
  11794. void focusGained (Component::FocusChangeType cause);
  11795. void focusLost (Component::FocusChangeType cause);
  11796. void handleAsyncUpdate();
  11797. const String getTooltip() { return label->getTooltip(); }
  11798. void mouseDown (const MouseEvent&);
  11799. void mouseDrag (const MouseEvent&);
  11800. void mouseUp (const MouseEvent&);
  11801. void lookAndFeelChanged();
  11802. void paint (Graphics&);
  11803. void resized();
  11804. bool keyStateChanged (bool isKeyDown);
  11805. bool keyPressed (const KeyPress&);
  11806. void valueChanged (Value&);
  11807. juce_UseDebuggingNewOperator
  11808. private:
  11809. struct ItemInfo
  11810. {
  11811. String name;
  11812. int itemId;
  11813. bool isEnabled : 1, isHeading : 1;
  11814. bool isSeparator() const throw();
  11815. bool isRealItem() const throw();
  11816. };
  11817. OwnedArray <ItemInfo> items;
  11818. Value currentId;
  11819. int lastCurrentId;
  11820. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11821. ListenerList <ComboBoxListener> listeners;
  11822. ScopedPointer<Label> label;
  11823. String textWhenNothingSelected, noChoicesMessage;
  11824. void showPopup();
  11825. ItemInfo* getItemForId (int itemId) const throw();
  11826. ItemInfo* getItemForIndex (int index) const throw();
  11827. ComboBox (const ComboBox&);
  11828. ComboBox& operator= (const ComboBox&);
  11829. };
  11830. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11831. /*** End of inlined file: juce_ComboBox.h ***/
  11832. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11833. {
  11834. public:
  11835. AudioDeviceManager();
  11836. ~AudioDeviceManager();
  11837. struct JUCE_API AudioDeviceSetup
  11838. {
  11839. AudioDeviceSetup();
  11840. bool operator== (const AudioDeviceSetup& other) const;
  11841. String outputDeviceName;
  11842. String inputDeviceName;
  11843. double sampleRate;
  11844. int bufferSize;
  11845. BigInteger inputChannels;
  11846. bool useDefaultInputChannels;
  11847. BigInteger outputChannels;
  11848. bool useDefaultOutputChannels;
  11849. };
  11850. const String initialise (int numInputChannelsNeeded,
  11851. int numOutputChannelsNeeded,
  11852. const XmlElement* savedState,
  11853. bool selectDefaultDeviceOnFailure,
  11854. const String& preferredDefaultDeviceName = String::empty,
  11855. const AudioDeviceSetup* preferredSetupOptions = 0);
  11856. XmlElement* createStateXml() const;
  11857. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11858. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11859. bool treatAsChosenDevice);
  11860. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11861. const String getCurrentAudioDeviceType() const { return currentDeviceType; }
  11862. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11863. void setCurrentAudioDeviceType (const String& type,
  11864. bool treatAsChosenDevice);
  11865. void closeAudioDevice();
  11866. void restartLastAudioDevice();
  11867. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11868. void removeAudioCallback (AudioIODeviceCallback* callback);
  11869. double getCpuUsage() const;
  11870. void setMidiInputEnabled (const String& midiInputDeviceName,
  11871. bool enabled);
  11872. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11873. void addMidiInputCallback (const String& midiInputDeviceName,
  11874. MidiInputCallback* callback);
  11875. void removeMidiInputCallback (const String& midiInputDeviceName,
  11876. MidiInputCallback* callback);
  11877. void setDefaultMidiOutput (const String& deviceName);
  11878. const String getDefaultMidiOutputName() const { return defaultMidiOutputName; }
  11879. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11880. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11881. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11882. void playTestSound();
  11883. void enableInputLevelMeasurement (bool enableMeasurement);
  11884. double getCurrentInputLevel() const;
  11885. juce_UseDebuggingNewOperator
  11886. private:
  11887. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11888. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11889. AudioDeviceSetup currentSetup;
  11890. ScopedPointer <AudioIODevice> currentAudioDevice;
  11891. SortedSet <AudioIODeviceCallback*> callbacks;
  11892. int numInputChansNeeded, numOutputChansNeeded;
  11893. String currentDeviceType;
  11894. BigInteger inputChannels, outputChannels;
  11895. ScopedPointer <XmlElement> lastExplicitSettings;
  11896. mutable bool listNeedsScanning;
  11897. bool useInputNames;
  11898. int inputLevelMeasurementEnabledCount;
  11899. double inputLevel;
  11900. ScopedPointer <AudioSampleBuffer> testSound;
  11901. int testSoundPosition;
  11902. AudioSampleBuffer tempBuffer;
  11903. StringArray midiInsFromXml;
  11904. OwnedArray <MidiInput> enabledMidiInputs;
  11905. Array <MidiInputCallback*> midiCallbacks;
  11906. Array <MidiInput*> midiCallbackDevices;
  11907. String defaultMidiOutputName;
  11908. ScopedPointer <MidiOutput> defaultMidiOutput;
  11909. CriticalSection audioCallbackLock, midiCallbackLock;
  11910. double cpuUsageMs, timeToCpuScale;
  11911. class CallbackHandler : public AudioIODeviceCallback,
  11912. public MidiInputCallback
  11913. {
  11914. public:
  11915. AudioDeviceManager* owner;
  11916. void audioDeviceIOCallback (const float** inputChannelData,
  11917. int totalNumInputChannels,
  11918. float** outputChannelData,
  11919. int totalNumOutputChannels,
  11920. int numSamples);
  11921. void audioDeviceAboutToStart (AudioIODevice*);
  11922. void audioDeviceStopped();
  11923. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11924. };
  11925. CallbackHandler callbackHandler;
  11926. friend class CallbackHandler;
  11927. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11928. int totalNumInputChannels,
  11929. float** outputChannelData,
  11930. int totalNumOutputChannels,
  11931. int numSamples);
  11932. void audioDeviceAboutToStartInt (AudioIODevice* device);
  11933. void audioDeviceStoppedInt();
  11934. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11935. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11936. const BigInteger& ins, const BigInteger& outs);
  11937. void stopDevice();
  11938. void updateXml();
  11939. void createDeviceTypesIfNeeded();
  11940. void scanDevicesIfNeeded();
  11941. void deleteCurrentDevice();
  11942. double chooseBestSampleRate (double preferred) const;
  11943. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11944. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11945. AudioDeviceManager (const AudioDeviceManager&);
  11946. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11947. };
  11948. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11949. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11950. #endif
  11951. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11952. #endif
  11953. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11954. #endif
  11955. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11956. #endif
  11957. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11958. #endif
  11959. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11960. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11961. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11962. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11963. class JUCE_API AudioDataConverters
  11964. {
  11965. public:
  11966. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  11967. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  11968. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  11969. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  11970. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11971. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11972. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11973. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11974. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  11975. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  11976. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  11977. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  11978. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11979. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11980. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11981. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11982. enum DataFormat
  11983. {
  11984. int16LE,
  11985. int16BE,
  11986. int24LE,
  11987. int24BE,
  11988. int32LE,
  11989. int32BE,
  11990. float32LE,
  11991. float32BE,
  11992. };
  11993. static void convertFloatToFormat (DataFormat destFormat,
  11994. const float* source, void* dest, int numSamples);
  11995. static void convertFormatToFloat (DataFormat sourceFormat,
  11996. const void* source, float* dest, int numSamples);
  11997. static void interleaveSamples (const float** source, float* dest,
  11998. int numSamples, int numChannels);
  11999. static void deinterleaveSamples (const float* source, float** dest,
  12000. int numSamples, int numChannels);
  12001. private:
  12002. AudioDataConverters();
  12003. AudioDataConverters (const AudioDataConverters&);
  12004. AudioDataConverters& operator= (const AudioDataConverters&);
  12005. };
  12006. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12007. /*** End of inlined file: juce_AudioDataConverters.h ***/
  12008. #endif
  12009. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  12010. #endif
  12011. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  12012. #endif
  12013. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  12014. #endif
  12015. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12016. /*** Start of inlined file: juce_MidiFile.h ***/
  12017. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12018. #define __JUCE_MIDIFILE_JUCEHEADER__
  12019. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  12020. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12021. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12022. class JUCE_API MidiMessageSequence
  12023. {
  12024. public:
  12025. MidiMessageSequence();
  12026. MidiMessageSequence (const MidiMessageSequence& other);
  12027. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  12028. ~MidiMessageSequence();
  12029. class MidiEventHolder
  12030. {
  12031. public:
  12032. ~MidiEventHolder();
  12033. MidiMessage message;
  12034. MidiEventHolder* noteOffObject;
  12035. juce_UseDebuggingNewOperator
  12036. private:
  12037. friend class MidiMessageSequence;
  12038. MidiEventHolder (const MidiMessage& message);
  12039. };
  12040. void clear();
  12041. int getNumEvents() const;
  12042. MidiEventHolder* getEventPointer (int index) const;
  12043. double getTimeOfMatchingKeyUp (int index) const;
  12044. int getIndexOfMatchingKeyUp (int index) const;
  12045. int getIndexOf (MidiEventHolder* event) const;
  12046. int getNextIndexAtTime (double timeStamp) const;
  12047. double getStartTime() const;
  12048. double getEndTime() const;
  12049. double getEventTime (int index) const;
  12050. void addEvent (const MidiMessage& newMessage,
  12051. double timeAdjustment = 0);
  12052. void deleteEvent (int index, bool deleteMatchingNoteUp);
  12053. void addSequence (const MidiMessageSequence& other,
  12054. double timeAdjustmentDelta,
  12055. double firstAllowableDestTime,
  12056. double endOfAllowableDestTimes);
  12057. void updateMatchedPairs();
  12058. void extractMidiChannelMessages (int channelNumberToExtract,
  12059. MidiMessageSequence& destSequence,
  12060. bool alsoIncludeMetaEvents) const;
  12061. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12062. void deleteMidiChannelMessages (int channelNumberToRemove);
  12063. void deleteSysExMessages();
  12064. void addTimeToMessages (double deltaTime);
  12065. void createControllerUpdatesForTime (int channelNumber, double time,
  12066. OwnedArray<MidiMessage>& resultMessages);
  12067. void swapWith (MidiMessageSequence& other) throw();
  12068. juce_UseDebuggingNewOperator
  12069. static int compareElements (const MidiMessageSequence::MidiEventHolder* first,
  12070. const MidiMessageSequence::MidiEventHolder* second) throw();
  12071. private:
  12072. friend class MidiFile;
  12073. OwnedArray <MidiEventHolder> list;
  12074. void sort();
  12075. };
  12076. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12077. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12078. class JUCE_API MidiFile
  12079. {
  12080. public:
  12081. MidiFile();
  12082. ~MidiFile();
  12083. int getNumTracks() const throw();
  12084. const MidiMessageSequence* getTrack (const int index) const throw();
  12085. void addTrack (const MidiMessageSequence& trackSequence);
  12086. void clear();
  12087. short getTimeFormat() const throw();
  12088. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12089. void setSmpteTimeFormat (const int framesPerSecond,
  12090. const int subframeResolution) throw();
  12091. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12092. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12093. double getLastTimestamp() const;
  12094. bool readFrom (InputStream& sourceStream);
  12095. bool writeTo (OutputStream& destStream);
  12096. void convertTimestampTicksToSeconds();
  12097. juce_UseDebuggingNewOperator
  12098. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12099. const MidiMessageSequence::MidiEventHolder* const second);
  12100. private:
  12101. OwnedArray <MidiMessageSequence> tracks;
  12102. short timeFormat;
  12103. MidiFile (const MidiFile&);
  12104. MidiFile& operator= (const MidiFile&);
  12105. void readNextTrack (const uint8* data, int size);
  12106. void writeTrack (OutputStream& mainOut, const int trackNum);
  12107. };
  12108. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12109. /*** End of inlined file: juce_MidiFile.h ***/
  12110. #endif
  12111. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12112. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12113. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12114. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12115. class MidiKeyboardState;
  12116. class JUCE_API MidiKeyboardStateListener
  12117. {
  12118. public:
  12119. MidiKeyboardStateListener() throw() {}
  12120. virtual ~MidiKeyboardStateListener() {}
  12121. virtual void handleNoteOn (MidiKeyboardState* source,
  12122. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12123. virtual void handleNoteOff (MidiKeyboardState* source,
  12124. int midiChannel, int midiNoteNumber) = 0;
  12125. };
  12126. class JUCE_API MidiKeyboardState
  12127. {
  12128. public:
  12129. MidiKeyboardState();
  12130. ~MidiKeyboardState();
  12131. void reset();
  12132. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12133. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12134. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12135. void noteOff (const int midiChannel, const int midiNoteNumber);
  12136. void allNotesOff (const int midiChannel);
  12137. void processNextMidiEvent (const MidiMessage& message);
  12138. void processNextMidiBuffer (MidiBuffer& buffer,
  12139. const int startSample,
  12140. const int numSamples,
  12141. const bool injectIndirectEvents);
  12142. void addListener (MidiKeyboardStateListener* const listener) throw();
  12143. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12144. juce_UseDebuggingNewOperator
  12145. private:
  12146. CriticalSection lock;
  12147. uint16 noteStates [128];
  12148. MidiBuffer eventsToAdd;
  12149. Array <MidiKeyboardStateListener*> listeners;
  12150. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12151. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12152. MidiKeyboardState (const MidiKeyboardState&);
  12153. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12154. };
  12155. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12156. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12157. #endif
  12158. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12159. #endif
  12160. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12161. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12162. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12163. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12164. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12165. public MidiInputCallback
  12166. {
  12167. public:
  12168. MidiMessageCollector();
  12169. ~MidiMessageCollector();
  12170. void reset (double sampleRate);
  12171. void addMessageToQueue (const MidiMessage& message);
  12172. void removeNextBlockOfMessages (MidiBuffer& destBuffer, int numSamples);
  12173. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12174. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12175. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12176. juce_UseDebuggingNewOperator
  12177. private:
  12178. double lastCallbackTime;
  12179. CriticalSection midiCallbackLock;
  12180. MidiBuffer incomingMessages;
  12181. double sampleRate;
  12182. MidiMessageCollector (const MidiMessageCollector&);
  12183. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12184. };
  12185. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12186. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12187. #endif
  12188. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12189. #endif
  12190. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12191. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12192. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12193. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12194. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12195. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12196. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12197. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12198. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12199. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12200. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12201. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12202. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12203. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12204. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12205. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12206. class AudioProcessor;
  12207. class JUCE_API AudioProcessorEditor : public Component
  12208. {
  12209. protected:
  12210. AudioProcessorEditor (AudioProcessor* const owner);
  12211. public:
  12212. ~AudioProcessorEditor();
  12213. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12214. private:
  12215. AudioProcessor* const owner;
  12216. AudioProcessorEditor (const AudioProcessorEditor&);
  12217. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12218. };
  12219. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12220. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12221. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12222. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12223. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12224. class AudioProcessor;
  12225. class JUCE_API AudioProcessorListener
  12226. {
  12227. public:
  12228. virtual ~AudioProcessorListener() {}
  12229. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12230. int parameterIndex,
  12231. float newValue) = 0;
  12232. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12233. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12234. int parameterIndex);
  12235. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12236. int parameterIndex);
  12237. };
  12238. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12239. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12240. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12241. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12242. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12243. class JUCE_API AudioPlayHead
  12244. {
  12245. protected:
  12246. AudioPlayHead() {}
  12247. public:
  12248. virtual ~AudioPlayHead() {}
  12249. enum FrameRateType
  12250. {
  12251. fps24 = 0,
  12252. fps25 = 1,
  12253. fps2997 = 2,
  12254. fps30 = 3,
  12255. fps2997drop = 4,
  12256. fps30drop = 5,
  12257. fpsUnknown = 99
  12258. };
  12259. struct CurrentPositionInfo
  12260. {
  12261. double bpm;
  12262. int timeSigNumerator;
  12263. int timeSigDenominator;
  12264. double timeInSeconds;
  12265. double editOriginTime;
  12266. double ppqPosition;
  12267. double ppqPositionOfLastBarStart;
  12268. FrameRateType frameRate;
  12269. bool isPlaying;
  12270. bool isRecording;
  12271. bool operator== (const CurrentPositionInfo& other) const throw();
  12272. bool operator!= (const CurrentPositionInfo& other) const throw();
  12273. void resetToDefault();
  12274. };
  12275. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12276. };
  12277. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12278. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12279. class JUCE_API AudioProcessor
  12280. {
  12281. protected:
  12282. AudioProcessor();
  12283. public:
  12284. virtual ~AudioProcessor();
  12285. virtual const String getName() const = 0;
  12286. virtual void prepareToPlay (double sampleRate,
  12287. int estimatedSamplesPerBlock) = 0;
  12288. virtual void releaseResources() = 0;
  12289. virtual void processBlock (AudioSampleBuffer& buffer,
  12290. MidiBuffer& midiMessages) = 0;
  12291. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12292. double getSampleRate() const throw() { return sampleRate; }
  12293. int getBlockSize() const throw() { return blockSize; }
  12294. int getNumInputChannels() const throw() { return numInputChannels; }
  12295. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12296. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12297. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12298. virtual bool isInputChannelStereoPair (int index) const = 0;
  12299. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12300. int getLatencySamples() const throw() { return latencySamples; }
  12301. void setLatencySamples (const int newLatency);
  12302. virtual bool acceptsMidi() const = 0;
  12303. virtual bool producesMidi() const = 0;
  12304. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12305. void suspendProcessing (const bool shouldBeSuspended);
  12306. bool isSuspended() const throw() { return suspended; }
  12307. virtual void reset();
  12308. bool isNonRealtime() const throw() { return nonRealtime; }
  12309. void setNonRealtime (const bool isNonRealtime) throw();
  12310. virtual AudioProcessorEditor* createEditor() = 0;
  12311. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12312. AudioProcessorEditor* createEditorIfNeeded();
  12313. virtual int getNumParameters() = 0;
  12314. virtual const String getParameterName (int parameterIndex) = 0;
  12315. virtual float getParameter (int parameterIndex) = 0;
  12316. virtual const String getParameterText (int parameterIndex) = 0;
  12317. virtual void setParameter (int parameterIndex,
  12318. float newValue) = 0;
  12319. void setParameterNotifyingHost (int parameterIndex,
  12320. float newValue);
  12321. virtual bool isParameterAutomatable (int parameterIndex) const;
  12322. virtual bool isMetaParameter (int parameterIndex) const;
  12323. void beginParameterChangeGesture (int parameterIndex);
  12324. void endParameterChangeGesture (int parameterIndex);
  12325. void updateHostDisplay();
  12326. virtual int getNumPrograms() = 0;
  12327. virtual int getCurrentProgram() = 0;
  12328. virtual void setCurrentProgram (int index) = 0;
  12329. virtual const String getProgramName (int index) = 0;
  12330. virtual void changeProgramName (int index, const String& newName) = 0;
  12331. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12332. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12333. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12334. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12335. void addListener (AudioProcessorListener* const newListener) throw();
  12336. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12337. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12338. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12339. void setPlayConfigDetails (const int numIns, const int numOuts,
  12340. const double sampleRate,
  12341. const int blockSize) throw();
  12342. juce_UseDebuggingNewOperator
  12343. protected:
  12344. static void copyXmlToBinary (const XmlElement& xml,
  12345. JUCE_NAMESPACE::MemoryBlock& destData);
  12346. static XmlElement* getXmlFromBinary (const void* data,
  12347. const int sizeInBytes);
  12348. AudioPlayHead* playHead;
  12349. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12350. private:
  12351. VoidArray listeners;
  12352. AudioProcessorEditor* activeEditor;
  12353. double sampleRate;
  12354. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12355. bool suspended, nonRealtime;
  12356. CriticalSection callbackLock, listenerLock;
  12357. #ifdef JUCE_DEBUG
  12358. BigInteger changingParams;
  12359. #endif
  12360. AudioProcessor (const AudioProcessor&);
  12361. AudioProcessor& operator= (const AudioProcessor&);
  12362. };
  12363. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12364. /*** End of inlined file: juce_AudioProcessor.h ***/
  12365. /*** Start of inlined file: juce_PluginDescription.h ***/
  12366. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12367. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12368. class JUCE_API PluginDescription
  12369. {
  12370. public:
  12371. PluginDescription() throw();
  12372. PluginDescription (const PluginDescription& other) throw();
  12373. PluginDescription& operator= (const PluginDescription& other) throw();
  12374. ~PluginDescription() throw();
  12375. String name;
  12376. String pluginFormatName;
  12377. String category;
  12378. String manufacturerName;
  12379. String version;
  12380. String fileOrIdentifier;
  12381. Time lastFileModTime;
  12382. int uid;
  12383. bool isInstrument;
  12384. int numInputChannels;
  12385. int numOutputChannels;
  12386. bool isDuplicateOf (const PluginDescription& other) const;
  12387. const String createIdentifierString() const throw();
  12388. XmlElement* createXml() const;
  12389. bool loadFromXml (const XmlElement& xml);
  12390. juce_UseDebuggingNewOperator
  12391. };
  12392. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12393. /*** End of inlined file: juce_PluginDescription.h ***/
  12394. class JUCE_API AudioPluginInstance : public AudioProcessor
  12395. {
  12396. public:
  12397. virtual ~AudioPluginInstance();
  12398. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12399. juce_UseDebuggingNewOperator
  12400. protected:
  12401. AudioPluginInstance();
  12402. AudioPluginInstance (const AudioPluginInstance&);
  12403. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12404. };
  12405. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12406. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12407. class PluginDescription;
  12408. class JUCE_API AudioPluginFormat
  12409. {
  12410. public:
  12411. virtual ~AudioPluginFormat();
  12412. virtual const String getName() const = 0;
  12413. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12414. const String& fileOrIdentifier) = 0;
  12415. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12416. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12417. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12418. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12419. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12420. bool recursive) = 0;
  12421. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12422. juce_UseDebuggingNewOperator
  12423. protected:
  12424. AudioPluginFormat() throw();
  12425. AudioPluginFormat (const AudioPluginFormat&);
  12426. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12427. };
  12428. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12429. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12430. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12431. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12432. {
  12433. public:
  12434. AudioUnitPluginFormat();
  12435. ~AudioUnitPluginFormat();
  12436. const String getName() const { return "AudioUnit"; }
  12437. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12438. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12439. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12440. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12441. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12442. bool doesPluginStillExist (const PluginDescription& desc);
  12443. const FileSearchPath getDefaultLocationsToSearch();
  12444. juce_UseDebuggingNewOperator
  12445. private:
  12446. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12447. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12448. };
  12449. #endif
  12450. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12451. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12452. #endif
  12453. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12454. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12455. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12456. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12457. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12458. // Sorry, this file is just a placeholder at the moment!...
  12459. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12460. {
  12461. public:
  12462. DirectXPluginFormat();
  12463. ~DirectXPluginFormat();
  12464. const String getName() const { return "DirectX"; }
  12465. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12466. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12467. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12468. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12469. const FileSearchPath getDefaultLocationsToSearch();
  12470. juce_UseDebuggingNewOperator
  12471. private:
  12472. DirectXPluginFormat (const DirectXPluginFormat&);
  12473. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12474. };
  12475. #endif
  12476. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12477. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12478. #endif
  12479. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12480. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12481. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12482. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12483. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12484. // Sorry, this file is just a placeholder at the moment!...
  12485. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12486. {
  12487. public:
  12488. LADSPAPluginFormat();
  12489. ~LADSPAPluginFormat();
  12490. const String getName() const { return "LADSPA"; }
  12491. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12492. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12493. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12494. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12495. const FileSearchPath getDefaultLocationsToSearch();
  12496. juce_UseDebuggingNewOperator
  12497. private:
  12498. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12499. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12500. };
  12501. #endif
  12502. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12503. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12504. #endif
  12505. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12506. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12507. #ifdef __aeffect__
  12508. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12509. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12510. class VSTMidiEventList
  12511. {
  12512. public:
  12513. VSTMidiEventList()
  12514. : numEventsUsed (0), numEventsAllocated (0)
  12515. {
  12516. }
  12517. ~VSTMidiEventList()
  12518. {
  12519. freeEvents();
  12520. }
  12521. void clear()
  12522. {
  12523. numEventsUsed = 0;
  12524. if (events != 0)
  12525. events->numEvents = 0;
  12526. }
  12527. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12528. {
  12529. ensureSize (numEventsUsed + 1);
  12530. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12531. events->numEvents = ++numEventsUsed;
  12532. if (numBytes <= 4)
  12533. {
  12534. if (e->type == kVstSysExType)
  12535. {
  12536. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12537. e->type = kVstMidiType;
  12538. e->byteSize = sizeof (VstMidiEvent);
  12539. e->noteLength = 0;
  12540. e->noteOffset = 0;
  12541. e->detune = 0;
  12542. e->noteOffVelocity = 0;
  12543. }
  12544. e->deltaFrames = frameOffset;
  12545. memcpy (e->midiData, midiData, numBytes);
  12546. }
  12547. else
  12548. {
  12549. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12550. if (se->type == kVstSysExType)
  12551. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12552. else
  12553. se->sysexDump = (char*) juce_malloc (numBytes);
  12554. memcpy (se->sysexDump, midiData, numBytes);
  12555. se->type = kVstSysExType;
  12556. se->byteSize = sizeof (VstMidiSysexEvent);
  12557. se->deltaFrames = frameOffset;
  12558. se->flags = 0;
  12559. se->dumpBytes = numBytes;
  12560. se->resvd1 = 0;
  12561. se->resvd2 = 0;
  12562. }
  12563. }
  12564. // Handy method to pull the events out of an event buffer supplied by the host
  12565. // or plugin.
  12566. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12567. {
  12568. for (int i = 0; i < events->numEvents; ++i)
  12569. {
  12570. const VstEvent* const e = events->events[i];
  12571. if (e != 0)
  12572. {
  12573. if (e->type == kVstMidiType)
  12574. {
  12575. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12576. 4, e->deltaFrames);
  12577. }
  12578. else if (e->type == kVstSysExType)
  12579. {
  12580. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12581. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12582. e->deltaFrames);
  12583. }
  12584. }
  12585. }
  12586. }
  12587. void ensureSize (int numEventsNeeded)
  12588. {
  12589. if (numEventsNeeded > numEventsAllocated)
  12590. {
  12591. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12592. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12593. if (events == 0)
  12594. events.calloc (size, 1);
  12595. else
  12596. events.realloc (size, 1);
  12597. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12598. {
  12599. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12600. (int) sizeof (VstMidiSysexEvent)));
  12601. e->type = kVstMidiType;
  12602. e->byteSize = sizeof (VstMidiEvent);
  12603. events->events[i] = (VstEvent*) e;
  12604. }
  12605. numEventsAllocated = numEventsNeeded;
  12606. }
  12607. }
  12608. void freeEvents()
  12609. {
  12610. if (events != 0)
  12611. {
  12612. for (int i = numEventsAllocated; --i >= 0;)
  12613. {
  12614. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12615. if (e->type == kVstSysExType)
  12616. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12617. juce_free (e);
  12618. }
  12619. events.free();
  12620. numEventsUsed = 0;
  12621. numEventsAllocated = 0;
  12622. }
  12623. }
  12624. HeapBlock <VstEvents> events;
  12625. private:
  12626. int numEventsUsed, numEventsAllocated;
  12627. };
  12628. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12629. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12630. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12631. #endif
  12632. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12633. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12634. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12635. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12636. #if JUCE_PLUGINHOST_VST
  12637. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12638. {
  12639. public:
  12640. VSTPluginFormat();
  12641. ~VSTPluginFormat();
  12642. const String getName() const { return "VST"; }
  12643. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12644. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12645. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12646. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12647. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12648. bool doesPluginStillExist (const PluginDescription& desc);
  12649. const FileSearchPath getDefaultLocationsToSearch();
  12650. juce_UseDebuggingNewOperator
  12651. private:
  12652. VSTPluginFormat (const VSTPluginFormat&);
  12653. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12654. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12655. };
  12656. #endif
  12657. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12658. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12659. #endif
  12660. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12661. #endif
  12662. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12663. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12664. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12665. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12666. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12667. {
  12668. public:
  12669. AudioPluginFormatManager() throw();
  12670. ~AudioPluginFormatManager() throw();
  12671. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12672. void addDefaultFormats();
  12673. int getNumFormats() throw();
  12674. AudioPluginFormat* getFormat (const int index) throw();
  12675. void addFormat (AudioPluginFormat* const format) throw();
  12676. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12677. String& errorMessage) const;
  12678. bool doesPluginStillExist (const PluginDescription& description) const;
  12679. juce_UseDebuggingNewOperator
  12680. private:
  12681. OwnedArray <AudioPluginFormat> formats;
  12682. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12683. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12684. };
  12685. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12686. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12687. #endif
  12688. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12689. #endif
  12690. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12691. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12692. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12693. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12694. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12695. {
  12696. public:
  12697. KnownPluginList();
  12698. ~KnownPluginList();
  12699. void clear();
  12700. int getNumTypes() const throw() { return types.size(); }
  12701. PluginDescription* getType (int index) const throw() { return types [index]; }
  12702. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12703. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12704. bool addType (const PluginDescription& type);
  12705. void removeType (int index) throw();
  12706. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12707. bool dontRescanIfAlreadyInList,
  12708. OwnedArray <PluginDescription>& typesFound,
  12709. AudioPluginFormat& formatToUse);
  12710. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12711. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12712. OwnedArray <PluginDescription>& typesFound);
  12713. enum SortMethod
  12714. {
  12715. defaultOrder = 0,
  12716. sortAlphabetically,
  12717. sortByCategory,
  12718. sortByManufacturer,
  12719. sortByFileSystemLocation
  12720. };
  12721. void addToMenu (PopupMenu& menu,
  12722. const SortMethod sortMethod) const;
  12723. int getIndexChosenByMenu (int menuResultCode) const;
  12724. void sort (const SortMethod method);
  12725. XmlElement* createXml() const;
  12726. void recreateFromXml (const XmlElement& xml);
  12727. juce_UseDebuggingNewOperator
  12728. private:
  12729. OwnedArray <PluginDescription> types;
  12730. KnownPluginList (const KnownPluginList&);
  12731. KnownPluginList& operator= (const KnownPluginList&);
  12732. };
  12733. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12734. /*** End of inlined file: juce_KnownPluginList.h ***/
  12735. #endif
  12736. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12737. #endif
  12738. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12739. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12740. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12741. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12742. class JUCE_API PluginDirectoryScanner
  12743. {
  12744. public:
  12745. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12746. AudioPluginFormat& formatToLookFor,
  12747. FileSearchPath directoriesToSearch,
  12748. bool searchRecursively,
  12749. const File& deadMansPedalFile);
  12750. ~PluginDirectoryScanner();
  12751. bool scanNextFile (bool dontRescanIfAlreadyInList);
  12752. const String getNextPluginFileThatWillBeScanned() const throw();
  12753. float getProgress() const { return progress; }
  12754. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12755. juce_UseDebuggingNewOperator
  12756. private:
  12757. KnownPluginList& list;
  12758. AudioPluginFormat& format;
  12759. StringArray filesOrIdentifiersToScan;
  12760. File deadMansPedalFile;
  12761. StringArray failedFiles;
  12762. int nextIndex;
  12763. float progress;
  12764. const StringArray getDeadMansPedalFile() throw();
  12765. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12766. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12767. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12768. };
  12769. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12770. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12771. #endif
  12772. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12773. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12774. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12775. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12776. /*** Start of inlined file: juce_ListBox.h ***/
  12777. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12778. #define __JUCE_LISTBOX_JUCEHEADER__
  12779. class ListViewport;
  12780. class JUCE_API ListBoxModel
  12781. {
  12782. public:
  12783. virtual ~ListBoxModel() {}
  12784. virtual int getNumRows() = 0;
  12785. virtual void paintListBoxItem (int rowNumber,
  12786. Graphics& g,
  12787. int width, int height,
  12788. bool rowIsSelected) = 0;
  12789. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12790. Component* existingComponentToUpdate);
  12791. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12792. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12793. virtual void backgroundClicked();
  12794. virtual void selectedRowsChanged (int lastRowSelected);
  12795. virtual void deleteKeyPressed (int lastRowSelected);
  12796. virtual void returnKeyPressed (int lastRowSelected);
  12797. virtual void listWasScrolled();
  12798. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12799. virtual const String getTooltipForRow (int row);
  12800. };
  12801. class JUCE_API ListBox : public Component,
  12802. public SettableTooltipClient
  12803. {
  12804. public:
  12805. ListBox (const String& componentName,
  12806. ListBoxModel* model);
  12807. ~ListBox();
  12808. void setModel (ListBoxModel* newModel);
  12809. ListBoxModel* getModel() const throw() { return model; }
  12810. void updateContent();
  12811. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12812. void setMouseMoveSelectsRows (bool shouldSelect);
  12813. void selectRow (int rowNumber,
  12814. bool dontScrollToShowThisRow = false,
  12815. bool deselectOthersFirst = true);
  12816. void selectRangeOfRows (int firstRow,
  12817. int lastRow);
  12818. void deselectRow (int rowNumber);
  12819. void deselectAllRows();
  12820. void flipRowSelection (int rowNumber);
  12821. const SparseSet<int> getSelectedRows() const;
  12822. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12823. bool sendNotificationEventToModel = true);
  12824. bool isRowSelected (int rowNumber) const;
  12825. int getNumSelectedRows() const;
  12826. int getSelectedRow (int index = 0) const;
  12827. int getLastRowSelected() const;
  12828. void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn,
  12829. const ModifierKeys& modifiers);
  12830. void setVerticalPosition (double newProportion);
  12831. double getVerticalPosition() const;
  12832. void scrollToEnsureRowIsOnscreen (int row);
  12833. ScrollBar* getVerticalScrollBar() const throw();
  12834. ScrollBar* getHorizontalScrollBar() const throw();
  12835. int getRowContainingPosition (int x, int y) const throw();
  12836. int getInsertionIndexForPosition (int x, int y) const throw();
  12837. const Rectangle<int> getRowPosition (int rowNumber,
  12838. bool relativeToComponentTopLeft) const throw();
  12839. Component* getComponentForRowNumber (int rowNumber) const throw();
  12840. int getRowNumberOfComponent (Component* rowComponent) const throw();
  12841. int getVisibleRowWidth() const throw();
  12842. void setRowHeight (int newHeight);
  12843. int getRowHeight() const throw() { return rowHeight; }
  12844. int getNumRowsOnScreen() const throw();
  12845. enum ColourIds
  12846. {
  12847. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12848. Make this transparent if you don't want the background to be filled. */
  12849. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12850. Make this transparent to not have an outline. */
  12851. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12852. };
  12853. void setOutlineThickness (int outlineThickness);
  12854. int getOutlineThickness() const throw() { return outlineThickness; }
  12855. void setHeaderComponent (Component* newHeaderComponent);
  12856. void setMinimumContentWidth (int newMinimumWidth);
  12857. int getVisibleContentWidth() const throw();
  12858. void repaintRow (int rowNumber) throw();
  12859. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12860. Viewport* getViewport() const throw();
  12861. bool keyPressed (const KeyPress& key);
  12862. bool keyStateChanged (bool isKeyDown);
  12863. void paint (Graphics& g);
  12864. void paintOverChildren (Graphics& g);
  12865. void resized();
  12866. void visibilityChanged();
  12867. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12868. void mouseMove (const MouseEvent&);
  12869. void mouseExit (const MouseEvent&);
  12870. void mouseUp (const MouseEvent&);
  12871. void colourChanged();
  12872. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12873. juce_UseDebuggingNewOperator
  12874. private:
  12875. friend class ListViewport;
  12876. friend class TableListBox;
  12877. ListBoxModel* model;
  12878. ListViewport* viewport;
  12879. Component* headerComponent;
  12880. int totalItems, rowHeight, minimumRowWidth;
  12881. int outlineThickness;
  12882. int lastRowSelected;
  12883. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12884. SparseSet <int> selected;
  12885. void selectRowInternal (int rowNumber,
  12886. bool dontScrollToShowThisRow,
  12887. bool deselectOthersFirst,
  12888. bool isMouseClick);
  12889. ListBox (const ListBox&);
  12890. ListBox& operator= (const ListBox&);
  12891. };
  12892. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12893. /*** End of inlined file: juce_ListBox.h ***/
  12894. /*** Start of inlined file: juce_TextButton.h ***/
  12895. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12896. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12897. class JUCE_API TextButton : public Button
  12898. {
  12899. public:
  12900. TextButton (const String& buttonName,
  12901. const String& toolTip = String::empty);
  12902. ~TextButton();
  12903. enum ColourIds
  12904. {
  12905. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12906. 'off'). The look-and-feel class might re-interpret this to add
  12907. effects, etc. */
  12908. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12909. 'on'). The look-and-feel class might re-interpret this to add
  12910. effects, etc. */
  12911. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12912. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12913. };
  12914. void changeWidthToFitText (int newHeight = -1);
  12915. virtual const Font getFont();
  12916. juce_UseDebuggingNewOperator
  12917. protected:
  12918. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12919. void colourChanged();
  12920. private:
  12921. TextButton (const TextButton&);
  12922. TextButton& operator= (const TextButton&);
  12923. };
  12924. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12925. /*** End of inlined file: juce_TextButton.h ***/
  12926. class JUCE_API PluginListComponent : public Component,
  12927. public ListBoxModel,
  12928. public ChangeListener,
  12929. public ButtonListener,
  12930. public Timer
  12931. {
  12932. public:
  12933. PluginListComponent (KnownPluginList& listToRepresent,
  12934. const File& deadMansPedalFile,
  12935. PropertiesFile* propertiesToUse);
  12936. ~PluginListComponent();
  12937. void resized();
  12938. bool isInterestedInFileDrag (const StringArray& files);
  12939. void filesDropped (const StringArray& files, int, int);
  12940. int getNumRows();
  12941. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12942. void deleteKeyPressed (int lastRowSelected);
  12943. void buttonClicked (Button* b);
  12944. void changeListenerCallback (void*);
  12945. void timerCallback();
  12946. juce_UseDebuggingNewOperator
  12947. private:
  12948. KnownPluginList& list;
  12949. File deadMansPedalFile;
  12950. ListBox* listBox;
  12951. TextButton* optionsButton;
  12952. PropertiesFile* propertiesToUse;
  12953. int typeToScan;
  12954. void scanFor (AudioPluginFormat* format);
  12955. PluginListComponent (const PluginListComponent&);
  12956. PluginListComponent& operator= (const PluginListComponent&);
  12957. };
  12958. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12959. /*** End of inlined file: juce_PluginListComponent.h ***/
  12960. #endif
  12961. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12962. #endif
  12963. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12964. #endif
  12965. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12966. #endif
  12967. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12968. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12969. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12970. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12971. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12972. public AsyncUpdater
  12973. {
  12974. public:
  12975. AudioProcessorGraph();
  12976. ~AudioProcessorGraph();
  12977. class JUCE_API Node : public ReferenceCountedObject
  12978. {
  12979. public:
  12980. ~Node();
  12981. const uint32 id;
  12982. AudioProcessor* const processor;
  12983. NamedValueSet properties;
  12984. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12985. juce_UseDebuggingNewOperator
  12986. private:
  12987. friend class AudioProcessorGraph;
  12988. bool isPrepared;
  12989. Node (uint32 id, AudioProcessor* processor);
  12990. void prepare (double sampleRate, int blockSize, AudioProcessorGraph* graph);
  12991. void unprepare();
  12992. Node (const Node&);
  12993. Node& operator= (const Node&);
  12994. };
  12995. struct JUCE_API Connection
  12996. {
  12997. public:
  12998. uint32 sourceNodeId;
  12999. int sourceChannelIndex;
  13000. uint32 destNodeId;
  13001. int destChannelIndex;
  13002. juce_UseDebuggingNewOperator
  13003. private:
  13004. };
  13005. void clear();
  13006. int getNumNodes() const { return nodes.size(); }
  13007. Node* getNode (const int index) const { return nodes [index]; }
  13008. Node* getNodeForId (const uint32 nodeId) const;
  13009. Node* addNode (AudioProcessor* newProcessor, uint32 nodeId = 0);
  13010. bool removeNode (uint32 nodeId);
  13011. int getNumConnections() const { return connections.size(); }
  13012. const Connection* getConnection (int index) const { return connections [index]; }
  13013. const Connection* getConnectionBetween (uint32 sourceNodeId,
  13014. int sourceChannelIndex,
  13015. uint32 destNodeId,
  13016. int destChannelIndex) const;
  13017. bool isConnected (uint32 possibleSourceNodeId,
  13018. uint32 possibleDestNodeId) const;
  13019. bool canConnect (uint32 sourceNodeId, int sourceChannelIndex,
  13020. uint32 destNodeId, int destChannelIndex) const;
  13021. bool addConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13022. uint32 destNodeId, int destChannelIndex);
  13023. void removeConnection (int index);
  13024. bool removeConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13025. uint32 destNodeId, int destChannelIndex);
  13026. bool disconnectNode (uint32 nodeId);
  13027. bool removeIllegalConnections();
  13028. static const int midiChannelIndex;
  13029. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13030. {
  13031. public:
  13032. enum IODeviceType
  13033. {
  13034. audioInputNode, /**< In this mode, the processor has output channels
  13035. representing all the audio input channels that are
  13036. coming into its parent audio graph. */
  13037. audioOutputNode, /**< In this mode, the processor has input channels
  13038. representing all the audio output channels that are
  13039. going out of its parent audio graph. */
  13040. midiInputNode, /**< In this mode, the processor has a midi output which
  13041. delivers the same midi data that is arriving at its
  13042. parent graph. */
  13043. midiOutputNode /**< In this mode, the processor has a midi input and
  13044. any data sent to it will be passed out of the parent
  13045. graph. */
  13046. };
  13047. IODeviceType getType() const { return type; }
  13048. AudioProcessorGraph* getParentGraph() const { return graph; }
  13049. bool isInput() const;
  13050. bool isOutput() const;
  13051. AudioGraphIOProcessor (const IODeviceType type);
  13052. ~AudioGraphIOProcessor();
  13053. const String getName() const;
  13054. void fillInPluginDescription (PluginDescription& d) const;
  13055. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13056. void releaseResources();
  13057. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13058. const String getInputChannelName (const int channelIndex) const;
  13059. const String getOutputChannelName (const int channelIndex) const;
  13060. bool isInputChannelStereoPair (int index) const;
  13061. bool isOutputChannelStereoPair (int index) const;
  13062. bool acceptsMidi() const;
  13063. bool producesMidi() const;
  13064. AudioProcessorEditor* createEditor();
  13065. int getNumParameters();
  13066. const String getParameterName (int);
  13067. float getParameter (int);
  13068. const String getParameterText (int);
  13069. void setParameter (int, float);
  13070. int getNumPrograms();
  13071. int getCurrentProgram();
  13072. void setCurrentProgram (int);
  13073. const String getProgramName (int);
  13074. void changeProgramName (int, const String&);
  13075. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13076. void setStateInformation (const void* data, int sizeInBytes);
  13077. void setParentGraph (AudioProcessorGraph* graph);
  13078. juce_UseDebuggingNewOperator
  13079. private:
  13080. const IODeviceType type;
  13081. AudioProcessorGraph* graph;
  13082. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13083. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13084. };
  13085. // AudioProcessor methods:
  13086. const String getName() const;
  13087. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13088. void releaseResources();
  13089. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13090. const String getInputChannelName (const int channelIndex) const;
  13091. const String getOutputChannelName (const int channelIndex) const;
  13092. bool isInputChannelStereoPair (int index) const;
  13093. bool isOutputChannelStereoPair (int index) const;
  13094. bool acceptsMidi() const;
  13095. bool producesMidi() const;
  13096. AudioProcessorEditor* createEditor() { return 0; }
  13097. int getNumParameters() { return 0; }
  13098. const String getParameterName (int) { return String::empty; }
  13099. float getParameter (int) { return 0; }
  13100. const String getParameterText (int) { return String::empty; }
  13101. void setParameter (int, float) { }
  13102. int getNumPrograms() { return 0; }
  13103. int getCurrentProgram() { return 0; }
  13104. void setCurrentProgram (int) { }
  13105. const String getProgramName (int) { return String::empty; }
  13106. void changeProgramName (int, const String&) { }
  13107. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13108. void setStateInformation (const void* data, int sizeInBytes);
  13109. void handleAsyncUpdate();
  13110. juce_UseDebuggingNewOperator
  13111. private:
  13112. ReferenceCountedArray <Node> nodes;
  13113. OwnedArray <Connection> connections;
  13114. int lastNodeId;
  13115. AudioSampleBuffer renderingBuffers;
  13116. OwnedArray <MidiBuffer> midiBuffers;
  13117. CriticalSection renderLock;
  13118. VoidArray renderingOps;
  13119. friend class AudioGraphIOProcessor;
  13120. AudioSampleBuffer* currentAudioInputBuffer;
  13121. AudioSampleBuffer currentAudioOutputBuffer;
  13122. MidiBuffer* currentMidiInputBuffer;
  13123. MidiBuffer currentMidiOutputBuffer;
  13124. void clearRenderingSequence();
  13125. void buildRenderingSequence();
  13126. bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const;
  13127. AudioProcessorGraph (const AudioProcessorGraph&);
  13128. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13129. };
  13130. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13131. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13132. #endif
  13133. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13134. #endif
  13135. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13136. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13137. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13138. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13139. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13140. public MidiInputCallback
  13141. {
  13142. public:
  13143. AudioProcessorPlayer();
  13144. virtual ~AudioProcessorPlayer();
  13145. void setProcessor (AudioProcessor* const processorToPlay);
  13146. AudioProcessor* getCurrentProcessor() const { return processor; }
  13147. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13148. void audioDeviceIOCallback (const float** inputChannelData,
  13149. int totalNumInputChannels,
  13150. float** outputChannelData,
  13151. int totalNumOutputChannels,
  13152. int numSamples);
  13153. void audioDeviceAboutToStart (AudioIODevice* device);
  13154. void audioDeviceStopped();
  13155. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13156. juce_UseDebuggingNewOperator
  13157. private:
  13158. AudioProcessor* processor;
  13159. CriticalSection lock;
  13160. double sampleRate;
  13161. int blockSize;
  13162. bool isPrepared;
  13163. int numInputChans, numOutputChans;
  13164. float* channels [128];
  13165. AudioSampleBuffer tempBuffer;
  13166. MidiBuffer incomingMidi;
  13167. MidiMessageCollector messageCollector;
  13168. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13169. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13170. };
  13171. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13172. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13173. #endif
  13174. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13175. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13176. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13177. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13178. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13179. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13180. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13181. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13182. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13183. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13184. class EditableProperty;
  13185. class JUCE_API PropertyComponent : public Component,
  13186. public SettableTooltipClient
  13187. {
  13188. public:
  13189. PropertyComponent (const String& propertyName,
  13190. int preferredHeight = 25);
  13191. ~PropertyComponent();
  13192. int getPreferredHeight() const throw() { return preferredHeight; }
  13193. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13194. virtual void refresh() = 0;
  13195. void paint (Graphics& g);
  13196. void resized();
  13197. void enablementChanged();
  13198. juce_UseDebuggingNewOperator
  13199. protected:
  13200. int preferredHeight;
  13201. };
  13202. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13203. /*** End of inlined file: juce_PropertyComponent.h ***/
  13204. class JUCE_API PropertyPanel : public Component
  13205. {
  13206. public:
  13207. PropertyPanel();
  13208. ~PropertyPanel();
  13209. void clear();
  13210. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13211. void addSection (const String& sectionTitle,
  13212. const Array <PropertyComponent*>& newPropertyComponents,
  13213. bool shouldSectionInitiallyBeOpen = true);
  13214. void refreshAll() const;
  13215. const StringArray getSectionNames() const;
  13216. bool isSectionOpen (int sectionIndex) const;
  13217. void setSectionOpen (int sectionIndex, bool shouldBeOpen);
  13218. void setSectionEnabled (int sectionIndex, bool shouldBeEnabled);
  13219. XmlElement* getOpennessState() const;
  13220. void restoreOpennessState (const XmlElement& newState);
  13221. void setMessageWhenEmpty (const String& newMessage);
  13222. const String& getMessageWhenEmpty() const;
  13223. void paint (Graphics& g);
  13224. void resized();
  13225. juce_UseDebuggingNewOperator
  13226. private:
  13227. Viewport* viewport;
  13228. class PropertyHolderComponent;
  13229. PropertyHolderComponent* propertyHolderComponent;
  13230. String messageWhenEmpty;
  13231. void updatePropHolderLayout() const;
  13232. void updatePropHolderLayout (int width) const;
  13233. };
  13234. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13235. /*** End of inlined file: juce_PropertyPanel.h ***/
  13236. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13237. {
  13238. public:
  13239. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13240. ~GenericAudioProcessorEditor();
  13241. void paint (Graphics& g);
  13242. void resized();
  13243. juce_UseDebuggingNewOperator
  13244. private:
  13245. PropertyPanel* panel;
  13246. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13247. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13248. };
  13249. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13250. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13251. #endif
  13252. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13253. /*** Start of inlined file: juce_Sampler.h ***/
  13254. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13255. #define __JUCE_SAMPLER_JUCEHEADER__
  13256. /*** Start of inlined file: juce_Synthesiser.h ***/
  13257. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13258. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13259. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13260. {
  13261. protected:
  13262. SynthesiserSound();
  13263. public:
  13264. virtual ~SynthesiserSound();
  13265. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13266. virtual bool appliesToChannel (const int midiChannel) = 0;
  13267. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13268. juce_UseDebuggingNewOperator
  13269. };
  13270. class JUCE_API SynthesiserVoice
  13271. {
  13272. public:
  13273. SynthesiserVoice();
  13274. virtual ~SynthesiserVoice();
  13275. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13276. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13277. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13278. virtual void startNote (const int midiNoteNumber,
  13279. const float velocity,
  13280. SynthesiserSound* sound,
  13281. const int currentPitchWheelPosition) = 0;
  13282. virtual void stopNote (const bool allowTailOff) = 0;
  13283. virtual void pitchWheelMoved (const int newValue) = 0;
  13284. virtual void controllerMoved (const int controllerNumber,
  13285. const int newValue) = 0;
  13286. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13287. int startSample,
  13288. int numSamples) = 0;
  13289. bool isPlayingChannel (int midiChannel) const;
  13290. void setCurrentPlaybackSampleRate (double newRate);
  13291. juce_UseDebuggingNewOperator
  13292. protected:
  13293. double getSampleRate() const { return currentSampleRate; }
  13294. void clearCurrentNote();
  13295. private:
  13296. friend class Synthesiser;
  13297. double currentSampleRate;
  13298. int currentlyPlayingNote;
  13299. uint32 noteOnTime;
  13300. SynthesiserSound::Ptr currentlyPlayingSound;
  13301. };
  13302. class JUCE_API Synthesiser
  13303. {
  13304. public:
  13305. Synthesiser();
  13306. virtual ~Synthesiser();
  13307. void clearVoices();
  13308. int getNumVoices() const { return voices.size(); }
  13309. SynthesiserVoice* getVoice (int index) const;
  13310. void addVoice (SynthesiserVoice* newVoice);
  13311. void removeVoice (int index);
  13312. void clearSounds();
  13313. int getNumSounds() const { return sounds.size(); }
  13314. SynthesiserSound* getSound (int index) const { return sounds [index]; }
  13315. void addSound (const SynthesiserSound::Ptr& newSound);
  13316. void removeSound (int index);
  13317. void setNoteStealingEnabled (bool shouldStealNotes);
  13318. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13319. virtual void noteOn (const int midiChannel,
  13320. const int midiNoteNumber,
  13321. const float velocity);
  13322. virtual void noteOff (const int midiChannel,
  13323. const int midiNoteNumber,
  13324. const bool allowTailOff);
  13325. virtual void allNotesOff (const int midiChannel,
  13326. const bool allowTailOff);
  13327. virtual void handlePitchWheel (const int midiChannel,
  13328. const int wheelValue);
  13329. virtual void handleController (const int midiChannel,
  13330. const int controllerNumber,
  13331. const int controllerValue);
  13332. void setCurrentPlaybackSampleRate (const double sampleRate);
  13333. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13334. const MidiBuffer& inputMidi,
  13335. int startSample,
  13336. int numSamples);
  13337. juce_UseDebuggingNewOperator
  13338. protected:
  13339. CriticalSection lock;
  13340. OwnedArray <SynthesiserVoice> voices;
  13341. ReferenceCountedArray <SynthesiserSound> sounds;
  13342. int lastPitchWheelValues [16];
  13343. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13344. const bool stealIfNoneAvailable) const;
  13345. void startVoice (SynthesiserVoice* voice,
  13346. SynthesiserSound* sound,
  13347. int midiChannel,
  13348. int midiNoteNumber,
  13349. float velocity);
  13350. int findFreeVoice (const bool) const { return 0; }
  13351. private:
  13352. double sampleRate;
  13353. uint32 lastNoteOnCounter;
  13354. bool shouldStealNotes;
  13355. Synthesiser (const Synthesiser&);
  13356. Synthesiser& operator= (const Synthesiser&);
  13357. };
  13358. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13359. /*** End of inlined file: juce_Synthesiser.h ***/
  13360. class JUCE_API SamplerSound : public SynthesiserSound
  13361. {
  13362. public:
  13363. SamplerSound (const String& name,
  13364. AudioFormatReader& source,
  13365. const BigInteger& midiNotes,
  13366. int midiNoteForNormalPitch,
  13367. double attackTimeSecs,
  13368. double releaseTimeSecs,
  13369. double maxSampleLengthSeconds);
  13370. ~SamplerSound();
  13371. const String& getName() const { return name; }
  13372. AudioSampleBuffer* getAudioData() const { return data; }
  13373. bool appliesToNote (const int midiNoteNumber);
  13374. bool appliesToChannel (const int midiChannel);
  13375. juce_UseDebuggingNewOperator
  13376. private:
  13377. friend class SamplerVoice;
  13378. String name;
  13379. ScopedPointer <AudioSampleBuffer> data;
  13380. double sourceSampleRate;
  13381. BigInteger midiNotes;
  13382. int length, attackSamples, releaseSamples;
  13383. int midiRootNote;
  13384. };
  13385. class JUCE_API SamplerVoice : public SynthesiserVoice
  13386. {
  13387. public:
  13388. SamplerVoice();
  13389. ~SamplerVoice();
  13390. bool canPlaySound (SynthesiserSound* sound);
  13391. void startNote (const int midiNoteNumber,
  13392. const float velocity,
  13393. SynthesiserSound* sound,
  13394. const int currentPitchWheelPosition);
  13395. void stopNote (const bool allowTailOff);
  13396. void pitchWheelMoved (const int newValue);
  13397. void controllerMoved (const int controllerNumber,
  13398. const int newValue);
  13399. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13400. juce_UseDebuggingNewOperator
  13401. private:
  13402. double pitchRatio;
  13403. double sourceSamplePosition;
  13404. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13405. bool isInAttack, isInRelease;
  13406. };
  13407. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13408. /*** End of inlined file: juce_Sampler.h ***/
  13409. #endif
  13410. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13411. #endif
  13412. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13413. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13414. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13415. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13416. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13417. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13418. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13419. class JUCE_API ActionListenerList : public MessageListener
  13420. {
  13421. public:
  13422. ActionListenerList() throw();
  13423. ~ActionListenerList() throw();
  13424. void addActionListener (ActionListener* listener) throw();
  13425. void removeActionListener (ActionListener* listener) throw();
  13426. void removeAllActionListeners() throw();
  13427. void sendActionMessage (const String& message) const;
  13428. void handleMessage (const Message&);
  13429. juce_UseDebuggingNewOperator
  13430. private:
  13431. SortedSet <void*> actionListeners_;
  13432. CriticalSection actionListenerLock_;
  13433. ActionListenerList (const ActionListenerList&);
  13434. ActionListenerList& operator= (const ActionListenerList&);
  13435. };
  13436. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13437. /*** End of inlined file: juce_ActionListenerList.h ***/
  13438. class JUCE_API ActionBroadcaster
  13439. {
  13440. public:
  13441. ActionBroadcaster() throw();
  13442. virtual ~ActionBroadcaster();
  13443. void addActionListener (ActionListener* listener);
  13444. void removeActionListener (ActionListener* listener);
  13445. void removeAllActionListeners();
  13446. void sendActionMessage (const String& message) const;
  13447. private:
  13448. ActionListenerList actionListenerList;
  13449. ActionBroadcaster (const ActionBroadcaster&);
  13450. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13451. };
  13452. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13453. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13454. #endif
  13455. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13456. #endif
  13457. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13458. #endif
  13459. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13460. #endif
  13461. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13462. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13463. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13464. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13465. class JUCE_API CallbackMessage : public Message
  13466. {
  13467. public:
  13468. CallbackMessage() throw();
  13469. ~CallbackMessage() throw();
  13470. virtual void messageCallback() = 0;
  13471. void post();
  13472. juce_UseDebuggingNewOperator
  13473. private:
  13474. CallbackMessage (const CallbackMessage&);
  13475. CallbackMessage& operator= (const CallbackMessage&);
  13476. };
  13477. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13478. /*** End of inlined file: juce_CallbackMessage.h ***/
  13479. #endif
  13480. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13481. #endif
  13482. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13483. #endif
  13484. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13485. #endif
  13486. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13487. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13488. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13489. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13490. class InterprocessConnectionServer;
  13491. class JUCE_API InterprocessConnection : public Thread,
  13492. private MessageListener
  13493. {
  13494. public:
  13495. InterprocessConnection (bool callbacksOnMessageThread = true,
  13496. uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13497. ~InterprocessConnection();
  13498. bool connectToSocket (const String& hostName,
  13499. int portNumber,
  13500. int timeOutMillisecs);
  13501. bool connectToPipe (const String& pipeName,
  13502. int pipeReceiveMessageTimeoutMs = -1);
  13503. bool createPipe (const String& pipeName,
  13504. int pipeReceiveMessageTimeoutMs = -1);
  13505. void disconnect();
  13506. bool isConnected() const;
  13507. StreamingSocket* getSocket() const throw() { return socket; }
  13508. NamedPipe* getPipe() const throw() { return pipe; }
  13509. const String getConnectedHostName() const;
  13510. bool sendMessage (const MemoryBlock& message);
  13511. virtual void connectionMade() = 0;
  13512. virtual void connectionLost() = 0;
  13513. virtual void messageReceived (const MemoryBlock& message) = 0;
  13514. juce_UseDebuggingNewOperator
  13515. private:
  13516. CriticalSection pipeAndSocketLock;
  13517. ScopedPointer <StreamingSocket> socket;
  13518. ScopedPointer <NamedPipe> pipe;
  13519. bool callbackConnectionState;
  13520. const bool useMessageThread;
  13521. const uint32 magicMessageHeader;
  13522. int pipeReceiveMessageTimeout;
  13523. friend class InterprocessConnectionServer;
  13524. void initialiseWithSocket (StreamingSocket* socket_);
  13525. void initialiseWithPipe (NamedPipe* pipe_);
  13526. void handleMessage (const Message& message);
  13527. void connectionMadeInt();
  13528. void connectionLostInt();
  13529. void deliverDataInt (const MemoryBlock& data);
  13530. bool readNextMessageInt();
  13531. void run();
  13532. InterprocessConnection (const InterprocessConnection&);
  13533. InterprocessConnection& operator= (const InterprocessConnection&);
  13534. };
  13535. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13536. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13537. #endif
  13538. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13539. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13540. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13541. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13542. class JUCE_API InterprocessConnectionServer : private Thread
  13543. {
  13544. public:
  13545. InterprocessConnectionServer();
  13546. ~InterprocessConnectionServer();
  13547. bool beginWaitingForSocket (int portNumber);
  13548. void stop();
  13549. protected:
  13550. virtual InterprocessConnection* createConnectionObject() = 0;
  13551. public:
  13552. juce_UseDebuggingNewOperator
  13553. private:
  13554. ScopedPointer <StreamingSocket> socket;
  13555. void run();
  13556. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13557. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13558. };
  13559. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13560. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13561. #endif
  13562. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13563. #endif
  13564. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13565. #endif
  13566. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13567. #endif
  13568. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13569. /*** Start of inlined file: juce_MessageManager.h ***/
  13570. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13571. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13572. class Component;
  13573. class MessageManagerLock;
  13574. typedef void* (MessageCallbackFunction) (void* userData);
  13575. class JUCE_API MessageManager
  13576. {
  13577. public:
  13578. static MessageManager* getInstance() throw();
  13579. void runDispatchLoop();
  13580. void stopDispatchLoop();
  13581. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13582. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13583. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13584. void* userData);
  13585. bool isThisTheMessageThread() const throw();
  13586. void setCurrentThreadAsMessageThread();
  13587. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13588. bool currentThreadHasLockedMessageManager() const throw();
  13589. static void broadcastMessage (const String& messageText) throw();
  13590. void registerBroadcastListener (ActionListener* listener) throw();
  13591. void deregisterBroadcastListener (ActionListener* listener) throw();
  13592. void deliverMessage (void*);
  13593. void deliverBroadcastMessage (const String&);
  13594. ~MessageManager() throw();
  13595. juce_UseDebuggingNewOperator
  13596. private:
  13597. MessageManager() throw();
  13598. friend class MessageListener;
  13599. friend class ChangeBroadcaster;
  13600. friend class ActionBroadcaster;
  13601. friend class CallbackMessage;
  13602. static MessageManager* instance;
  13603. SortedSet <const MessageListener*> messageListeners;
  13604. ScopedPointer <ActionListenerList> broadcastListeners;
  13605. friend class JUCEApplication;
  13606. bool quitMessagePosted, quitMessageReceived;
  13607. Thread::ThreadID messageThreadId;
  13608. VoidArray modalComponents;
  13609. static void* exitModalLoopCallback (void*);
  13610. void postMessageToQueue (Message* message);
  13611. void postCallbackMessage (Message* message);
  13612. static void doPlatformSpecificInitialisation();
  13613. static void doPlatformSpecificShutdown();
  13614. friend class MessageManagerLock;
  13615. Thread::ThreadID volatile threadWithLock;
  13616. CriticalSection lockingLock;
  13617. MessageManager (const MessageManager&);
  13618. MessageManager& operator= (const MessageManager&);
  13619. };
  13620. class JUCE_API MessageManagerLock
  13621. {
  13622. public:
  13623. MessageManagerLock (Thread* threadToCheckForExitSignal = 0) throw();
  13624. MessageManagerLock (ThreadPoolJob* jobToCheckForExitSignal) throw();
  13625. ~MessageManagerLock() throw();
  13626. bool lockWasGained() const throw() { return locked; }
  13627. private:
  13628. class SharedEvents;
  13629. class BlockingMessage;
  13630. friend class SharedEvents;
  13631. friend class BlockingMessage;
  13632. SharedEvents* sharedEvents;
  13633. bool locked;
  13634. void init (Thread* thread, ThreadPoolJob* job) throw();
  13635. MessageManagerLock (const MessageManagerLock&);
  13636. MessageManagerLock& operator= (const MessageManagerLock&);
  13637. };
  13638. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13639. /*** End of inlined file: juce_MessageManager.h ***/
  13640. #endif
  13641. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13642. /*** Start of inlined file: juce_MultiTimer.h ***/
  13643. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13644. #define __JUCE_MULTITIMER_JUCEHEADER__
  13645. class JUCE_API MultiTimer
  13646. {
  13647. protected:
  13648. MultiTimer() throw();
  13649. MultiTimer (const MultiTimer& other) throw();
  13650. public:
  13651. virtual ~MultiTimer();
  13652. virtual void timerCallback (int timerId) = 0;
  13653. void startTimer (int timerId, int intervalInMilliseconds) throw();
  13654. void stopTimer (int timerId) throw();
  13655. bool isTimerRunning (int timerId) const throw();
  13656. int getTimerInterval (int timerId) const throw();
  13657. private:
  13658. class MultiTimerCallback;
  13659. CriticalSection timerListLock;
  13660. OwnedArray <MultiTimerCallback> timers;
  13661. MultiTimer& operator= (const MultiTimer&);
  13662. };
  13663. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13664. /*** End of inlined file: juce_MultiTimer.h ***/
  13665. #endif
  13666. #ifndef __JUCE_TIMER_JUCEHEADER__
  13667. #endif
  13668. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13669. /*** Start of inlined file: juce_ArrowButton.h ***/
  13670. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13671. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13672. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13673. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13674. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13675. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13676. {
  13677. public:
  13678. DropShadowEffect();
  13679. ~DropShadowEffect();
  13680. void setShadowProperties (const float newRadius,
  13681. const float newOpacity,
  13682. const int newShadowOffsetX,
  13683. const int newShadowOffsetY);
  13684. void applyEffect (Image& sourceImage, Graphics& destContext);
  13685. juce_UseDebuggingNewOperator
  13686. private:
  13687. int offsetX, offsetY;
  13688. float radius, opacity;
  13689. };
  13690. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13691. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13692. class JUCE_API ArrowButton : public Button
  13693. {
  13694. public:
  13695. ArrowButton (const String& buttonName,
  13696. float arrowDirection,
  13697. const Colour& arrowColour);
  13698. ~ArrowButton();
  13699. juce_UseDebuggingNewOperator
  13700. protected:
  13701. void paintButton (Graphics& g,
  13702. bool isMouseOverButton,
  13703. bool isButtonDown);
  13704. void buttonStateChanged();
  13705. private:
  13706. Colour colour;
  13707. DropShadowEffect shadow;
  13708. Path path;
  13709. int offset;
  13710. ArrowButton (const ArrowButton&);
  13711. ArrowButton& operator= (const ArrowButton&);
  13712. };
  13713. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13714. /*** End of inlined file: juce_ArrowButton.h ***/
  13715. #endif
  13716. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13717. #endif
  13718. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13719. /*** Start of inlined file: juce_DrawableButton.h ***/
  13720. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13721. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13722. /*** Start of inlined file: juce_Drawable.h ***/
  13723. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13724. #define __JUCE_DRAWABLE_JUCEHEADER__
  13725. class JUCE_API Drawable
  13726. {
  13727. protected:
  13728. Drawable();
  13729. public:
  13730. virtual ~Drawable();
  13731. virtual Drawable* createCopy() const = 0;
  13732. void draw (Graphics& g, float opacity,
  13733. const AffineTransform& transform = AffineTransform::identity) const;
  13734. void drawAt (Graphics& g,
  13735. float x, float y,
  13736. float opacity) const;
  13737. void drawWithin (Graphics& g,
  13738. int destX,
  13739. int destY,
  13740. int destWidth,
  13741. int destHeight,
  13742. const RectanglePlacement& placement,
  13743. float opacity) const;
  13744. class RenderingContext
  13745. {
  13746. public:
  13747. RenderingContext (Graphics& g, const AffineTransform& transform, float opacity) throw();
  13748. Graphics& g;
  13749. AffineTransform transform;
  13750. float opacity;
  13751. private:
  13752. RenderingContext& operator= (const RenderingContext&);
  13753. };
  13754. virtual void render (const RenderingContext& context) const = 0;
  13755. virtual const Rectangle<float> getBounds() const = 0;
  13756. virtual bool hitTest (float x, float y) const = 0;
  13757. const String& getName() const throw() { return name; }
  13758. void setName (const String& newName) throw() { name = newName; }
  13759. static Drawable* createFromImageData (const void* data, size_t numBytes);
  13760. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13761. static Drawable* createFromImageFile (const File& file);
  13762. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13763. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13764. virtual ValueTree createValueTree() const throw() = 0;
  13765. juce_UseDebuggingNewOperator
  13766. private:
  13767. Drawable (const Drawable&);
  13768. Drawable& operator= (const Drawable&);
  13769. String name;
  13770. };
  13771. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13772. /*** End of inlined file: juce_Drawable.h ***/
  13773. class JUCE_API DrawableButton : public Button
  13774. {
  13775. public:
  13776. enum ButtonStyle
  13777. {
  13778. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13779. ImageRaw, /**< The button will just display the images in their normal size and position.
  13780. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13781. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13782. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13783. };
  13784. DrawableButton (const String& buttonName,
  13785. ButtonStyle buttonStyle);
  13786. ~DrawableButton();
  13787. void setImages (const Drawable* normalImage,
  13788. const Drawable* overImage = 0,
  13789. const Drawable* downImage = 0,
  13790. const Drawable* disabledImage = 0,
  13791. const Drawable* normalImageOn = 0,
  13792. const Drawable* overImageOn = 0,
  13793. const Drawable* downImageOn = 0,
  13794. const Drawable* disabledImageOn = 0);
  13795. void setButtonStyle (ButtonStyle newStyle);
  13796. void setBackgroundColours (const Colour& toggledOffColour,
  13797. const Colour& toggledOnColour);
  13798. const Colour& getBackgroundColour() const throw();
  13799. void setEdgeIndent (int numPixelsIndent);
  13800. const Drawable* getCurrentImage() const throw();
  13801. const Drawable* getNormalImage() const throw();
  13802. const Drawable* getOverImage() const throw();
  13803. const Drawable* getDownImage() const throw();
  13804. juce_UseDebuggingNewOperator
  13805. protected:
  13806. void paintButton (Graphics& g,
  13807. bool isMouseOverButton,
  13808. bool isButtonDown);
  13809. private:
  13810. ButtonStyle style;
  13811. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13812. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13813. Colour backgroundOff, backgroundOn;
  13814. int edgeIndent;
  13815. void deleteImages();
  13816. DrawableButton (const DrawableButton&);
  13817. DrawableButton& operator= (const DrawableButton&);
  13818. };
  13819. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13820. /*** End of inlined file: juce_DrawableButton.h ***/
  13821. #endif
  13822. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13823. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13824. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13825. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13826. class JUCE_API HyperlinkButton : public Button
  13827. {
  13828. public:
  13829. HyperlinkButton (const String& linkText,
  13830. const URL& linkURL);
  13831. ~HyperlinkButton();
  13832. void setFont (const Font& newFont,
  13833. bool resizeToMatchComponentHeight,
  13834. const Justification& justificationType = Justification::horizontallyCentred);
  13835. enum ColourIds
  13836. {
  13837. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13838. };
  13839. void setURL (const URL& newURL) throw();
  13840. const URL& getURL() const throw() { return url; }
  13841. void changeWidthToFitText();
  13842. juce_UseDebuggingNewOperator
  13843. protected:
  13844. void clicked();
  13845. void colourChanged();
  13846. void paintButton (Graphics& g,
  13847. bool isMouseOverButton,
  13848. bool isButtonDown);
  13849. private:
  13850. URL url;
  13851. Font font;
  13852. bool resizeFont;
  13853. Justification justification;
  13854. const Font getFontToUse() const;
  13855. HyperlinkButton (const HyperlinkButton&);
  13856. HyperlinkButton& operator= (const HyperlinkButton&);
  13857. };
  13858. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13859. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13860. #endif
  13861. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13862. /*** Start of inlined file: juce_ImageButton.h ***/
  13863. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13864. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13865. class JUCE_API ImageButton : public Button
  13866. {
  13867. public:
  13868. explicit ImageButton (const String& name);
  13869. ~ImageButton();
  13870. void setImages (bool resizeButtonNowToFitThisImage,
  13871. bool rescaleImagesWhenButtonSizeChanges,
  13872. bool preserveImageProportions,
  13873. Image* normalImage,
  13874. float imageOpacityWhenNormal,
  13875. const Colour& overlayColourWhenNormal,
  13876. Image* overImage,
  13877. float imageOpacityWhenOver,
  13878. const Colour& overlayColourWhenOver,
  13879. Image* downImage,
  13880. float imageOpacityWhenDown,
  13881. const Colour& overlayColourWhenDown,
  13882. float hitTestAlphaThreshold = 0.0f);
  13883. Image* getNormalImage() const throw();
  13884. Image* getOverImage() const throw();
  13885. Image* getDownImage() const throw();
  13886. juce_UseDebuggingNewOperator
  13887. protected:
  13888. bool hitTest (int x, int y);
  13889. void paintButton (Graphics& g,
  13890. bool isMouseOverButton,
  13891. bool isButtonDown);
  13892. private:
  13893. bool scaleImageToFit, preserveProportions;
  13894. unsigned char alphaThreshold;
  13895. int imageX, imageY, imageW, imageH;
  13896. Image* normalImage;
  13897. Image* overImage;
  13898. Image* downImage;
  13899. float normalOpacity, overOpacity, downOpacity;
  13900. Colour normalOverlay, overOverlay, downOverlay;
  13901. Image* getCurrentImage() const;
  13902. void deleteImages();
  13903. ImageButton (const ImageButton&);
  13904. ImageButton& operator= (const ImageButton&);
  13905. };
  13906. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13907. /*** End of inlined file: juce_ImageButton.h ***/
  13908. #endif
  13909. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13910. /*** Start of inlined file: juce_ShapeButton.h ***/
  13911. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13912. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13913. class JUCE_API ShapeButton : public Button
  13914. {
  13915. public:
  13916. ShapeButton (const String& name,
  13917. const Colour& normalColour,
  13918. const Colour& overColour,
  13919. const Colour& downColour);
  13920. ~ShapeButton();
  13921. void setShape (const Path& newShape,
  13922. bool resizeNowToFitThisShape,
  13923. bool maintainShapeProportions,
  13924. bool hasDropShadow);
  13925. void setColours (const Colour& normalColour,
  13926. const Colour& overColour,
  13927. const Colour& downColour);
  13928. void setOutline (const Colour& outlineColour,
  13929. float outlineStrokeWidth);
  13930. juce_UseDebuggingNewOperator
  13931. protected:
  13932. void paintButton (Graphics& g,
  13933. bool isMouseOverButton,
  13934. bool isButtonDown);
  13935. private:
  13936. Colour normalColour, overColour, downColour, outlineColour;
  13937. DropShadowEffect shadow;
  13938. Path shape;
  13939. bool maintainShapeProportions;
  13940. float outlineWidth;
  13941. ShapeButton (const ShapeButton&);
  13942. ShapeButton& operator= (const ShapeButton&);
  13943. };
  13944. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13945. /*** End of inlined file: juce_ShapeButton.h ***/
  13946. #endif
  13947. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13948. #endif
  13949. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13950. /*** Start of inlined file: juce_ToggleButton.h ***/
  13951. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13952. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13953. class JUCE_API ToggleButton : public Button
  13954. {
  13955. public:
  13956. ToggleButton (const String& buttonText);
  13957. ~ToggleButton();
  13958. void changeWidthToFitText();
  13959. enum ColourIds
  13960. {
  13961. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13962. };
  13963. juce_UseDebuggingNewOperator
  13964. protected:
  13965. void paintButton (Graphics& g,
  13966. bool isMouseOverButton,
  13967. bool isButtonDown);
  13968. void colourChanged();
  13969. private:
  13970. ToggleButton (const ToggleButton&);
  13971. ToggleButton& operator= (const ToggleButton&);
  13972. };
  13973. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13974. /*** End of inlined file: juce_ToggleButton.h ***/
  13975. #endif
  13976. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13977. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13978. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13979. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13980. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13981. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13982. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13983. /*** Start of inlined file: juce_Toolbar.h ***/
  13984. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13985. #define __JUCE_TOOLBAR_JUCEHEADER__
  13986. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13987. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13988. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13989. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13990. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13991. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13992. class JUCE_API DragAndDropTarget
  13993. {
  13994. public:
  13995. virtual ~DragAndDropTarget() {}
  13996. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13997. Component* sourceComponent) = 0;
  13998. virtual void itemDragEnter (const String& sourceDescription,
  13999. Component* sourceComponent,
  14000. int x, int y);
  14001. virtual void itemDragMove (const String& sourceDescription,
  14002. Component* sourceComponent,
  14003. int x, int y);
  14004. virtual void itemDragExit (const String& sourceDescription,
  14005. Component* sourceComponent);
  14006. virtual void itemDropped (const String& sourceDescription,
  14007. Component* sourceComponent,
  14008. int x, int y) = 0;
  14009. virtual bool shouldDrawDragImageWhenOver();
  14010. };
  14011. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14012. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  14013. class JUCE_API DragAndDropContainer
  14014. {
  14015. public:
  14016. DragAndDropContainer();
  14017. virtual ~DragAndDropContainer();
  14018. void startDragging (const String& sourceDescription,
  14019. Component* sourceComponent,
  14020. Image* dragImage = 0,
  14021. bool allowDraggingToOtherJuceWindows = false,
  14022. const Point<int>* imageOffsetFromMouse = 0);
  14023. bool isDragAndDropActive() const;
  14024. const String getCurrentDragDescription() const;
  14025. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14026. static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles);
  14027. static bool performExternalDragDropOfText (const String& text);
  14028. juce_UseDebuggingNewOperator
  14029. protected:
  14030. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14031. Component* dragSourceComponent,
  14032. StringArray& files,
  14033. bool& canMoveFiles);
  14034. private:
  14035. friend class DragImageComponent;
  14036. ScopedPointer <Component> dragImageComponent;
  14037. String currentDragDesc;
  14038. };
  14039. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14040. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14041. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14042. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14043. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14044. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14045. private Timer
  14046. {
  14047. public:
  14048. ComponentAnimator();
  14049. ~ComponentAnimator();
  14050. void animateComponent (Component* component,
  14051. const Rectangle<int>& finalPosition,
  14052. int millisecondsToSpendMoving,
  14053. double startSpeed = 1.0,
  14054. double endSpeed = 1.0);
  14055. void cancelAnimation (Component* component,
  14056. bool moveComponentToItsFinalPosition);
  14057. void cancelAllAnimations (bool moveComponentsToTheirFinalPositions);
  14058. const Rectangle<int> getComponentDestination (Component* component);
  14059. bool isAnimating (Component* component) const;
  14060. juce_UseDebuggingNewOperator
  14061. private:
  14062. class AnimationTask;
  14063. Array <AnimationTask*> tasks;
  14064. uint32 lastTime;
  14065. AnimationTask* findTaskFor (Component* component) const;
  14066. void timerCallback();
  14067. };
  14068. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14069. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14070. class ToolbarItemComponent;
  14071. class ToolbarItemFactory;
  14072. class MissingItemsComponent;
  14073. class JUCE_API Toolbar : public Component,
  14074. public DragAndDropContainer,
  14075. public DragAndDropTarget,
  14076. private ButtonListener
  14077. {
  14078. public:
  14079. Toolbar();
  14080. ~Toolbar();
  14081. void setVertical (bool shouldBeVertical);
  14082. bool isVertical() const throw() { return vertical; }
  14083. int getThickness() const throw();
  14084. int getLength() const throw();
  14085. void clear();
  14086. void addItem (ToolbarItemFactory& factory,
  14087. int itemId,
  14088. int insertIndex = -1);
  14089. void removeToolbarItem (int itemIndex);
  14090. int getNumItems() const throw();
  14091. int getItemId (int itemIndex) const throw();
  14092. ToolbarItemComponent* getItemComponent (int itemIndex) const throw();
  14093. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14094. enum ToolbarItemStyle
  14095. {
  14096. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14097. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14098. textOnly /**< Means that the toolbar only display text labels for each item. */
  14099. };
  14100. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14101. void setStyle (const ToolbarItemStyle& newStyle);
  14102. enum CustomisationFlags
  14103. {
  14104. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14105. show the "icons only" option on its choice of toolbar styles. */
  14106. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14107. show the "icons with text" option on its choice of toolbar styles. */
  14108. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14109. show the "text only" option on its choice of toolbar styles. */
  14110. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14111. show a button to reset the toolbar to its default set of items. */
  14112. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14113. };
  14114. void showCustomisationDialog (ToolbarItemFactory& factory,
  14115. int optionFlags = allCustomisationOptionsEnabled);
  14116. void setEditingActive (bool editingEnabled);
  14117. enum ColourIds
  14118. {
  14119. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14120. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14121. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14122. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14123. over them. */
  14124. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14125. held down on them. */
  14126. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14127. when the style is set to iconsWithText or textOnly. */
  14128. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14129. the customisation dialog is active and the mouse moves over them. */
  14130. };
  14131. const String toString() const;
  14132. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14133. const String& savedVersion);
  14134. void paint (Graphics& g);
  14135. void resized();
  14136. void buttonClicked (Button*);
  14137. void mouseDown (const MouseEvent&);
  14138. bool isInterestedInDragSource (const String&, Component*);
  14139. void itemDragMove (const String&, Component*, int, int);
  14140. void itemDragExit (const String&, Component*);
  14141. void itemDropped (const String&, Component*, int, int);
  14142. void updateAllItemPositions (const bool animate);
  14143. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14144. juce_UseDebuggingNewOperator
  14145. private:
  14146. Button* missingItemsButton;
  14147. bool vertical, isEditingActive;
  14148. ToolbarItemStyle toolbarStyle;
  14149. ComponentAnimator animator;
  14150. friend class MissingItemsComponent;
  14151. Array <ToolbarItemComponent*> items;
  14152. friend class ItemDragAndDropOverlayComponent;
  14153. static const char* const toolbarDragDescriptor;
  14154. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14155. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14156. Toolbar (const Toolbar&);
  14157. Toolbar& operator= (const Toolbar&);
  14158. };
  14159. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14160. /*** End of inlined file: juce_Toolbar.h ***/
  14161. class ItemDragAndDropOverlayComponent;
  14162. class JUCE_API ToolbarItemComponent : public Button
  14163. {
  14164. public:
  14165. ToolbarItemComponent (int itemId,
  14166. const String& labelText,
  14167. bool isBeingUsedAsAButton);
  14168. ~ToolbarItemComponent();
  14169. int getItemId() const throw() { return itemId; }
  14170. Toolbar* getToolbar() const;
  14171. bool isToolbarVertical() const;
  14172. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14173. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14174. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14175. virtual bool getToolbarItemSizes (int toolbarThickness,
  14176. bool isToolbarVertical,
  14177. int& preferredSize,
  14178. int& minSize,
  14179. int& maxSize) = 0;
  14180. virtual void paintButtonArea (Graphics& g,
  14181. int width, int height,
  14182. bool isMouseOver, bool isMouseDown) = 0;
  14183. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14184. enum ToolbarEditingMode
  14185. {
  14186. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14187. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14188. customisation mode, and the items can be dragged around. */
  14189. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14190. dragged onto a toolbar to add it to that bar.*/
  14191. };
  14192. void setEditingMode (const ToolbarEditingMode newMode);
  14193. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14194. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14195. void resized();
  14196. juce_UseDebuggingNewOperator
  14197. private:
  14198. friend class Toolbar;
  14199. friend class ItemDragAndDropOverlayComponent;
  14200. const int itemId;
  14201. ToolbarEditingMode mode;
  14202. Toolbar::ToolbarItemStyle toolbarStyle;
  14203. ScopedPointer <Component> overlayComp;
  14204. int dragOffsetX, dragOffsetY;
  14205. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14206. Rectangle<int> contentArea;
  14207. ToolbarItemComponent (const ToolbarItemComponent&);
  14208. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14209. };
  14210. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14211. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14212. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14213. {
  14214. public:
  14215. ToolbarButton (int itemId,
  14216. const String& labelText,
  14217. Drawable* normalImage,
  14218. Drawable* toggledOnImage);
  14219. ~ToolbarButton();
  14220. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14221. int& minSize, int& maxSize);
  14222. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14223. void contentAreaChanged (const Rectangle<int>& newBounds);
  14224. juce_UseDebuggingNewOperator
  14225. private:
  14226. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14227. ToolbarButton (const ToolbarButton&);
  14228. ToolbarButton& operator= (const ToolbarButton&);
  14229. };
  14230. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14231. /*** End of inlined file: juce_ToolbarButton.h ***/
  14232. #endif
  14233. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14234. /*** Start of inlined file: juce_CodeDocument.h ***/
  14235. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14236. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14237. class CodeDocumentLine;
  14238. class JUCE_API CodeDocument
  14239. {
  14240. public:
  14241. CodeDocument();
  14242. ~CodeDocument();
  14243. class JUCE_API Position
  14244. {
  14245. public:
  14246. Position() throw();
  14247. Position (const CodeDocument* ownerDocument,
  14248. int line, int indexInLine) throw();
  14249. Position (const CodeDocument* ownerDocument,
  14250. int charactersFromStartOfDocument) throw();
  14251. Position (const Position& other) throw();
  14252. ~Position() throw();
  14253. Position& operator= (const Position& other) throw();
  14254. bool operator== (const Position& other) const throw();
  14255. bool operator!= (const Position& other) const throw();
  14256. void setPosition (int charactersFromStartOfDocument) throw();
  14257. int getPosition() const throw() { return characterPos; }
  14258. void setLineAndIndex (int newLine, int newIndexInLine) throw();
  14259. int getLineNumber() const throw() { return line; }
  14260. int getIndexInLine() const throw() { return indexInLine; }
  14261. void setPositionMaintained (bool isMaintained) throw();
  14262. void moveBy (int characterDelta) throw();
  14263. const Position movedBy (int characterDelta) const throw();
  14264. const Position movedByLines (int deltaLines) const throw();
  14265. const juce_wchar getCharacter() const throw();
  14266. const String getLineText() const throw();
  14267. private:
  14268. CodeDocument* owner;
  14269. int characterPos, line, indexInLine;
  14270. bool positionMaintained;
  14271. };
  14272. const String getAllContent() const throw();
  14273. const String getTextBetween (const Position& start, const Position& end) const throw();
  14274. const String getLine (int lineIndex) const throw();
  14275. int getNumCharacters() const throw();
  14276. int getNumLines() const throw() { return lines.size(); }
  14277. int getMaximumLineLength() throw();
  14278. void deleteSection (const Position& startPosition, const Position& endPosition);
  14279. void insertText (const Position& position, const String& text);
  14280. void replaceAllContent (const String& newContent);
  14281. bool loadFromStream (InputStream& stream);
  14282. bool writeToStream (OutputStream& stream);
  14283. const String getNewLineCharacters() const throw() { return newLineChars; }
  14284. void setNewLineCharacters (const String& newLine) throw();
  14285. void newTransaction();
  14286. void undo();
  14287. void redo();
  14288. void clearUndoHistory();
  14289. UndoManager& getUndoManager() throw() { return undoManager; }
  14290. void setSavePoint() throw();
  14291. bool hasChangedSinceSavePoint() const throw();
  14292. const Position findWordBreakAfter (const Position& position) const throw();
  14293. const Position findWordBreakBefore (const Position& position) const throw();
  14294. class JUCE_API Listener
  14295. {
  14296. public:
  14297. Listener() {}
  14298. virtual ~Listener() {}
  14299. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14300. const Position& affectedTextEnd) = 0;
  14301. };
  14302. void addListener (Listener* listener) throw();
  14303. void removeListener (Listener* listener) throw();
  14304. class Iterator
  14305. {
  14306. public:
  14307. Iterator (CodeDocument* document);
  14308. Iterator (const Iterator& other);
  14309. Iterator& operator= (const Iterator& other) throw();
  14310. ~Iterator() throw();
  14311. juce_wchar nextChar();
  14312. juce_wchar peekNextChar() const;
  14313. void skip();
  14314. int getPosition() const throw() { return position; }
  14315. void skipWhitespace();
  14316. void skipToEndOfLine();
  14317. int getLine() const throw() { return line; }
  14318. bool isEOF() const throw();
  14319. private:
  14320. CodeDocument* document;
  14321. CodeDocumentLine* currentLine;
  14322. int line, position;
  14323. };
  14324. juce_UseDebuggingNewOperator
  14325. private:
  14326. friend class CodeDocumentInsertAction;
  14327. friend class CodeDocumentDeleteAction;
  14328. friend class Iterator;
  14329. friend class Position;
  14330. OwnedArray <CodeDocumentLine> lines;
  14331. Array <Position*> positionsToMaintain;
  14332. UndoManager undoManager;
  14333. int currentActionIndex, indexOfSavedState;
  14334. int maximumLineLength;
  14335. ListenerList <Listener> listeners;
  14336. String newLineChars;
  14337. void sendListenerChangeMessage (int startLine, int endLine);
  14338. void insert (const String& text, int insertPos, bool undoable);
  14339. void remove (int startPos, int endPos, bool undoable);
  14340. void checkLastLineStatus();
  14341. CodeDocument (const CodeDocument&);
  14342. CodeDocument& operator= (const CodeDocument&);
  14343. };
  14344. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14345. /*** End of inlined file: juce_CodeDocument.h ***/
  14346. #endif
  14347. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14348. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14349. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14350. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14351. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14352. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14353. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14354. class JUCE_API CodeTokeniser
  14355. {
  14356. public:
  14357. CodeTokeniser() {}
  14358. virtual ~CodeTokeniser() {}
  14359. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14360. virtual const StringArray getTokenTypes() = 0;
  14361. virtual const Colour getDefaultColour (int tokenType) = 0;
  14362. juce_UseDebuggingNewOperator
  14363. };
  14364. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14365. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14366. class JUCE_API CodeEditorComponent : public Component,
  14367. public TextInputTarget,
  14368. public Timer,
  14369. public ScrollBarListener,
  14370. public CodeDocument::Listener,
  14371. public AsyncUpdater
  14372. {
  14373. public:
  14374. CodeEditorComponent (CodeDocument& document,
  14375. CodeTokeniser* codeTokeniser);
  14376. ~CodeEditorComponent();
  14377. CodeDocument& getDocument() const throw() { return document; }
  14378. void loadContent (const String& newContent);
  14379. float getCharWidth() const throw() { return charWidth; }
  14380. int getLineHeight() const throw() { return lineHeight; }
  14381. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14382. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14383. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14384. void moveCaretTo (const CodeDocument::Position& newPos, bool selecting);
  14385. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14386. const CodeDocument::Position getPositionAt (int x, int y);
  14387. void cursorLeft (bool moveInWholeWordSteps, bool selecting);
  14388. void cursorRight (bool moveInWholeWordSteps, bool selecting);
  14389. void cursorDown (bool selecting);
  14390. void cursorUp (bool selecting);
  14391. void pageDown (bool selecting);
  14392. void pageUp (bool selecting);
  14393. void scrollDown();
  14394. void scrollUp();
  14395. void scrollToLine (int newFirstLineOnScreen);
  14396. void scrollBy (int deltaLines);
  14397. void scrollToColumn (int newFirstColumnOnScreen);
  14398. void scrollToKeepCaretOnScreen();
  14399. void goToStartOfDocument (bool selecting);
  14400. void goToStartOfLine (bool selecting);
  14401. void goToEndOfDocument (bool selecting);
  14402. void goToEndOfLine (bool selecting);
  14403. void deselectAll();
  14404. void selectAll();
  14405. void insertTextAtCaret (const String& textToInsert);
  14406. void insertTabAtCaret();
  14407. void cut();
  14408. void copy();
  14409. void copyThenCut();
  14410. void paste();
  14411. void backspace (bool moveInWholeWordSteps);
  14412. void deleteForward (bool moveInWholeWordSteps);
  14413. void undo();
  14414. void redo();
  14415. const Range<int> getHighlightedRegion() const;
  14416. void setHighlightedRegion (const Range<int>& newRange);
  14417. const String getTextInRange (const Range<int>& range) const;
  14418. void setTabSize (int numSpacesPerTab,
  14419. bool insertSpacesInsteadOfTabCharacters) throw();
  14420. int getTabSize() const throw() { return spacesPerTab; }
  14421. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14422. void setFont (const Font& newFont);
  14423. void resetToDefaultColours();
  14424. void setColourForTokenType (int tokenType, const Colour& colour);
  14425. const Colour getColourForTokenType (int tokenType) const throw();
  14426. enum ColourIds
  14427. {
  14428. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14429. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14430. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14431. selected text. */
  14432. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14433. enabled. */
  14434. };
  14435. void setScrollbarThickness (int thickness) throw();
  14436. void resized();
  14437. void paint (Graphics& g);
  14438. bool keyPressed (const KeyPress& key);
  14439. void mouseDown (const MouseEvent& e);
  14440. void mouseDrag (const MouseEvent& e);
  14441. void mouseUp (const MouseEvent& e);
  14442. void mouseDoubleClick (const MouseEvent& e);
  14443. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14444. void timerCallback();
  14445. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14446. void handleAsyncUpdate();
  14447. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14448. const CodeDocument::Position& affectedTextEnd);
  14449. juce_UseDebuggingNewOperator
  14450. private:
  14451. CodeDocument& document;
  14452. Font font;
  14453. int firstLineOnScreen, gutter, spacesPerTab;
  14454. float charWidth;
  14455. int lineHeight, linesOnScreen, columnsOnScreen;
  14456. int scrollbarThickness, columnToTryToMaintain;
  14457. bool useSpacesForTabs;
  14458. double xOffset;
  14459. CodeDocument::Position caretPos;
  14460. CodeDocument::Position selectionStart, selectionEnd;
  14461. class CaretComponent;
  14462. CaretComponent* caret;
  14463. ScrollBar* verticalScrollBar;
  14464. ScrollBar* horizontalScrollBar;
  14465. enum DragType
  14466. {
  14467. notDragging,
  14468. draggingSelectionStart,
  14469. draggingSelectionEnd
  14470. };
  14471. DragType dragType;
  14472. CodeTokeniser* codeTokeniser;
  14473. Array <Colour> coloursForTokenCategories;
  14474. class CodeEditorLine;
  14475. OwnedArray <CodeEditorLine> lines;
  14476. void rebuildLineTokens();
  14477. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14478. void clearCachedIterators (int firstLineToBeInvalid) throw();
  14479. void updateCachedIterators (int maxLineNum);
  14480. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14481. void moveLineDelta (int delta, bool selecting);
  14482. void updateScrollBars();
  14483. void scrollToLineInternal (int line);
  14484. void scrollToColumnInternal (double column);
  14485. void newTransaction();
  14486. int indexToColumn (int line, int index) const throw();
  14487. int columnToIndex (int line, int column) const throw();
  14488. CodeEditorComponent (const CodeEditorComponent&);
  14489. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14490. };
  14491. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14492. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14493. #endif
  14494. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14495. #endif
  14496. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14497. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14498. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14499. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14500. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14501. {
  14502. public:
  14503. CPlusPlusCodeTokeniser();
  14504. ~CPlusPlusCodeTokeniser();
  14505. enum TokenType
  14506. {
  14507. tokenType_error = 0,
  14508. tokenType_comment,
  14509. tokenType_builtInKeyword,
  14510. tokenType_identifier,
  14511. tokenType_integerLiteral,
  14512. tokenType_floatLiteral,
  14513. tokenType_stringLiteral,
  14514. tokenType_operator,
  14515. tokenType_bracket,
  14516. tokenType_punctuation,
  14517. tokenType_preprocessor
  14518. };
  14519. int readNextToken (CodeDocument::Iterator& source);
  14520. const StringArray getTokenTypes();
  14521. const Colour getDefaultColour (int tokenType);
  14522. juce_UseDebuggingNewOperator
  14523. };
  14524. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14525. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14526. #endif
  14527. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14528. #endif
  14529. #ifndef __JUCE_LABEL_JUCEHEADER__
  14530. #endif
  14531. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14532. #endif
  14533. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14534. /*** Start of inlined file: juce_ProgressBar.h ***/
  14535. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14536. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14537. class JUCE_API ProgressBar : public Component,
  14538. public SettableTooltipClient,
  14539. private Timer
  14540. {
  14541. public:
  14542. explicit ProgressBar (double& progress);
  14543. ~ProgressBar();
  14544. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14545. void setTextToDisplay (const String& text);
  14546. enum ColourIds
  14547. {
  14548. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14549. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14550. classes will probably use variations on this colour. */
  14551. };
  14552. juce_UseDebuggingNewOperator
  14553. protected:
  14554. void paint (Graphics& g);
  14555. void lookAndFeelChanged();
  14556. void visibilityChanged();
  14557. void colourChanged();
  14558. private:
  14559. double& progress;
  14560. double currentValue;
  14561. bool displayPercentage;
  14562. String displayedMessage, currentMessage;
  14563. uint32 lastCallbackTime;
  14564. void timerCallback();
  14565. ProgressBar (const ProgressBar&);
  14566. ProgressBar& operator= (const ProgressBar&);
  14567. };
  14568. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14569. /*** End of inlined file: juce_ProgressBar.h ***/
  14570. #endif
  14571. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14572. /*** Start of inlined file: juce_Slider.h ***/
  14573. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14574. #define __JUCE_SLIDER_JUCEHEADER__
  14575. /*** Start of inlined file: juce_SliderListener.h ***/
  14576. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14577. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14578. class Slider;
  14579. class JUCE_API SliderListener
  14580. {
  14581. public:
  14582. virtual ~SliderListener() {}
  14583. virtual void sliderValueChanged (Slider* slider) = 0;
  14584. virtual void sliderDragStarted (Slider* slider);
  14585. virtual void sliderDragEnded (Slider* slider);
  14586. };
  14587. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14588. /*** End of inlined file: juce_SliderListener.h ***/
  14589. class JUCE_API Slider : public Component,
  14590. public SettableTooltipClient,
  14591. private AsyncUpdater,
  14592. private ButtonListener,
  14593. private LabelListener,
  14594. private Value::Listener
  14595. {
  14596. public:
  14597. explicit Slider (const String& componentName);
  14598. ~Slider();
  14599. enum SliderStyle
  14600. {
  14601. LinearHorizontal, /**< A traditional horizontal slider. */
  14602. LinearVertical, /**< A traditional vertical slider. */
  14603. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14604. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14605. @see setRotaryParameters */
  14606. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14607. @see setRotaryParameters */
  14608. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14609. @see setRotaryParameters */
  14610. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14611. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14612. @see setMinValue, setMaxValue */
  14613. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14614. @see setMinValue, setMaxValue */
  14615. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14616. value, with the current value being somewhere between them.
  14617. @see setMinValue, setMaxValue */
  14618. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14619. value, with the current value being somewhere between them.
  14620. @see setMinValue, setMaxValue */
  14621. };
  14622. void setSliderStyle (SliderStyle newStyle);
  14623. SliderStyle getSliderStyle() const { return style; }
  14624. void setRotaryParameters (float startAngleRadians,
  14625. float endAngleRadians,
  14626. bool stopAtEnd);
  14627. void setMouseDragSensitivity (int distanceForFullScaleDrag);
  14628. void setVelocityBasedMode (bool isVelocityBased);
  14629. bool getVelocityBasedMode() const { return isVelocityBased; }
  14630. void setVelocityModeParameters (double sensitivity = 1.0,
  14631. int threshold = 1,
  14632. double offset = 0.0,
  14633. bool userCanPressKeyToSwapMode = true);
  14634. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14635. int getVelocityThreshold() const { return velocityModeThreshold; }
  14636. double getVelocityOffset() const { return velocityModeOffset; }
  14637. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14638. void setSkewFactor (double factor);
  14639. void setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint);
  14640. double getSkewFactor() const { return skewFactor; }
  14641. enum IncDecButtonMode
  14642. {
  14643. incDecButtonsNotDraggable,
  14644. incDecButtonsDraggable_AutoDirection,
  14645. incDecButtonsDraggable_Horizontal,
  14646. incDecButtonsDraggable_Vertical
  14647. };
  14648. void setIncDecButtonsMode (IncDecButtonMode mode);
  14649. enum TextEntryBoxPosition
  14650. {
  14651. NoTextBox, /**< Doesn't display a text box. */
  14652. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14653. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14654. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14655. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14656. };
  14657. void setTextBoxStyle (TextEntryBoxPosition newPosition,
  14658. bool isReadOnly,
  14659. int textEntryBoxWidth,
  14660. int textEntryBoxHeight);
  14661. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14662. int getTextBoxWidth() const { return textBoxWidth; }
  14663. int getTextBoxHeight() const { return textBoxHeight; }
  14664. void setTextBoxIsEditable (bool shouldBeEditable);
  14665. bool isTextBoxEditable() const { return editableText; }
  14666. void showTextBox();
  14667. void hideTextBox (bool discardCurrentEditorContents);
  14668. void setValue (double newValue,
  14669. bool sendUpdateMessage = true,
  14670. bool sendMessageSynchronously = false);
  14671. double getValue() const;
  14672. Value& getValueObject() { return currentValue; }
  14673. void setRange (double newMinimum,
  14674. double newMaximum,
  14675. double newInterval = 0);
  14676. double getMaximum() const { return maximum; }
  14677. double getMinimum() const { return minimum; }
  14678. double getInterval() const { return interval; }
  14679. double getMinValue() const;
  14680. Value& getMinValueObject() { return valueMin; }
  14681. void setMinValue (double newValue,
  14682. bool sendUpdateMessage = true,
  14683. bool sendMessageSynchronously = false,
  14684. bool allowNudgingOfOtherValues = false);
  14685. double getMaxValue() const;
  14686. Value& getMaxValueObject() { return valueMax; }
  14687. void setMaxValue (double newValue,
  14688. bool sendUpdateMessage = true,
  14689. bool sendMessageSynchronously = false,
  14690. bool allowNudgingOfOtherValues = false);
  14691. void addListener (SliderListener* listener);
  14692. void removeListener (SliderListener* listener);
  14693. void setDoubleClickReturnValue (bool isDoubleClickEnabled,
  14694. double valueToSetOnDoubleClick);
  14695. double getDoubleClickReturnValue (bool& isEnabled) const;
  14696. void setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease);
  14697. void setSliderSnapsToMousePosition (bool shouldSnapToMouse);
  14698. void setPopupDisplayEnabled (bool isEnabled,
  14699. Component* parentComponentToUse);
  14700. void setPopupMenuEnabled (bool menuEnabled);
  14701. void setScrollWheelEnabled (bool enabled);
  14702. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14703. virtual void startedDragging();
  14704. virtual void stoppedDragging();
  14705. virtual void valueChanged();
  14706. /** Callback to indicate that the user has just moved the slider.
  14707. Note - the valueChanged() method has changed its format and now no longer has
  14708. any parameters. Update your code to use the new version.
  14709. This version has been left here with an int as its return value to cause
  14710. a syntax error if you've got existing code that uses the old version.
  14711. */
  14712. virtual int valueChanged (double) { jassertfalse; return 0; }
  14713. virtual double getValueFromText (const String& text);
  14714. virtual const String getTextFromValue (double value);
  14715. void setTextValueSuffix (const String& suffix);
  14716. const String getTextValueSuffix() const;
  14717. virtual double proportionOfLengthToValue (double proportion);
  14718. virtual double valueToProportionOfLength (double value);
  14719. float getPositionOfValue (double value);
  14720. virtual double snapValue (double attemptedValue, bool userIsDragging);
  14721. void updateText();
  14722. bool isHorizontal() const;
  14723. bool isVertical() const;
  14724. enum ColourIds
  14725. {
  14726. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14727. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14728. and feel class how this is used. */
  14729. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14730. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14731. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14732. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14733. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14734. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14735. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14736. };
  14737. juce_UseDebuggingNewOperator
  14738. protected:
  14739. void labelTextChanged (Label*);
  14740. void paint (Graphics& g);
  14741. void resized();
  14742. void mouseDown (const MouseEvent& e);
  14743. void mouseUp (const MouseEvent& e);
  14744. void mouseDrag (const MouseEvent& e);
  14745. void mouseDoubleClick (const MouseEvent& e);
  14746. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14747. void modifierKeysChanged (const ModifierKeys& modifiers);
  14748. void buttonClicked (Button* button);
  14749. void lookAndFeelChanged();
  14750. void enablementChanged();
  14751. void focusOfChildComponentChanged (FocusChangeType cause);
  14752. void handleAsyncUpdate();
  14753. void colourChanged();
  14754. void valueChanged (Value& value);
  14755. int getNumDecimalPlacesToDisplay() const throw() { return numDecimalPlaces; }
  14756. private:
  14757. ListenerList <SliderListener> listeners;
  14758. Value currentValue, valueMin, valueMax;
  14759. double lastCurrentValue, lastValueMin, lastValueMax;
  14760. double minimum, maximum, interval, doubleClickReturnValue;
  14761. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14762. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14763. int velocityModeThreshold;
  14764. float rotaryStart, rotaryEnd;
  14765. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14766. int mouseDragStartX, mouseDragStartY;
  14767. int sliderRegionStart, sliderRegionSize;
  14768. int sliderBeingDragged;
  14769. int pixelsForFullDragExtent;
  14770. Rectangle<int> sliderRect;
  14771. String textSuffix;
  14772. SliderStyle style;
  14773. TextEntryBoxPosition textBoxPos;
  14774. int textBoxWidth, textBoxHeight;
  14775. IncDecButtonMode incDecButtonMode;
  14776. bool editableText : 1, doubleClickToValue : 1;
  14777. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14778. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14779. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14780. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14781. Label* valueBox;
  14782. Button* incButton;
  14783. Button* decButton;
  14784. ScopedPointer <Component> popupDisplay;
  14785. Component* parentForPopupDisplay;
  14786. float getLinearSliderPos (double value);
  14787. void restoreMouseIfHidden();
  14788. void sendDragStart();
  14789. void sendDragEnd();
  14790. double constrainedValue (double value) const;
  14791. void triggerChangeMessage (bool synchronous);
  14792. bool incDecDragDirectionIsHorizontal() const;
  14793. Slider (const Slider&);
  14794. Slider& operator= (const Slider&);
  14795. };
  14796. #endif // __JUCE_SLIDER_JUCEHEADER__
  14797. /*** End of inlined file: juce_Slider.h ***/
  14798. #endif
  14799. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14800. #endif
  14801. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14802. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14803. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14804. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14805. class TableHeaderComponent;
  14806. class JUCE_API TableHeaderListener
  14807. {
  14808. public:
  14809. TableHeaderListener() {}
  14810. virtual ~TableHeaderListener() {}
  14811. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14812. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14813. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14814. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14815. int columnIdNowBeingDragged);
  14816. };
  14817. class JUCE_API TableHeaderComponent : public Component,
  14818. private AsyncUpdater
  14819. {
  14820. public:
  14821. TableHeaderComponent();
  14822. ~TableHeaderComponent();
  14823. enum ColumnPropertyFlags
  14824. {
  14825. 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. */
  14826. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14827. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14828. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14829. 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. */
  14830. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14831. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14832. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14833. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14834. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14835. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14836. };
  14837. void addColumn (const String& columnName,
  14838. int columnId,
  14839. int width,
  14840. int minimumWidth = 30,
  14841. int maximumWidth = -1,
  14842. int propertyFlags = defaultFlags,
  14843. int insertIndex = -1);
  14844. void removeColumn (int columnIdToRemove);
  14845. void removeAllColumns();
  14846. int getNumColumns (bool onlyCountVisibleColumns) const;
  14847. const String getColumnName (int columnId) const;
  14848. void setColumnName (int columnId, const String& newName);
  14849. void moveColumn (int columnId, int newVisibleIndex);
  14850. int getColumnWidth (int columnId) const;
  14851. void setColumnWidth (int columnId, int newWidth);
  14852. void setColumnVisible (int columnId, bool shouldBeVisible);
  14853. bool isColumnVisible (int columnId) const;
  14854. void setSortColumnId (int columnId, bool sortForwards);
  14855. int getSortColumnId() const;
  14856. bool isSortedForwards() const;
  14857. void reSortTable();
  14858. int getTotalWidth() const;
  14859. int getIndexOfColumnId (int columnId, bool onlyCountVisibleColumns) const;
  14860. int getColumnIdOfIndex (int index, bool onlyCountVisibleColumns) const;
  14861. const Rectangle<int> getColumnPosition (int index) const;
  14862. int getColumnIdAtX (int xToFind) const;
  14863. void setStretchToFitActive (bool shouldStretchToFit);
  14864. bool isStretchToFitActive() const;
  14865. void resizeAllColumnsToFit (int targetTotalWidth);
  14866. void setPopupMenuActive (bool hasMenu);
  14867. bool isPopupMenuActive() const;
  14868. const String toString() const;
  14869. void restoreFromString (const String& storedVersion);
  14870. void addListener (TableHeaderListener* newListener);
  14871. void removeListener (TableHeaderListener* listenerToRemove);
  14872. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14873. virtual void addMenuItems (PopupMenu& menu, int columnIdClicked);
  14874. virtual void reactToMenuItem (int menuReturnId, int columnIdClicked);
  14875. void paint (Graphics& g);
  14876. void resized();
  14877. void mouseMove (const MouseEvent&);
  14878. void mouseEnter (const MouseEvent&);
  14879. void mouseExit (const MouseEvent&);
  14880. void mouseDown (const MouseEvent&);
  14881. void mouseDrag (const MouseEvent&);
  14882. void mouseUp (const MouseEvent&);
  14883. const MouseCursor getMouseCursor();
  14884. virtual void showColumnChooserMenu (int columnIdClicked);
  14885. juce_UseDebuggingNewOperator
  14886. private:
  14887. struct ColumnInfo
  14888. {
  14889. String name;
  14890. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14891. double lastDeliberateWidth;
  14892. bool isVisible() const;
  14893. };
  14894. OwnedArray <ColumnInfo> columns;
  14895. Array <TableHeaderListener*> listeners;
  14896. ScopedPointer <Component> dragOverlayComp;
  14897. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14898. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14899. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14900. ColumnInfo* getInfoForId (int columnId) const;
  14901. int visibleIndexToTotalIndex (int visibleIndex) const;
  14902. void sendColumnsChanged();
  14903. void handleAsyncUpdate();
  14904. void beginDrag (const MouseEvent&);
  14905. void endDrag (int finalIndex);
  14906. int getResizeDraggerAt (int mouseX) const;
  14907. void updateColumnUnderMouse (int x, int y);
  14908. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14909. TableHeaderComponent (const TableHeaderComponent&);
  14910. TableHeaderComponent operator= (const TableHeaderComponent&);
  14911. };
  14912. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14913. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14914. #endif
  14915. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14916. /*** Start of inlined file: juce_TableListBox.h ***/
  14917. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14918. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14919. class JUCE_API TableListBoxModel
  14920. {
  14921. public:
  14922. TableListBoxModel() {}
  14923. virtual ~TableListBoxModel() {}
  14924. virtual int getNumRows() = 0;
  14925. virtual void paintRowBackground (Graphics& g,
  14926. int rowNumber,
  14927. int width, int height,
  14928. bool rowIsSelected) = 0;
  14929. virtual void paintCell (Graphics& g,
  14930. int rowNumber,
  14931. int columnId,
  14932. int width, int height,
  14933. bool rowIsSelected) = 0;
  14934. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14935. Component* existingComponentToUpdate);
  14936. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14937. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14938. virtual void backgroundClicked();
  14939. virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
  14940. virtual int getColumnAutoSizeWidth (int columnId);
  14941. virtual const String getCellTooltip (int rowNumber, int columnId);
  14942. virtual void selectedRowsChanged (int lastRowSelected);
  14943. virtual void deleteKeyPressed (int lastRowSelected);
  14944. virtual void returnKeyPressed (int lastRowSelected);
  14945. virtual void listWasScrolled();
  14946. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14947. };
  14948. class JUCE_API TableListBox : public ListBox,
  14949. private ListBoxModel,
  14950. private TableHeaderListener
  14951. {
  14952. public:
  14953. TableListBox (const String& componentName,
  14954. TableListBoxModel* model);
  14955. ~TableListBox();
  14956. void setModel (TableListBoxModel* newModel);
  14957. TableListBoxModel* getModel() const { return model; }
  14958. TableHeaderComponent* getHeader() const { return header; }
  14959. void setHeaderHeight (int newHeight);
  14960. int getHeaderHeight() const;
  14961. void autoSizeColumn (int columnId);
  14962. void autoSizeAllColumns();
  14963. void setAutoSizeMenuOptionShown (bool shouldBeShown);
  14964. bool isAutoSizeMenuOptionShown() const;
  14965. const Rectangle<int> getCellPosition (int columnId,
  14966. int rowNumber,
  14967. bool relativeToComponentTopLeft) const;
  14968. void scrollToEnsureColumnIsOnscreen (int columnId);
  14969. int getNumRows();
  14970. void paintListBoxItem (int, Graphics&, int, int, bool);
  14971. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14972. void selectedRowsChanged (int lastRowSelected);
  14973. void deleteKeyPressed (int currentSelectedRow);
  14974. void returnKeyPressed (int currentSelectedRow);
  14975. void backgroundClicked();
  14976. void listWasScrolled();
  14977. void tableColumnsChanged (TableHeaderComponent*);
  14978. void tableColumnsResized (TableHeaderComponent*);
  14979. void tableSortOrderChanged (TableHeaderComponent*);
  14980. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14981. void resized();
  14982. juce_UseDebuggingNewOperator
  14983. private:
  14984. TableHeaderComponent* header;
  14985. TableListBoxModel* model;
  14986. int columnIdNowBeingDragged;
  14987. bool autoSizeOptionsShown;
  14988. void updateColumnComponents() const;
  14989. TableListBox (const TableListBox&);
  14990. TableListBox& operator= (const TableListBox&);
  14991. };
  14992. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14993. /*** End of inlined file: juce_TableListBox.h ***/
  14994. #endif
  14995. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14996. #endif
  14997. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14998. #endif
  14999. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  15000. #endif
  15001. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15002. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  15003. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15004. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15005. class JUCE_API ToolbarItemFactory
  15006. {
  15007. public:
  15008. ToolbarItemFactory();
  15009. virtual ~ToolbarItemFactory();
  15010. enum SpecialItemIds
  15011. {
  15012. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  15013. can be placed between sets of items to break them into groups. */
  15014. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  15015. items.*/
  15016. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  15017. either side of it, filling any available space. */
  15018. };
  15019. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  15020. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  15021. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  15022. };
  15023. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15024. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  15025. #endif
  15026. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15027. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15028. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15029. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15030. class JUCE_API ToolbarItemPalette : public Component,
  15031. public DragAndDropContainer
  15032. {
  15033. public:
  15034. ToolbarItemPalette (ToolbarItemFactory& factory,
  15035. Toolbar* toolbar);
  15036. ~ToolbarItemPalette();
  15037. void resized();
  15038. juce_UseDebuggingNewOperator
  15039. private:
  15040. ToolbarItemFactory& factory;
  15041. Toolbar* toolbar;
  15042. Viewport* viewport;
  15043. friend class Toolbar;
  15044. void replaceComponent (ToolbarItemComponent* comp);
  15045. ToolbarItemPalette (const ToolbarItemPalette&);
  15046. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15047. };
  15048. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15049. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15050. #endif
  15051. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15052. /*** Start of inlined file: juce_TreeView.h ***/
  15053. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15054. #define __JUCE_TREEVIEW_JUCEHEADER__
  15055. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15056. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15057. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15058. class JUCE_API FileDragAndDropTarget
  15059. {
  15060. public:
  15061. virtual ~FileDragAndDropTarget() {}
  15062. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15063. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15064. virtual void fileDragMove (const StringArray& files, int x, int y);
  15065. virtual void fileDragExit (const StringArray& files);
  15066. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15067. };
  15068. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15069. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15070. class TreeView;
  15071. class JUCE_API TreeViewItem
  15072. {
  15073. public:
  15074. TreeViewItem();
  15075. virtual ~TreeViewItem();
  15076. int getNumSubItems() const throw();
  15077. TreeViewItem* getSubItem (int index) const throw();
  15078. void clearSubItems();
  15079. void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
  15080. void removeSubItem (int index, bool deleteItem = true);
  15081. TreeView* getOwnerView() const throw() { return ownerView; }
  15082. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15083. bool isOpen() const throw();
  15084. void setOpen (bool shouldBeOpen);
  15085. bool isSelected() const throw();
  15086. void setSelected (bool shouldBeSelected,
  15087. bool deselectOtherItemsFirst);
  15088. const Rectangle<int> getItemPosition (bool relativeToTreeViewTopLeft) const throw();
  15089. void treeHasChanged() const throw();
  15090. void repaintItem() const;
  15091. int getRowNumberInTree() const throw();
  15092. bool areAllParentsOpen() const throw();
  15093. void setLinesDrawnForSubItems (bool shouldDrawLines) throw();
  15094. virtual bool mightContainSubItems() = 0;
  15095. virtual const String getUniqueName() const;
  15096. virtual void itemOpennessChanged (bool isNowOpen);
  15097. virtual int getItemWidth() const { return -1; }
  15098. virtual int getItemHeight() const { return 20; }
  15099. virtual bool canBeSelected() const { return true; }
  15100. virtual Component* createItemComponent() { return 0; }
  15101. virtual void paintItem (Graphics& g, int width, int height);
  15102. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15103. virtual void itemClicked (const MouseEvent& e);
  15104. virtual void itemDoubleClicked (const MouseEvent& e);
  15105. virtual void itemSelectionChanged (bool isNowSelected);
  15106. virtual const String getTooltip();
  15107. virtual const String getDragSourceDescription();
  15108. virtual bool isInterestedInFileDrag (const StringArray& files);
  15109. virtual void filesDropped (const StringArray& files, int insertIndex);
  15110. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15111. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15112. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15113. XmlElement* getOpennessState() const throw();
  15114. void restoreOpennessState (const XmlElement& xml) throw();
  15115. int getIndexInParent() const throw();
  15116. bool isLastOfSiblings() const throw();
  15117. const String getItemIdentifierString() const;
  15118. juce_UseDebuggingNewOperator
  15119. private:
  15120. TreeView* ownerView;
  15121. TreeViewItem* parentItem;
  15122. OwnedArray <TreeViewItem> subItems;
  15123. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15124. int uid;
  15125. bool selected : 1;
  15126. bool redrawNeeded : 1;
  15127. bool drawLinesInside : 1;
  15128. bool drawsInLeftMargin : 1;
  15129. unsigned int openness : 2;
  15130. friend class TreeView;
  15131. friend class TreeViewContentComponent;
  15132. void updatePositions (int newY);
  15133. int getIndentX() const throw();
  15134. void setOwnerView (TreeView* newOwner) throw();
  15135. void paintRecursively (Graphics& g, int width);
  15136. TreeViewItem* getTopLevelItem() throw();
  15137. TreeViewItem* findItemRecursively (int y) throw();
  15138. TreeViewItem* getDeepestOpenParentItem() throw();
  15139. int getNumRows() const throw();
  15140. TreeViewItem* getItemOnRow (int index) throw();
  15141. void deselectAllRecursively();
  15142. int countSelectedItemsRecursively() const throw();
  15143. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15144. TreeViewItem* getNextVisibleItem (bool recurse) const throw();
  15145. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15146. TreeViewItem (const TreeViewItem&);
  15147. TreeViewItem& operator= (const TreeViewItem&);
  15148. };
  15149. class JUCE_API TreeView : public Component,
  15150. public SettableTooltipClient,
  15151. public FileDragAndDropTarget,
  15152. public DragAndDropTarget,
  15153. private AsyncUpdater
  15154. {
  15155. public:
  15156. TreeView (const String& componentName = String::empty);
  15157. ~TreeView();
  15158. void setRootItem (TreeViewItem* newRootItem);
  15159. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15160. void deleteRootItem();
  15161. void setRootItemVisible (bool shouldBeVisible);
  15162. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15163. void setDefaultOpenness (bool isOpenByDefault);
  15164. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15165. void setMultiSelectEnabled (bool canMultiSelect);
  15166. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15167. void setOpenCloseButtonsVisible (bool shouldBeVisible);
  15168. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15169. void clearSelectedItems();
  15170. int getNumSelectedItems() const throw();
  15171. TreeViewItem* getSelectedItem (int index) const throw();
  15172. int getNumRowsInTree() const;
  15173. TreeViewItem* getItemOnRow (int index) const;
  15174. TreeViewItem* getItemAt (int yPosition) const throw();
  15175. void scrollToKeepItemVisible (TreeViewItem* item);
  15176. Viewport* getViewport() const throw();
  15177. int getIndentSize() const throw() { return indentSize; }
  15178. void setIndentSize (int newIndentSize);
  15179. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15180. XmlElement* getOpennessState (bool alsoIncludeScrollPosition) const;
  15181. void restoreOpennessState (const XmlElement& newState);
  15182. enum ColourIds
  15183. {
  15184. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15185. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15186. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15187. };
  15188. void paint (Graphics& g);
  15189. void resized();
  15190. bool keyPressed (const KeyPress& key);
  15191. void colourChanged();
  15192. void enablementChanged();
  15193. bool isInterestedInFileDrag (const StringArray& files);
  15194. void fileDragEnter (const StringArray& files, int x, int y);
  15195. void fileDragMove (const StringArray& files, int x, int y);
  15196. void fileDragExit (const StringArray& files);
  15197. void filesDropped (const StringArray& files, int x, int y);
  15198. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15199. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15200. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15201. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15202. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15203. juce_UseDebuggingNewOperator
  15204. private:
  15205. friend class TreeViewItem;
  15206. friend class TreeViewContentComponent;
  15207. class TreeViewport;
  15208. TreeViewport* viewport;
  15209. CriticalSection nodeAlterationLock;
  15210. TreeViewItem* rootItem;
  15211. class InsertPointHighlight;
  15212. class TargetGroupHighlight;
  15213. InsertPointHighlight* dragInsertPointHighlight;
  15214. TargetGroupHighlight* dragTargetGroupHighlight;
  15215. int indentSize;
  15216. bool defaultOpenness : 1;
  15217. bool needsRecalculating : 1;
  15218. bool rootItemVisible : 1;
  15219. bool multiSelectEnabled : 1;
  15220. bool openCloseButtonsVisible : 1;
  15221. void itemsChanged() throw();
  15222. void handleAsyncUpdate();
  15223. void moveSelectedRow (int delta);
  15224. void updateButtonUnderMouse (const MouseEvent& e);
  15225. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15226. void hideDragHighlight() throw();
  15227. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15228. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15229. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15230. const StringArray& files, const String& sourceDescription,
  15231. Component* sourceComponent) const throw();
  15232. TreeView (const TreeView&);
  15233. TreeView& operator= (const TreeView&);
  15234. };
  15235. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15236. /*** End of inlined file: juce_TreeView.h ***/
  15237. #endif
  15238. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15239. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15240. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15241. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15242. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15243. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15244. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15245. /*** Start of inlined file: juce_FileFilter.h ***/
  15246. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15247. #define __JUCE_FILEFILTER_JUCEHEADER__
  15248. class JUCE_API FileFilter
  15249. {
  15250. public:
  15251. FileFilter (const String& filterDescription);
  15252. virtual ~FileFilter();
  15253. const String& getDescription() const throw();
  15254. virtual bool isFileSuitable (const File& file) const = 0;
  15255. virtual bool isDirectorySuitable (const File& file) const = 0;
  15256. protected:
  15257. String description;
  15258. };
  15259. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15260. /*** End of inlined file: juce_FileFilter.h ***/
  15261. /*** Start of inlined file: juce_Image.h ***/
  15262. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15263. #define __JUCE_IMAGE_JUCEHEADER__
  15264. class JUCE_API Image
  15265. {
  15266. public:
  15267. enum PixelFormat
  15268. {
  15269. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15270. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15271. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15272. };
  15273. Image (PixelFormat format,
  15274. int imageWidth,
  15275. int imageHeight,
  15276. bool clearImage);
  15277. Image (const Image& other);
  15278. virtual ~Image();
  15279. static Image* createNativeImage (PixelFormat format,
  15280. int imageWidth,
  15281. int imageHeight,
  15282. bool clearImage);
  15283. int getWidth() const throw() { return imageWidth; }
  15284. int getHeight() const throw() { return imageHeight; }
  15285. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15286. PixelFormat getFormat() const throw() { return format; }
  15287. bool isARGB() const throw() { return format == ARGB; }
  15288. bool isRGB() const throw() { return format == RGB; }
  15289. bool hasAlphaChannel() const throw() { return format != RGB; }
  15290. virtual void clear (int x, int y, int w, int h,
  15291. const Colour& colourToClearTo = Colour (0x00000000));
  15292. virtual Image* createCopy (int newWidth = -1,
  15293. int newHeight = -1,
  15294. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15295. virtual Image* createCopyOfAlphaChannel() const;
  15296. virtual const Colour getPixelAt (int x, int y) const;
  15297. virtual void setPixelAt (int x, int y, const Colour& colour);
  15298. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15299. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15300. virtual void desaturate();
  15301. class BitmapData
  15302. {
  15303. public:
  15304. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15305. BitmapData (const Image& image, int x, int y, int w, int h);
  15306. ~BitmapData();
  15307. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15308. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15309. uint8* data;
  15310. int lineStride, pixelStride, width, height;
  15311. private:
  15312. BitmapData (const BitmapData&);
  15313. BitmapData& operator= (const BitmapData&);
  15314. };
  15315. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15316. const uint8* sourcePixelData, int sourceLineStride);
  15317. virtual void moveImageSection (int destX, int destY,
  15318. int sourceX, int sourceY,
  15319. int width, int height);
  15320. void createSolidAreaMask (RectangleList& result,
  15321. float alphaThreshold = 0.5f) const;
  15322. juce_UseDebuggingNewOperator
  15323. virtual LowLevelGraphicsContext* createLowLevelContext();
  15324. protected:
  15325. friend class BitmapData;
  15326. const PixelFormat format;
  15327. const int imageWidth, imageHeight;
  15328. Image (PixelFormat format,
  15329. int imageWidth,
  15330. int imageHeight);
  15331. int pixelStride, lineStride;
  15332. HeapBlock <uint8> imageDataAllocated;
  15333. uint8* imageData;
  15334. private:
  15335. Image& operator= (const Image&);
  15336. };
  15337. #endif // __JUCE_IMAGE_JUCEHEADER__
  15338. /*** End of inlined file: juce_Image.h ***/
  15339. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15340. public TimeSliceClient
  15341. {
  15342. public:
  15343. DirectoryContentsList (const FileFilter* fileFilter,
  15344. TimeSliceThread& threadToUse);
  15345. ~DirectoryContentsList();
  15346. void setDirectory (const File& directory,
  15347. bool includeDirectories,
  15348. bool includeFiles);
  15349. const File& getDirectory() const;
  15350. void clear();
  15351. void refresh();
  15352. bool isStillLoading() const;
  15353. void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
  15354. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15355. struct FileInfo
  15356. {
  15357. String filename;
  15358. int64 fileSize;
  15359. Time modificationTime;
  15360. Time creationTime;
  15361. bool isDirectory;
  15362. bool isReadOnly;
  15363. };
  15364. int getNumFiles() const;
  15365. bool getFileInfo (int index, FileInfo& resultInfo) const;
  15366. const File getFile (int index) const;
  15367. const FileFilter* getFilter() const { return fileFilter; }
  15368. bool useTimeSlice();
  15369. TimeSliceThread& getTimeSliceThread() { return thread; }
  15370. static int compareElements (const DirectoryContentsList::FileInfo* first,
  15371. const DirectoryContentsList::FileInfo* second);
  15372. juce_UseDebuggingNewOperator
  15373. private:
  15374. File root;
  15375. const FileFilter* fileFilter;
  15376. TimeSliceThread& thread;
  15377. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15378. CriticalSection fileListLock;
  15379. OwnedArray <FileInfo> files;
  15380. void* volatile fileFindHandle;
  15381. bool volatile shouldStop;
  15382. void changed();
  15383. bool checkNextFile (bool& hasChanged);
  15384. bool addFile (const String& filename, bool isDir, bool isHidden,
  15385. const int64 fileSize, const Time& modTime,
  15386. const Time& creationTime, bool isReadOnly);
  15387. DirectoryContentsList (const DirectoryContentsList&);
  15388. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15389. };
  15390. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15391. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15392. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15393. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15394. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15395. class JUCE_API FileBrowserListener
  15396. {
  15397. public:
  15398. virtual ~FileBrowserListener();
  15399. virtual void selectionChanged() = 0;
  15400. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15401. virtual void fileDoubleClicked (const File& file) = 0;
  15402. };
  15403. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15404. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15405. class JUCE_API DirectoryContentsDisplayComponent
  15406. {
  15407. public:
  15408. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15409. virtual ~DirectoryContentsDisplayComponent();
  15410. virtual int getNumSelectedFiles() const = 0;
  15411. virtual const File getSelectedFile (int index) const = 0;
  15412. virtual void scrollToTop() = 0;
  15413. void addListener (FileBrowserListener* listener);
  15414. void removeListener (FileBrowserListener* listener);
  15415. enum ColourIds
  15416. {
  15417. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15418. textColourId = 0x1000541, /**< The colour for the text. */
  15419. };
  15420. void sendSelectionChangeMessage();
  15421. void sendDoubleClickMessage (const File& file);
  15422. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15423. juce_UseDebuggingNewOperator
  15424. protected:
  15425. DirectoryContentsList& fileList;
  15426. ListenerList <FileBrowserListener> listeners;
  15427. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15428. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15429. };
  15430. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15431. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15432. #endif
  15433. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15434. #endif
  15435. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15436. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15437. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15438. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15439. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15440. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15441. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15442. class JUCE_API FilePreviewComponent : public Component
  15443. {
  15444. public:
  15445. FilePreviewComponent();
  15446. ~FilePreviewComponent();
  15447. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15448. juce_UseDebuggingNewOperator
  15449. private:
  15450. FilePreviewComponent (const FilePreviewComponent&);
  15451. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15452. };
  15453. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15454. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15455. class JUCE_API FileBrowserComponent : public Component,
  15456. public ChangeBroadcaster,
  15457. private FileBrowserListener,
  15458. private TextEditorListener,
  15459. private ButtonListener,
  15460. private ComboBoxListener,
  15461. private FileFilter
  15462. {
  15463. public:
  15464. enum FileChooserFlags
  15465. {
  15466. openMode = 1, /**< specifies that the component should allow the user to
  15467. choose an existing file with the intention of opening it. */
  15468. saveMode = 2, /**< specifies that the component should allow the user to specify
  15469. the name of a file that will be used to save something. */
  15470. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15471. conjunction with canSelectDirectories). */
  15472. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15473. conjuction with canSelectFiles). */
  15474. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15475. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15476. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15477. };
  15478. FileBrowserComponent (int flags,
  15479. const File& initialFileOrDirectory,
  15480. const FileFilter* fileFilter,
  15481. FilePreviewComponent* previewComp);
  15482. ~FileBrowserComponent();
  15483. int getNumSelectedFiles() const throw();
  15484. const File getSelectedFile (int index) const throw();
  15485. bool currentFileIsValid() const;
  15486. const File getHighlightedFile() const throw();
  15487. const File getRoot() const;
  15488. void setRoot (const File& newRootDirectory);
  15489. void goUp();
  15490. void refresh();
  15491. virtual const String getActionVerb() const;
  15492. bool isSaveMode() const throw();
  15493. void addListener (FileBrowserListener* listener);
  15494. void removeListener (FileBrowserListener* listener);
  15495. void resized();
  15496. void buttonClicked (Button* b);
  15497. void comboBoxChanged (ComboBox*);
  15498. void textEditorTextChanged (TextEditor& editor);
  15499. void textEditorReturnKeyPressed (TextEditor& editor);
  15500. void textEditorEscapeKeyPressed (TextEditor& editor);
  15501. void textEditorFocusLost (TextEditor& editor);
  15502. bool keyPressed (const KeyPress& key);
  15503. void selectionChanged();
  15504. void fileClicked (const File& f, const MouseEvent& e);
  15505. void fileDoubleClicked (const File& f);
  15506. bool isFileSuitable (const File& file) const;
  15507. bool isDirectorySuitable (const File&) const;
  15508. FilePreviewComponent* getPreviewComponent() const throw();
  15509. juce_UseDebuggingNewOperator
  15510. protected:
  15511. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15512. private:
  15513. ScopedPointer <DirectoryContentsList> fileList;
  15514. const FileFilter* fileFilter;
  15515. int flags;
  15516. File currentRoot;
  15517. Array<File> chosenFiles;
  15518. ListenerList <FileBrowserListener> listeners;
  15519. DirectoryContentsDisplayComponent* fileListComponent;
  15520. FilePreviewComponent* previewComp;
  15521. ComboBox* currentPathBox;
  15522. TextEditor* filenameBox;
  15523. Button* goUpButton;
  15524. TimeSliceThread thread;
  15525. void sendListenerChangeMessage();
  15526. bool isFileOrDirSuitable (const File& f) const;
  15527. FileBrowserComponent (const FileBrowserComponent&);
  15528. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15529. };
  15530. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15531. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15532. #endif
  15533. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15534. #endif
  15535. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15536. /*** Start of inlined file: juce_FileChooser.h ***/
  15537. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15538. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15539. class JUCE_API FileChooser
  15540. {
  15541. public:
  15542. FileChooser (const String& dialogBoxTitle,
  15543. const File& initialFileOrDirectory = File::nonexistent,
  15544. const String& filePatternsAllowed = String::empty,
  15545. bool useOSNativeDialogBox = true);
  15546. ~FileChooser();
  15547. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15548. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15549. bool browseForFileToSave (bool warnAboutOverwritingExistingFiles);
  15550. bool browseForDirectory();
  15551. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15552. const File getResult() const;
  15553. const Array<File>& getResults() const;
  15554. juce_UseDebuggingNewOperator
  15555. private:
  15556. String title, filters;
  15557. File startingFile;
  15558. Array<File> results;
  15559. bool useNativeDialogBox;
  15560. bool showDialog (bool selectsDirectories, bool selectsFiles, bool isSave,
  15561. bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15562. FilePreviewComponent* previewComponent);
  15563. static void showPlatformDialog (Array<File>& results, const String& title, const File& file,
  15564. const String& filters, bool selectsDirectories, bool selectsFiles,
  15565. bool isSave, bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15566. FilePreviewComponent* previewComponent);
  15567. };
  15568. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15569. /*** End of inlined file: juce_FileChooser.h ***/
  15570. #endif
  15571. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15572. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15573. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15574. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15575. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15576. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15577. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15578. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15579. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15580. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15581. /*** Start of inlined file: juce_DropShadower.h ***/
  15582. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15583. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15584. class JUCE_API DropShadower : public ComponentListener
  15585. {
  15586. public:
  15587. DropShadower (float alpha = 0.5f,
  15588. int xOffset = 1,
  15589. int yOffset = 5,
  15590. float blurRadius = 10.0f);
  15591. virtual ~DropShadower();
  15592. void setOwner (Component* componentToFollow);
  15593. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15594. void componentBroughtToFront (Component& component);
  15595. void componentChildrenChanged (Component& component);
  15596. void componentParentHierarchyChanged (Component& component);
  15597. void componentVisibilityChanged (Component& component);
  15598. juce_UseDebuggingNewOperator
  15599. private:
  15600. Component* owner;
  15601. int numShadows;
  15602. Component* shadowWindows[4];
  15603. Image* shadowImageSections[12];
  15604. const int shadowEdge, xOffset, yOffset;
  15605. const float alpha, blurRadius;
  15606. bool inDestructor, reentrant;
  15607. void updateShadows();
  15608. void setShadowImage (Image* const src,
  15609. const int num,
  15610. const int w, const int h,
  15611. const int sx, const int sy);
  15612. void bringShadowWindowsToFront();
  15613. void deleteShadowWindows();
  15614. DropShadower (const DropShadower&);
  15615. DropShadower& operator= (const DropShadower&);
  15616. };
  15617. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15618. /*** End of inlined file: juce_DropShadower.h ***/
  15619. class JUCE_API TopLevelWindow : public Component
  15620. {
  15621. public:
  15622. TopLevelWindow (const String& name, bool addToDesktop);
  15623. ~TopLevelWindow();
  15624. bool isActiveWindow() const throw() { return windowIsActive_; }
  15625. void centreAroundComponent (Component* componentToCentreAround,
  15626. int width, int height);
  15627. void setDropShadowEnabled (bool useShadow);
  15628. void setUsingNativeTitleBar (bool useNativeTitleBar);
  15629. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15630. static int getNumTopLevelWindows() throw();
  15631. static TopLevelWindow* getTopLevelWindow (int index) throw();
  15632. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15633. juce_UseDebuggingNewOperator
  15634. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15635. protected:
  15636. virtual void activeWindowStatusChanged();
  15637. void focusOfChildComponentChanged (FocusChangeType cause);
  15638. void parentHierarchyChanged();
  15639. void visibilityChanged();
  15640. virtual int getDesktopWindowStyleFlags() const;
  15641. void recreateDesktopWindow();
  15642. private:
  15643. friend class TopLevelWindowManager;
  15644. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15645. ScopedPointer <DropShadower> shadower;
  15646. void setWindowActive (bool isNowActive) throw();
  15647. TopLevelWindow (const TopLevelWindow&);
  15648. TopLevelWindow& operator= (const TopLevelWindow&);
  15649. };
  15650. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15651. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15652. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15653. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15654. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15655. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15656. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15657. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15658. class JUCE_API ComponentBoundsConstrainer
  15659. {
  15660. public:
  15661. ComponentBoundsConstrainer() throw();
  15662. virtual ~ComponentBoundsConstrainer();
  15663. void setMinimumWidth (int minimumWidth) throw();
  15664. int getMinimumWidth() const throw() { return minW; }
  15665. void setMaximumWidth (int maximumWidth) throw();
  15666. int getMaximumWidth() const throw() { return maxW; }
  15667. void setMinimumHeight (int minimumHeight) throw();
  15668. int getMinimumHeight() const throw() { return minH; }
  15669. void setMaximumHeight (int maximumHeight) throw();
  15670. int getMaximumHeight() const throw() { return maxH; }
  15671. void setMinimumSize (int minimumWidth,
  15672. int minimumHeight) throw();
  15673. void setMaximumSize (int maximumWidth,
  15674. int maximumHeight) throw();
  15675. void setSizeLimits (int minimumWidth,
  15676. int minimumHeight,
  15677. int maximumWidth,
  15678. int maximumHeight) throw();
  15679. void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
  15680. int minimumWhenOffTheLeft,
  15681. int minimumWhenOffTheBottom,
  15682. int minimumWhenOffTheRight) throw();
  15683. void setFixedAspectRatio (double widthOverHeight) throw();
  15684. double getFixedAspectRatio() const throw();
  15685. virtual void checkBounds (Rectangle<int>& bounds,
  15686. const Rectangle<int>& previousBounds,
  15687. const Rectangle<int>& limits,
  15688. bool isStretchingTop,
  15689. bool isStretchingLeft,
  15690. bool isStretchingBottom,
  15691. bool isStretchingRight);
  15692. virtual void resizeStart();
  15693. virtual void resizeEnd();
  15694. void setBoundsForComponent (Component* const component,
  15695. const Rectangle<int>& bounds,
  15696. bool isStretchingTop,
  15697. bool isStretchingLeft,
  15698. bool isStretchingBottom,
  15699. bool isStretchingRight);
  15700. void checkComponentBounds (Component* component);
  15701. virtual void applyBoundsToComponent (Component* component,
  15702. const Rectangle<int>& bounds);
  15703. juce_UseDebuggingNewOperator
  15704. private:
  15705. int minW, maxW, minH, maxH;
  15706. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15707. double aspectRatio;
  15708. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15709. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15710. };
  15711. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15712. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15713. class JUCE_API ComponentDragger
  15714. {
  15715. public:
  15716. ComponentDragger();
  15717. virtual ~ComponentDragger();
  15718. void startDraggingComponent (Component* const componentToDrag,
  15719. ComponentBoundsConstrainer* constrainer);
  15720. void dragComponent (Component* const componentToDrag,
  15721. const MouseEvent& e);
  15722. juce_UseDebuggingNewOperator
  15723. private:
  15724. ComponentBoundsConstrainer* constrainer;
  15725. Point<int> originalPos;
  15726. ComponentDragger (const ComponentDragger&);
  15727. ComponentDragger& operator= (const ComponentDragger&);
  15728. };
  15729. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15730. /*** End of inlined file: juce_ComponentDragger.h ***/
  15731. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15732. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15733. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15734. class JUCE_API ResizableBorderComponent : public Component
  15735. {
  15736. public:
  15737. ResizableBorderComponent (Component* componentToResize,
  15738. ComponentBoundsConstrainer* constrainer);
  15739. ~ResizableBorderComponent();
  15740. void setBorderThickness (const BorderSize& newBorderSize);
  15741. const BorderSize getBorderThickness() const;
  15742. class Zone
  15743. {
  15744. public:
  15745. enum Zones
  15746. {
  15747. centre = 0,
  15748. left = 1,
  15749. top = 2,
  15750. right = 4,
  15751. bottom = 8
  15752. };
  15753. explicit Zone (int zoneFlags = 0) throw();
  15754. Zone (const Zone& other) throw();
  15755. Zone& operator= (const Zone& other) throw();
  15756. bool operator== (const Zone& other) const throw();
  15757. bool operator!= (const Zone& other) const throw();
  15758. static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
  15759. const BorderSize& border,
  15760. const Point<int>& position);
  15761. const MouseCursor getMouseCursor() const throw();
  15762. bool isDraggingWholeObject() const throw() { return zone == centre; }
  15763. bool isDraggingLeftEdge() const throw() { return (zone & left) != 0; }
  15764. bool isDraggingRightEdge() const throw() { return (zone & right) != 0; }
  15765. bool isDraggingTopEdge() const throw() { return (zone & top) != 0; }
  15766. bool isDraggingBottomEdge() const throw() { return (zone & bottom) != 0; }
  15767. const Rectangle<int> resizeRectangleBy (Rectangle<int> original,
  15768. const Point<int>& distance) const throw();
  15769. int getZoneFlags() const throw() { return zone; }
  15770. private:
  15771. int zone;
  15772. };
  15773. juce_UseDebuggingNewOperator
  15774. protected:
  15775. void paint (Graphics& g);
  15776. void mouseEnter (const MouseEvent& e);
  15777. void mouseMove (const MouseEvent& e);
  15778. void mouseDown (const MouseEvent& e);
  15779. void mouseDrag (const MouseEvent& e);
  15780. void mouseUp (const MouseEvent& e);
  15781. bool hitTest (int x, int y);
  15782. private:
  15783. Component::SafePointer<Component> component;
  15784. ComponentBoundsConstrainer* constrainer;
  15785. BorderSize borderSize;
  15786. Rectangle<int> originalBounds;
  15787. Zone mouseZone;
  15788. void updateMouseZone (const MouseEvent& e);
  15789. ResizableBorderComponent (const ResizableBorderComponent&);
  15790. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15791. };
  15792. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15793. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15794. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15795. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15796. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15797. class JUCE_API ResizableCornerComponent : public Component
  15798. {
  15799. public:
  15800. ResizableCornerComponent (Component* componentToResize,
  15801. ComponentBoundsConstrainer* constrainer);
  15802. ~ResizableCornerComponent();
  15803. juce_UseDebuggingNewOperator
  15804. protected:
  15805. void paint (Graphics& g);
  15806. void mouseDown (const MouseEvent& e);
  15807. void mouseDrag (const MouseEvent& e);
  15808. void mouseUp (const MouseEvent& e);
  15809. bool hitTest (int x, int y);
  15810. private:
  15811. Component::SafePointer<Component> component;
  15812. ComponentBoundsConstrainer* constrainer;
  15813. Rectangle<int> originalBounds;
  15814. ResizableCornerComponent (const ResizableCornerComponent&);
  15815. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15816. };
  15817. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15818. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15819. class JUCE_API ResizableWindow : public TopLevelWindow
  15820. {
  15821. public:
  15822. ResizableWindow (const String& name,
  15823. bool addToDesktop);
  15824. ResizableWindow (const String& name,
  15825. const Colour& backgroundColour,
  15826. bool addToDesktop);
  15827. ~ResizableWindow();
  15828. const Colour getBackgroundColour() const throw();
  15829. void setBackgroundColour (const Colour& newColour);
  15830. void setResizable (bool shouldBeResizable,
  15831. bool useBottomRightCornerResizer);
  15832. bool isResizable() const throw();
  15833. void setResizeLimits (int newMinimumWidth,
  15834. int newMinimumHeight,
  15835. int newMaximumWidth,
  15836. int newMaximumHeight) throw();
  15837. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15838. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15839. void setBoundsConstrained (const Rectangle<int>& bounds);
  15840. bool isFullScreen() const;
  15841. void setFullScreen (bool shouldBeFullScreen);
  15842. bool isMinimised() const;
  15843. void setMinimised (bool shouldMinimise);
  15844. const String getWindowStateAsString();
  15845. bool restoreWindowStateFromString (const String& previousState);
  15846. Component* getContentComponent() const throw() { return contentComponent; }
  15847. void setContentComponent (Component* newContentComponent,
  15848. bool deleteOldOne = true,
  15849. bool resizeToFit = false);
  15850. void setContentComponentSize (int width, int height);
  15851. enum ColourIds
  15852. {
  15853. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15854. };
  15855. juce_UseDebuggingNewOperator
  15856. protected:
  15857. void paint (Graphics& g);
  15858. void moved();
  15859. void resized();
  15860. void mouseDown (const MouseEvent& e);
  15861. void mouseDrag (const MouseEvent& e);
  15862. void lookAndFeelChanged();
  15863. void childBoundsChanged (Component* child);
  15864. void parentSizeChanged();
  15865. void visibilityChanged();
  15866. void activeWindowStatusChanged();
  15867. int getDesktopWindowStyleFlags() const;
  15868. virtual const BorderSize getBorderThickness();
  15869. virtual const BorderSize getContentComponentBorder();
  15870. #ifdef JUCE_DEBUG
  15871. void addChildComponent (Component* child, int zOrder = -1);
  15872. void addAndMakeVisible (Component* child, int zOrder = -1);
  15873. #endif
  15874. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15875. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15876. private:
  15877. ScopedPointer <Component> contentComponent;
  15878. bool resizeToFitContent, fullscreen;
  15879. ComponentDragger dragger;
  15880. Rectangle<int> lastNonFullScreenPos;
  15881. ComponentBoundsConstrainer defaultConstrainer;
  15882. ComponentBoundsConstrainer* constrainer;
  15883. #ifdef JUCE_DEBUG
  15884. bool hasBeenResized;
  15885. #endif
  15886. void updateLastPos();
  15887. ResizableWindow (const ResizableWindow&);
  15888. ResizableWindow& operator= (const ResizableWindow&);
  15889. // (xxx remove these eventually)
  15890. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15891. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15892. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15893. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15894. };
  15895. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15896. /*** End of inlined file: juce_ResizableWindow.h ***/
  15897. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15898. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15899. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15900. class JUCE_API PositionedGlyph
  15901. {
  15902. public:
  15903. juce_wchar getCharacter() const { return character; }
  15904. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15905. float getLeft() const { return x; }
  15906. float getRight() const { return x + w; }
  15907. float getBaselineY() const { return y; }
  15908. float getTop() const { return y - font.getAscent(); }
  15909. float getBottom() const { return y + font.getDescent(); }
  15910. const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
  15911. void moveBy (float deltaX, float deltaY);
  15912. void draw (const Graphics& g) const;
  15913. void draw (const Graphics& g, const AffineTransform& transform) const;
  15914. void createPath (Path& path) const;
  15915. bool hitTest (float x, float y) const;
  15916. juce_UseDebuggingNewOperator
  15917. private:
  15918. friend class GlyphArrangement;
  15919. float x, y, w;
  15920. Font font;
  15921. juce_wchar character;
  15922. int glyph;
  15923. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  15924. PositionedGlyph (const PositionedGlyph& other);
  15925. };
  15926. class JUCE_API GlyphArrangement
  15927. {
  15928. public:
  15929. GlyphArrangement();
  15930. GlyphArrangement (const GlyphArrangement& other);
  15931. GlyphArrangement& operator= (const GlyphArrangement& other);
  15932. ~GlyphArrangement();
  15933. int getNumGlyphs() const throw() { return glyphs.size(); }
  15934. PositionedGlyph& getGlyph (int index) const;
  15935. void clear();
  15936. void addLineOfText (const Font& font,
  15937. const String& text,
  15938. float x, float y);
  15939. void addCurtailedLineOfText (const Font& font,
  15940. const String& text,
  15941. float x, float y,
  15942. float maxWidthPixels,
  15943. bool useEllipsis);
  15944. void addJustifiedText (const Font& font,
  15945. const String& text,
  15946. float x, float y,
  15947. float maxLineWidth,
  15948. const Justification& horizontalLayout);
  15949. void addFittedText (const Font& font,
  15950. const String& text,
  15951. float x, float y, float width, float height,
  15952. const Justification& layout,
  15953. int maximumLinesToUse,
  15954. float minimumHorizontalScale = 0.7f);
  15955. void addGlyphArrangement (const GlyphArrangement& other);
  15956. void draw (const Graphics& g) const;
  15957. void draw (const Graphics& g, const AffineTransform& transform) const;
  15958. void createPath (Path& path) const;
  15959. int findGlyphIndexAt (float x, float y) const;
  15960. const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
  15961. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15962. float deltaX, float deltaY);
  15963. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15964. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15965. float horizontalScaleFactor);
  15966. void justifyGlyphs (int startIndex, int numGlyphs,
  15967. float x, float y, float width, float height,
  15968. const Justification& justification);
  15969. juce_UseDebuggingNewOperator
  15970. private:
  15971. OwnedArray <PositionedGlyph> glyphs;
  15972. int insertEllipsis (const Font& font, float maxXPos, int startIndex, int endIndex);
  15973. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15974. const Justification& justification, float minimumHorizontalScale);
  15975. void spreadOutLine (int start, int numGlyphs, float targetWidth);
  15976. };
  15977. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15978. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15979. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15980. public ButtonListener,
  15981. public FileBrowserListener
  15982. {
  15983. public:
  15984. FileChooserDialogBox (const String& title,
  15985. const String& instructions,
  15986. FileBrowserComponent& browserComponent,
  15987. bool warnAboutOverwritingExistingFiles,
  15988. const Colour& backgroundColour);
  15989. ~FileChooserDialogBox();
  15990. bool show (int width = 0,int height = 0);
  15991. enum ColourIds
  15992. {
  15993. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15994. };
  15995. void buttonClicked (Button* button);
  15996. void closeButtonPressed();
  15997. void selectionChanged();
  15998. void fileClicked (const File& file, const MouseEvent& e);
  15999. void fileDoubleClicked (const File& file);
  16000. juce_UseDebuggingNewOperator
  16001. private:
  16002. class ContentComponent : public Component
  16003. {
  16004. public:
  16005. ContentComponent();
  16006. ~ContentComponent();
  16007. void paint (Graphics& g);
  16008. void resized();
  16009. String instructions;
  16010. GlyphArrangement text;
  16011. FileBrowserComponent* chooserComponent;
  16012. FilePreviewComponent* previewComponent;
  16013. TextButton* okButton;
  16014. TextButton* cancelButton;
  16015. };
  16016. ContentComponent* content;
  16017. const bool warnAboutOverwritingExistingFiles;
  16018. FileChooserDialogBox (const FileChooserDialogBox&);
  16019. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  16020. };
  16021. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  16022. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  16023. #endif
  16024. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  16025. #endif
  16026. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16027. /*** Start of inlined file: juce_FileListComponent.h ***/
  16028. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16029. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16030. class JUCE_API FileListComponent : public ListBox,
  16031. public DirectoryContentsDisplayComponent,
  16032. private ListBoxModel,
  16033. private ChangeListener
  16034. {
  16035. public:
  16036. FileListComponent (DirectoryContentsList& listToShow);
  16037. ~FileListComponent();
  16038. int getNumSelectedFiles() const;
  16039. const File getSelectedFile (int index = 0) const;
  16040. void scrollToTop();
  16041. void changeListenerCallback (void*);
  16042. int getNumRows();
  16043. void paintListBoxItem (int, Graphics&, int, int, bool);
  16044. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16045. void selectedRowsChanged (int lastRowSelected);
  16046. void deleteKeyPressed (int currentSelectedRow);
  16047. void returnKeyPressed (int currentSelectedRow);
  16048. juce_UseDebuggingNewOperator
  16049. private:
  16050. FileListComponent (const FileListComponent&);
  16051. FileListComponent& operator= (const FileListComponent&);
  16052. File lastDirectory;
  16053. };
  16054. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16055. /*** End of inlined file: juce_FileListComponent.h ***/
  16056. #endif
  16057. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16058. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16059. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16060. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16061. class FilenameComponent;
  16062. class JUCE_API FilenameComponentListener
  16063. {
  16064. public:
  16065. virtual ~FilenameComponentListener() {}
  16066. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16067. };
  16068. class JUCE_API FilenameComponent : public Component,
  16069. public SettableTooltipClient,
  16070. public FileDragAndDropTarget,
  16071. private AsyncUpdater,
  16072. private ButtonListener,
  16073. private ComboBoxListener
  16074. {
  16075. public:
  16076. FilenameComponent (const String& name,
  16077. const File& currentFile,
  16078. bool canEditFilename,
  16079. bool isDirectory,
  16080. bool isForSaving,
  16081. const String& fileBrowserWildcard,
  16082. const String& enforcedSuffix,
  16083. const String& textWhenNothingSelected);
  16084. ~FilenameComponent();
  16085. const File getCurrentFile() const;
  16086. void setCurrentFile (File newFile,
  16087. bool addToRecentlyUsedList,
  16088. bool sendChangeNotification = true);
  16089. void setFilenameIsEditable (bool shouldBeEditable);
  16090. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16091. const StringArray getRecentlyUsedFilenames() const;
  16092. void setRecentlyUsedFilenames (const StringArray& filenames);
  16093. void addRecentlyUsedFile (const File& file);
  16094. void setMaxNumberOfRecentFiles (int newMaximum);
  16095. void setBrowseButtonText (const String& browseButtonText);
  16096. void addListener (FilenameComponentListener* listener);
  16097. void removeListener (FilenameComponentListener* listener);
  16098. void setTooltip (const String& newTooltip);
  16099. void paintOverChildren (Graphics& g);
  16100. void resized();
  16101. void lookAndFeelChanged();
  16102. bool isInterestedInFileDrag (const StringArray& files);
  16103. void filesDropped (const StringArray& files, int, int);
  16104. void fileDragEnter (const StringArray& files, int, int);
  16105. void fileDragExit (const StringArray& files);
  16106. juce_UseDebuggingNewOperator
  16107. private:
  16108. ComboBox* filenameBox;
  16109. String lastFilename;
  16110. Button* browseButton;
  16111. int maxRecentFiles;
  16112. bool isDir, isSaving, isFileDragOver;
  16113. String wildcard, enforcedSuffix, browseButtonText;
  16114. ListenerList <FilenameComponentListener> listeners;
  16115. File defaultBrowseFile;
  16116. void comboBoxChanged (ComboBox*);
  16117. void buttonClicked (Button* button);
  16118. void handleAsyncUpdate();
  16119. FilenameComponent (const FilenameComponent&);
  16120. FilenameComponent& operator= (const FilenameComponent&);
  16121. };
  16122. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16123. /*** End of inlined file: juce_FilenameComponent.h ***/
  16124. #endif
  16125. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16126. #endif
  16127. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16128. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16129. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16130. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16131. class JUCE_API FileSearchPathListComponent : public Component,
  16132. public SettableTooltipClient,
  16133. public FileDragAndDropTarget,
  16134. private ButtonListener,
  16135. private ListBoxModel
  16136. {
  16137. public:
  16138. FileSearchPathListComponent();
  16139. ~FileSearchPathListComponent();
  16140. const FileSearchPath& getPath() const throw() { return path; }
  16141. void setPath (const FileSearchPath& newPath);
  16142. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16143. enum ColourIds
  16144. {
  16145. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16146. Make this transparent if you don't want the background to be filled. */
  16147. };
  16148. int getNumRows();
  16149. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16150. void deleteKeyPressed (int lastRowSelected);
  16151. void returnKeyPressed (int lastRowSelected);
  16152. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16153. void selectedRowsChanged (int lastRowSelected);
  16154. void resized();
  16155. void paint (Graphics& g);
  16156. bool isInterestedInFileDrag (const StringArray& files);
  16157. void filesDropped (const StringArray& files, int, int);
  16158. void buttonClicked (Button* button);
  16159. juce_UseDebuggingNewOperator
  16160. private:
  16161. FileSearchPath path;
  16162. File defaultBrowseTarget;
  16163. ListBox* listBox;
  16164. Button* addButton;
  16165. Button* removeButton;
  16166. TextButton* changeButton;
  16167. DrawableButton* upButton;
  16168. DrawableButton* downButton;
  16169. void changed();
  16170. void updateButtons();
  16171. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16172. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16173. };
  16174. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16175. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16176. #endif
  16177. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16178. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16179. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16180. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16181. class JUCE_API FileTreeComponent : public TreeView,
  16182. public DirectoryContentsDisplayComponent
  16183. {
  16184. public:
  16185. FileTreeComponent (DirectoryContentsList& listToShow);
  16186. ~FileTreeComponent();
  16187. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16188. const File getSelectedFile (int index = 0) const;
  16189. void scrollToTop();
  16190. void setDragAndDropDescription (const String& description);
  16191. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16192. juce_UseDebuggingNewOperator
  16193. private:
  16194. String dragAndDropDescription;
  16195. FileTreeComponent (const FileTreeComponent&);
  16196. FileTreeComponent& operator= (const FileTreeComponent&);
  16197. };
  16198. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16199. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16200. #endif
  16201. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16202. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16203. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16204. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16205. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16206. private Timer
  16207. {
  16208. public:
  16209. ImagePreviewComponent();
  16210. ~ImagePreviewComponent();
  16211. void selectedFileChanged (const File& newSelectedFile);
  16212. void paint (Graphics& g);
  16213. void timerCallback();
  16214. juce_UseDebuggingNewOperator
  16215. private:
  16216. File fileToLoad;
  16217. ScopedPointer <Image> currentThumbnail;
  16218. String currentDetails;
  16219. void getThumbSize (int& w, int& h) const;
  16220. ImagePreviewComponent (const ImagePreviewComponent&);
  16221. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16222. };
  16223. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16224. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16225. #endif
  16226. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16227. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16228. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16229. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16230. class JUCE_API WildcardFileFilter : public FileFilter
  16231. {
  16232. public:
  16233. WildcardFileFilter (const String& fileWildcardPatterns,
  16234. const String& directoryWildcardPatterns,
  16235. const String& description);
  16236. ~WildcardFileFilter();
  16237. bool isFileSuitable (const File& file) const;
  16238. bool isDirectorySuitable (const File& file) const;
  16239. juce_UseDebuggingNewOperator
  16240. private:
  16241. StringArray fileWildcards, directoryWildcards;
  16242. static void parse (const String& pattern, StringArray& result);
  16243. static bool match (const File& file, const StringArray& wildcards);
  16244. };
  16245. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16246. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16247. #endif
  16248. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16249. #endif
  16250. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16251. #endif
  16252. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16253. #endif
  16254. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16255. #endif
  16256. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16257. #endif
  16258. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16259. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16260. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16261. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16262. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16263. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16264. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16265. class JUCE_API KeyPressMappingSet : public KeyListener,
  16266. public ChangeBroadcaster,
  16267. public FocusChangeListener
  16268. {
  16269. public:
  16270. explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);
  16271. KeyPressMappingSet (const KeyPressMappingSet& other);
  16272. ~KeyPressMappingSet();
  16273. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16274. const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
  16275. void addKeyPress (CommandID commandID,
  16276. const KeyPress& newKeyPress,
  16277. int insertIndex = -1);
  16278. void resetToDefaultMappings();
  16279. void resetToDefaultMapping (CommandID commandID);
  16280. void clearAllKeyPresses();
  16281. void clearAllKeyPresses (CommandID commandID);
  16282. void removeKeyPress (CommandID commandID, int keyPressIndex);
  16283. void removeKeyPress (const KeyPress& keypress);
  16284. bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();
  16285. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16286. bool restoreFromXml (const XmlElement& xmlVersion);
  16287. XmlElement* createXml (bool saveDifferencesFromDefaultSet) const;
  16288. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16289. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  16290. void globalFocusChanged (Component* focusedComponent);
  16291. juce_UseDebuggingNewOperator
  16292. private:
  16293. ApplicationCommandManager* commandManager;
  16294. struct CommandMapping
  16295. {
  16296. CommandID commandID;
  16297. Array <KeyPress> keypresses;
  16298. bool wantsKeyUpDownCallbacks;
  16299. };
  16300. OwnedArray <CommandMapping> mappings;
  16301. struct KeyPressTime
  16302. {
  16303. KeyPress key;
  16304. uint32 timeWhenPressed;
  16305. };
  16306. OwnedArray <KeyPressTime> keysDown;
  16307. void handleMessage (const Message& message);
  16308. void invokeCommand (const CommandID commandID,
  16309. const KeyPress& keyPress,
  16310. const bool isKeyDown,
  16311. const int millisecsSinceKeyPressed,
  16312. Component* const originatingComponent) const;
  16313. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16314. };
  16315. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16316. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16317. class JUCE_API KeyMappingEditorComponent : public Component,
  16318. public TreeViewItem,
  16319. public ChangeListener,
  16320. private ButtonListener
  16321. {
  16322. public:
  16323. KeyMappingEditorComponent (KeyPressMappingSet* mappingSet,
  16324. bool showResetToDefaultButton);
  16325. virtual ~KeyMappingEditorComponent();
  16326. void setColours (const Colour& mainBackground,
  16327. const Colour& textColour);
  16328. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16329. virtual bool shouldCommandBeIncluded (CommandID commandID);
  16330. virtual bool isCommandReadOnly (CommandID commandID);
  16331. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16332. enum ColourIds
  16333. {
  16334. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16335. textColourId = 0x100ad01, /**< The colour for the text. */
  16336. };
  16337. void parentHierarchyChanged();
  16338. void resized();
  16339. void changeListenerCallback (void*);
  16340. bool mightContainSubItems();
  16341. const String getUniqueName() const;
  16342. void buttonClicked (Button* button);
  16343. juce_UseDebuggingNewOperator
  16344. private:
  16345. KeyPressMappingSet* mappings;
  16346. TreeView* tree;
  16347. friend class KeyMappingTreeViewItem;
  16348. friend class KeyCategoryTreeViewItem;
  16349. friend class KeyMappingItemComponent;
  16350. friend class KeyMappingChangeButton;
  16351. TextButton* resetButton;
  16352. void assignNewKey (CommandID commandID, int index);
  16353. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16354. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16355. };
  16356. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16357. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16358. #endif
  16359. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16360. #endif
  16361. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16362. #endif
  16363. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16364. #endif
  16365. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16366. #endif
  16367. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16368. #endif
  16369. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16370. #endif
  16371. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16372. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16373. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16374. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16375. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16376. {
  16377. public:
  16378. ComponentMovementWatcher (Component* component);
  16379. ~ComponentMovementWatcher();
  16380. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16381. virtual void componentPeerChanged() = 0;
  16382. juce_UseDebuggingNewOperator
  16383. void componentParentHierarchyChanged (Component& component);
  16384. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16385. private:
  16386. Component::SafePointer<Component> component;
  16387. ComponentPeer* lastPeer;
  16388. VoidArray registeredParentComps;
  16389. bool reentrant;
  16390. Rectangle<int> lastBounds;
  16391. void unregister() throw();
  16392. void registerWithParentComps() throw();
  16393. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16394. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16395. };
  16396. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16397. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16398. #endif
  16399. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16400. /*** Start of inlined file: juce_GroupComponent.h ***/
  16401. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16402. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16403. class JUCE_API GroupComponent : public Component
  16404. {
  16405. public:
  16406. GroupComponent (const String& componentName,
  16407. const String& labelText);
  16408. ~GroupComponent();
  16409. void setText (const String& newText);
  16410. const String getText() const;
  16411. void setTextLabelPosition (const Justification& justification);
  16412. const Justification getTextLabelPosition() const throw() { return justification; }
  16413. enum ColourIds
  16414. {
  16415. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16416. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16417. };
  16418. void paint (Graphics& g);
  16419. void enablementChanged();
  16420. void colourChanged();
  16421. private:
  16422. String text;
  16423. Justification justification;
  16424. GroupComponent (const GroupComponent&);
  16425. GroupComponent& operator= (const GroupComponent&);
  16426. };
  16427. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16428. /*** End of inlined file: juce_GroupComponent.h ***/
  16429. #endif
  16430. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16431. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16432. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16433. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16434. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16435. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16436. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16437. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16438. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16439. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16440. class TabbedButtonBar;
  16441. class JUCE_API TabBarButton : public Button
  16442. {
  16443. public:
  16444. TabBarButton (const String& name,
  16445. TabbedButtonBar* ownerBar,
  16446. int tabIndex);
  16447. ~TabBarButton();
  16448. virtual int getBestTabLength (int depth);
  16449. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16450. void clicked (const ModifierKeys& mods);
  16451. bool hitTest (int x, int y);
  16452. juce_UseDebuggingNewOperator
  16453. protected:
  16454. friend class TabbedButtonBar;
  16455. TabbedButtonBar* const owner;
  16456. int tabIndex, overlapPixels;
  16457. DropShadowEffect shadow;
  16458. void getActiveArea (int& x, int& y, int& w, int& h);
  16459. private:
  16460. TabBarButton (const TabBarButton&);
  16461. TabBarButton& operator= (const TabBarButton&);
  16462. };
  16463. class JUCE_API TabbedButtonBar : public Component,
  16464. public ChangeBroadcaster,
  16465. public ButtonListener
  16466. {
  16467. public:
  16468. enum Orientation
  16469. {
  16470. TabsAtTop,
  16471. TabsAtBottom,
  16472. TabsAtLeft,
  16473. TabsAtRight
  16474. };
  16475. TabbedButtonBar (Orientation orientation);
  16476. ~TabbedButtonBar();
  16477. void setOrientation (Orientation orientation);
  16478. Orientation getOrientation() const throw() { return orientation; }
  16479. void clearTabs();
  16480. void addTab (const String& tabName,
  16481. const Colour& tabBackgroundColour,
  16482. int insertIndex = -1);
  16483. void setTabName (int tabIndex,
  16484. const String& newName);
  16485. void removeTab (int tabIndex);
  16486. void moveTab (int currentIndex, int newIndex);
  16487. int getNumTabs() const;
  16488. const StringArray getTabNames() const;
  16489. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16490. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16491. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16492. TabBarButton* getTabButton (int index) const;
  16493. virtual void currentTabChanged (int newCurrentTabIndex,
  16494. const String& newCurrentTabName);
  16495. virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
  16496. const Colour getTabBackgroundColour (int tabIndex);
  16497. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16498. enum ColourIds
  16499. {
  16500. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16501. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16502. the look and feel will choose an appropriate colour. */
  16503. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16504. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16505. this isn't specified, the look and feel will choose an appropriate
  16506. colour. */
  16507. };
  16508. void resized();
  16509. void buttonClicked (Button* button);
  16510. void lookAndFeelChanged();
  16511. juce_UseDebuggingNewOperator
  16512. protected:
  16513. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16514. private:
  16515. Orientation orientation;
  16516. StringArray tabs;
  16517. Array <Colour> tabColours;
  16518. int currentTabIndex;
  16519. Component* behindFrontTab;
  16520. Button* extraTabsButton;
  16521. TabbedButtonBar (const TabbedButtonBar&);
  16522. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16523. };
  16524. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16525. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16526. class JUCE_API TabbedComponent : public Component
  16527. {
  16528. public:
  16529. explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
  16530. ~TabbedComponent();
  16531. void setOrientation (TabbedButtonBar::Orientation orientation);
  16532. TabbedButtonBar::Orientation getOrientation() const throw();
  16533. void setTabBarDepth (int newDepth);
  16534. int getTabBarDepth() const throw() { return tabDepth; }
  16535. void setOutline (int newThickness);
  16536. void setIndent (int indentThickness);
  16537. void clearTabs();
  16538. void addTab (const String& tabName,
  16539. const Colour& tabBackgroundColour,
  16540. Component* contentComponent,
  16541. bool deleteComponentWhenNotNeeded,
  16542. int insertIndex = -1);
  16543. void setTabName (int tabIndex, const String& newName);
  16544. void removeTab (int tabIndex);
  16545. int getNumTabs() const;
  16546. const StringArray getTabNames() const;
  16547. Component* getTabContentComponent (int tabIndex) const throw();
  16548. const Colour getTabBackgroundColour (int tabIndex) const throw();
  16549. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16550. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16551. int getCurrentTabIndex() const;
  16552. const String& getCurrentTabName() const;
  16553. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16554. virtual void currentTabChanged (int newCurrentTabIndex,
  16555. const String& newCurrentTabName);
  16556. virtual void popupMenuClickOnTab (int tabIndex,
  16557. const String& tabName);
  16558. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16559. enum ColourIds
  16560. {
  16561. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16562. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16563. (See setOutline) */
  16564. };
  16565. void paint (Graphics& g);
  16566. void resized();
  16567. void lookAndFeelChanged();
  16568. juce_UseDebuggingNewOperator
  16569. protected:
  16570. TabbedButtonBar* tabs;
  16571. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16572. private:
  16573. Array <Component*> contentComponents;
  16574. Component* panelComponent;
  16575. int tabDepth;
  16576. int outlineThickness, edgeIndent;
  16577. friend class TabCompButtonBar;
  16578. void changeCallback (int newCurrentTabIndex, const String& newTabName);
  16579. TabbedComponent (const TabbedComponent&);
  16580. TabbedComponent& operator= (const TabbedComponent&);
  16581. };
  16582. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16583. /*** End of inlined file: juce_TabbedComponent.h ***/
  16584. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16585. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16586. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16587. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16588. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16589. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16590. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16591. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16592. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16593. class MenuBarModel;
  16594. class JUCE_API MenuBarModelListener
  16595. {
  16596. public:
  16597. virtual ~MenuBarModelListener() {}
  16598. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16599. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16600. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16601. };
  16602. class JUCE_API MenuBarModel : private AsyncUpdater,
  16603. private ApplicationCommandManagerListener
  16604. {
  16605. public:
  16606. MenuBarModel() throw();
  16607. virtual ~MenuBarModel();
  16608. void menuItemsChanged();
  16609. void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
  16610. void addListener (MenuBarModelListener* listenerToAdd) throw();
  16611. void removeListener (MenuBarModelListener* listenerToRemove) throw();
  16612. virtual const StringArray getMenuBarNames() = 0;
  16613. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16614. const String& menuName) = 0;
  16615. virtual void menuItemSelected (int menuItemID,
  16616. int topLevelMenuIndex) = 0;
  16617. #if JUCE_MAC || DOXYGEN
  16618. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16619. const PopupMenu* extraAppleMenuItems = 0);
  16620. static MenuBarModel* getMacMainMenu();
  16621. #endif
  16622. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16623. void applicationCommandListChanged();
  16624. void handleAsyncUpdate();
  16625. juce_UseDebuggingNewOperator
  16626. private:
  16627. ApplicationCommandManager* manager;
  16628. ListenerList <MenuBarModelListener> listeners;
  16629. MenuBarModel (const MenuBarModel&);
  16630. MenuBarModel& operator= (const MenuBarModel&);
  16631. };
  16632. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16633. /*** End of inlined file: juce_MenuBarModel.h ***/
  16634. class JUCE_API MenuBarComponent : public Component,
  16635. private MenuBarModelListener,
  16636. private Timer
  16637. {
  16638. public:
  16639. MenuBarComponent (MenuBarModel* model);
  16640. ~MenuBarComponent();
  16641. void setModel (MenuBarModel* newModel);
  16642. void showMenu (int menuIndex);
  16643. void paint (Graphics& g);
  16644. void resized();
  16645. void mouseEnter (const MouseEvent& e);
  16646. void mouseExit (const MouseEvent& e);
  16647. void mouseDown (const MouseEvent& e);
  16648. void mouseDrag (const MouseEvent& e);
  16649. void mouseUp (const MouseEvent& e);
  16650. void mouseMove (const MouseEvent& e);
  16651. void inputAttemptWhenModal();
  16652. void handleCommandMessage (int commandId);
  16653. bool keyPressed (const KeyPress& key);
  16654. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16655. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16656. const ApplicationCommandTarget::InvocationInfo& info);
  16657. juce_UseDebuggingNewOperator
  16658. private:
  16659. MenuBarModel* model;
  16660. StringArray menuNames;
  16661. Array <int> xPositions;
  16662. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16663. int lastMouseX, lastMouseY;
  16664. bool inModalState;
  16665. ScopedPointer <Component> currentPopup;
  16666. int getItemAt (int x, int y);
  16667. void updateItemUnderMouse (int x, int y);
  16668. void hideCurrentMenu();
  16669. void timerCallback();
  16670. void repaintMenuItem (int index);
  16671. MenuBarComponent (const MenuBarComponent&);
  16672. MenuBarComponent& operator= (const MenuBarComponent&);
  16673. };
  16674. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16675. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16676. class JUCE_API DocumentWindow : public ResizableWindow
  16677. {
  16678. public:
  16679. enum TitleBarButtons
  16680. {
  16681. minimiseButton = 1,
  16682. maximiseButton = 2,
  16683. closeButton = 4,
  16684. allButtons = 7
  16685. };
  16686. DocumentWindow (const String& name,
  16687. const Colour& backgroundColour,
  16688. int requiredButtons,
  16689. bool addToDesktop = true);
  16690. ~DocumentWindow();
  16691. void setName (const String& newName);
  16692. void setIcon (const Image* imageToUse);
  16693. void setTitleBarHeight (int newHeight);
  16694. int getTitleBarHeight() const;
  16695. void setTitleBarButtonsRequired (int requiredButtons,
  16696. bool positionTitleBarButtonsOnLeft);
  16697. void setTitleBarTextCentred (bool textShouldBeCentred);
  16698. void setMenuBar (MenuBarModel* menuBarModel,
  16699. int menuBarHeight = 0);
  16700. virtual void closeButtonPressed();
  16701. virtual void minimiseButtonPressed();
  16702. virtual void maximiseButtonPressed();
  16703. Button* getCloseButton() const throw();
  16704. Button* getMinimiseButton() const throw();
  16705. Button* getMaximiseButton() const throw();
  16706. enum ColourIds
  16707. {
  16708. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16709. and feel class how this is used. */
  16710. };
  16711. void paint (Graphics& g);
  16712. void resized();
  16713. void lookAndFeelChanged();
  16714. const BorderSize getBorderThickness();
  16715. const BorderSize getContentComponentBorder();
  16716. void mouseDoubleClick (const MouseEvent& e);
  16717. void userTriedToCloseWindow();
  16718. void activeWindowStatusChanged();
  16719. int getDesktopWindowStyleFlags() const;
  16720. void parentHierarchyChanged();
  16721. const Rectangle<int> getTitleBarArea();
  16722. juce_UseDebuggingNewOperator
  16723. private:
  16724. int titleBarHeight, menuBarHeight, requiredButtons;
  16725. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16726. ScopedPointer <Button> titleBarButtons [3];
  16727. ScopedPointer <Image> titleBarIcon;
  16728. ScopedPointer <MenuBarComponent> menuBar;
  16729. MenuBarModel* menuBarModel;
  16730. class ButtonListenerProxy;
  16731. friend class ScopedPointer <ButtonListenerProxy>;
  16732. ScopedPointer <ButtonListenerProxy> buttonListener;
  16733. void repaintTitleBar();
  16734. DocumentWindow (const DocumentWindow&);
  16735. DocumentWindow& operator= (const DocumentWindow&);
  16736. };
  16737. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16738. /*** End of inlined file: juce_DocumentWindow.h ***/
  16739. class MultiDocumentPanel;
  16740. class MDITabbedComponentInternal;
  16741. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16742. {
  16743. public:
  16744. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16745. ~MultiDocumentPanelWindow();
  16746. void maximiseButtonPressed();
  16747. void closeButtonPressed();
  16748. void activeWindowStatusChanged();
  16749. void broughtToFront();
  16750. juce_UseDebuggingNewOperator
  16751. private:
  16752. void updateOrder();
  16753. MultiDocumentPanel* getOwner() const throw();
  16754. };
  16755. class JUCE_API MultiDocumentPanel : public Component,
  16756. private ComponentListener
  16757. {
  16758. public:
  16759. MultiDocumentPanel();
  16760. ~MultiDocumentPanel();
  16761. bool closeAllDocuments (bool checkItsOkToCloseFirst);
  16762. bool addDocument (Component* component,
  16763. const Colour& backgroundColour,
  16764. bool deleteWhenRemoved);
  16765. bool closeDocument (Component* component,
  16766. bool checkItsOkToCloseFirst);
  16767. int getNumDocuments() const throw();
  16768. Component* getDocument (int index) const throw();
  16769. Component* getActiveDocument() const throw();
  16770. void setActiveDocument (Component* component);
  16771. virtual void activeDocumentChanged();
  16772. void setMaximumNumDocuments (int maximumNumDocuments);
  16773. void useFullscreenWhenOneDocument (bool shouldUseTabs);
  16774. bool isFullscreenWhenOneDocument() const throw();
  16775. enum LayoutMode
  16776. {
  16777. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16778. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16779. };
  16780. void setLayoutMode (LayoutMode newLayoutMode);
  16781. LayoutMode getLayoutMode() const throw() { return mode; }
  16782. void setBackgroundColour (const Colour& newBackgroundColour);
  16783. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16784. virtual bool tryToCloseDocument (Component* component) = 0;
  16785. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16786. void paint (Graphics& g);
  16787. void resized();
  16788. void componentNameChanged (Component&);
  16789. juce_UseDebuggingNewOperator
  16790. private:
  16791. LayoutMode mode;
  16792. Array <Component*> components;
  16793. TabbedComponent* tabComponent;
  16794. Colour backgroundColour;
  16795. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16796. friend class MultiDocumentPanelWindow;
  16797. friend class MDITabbedComponentInternal;
  16798. Component* getContainerComp (Component* c) const;
  16799. void updateOrder();
  16800. void addWindow (Component* component);
  16801. };
  16802. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16803. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16804. #endif
  16805. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16806. #endif
  16807. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16808. #endif
  16809. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16810. #endif
  16811. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16812. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16813. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16814. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16815. class JUCE_API StretchableLayoutManager
  16816. {
  16817. public:
  16818. StretchableLayoutManager();
  16819. ~StretchableLayoutManager();
  16820. void setItemLayout (int itemIndex,
  16821. double minimumSize,
  16822. double maximumSize,
  16823. double preferredSize);
  16824. bool getItemLayout (int itemIndex,
  16825. double& minimumSize,
  16826. double& maximumSize,
  16827. double& preferredSize) const;
  16828. void clearAllItems();
  16829. void layOutComponents (Component** components,
  16830. int numComponents,
  16831. int x, int y, int width, int height,
  16832. bool vertically,
  16833. bool resizeOtherDimension);
  16834. int getItemCurrentPosition (int itemIndex) const;
  16835. int getItemCurrentAbsoluteSize (int itemIndex) const;
  16836. double getItemCurrentRelativeSize (int itemIndex) const;
  16837. void setItemPosition (int itemIndex,
  16838. int newPosition);
  16839. juce_UseDebuggingNewOperator
  16840. private:
  16841. struct ItemLayoutProperties
  16842. {
  16843. int itemIndex;
  16844. int currentSize;
  16845. double minSize, maxSize, preferredSize;
  16846. };
  16847. OwnedArray <ItemLayoutProperties> items;
  16848. int totalSize;
  16849. static int sizeToRealSize (double size, int totalSpace);
  16850. ItemLayoutProperties* getInfoFor (int itemIndex) const;
  16851. void setTotalSize (int newTotalSize);
  16852. int fitComponentsIntoSpace (int startIndex, int endIndex, int availableSpace, int startPos);
  16853. int getMinimumSizeOfItems (int startIndex, int endIndex) const;
  16854. int getMaximumSizeOfItems (int startIndex, int endIndex) const;
  16855. void updatePrefSizesToMatchCurrentPositions();
  16856. StretchableLayoutManager (const StretchableLayoutManager&);
  16857. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16858. };
  16859. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16860. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16861. #endif
  16862. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16863. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16864. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16865. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16866. class JUCE_API StretchableLayoutResizerBar : public Component
  16867. {
  16868. public:
  16869. StretchableLayoutResizerBar (StretchableLayoutManager* layoutToUse,
  16870. int itemIndexInLayout,
  16871. bool isBarVertical);
  16872. ~StretchableLayoutResizerBar();
  16873. virtual void hasBeenMoved();
  16874. void paint (Graphics& g);
  16875. void mouseDown (const MouseEvent& e);
  16876. void mouseDrag (const MouseEvent& e);
  16877. juce_UseDebuggingNewOperator
  16878. private:
  16879. StretchableLayoutManager* layout;
  16880. int itemIndex, mouseDownPos;
  16881. bool isVertical;
  16882. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16883. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16884. };
  16885. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16886. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16887. #endif
  16888. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16889. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16890. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16891. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16892. class StretchableObjectResizer
  16893. {
  16894. public:
  16895. StretchableObjectResizer();
  16896. ~StretchableObjectResizer();
  16897. void addItem (double currentSize,
  16898. double minSize,
  16899. double maxSize,
  16900. int order = 0);
  16901. void resizeToFit (double targetSize);
  16902. int getNumItems() const throw() { return items.size(); }
  16903. double getItemSize (int index) const throw();
  16904. juce_UseDebuggingNewOperator
  16905. private:
  16906. struct Item
  16907. {
  16908. double size;
  16909. double minSize;
  16910. double maxSize;
  16911. int order;
  16912. };
  16913. OwnedArray <Item> items;
  16914. StretchableObjectResizer (const StretchableObjectResizer&);
  16915. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16916. };
  16917. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16918. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16919. #endif
  16920. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16921. #endif
  16922. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16923. #endif
  16924. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16925. #endif
  16926. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16927. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16928. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16929. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16930. /*** Start of inlined file: juce_AlertWindow.h ***/
  16931. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16932. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16933. /*** Start of inlined file: juce_TextLayout.h ***/
  16934. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16935. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16936. class Graphics;
  16937. class JUCE_API TextLayout
  16938. {
  16939. public:
  16940. TextLayout();
  16941. TextLayout (const TextLayout& other);
  16942. TextLayout (const String& text, const Font& font);
  16943. ~TextLayout();
  16944. TextLayout& operator= (const TextLayout& layoutToCopy);
  16945. void clear();
  16946. void appendText (const String& textToAppend,
  16947. const Font& fontToUse);
  16948. void setText (const String& newText,
  16949. const Font& fontToUse);
  16950. void layout (int maximumWidth,
  16951. const Justification& justification,
  16952. bool attemptToBalanceLineLengths);
  16953. int getWidth() const;
  16954. int getHeight() const;
  16955. int getNumLines() const { return totalLines; }
  16956. int getLineWidth (int lineNumber) const;
  16957. void draw (Graphics& g, int topLeftX, int topLeftY) const;
  16958. void drawWithin (Graphics& g,
  16959. int x, int y, int w, int h,
  16960. const Justification& layoutFlags) const;
  16961. juce_UseDebuggingNewOperator
  16962. private:
  16963. class Token;
  16964. friend class OwnedArray <Token>;
  16965. OwnedArray <Token> tokens;
  16966. int totalLines;
  16967. };
  16968. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16969. /*** End of inlined file: juce_TextLayout.h ***/
  16970. class JUCE_API AlertWindow : public TopLevelWindow,
  16971. private ButtonListener
  16972. {
  16973. public:
  16974. enum AlertIconType
  16975. {
  16976. NoIcon, /**< No icon will be shown on the dialog box. */
  16977. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16978. user to answer a question. */
  16979. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16980. warning about something and shouldn't be ignored. */
  16981. InfoIcon /**< An icon that indicates that the dialog box is just
  16982. giving the user some information, which doesn't require
  16983. a response from them. */
  16984. };
  16985. AlertWindow (const String& title,
  16986. const String& message,
  16987. AlertIconType iconType,
  16988. Component* associatedComponent = 0);
  16989. ~AlertWindow();
  16990. AlertIconType getAlertType() const throw() { return alertIconType; }
  16991. void setMessage (const String& message);
  16992. void addButton (const String& name,
  16993. int returnValue,
  16994. const KeyPress& shortcutKey1 = KeyPress(),
  16995. const KeyPress& shortcutKey2 = KeyPress());
  16996. int getNumButtons() const;
  16997. void addTextEditor (const String& name,
  16998. const String& initialContents,
  16999. const String& onScreenLabel = String::empty,
  17000. bool isPasswordBox = false);
  17001. const String getTextEditorContents (const String& nameOfTextEditor) const;
  17002. void addComboBox (const String& name,
  17003. const StringArray& items,
  17004. const String& onScreenLabel = String::empty);
  17005. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  17006. void addTextBlock (const String& text);
  17007. void addProgressBarComponent (double& progressValue);
  17008. void addCustomComponent (Component* component);
  17009. int getNumCustomComponents() const;
  17010. Component* getCustomComponent (int index) const;
  17011. Component* removeCustomComponent (int index);
  17012. bool containsAnyExtraComponents() const;
  17013. // easy-to-use message box functions:
  17014. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  17015. const String& title,
  17016. const String& message,
  17017. const String& buttonText = String::empty,
  17018. Component* associatedComponent = 0);
  17019. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  17020. const String& title,
  17021. const String& message,
  17022. const String& button1Text = String::empty,
  17023. const String& button2Text = String::empty,
  17024. Component* associatedComponent = 0);
  17025. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17026. const String& title,
  17027. const String& message,
  17028. const String& button1Text = String::empty,
  17029. const String& button2Text = String::empty,
  17030. const String& button3Text = String::empty,
  17031. Component* associatedComponent = 0);
  17032. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17033. const String& bodyText,
  17034. bool isOkCancel);
  17035. enum ColourIds
  17036. {
  17037. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17038. textColourId = 0x1001810, /**< The colour for the text. */
  17039. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17040. };
  17041. juce_UseDebuggingNewOperator
  17042. protected:
  17043. void paint (Graphics& g);
  17044. void mouseDown (const MouseEvent& e);
  17045. void mouseDrag (const MouseEvent& e);
  17046. bool keyPressed (const KeyPress& key);
  17047. void buttonClicked (Button* button);
  17048. void lookAndFeelChanged();
  17049. void userTriedToCloseWindow();
  17050. int getDesktopWindowStyleFlags() const;
  17051. private:
  17052. String text;
  17053. TextLayout textLayout;
  17054. AlertIconType alertIconType;
  17055. ComponentBoundsConstrainer constrainer;
  17056. ComponentDragger dragger;
  17057. Rectangle<int> textArea;
  17058. VoidArray buttons, textBoxes, comboBoxes;
  17059. VoidArray progressBars, customComps, textBlocks, allComps;
  17060. StringArray textboxNames, comboBoxNames;
  17061. Font font;
  17062. Component* associatedComponent;
  17063. void updateLayout (bool onlyIncreaseSize);
  17064. // disable copy constructor
  17065. AlertWindow (const AlertWindow&);
  17066. AlertWindow& operator= (const AlertWindow&);
  17067. };
  17068. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17069. /*** End of inlined file: juce_AlertWindow.h ***/
  17070. class ToggleButton;
  17071. class TextButton;
  17072. class AlertWindow;
  17073. class TextLayout;
  17074. class ScrollBar;
  17075. class BubbleComponent;
  17076. class ComboBox;
  17077. class Button;
  17078. class FilenameComponent;
  17079. class DocumentWindow;
  17080. class ResizableWindow;
  17081. class GroupComponent;
  17082. class MenuBarComponent;
  17083. class DropShadower;
  17084. class GlyphArrangement;
  17085. class PropertyComponent;
  17086. class TableHeaderComponent;
  17087. class Toolbar;
  17088. class ToolbarItemComponent;
  17089. class PopupMenu;
  17090. class ProgressBar;
  17091. class FileBrowserComponent;
  17092. class DirectoryContentsDisplayComponent;
  17093. class FilePreviewComponent;
  17094. class ImageButton;
  17095. class JUCE_API LookAndFeel
  17096. {
  17097. public:
  17098. LookAndFeel();
  17099. virtual ~LookAndFeel();
  17100. static LookAndFeel& getDefaultLookAndFeel() throw();
  17101. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17102. const Colour findColour (int colourId) const throw();
  17103. void setColour (int colourId, const Colour& colour) throw();
  17104. bool isColourSpecified (int colourId) const throw();
  17105. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17106. void setDefaultSansSerifTypefaceName (const String& newName);
  17107. virtual const MouseCursor getMouseCursorFor (Component& component);
  17108. virtual void drawButtonBackground (Graphics& g,
  17109. Button& button,
  17110. const Colour& backgroundColour,
  17111. bool isMouseOverButton,
  17112. bool isButtonDown);
  17113. virtual const Font getFontForTextButton (TextButton& button);
  17114. virtual void drawButtonText (Graphics& g,
  17115. TextButton& button,
  17116. bool isMouseOverButton,
  17117. bool isButtonDown);
  17118. virtual void drawToggleButton (Graphics& g,
  17119. ToggleButton& button,
  17120. bool isMouseOverButton,
  17121. bool isButtonDown);
  17122. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17123. virtual void drawTickBox (Graphics& g,
  17124. Component& component,
  17125. float x, float y, float w, float h,
  17126. bool ticked,
  17127. bool isEnabled,
  17128. bool isMouseOverButton,
  17129. bool isButtonDown);
  17130. virtual AlertWindow* createAlertWindow (const String& title,
  17131. const String& message,
  17132. const String& button1,
  17133. const String& button2,
  17134. const String& button3,
  17135. AlertWindow::AlertIconType iconType,
  17136. int numButtons,
  17137. Component* associatedComponent);
  17138. virtual void drawAlertBox (Graphics& g,
  17139. AlertWindow& alert,
  17140. const Rectangle<int>& textArea,
  17141. TextLayout& textLayout);
  17142. virtual int getAlertBoxWindowFlags();
  17143. virtual int getAlertWindowButtonHeight();
  17144. virtual const Font getAlertWindowFont();
  17145. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17146. int width, int height,
  17147. double progress, const String& textToShow);
  17148. // Draws a small image that spins to indicate that something's happening..
  17149. // This method should use the current time to animate itself, so just keep
  17150. // repainting it every so often.
  17151. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17152. int x, int y, int w, int h);
  17153. virtual void drawScrollbarButton (Graphics& g,
  17154. ScrollBar& scrollbar,
  17155. int width, int height,
  17156. int buttonDirection,
  17157. bool isScrollbarVertical,
  17158. bool isMouseOverButton,
  17159. bool isButtonDown);
  17160. virtual void drawScrollbar (Graphics& g,
  17161. ScrollBar& scrollbar,
  17162. int x, int y,
  17163. int width, int height,
  17164. bool isScrollbarVertical,
  17165. int thumbStartPosition,
  17166. int thumbSize,
  17167. bool isMouseOver,
  17168. bool isMouseDown);
  17169. virtual ImageEffectFilter* getScrollbarEffect();
  17170. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17171. virtual int getDefaultScrollbarWidth();
  17172. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17173. virtual const Path getTickShape (float height);
  17174. virtual const Path getCrossShape (float height);
  17175. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17176. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17177. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17178. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17179. virtual Image* getDefaultFolderImage();
  17180. virtual Image* getDefaultDocumentFileImage();
  17181. virtual void createFileChooserHeaderText (const String& title,
  17182. const String& instructions,
  17183. GlyphArrangement& destArrangement,
  17184. int width);
  17185. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17186. const String& filename, Image* icon,
  17187. const String& fileSizeDescription,
  17188. const String& fileTimeDescription,
  17189. bool isDirectory,
  17190. bool isItemSelected,
  17191. int itemIndex);
  17192. virtual Button* createFileBrowserGoUpButton();
  17193. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17194. DirectoryContentsDisplayComponent* fileListComponent,
  17195. FilePreviewComponent* previewComp,
  17196. ComboBox* currentPathBox,
  17197. TextEditor* filenameBox,
  17198. Button* goUpButton);
  17199. virtual void drawBubble (Graphics& g,
  17200. float tipX, float tipY,
  17201. float boxX, float boxY, float boxW, float boxH);
  17202. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17203. virtual void drawPopupMenuItem (Graphics& g,
  17204. int width, int height,
  17205. bool isSeparator,
  17206. bool isActive,
  17207. bool isHighlighted,
  17208. bool isTicked,
  17209. bool hasSubMenu,
  17210. const String& text,
  17211. const String& shortcutKeyText,
  17212. Image* image,
  17213. const Colour* const textColour);
  17214. virtual const Font getPopupMenuFont();
  17215. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17216. int width, int height,
  17217. bool isScrollUpArrow);
  17218. virtual void getIdealPopupMenuItemSize (const String& text,
  17219. bool isSeparator,
  17220. int standardMenuItemHeight,
  17221. int& idealWidth,
  17222. int& idealHeight);
  17223. virtual int getMenuWindowFlags();
  17224. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17225. bool isMouseOverBar,
  17226. MenuBarComponent& menuBar);
  17227. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17228. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17229. virtual void drawMenuBarItem (Graphics& g,
  17230. int width, int height,
  17231. int itemIndex,
  17232. const String& itemText,
  17233. bool isMouseOverItem,
  17234. bool isMenuOpen,
  17235. bool isMouseOverBar,
  17236. MenuBarComponent& menuBar);
  17237. virtual void drawComboBox (Graphics& g, int width, int height,
  17238. bool isButtonDown,
  17239. int buttonX, int buttonY,
  17240. int buttonW, int buttonH,
  17241. ComboBox& box);
  17242. virtual const Font getComboBoxFont (ComboBox& box);
  17243. virtual Label* createComboBoxTextBox (ComboBox& box);
  17244. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17245. virtual void drawLabel (Graphics& g, Label& label);
  17246. virtual void drawLinearSlider (Graphics& g,
  17247. int x, int y,
  17248. int width, int height,
  17249. float sliderPos,
  17250. float minSliderPos,
  17251. float maxSliderPos,
  17252. const Slider::SliderStyle style,
  17253. Slider& slider);
  17254. virtual void drawLinearSliderBackground (Graphics& g,
  17255. int x, int y,
  17256. int width, int height,
  17257. float sliderPos,
  17258. float minSliderPos,
  17259. float maxSliderPos,
  17260. const Slider::SliderStyle style,
  17261. Slider& slider);
  17262. virtual void drawLinearSliderThumb (Graphics& g,
  17263. int x, int y,
  17264. int width, int height,
  17265. float sliderPos,
  17266. float minSliderPos,
  17267. float maxSliderPos,
  17268. const Slider::SliderStyle style,
  17269. Slider& slider);
  17270. virtual int getSliderThumbRadius (Slider& slider);
  17271. virtual void drawRotarySlider (Graphics& g,
  17272. int x, int y,
  17273. int width, int height,
  17274. float sliderPosProportional,
  17275. float rotaryStartAngle,
  17276. float rotaryEndAngle,
  17277. Slider& slider);
  17278. virtual Button* createSliderButton (bool isIncrement);
  17279. virtual Label* createSliderTextBox (Slider& slider);
  17280. virtual ImageEffectFilter* getSliderEffect();
  17281. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17282. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17283. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17284. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17285. ComboBox* filenameBox, Button* browseButton);
  17286. virtual void drawCornerResizer (Graphics& g,
  17287. int w, int h,
  17288. bool isMouseOver,
  17289. bool isMouseDragging);
  17290. virtual void drawResizableFrame (Graphics& g,
  17291. int w, int h,
  17292. const BorderSize& borders);
  17293. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17294. const BorderSize& border,
  17295. ResizableWindow& window);
  17296. virtual void drawResizableWindowBorder (Graphics& g,
  17297. int w, int h,
  17298. const BorderSize& border,
  17299. ResizableWindow& window);
  17300. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17301. Graphics& g, int w, int h,
  17302. int titleSpaceX, int titleSpaceW,
  17303. const Image* icon,
  17304. bool drawTitleTextOnLeft);
  17305. virtual Button* createDocumentWindowButton (int buttonType);
  17306. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17307. int titleBarX, int titleBarY,
  17308. int titleBarW, int titleBarH,
  17309. Button* minimiseButton,
  17310. Button* maximiseButton,
  17311. Button* closeButton,
  17312. bool positionTitleBarButtonsOnLeft);
  17313. virtual int getDefaultMenuBarHeight();
  17314. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17315. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17316. int w, int h,
  17317. bool isVerticalBar,
  17318. bool isMouseOver,
  17319. bool isMouseDragging);
  17320. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17321. const String& text,
  17322. const Justification& position,
  17323. GroupComponent& group);
  17324. virtual void createTabButtonShape (Path& p,
  17325. int width, int height,
  17326. int tabIndex,
  17327. const String& text,
  17328. Button& button,
  17329. TabbedButtonBar::Orientation orientation,
  17330. bool isMouseOver,
  17331. bool isMouseDown,
  17332. bool isFrontTab);
  17333. virtual void fillTabButtonShape (Graphics& g,
  17334. const Path& path,
  17335. const Colour& preferredBackgroundColour,
  17336. int tabIndex,
  17337. const String& text,
  17338. Button& button,
  17339. TabbedButtonBar::Orientation orientation,
  17340. bool isMouseOver,
  17341. bool isMouseDown,
  17342. bool isFrontTab);
  17343. virtual void drawTabButtonText (Graphics& g,
  17344. int x, int y, int w, int h,
  17345. const Colour& preferredBackgroundColour,
  17346. int tabIndex,
  17347. const String& text,
  17348. Button& button,
  17349. TabbedButtonBar::Orientation orientation,
  17350. bool isMouseOver,
  17351. bool isMouseDown,
  17352. bool isFrontTab);
  17353. virtual int getTabButtonOverlap (int tabDepth);
  17354. virtual int getTabButtonSpaceAroundImage();
  17355. virtual int getTabButtonBestWidth (int tabIndex,
  17356. const String& text,
  17357. int tabDepth,
  17358. Button& button);
  17359. virtual void drawTabButton (Graphics& g,
  17360. int w, int h,
  17361. const Colour& preferredColour,
  17362. int tabIndex,
  17363. const String& text,
  17364. Button& button,
  17365. TabbedButtonBar::Orientation orientation,
  17366. bool isMouseOver,
  17367. bool isMouseDown,
  17368. bool isFrontTab);
  17369. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17370. int w, int h,
  17371. TabbedButtonBar& tabBar,
  17372. TabbedButtonBar::Orientation orientation);
  17373. virtual Button* createTabBarExtrasButton();
  17374. virtual void drawImageButton (Graphics& g, Image* image,
  17375. int imageX, int imageY, int imageW, int imageH,
  17376. const Colour& overlayColour,
  17377. float imageOpacity,
  17378. ImageButton& button);
  17379. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17380. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17381. int width, int height,
  17382. bool isMouseOver, bool isMouseDown,
  17383. int columnFlags);
  17384. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17385. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17386. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17387. bool isMouseOver, bool isMouseDown,
  17388. ToolbarItemComponent& component);
  17389. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17390. const String& text, ToolbarItemComponent& component);
  17391. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17392. bool isOpen, int width, int height);
  17393. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17394. PropertyComponent& component);
  17395. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17396. PropertyComponent& component);
  17397. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17398. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17399. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17400. virtual void playAlertSound();
  17401. static void drawGlassSphere (Graphics& g,
  17402. float x, float y,
  17403. float diameter,
  17404. const Colour& colour,
  17405. float outlineThickness) throw();
  17406. static void drawGlassPointer (Graphics& g,
  17407. float x, float y,
  17408. float diameter,
  17409. const Colour& colour, float outlineThickness,
  17410. int direction) throw();
  17411. static void drawGlassLozenge (Graphics& g,
  17412. float x, float y,
  17413. float width, float height,
  17414. const Colour& colour,
  17415. float outlineThickness,
  17416. float cornerSize,
  17417. bool flatOnLeft, bool flatOnRight,
  17418. bool flatOnTop, bool flatOnBottom) throw();
  17419. juce_UseDebuggingNewOperator
  17420. private:
  17421. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17422. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17423. Array <int> colourIds;
  17424. Array <Colour> colours;
  17425. // default typeface names
  17426. String defaultSans, defaultSerif, defaultFixed;
  17427. void drawShinyButtonShape (Graphics& g,
  17428. float x, float y, float w, float h, float maxCornerSize,
  17429. const Colour& baseColour,
  17430. float strokeWidth,
  17431. bool flatOnLeft,
  17432. bool flatOnRight,
  17433. bool flatOnTop,
  17434. bool flatOnBottom) throw();
  17435. LookAndFeel (const LookAndFeel&);
  17436. LookAndFeel& operator= (const LookAndFeel&);
  17437. };
  17438. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17439. /*** End of inlined file: juce_LookAndFeel.h ***/
  17440. #endif
  17441. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17442. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17443. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17444. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17445. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17446. {
  17447. public:
  17448. OldSchoolLookAndFeel();
  17449. virtual ~OldSchoolLookAndFeel();
  17450. virtual void drawButtonBackground (Graphics& g,
  17451. Button& button,
  17452. const Colour& backgroundColour,
  17453. bool isMouseOverButton,
  17454. bool isButtonDown);
  17455. virtual void drawToggleButton (Graphics& g,
  17456. ToggleButton& button,
  17457. bool isMouseOverButton,
  17458. bool isButtonDown);
  17459. virtual void drawTickBox (Graphics& g,
  17460. Component& component,
  17461. float x, float y, float w, float h,
  17462. bool ticked,
  17463. bool isEnabled,
  17464. bool isMouseOverButton,
  17465. bool isButtonDown);
  17466. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17467. int width, int height,
  17468. double progress, const String& textToShow);
  17469. virtual void drawScrollbarButton (Graphics& g,
  17470. ScrollBar& scrollbar,
  17471. int width, int height,
  17472. int buttonDirection,
  17473. bool isScrollbarVertical,
  17474. bool isMouseOverButton,
  17475. bool isButtonDown);
  17476. virtual void drawScrollbar (Graphics& g,
  17477. ScrollBar& scrollbar,
  17478. int x, int y,
  17479. int width, int height,
  17480. bool isScrollbarVertical,
  17481. int thumbStartPosition,
  17482. int thumbSize,
  17483. bool isMouseOver,
  17484. bool isMouseDown);
  17485. virtual ImageEffectFilter* getScrollbarEffect();
  17486. virtual void drawTextEditorOutline (Graphics& g,
  17487. int width, int height,
  17488. TextEditor& textEditor);
  17489. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17490. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17491. bool isMouseOverBar,
  17492. MenuBarComponent& menuBar);
  17493. virtual void drawComboBox (Graphics& g, int width, int height,
  17494. bool isButtonDown,
  17495. int buttonX, int buttonY,
  17496. int buttonW, int buttonH,
  17497. ComboBox& box);
  17498. virtual const Font getComboBoxFont (ComboBox& box);
  17499. virtual void drawLinearSlider (Graphics& g,
  17500. int x, int y,
  17501. int width, int height,
  17502. float sliderPos,
  17503. float minSliderPos,
  17504. float maxSliderPos,
  17505. const Slider::SliderStyle style,
  17506. Slider& slider);
  17507. virtual int getSliderThumbRadius (Slider& slider);
  17508. virtual Button* createSliderButton (bool isIncrement);
  17509. virtual ImageEffectFilter* getSliderEffect();
  17510. virtual void drawCornerResizer (Graphics& g,
  17511. int w, int h,
  17512. bool isMouseOver,
  17513. bool isMouseDragging);
  17514. virtual Button* createDocumentWindowButton (int buttonType);
  17515. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17516. int titleBarX, int titleBarY,
  17517. int titleBarW, int titleBarH,
  17518. Button* minimiseButton,
  17519. Button* maximiseButton,
  17520. Button* closeButton,
  17521. bool positionTitleBarButtonsOnLeft);
  17522. juce_UseDebuggingNewOperator
  17523. private:
  17524. DropShadowEffect scrollbarShadow;
  17525. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17526. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17527. };
  17528. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17529. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17530. #endif
  17531. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17532. #endif
  17533. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17534. #endif
  17535. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17536. #endif
  17537. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17538. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17539. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17540. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17541. class JUCE_API PopupMenuCustomComponent : public Component,
  17542. public ReferenceCountedObject
  17543. {
  17544. public:
  17545. ~PopupMenuCustomComponent();
  17546. virtual void getIdealSize (int& idealWidth,
  17547. int& idealHeight) = 0;
  17548. void triggerMenuItem();
  17549. bool isItemHighlighted() const throw() { return isHighlighted; }
  17550. protected:
  17551. PopupMenuCustomComponent (bool isTriggeredAutomatically = true);
  17552. private:
  17553. friend class PopupMenu;
  17554. friend class PopupMenu::ItemComponent;
  17555. friend class PopupMenu::Window;
  17556. bool isHighlighted, isTriggeredAutomatically;
  17557. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17558. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17559. };
  17560. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17561. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17562. #endif
  17563. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17564. #endif
  17565. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17566. #endif
  17567. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17568. #endif
  17569. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17570. #endif
  17571. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17572. /*** Start of inlined file: juce_LassoComponent.h ***/
  17573. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17574. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17575. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17576. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17577. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17578. template <class SelectableItemType>
  17579. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17580. {
  17581. public:
  17582. typedef SelectableItemType ItemType;
  17583. SelectedItemSet()
  17584. {
  17585. }
  17586. explicit SelectedItemSet (const Array <SelectableItemType>& items)
  17587. : selectedItems (items)
  17588. {
  17589. }
  17590. SelectedItemSet (const SelectedItemSet& other)
  17591. : selectedItems (other.selectedItems)
  17592. {
  17593. }
  17594. SelectedItemSet& operator= (const SelectedItemSet& other)
  17595. {
  17596. if (selectedItems != other.selectedItems)
  17597. {
  17598. selectedItems = other.selectedItems;
  17599. changed();
  17600. }
  17601. return *this;
  17602. }
  17603. ~SelectedItemSet()
  17604. {
  17605. }
  17606. void selectOnly (SelectableItemType item)
  17607. {
  17608. if (isSelected (item))
  17609. {
  17610. for (int i = selectedItems.size(); --i >= 0;)
  17611. {
  17612. if (selectedItems.getUnchecked(i) != item)
  17613. {
  17614. deselect (selectedItems.getUnchecked(i));
  17615. i = jmin (i, selectedItems.size());
  17616. }
  17617. }
  17618. }
  17619. else
  17620. {
  17621. deselectAll();
  17622. changed();
  17623. selectedItems.add (item);
  17624. itemSelected (item);
  17625. }
  17626. }
  17627. void addToSelection (SelectableItemType item)
  17628. {
  17629. if (! isSelected (item))
  17630. {
  17631. changed();
  17632. selectedItems.add (item);
  17633. itemSelected (item);
  17634. }
  17635. }
  17636. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17637. const ModifierKeys& modifiers)
  17638. {
  17639. if (modifiers.isShiftDown())
  17640. {
  17641. addToSelection (item);
  17642. }
  17643. else if (modifiers.isCommandDown())
  17644. {
  17645. if (isSelected (item))
  17646. deselect (item);
  17647. else
  17648. addToSelection (item);
  17649. }
  17650. else
  17651. {
  17652. selectOnly (item);
  17653. }
  17654. }
  17655. bool addToSelectionOnMouseDown (SelectableItemType item,
  17656. const ModifierKeys& modifiers)
  17657. {
  17658. if (isSelected (item))
  17659. {
  17660. return ! modifiers.isPopupMenu();
  17661. }
  17662. else
  17663. {
  17664. addToSelectionBasedOnModifiers (item, modifiers);
  17665. return false;
  17666. }
  17667. }
  17668. void addToSelectionOnMouseUp (SelectableItemType item,
  17669. const ModifierKeys& modifiers,
  17670. const bool wasItemDragged,
  17671. const bool resultOfMouseDownSelectMethod)
  17672. {
  17673. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17674. addToSelectionBasedOnModifiers (item, modifiers);
  17675. }
  17676. void deselect (SelectableItemType item)
  17677. {
  17678. const int i = selectedItems.indexOf (item);
  17679. if (i >= 0)
  17680. {
  17681. changed();
  17682. itemDeselected (selectedItems.remove (i));
  17683. }
  17684. }
  17685. void deselectAll()
  17686. {
  17687. if (selectedItems.size() > 0)
  17688. {
  17689. changed();
  17690. for (int i = selectedItems.size(); --i >= 0;)
  17691. {
  17692. itemDeselected (selectedItems.remove (i));
  17693. i = jmin (i, selectedItems.size());
  17694. }
  17695. }
  17696. }
  17697. int getNumSelected() const throw()
  17698. {
  17699. return selectedItems.size();
  17700. }
  17701. SelectableItemType getSelectedItem (const int index) const throw()
  17702. {
  17703. return selectedItems [index];
  17704. }
  17705. bool isSelected (const SelectableItemType item) const throw()
  17706. {
  17707. return selectedItems.contains (item);
  17708. }
  17709. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17710. virtual void itemSelected (SelectableItemType item) {}
  17711. virtual void itemDeselected (SelectableItemType item) {}
  17712. void changed (const bool synchronous = false)
  17713. {
  17714. if (synchronous)
  17715. sendSynchronousChangeMessage (this);
  17716. else
  17717. sendChangeMessage (this);
  17718. }
  17719. juce_UseDebuggingNewOperator
  17720. private:
  17721. Array <SelectableItemType> selectedItems;
  17722. };
  17723. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17724. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17725. template <class SelectableItemType>
  17726. class LassoSource
  17727. {
  17728. public:
  17729. virtual ~LassoSource() {}
  17730. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17731. int x, int y, int width, int height) = 0;
  17732. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17733. };
  17734. template <class SelectableItemType>
  17735. class LassoComponent : public Component
  17736. {
  17737. public:
  17738. explicit LassoComponent (const int outlineThickness_ = 1)
  17739. : source (0),
  17740. outlineThickness (outlineThickness_)
  17741. {
  17742. }
  17743. ~LassoComponent()
  17744. {
  17745. }
  17746. void beginLasso (const MouseEvent& e,
  17747. LassoSource <SelectableItemType>* const lassoSource)
  17748. {
  17749. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17750. jassert (lassoSource != 0); // the source can't be null!
  17751. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17752. source = lassoSource;
  17753. if (lassoSource != 0)
  17754. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17755. setSize (0, 0);
  17756. }
  17757. void dragLasso (const MouseEvent& e)
  17758. {
  17759. if (source != 0)
  17760. {
  17761. setBounds (Rectangle<int> (e.getMouseDownPosition(), e.getPosition()));
  17762. setVisible (true);
  17763. Array <SelectableItemType> itemsInLasso;
  17764. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17765. if (e.mods.isShiftDown())
  17766. {
  17767. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17768. itemsInLasso.addArray (originalSelection);
  17769. }
  17770. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17771. {
  17772. Array <SelectableItemType> originalMinusNew (originalSelection);
  17773. originalMinusNew.removeValuesIn (itemsInLasso);
  17774. itemsInLasso.removeValuesIn (originalSelection);
  17775. itemsInLasso.addArray (originalMinusNew);
  17776. }
  17777. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17778. }
  17779. }
  17780. void endLasso()
  17781. {
  17782. source = 0;
  17783. originalSelection.clear();
  17784. setVisible (false);
  17785. }
  17786. enum ColourIds
  17787. {
  17788. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17789. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17790. };
  17791. void paint (Graphics& g)
  17792. {
  17793. g.fillAll (findColour (lassoFillColourId));
  17794. g.setColour (findColour (lassoOutlineColourId));
  17795. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17796. // this suggests that you've left a lasso comp lying around after the
  17797. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17798. // mouse-up event.
  17799. jassert (isMouseButtonDownAnywhere());
  17800. }
  17801. bool hitTest (int x, int y) { return false; }
  17802. juce_UseDebuggingNewOperator
  17803. private:
  17804. Array <SelectableItemType> originalSelection;
  17805. LassoSource <SelectableItemType>* source;
  17806. int outlineThickness;
  17807. };
  17808. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17809. /*** End of inlined file: juce_LassoComponent.h ***/
  17810. #endif
  17811. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17812. #endif
  17813. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17814. #endif
  17815. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17816. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17817. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17818. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17819. class JUCE_API MouseHoverDetector
  17820. {
  17821. public:
  17822. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17823. virtual ~MouseHoverDetector();
  17824. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17825. void setHoverComponent (Component* const newSourceComponent);
  17826. protected:
  17827. virtual void mouseHovered (int mouseX,
  17828. int mouseY) = 0;
  17829. virtual void mouseMovedAfterHover() = 0;
  17830. private:
  17831. class JUCE_API HoverDetectorInternal : public MouseListener,
  17832. public Timer
  17833. {
  17834. public:
  17835. MouseHoverDetector* owner;
  17836. int lastX, lastY;
  17837. void timerCallback();
  17838. void mouseEnter (const MouseEvent&);
  17839. void mouseExit (const MouseEvent&);
  17840. void mouseDown (const MouseEvent&);
  17841. void mouseUp (const MouseEvent&);
  17842. void mouseMove (const MouseEvent&);
  17843. void mouseWheelMove (const MouseEvent&, float, float);
  17844. } internalTimer;
  17845. friend class HoverDetectorInternal;
  17846. Component* source;
  17847. int hoverTimeMillisecs;
  17848. bool hasJustHovered;
  17849. void hoverTimerCallback();
  17850. void checkJustHoveredCallback();
  17851. MouseHoverDetector (const MouseHoverDetector&);
  17852. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17853. };
  17854. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17855. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17856. #endif
  17857. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17858. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17859. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17860. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17861. class Component;
  17862. class ComponentPeer;
  17863. class MouseInputSourceInternal;
  17864. class JUCE_API MouseInputSource
  17865. {
  17866. public:
  17867. MouseInputSource (int index, bool isMouseDevice);
  17868. ~MouseInputSource();
  17869. bool isMouse() const;
  17870. bool isTouch() const;
  17871. bool canHover() const;
  17872. bool hasMouseWheel() const;
  17873. int getIndex() const;
  17874. bool isDragging() const;
  17875. const Point<int> getScreenPosition() const;
  17876. const ModifierKeys getCurrentModifiers() const;
  17877. Component* getComponentUnderMouse() const;
  17878. void triggerFakeMove() const;
  17879. int getNumberOfMultipleClicks() const throw();
  17880. const Time getLastMouseDownTime() const throw();
  17881. const Point<int> getLastMouseDownPosition() const throw();
  17882. bool hasMouseMovedSignificantlySincePressed() const throw();
  17883. bool hasMouseCursor() const throw();
  17884. void showMouseCursor (const MouseCursor& cursor);
  17885. void hideCursor();
  17886. void revealCursor();
  17887. void forceMouseCursorUpdate();
  17888. bool canDoUnboundedMovement() const throw();
  17889. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17890. juce_UseDebuggingNewOperator
  17891. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17892. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17893. private:
  17894. friend class Desktop;
  17895. friend class ComponentPeer;
  17896. friend class MouseInputSourceInternal;
  17897. ScopedPointer<MouseInputSourceInternal> pimpl;
  17898. MouseInputSource (const MouseInputSource&);
  17899. MouseInputSource& operator= (const MouseInputSource&);
  17900. };
  17901. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17902. /*** End of inlined file: juce_MouseInputSource.h ***/
  17903. #endif
  17904. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17905. #endif
  17906. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17907. #endif
  17908. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17909. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17910. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17911. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17912. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17913. private ButtonListener
  17914. {
  17915. protected:
  17916. BooleanPropertyComponent (const String& propertyName,
  17917. const String& buttonTextWhenTrue,
  17918. const String& buttonTextWhenFalse);
  17919. public:
  17920. BooleanPropertyComponent (const Value& valueToControl,
  17921. const String& propertyName,
  17922. const String& buttonText);
  17923. ~BooleanPropertyComponent();
  17924. virtual void setState (bool newState);
  17925. virtual bool getState() const;
  17926. void paint (Graphics& g);
  17927. void refresh();
  17928. void buttonClicked (Button*);
  17929. juce_UseDebuggingNewOperator
  17930. private:
  17931. ToggleButton* button;
  17932. String onText, offText;
  17933. void createButton();
  17934. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17935. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17936. };
  17937. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17938. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17939. #endif
  17940. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17941. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17942. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17943. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17944. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17945. private ButtonListener
  17946. {
  17947. public:
  17948. ButtonPropertyComponent (const String& propertyName,
  17949. bool triggerOnMouseDown);
  17950. ~ButtonPropertyComponent();
  17951. virtual void buttonClicked() = 0;
  17952. virtual const String getButtonText() const = 0;
  17953. void refresh();
  17954. void buttonClicked (Button*);
  17955. juce_UseDebuggingNewOperator
  17956. private:
  17957. TextButton* button;
  17958. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17959. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17960. };
  17961. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17962. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17963. #endif
  17964. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17965. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17966. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17967. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17968. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17969. private ComboBoxListener
  17970. {
  17971. protected:
  17972. ChoicePropertyComponent (const String& propertyName);
  17973. public:
  17974. ChoicePropertyComponent (const Value& valueToControl,
  17975. const String& propertyName,
  17976. const StringArray& choices,
  17977. const Array <int>* choiceIDs = 0);
  17978. ~ChoicePropertyComponent();
  17979. virtual void setIndex (int newIndex);
  17980. virtual int getIndex() const;
  17981. const StringArray& getChoices() const;
  17982. void refresh();
  17983. void comboBoxChanged (ComboBox*);
  17984. juce_UseDebuggingNewOperator
  17985. protected:
  17986. StringArray choices;
  17987. private:
  17988. ComboBox* comboBox;
  17989. void createComboBox (const Array <int>* choiceIDs);
  17990. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17991. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17992. };
  17993. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17994. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17995. #endif
  17996. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17997. #endif
  17998. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17999. #endif
  18000. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18001. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  18002. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18003. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18004. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  18005. private SliderListener
  18006. {
  18007. protected:
  18008. SliderPropertyComponent (const String& propertyName,
  18009. double rangeMin,
  18010. double rangeMax,
  18011. double interval,
  18012. double skewFactor = 1.0);
  18013. public:
  18014. SliderPropertyComponent (Value& valueToControl,
  18015. const String& propertyName,
  18016. double rangeMin,
  18017. double rangeMax,
  18018. double interval,
  18019. double skewFactor = 1.0);
  18020. ~SliderPropertyComponent();
  18021. virtual void setValue (double newValue);
  18022. virtual double getValue() const;
  18023. void refresh();
  18024. void changeListenerCallback (void*);
  18025. void sliderValueChanged (Slider*);
  18026. juce_UseDebuggingNewOperator
  18027. protected:
  18028. Slider* slider;
  18029. SliderPropertyComponent (const SliderPropertyComponent&);
  18030. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18031. };
  18032. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18033. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18034. #endif
  18035. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18036. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18037. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18038. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18039. class JUCE_API TextPropertyComponent : public PropertyComponent
  18040. {
  18041. protected:
  18042. TextPropertyComponent (const String& propertyName,
  18043. int maxNumChars,
  18044. bool isMultiLine);
  18045. public:
  18046. TextPropertyComponent (const Value& valueToControl,
  18047. const String& propertyName,
  18048. int maxNumChars,
  18049. bool isMultiLine);
  18050. ~TextPropertyComponent();
  18051. virtual void setText (const String& newText);
  18052. virtual const String getText() const;
  18053. void refresh();
  18054. void textWasEdited();
  18055. juce_UseDebuggingNewOperator
  18056. private:
  18057. Label* textEditor;
  18058. void createEditor (int maxNumChars, bool isMultiLine);
  18059. TextPropertyComponent (const TextPropertyComponent&);
  18060. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18061. };
  18062. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18063. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18064. #endif
  18065. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18066. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18067. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18068. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18069. #if JUCE_WINDOWS || DOXYGEN
  18070. class JUCE_API ActiveXControlComponent : public Component
  18071. {
  18072. public:
  18073. ActiveXControlComponent();
  18074. ~ActiveXControlComponent();
  18075. bool createControl (const void* controlIID);
  18076. void deleteControl();
  18077. bool isControlOpen() const throw() { return control != 0; }
  18078. void* queryInterface (const void* iid) const;
  18079. void setMouseEventsAllowed (bool eventsCanReachControl);
  18080. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18081. void paint (Graphics& g);
  18082. void* originalWndProc;
  18083. juce_UseDebuggingNewOperator
  18084. private:
  18085. class ActiveXControlData;
  18086. friend class ActiveXControlData;
  18087. void* control;
  18088. bool mouseEventsAllowed;
  18089. ActiveXControlComponent (const ActiveXControlComponent&);
  18090. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18091. void setControlBounds (const Rectangle<int>& bounds) const;
  18092. void setControlVisible (bool b) const;
  18093. };
  18094. #endif
  18095. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18096. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18097. #endif
  18098. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18099. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18100. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18101. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18102. class MidiInputSelectorComponentListBox;
  18103. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18104. public ComboBoxListener,
  18105. public ButtonListener,
  18106. public ChangeListener
  18107. {
  18108. public:
  18109. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18110. const int minAudioInputChannels,
  18111. const int maxAudioInputChannels,
  18112. const int minAudioOutputChannels,
  18113. const int maxAudioOutputChannels,
  18114. const bool showMidiInputOptions,
  18115. const bool showMidiOutputSelector,
  18116. const bool showChannelsAsStereoPairs,
  18117. const bool hideAdvancedOptionsWithButton);
  18118. ~AudioDeviceSelectorComponent();
  18119. void resized();
  18120. void comboBoxChanged (ComboBox*);
  18121. void buttonClicked (Button*);
  18122. void changeListenerCallback (void*);
  18123. void childBoundsChanged (Component*);
  18124. juce_UseDebuggingNewOperator
  18125. private:
  18126. AudioDeviceManager& deviceManager;
  18127. ComboBox* deviceTypeDropDown;
  18128. Label* deviceTypeDropDownLabel;
  18129. Component* audioDeviceSettingsComp;
  18130. String audioDeviceSettingsCompType;
  18131. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18132. const bool showChannelsAsStereoPairs;
  18133. const bool hideAdvancedOptionsWithButton;
  18134. MidiInputSelectorComponentListBox* midiInputsList;
  18135. Label* midiInputsLabel;
  18136. ComboBox* midiOutputSelector;
  18137. Label* midiOutputLabel;
  18138. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18139. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18140. };
  18141. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18142. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18143. #endif
  18144. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18145. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18146. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18147. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18148. class JUCE_API BubbleComponent : public Component
  18149. {
  18150. protected:
  18151. BubbleComponent();
  18152. public:
  18153. ~BubbleComponent();
  18154. enum BubblePlacement
  18155. {
  18156. above = 1,
  18157. below = 2,
  18158. left = 4,
  18159. right = 8
  18160. };
  18161. void setAllowedPlacement (int newPlacement);
  18162. void setPosition (Component* componentToPointTo);
  18163. void setPosition (int arrowTipX,
  18164. int arrowTipY);
  18165. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18166. protected:
  18167. virtual void getContentSize (int& width, int& height) = 0;
  18168. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18169. public:
  18170. void paint (Graphics& g);
  18171. juce_UseDebuggingNewOperator
  18172. private:
  18173. Rectangle<int> content;
  18174. int side, allowablePlacements;
  18175. float arrowTipX, arrowTipY;
  18176. DropShadowEffect shadow;
  18177. BubbleComponent (const BubbleComponent&);
  18178. BubbleComponent& operator= (const BubbleComponent&);
  18179. };
  18180. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18181. /*** End of inlined file: juce_BubbleComponent.h ***/
  18182. #endif
  18183. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18184. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18185. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18186. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18187. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18188. private Timer
  18189. {
  18190. public:
  18191. BubbleMessageComponent (int fadeOutLengthMs = 150);
  18192. ~BubbleMessageComponent();
  18193. void showAt (int x, int y,
  18194. const String& message,
  18195. int numMillisecondsBeforeRemoving,
  18196. bool removeWhenMouseClicked = true,
  18197. bool deleteSelfAfterUse = false);
  18198. void showAt (Component* component,
  18199. const String& message,
  18200. int numMillisecondsBeforeRemoving,
  18201. bool removeWhenMouseClicked = true,
  18202. bool deleteSelfAfterUse = false);
  18203. void getContentSize (int& w, int& h);
  18204. void paintContent (Graphics& g, int w, int h);
  18205. void timerCallback();
  18206. juce_UseDebuggingNewOperator
  18207. private:
  18208. int fadeOutLength, mouseClickCounter;
  18209. TextLayout textLayout;
  18210. int64 expiryTime;
  18211. bool deleteAfterUse;
  18212. void init (int numMillisecondsBeforeRemoving,
  18213. bool removeWhenMouseClicked,
  18214. bool deleteSelfAfterUse);
  18215. BubbleMessageComponent (const BubbleMessageComponent&);
  18216. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18217. };
  18218. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18219. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18220. #endif
  18221. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18222. /*** Start of inlined file: juce_ColourSelector.h ***/
  18223. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18224. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18225. class JUCE_API ColourSelector : public Component,
  18226. public ChangeBroadcaster,
  18227. protected SliderListener
  18228. {
  18229. public:
  18230. enum ColourSelectorOptions
  18231. {
  18232. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18233. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18234. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18235. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18236. };
  18237. ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18238. int edgeGap = 4,
  18239. int gapAroundColourSpaceComponent = 7);
  18240. ~ColourSelector();
  18241. const Colour getCurrentColour() const;
  18242. void setCurrentColour (const Colour& newColour);
  18243. virtual int getNumSwatches() const;
  18244. virtual const Colour getSwatchColour (int index) const;
  18245. virtual void setSwatchColour (int index, const Colour& newColour) const;
  18246. enum ColourIds
  18247. {
  18248. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18249. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18250. };
  18251. juce_UseDebuggingNewOperator
  18252. private:
  18253. class ColourSpaceView;
  18254. class HueSelectorComp;
  18255. class SwatchComponent;
  18256. friend class ColourSpaceView;
  18257. friend class HueSelectorComp;
  18258. Colour colour;
  18259. float h, s, v;
  18260. Slider* sliders[4];
  18261. ColourSpaceView* colourSpace;
  18262. HueSelectorComp* hueSelector;
  18263. OwnedArray <SwatchComponent> swatchComponents;
  18264. const int flags;
  18265. int topSpace, edgeGap;
  18266. void setHue (float newH);
  18267. void setSV (float newS, float newV);
  18268. void updateHSV();
  18269. void update();
  18270. void sliderValueChanged (Slider*);
  18271. void paint (Graphics& g);
  18272. void resized();
  18273. ColourSelector (const ColourSelector&);
  18274. ColourSelector& operator= (const ColourSelector&);
  18275. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18276. // have changed - if you get an error here, update your code to use the new constructor instead..
  18277. // (xxx - note to self: remember to remove this at some point in the future)
  18278. ColourSelector (bool);
  18279. };
  18280. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18281. /*** End of inlined file: juce_ColourSelector.h ***/
  18282. #endif
  18283. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18284. #endif
  18285. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18286. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18287. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18288. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18289. class JUCE_API MagnifierComponent : public Component
  18290. {
  18291. public:
  18292. MagnifierComponent (Component* contentComponent,
  18293. bool deleteContentCompWhenNoLongerNeeded);
  18294. ~MagnifierComponent();
  18295. Component* getContentComponent() const { return content; }
  18296. void setScaleFactor (double newScaleFactor);
  18297. double getScaleFactor() const { return scaleFactor; }
  18298. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18299. juce_UseDebuggingNewOperator
  18300. void childBoundsChanged (Component*);
  18301. private:
  18302. Component* content;
  18303. Component* holderComp;
  18304. double scaleFactor;
  18305. ComponentPeer* peer;
  18306. bool deleteContent;
  18307. Graphics::ResamplingQuality quality;
  18308. MouseInputSource mouseSource;
  18309. void paint (Graphics& g);
  18310. void mouseDown (const MouseEvent& e);
  18311. void mouseUp (const MouseEvent& e);
  18312. void mouseDrag (const MouseEvent& e);
  18313. void mouseMove (const MouseEvent& e);
  18314. void mouseEnter (const MouseEvent& e);
  18315. void mouseExit (const MouseEvent& e);
  18316. void mouseWheelMove (const MouseEvent& e, float, float);
  18317. void passOnMouseEventToPeer (const MouseEvent& e);
  18318. int scaleInt (int n) const;
  18319. MagnifierComponent (const MagnifierComponent&);
  18320. MagnifierComponent& operator= (const MagnifierComponent&);
  18321. };
  18322. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18323. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18324. #endif
  18325. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18326. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18327. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18328. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18329. class JUCE_API MidiKeyboardComponent : public Component,
  18330. public MidiKeyboardStateListener,
  18331. public ChangeBroadcaster,
  18332. private Timer,
  18333. private AsyncUpdater
  18334. {
  18335. public:
  18336. enum Orientation
  18337. {
  18338. horizontalKeyboard,
  18339. verticalKeyboardFacingLeft,
  18340. verticalKeyboardFacingRight,
  18341. };
  18342. MidiKeyboardComponent (MidiKeyboardState& state,
  18343. Orientation orientation);
  18344. ~MidiKeyboardComponent();
  18345. void setVelocity (float velocity, bool useMousePositionForVelocity);
  18346. void setMidiChannel (int midiChannelNumber);
  18347. int getMidiChannel() const throw() { return midiChannel; }
  18348. void setMidiChannelsToDisplay (int midiChannelMask);
  18349. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18350. void setKeyWidth (float widthInPixels);
  18351. float getKeyWidth() const throw() { return keyWidth; }
  18352. void setOrientation (Orientation newOrientation);
  18353. const Orientation getOrientation() const throw() { return orientation; }
  18354. void setAvailableRange (int lowestNote,
  18355. int highestNote);
  18356. int getRangeStart() const throw() { return rangeStart; }
  18357. int getRangeEnd() const throw() { return rangeEnd; }
  18358. void setLowestVisibleKey (int noteNumber);
  18359. int getLowestVisibleKey() const throw() { return firstKey; }
  18360. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18361. void setScrollButtonsVisible (bool canScroll);
  18362. enum ColourIds
  18363. {
  18364. whiteNoteColourId = 0x1005000,
  18365. blackNoteColourId = 0x1005001,
  18366. keySeparatorLineColourId = 0x1005002,
  18367. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18368. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18369. textLabelColourId = 0x1005005,
  18370. upDownButtonBackgroundColourId = 0x1005006,
  18371. upDownButtonArrowColourId = 0x1005007
  18372. };
  18373. int getKeyStartPosition (const int midiNoteNumber) const;
  18374. void clearKeyMappings();
  18375. void setKeyPressForNote (const KeyPress& key,
  18376. int midiNoteOffsetFromC);
  18377. void removeKeyPressForNote (int midiNoteOffsetFromC);
  18378. void setKeyPressBaseOctave (int newOctaveNumber);
  18379. void setOctaveForMiddleC (int octaveNumForMiddleC) throw();
  18380. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18381. void paint (Graphics& g);
  18382. void resized();
  18383. void mouseMove (const MouseEvent& e);
  18384. void mouseDrag (const MouseEvent& e);
  18385. void mouseDown (const MouseEvent& e);
  18386. void mouseUp (const MouseEvent& e);
  18387. void mouseEnter (const MouseEvent& e);
  18388. void mouseExit (const MouseEvent& e);
  18389. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18390. void timerCallback();
  18391. bool keyStateChanged (bool isKeyDown);
  18392. void focusLost (FocusChangeType cause);
  18393. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18394. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18395. void handleAsyncUpdate();
  18396. void colourChanged();
  18397. juce_UseDebuggingNewOperator
  18398. protected:
  18399. friend class MidiKeyboardUpDownButton;
  18400. virtual void drawWhiteNote (int midiNoteNumber,
  18401. Graphics& g,
  18402. int x, int y, int w, int h,
  18403. bool isDown, bool isOver,
  18404. const Colour& lineColour,
  18405. const Colour& textColour);
  18406. virtual void drawBlackNote (int midiNoteNumber,
  18407. Graphics& g,
  18408. int x, int y, int w, int h,
  18409. bool isDown, bool isOver,
  18410. const Colour& noteFillColour);
  18411. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18412. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18413. const bool isMouseOver,
  18414. const bool isButtonPressed,
  18415. const bool movesOctavesUp);
  18416. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18417. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18418. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18419. int& x, int& w) const;
  18420. private:
  18421. MidiKeyboardState& state;
  18422. int xOffset, blackNoteLength;
  18423. float keyWidth;
  18424. Orientation orientation;
  18425. int midiChannel, midiInChannelMask;
  18426. float velocity;
  18427. int noteUnderMouse, mouseDownNote;
  18428. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18429. int rangeStart, rangeEnd, firstKey;
  18430. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18431. Button* scrollDown;
  18432. Button* scrollUp;
  18433. Array <KeyPress> keyPresses;
  18434. Array <int> keyPressNotes;
  18435. int keyMappingOctave;
  18436. int octaveNumForMiddleC;
  18437. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18438. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18439. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18440. void resetAnyKeysInUse();
  18441. void updateNoteUnderMouse (const Point<int>& pos);
  18442. void repaintNote (const int midiNoteNumber);
  18443. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18444. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18445. };
  18446. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18447. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18448. #endif
  18449. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18450. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18451. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18452. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18453. #if ! DOXYGEN
  18454. class NSViewComponentInternal;
  18455. #endif
  18456. #if JUCE_MAC || DOXYGEN
  18457. class JUCE_API NSViewComponent : public Component
  18458. {
  18459. public:
  18460. NSViewComponent();
  18461. ~NSViewComponent();
  18462. void setView (void* nsView);
  18463. void* getView() const;
  18464. void paint (Graphics& g);
  18465. juce_UseDebuggingNewOperator
  18466. private:
  18467. friend class NSViewComponentInternal;
  18468. ScopedPointer <NSViewComponentInternal> info;
  18469. NSViewComponent (const NSViewComponent&);
  18470. NSViewComponent& operator= (const NSViewComponent&);
  18471. };
  18472. #endif
  18473. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18474. /*** End of inlined file: juce_NSViewComponent.h ***/
  18475. #endif
  18476. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18477. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18478. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18479. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18480. // this is used to disable OpenGL, and is defined in juce_Config.h
  18481. #if JUCE_OPENGL || DOXYGEN
  18482. class JUCE_API OpenGLPixelFormat
  18483. {
  18484. public:
  18485. OpenGLPixelFormat (int bitsPerRGBComponent = 8,
  18486. int alphaBits = 8,
  18487. int depthBufferBits = 16,
  18488. int stencilBufferBits = 0);
  18489. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18490. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18491. bool operator== (const OpenGLPixelFormat&) const;
  18492. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18493. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18494. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18495. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18496. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18497. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18498. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18499. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18500. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18501. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18502. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18503. static void getAvailablePixelFormats (Component* component,
  18504. OwnedArray <OpenGLPixelFormat>& results);
  18505. juce_UseDebuggingNewOperator
  18506. };
  18507. class JUCE_API OpenGLContext
  18508. {
  18509. public:
  18510. virtual ~OpenGLContext();
  18511. virtual bool makeActive() const throw() = 0;
  18512. virtual bool makeInactive() const throw() = 0;
  18513. virtual bool isActive() const throw() = 0;
  18514. virtual void swapBuffers() = 0;
  18515. virtual bool setSwapInterval (int numFramesPerSwap) = 0;
  18516. virtual int getSwapInterval() const = 0;
  18517. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18518. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18519. virtual void repaint() = 0;
  18520. virtual void* getRawContext() const throw() = 0;
  18521. static OpenGLContext* getCurrentContext();
  18522. juce_UseDebuggingNewOperator
  18523. protected:
  18524. OpenGLContext() throw();
  18525. };
  18526. class JUCE_API OpenGLComponent : public Component
  18527. {
  18528. public:
  18529. enum OpenGLType
  18530. {
  18531. openGLDefault = 0,
  18532. #if JUCE_IPHONE
  18533. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18534. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18535. #endif
  18536. };
  18537. OpenGLComponent (OpenGLType type = openGLDefault);
  18538. ~OpenGLComponent();
  18539. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18540. const OpenGLPixelFormat getPixelFormat() const;
  18541. void shareWith (OpenGLContext* contextToShareListsWith);
  18542. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18543. void swapBuffers();
  18544. virtual void renderOpenGL() = 0;
  18545. virtual void newOpenGLContextCreated() = 0;
  18546. OpenGLContext* getCurrentContext() const throw() { return context; }
  18547. bool makeCurrentContextActive();
  18548. void makeCurrentContextInactive();
  18549. bool isActiveContext() const throw();
  18550. virtual bool renderAndSwapBuffers();
  18551. CriticalSection& getContextLock() throw() { return contextLock; }
  18552. void paint (Graphics& g);
  18553. void* getNativeWindowHandle() const;
  18554. juce_UseDebuggingNewOperator
  18555. private:
  18556. const OpenGLType type;
  18557. class OpenGLComponentWatcher;
  18558. friend class OpenGLComponentWatcher;
  18559. friend class ScopedPointer <OpenGLComponentWatcher>;
  18560. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18561. ScopedPointer <OpenGLContext> context;
  18562. OpenGLContext* contextToShareListsWith;
  18563. CriticalSection contextLock;
  18564. OpenGLPixelFormat preferredPixelFormat;
  18565. bool needToUpdateViewport;
  18566. OpenGLContext* createContext();
  18567. void deleteContext();
  18568. void updateContextPosition();
  18569. void internalRepaint (int x, int y, int w, int h);
  18570. OpenGLComponent (const OpenGLComponent&);
  18571. OpenGLComponent& operator= (const OpenGLComponent&);
  18572. };
  18573. #endif
  18574. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18575. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18576. #endif
  18577. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18578. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18579. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18580. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18581. class JUCE_API PreferencesPanel : public Component,
  18582. private ButtonListener
  18583. {
  18584. public:
  18585. PreferencesPanel();
  18586. ~PreferencesPanel();
  18587. void addSettingsPage (const String& pageTitle,
  18588. const Drawable* normalIcon,
  18589. const Drawable* overIcon,
  18590. const Drawable* downIcon);
  18591. void addSettingsPage (const String& pageTitle,
  18592. const char* imageData,
  18593. int imageDataSize);
  18594. void showInDialogBox (const String& dialogtitle,
  18595. int dialogWidth,
  18596. int dialogHeight,
  18597. const Colour& backgroundColour = Colours::white);
  18598. virtual Component* createComponentForPage (const String& pageName) = 0;
  18599. void setCurrentPage (const String& pageName);
  18600. void resized();
  18601. void paint (Graphics& g);
  18602. void buttonClicked (Button* button);
  18603. juce_UseDebuggingNewOperator
  18604. private:
  18605. String currentPageName;
  18606. ScopedPointer <Component> currentPage;
  18607. int buttonSize;
  18608. PreferencesPanel (const PreferencesPanel&);
  18609. PreferencesPanel& operator= (const PreferencesPanel&);
  18610. };
  18611. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18612. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18613. #endif
  18614. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18615. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18616. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18617. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18618. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18619. // amalgamated build)
  18620. #if JUCE_WINDOWS
  18621. typedef ActiveXControlComponent QTCompBaseClass;
  18622. #elif JUCE_MAC
  18623. typedef NSViewComponent QTCompBaseClass;
  18624. #endif
  18625. // this is used to disable QuickTime, and is defined in juce_Config.h
  18626. #if JUCE_QUICKTIME || DOXYGEN
  18627. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18628. {
  18629. public:
  18630. QuickTimeMovieComponent();
  18631. ~QuickTimeMovieComponent();
  18632. static bool isQuickTimeAvailable() throw();
  18633. bool loadMovie (const File& movieFile,
  18634. bool isControllerVisible);
  18635. bool loadMovie (const URL& movieURL,
  18636. bool isControllerVisible);
  18637. bool loadMovie (InputStream* movieStream,
  18638. bool isControllerVisible);
  18639. void closeMovie();
  18640. const File getCurrentMovieFile() const;
  18641. bool isMovieOpen() const;
  18642. double getMovieDuration() const;
  18643. void getMovieNormalSize (int& width, int& height) const;
  18644. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18645. const RectanglePlacement& placement);
  18646. void play();
  18647. void stop();
  18648. bool isPlaying() const;
  18649. void goToStart();
  18650. void setPosition (double seconds);
  18651. double getPosition() const;
  18652. void setSpeed (float newSpeed);
  18653. void setMovieVolume (float newVolume);
  18654. float getMovieVolume() const;
  18655. void setLooping (bool shouldLoop);
  18656. bool isLooping() const;
  18657. bool isControllerVisible() const;
  18658. void paint (Graphics& g);
  18659. juce_UseDebuggingNewOperator
  18660. private:
  18661. File movieFile;
  18662. bool movieLoaded, controllerVisible, looping;
  18663. #if JUCE_WINDOWS
  18664. void parentHierarchyChanged();
  18665. void visibilityChanged();
  18666. void createControlIfNeeded();
  18667. bool isControlCreated() const;
  18668. class Pimpl;
  18669. friend class ScopedPointer <Pimpl>;
  18670. ScopedPointer <Pimpl> pimpl;
  18671. #else
  18672. void* movie;
  18673. #endif
  18674. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18675. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18676. };
  18677. #endif
  18678. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18679. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18680. #endif
  18681. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18682. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18683. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18684. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18685. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18686. class JUCE_API SystemTrayIconComponent : public Component
  18687. {
  18688. public:
  18689. SystemTrayIconComponent();
  18690. ~SystemTrayIconComponent();
  18691. void setIconImage (const Image& newImage);
  18692. void setIconTooltip (const String& tooltip);
  18693. #if JUCE_LINUX
  18694. void paint (Graphics& g);
  18695. #endif
  18696. juce_UseDebuggingNewOperator
  18697. private:
  18698. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18699. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18700. };
  18701. #endif
  18702. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18703. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18704. #endif
  18705. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18706. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18707. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18708. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18709. #if JUCE_WEB_BROWSER || DOXYGEN
  18710. #if ! DOXYGEN
  18711. class WebBrowserComponentInternal;
  18712. #endif
  18713. class JUCE_API WebBrowserComponent : public Component
  18714. {
  18715. public:
  18716. explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true);
  18717. ~WebBrowserComponent();
  18718. void goToURL (const String& url,
  18719. const StringArray* headers = 0,
  18720. const MemoryBlock* postData = 0);
  18721. void stop();
  18722. void goBack();
  18723. void goForward();
  18724. void refresh();
  18725. virtual bool pageAboutToLoad (const String& newURL);
  18726. void paint (Graphics& g);
  18727. void resized();
  18728. void parentHierarchyChanged();
  18729. void visibilityChanged();
  18730. juce_UseDebuggingNewOperator
  18731. private:
  18732. WebBrowserComponentInternal* browser;
  18733. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18734. String lastURL;
  18735. StringArray lastHeaders;
  18736. MemoryBlock lastPostData;
  18737. void reloadLastURL();
  18738. void checkWindowAssociation();
  18739. WebBrowserComponent (const WebBrowserComponent&);
  18740. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18741. };
  18742. #endif
  18743. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18744. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18745. #endif
  18746. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18747. #endif
  18748. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18749. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18750. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18751. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18752. class ComponentBoundsConstrainer;
  18753. class JUCE_API ComponentPeer
  18754. {
  18755. public:
  18756. enum StyleFlags
  18757. {
  18758. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18759. entry on the taskbar (ignored on MacOSX) */
  18760. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18761. tooltip, etc. */
  18762. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18763. through it (may not be possible on some platforms). */
  18764. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18765. title bar and frame\. if not specified, the window will be
  18766. borderless. */
  18767. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18768. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18769. minimise button on it. */
  18770. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18771. maximise button on it. */
  18772. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18773. close button on it. */
  18774. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18775. not be possible on all platforms). */
  18776. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18777. do its own repainting, but only to repaint when the
  18778. performAnyPendingRepaintsNow() method is called. */
  18779. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18780. be used for things like plugin windows, to stop them interfering
  18781. with the host's shortcut keys */
  18782. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18783. };
  18784. ComponentPeer (Component* component,
  18785. int styleFlags) throw();
  18786. virtual ~ComponentPeer();
  18787. Component* getComponent() const throw() { return component; }
  18788. int getStyleFlags() const throw() { return styleFlags; }
  18789. virtual void* getNativeHandle() const = 0;
  18790. virtual void setVisible (bool shouldBeVisible) = 0;
  18791. virtual void setTitle (const String& title) = 0;
  18792. virtual void setPosition (int x, int y) = 0;
  18793. virtual void setSize (int w, int h) = 0;
  18794. virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0;
  18795. virtual const Rectangle<int> getBounds() const = 0;
  18796. virtual const Point<int> getScreenPosition() const = 0;
  18797. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18798. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18799. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18800. virtual bool isMinimised() const = 0;
  18801. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18802. virtual bool isFullScreen() const = 0;
  18803. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18804. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18805. virtual void setIcon (const Image& newIcon) = 0;
  18806. void setConstrainer (ComponentBoundsConstrainer* newConstrainer) throw();
  18807. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18808. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18809. virtual const BorderSize getFrameSize() const = 0;
  18810. void handleMovedOrResized();
  18811. void handleScreenSizeChange();
  18812. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18813. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18814. virtual void toFront (bool makeActive) = 0;
  18815. virtual void toBehind (ComponentPeer* other) = 0;
  18816. void handleBroughtToFront();
  18817. virtual bool isFocused() const = 0;
  18818. virtual void grabFocus() = 0;
  18819. virtual void textInputRequired (const Point<int>& position) = 0;
  18820. void handleFocusGain();
  18821. void handleFocusLoss();
  18822. Component* getLastFocusedSubcomponent() const throw();
  18823. bool handleKeyPress (int keyCode,
  18824. juce_wchar textCharacter);
  18825. bool handleKeyUpOrDown (bool isKeyDown);
  18826. void handleModifierKeysChange();
  18827. TextInputTarget* findCurrentTextInputTarget();
  18828. virtual void repaint (int x, int y, int w, int h) = 0;
  18829. virtual void performAnyPendingRepaintsNow() = 0;
  18830. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
  18831. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18832. void handleUserClosingWindow();
  18833. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18834. void handleFileDragExit (const StringArray& files);
  18835. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18836. void clearMaskedRegion() throw();
  18837. void addMaskedRegion (int x, int y, int w, int h) throw();
  18838. static int getNumPeers() throw();
  18839. static ComponentPeer* getPeer (int index) throw();
  18840. static bool isValidPeer (const ComponentPeer* peer) throw();
  18841. static void bringModalComponentToFront();
  18842. virtual const StringArray getAvailableRenderingEngines() throw();
  18843. virtual int getCurrentRenderingEngine() throw();
  18844. virtual void setCurrentRenderingEngine (int index) throw();
  18845. juce_UseDebuggingNewOperator
  18846. protected:
  18847. Component* const component;
  18848. const int styleFlags;
  18849. RectangleList maskedRegion;
  18850. Rectangle<int> lastNonFullscreenBounds;
  18851. uint32 lastPaintTime;
  18852. ComponentBoundsConstrainer* constrainer;
  18853. static void updateCurrentModifiers() throw();
  18854. private:
  18855. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  18856. Component* lastDragAndDropCompUnderMouse;
  18857. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18858. friend class Component;
  18859. static ComponentPeer* getPeerFor (const Component* component) throw();
  18860. void setLastDragDropTarget (Component* comp);
  18861. ComponentPeer (const ComponentPeer&);
  18862. ComponentPeer& operator= (const ComponentPeer&);
  18863. };
  18864. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18865. /*** End of inlined file: juce_ComponentPeer.h ***/
  18866. #endif
  18867. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18868. /*** Start of inlined file: juce_DialogWindow.h ***/
  18869. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18870. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18871. class JUCE_API DialogWindow : public DocumentWindow
  18872. {
  18873. public:
  18874. DialogWindow (const String& name,
  18875. const Colour& backgroundColour,
  18876. bool escapeKeyTriggersCloseButton,
  18877. bool addToDesktop = true);
  18878. ~DialogWindow();
  18879. static int showModalDialog (const String& dialogTitle,
  18880. Component* contentComponent,
  18881. Component* componentToCentreAround,
  18882. const Colour& backgroundColour,
  18883. bool escapeKeyTriggersCloseButton,
  18884. bool shouldBeResizable = false,
  18885. bool useBottomRightCornerResizer = false);
  18886. juce_UseDebuggingNewOperator
  18887. protected:
  18888. void resized();
  18889. private:
  18890. bool escapeKeyTriggersCloseButton;
  18891. DialogWindow (const DialogWindow&);
  18892. DialogWindow& operator= (const DialogWindow&);
  18893. };
  18894. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18895. /*** End of inlined file: juce_DialogWindow.h ***/
  18896. #endif
  18897. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18898. #endif
  18899. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18900. #endif
  18901. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18902. /*** Start of inlined file: juce_SplashScreen.h ***/
  18903. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18904. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18905. class JUCE_API SplashScreen : public Component,
  18906. public Timer,
  18907. private DeletedAtShutdown
  18908. {
  18909. public:
  18910. SplashScreen();
  18911. ~SplashScreen();
  18912. void show (const String& title,
  18913. Image* backgroundImage,
  18914. int minimumTimeToDisplayFor,
  18915. bool useDropShadow,
  18916. bool removeOnMouseClick = true);
  18917. void show (const String& title,
  18918. int width,
  18919. int height,
  18920. int minimumTimeToDisplayFor,
  18921. bool useDropShadow,
  18922. bool removeOnMouseClick = true);
  18923. void paint (Graphics& g);
  18924. void timerCallback();
  18925. juce_UseDebuggingNewOperator
  18926. private:
  18927. Image* backgroundImage;
  18928. Time earliestTimeToDelete;
  18929. int originalClickCounter;
  18930. SplashScreen (const SplashScreen&);
  18931. SplashScreen& operator= (const SplashScreen&);
  18932. };
  18933. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18934. /*** End of inlined file: juce_SplashScreen.h ***/
  18935. #endif
  18936. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18937. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18938. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18939. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18940. class JUCE_API ThreadWithProgressWindow : public Thread,
  18941. private Timer
  18942. {
  18943. public:
  18944. ThreadWithProgressWindow (const String& windowTitle,
  18945. bool hasProgressBar,
  18946. bool hasCancelButton,
  18947. int timeOutMsWhenCancelling = 10000,
  18948. const String& cancelButtonText = "Cancel");
  18949. ~ThreadWithProgressWindow();
  18950. bool runThread (int threadPriority = 5);
  18951. void setProgress (double newProgress);
  18952. void setStatusMessage (const String& newStatusMessage);
  18953. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18954. juce_UseDebuggingNewOperator
  18955. private:
  18956. void timerCallback();
  18957. double progress;
  18958. ScopedPointer <AlertWindow> alertWindow;
  18959. String message;
  18960. CriticalSection messageLock;
  18961. const int timeOutMsWhenCancelling;
  18962. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18963. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18964. };
  18965. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18966. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18967. #endif
  18968. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18969. #endif
  18970. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18971. #endif
  18972. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18973. #endif
  18974. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18975. #endif
  18976. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18977. #endif
  18978. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18979. #endif
  18980. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18981. #endif
  18982. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18983. #endif
  18984. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18985. #endif
  18986. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18987. #endif
  18988. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18989. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18990. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18991. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18992. class JUCE_API LowLevelGraphicsContext
  18993. {
  18994. protected:
  18995. LowLevelGraphicsContext();
  18996. public:
  18997. virtual ~LowLevelGraphicsContext();
  18998. virtual bool isVectorDevice() const = 0;
  18999. virtual void setOrigin (int x, int y) = 0;
  19000. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  19001. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  19002. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  19003. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  19004. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  19005. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  19006. virtual const Rectangle<int> getClipBounds() const = 0;
  19007. virtual bool isClipEmpty() const = 0;
  19008. virtual void saveState() = 0;
  19009. virtual void restoreState() = 0;
  19010. virtual void setFill (const FillType& fillType) = 0;
  19011. virtual void setOpacity (float newOpacity) = 0;
  19012. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  19013. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  19014. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  19015. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19016. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  19017. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  19018. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  19019. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  19020. virtual void setFont (const Font& newFont) = 0;
  19021. virtual const Font getFont() = 0;
  19022. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  19023. };
  19024. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19025. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  19026. #endif
  19027. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19028. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19029. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19030. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19031. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  19032. {
  19033. public:
  19034. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19035. const String& documentTitle,
  19036. int totalWidth,
  19037. int totalHeight);
  19038. ~LowLevelGraphicsPostScriptRenderer();
  19039. bool isVectorDevice() const;
  19040. void setOrigin (int x, int y);
  19041. bool clipToRectangle (const Rectangle<int>& r);
  19042. bool clipToRectangleList (const RectangleList& clipRegion);
  19043. void excludeClipRectangle (const Rectangle<int>& r);
  19044. void clipToPath (const Path& path, const AffineTransform& transform);
  19045. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19046. void saveState();
  19047. void restoreState();
  19048. bool clipRegionIntersects (const Rectangle<int>& r);
  19049. const Rectangle<int> getClipBounds() const;
  19050. bool isClipEmpty() const;
  19051. void setFill (const FillType& fillType);
  19052. void setOpacity (float opacity);
  19053. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19054. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19055. void fillPath (const Path& path, const AffineTransform& transform);
  19056. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19057. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19058. void drawLine (double x1, double y1, double x2, double y2);
  19059. void drawVerticalLine (int x, double top, double bottom);
  19060. void drawHorizontalLine (int x, double top, double bottom);
  19061. const Font getFont();
  19062. void setFont (const Font& newFont);
  19063. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19064. juce_UseDebuggingNewOperator
  19065. protected:
  19066. OutputStream& out;
  19067. int totalWidth, totalHeight;
  19068. bool needToClip;
  19069. Colour lastColour;
  19070. struct SavedState
  19071. {
  19072. SavedState();
  19073. ~SavedState();
  19074. RectangleList clip;
  19075. int xOffset, yOffset;
  19076. FillType fillType;
  19077. Font font;
  19078. private:
  19079. SavedState& operator= (const SavedState&);
  19080. };
  19081. OwnedArray <SavedState> stateStack;
  19082. void writeClip();
  19083. void writeColour (const Colour& colour);
  19084. void writePath (const Path& path) const;
  19085. void writeXY (float x, float y) const;
  19086. void writeTransform (const AffineTransform& trans) const;
  19087. void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
  19088. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19089. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19090. };
  19091. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19092. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19093. #endif
  19094. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19095. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19096. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19097. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19098. class LLGCSavedState;
  19099. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19100. {
  19101. public:
  19102. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19103. ~LowLevelGraphicsSoftwareRenderer();
  19104. bool isVectorDevice() const;
  19105. void setOrigin (int x, int y);
  19106. bool clipToRectangle (const Rectangle<int>& r);
  19107. bool clipToRectangleList (const RectangleList& clipRegion);
  19108. void excludeClipRectangle (const Rectangle<int>& r);
  19109. void clipToPath (const Path& path, const AffineTransform& transform);
  19110. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19111. bool clipRegionIntersects (const Rectangle<int>& r);
  19112. const Rectangle<int> getClipBounds() const;
  19113. bool isClipEmpty() const;
  19114. void saveState();
  19115. void restoreState();
  19116. void setFill (const FillType& fillType);
  19117. void setOpacity (float opacity);
  19118. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19119. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19120. void fillPath (const Path& path, const AffineTransform& transform);
  19121. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19122. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19123. void drawLine (double x1, double y1, double x2, double y2);
  19124. void drawVerticalLine (int x, double top, double bottom);
  19125. void drawHorizontalLine (int x, double top, double bottom);
  19126. void setFont (const Font& newFont);
  19127. const Font getFont();
  19128. void drawGlyph (int glyphNumber, float x, float y);
  19129. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19130. juce_UseDebuggingNewOperator
  19131. protected:
  19132. Image& image;
  19133. ScopedPointer <LLGCSavedState> currentState;
  19134. OwnedArray <LLGCSavedState> stateStack;
  19135. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19136. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19137. };
  19138. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19139. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19140. #endif
  19141. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19142. #endif
  19143. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19144. #endif
  19145. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19146. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19147. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19148. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19149. class JUCE_API DrawableComposite : public Drawable
  19150. {
  19151. public:
  19152. DrawableComposite();
  19153. virtual ~DrawableComposite();
  19154. void insertDrawable (Drawable* drawable,
  19155. const AffineTransform& transform = AffineTransform::identity,
  19156. int index = -1);
  19157. void insertDrawable (const Drawable& drawable,
  19158. const AffineTransform& transform = AffineTransform::identity,
  19159. int index = -1);
  19160. void removeDrawable (int index, bool deleteDrawable = true);
  19161. int getNumDrawables() const throw() { return drawables.size(); }
  19162. Drawable* getDrawable (int index) const throw() { return drawables [index]; }
  19163. const AffineTransform* getDrawableTransform (int index) const throw() { return transforms [index]; }
  19164. void bringToFront (int index);
  19165. void render (const Drawable::RenderingContext& context) const;
  19166. const Rectangle<float> getBounds() const;
  19167. bool hitTest (float x, float y) const;
  19168. Drawable* createCopy() const;
  19169. ValueTree createValueTree() const throw();
  19170. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19171. juce_UseDebuggingNewOperator
  19172. private:
  19173. OwnedArray <Drawable> drawables;
  19174. OwnedArray <AffineTransform> transforms;
  19175. DrawableComposite (const DrawableComposite&);
  19176. DrawableComposite& operator= (const DrawableComposite&);
  19177. };
  19178. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19179. /*** End of inlined file: juce_DrawableComposite.h ***/
  19180. #endif
  19181. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19182. /*** Start of inlined file: juce_DrawableImage.h ***/
  19183. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19184. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19185. class JUCE_API DrawableImage : public Drawable
  19186. {
  19187. public:
  19188. DrawableImage();
  19189. virtual ~DrawableImage();
  19190. void setImage (const Image& imageToCopy);
  19191. void setImage (Image* imageToUse,
  19192. bool releaseWhenNotNeeded);
  19193. Image* getImage() const throw() { return image; }
  19194. void clearImage();
  19195. void setOpacity (float newOpacity);
  19196. float getOpacity() const throw() { return opacity; }
  19197. void setOverlayColour (const Colour& newOverlayColour);
  19198. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19199. void render (const Drawable::RenderingContext& context) const;
  19200. const Rectangle<float> getBounds() const;
  19201. bool hitTest (float x, float y) const;
  19202. Drawable* createCopy() const;
  19203. ValueTree createValueTree() const throw();
  19204. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19205. juce_UseDebuggingNewOperator
  19206. private:
  19207. Image* image;
  19208. bool canDeleteImage;
  19209. float opacity;
  19210. Colour overlayColour;
  19211. DrawableImage (const DrawableImage&);
  19212. DrawableImage& operator= (const DrawableImage&);
  19213. };
  19214. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19215. /*** End of inlined file: juce_DrawableImage.h ***/
  19216. #endif
  19217. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19218. /*** Start of inlined file: juce_DrawablePath.h ***/
  19219. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19220. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19221. class JUCE_API DrawablePath : public Drawable
  19222. {
  19223. public:
  19224. DrawablePath();
  19225. virtual ~DrawablePath();
  19226. void setPath (const Path& newPath) throw();
  19227. const Path& getPath() const throw() { return path; }
  19228. void setFill (const FillType& newFill) throw();
  19229. const FillType& getFill() const throw() { return mainFill; }
  19230. void setStrokeFill (const FillType& newStrokeFill) throw();
  19231. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19232. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19233. void setStrokeThickness (float newThickness) throw();
  19234. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19235. void render (const Drawable::RenderingContext& context) const;
  19236. const Rectangle<float> getBounds() const;
  19237. bool hitTest (float x, float y) const;
  19238. Drawable* createCopy() const;
  19239. ValueTree createValueTree() const throw();
  19240. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19241. juce_UseDebuggingNewOperator
  19242. private:
  19243. Path path, stroke;
  19244. FillType mainFill, strokeFill;
  19245. PathStrokeType strokeType;
  19246. void updateOutline();
  19247. DrawablePath (const DrawablePath&);
  19248. DrawablePath& operator= (const DrawablePath&);
  19249. };
  19250. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19251. /*** End of inlined file: juce_DrawablePath.h ***/
  19252. #endif
  19253. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19254. /*** Start of inlined file: juce_DrawableText.h ***/
  19255. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19256. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19257. class JUCE_API DrawableText : public Drawable
  19258. {
  19259. public:
  19260. DrawableText();
  19261. virtual ~DrawableText();
  19262. void setText (const GlyphArrangement& newText);
  19263. void setText (const String& newText, const Font& fontToUse);
  19264. const GlyphArrangement& getText() const throw() { return text; }
  19265. void setColour (const Colour& newColour);
  19266. const Colour& getColour() const throw() { return colour; }
  19267. void render (const Drawable::RenderingContext& context) const;
  19268. const Rectangle<float> getBounds() const;
  19269. bool hitTest (float x, float y) const;
  19270. Drawable* createCopy() const;
  19271. ValueTree createValueTree() const throw();
  19272. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19273. juce_UseDebuggingNewOperator
  19274. private:
  19275. GlyphArrangement text;
  19276. Colour colour;
  19277. DrawableText (const DrawableText&);
  19278. DrawableText& operator= (const DrawableText&);
  19279. };
  19280. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19281. /*** End of inlined file: juce_DrawableText.h ***/
  19282. #endif
  19283. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19284. #endif
  19285. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19286. /*** Start of inlined file: juce_GlowEffect.h ***/
  19287. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19288. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19289. class JUCE_API GlowEffect : public ImageEffectFilter
  19290. {
  19291. public:
  19292. GlowEffect();
  19293. ~GlowEffect();
  19294. void setGlowProperties (const float newRadius,
  19295. const Colour& newColour);
  19296. void applyEffect (Image& sourceImage, Graphics& destContext);
  19297. juce_UseDebuggingNewOperator
  19298. private:
  19299. float radius;
  19300. Colour colour;
  19301. };
  19302. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19303. /*** End of inlined file: juce_GlowEffect.h ***/
  19304. #endif
  19305. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19306. #endif
  19307. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19308. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19309. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19310. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19311. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19312. {
  19313. public:
  19314. ReduceOpacityEffect (const float opacity = 1.0f);
  19315. ~ReduceOpacityEffect();
  19316. void setOpacity (const float newOpacity);
  19317. void applyEffect (Image& sourceImage, Graphics& destContext);
  19318. juce_UseDebuggingNewOperator
  19319. private:
  19320. float opacity;
  19321. };
  19322. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19323. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19324. #endif
  19325. #ifndef __JUCE_FONT_JUCEHEADER__
  19326. #endif
  19327. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19328. #endif
  19329. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19330. #endif
  19331. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19332. #endif
  19333. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19334. #endif
  19335. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19336. #endif
  19337. #ifndef __JUCE_LINE_JUCEHEADER__
  19338. #endif
  19339. #ifndef __JUCE_PATH_JUCEHEADER__
  19340. #endif
  19341. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19342. /*** Start of inlined file: juce_PathIterator.h ***/
  19343. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19344. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19345. class JUCE_API PathFlatteningIterator
  19346. {
  19347. public:
  19348. PathFlatteningIterator (const Path& path,
  19349. const AffineTransform& transform = AffineTransform::identity,
  19350. float tolerence = 6.0f);
  19351. ~PathFlatteningIterator();
  19352. bool next();
  19353. float x1;
  19354. float y1;
  19355. float x2;
  19356. float y2;
  19357. bool closesSubPath;
  19358. int subPathIndex;
  19359. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19360. && (index >= path.numElements
  19361. || points [index] == Path::moveMarker); }
  19362. juce_UseDebuggingNewOperator
  19363. private:
  19364. const Path& path;
  19365. const AffineTransform transform;
  19366. float* points;
  19367. float tolerence, subPathCloseX, subPathCloseY;
  19368. const bool isIdentityTransform;
  19369. HeapBlock <float> stackBase;
  19370. float* stackPos;
  19371. size_t index, stackSize;
  19372. PathFlatteningIterator (const PathFlatteningIterator&);
  19373. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19374. };
  19375. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19376. /*** End of inlined file: juce_PathIterator.h ***/
  19377. #endif
  19378. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19379. #endif
  19380. #ifndef __JUCE_POINT_JUCEHEADER__
  19381. #endif
  19382. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19383. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19384. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19385. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19386. class JUCE_API PositionedRectangle
  19387. {
  19388. public:
  19389. PositionedRectangle() throw();
  19390. PositionedRectangle (const String& stringVersion) throw();
  19391. PositionedRectangle (const PositionedRectangle& other) throw();
  19392. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19393. ~PositionedRectangle() throw();
  19394. const String toString() const throw();
  19395. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19396. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19397. double& x,
  19398. double& y,
  19399. double& width,
  19400. double& height) const throw();
  19401. void applyToComponent (Component& comp) const throw();
  19402. void updateFrom (const Rectangle<int>& newPosition,
  19403. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19404. void updateFromDouble (double x, double y, double width, double height,
  19405. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19406. void updateFromComponent (const Component& comp) throw();
  19407. enum AnchorPoint
  19408. {
  19409. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19410. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19411. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19412. };
  19413. enum PositionMode
  19414. {
  19415. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19416. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19417. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19418. 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. */
  19419. };
  19420. enum SizeMode
  19421. {
  19422. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19423. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19424. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19425. };
  19426. void setModes (const AnchorPoint xAnchorMode,
  19427. const PositionMode xPositionMode,
  19428. const AnchorPoint yAnchorMode,
  19429. const PositionMode yPositionMode,
  19430. const SizeMode widthMode,
  19431. const SizeMode heightMode,
  19432. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19433. AnchorPoint getAnchorPointX() const throw();
  19434. PositionMode getPositionModeX() const throw();
  19435. double getX() const throw() { return x; }
  19436. void setX (const double newX) throw() { x = newX; }
  19437. AnchorPoint getAnchorPointY() const throw();
  19438. PositionMode getPositionModeY() const throw();
  19439. double getY() const throw() { return y; }
  19440. void setY (const double newY) throw() { y = newY; }
  19441. SizeMode getWidthMode() const throw();
  19442. double getWidth() const throw() { return w; }
  19443. void setWidth (const double newWidth) throw() { w = newWidth; }
  19444. SizeMode getHeightMode() const throw();
  19445. double getHeight() const throw() { return h; }
  19446. void setHeight (const double newHeight) throw() { h = newHeight; }
  19447. bool isPositionAbsolute() const throw();
  19448. bool operator== (const PositionedRectangle& other) const throw();
  19449. bool operator!= (const PositionedRectangle& other) const throw();
  19450. juce_UseDebuggingNewOperator
  19451. private:
  19452. double x, y, w, h;
  19453. uint8 xMode, yMode, wMode, hMode;
  19454. void addPosDescription (String& result, uint8 mode, double value) const throw();
  19455. void addSizeDescription (String& result, uint8 mode, double value) const throw();
  19456. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19457. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19458. void applyPosAndSize (double& xOut, double& wOut, double x, double w,
  19459. uint8 xMode, uint8 wMode,
  19460. int parentPos, int parentSize) const throw();
  19461. void updatePosAndSize (double& xOut, double& wOut, double x, double w,
  19462. uint8 xMode, uint8 wMode,
  19463. int parentPos, int parentSize) const throw();
  19464. };
  19465. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19466. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19467. #endif
  19468. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19469. #endif
  19470. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19471. #endif
  19472. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19473. /*** Start of inlined file: juce_CameraDevice.h ***/
  19474. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19475. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19476. #if JUCE_USE_CAMERA
  19477. class CameraImageListener
  19478. {
  19479. public:
  19480. CameraImageListener() {}
  19481. virtual ~CameraImageListener() {}
  19482. virtual void imageReceived (Image& image) = 0;
  19483. };
  19484. class JUCE_API CameraDevice
  19485. {
  19486. public:
  19487. virtual ~CameraDevice();
  19488. static const StringArray getAvailableDevices();
  19489. static CameraDevice* openDevice (int deviceIndex,
  19490. int minWidth = 128, int minHeight = 64,
  19491. int maxWidth = 1024, int maxHeight = 768);
  19492. const String getName() const { return name; }
  19493. Component* createViewerComponent();
  19494. void startRecordingToFile (const File& file, int quality = 2);
  19495. void stopRecording();
  19496. static const String getFileExtension();
  19497. const Time getTimeOfFirstRecordedFrame() const;
  19498. void addListener (CameraImageListener* listenerToAdd);
  19499. void removeListener (CameraImageListener* listenerToRemove);
  19500. juce_UseDebuggingNewOperator
  19501. protected:
  19502. CameraDevice (const String& name, int index);
  19503. private:
  19504. void* internal;
  19505. bool isRecording;
  19506. String name;
  19507. CameraDevice (const CameraDevice&);
  19508. CameraDevice& operator= (const CameraDevice&);
  19509. };
  19510. #endif
  19511. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19512. /*** End of inlined file: juce_CameraDevice.h ***/
  19513. #endif
  19514. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19515. #endif
  19516. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19517. /*** Start of inlined file: juce_ImageCache.h ***/
  19518. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19519. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19520. class JUCE_API ImageCache : private DeletedAtShutdown,
  19521. private Timer
  19522. {
  19523. public:
  19524. static Image* getFromFile (const File& file);
  19525. static Image* getFromMemory (const void* imageData, int dataSize);
  19526. static void release (Image* imageToRelease);
  19527. static void releaseOrDelete (Image* imageToRelease);
  19528. static bool isImageInCache (Image* imageToLookFor);
  19529. static void incReferenceCount (Image* image);
  19530. static Image* getFromHashCode (int64 hashCode);
  19531. static void addImageToCache (Image* image, int64 hashCode);
  19532. static void setCacheTimeout (int millisecs);
  19533. juce_UseDebuggingNewOperator
  19534. private:
  19535. CriticalSection lock;
  19536. struct Item;
  19537. friend class ScopedPointer<Item>;
  19538. friend class OwnedArray<Item>;
  19539. OwnedArray<Item> images;
  19540. static ImageCache* instance;
  19541. static int cacheTimeout;
  19542. ImageCache();
  19543. ImageCache (const ImageCache&);
  19544. ImageCache& operator= (const ImageCache&);
  19545. ~ImageCache();
  19546. void timerCallback();
  19547. };
  19548. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19549. /*** End of inlined file: juce_ImageCache.h ***/
  19550. #endif
  19551. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19552. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19553. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19554. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19555. class JUCE_API ImageConvolutionKernel
  19556. {
  19557. public:
  19558. ImageConvolutionKernel (int size);
  19559. ~ImageConvolutionKernel();
  19560. void clear();
  19561. float getKernelValue (int x, int y) const throw();
  19562. void setKernelValue (int x, int y, float value) throw();
  19563. void setOverallSum (float desiredTotalSum);
  19564. void rescaleAllValues (float multiplier);
  19565. void createGaussianBlur (float blurRadius);
  19566. int getKernelSize() const { return size; }
  19567. void applyToImage (Image& destImage,
  19568. const Image* sourceImage,
  19569. const Rectangle<int>& destinationArea) const;
  19570. juce_UseDebuggingNewOperator
  19571. private:
  19572. HeapBlock <float> values;
  19573. const int size;
  19574. // no reason not to implement these one day..
  19575. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19576. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19577. };
  19578. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19579. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19580. #endif
  19581. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19582. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19583. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19584. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19585. class JUCE_API ImageFileFormat
  19586. {
  19587. protected:
  19588. ImageFileFormat() {}
  19589. public:
  19590. virtual ~ImageFileFormat() {}
  19591. virtual const String getFormatName() = 0;
  19592. virtual bool canUnderstand (InputStream& input) = 0;
  19593. virtual Image* decodeImage (InputStream& input) = 0;
  19594. virtual bool writeImageToStream (const Image& sourceImage,
  19595. OutputStream& destStream) = 0;
  19596. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19597. static Image* loadFrom (InputStream& input);
  19598. static Image* loadFrom (const File& file);
  19599. static Image* loadFrom (const void* rawData,
  19600. const int numBytesOfData);
  19601. };
  19602. class JUCE_API PNGImageFormat : public ImageFileFormat
  19603. {
  19604. public:
  19605. PNGImageFormat();
  19606. ~PNGImageFormat();
  19607. const String getFormatName();
  19608. bool canUnderstand (InputStream& input);
  19609. Image* decodeImage (InputStream& input);
  19610. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19611. };
  19612. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19613. {
  19614. public:
  19615. JPEGImageFormat();
  19616. ~JPEGImageFormat();
  19617. void setQuality (const float newQuality);
  19618. const String getFormatName();
  19619. bool canUnderstand (InputStream& input);
  19620. Image* decodeImage (InputStream& input);
  19621. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19622. private:
  19623. float quality;
  19624. };
  19625. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19626. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19627. #endif
  19628. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19629. #endif
  19630. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19631. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19632. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19633. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19634. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19635. {
  19636. public:
  19637. FileBasedDocument (const String& fileExtension,
  19638. const String& fileWildCard,
  19639. const String& openFileDialogTitle,
  19640. const String& saveFileDialogTitle);
  19641. virtual ~FileBasedDocument();
  19642. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19643. virtual void changed();
  19644. void setChangedFlag (bool hasChanged);
  19645. bool loadFrom (const File& fileToLoadFrom,
  19646. bool showMessageOnFailure);
  19647. bool loadFromUserSpecifiedFile (bool showMessageOnFailure);
  19648. enum SaveResult
  19649. {
  19650. savedOk = 0, /**< indicates that a file was saved successfully. */
  19651. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19652. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19653. };
  19654. SaveResult save (bool askUserForFileIfNotSpecified,
  19655. bool showMessageOnFailure);
  19656. SaveResult saveIfNeededAndUserAgrees();
  19657. SaveResult saveAs (const File& newFile,
  19658. bool warnAboutOverwritingExistingFiles,
  19659. bool askUserForFileIfNotSpecified,
  19660. bool showMessageOnFailure);
  19661. SaveResult saveAsInteractive (bool warnAboutOverwritingExistingFiles);
  19662. const File getFile() const { return documentFile; }
  19663. void setFile (const File& newFile);
  19664. protected:
  19665. virtual const String getDocumentTitle() = 0;
  19666. virtual const String loadDocument (const File& file) = 0;
  19667. virtual const String saveDocument (const File& file) = 0;
  19668. virtual const File getLastDocumentOpened() = 0;
  19669. virtual void setLastDocumentOpened (const File& file) = 0;
  19670. public:
  19671. juce_UseDebuggingNewOperator
  19672. private:
  19673. File documentFile;
  19674. bool changedSinceSave;
  19675. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19676. FileBasedDocument (const FileBasedDocument&);
  19677. FileBasedDocument& operator= (const FileBasedDocument&);
  19678. };
  19679. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19680. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19681. #endif
  19682. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19683. #endif
  19684. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19685. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19686. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19687. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19688. class JUCE_API RecentlyOpenedFilesList
  19689. {
  19690. public:
  19691. RecentlyOpenedFilesList();
  19692. ~RecentlyOpenedFilesList();
  19693. void setMaxNumberOfItems (int newMaxNumber);
  19694. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19695. int getNumFiles() const;
  19696. const File getFile (int index) const;
  19697. const StringArray& getAllFilenames() const throw() { return files; }
  19698. void clear();
  19699. void addFile (const File& file);
  19700. void removeNonExistentFiles();
  19701. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19702. int baseItemId,
  19703. bool showFullPaths,
  19704. bool dontAddNonExistentFiles,
  19705. const File** filesToAvoid = 0);
  19706. const String toString() const;
  19707. void restoreFromString (const String& stringifiedVersion);
  19708. juce_UseDebuggingNewOperator
  19709. private:
  19710. StringArray files;
  19711. int maxNumberOfItems;
  19712. };
  19713. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19714. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19715. #endif
  19716. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19717. #endif
  19718. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19719. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19720. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19721. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19722. class JUCE_API SystemClipboard
  19723. {
  19724. public:
  19725. static void copyTextToClipboard (const String& text);
  19726. static const String getTextFromClipboard();
  19727. };
  19728. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19729. /*** End of inlined file: juce_SystemClipboard.h ***/
  19730. #endif
  19731. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19732. #endif
  19733. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19734. #endif
  19735. #endif
  19736. /*** End of inlined file: juce_app_includes.h ***/
  19737. #endif
  19738. #if JUCE_MSVC
  19739. #pragma warning (pop)
  19740. #pragma pack (pop)
  19741. #endif
  19742. END_JUCE_NAMESPACE
  19743. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19744. #ifdef JUCE_NAMESPACE
  19745. // this will obviously save a lot of typing, but can be disabled by
  19746. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19747. using namespace JUCE_NAMESPACE;
  19748. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19749. #define Component JUCE_NAMESPACE::Component
  19750. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19751. #define Point JUCE_NAMESPACE::Point
  19752. #define Button JUCE_NAMESPACE::Button
  19753. #endif
  19754. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19755. #define Rectangle JUCE_NAMESPACE::Rectangle
  19756. #endif
  19757. #endif
  19758. #endif
  19759. #if JUCE_MSVC
  19760. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19761. #ifdef JUCE_DLL
  19762. #ifdef JUCE_DEBUG
  19763. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19764. #else
  19765. #define AUTOLINKEDLIB "JUCE.lib"
  19766. #endif
  19767. #else
  19768. #ifdef JUCE_DEBUG
  19769. #ifdef _WIN64
  19770. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19771. #else
  19772. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19773. #endif
  19774. #else
  19775. #ifdef _WIN64
  19776. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19777. #else
  19778. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19779. #endif
  19780. #endif
  19781. #endif
  19782. #pragma comment(lib, AUTOLINKEDLIB)
  19783. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19784. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19785. #endif
  19786. // Auto-link the other win32 libs that are needed by library calls..
  19787. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19788. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19789. // Auto-links to various win32 libs that are needed by library calls..
  19790. #pragma comment(lib, "kernel32.lib")
  19791. #pragma comment(lib, "user32.lib")
  19792. #pragma comment(lib, "shell32.lib")
  19793. #pragma comment(lib, "gdi32.lib")
  19794. #pragma comment(lib, "vfw32.lib")
  19795. #pragma comment(lib, "comdlg32.lib")
  19796. #pragma comment(lib, "winmm.lib")
  19797. #pragma comment(lib, "wininet.lib")
  19798. #pragma comment(lib, "ole32.lib")
  19799. #pragma comment(lib, "oleaut32.lib")
  19800. #pragma comment(lib, "advapi32.lib")
  19801. #pragma comment(lib, "ws2_32.lib")
  19802. #pragma comment(lib, "comsupp.lib")
  19803. #pragma comment(lib, "version.lib")
  19804. #if JUCE_OPENGL
  19805. #pragma comment(lib, "OpenGL32.Lib")
  19806. #pragma comment(lib, "GlU32.Lib")
  19807. #endif
  19808. #if JUCE_QUICKTIME
  19809. #pragma comment (lib, "QTMLClient.lib")
  19810. #endif
  19811. #if JUCE_USE_CAMERA
  19812. #pragma comment (lib, "Strmiids.lib")
  19813. #pragma comment (lib, "wmvcore.lib")
  19814. #endif
  19815. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19816. #endif
  19817. #endif
  19818. #endif
  19819. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19820. #define START_JUCE_APPLICATION(AppClass) \
  19821. int main (int argc, char* argv[]) \
  19822. { \
  19823. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19824. }
  19825. #elif JUCE_WINDOWS
  19826. #ifdef _CONSOLE
  19827. #define START_JUCE_APPLICATION(AppClass) \
  19828. int main (int, char* argv[]) \
  19829. { \
  19830. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19831. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19832. }
  19833. #elif ! defined (_AFXDLL)
  19834. #ifdef _WINDOWS_
  19835. #define START_JUCE_APPLICATION(AppClass) \
  19836. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19837. { \
  19838. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19839. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19840. }
  19841. #else
  19842. #define START_JUCE_APPLICATION(AppClass) \
  19843. int __stdcall WinMain (int, int, const char*, int) \
  19844. { \
  19845. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19846. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19847. }
  19848. #endif
  19849. #endif
  19850. #endif
  19851. #endif // __JUCE_JUCEHEADER__
  19852. /*** End of inlined file: juce.h ***/
  19853. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__