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.

28820 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 && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) // Older Mac builds using gcc4.1 or earlier...
  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. {
  2293. for (;;) // Annoying workaround for OSX only having a bool CAS operation..
  2294. {
  2295. if (OSAtomicCompareAndSwap32Barrier (oldValue, newValue, static_cast <int32_t*> (&destination)))
  2296. return oldValue;
  2297. const uint32 result = destination;
  2298. if (result != oldValue)
  2299. return result;
  2300. }
  2301. }
  2302. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2303. {
  2304. void* currentVal = *value1;
  2305. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2306. while (! OSAtomicCompareAndSwap32 (reinterpret_cast <int32_t> (currentVal), reinterpret_cast <int32_t> (value2),
  2307. const_cast <int32_t*> (reinterpret_cast <volatile int32_t*> (value1)))) { currentVal = *value1; }
  2308. #else
  2309. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2310. #endif
  2311. return currentVal;
  2312. }
  2313. #elif JUCE_LINUX && __INTEL_COMPILER // Linux with Intel compiler...
  2314. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (&variable); }
  2315. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (&variable); }
  2316. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (&variable); }
  2317. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (&variable); }
  2318. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2319. { return _InterlockedCompareExchange (&destination, newValue, oldValue); }
  2320. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2321. {
  2322. #if __ia64__
  2323. return reinterpret_cast<void*> (_InterlockedExchange64 (const_cast<void**> (value1), reinterpret_cast<__int64> (value2)));
  2324. #else
  2325. return reinterpret_cast<void*> (_InterlockedExchange (const_cast<void**> (value1), reinterpret_cast<long> (value2)));
  2326. #endif
  2327. }
  2328. #elif JUCE_GCC // On GCC, use intrinsics...
  2329. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2330. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2331. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2332. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2333. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2334. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2335. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2336. {
  2337. void* currentVal = *value1;
  2338. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2339. return currentVal;
  2340. }
  2341. #elif JUCE_USE_INTRINSICS // Windows...
  2342. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is declared in juce_win32_Threads.cpp)
  2343. #pragma intrinsic (_InterlockedIncrement)
  2344. #pragma intrinsic (_InterlockedDecrement)
  2345. #pragma intrinsic (_InterlockedCompareExchange)
  2346. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2347. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2348. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2349. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2350. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2351. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2352. #endif
  2353. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2354. /*** End of inlined file: juce_Atomic.h ***/
  2355. class JUCE_API ReferenceCountedObject
  2356. {
  2357. public:
  2358. inline void incReferenceCount() throw()
  2359. {
  2360. Atomic::increment (refCounts);
  2361. jassert (refCounts > 0);
  2362. }
  2363. inline void decReferenceCount() throw()
  2364. {
  2365. jassert (refCounts > 0);
  2366. if (Atomic::decrementAndReturn (refCounts) == 0)
  2367. delete this;
  2368. }
  2369. inline int getReferenceCount() const throw()
  2370. {
  2371. return refCounts;
  2372. }
  2373. protected:
  2374. ReferenceCountedObject()
  2375. : refCounts (0)
  2376. {
  2377. }
  2378. virtual ~ReferenceCountedObject()
  2379. {
  2380. // it's dangerous to delete an object that's still referenced by something else!
  2381. jassert (refCounts == 0);
  2382. }
  2383. private:
  2384. int32 refCounts;
  2385. };
  2386. template <class ReferenceCountedObjectClass>
  2387. class ReferenceCountedObjectPtr
  2388. {
  2389. public:
  2390. inline ReferenceCountedObjectPtr() throw()
  2391. : referencedObject (0)
  2392. {
  2393. }
  2394. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2395. : referencedObject (refCountedObject)
  2396. {
  2397. if (refCountedObject != 0)
  2398. refCountedObject->incReferenceCount();
  2399. }
  2400. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2401. : referencedObject (other.referencedObject)
  2402. {
  2403. if (referencedObject != 0)
  2404. referencedObject->incReferenceCount();
  2405. }
  2406. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2407. {
  2408. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2409. if (newObject != referencedObject)
  2410. {
  2411. if (newObject != 0)
  2412. newObject->incReferenceCount();
  2413. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2414. referencedObject = newObject;
  2415. if (oldObject != 0)
  2416. oldObject->decReferenceCount();
  2417. }
  2418. return *this;
  2419. }
  2420. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2421. {
  2422. if (referencedObject != newObject)
  2423. {
  2424. if (newObject != 0)
  2425. newObject->incReferenceCount();
  2426. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2427. referencedObject = newObject;
  2428. if (oldObject != 0)
  2429. oldObject->decReferenceCount();
  2430. }
  2431. return *this;
  2432. }
  2433. inline ~ReferenceCountedObjectPtr()
  2434. {
  2435. if (referencedObject != 0)
  2436. referencedObject->decReferenceCount();
  2437. }
  2438. inline operator ReferenceCountedObjectClass*() const throw()
  2439. {
  2440. return referencedObject;
  2441. }
  2442. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2443. {
  2444. return referencedObject == object;
  2445. }
  2446. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2447. {
  2448. return referencedObject != object;
  2449. }
  2450. // the -> operator is called on the referenced object
  2451. inline ReferenceCountedObjectClass* operator->() const throw()
  2452. {
  2453. return referencedObject;
  2454. }
  2455. inline ReferenceCountedObjectClass* getObject() const throw()
  2456. {
  2457. return referencedObject;
  2458. }
  2459. private:
  2460. ReferenceCountedObjectClass* referencedObject;
  2461. };
  2462. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2463. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2464. class JUCE_API DynamicObject : public ReferenceCountedObject
  2465. {
  2466. public:
  2467. DynamicObject();
  2468. virtual ~DynamicObject();
  2469. virtual bool hasProperty (const var::identifier& propertyName) const;
  2470. virtual const var getProperty (const var::identifier& propertyName) const;
  2471. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2472. virtual void removeProperty (const var::identifier& propertyName);
  2473. virtual bool hasMethod (const var::identifier& methodName) const;
  2474. virtual const var invokeMethod (const var::identifier& methodName,
  2475. const var* parameters,
  2476. int numParameters);
  2477. void setMethod (const var::identifier& methodName,
  2478. var::MethodFunction methodFunction);
  2479. void clear();
  2480. juce_UseDebuggingNewOperator
  2481. private:
  2482. NamedValueSet properties;
  2483. };
  2484. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2485. /*** End of inlined file: juce_DynamicObject.h ***/
  2486. #endif
  2487. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2488. #endif
  2489. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2490. #endif
  2491. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2492. #endif
  2493. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2494. #endif
  2495. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2496. /*** Start of inlined file: juce_OwnedArray.h ***/
  2497. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2498. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2499. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2500. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2501. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2502. template <class ObjectType>
  2503. class JUCE_API ScopedPointer
  2504. {
  2505. public:
  2506. inline ScopedPointer() throw() : object (0)
  2507. {
  2508. }
  2509. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2510. : object (objectToTakePossessionOf)
  2511. {
  2512. }
  2513. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2514. : object (objectToTransferFrom.object)
  2515. {
  2516. objectToTransferFrom.object = 0;
  2517. }
  2518. inline ~ScopedPointer() { delete object; }
  2519. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2520. {
  2521. if (this != objectToTransferFrom.getAddress())
  2522. {
  2523. // Two ScopedPointers should never be able to refer to the same object - if
  2524. // this happens, you must have done something dodgy!
  2525. jassert (object == 0 || object != objectToTransferFrom.object);
  2526. ObjectType* const oldObject = object;
  2527. object = objectToTransferFrom.object;
  2528. objectToTransferFrom.object = 0;
  2529. delete oldObject;
  2530. }
  2531. return *this;
  2532. }
  2533. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2534. {
  2535. if (object != newObjectToTakePossessionOf)
  2536. {
  2537. ObjectType* const oldObject = object;
  2538. object = newObjectToTakePossessionOf;
  2539. delete oldObject;
  2540. }
  2541. return *this;
  2542. }
  2543. inline operator ObjectType*() const throw() { return object; }
  2544. inline ObjectType& operator*() const throw() { return *object; }
  2545. inline ObjectType* operator->() const throw() { return object; }
  2546. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2547. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2548. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2549. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2550. {
  2551. // Two ScopedPointers should never be able to refer to the same object - if
  2552. // this happens, you must have done something dodgy!
  2553. jassert (object != other.object);
  2554. swapVariables (object, other.object);
  2555. }
  2556. private:
  2557. ObjectType* object;
  2558. // (Required as an alternative to the overloaded & operator).
  2559. const ScopedPointer* getAddress() const throw() { return this; }
  2560. #if ! JUCE_MSVC // (MSVC can't deal with multiple copy constructors)
  2561. // This is private to stop people accidentally copying a const ScopedPointer (the compiler
  2562. // will let you do so by implicitly casting the source to its raw object pointer).
  2563. ScopedPointer (const ScopedPointer&);
  2564. #endif
  2565. };
  2566. template <class ObjectType>
  2567. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2568. {
  2569. return static_cast <ObjectType*> (pointer1) == pointer2;
  2570. }
  2571. template <class ObjectType>
  2572. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2573. {
  2574. return static_cast <ObjectType*> (pointer1) != pointer2;
  2575. }
  2576. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2577. /*** End of inlined file: juce_ScopedPointer.h ***/
  2578. template <class ObjectClass,
  2579. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2580. class OwnedArray
  2581. {
  2582. public:
  2583. OwnedArray() throw()
  2584. : numUsed (0)
  2585. {
  2586. }
  2587. ~OwnedArray()
  2588. {
  2589. clear (true);
  2590. }
  2591. void clear (const bool deleteObjects = true)
  2592. {
  2593. const ScopedLockType lock (getLock());
  2594. if (deleteObjects)
  2595. {
  2596. while (numUsed > 0)
  2597. delete data.elements [--numUsed];
  2598. }
  2599. data.setAllocatedSize (0);
  2600. numUsed = 0;
  2601. }
  2602. inline int size() const throw()
  2603. {
  2604. return numUsed;
  2605. }
  2606. inline ObjectClass* operator[] (const int index) const throw()
  2607. {
  2608. const ScopedLockType lock (getLock());
  2609. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2610. : static_cast <ObjectClass*> (0);
  2611. }
  2612. inline ObjectClass* getUnchecked (const int index) const throw()
  2613. {
  2614. const ScopedLockType lock (getLock());
  2615. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2616. return data.elements [index];
  2617. }
  2618. inline ObjectClass* getFirst() const throw()
  2619. {
  2620. const ScopedLockType lock (getLock());
  2621. return numUsed > 0 ? data.elements [0]
  2622. : static_cast <ObjectClass*> (0);
  2623. }
  2624. inline ObjectClass* getLast() const throw()
  2625. {
  2626. const ScopedLockType lock (getLock());
  2627. return numUsed > 0 ? data.elements [numUsed - 1]
  2628. : static_cast <ObjectClass*> (0);
  2629. }
  2630. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2631. {
  2632. const ScopedLockType lock (getLock());
  2633. ObjectClass* const* e = data.elements.getData();
  2634. ObjectClass* const* const end = e + numUsed;
  2635. while (e != end)
  2636. {
  2637. if (objectToLookFor == *e)
  2638. return static_cast <int> (e - data.elements.getData());
  2639. ++e;
  2640. }
  2641. return -1;
  2642. }
  2643. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2644. {
  2645. const ScopedLockType lock (getLock());
  2646. ObjectClass* const* e = data.elements.getData();
  2647. ObjectClass* const* const end = e + numUsed;
  2648. while (e != end)
  2649. {
  2650. if (objectToLookFor == *e)
  2651. return true;
  2652. ++e;
  2653. }
  2654. return false;
  2655. }
  2656. void add (const ObjectClass* const newObject) throw()
  2657. {
  2658. const ScopedLockType lock (getLock());
  2659. data.ensureAllocatedSize (numUsed + 1);
  2660. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2661. }
  2662. void insert (int indexToInsertAt,
  2663. const ObjectClass* const newObject) throw()
  2664. {
  2665. if (indexToInsertAt >= 0)
  2666. {
  2667. const ScopedLockType lock (getLock());
  2668. if (indexToInsertAt > numUsed)
  2669. indexToInsertAt = numUsed;
  2670. data.ensureAllocatedSize (numUsed + 1);
  2671. ObjectClass** const e = data.elements + indexToInsertAt;
  2672. const int numToMove = numUsed - indexToInsertAt;
  2673. if (numToMove > 0)
  2674. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2675. *e = const_cast <ObjectClass*> (newObject);
  2676. ++numUsed;
  2677. }
  2678. else
  2679. {
  2680. add (newObject);
  2681. }
  2682. }
  2683. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2684. {
  2685. const ScopedLockType lock (getLock());
  2686. if (! contains (newObject))
  2687. add (newObject);
  2688. }
  2689. void set (const int indexToChange,
  2690. const ObjectClass* const newObject,
  2691. const bool deleteOldElement = true)
  2692. {
  2693. if (indexToChange >= 0)
  2694. {
  2695. ScopedPointer <ObjectClass> toDelete;
  2696. const ScopedLockType lock (getLock());
  2697. if (indexToChange < numUsed)
  2698. {
  2699. if (deleteOldElement)
  2700. {
  2701. toDelete = data.elements [indexToChange];
  2702. if (toDelete == newObject)
  2703. toDelete = 0;
  2704. }
  2705. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2706. }
  2707. else
  2708. {
  2709. data.ensureAllocatedSize (numUsed + 1);
  2710. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2711. }
  2712. }
  2713. }
  2714. template <class OtherArrayType>
  2715. void addArray (const OtherArrayType& arrayToAddFrom,
  2716. int startIndex = 0,
  2717. int numElementsToAdd = -1)
  2718. {
  2719. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  2720. const ScopedLockType lock2 (getLock());
  2721. if (startIndex < 0)
  2722. {
  2723. jassertfalse
  2724. startIndex = 0;
  2725. }
  2726. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  2727. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  2728. while (--numElementsToAdd >= 0)
  2729. add (arrayToAddFrom.getUnchecked (startIndex++));
  2730. }
  2731. template <class ElementComparator>
  2732. void addSorted (ElementComparator& comparator,
  2733. ObjectClass* const newObject) throw()
  2734. {
  2735. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2736. // avoids getting warning messages about the parameter being unused
  2737. const ScopedLockType lock (getLock());
  2738. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  2739. }
  2740. template <class ElementComparator>
  2741. int indexOfSorted (ElementComparator& comparator,
  2742. const ObjectClass* const objectToLookFor) const throw()
  2743. {
  2744. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2745. // avoids getting warning messages about the parameter being unused
  2746. const ScopedLockType lock (getLock());
  2747. int start = 0;
  2748. int end = numUsed;
  2749. for (;;)
  2750. {
  2751. if (start >= end)
  2752. {
  2753. return -1;
  2754. }
  2755. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2756. {
  2757. return start;
  2758. }
  2759. else
  2760. {
  2761. const int halfway = (start + end) >> 1;
  2762. if (halfway == start)
  2763. return -1;
  2764. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2765. start = halfway;
  2766. else
  2767. end = halfway;
  2768. }
  2769. }
  2770. }
  2771. void remove (const int indexToRemove,
  2772. const bool deleteObject = true)
  2773. {
  2774. ScopedPointer <ObjectClass> toDelete;
  2775. const ScopedLockType lock (getLock());
  2776. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2777. {
  2778. ObjectClass** const e = data.elements + indexToRemove;
  2779. if (deleteObject)
  2780. toDelete = *e;
  2781. --numUsed;
  2782. const int numToShift = numUsed - indexToRemove;
  2783. if (numToShift > 0)
  2784. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2785. if ((numUsed << 1) < data.numAllocated)
  2786. minimiseStorageOverheads();
  2787. }
  2788. }
  2789. void removeObject (const ObjectClass* const objectToRemove,
  2790. const bool deleteObject = true)
  2791. {
  2792. const ScopedLockType lock (getLock());
  2793. ObjectClass** e = data.elements.getData();
  2794. for (int i = numUsed; --i >= 0;)
  2795. {
  2796. if (objectToRemove == *e)
  2797. {
  2798. remove (static_cast <int> (e - data.elements.getData()), deleteObject);
  2799. break;
  2800. }
  2801. ++e;
  2802. }
  2803. }
  2804. void removeRange (int startIndex,
  2805. const int numberToRemove,
  2806. const bool deleteObjects = true)
  2807. {
  2808. const ScopedLockType lock (getLock());
  2809. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2810. startIndex = jlimit (0, numUsed, startIndex);
  2811. if (endIndex > startIndex)
  2812. {
  2813. if (deleteObjects)
  2814. {
  2815. for (int i = startIndex; i < endIndex; ++i)
  2816. {
  2817. delete data.elements [i];
  2818. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2819. }
  2820. }
  2821. const int rangeSize = endIndex - startIndex;
  2822. ObjectClass** e = data.elements + startIndex;
  2823. int numToShift = numUsed - endIndex;
  2824. numUsed -= rangeSize;
  2825. while (--numToShift >= 0)
  2826. {
  2827. *e = e [rangeSize];
  2828. ++e;
  2829. }
  2830. if ((numUsed << 1) < data.numAllocated)
  2831. minimiseStorageOverheads();
  2832. }
  2833. }
  2834. void removeLast (int howManyToRemove = 1,
  2835. const bool deleteObjects = true)
  2836. {
  2837. const ScopedLockType lock (getLock());
  2838. if (howManyToRemove >= numUsed)
  2839. {
  2840. clear (deleteObjects);
  2841. }
  2842. else
  2843. {
  2844. while (--howManyToRemove >= 0)
  2845. remove (numUsed - 1, deleteObjects);
  2846. }
  2847. }
  2848. void swap (const int index1,
  2849. const int index2) throw()
  2850. {
  2851. const ScopedLockType lock (getLock());
  2852. if (((unsigned int) index1) < (unsigned int) numUsed
  2853. && ((unsigned int) index2) < (unsigned int) numUsed)
  2854. {
  2855. swapVariables (data.elements [index1],
  2856. data.elements [index2]);
  2857. }
  2858. }
  2859. void move (const int currentIndex,
  2860. int newIndex) throw()
  2861. {
  2862. if (currentIndex != newIndex)
  2863. {
  2864. const ScopedLockType lock (getLock());
  2865. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2866. {
  2867. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2868. newIndex = numUsed - 1;
  2869. ObjectClass* const value = data.elements [currentIndex];
  2870. if (newIndex > currentIndex)
  2871. {
  2872. memmove (data.elements + currentIndex,
  2873. data.elements + currentIndex + 1,
  2874. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2875. }
  2876. else
  2877. {
  2878. memmove (data.elements + newIndex + 1,
  2879. data.elements + newIndex,
  2880. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2881. }
  2882. data.elements [newIndex] = value;
  2883. }
  2884. }
  2885. }
  2886. void swapWithArray (OwnedArray& otherArray) throw()
  2887. {
  2888. const ScopedLockType lock1 (getLock());
  2889. const ScopedLockType lock2 (otherArray.getLock());
  2890. data.swapWith (otherArray.data);
  2891. swapVariables (numUsed, otherArray.numUsed);
  2892. }
  2893. void minimiseStorageOverheads() throw()
  2894. {
  2895. const ScopedLockType lock (getLock());
  2896. data.shrinkToNoMoreThan (numUsed);
  2897. }
  2898. void ensureStorageAllocated (const int minNumElements) throw()
  2899. {
  2900. const ScopedLockType lock (getLock());
  2901. data.ensureAllocatedSize (minNumElements);
  2902. }
  2903. template <class ElementComparator>
  2904. void sort (ElementComparator& comparator,
  2905. const bool retainOrderOfEquivalentItems = false) const throw()
  2906. {
  2907. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2908. // avoids getting warning messages about the parameter being unused
  2909. const ScopedLockType lock (getLock());
  2910. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  2911. }
  2912. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2913. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2914. juce_UseDebuggingNewOperator
  2915. private:
  2916. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2917. int numUsed;
  2918. // disallow copy constructor and assignment
  2919. OwnedArray (const OwnedArray&);
  2920. OwnedArray& operator= (const OwnedArray&);
  2921. };
  2922. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2923. /*** End of inlined file: juce_OwnedArray.h ***/
  2924. #endif
  2925. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2926. /*** Start of inlined file: juce_PropertySet.h ***/
  2927. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2928. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2929. /*** Start of inlined file: juce_StringPairArray.h ***/
  2930. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2931. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2932. /*** Start of inlined file: juce_StringArray.h ***/
  2933. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2934. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2935. class JUCE_API StringArray
  2936. {
  2937. public:
  2938. StringArray() throw();
  2939. StringArray (const StringArray& other);
  2940. explicit StringArray (const String& firstValue);
  2941. StringArray (const juce_wchar** strings, int numberOfStrings);
  2942. StringArray (const char** strings, int numberOfStrings);
  2943. explicit StringArray (const juce_wchar** strings);
  2944. explicit StringArray (const char** strings);
  2945. ~StringArray();
  2946. StringArray& operator= (const StringArray& other);
  2947. bool operator== (const StringArray& other) const throw();
  2948. bool operator!= (const StringArray& other) const throw();
  2949. inline int size() const throw() { return strings.size(); };
  2950. const String& operator[] (int index) const throw();
  2951. bool contains (const String& stringToLookFor,
  2952. bool ignoreCase = false) const;
  2953. int indexOf (const String& stringToLookFor,
  2954. bool ignoreCase = false,
  2955. int startIndex = 0) const;
  2956. void add (const String& stringToAdd);
  2957. void insert (int index, const String& stringToAdd);
  2958. void addIfNotAlreadyThere (const String& stringToAdd, bool ignoreCase = false);
  2959. void set (int index, const String& newString);
  2960. void addArray (const StringArray& other,
  2961. int startIndex = 0,
  2962. int numElementsToAdd = -1);
  2963. int addTokens (const String& stringToTokenise,
  2964. bool preserveQuotedStrings);
  2965. int addTokens (const String& stringToTokenise,
  2966. const String& breakCharacters,
  2967. const String& quoteCharacters);
  2968. int addLines (const String& stringToBreakUp);
  2969. void clear();
  2970. void remove (int index);
  2971. void removeString (const String& stringToRemove,
  2972. bool ignoreCase = false);
  2973. void removeDuplicates (bool ignoreCase);
  2974. void removeEmptyStrings (bool removeWhitespaceStrings = true);
  2975. void move (int currentIndex, int newIndex) throw();
  2976. void trim();
  2977. void appendNumbersToDuplicates (bool ignoreCaseWhenComparing,
  2978. bool appendNumberToFirstInstance,
  2979. const juce_wchar* preNumberString = 0,
  2980. const juce_wchar* postNumberString = 0);
  2981. const String joinIntoString (const String& separatorString,
  2982. int startIndex = 0,
  2983. int numberOfElements = -1) const;
  2984. void sort (bool ignoreCase);
  2985. void minimiseStorageOverheads();
  2986. juce_UseDebuggingNewOperator
  2987. private:
  2988. Array <String> strings;
  2989. };
  2990. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2991. /*** End of inlined file: juce_StringArray.h ***/
  2992. class JUCE_API StringPairArray
  2993. {
  2994. public:
  2995. StringPairArray (bool ignoreCaseWhenComparingKeys = true);
  2996. StringPairArray (const StringPairArray& other);
  2997. ~StringPairArray();
  2998. StringPairArray& operator= (const StringPairArray& other);
  2999. bool operator== (const StringPairArray& other) const;
  3000. bool operator!= (const StringPairArray& other) const;
  3001. const String& operator[] (const String& key) const;
  3002. const String getValue (const String& key, const String& defaultReturnValue) const;
  3003. const StringArray& getAllKeys() const throw() { return keys; }
  3004. const StringArray& getAllValues() const throw() { return values; }
  3005. inline int size() const throw() { return keys.size(); };
  3006. void set (const String& key, const String& value);
  3007. void addArray (const StringPairArray& other);
  3008. void clear();
  3009. void remove (const String& key);
  3010. void remove (int index);
  3011. void setIgnoresCase (bool shouldIgnoreCase);
  3012. const String getDescription() const;
  3013. void minimiseStorageOverheads();
  3014. juce_UseDebuggingNewOperator
  3015. private:
  3016. StringArray keys, values;
  3017. bool ignoreCase;
  3018. };
  3019. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3020. /*** End of inlined file: juce_StringPairArray.h ***/
  3021. /*** Start of inlined file: juce_XmlElement.h ***/
  3022. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3023. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3024. /*** Start of inlined file: juce_File.h ***/
  3025. #ifndef __JUCE_FILE_JUCEHEADER__
  3026. #define __JUCE_FILE_JUCEHEADER__
  3027. /*** Start of inlined file: juce_Time.h ***/
  3028. #ifndef __JUCE_TIME_JUCEHEADER__
  3029. #define __JUCE_TIME_JUCEHEADER__
  3030. /*** Start of inlined file: juce_RelativeTime.h ***/
  3031. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3032. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3033. class JUCE_API RelativeTime
  3034. {
  3035. public:
  3036. explicit RelativeTime (double seconds = 0.0) throw();
  3037. RelativeTime (const RelativeTime& other) throw();
  3038. RelativeTime& operator= (const RelativeTime& other) throw();
  3039. ~RelativeTime() throw();
  3040. static const RelativeTime milliseconds (int milliseconds) throw();
  3041. static const RelativeTime milliseconds (int64 milliseconds) throw();
  3042. static const RelativeTime minutes (double numberOfMinutes) throw();
  3043. static const RelativeTime hours (double numberOfHours) throw();
  3044. static const RelativeTime days (double numberOfDays) throw();
  3045. static const RelativeTime weeks (double numberOfWeeks) throw();
  3046. int64 inMilliseconds() const throw();
  3047. double inSeconds() const throw() { return seconds; }
  3048. double inMinutes() const throw();
  3049. double inHours() const throw();
  3050. double inDays() const throw();
  3051. double inWeeks() const throw();
  3052. const String getDescription (const String& returnValueForZeroTime = "0") const throw();
  3053. bool operator== (const RelativeTime& other) const throw();
  3054. bool operator!= (const RelativeTime& other) const throw();
  3055. bool operator> (const RelativeTime& other) const throw();
  3056. bool operator< (const RelativeTime& other) const throw();
  3057. bool operator>= (const RelativeTime& other) const throw();
  3058. bool operator<= (const RelativeTime& other) const throw();
  3059. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3060. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3061. const RelativeTime operator+ (double secondsToAdd) const throw();
  3062. const RelativeTime operator- (double secondsToSubtract) const throw();
  3063. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3064. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3065. const RelativeTime& operator+= (double secondsToAdd) throw();
  3066. const RelativeTime& operator-= (double secondsToSubtract) throw();
  3067. juce_UseDebuggingNewOperator
  3068. private:
  3069. double seconds;
  3070. };
  3071. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3072. /*** End of inlined file: juce_RelativeTime.h ***/
  3073. class JUCE_API Time
  3074. {
  3075. public:
  3076. Time() throw();
  3077. Time (const Time& other) throw();
  3078. Time (int64 millisecondsSinceEpoch) throw();
  3079. Time (int year,
  3080. int month,
  3081. int day,
  3082. int hours,
  3083. int minutes,
  3084. int seconds = 0,
  3085. int milliseconds = 0,
  3086. bool useLocalTime = true) throw();
  3087. ~Time() throw();
  3088. Time& operator= (const Time& other) throw();
  3089. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3090. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3091. int getYear() const throw();
  3092. int getMonth() const throw();
  3093. const String getMonthName (bool threeLetterVersion) const throw();
  3094. int getDayOfMonth() const throw();
  3095. int getDayOfWeek() const throw();
  3096. const String getWeekdayName (bool threeLetterVersion) const throw();
  3097. int getHours() const throw();
  3098. bool isAfternoon() const throw();
  3099. int getHoursInAmPmFormat() const throw();
  3100. int getMinutes() const throw();
  3101. int getSeconds() const throw();
  3102. int getMilliseconds() const throw();
  3103. bool isDaylightSavingTime() const throw();
  3104. const String getTimeZone() const throw();
  3105. const String toString (bool includeDate,
  3106. bool includeTime,
  3107. bool includeSeconds = true,
  3108. bool use24HourClock = false) const throw();
  3109. const String formatted (const juce_wchar* format) const throw();
  3110. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3111. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3112. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3113. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3114. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3115. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3116. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3117. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3118. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3119. bool setSystemTimeToThisTime() const throw();
  3120. static const String getWeekdayName (int dayNumber,
  3121. bool threeLetterVersion) throw();
  3122. static const String getMonthName (int monthNumber,
  3123. bool threeLetterVersion) throw();
  3124. // Static methods for getting system timers directly..
  3125. static int64 currentTimeMillis() throw();
  3126. static uint32 getMillisecondCounter() throw();
  3127. static double getMillisecondCounterHiRes() throw();
  3128. static void waitForMillisecondCounter (uint32 targetTime) throw();
  3129. static uint32 getApproximateMillisecondCounter() throw();
  3130. // High-resolution timers..
  3131. static int64 getHighResolutionTicks() throw();
  3132. static int64 getHighResolutionTicksPerSecond() throw();
  3133. static double highResolutionTicksToSeconds (int64 ticks) throw();
  3134. static int64 secondsToHighResolutionTicks (double seconds) throw();
  3135. private:
  3136. int64 millisSinceEpoch;
  3137. };
  3138. #endif // __JUCE_TIME_JUCEHEADER__
  3139. /*** End of inlined file: juce_Time.h ***/
  3140. class FileInputStream;
  3141. class FileOutputStream;
  3142. class JUCE_API File
  3143. {
  3144. public:
  3145. File() {}
  3146. File (const String& path);
  3147. File (const File& other);
  3148. ~File() {}
  3149. File& operator= (const String& newFilePath);
  3150. File& operator= (const File& otherFile);
  3151. static const File nonexistent;
  3152. bool exists() const;
  3153. bool existsAsFile() const;
  3154. bool isDirectory() const;
  3155. int64 getSize() const;
  3156. static const String descriptionOfSizeInBytes (int64 bytes);
  3157. const String& getFullPathName() const throw() { return fullPath; }
  3158. const String getFileName() const;
  3159. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3160. const String getFileExtension() const;
  3161. bool hasFileExtension (const String& extensionToTest) const;
  3162. const File withFileExtension (const String& newExtension) const;
  3163. const String getFileNameWithoutExtension() const;
  3164. int hashCode() const;
  3165. int64 hashCode64() const;
  3166. const File getChildFile (String relativePath) const;
  3167. const File getSiblingFile (const String& siblingFileName) const;
  3168. const File getParentDirectory() const;
  3169. bool isAChildOf (const File& potentialParentDirectory) const;
  3170. const File getNonexistentChildFile (const String& prefix,
  3171. const String& suffix,
  3172. bool putNumbersInBrackets = true) const;
  3173. const File getNonexistentSibling (bool putNumbersInBrackets = true) const;
  3174. bool operator== (const File& otherFile) const;
  3175. bool operator!= (const File& otherFile) const;
  3176. bool hasWriteAccess() const;
  3177. bool setReadOnly (bool shouldBeReadOnly,
  3178. bool applyRecursively = false) const;
  3179. bool isHidden() const;
  3180. const File getLinkedTarget() const;
  3181. const Time getLastModificationTime() const;
  3182. const Time getLastAccessTime() const;
  3183. const Time getCreationTime() const;
  3184. bool setLastModificationTime (const Time& newTime) const;
  3185. bool setLastAccessTime (const Time& newTime) const;
  3186. bool setCreationTime (const Time& newTime) const;
  3187. const String getVersion() const;
  3188. bool create() const;
  3189. bool createDirectory() const;
  3190. bool deleteFile() const;
  3191. bool deleteRecursively() const;
  3192. bool moveToTrash() const;
  3193. bool moveFileTo (const File& targetLocation) const;
  3194. bool copyFileTo (const File& targetLocation) const;
  3195. bool copyDirectoryTo (const File& newDirectory) const;
  3196. enum TypesOfFileToFind
  3197. {
  3198. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3199. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3200. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3201. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3202. };
  3203. int findChildFiles (Array<File>& results,
  3204. int whatToLookFor,
  3205. bool searchRecursively,
  3206. const String& wildCardPattern = "*") const;
  3207. int getNumberOfChildFiles (int whatToLookFor,
  3208. const String& wildCardPattern = "*") const;
  3209. bool containsSubDirectories() const;
  3210. FileInputStream* createInputStream() const;
  3211. FileOutputStream* createOutputStream (int bufferSize = 0x8000) const;
  3212. bool loadFileAsData (MemoryBlock& result) const;
  3213. const String loadFileAsString() const;
  3214. bool appendData (const void* dataToAppend,
  3215. int numberOfBytes) const;
  3216. bool replaceWithData (const void* dataToWrite,
  3217. int numberOfBytes) const;
  3218. bool appendText (const String& textToAppend,
  3219. bool asUnicode = false,
  3220. bool writeUnicodeHeaderBytes = false) const;
  3221. bool replaceWithText (const String& textToWrite,
  3222. bool asUnicode = false,
  3223. bool writeUnicodeHeaderBytes = false) const;
  3224. static void findFileSystemRoots (Array<File>& results);
  3225. const String getVolumeLabel() const;
  3226. int getVolumeSerialNumber() const;
  3227. int64 getBytesFreeOnVolume() const;
  3228. int64 getVolumeTotalSize() const;
  3229. bool isOnCDRomDrive() const;
  3230. bool isOnHardDisk() const;
  3231. bool isOnRemovableDrive() const;
  3232. bool startAsProcess (const String& parameters = String::empty) const;
  3233. void revealToUser() const;
  3234. enum SpecialLocationType
  3235. {
  3236. userHomeDirectory,
  3237. userDocumentsDirectory,
  3238. userDesktopDirectory,
  3239. userApplicationDataDirectory,
  3240. commonApplicationDataDirectory,
  3241. tempDirectory,
  3242. currentExecutableFile,
  3243. currentApplicationFile,
  3244. invokedExecutableFile,
  3245. globalApplicationsDirectory,
  3246. userMusicDirectory,
  3247. userMoviesDirectory,
  3248. };
  3249. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3250. static const File createTempFile (const String& fileNameEnding);
  3251. static const File getCurrentWorkingDirectory();
  3252. bool setAsCurrentWorkingDirectory() const;
  3253. static const juce_wchar separator;
  3254. static const juce_wchar* separatorString;
  3255. static const String createLegalFileName (const String& fileNameToFix);
  3256. static const String createLegalPathName (const String& pathNameToFix);
  3257. static bool areFileNamesCaseSensitive();
  3258. static bool isAbsolutePath (const String& path);
  3259. static const File createFileWithoutCheckingPath (const String& path);
  3260. juce_UseDebuggingNewOperator
  3261. private:
  3262. String fullPath;
  3263. // internal way of contructing a file without checking the path
  3264. friend class DirectoryIterator;
  3265. File (const String&, int);
  3266. const String getPathUpToLastSlash() const;
  3267. };
  3268. #endif // __JUCE_FILE_JUCEHEADER__
  3269. /*** End of inlined file: juce_File.h ***/
  3270. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3271. \
  3272. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3273. childElementVariableName != 0; \
  3274. childElementVariableName = childElementVariableName->getNextElement())
  3275. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3276. \
  3277. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3278. childElementVariableName != 0; \
  3279. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3280. class JUCE_API XmlElement
  3281. {
  3282. public:
  3283. explicit XmlElement (const String& tagName) throw();
  3284. XmlElement (const XmlElement& other) throw();
  3285. XmlElement& operator= (const XmlElement& other) throw();
  3286. ~XmlElement() throw();
  3287. bool isEquivalentTo (const XmlElement* other,
  3288. bool ignoreOrderOfAttributes) const throw();
  3289. const String createDocument (const String& dtdToUse,
  3290. bool allOnOneLine = false,
  3291. bool includeXmlHeader = true,
  3292. const String& encodingType = "UTF-8",
  3293. int lineWrapLength = 60) const;
  3294. void writeToStream (OutputStream& output,
  3295. const String& dtdToUse,
  3296. bool allOnOneLine = false,
  3297. bool includeXmlHeader = true,
  3298. const String& encodingType = "UTF-8",
  3299. int lineWrapLength = 60) const;
  3300. bool writeToFile (const File& destinationFile,
  3301. const String& dtdToUse,
  3302. const String& encodingType = "UTF-8",
  3303. int lineWrapLength = 60) const;
  3304. inline const String& getTagName() const throw() { return tagName; }
  3305. bool hasTagName (const String& possibleTagName) const throw();
  3306. int getNumAttributes() const throw();
  3307. const String& getAttributeName (int attributeIndex) const throw();
  3308. const String& getAttributeValue (int attributeIndex) const throw();
  3309. // Attribute-handling methods..
  3310. bool hasAttribute (const String& attributeName) const throw();
  3311. const String& getStringAttribute (const String& attributeName) const throw();
  3312. const String getStringAttribute (const String& attributeName,
  3313. const String& defaultReturnValue) const;
  3314. bool compareAttribute (const String& attributeName,
  3315. const String& stringToCompareAgainst,
  3316. bool ignoreCase = false) const throw();
  3317. int getIntAttribute (const String& attributeName,
  3318. int defaultReturnValue = 0) const;
  3319. double getDoubleAttribute (const String& attributeName,
  3320. double defaultReturnValue = 0.0) const;
  3321. bool getBoolAttribute (const String& attributeName,
  3322. bool defaultReturnValue = false) const;
  3323. void setAttribute (const String& attributeName,
  3324. const String& newValue);
  3325. void setAttribute (const String& attributeName,
  3326. int newValue);
  3327. void setAttribute (const String& attributeName,
  3328. double newValue);
  3329. void removeAttribute (const String& attributeName) throw();
  3330. void removeAllAttributes() throw();
  3331. // Child element methods..
  3332. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3333. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3334. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3335. int getNumChildElements() const throw();
  3336. XmlElement* getChildElement (int index) const throw();
  3337. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3338. void addChildElement (XmlElement* const newChildElement) throw();
  3339. void insertChildElement (XmlElement* newChildNode,
  3340. int indexToInsertAt) throw();
  3341. XmlElement* createNewChildElement (const String& tagName);
  3342. bool replaceChildElement (XmlElement* currentChildElement,
  3343. XmlElement* newChildNode) throw();
  3344. void removeChildElement (XmlElement* childToRemove,
  3345. bool shouldDeleteTheChild) throw();
  3346. void deleteAllChildElements() throw();
  3347. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3348. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3349. XmlElement* findParentElementOf (const XmlElement* elementToLookFor) throw();
  3350. template <class ElementComparator>
  3351. void sortChildElements (ElementComparator& comparator,
  3352. const bool retainOrderOfEquivalentItems = false) throw()
  3353. {
  3354. const int num = getNumChildElements();
  3355. if (num > 1)
  3356. {
  3357. HeapBlock <XmlElement*> elems (num);
  3358. getChildElementsAsArray (elems);
  3359. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3360. reorderChildElements (elems, num);
  3361. }
  3362. }
  3363. bool isTextElement() const throw();
  3364. const String getText() const throw();
  3365. void setText (const String& newText) throw();
  3366. const String getAllSubText() const throw();
  3367. const String getChildElementAllSubText (const String& childTagName,
  3368. const String& defaultReturnValue) const throw();
  3369. void addTextElement (const String& text) throw();
  3370. void deleteAllTextElements() throw();
  3371. static XmlElement* createTextElement (const String& text) throw();
  3372. juce_UseDebuggingNewOperator
  3373. private:
  3374. friend class XmlDocument;
  3375. String tagName;
  3376. XmlElement* firstChildElement;
  3377. XmlElement* nextElement;
  3378. struct XmlAttributeNode
  3379. {
  3380. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3381. XmlAttributeNode (const String& name, const String& value) throw();
  3382. String name, value;
  3383. XmlAttributeNode* next;
  3384. private:
  3385. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3386. };
  3387. XmlAttributeNode* attributes;
  3388. XmlElement (int) throw();
  3389. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3390. void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
  3391. void getChildElementsAsArray (XmlElement**) const throw();
  3392. void reorderChildElements (XmlElement** const, const int) throw();
  3393. };
  3394. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3395. /*** End of inlined file: juce_XmlElement.h ***/
  3396. class JUCE_API PropertySet
  3397. {
  3398. public:
  3399. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3400. PropertySet (const PropertySet& other) throw();
  3401. PropertySet& operator= (const PropertySet& other) throw();
  3402. virtual ~PropertySet();
  3403. const String getValue (const String& keyName,
  3404. const String& defaultReturnValue = String::empty) const throw();
  3405. int getIntValue (const String& keyName,
  3406. const int defaultReturnValue = 0) const throw();
  3407. double getDoubleValue (const String& keyName,
  3408. const double defaultReturnValue = 0.0) const throw();
  3409. bool getBoolValue (const String& keyName,
  3410. const bool defaultReturnValue = false) const throw();
  3411. XmlElement* getXmlValue (const String& keyName) const;
  3412. void setValue (const String& keyName, const String& value) throw();
  3413. void setValue (const String& keyName, const int value) throw();
  3414. void setValue (const String& keyName, const double value) throw();
  3415. void setValue (const String& keyName, const bool value) throw();
  3416. void setValue (const String& keyName, const XmlElement* const xml);
  3417. void removeValue (const String& keyName) throw();
  3418. bool containsKey (const String& keyName) const throw();
  3419. void clear();
  3420. StringPairArray& getAllProperties() throw() { return properties; }
  3421. const CriticalSection& getLock() const throw() { return lock; }
  3422. XmlElement* createXml (const String& nodeName) const throw();
  3423. void restoreFromXml (const XmlElement& xml) throw();
  3424. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3425. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3426. juce_UseDebuggingNewOperator
  3427. protected:
  3428. virtual void propertyChanged();
  3429. private:
  3430. StringPairArray properties;
  3431. PropertySet* fallbackProperties;
  3432. CriticalSection lock;
  3433. bool ignoreCaseOfKeys;
  3434. };
  3435. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3436. /*** End of inlined file: juce_PropertySet.h ***/
  3437. #endif
  3438. #ifndef __JUCE_RANGE_JUCEHEADER__
  3439. /*** Start of inlined file: juce_Range.h ***/
  3440. #ifndef __JUCE_RANGE_JUCEHEADER__
  3441. #define __JUCE_RANGE_JUCEHEADER__
  3442. template <typename ValueType>
  3443. class Range
  3444. {
  3445. public:
  3446. Range() throw()
  3447. : start (ValueType()), end (ValueType())
  3448. {
  3449. }
  3450. Range (const ValueType start_, const ValueType end_) throw()
  3451. : start (start_), end (jmax (start_, end_))
  3452. {
  3453. }
  3454. Range (const Range& other) throw()
  3455. : start (other.start), end (other.end)
  3456. {
  3457. }
  3458. Range& operator= (const Range& other) throw()
  3459. {
  3460. start = other.start;
  3461. end = other.end;
  3462. return *this;
  3463. }
  3464. ~Range() throw()
  3465. {
  3466. }
  3467. static const Range between (const ValueType position1, const ValueType position2) throw()
  3468. {
  3469. return (position1 < position2) ? Range (position1, position2)
  3470. : Range (position2, position1);
  3471. }
  3472. static const Range emptyRange (const ValueType start) throw()
  3473. {
  3474. return Range (start, start);
  3475. }
  3476. inline ValueType getStart() const throw() { return start; }
  3477. inline ValueType getLength() const throw() { return end - start; }
  3478. inline ValueType getEnd() const throw() { return end; }
  3479. inline bool isEmpty() const throw() { return start == end; }
  3480. void setStart (const ValueType newStart) throw()
  3481. {
  3482. start = newStart;
  3483. if (newStart > end)
  3484. end = newStart;
  3485. }
  3486. const Range withStart (const ValueType newStart) const throw()
  3487. {
  3488. return Range (newStart, jmax (newStart, end));
  3489. }
  3490. const Range movedToStartAt (const ValueType newStart) const throw()
  3491. {
  3492. return Range (newStart, newStart + getLength());
  3493. }
  3494. void setEnd (const ValueType newEnd) throw()
  3495. {
  3496. end = newEnd;
  3497. if (newEnd < start)
  3498. start = newEnd;
  3499. }
  3500. const Range withEnd (const ValueType newEnd) const throw()
  3501. {
  3502. return Range (jmin (start, newEnd), newEnd);
  3503. }
  3504. const Range movedToEndAt (const ValueType newEnd) const throw()
  3505. {
  3506. return Range (newEnd - getLength(), newEnd);
  3507. }
  3508. void setLength (const ValueType newLength) throw()
  3509. {
  3510. end = start + jmax (ValueType(), newLength);
  3511. }
  3512. const Range withLength (const ValueType newLength) const throw()
  3513. {
  3514. return Range (start, start + newLength);
  3515. }
  3516. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3517. {
  3518. start += amountToAdd;
  3519. end += amountToAdd;
  3520. return *this;
  3521. }
  3522. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3523. {
  3524. start -= amountToSubtract;
  3525. end -= amountToSubtract;
  3526. return *this;
  3527. }
  3528. const Range operator+ (const ValueType amountToAdd) const throw()
  3529. {
  3530. return Range (start + amountToAdd, end + amountToAdd);
  3531. }
  3532. const Range operator- (const ValueType amountToSubtract) const throw()
  3533. {
  3534. return Range (start - amountToSubtract, end - amountToSubtract);
  3535. }
  3536. bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
  3537. bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }
  3538. bool contains (const ValueType position) const throw()
  3539. {
  3540. return position >= start && position < end;
  3541. }
  3542. ValueType clipValue (const ValueType value) const throw()
  3543. {
  3544. return jlimit (start, end, value);
  3545. }
  3546. bool intersects (const Range& other) const throw()
  3547. {
  3548. return other.start < end && other.end > start;
  3549. }
  3550. const Range getIntersectionWith (const Range& other) const throw()
  3551. {
  3552. return Range (jmax (start, other.start),
  3553. jmin (end, other.end));
  3554. }
  3555. const Range getUnionWith (const Range& other) const throw()
  3556. {
  3557. return Range (jmin (start, other.start),
  3558. jmax (end, other.end));
  3559. }
  3560. const Range constrainRange (const Range& rangeToConstrain) const throw()
  3561. {
  3562. const ValueType otherLen = rangeToConstrain.getLength();
  3563. return otherLen >= getLength()
  3564. ? *this
  3565. : rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
  3566. }
  3567. juce_UseDebuggingNewOperator
  3568. private:
  3569. ValueType start, end;
  3570. };
  3571. #endif // __JUCE_RANGE_JUCEHEADER__
  3572. /*** End of inlined file: juce_Range.h ***/
  3573. #endif
  3574. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3575. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3576. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3577. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3578. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3579. class ReferenceCountedArray
  3580. {
  3581. public:
  3582. ReferenceCountedArray() throw()
  3583. : numUsed (0)
  3584. {
  3585. }
  3586. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3587. {
  3588. const ScopedLockType lock (other.getLock());
  3589. numUsed = other.numUsed;
  3590. data.setAllocatedSize (numUsed);
  3591. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3592. for (int i = numUsed; --i >= 0;)
  3593. if (data.elements[i] != 0)
  3594. data.elements[i]->incReferenceCount();
  3595. }
  3596. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3597. {
  3598. if (this != &other)
  3599. {
  3600. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3601. swapWithArray (other);
  3602. }
  3603. return *this;
  3604. }
  3605. ~ReferenceCountedArray()
  3606. {
  3607. clear();
  3608. }
  3609. void clear()
  3610. {
  3611. const ScopedLockType lock (getLock());
  3612. while (numUsed > 0)
  3613. if (data.elements [--numUsed] != 0)
  3614. data.elements [numUsed]->decReferenceCount();
  3615. jassert (numUsed == 0);
  3616. data.setAllocatedSize (0);
  3617. }
  3618. inline int size() const throw()
  3619. {
  3620. return numUsed;
  3621. }
  3622. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3623. {
  3624. const ScopedLockType lock (getLock());
  3625. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3626. : static_cast <ObjectClass*> (0);
  3627. }
  3628. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3629. {
  3630. const ScopedLockType lock (getLock());
  3631. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3632. return data.elements [index];
  3633. }
  3634. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3635. {
  3636. const ScopedLockType lock (getLock());
  3637. return numUsed > 0 ? data.elements [0]
  3638. : static_cast <ObjectClass*> (0);
  3639. }
  3640. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3641. {
  3642. const ScopedLockType lock (getLock());
  3643. return numUsed > 0 ? data.elements [numUsed - 1]
  3644. : static_cast <ObjectClass*> (0);
  3645. }
  3646. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3647. {
  3648. const ScopedLockType lock (getLock());
  3649. ObjectClass** e = data.elements.getData();
  3650. ObjectClass** const end = e + numUsed;
  3651. while (e != end)
  3652. {
  3653. if (objectToLookFor == *e)
  3654. return static_cast <int> (e - data.elements.getData());
  3655. ++e;
  3656. }
  3657. return -1;
  3658. }
  3659. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3660. {
  3661. const ScopedLockType lock (getLock());
  3662. ObjectClass** e = data.elements.getData();
  3663. ObjectClass** const end = e + numUsed;
  3664. while (e != end)
  3665. {
  3666. if (objectToLookFor == *e)
  3667. return true;
  3668. ++e;
  3669. }
  3670. return false;
  3671. }
  3672. void add (ObjectClass* const newObject) throw()
  3673. {
  3674. const ScopedLockType lock (getLock());
  3675. data.ensureAllocatedSize (numUsed + 1);
  3676. data.elements [numUsed++] = newObject;
  3677. if (newObject != 0)
  3678. newObject->incReferenceCount();
  3679. }
  3680. void insert (int indexToInsertAt,
  3681. ObjectClass* const newObject) throw()
  3682. {
  3683. if (indexToInsertAt >= 0)
  3684. {
  3685. const ScopedLockType lock (getLock());
  3686. if (indexToInsertAt > numUsed)
  3687. indexToInsertAt = numUsed;
  3688. data.ensureAllocatedSize (numUsed + 1);
  3689. ObjectClass** const e = data.elements + indexToInsertAt;
  3690. const int numToMove = numUsed - indexToInsertAt;
  3691. if (numToMove > 0)
  3692. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3693. *e = newObject;
  3694. if (newObject != 0)
  3695. newObject->incReferenceCount();
  3696. ++numUsed;
  3697. }
  3698. else
  3699. {
  3700. add (newObject);
  3701. }
  3702. }
  3703. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3704. {
  3705. const ScopedLockType lock (getLock());
  3706. if (! contains (newObject))
  3707. add (newObject);
  3708. }
  3709. void set (const int indexToChange,
  3710. ObjectClass* const newObject)
  3711. {
  3712. if (indexToChange >= 0)
  3713. {
  3714. const ScopedLockType lock (getLock());
  3715. if (newObject != 0)
  3716. newObject->incReferenceCount();
  3717. if (indexToChange < numUsed)
  3718. {
  3719. if (data.elements [indexToChange] != 0)
  3720. data.elements [indexToChange]->decReferenceCount();
  3721. data.elements [indexToChange] = newObject;
  3722. }
  3723. else
  3724. {
  3725. data.ensureAllocatedSize (numUsed + 1);
  3726. data.elements [numUsed++] = newObject;
  3727. }
  3728. }
  3729. }
  3730. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3731. int startIndex = 0,
  3732. int numElementsToAdd = -1) throw()
  3733. {
  3734. arrayToAddFrom.lockArray();
  3735. const ScopedLockType lock (getLock());
  3736. if (startIndex < 0)
  3737. {
  3738. jassertfalse
  3739. startIndex = 0;
  3740. }
  3741. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3742. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3743. if (numElementsToAdd > 0)
  3744. {
  3745. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3746. while (--numElementsToAdd >= 0)
  3747. add (arrayToAddFrom.getUnchecked (startIndex++));
  3748. }
  3749. arrayToAddFrom.unlockArray();
  3750. }
  3751. template <class ElementComparator>
  3752. void addSorted (ElementComparator& comparator,
  3753. ObjectClass* newObject) throw()
  3754. {
  3755. const ScopedLockType lock (getLock());
  3756. insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
  3757. }
  3758. template <class ElementComparator>
  3759. void addOrReplaceSorted (ElementComparator& comparator,
  3760. ObjectClass* newObject) throw()
  3761. {
  3762. const ScopedLockType lock (getLock());
  3763. const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
  3764. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3765. set (index - 1, newObject); // replace an existing object that matches
  3766. else
  3767. insert (index, newObject); // no match, so insert the new one
  3768. }
  3769. void remove (const int indexToRemove)
  3770. {
  3771. const ScopedLockType lock (getLock());
  3772. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3773. {
  3774. ObjectClass** const e = data.elements + indexToRemove;
  3775. if (*e != 0)
  3776. (*e)->decReferenceCount();
  3777. --numUsed;
  3778. const int numberToShift = numUsed - indexToRemove;
  3779. if (numberToShift > 0)
  3780. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3781. if ((numUsed << 1) < data.numAllocated)
  3782. minimiseStorageOverheads();
  3783. }
  3784. }
  3785. void removeObject (ObjectClass* const objectToRemove)
  3786. {
  3787. const ScopedLockType lock (getLock());
  3788. remove (indexOf (objectToRemove));
  3789. }
  3790. void removeRange (const int startIndex,
  3791. const int numberToRemove)
  3792. {
  3793. const ScopedLockType lock (getLock());
  3794. const int start = jlimit (0, numUsed, startIndex);
  3795. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3796. if (end > start)
  3797. {
  3798. int i;
  3799. for (i = start; i < end; ++i)
  3800. {
  3801. if (data.elements[i] != 0)
  3802. {
  3803. data.elements[i]->decReferenceCount();
  3804. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3805. }
  3806. }
  3807. const int rangeSize = end - start;
  3808. ObjectClass** e = data.elements + start;
  3809. i = numUsed - end;
  3810. numUsed -= rangeSize;
  3811. while (--i >= 0)
  3812. {
  3813. *e = e [rangeSize];
  3814. ++e;
  3815. }
  3816. if ((numUsed << 1) < data.numAllocated)
  3817. minimiseStorageOverheads();
  3818. }
  3819. }
  3820. void removeLast (int howManyToRemove = 1)
  3821. {
  3822. const ScopedLockType lock (getLock());
  3823. if (howManyToRemove > numUsed)
  3824. howManyToRemove = numUsed;
  3825. while (--howManyToRemove >= 0)
  3826. remove (numUsed - 1);
  3827. }
  3828. void swap (const int index1,
  3829. const int index2) throw()
  3830. {
  3831. const ScopedLockType lock (getLock());
  3832. if (((unsigned int) index1) < (unsigned int) numUsed
  3833. && ((unsigned int) index2) < (unsigned int) numUsed)
  3834. {
  3835. swapVariables (data.elements [index1],
  3836. data.elements [index2]);
  3837. }
  3838. }
  3839. void move (const int currentIndex,
  3840. int newIndex) throw()
  3841. {
  3842. if (currentIndex != newIndex)
  3843. {
  3844. const ScopedLockType lock (getLock());
  3845. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3846. {
  3847. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3848. newIndex = numUsed - 1;
  3849. ObjectClass* const value = data.elements [currentIndex];
  3850. if (newIndex > currentIndex)
  3851. {
  3852. memmove (data.elements + currentIndex,
  3853. data.elements + currentIndex + 1,
  3854. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3855. }
  3856. else
  3857. {
  3858. memmove (data.elements + newIndex + 1,
  3859. data.elements + newIndex,
  3860. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3861. }
  3862. data.elements [newIndex] = value;
  3863. }
  3864. }
  3865. }
  3866. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3867. {
  3868. const ScopedLockType lock1 (getLock());
  3869. const ScopedLockType lock2 (otherArray.getLock());
  3870. data.swapWith (otherArray.data);
  3871. swapVariables (numUsed, otherArray.numUsed);
  3872. }
  3873. bool operator== (const ReferenceCountedArray& other) const throw()
  3874. {
  3875. const ScopedLockType lock2 (other.getLock());
  3876. const ScopedLockType lock1 (getLock());
  3877. if (numUsed != other.numUsed)
  3878. return false;
  3879. for (int i = numUsed; --i >= 0;)
  3880. if (data.elements [i] != other.data.elements [i])
  3881. return false;
  3882. return true;
  3883. }
  3884. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3885. {
  3886. return ! operator== (other);
  3887. }
  3888. template <class ElementComparator>
  3889. void sort (ElementComparator& comparator,
  3890. const bool retainOrderOfEquivalentItems = false) const throw()
  3891. {
  3892. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3893. // avoids getting warning messages about the parameter being unused
  3894. const ScopedLockType lock (getLock());
  3895. sortArray (comparator, data.elements.getData(), 0, size() - 1, retainOrderOfEquivalentItems);
  3896. }
  3897. void minimiseStorageOverheads() throw()
  3898. {
  3899. const ScopedLockType lock (getLock());
  3900. data.shrinkToNoMoreThan (numUsed);
  3901. }
  3902. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3903. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3904. juce_UseDebuggingNewOperator
  3905. private:
  3906. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3907. int numUsed;
  3908. };
  3909. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3910. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3911. #endif
  3912. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3913. #endif
  3914. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3915. #endif
  3916. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3917. /*** Start of inlined file: juce_SortedSet.h ***/
  3918. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3919. #define __JUCE_SORTEDSET_JUCEHEADER__
  3920. #if JUCE_MSVC
  3921. #pragma warning (push)
  3922. #pragma warning (disable: 4512)
  3923. #endif
  3924. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3925. class SortedSet
  3926. {
  3927. public:
  3928. SortedSet() throw()
  3929. : numUsed (0)
  3930. {
  3931. }
  3932. SortedSet (const SortedSet& other) throw()
  3933. {
  3934. const ScopedLockType lock (other.getLock());
  3935. numUsed = other.numUsed;
  3936. data.setAllocatedSize (other.numUsed);
  3937. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3938. }
  3939. ~SortedSet() throw()
  3940. {
  3941. }
  3942. SortedSet& operator= (const SortedSet& other) throw()
  3943. {
  3944. if (this != &other)
  3945. {
  3946. const ScopedLockType lock1 (other.getLock());
  3947. const ScopedLockType lock2 (getLock());
  3948. data.ensureAllocatedSize (other.size());
  3949. numUsed = other.numUsed;
  3950. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3951. minimiseStorageOverheads();
  3952. }
  3953. return *this;
  3954. }
  3955. bool operator== (const SortedSet<ElementType>& other) const throw()
  3956. {
  3957. const ScopedLockType lock (getLock());
  3958. if (numUsed != other.numUsed)
  3959. return false;
  3960. for (int i = numUsed; --i >= 0;)
  3961. if (data.elements[i] != other.data.elements[i])
  3962. return false;
  3963. return true;
  3964. }
  3965. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3966. {
  3967. return ! operator== (other);
  3968. }
  3969. void clear() throw()
  3970. {
  3971. const ScopedLockType lock (getLock());
  3972. data.setAllocatedSize (0);
  3973. numUsed = 0;
  3974. }
  3975. void clearQuick() throw()
  3976. {
  3977. const ScopedLockType lock (getLock());
  3978. numUsed = 0;
  3979. }
  3980. inline int size() const throw()
  3981. {
  3982. return numUsed;
  3983. }
  3984. inline ElementType operator[] (const int index) const throw()
  3985. {
  3986. const ScopedLockType lock (getLock());
  3987. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3988. : ElementType();
  3989. }
  3990. inline ElementType getUnchecked (const int index) const throw()
  3991. {
  3992. const ScopedLockType lock (getLock());
  3993. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3994. return data.elements [index];
  3995. }
  3996. inline ElementType getFirst() const throw()
  3997. {
  3998. const ScopedLockType lock (getLock());
  3999. return numUsed > 0 ? data.elements [0] : ElementType();
  4000. }
  4001. inline ElementType getLast() const throw()
  4002. {
  4003. const ScopedLockType lock (getLock());
  4004. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  4005. }
  4006. int indexOf (const ElementType elementToLookFor) const throw()
  4007. {
  4008. const ScopedLockType lock (getLock());
  4009. int start = 0;
  4010. int end = numUsed;
  4011. for (;;)
  4012. {
  4013. if (start >= end)
  4014. {
  4015. return -1;
  4016. }
  4017. else if (elementToLookFor == data.elements [start])
  4018. {
  4019. return start;
  4020. }
  4021. else
  4022. {
  4023. const int halfway = (start + end) >> 1;
  4024. if (halfway == start)
  4025. return -1;
  4026. else if (elementToLookFor >= data.elements [halfway])
  4027. start = halfway;
  4028. else
  4029. end = halfway;
  4030. }
  4031. }
  4032. }
  4033. bool contains (const ElementType elementToLookFor) const throw()
  4034. {
  4035. const ScopedLockType lock (getLock());
  4036. int start = 0;
  4037. int end = numUsed;
  4038. for (;;)
  4039. {
  4040. if (start >= end)
  4041. {
  4042. return false;
  4043. }
  4044. else if (elementToLookFor == data.elements [start])
  4045. {
  4046. return true;
  4047. }
  4048. else
  4049. {
  4050. const int halfway = (start + end) >> 1;
  4051. if (halfway == start)
  4052. return false;
  4053. else if (elementToLookFor >= data.elements [halfway])
  4054. start = halfway;
  4055. else
  4056. end = halfway;
  4057. }
  4058. }
  4059. }
  4060. void add (const ElementType newElement) throw()
  4061. {
  4062. const ScopedLockType lock (getLock());
  4063. int start = 0;
  4064. int end = numUsed;
  4065. for (;;)
  4066. {
  4067. if (start >= end)
  4068. {
  4069. jassert (start <= end);
  4070. insertInternal (start, newElement);
  4071. break;
  4072. }
  4073. else if (newElement == data.elements [start])
  4074. {
  4075. break;
  4076. }
  4077. else
  4078. {
  4079. const int halfway = (start + end) >> 1;
  4080. if (halfway == start)
  4081. {
  4082. if (newElement >= data.elements [halfway])
  4083. insertInternal (start + 1, newElement);
  4084. else
  4085. insertInternal (start, newElement);
  4086. break;
  4087. }
  4088. else if (newElement >= data.elements [halfway])
  4089. start = halfway;
  4090. else
  4091. end = halfway;
  4092. }
  4093. }
  4094. }
  4095. void addArray (const ElementType* elementsToAdd,
  4096. int numElementsToAdd) throw()
  4097. {
  4098. const ScopedLockType lock (getLock());
  4099. while (--numElementsToAdd >= 0)
  4100. add (*elementsToAdd++);
  4101. }
  4102. template <class OtherSetType>
  4103. void addSet (const OtherSetType& setToAddFrom,
  4104. int startIndex = 0,
  4105. int numElementsToAdd = -1) throw()
  4106. {
  4107. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  4108. const ScopedLockType lock2 (getLock());
  4109. jassert (this != &setToAddFrom);
  4110. if (this != &setToAddFrom)
  4111. {
  4112. if (startIndex < 0)
  4113. {
  4114. jassertfalse
  4115. startIndex = 0;
  4116. }
  4117. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4118. numElementsToAdd = setToAddFrom.size() - startIndex;
  4119. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4120. }
  4121. }
  4122. ElementType remove (const int indexToRemove) throw()
  4123. {
  4124. const ScopedLockType lock (getLock());
  4125. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4126. {
  4127. --numUsed;
  4128. ElementType* const e = data.elements + indexToRemove;
  4129. ElementType const removed = *e;
  4130. const int numberToShift = numUsed - indexToRemove;
  4131. if (numberToShift > 0)
  4132. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4133. if ((numUsed << 1) < data.numAllocated)
  4134. minimiseStorageOverheads();
  4135. return removed;
  4136. }
  4137. return 0;
  4138. }
  4139. void removeValue (const ElementType valueToRemove) throw()
  4140. {
  4141. const ScopedLockType lock (getLock());
  4142. remove (indexOf (valueToRemove));
  4143. }
  4144. template <class OtherSetType>
  4145. void removeValuesIn (const OtherSetType& otherSet) throw()
  4146. {
  4147. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4148. const ScopedLockType lock2 (getLock());
  4149. if (this == &otherSet)
  4150. {
  4151. clear();
  4152. }
  4153. else
  4154. {
  4155. if (otherSet.size() > 0)
  4156. {
  4157. for (int i = numUsed; --i >= 0;)
  4158. if (otherSet.contains (data.elements [i]))
  4159. remove (i);
  4160. }
  4161. }
  4162. }
  4163. template <class OtherSetType>
  4164. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4165. {
  4166. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4167. const ScopedLockType lock2 (getLock());
  4168. if (this != &otherSet)
  4169. {
  4170. if (otherSet.size() <= 0)
  4171. {
  4172. clear();
  4173. }
  4174. else
  4175. {
  4176. for (int i = numUsed; --i >= 0;)
  4177. if (! otherSet.contains (data.elements [i]))
  4178. remove (i);
  4179. }
  4180. }
  4181. }
  4182. void minimiseStorageOverheads() throw()
  4183. {
  4184. const ScopedLockType lock (getLock());
  4185. data.shrinkToNoMoreThan (numUsed);
  4186. }
  4187. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4188. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4189. juce_UseDebuggingNewOperator
  4190. private:
  4191. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4192. int numUsed;
  4193. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4194. {
  4195. data.ensureAllocatedSize (numUsed + 1);
  4196. ElementType* const insertPos = data.elements + indexToInsertAt;
  4197. const int numberToMove = numUsed - indexToInsertAt;
  4198. if (numberToMove > 0)
  4199. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4200. *insertPos = newElement;
  4201. ++numUsed;
  4202. }
  4203. };
  4204. #if JUCE_MSVC
  4205. #pragma warning (pop)
  4206. #endif
  4207. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4208. /*** End of inlined file: juce_SortedSet.h ***/
  4209. #endif
  4210. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4211. /*** Start of inlined file: juce_SparseSet.h ***/
  4212. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4213. #define __JUCE_SPARSESET_JUCEHEADER__
  4214. template <class Type>
  4215. class SparseSet
  4216. {
  4217. public:
  4218. SparseSet() throw()
  4219. {
  4220. }
  4221. SparseSet (const SparseSet<Type>& other) throw()
  4222. : values (other.values)
  4223. {
  4224. }
  4225. ~SparseSet() throw()
  4226. {
  4227. }
  4228. void clear() throw()
  4229. {
  4230. values.clear();
  4231. }
  4232. bool isEmpty() const throw()
  4233. {
  4234. return values.size() == 0;
  4235. }
  4236. Type size() const throw()
  4237. {
  4238. Type num = 0;
  4239. for (int i = 0; i < values.size(); i += 2)
  4240. num += values[i + 1] - values[i];
  4241. return num;
  4242. }
  4243. Type operator[] (int index) const throw()
  4244. {
  4245. for (int i = 0; i < values.size(); i += 2)
  4246. {
  4247. const Type s = values.getUnchecked(i);
  4248. const Type e = values.getUnchecked(i + 1);
  4249. if (index < e - s)
  4250. return s + index;
  4251. index -= e - s;
  4252. }
  4253. return (Type) 0;
  4254. }
  4255. bool contains (const Type valueToLookFor) const throw()
  4256. {
  4257. bool on = false;
  4258. for (int i = 0; i < values.size(); ++i)
  4259. {
  4260. if (values.getUnchecked(i) > valueToLookFor)
  4261. return on;
  4262. on = ! on;
  4263. }
  4264. return false;
  4265. }
  4266. int getNumRanges() const throw()
  4267. {
  4268. return values.size() >> 1;
  4269. }
  4270. bool getRange (const int rangeIndex,
  4271. Type& startValue,
  4272. Type& numValues) const throw()
  4273. {
  4274. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4275. {
  4276. startValue = values [rangeIndex << 1];
  4277. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4278. return true;
  4279. }
  4280. return false;
  4281. }
  4282. bool getTotalRange (Type& lowestValue,
  4283. Type& highestValue) const throw()
  4284. {
  4285. if (values.size() > 0)
  4286. {
  4287. lowestValue = values.getUnchecked (0);
  4288. highestValue = values.getUnchecked (values.size() - 1);
  4289. return true;
  4290. }
  4291. return false;
  4292. }
  4293. void addRange (const Type firstValue,
  4294. const Type numValuesToAdd) throw()
  4295. {
  4296. jassert (numValuesToAdd >= 0);
  4297. if (numValuesToAdd > 0)
  4298. {
  4299. removeRange (firstValue, numValuesToAdd);
  4300. IntegerElementComparator<Type> sorter;
  4301. values.addSorted (sorter, firstValue);
  4302. values.addSorted (sorter, firstValue + numValuesToAdd);
  4303. simplify();
  4304. }
  4305. }
  4306. void removeRange (const Type firstValue,
  4307. const Type numValuesToRemove) throw()
  4308. {
  4309. jassert (numValuesToRemove >= 0);
  4310. if (numValuesToRemove >= 0
  4311. && firstValue < values.getLast())
  4312. {
  4313. const bool onAtStart = contains (firstValue - 1);
  4314. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4315. const bool onAtEnd = contains (lastValue);
  4316. for (int i = values.size(); --i >= 0;)
  4317. {
  4318. if (values.getUnchecked(i) <= lastValue)
  4319. {
  4320. while (values.getUnchecked(i) >= firstValue)
  4321. {
  4322. values.remove (i);
  4323. if (--i < 0)
  4324. break;
  4325. }
  4326. break;
  4327. }
  4328. }
  4329. IntegerElementComparator<Type> sorter;
  4330. if (onAtStart)
  4331. values.addSorted (sorter, firstValue);
  4332. if (onAtEnd)
  4333. values.addSorted (sorter, lastValue);
  4334. simplify();
  4335. }
  4336. }
  4337. void invertRange (const Type firstValue,
  4338. const Type numValues)
  4339. {
  4340. SparseSet newItems;
  4341. newItems.addRange (firstValue, numValues);
  4342. int i;
  4343. for (i = getNumRanges(); --i >= 0;)
  4344. {
  4345. const int start = values [i << 1];
  4346. const int end = values [(i << 1) + 1];
  4347. newItems.removeRange (start, end);
  4348. }
  4349. removeRange (firstValue, numValues);
  4350. for (i = newItems.getNumRanges(); --i >= 0;)
  4351. {
  4352. const int start = newItems.values [i << 1];
  4353. const int end = newItems.values [(i << 1) + 1];
  4354. addRange (start, end);
  4355. }
  4356. }
  4357. bool overlapsRange (const Type firstValue,
  4358. const Type numValues) throw()
  4359. {
  4360. jassert (numValues >= 0);
  4361. if (numValues > 0)
  4362. {
  4363. for (int i = getNumRanges(); --i >= 0;)
  4364. {
  4365. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4366. return false;
  4367. if (firstValue + numValues > values.getUnchecked (i << 1))
  4368. return true;
  4369. }
  4370. }
  4371. return false;
  4372. }
  4373. bool containsRange (const Type firstValue,
  4374. const Type numValues) throw()
  4375. {
  4376. jassert (numValues >= 0);
  4377. if (numValues > 0)
  4378. {
  4379. for (int i = getNumRanges(); --i >= 0;)
  4380. {
  4381. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4382. return false;
  4383. if (firstValue >= values.getUnchecked (i << 1)
  4384. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4385. return true;
  4386. }
  4387. }
  4388. return false;
  4389. }
  4390. bool operator== (const SparseSet<Type>& other) throw()
  4391. {
  4392. return values == other.values;
  4393. }
  4394. bool operator!= (const SparseSet<Type>& other) throw()
  4395. {
  4396. return values != other.values;
  4397. }
  4398. juce_UseDebuggingNewOperator
  4399. private:
  4400. // alternating start/end values of ranges of values that are present.
  4401. Array<Type, DummyCriticalSection> values;
  4402. void simplify() throw()
  4403. {
  4404. jassert ((values.size() & 1) == 0);
  4405. for (int i = values.size(); --i > 0;)
  4406. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4407. values.removeRange (i - 1, 2);
  4408. }
  4409. };
  4410. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4411. /*** End of inlined file: juce_SparseSet.h ***/
  4412. #endif
  4413. #ifndef __JUCE_VALUE_JUCEHEADER__
  4414. /*** Start of inlined file: juce_Value.h ***/
  4415. #ifndef __JUCE_VALUE_JUCEHEADER__
  4416. #define __JUCE_VALUE_JUCEHEADER__
  4417. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4418. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4419. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4420. /*** Start of inlined file: juce_MessageListener.h ***/
  4421. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4422. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4423. /*** Start of inlined file: juce_Message.h ***/
  4424. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4425. #define __JUCE_MESSAGE_JUCEHEADER__
  4426. class MessageListener;
  4427. class MessageManager;
  4428. class JUCE_API Message
  4429. {
  4430. public:
  4431. Message() throw();
  4432. Message (int intParameter1,
  4433. int intParameter2,
  4434. int intParameter3,
  4435. void* pointerParameter) throw();
  4436. virtual ~Message() throw();
  4437. // These values can be used for carrying simple data that the application needs to
  4438. // pass around. For more complex messages, just create a subclass.
  4439. int intParameter1; /**< user-defined integer value. */
  4440. int intParameter2; /**< user-defined integer value. */
  4441. int intParameter3; /**< user-defined integer value. */
  4442. void* pointerParameter; /**< user-defined pointer value. */
  4443. juce_UseDebuggingNewOperator
  4444. private:
  4445. friend class MessageListener;
  4446. friend class MessageManager;
  4447. MessageListener* messageRecipient;
  4448. Message (const Message&);
  4449. Message& operator= (const Message&);
  4450. };
  4451. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4452. /*** End of inlined file: juce_Message.h ***/
  4453. class JUCE_API MessageListener
  4454. {
  4455. protected:
  4456. MessageListener() throw();
  4457. public:
  4458. virtual ~MessageListener();
  4459. virtual void handleMessage (const Message& message) = 0;
  4460. void postMessage (Message* message) const throw();
  4461. bool isValidMessageListener() const throw();
  4462. };
  4463. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4464. /*** End of inlined file: juce_MessageListener.h ***/
  4465. class JUCE_API AsyncUpdater
  4466. {
  4467. public:
  4468. AsyncUpdater() throw();
  4469. virtual ~AsyncUpdater();
  4470. void triggerAsyncUpdate() throw();
  4471. void cancelPendingUpdate() throw();
  4472. void handleUpdateNowIfNeeded();
  4473. virtual void handleAsyncUpdate() = 0;
  4474. private:
  4475. class AsyncUpdaterInternal : public MessageListener
  4476. {
  4477. public:
  4478. AsyncUpdaterInternal() throw() {}
  4479. ~AsyncUpdaterInternal() {}
  4480. void handleMessage (const Message&);
  4481. AsyncUpdater* owner;
  4482. private:
  4483. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4484. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4485. };
  4486. AsyncUpdaterInternal internalAsyncHandler;
  4487. bool asyncMessagePending;
  4488. };
  4489. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4490. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4491. /*** Start of inlined file: juce_ListenerList.h ***/
  4492. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  4493. #define __JUCE_LISTENERLIST_JUCEHEADER__
  4494. template <class ListenerClass,
  4495. class ArrayType = Array <ListenerClass*> >
  4496. class ListenerList
  4497. {
  4498. // Horrible macros required to support VC6/7..
  4499. #if defined (_MSC_VER) && _MSC_VER <= 1400
  4500. #define LL_TEMPLATE(a) typename P##a, typename Q##a
  4501. #define LL_PARAM(a) Q##a& param##a
  4502. #else
  4503. #define LL_TEMPLATE(a) typename P##a
  4504. #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a
  4505. #endif
  4506. public:
  4507. ListenerList()
  4508. {
  4509. }
  4510. ~ListenerList()
  4511. {
  4512. }
  4513. void add (ListenerClass* const listenerToAdd)
  4514. {
  4515. // Listeners can't be null pointers!
  4516. jassert (listenerToAdd != 0);
  4517. if (listenerToAdd != 0)
  4518. listeners.addIfNotAlreadyThere (listenerToAdd);
  4519. }
  4520. void remove (ListenerClass* const listenerToRemove)
  4521. {
  4522. // Listeners can't be null pointers!
  4523. jassert (listenerToRemove != 0);
  4524. listeners.removeValue (listenerToRemove);
  4525. }
  4526. int size() const throw()
  4527. {
  4528. return listeners.size();
  4529. }
  4530. bool isEmpty() const throw()
  4531. {
  4532. return listeners.size() == 0;
  4533. }
  4534. bool contains (ListenerClass* const listener) const throw()
  4535. {
  4536. return listeners.contains (listener);
  4537. }
  4538. void call (void (ListenerClass::*callbackFunction) ())
  4539. {
  4540. callChecked (static_cast <const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
  4541. }
  4542. template <class BailOutCheckerType>
  4543. void callChecked (const BailOutCheckerType& bailOutChecker,
  4544. void (ListenerClass::*callbackFunction) ())
  4545. {
  4546. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4547. (iter.getListener()->*callbackFunction) ();
  4548. }
  4549. template <LL_TEMPLATE(1)>
  4550. void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
  4551. {
  4552. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4553. (iter.getListener()->*callbackFunction) (param1);
  4554. }
  4555. template <class BailOutCheckerType, LL_TEMPLATE(1)>
  4556. void callChecked (const BailOutCheckerType& bailOutChecker,
  4557. void (ListenerClass::*callbackFunction) (P1),
  4558. LL_PARAM(1))
  4559. {
  4560. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4561. (iter.getListener()->*callbackFunction) (param1);
  4562. }
  4563. template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4564. void call (void (ListenerClass::*callbackFunction) (P1, P2),
  4565. LL_PARAM(1), LL_PARAM(2))
  4566. {
  4567. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4568. (iter.getListener()->*callbackFunction) (param1, param2);
  4569. }
  4570. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2)>
  4571. void callChecked (const BailOutCheckerType& bailOutChecker,
  4572. void (ListenerClass::*callbackFunction) (P1, P2),
  4573. LL_PARAM(1), LL_PARAM(2))
  4574. {
  4575. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4576. (iter.getListener()->*callbackFunction) (param1, param2);
  4577. }
  4578. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4579. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4580. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4581. {
  4582. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4583. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4584. }
  4585. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
  4586. void callChecked (const BailOutCheckerType& bailOutChecker,
  4587. void (ListenerClass::*callbackFunction) (P1, P2, P3),
  4588. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
  4589. {
  4590. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4591. (iter.getListener()->*callbackFunction) (param1, param2, param3);
  4592. }
  4593. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4594. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4595. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4596. {
  4597. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4598. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4599. }
  4600. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
  4601. void callChecked (const BailOutCheckerType& bailOutChecker,
  4602. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
  4603. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
  4604. {
  4605. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4606. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
  4607. }
  4608. template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4609. void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4610. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4611. {
  4612. for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
  4613. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4614. }
  4615. template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
  4616. void callChecked (const BailOutCheckerType& bailOutChecker,
  4617. void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
  4618. LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
  4619. {
  4620. for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
  4621. (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
  4622. }
  4623. class DummyBailOutChecker
  4624. {
  4625. public:
  4626. inline bool shouldBailOut() const throw() { return false; }
  4627. };
  4628. template <class BailOutCheckerType, class ListType>
  4629. class Iterator
  4630. {
  4631. public:
  4632. Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
  4633. : list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
  4634. {}
  4635. ~Iterator() {}
  4636. bool next()
  4637. {
  4638. if (index <= 0 || bailOutChecker.shouldBailOut())
  4639. return false;
  4640. const int listSize = list.size();
  4641. if (--index < listSize)
  4642. return true;
  4643. index = listSize - 1;
  4644. return index >= 0;
  4645. }
  4646. typename ListType::ListenerType* getListener() const throw()
  4647. {
  4648. return list.getListeners().getUnchecked (index);
  4649. }
  4650. private:
  4651. const ListType& list;
  4652. const BailOutCheckerType& bailOutChecker;
  4653. int index;
  4654. Iterator (const Iterator&);
  4655. Iterator& operator= (const Iterator&);
  4656. };
  4657. typedef ListenerList<ListenerClass, ArrayType> ThisType;
  4658. typedef ListenerClass ListenerType;
  4659. const ArrayType& getListeners() const throw() { return listeners; }
  4660. private:
  4661. ArrayType listeners;
  4662. ListenerList (const ListenerList&);
  4663. ListenerList& operator= (const ListenerList&);
  4664. #undef LL_TEMPLATE
  4665. #undef LL_PARAM
  4666. };
  4667. #endif // __JUCE_LISTENERLIST_JUCEHEADER__
  4668. /*** End of inlined file: juce_ListenerList.h ***/
  4669. class JUCE_API Value
  4670. {
  4671. public:
  4672. Value();
  4673. Value (const Value& other);
  4674. Value (const var& initialValue);
  4675. ~Value();
  4676. const var getValue() const;
  4677. operator const var() const;
  4678. const String toString() const;
  4679. void setValue (const var& newValue);
  4680. Value& operator= (const var& newValue);
  4681. void referTo (const Value& valueToReferTo);
  4682. bool refersToSameSourceAs (const Value& other) const;
  4683. bool operator== (const Value& other) const;
  4684. bool operator!= (const Value& other) const;
  4685. class JUCE_API Listener
  4686. {
  4687. public:
  4688. Listener() {}
  4689. virtual ~Listener() {}
  4690. virtual void valueChanged (Value& value) = 0;
  4691. };
  4692. void addListener (Listener* const listener);
  4693. void removeListener (Listener* const listener);
  4694. class JUCE_API ValueSource : public ReferenceCountedObject,
  4695. public AsyncUpdater
  4696. {
  4697. public:
  4698. ValueSource();
  4699. virtual ~ValueSource();
  4700. virtual const var getValue() const = 0;
  4701. virtual void setValue (const var& newValue) = 0;
  4702. void sendChangeMessage (const bool dispatchSynchronously);
  4703. juce_UseDebuggingNewOperator
  4704. protected:
  4705. friend class Value;
  4706. SortedSet <Value*> valuesWithListeners;
  4707. void handleAsyncUpdate();
  4708. ValueSource (const ValueSource&);
  4709. ValueSource& operator= (const ValueSource&);
  4710. };
  4711. explicit Value (ValueSource* const valueSource);
  4712. ValueSource& getValueSource() { return *value; }
  4713. juce_UseDebuggingNewOperator
  4714. private:
  4715. friend class ValueSource;
  4716. ReferenceCountedObjectPtr <ValueSource> value;
  4717. ListenerList <Listener> listeners;
  4718. void callListeners();
  4719. // This is disallowed to avoid confusion about whether it should
  4720. // do a by-value or by-reference copy.
  4721. Value& operator= (const Value& other);
  4722. };
  4723. OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
  4724. #endif // __JUCE_VALUE_JUCEHEADER__
  4725. /*** End of inlined file: juce_Value.h ***/
  4726. #endif
  4727. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4728. /*** Start of inlined file: juce_ValueTree.h ***/
  4729. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4730. #define __JUCE_VALUETREE_JUCEHEADER__
  4731. /*** Start of inlined file: juce_UndoManager.h ***/
  4732. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4733. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4734. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4735. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4736. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4737. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4738. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4739. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4740. /*** Start of inlined file: juce_ChangeListener.h ***/
  4741. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4742. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4743. class JUCE_API ChangeListener
  4744. {
  4745. public:
  4746. virtual ~ChangeListener() {}
  4747. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4748. };
  4749. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4750. /*** End of inlined file: juce_ChangeListener.h ***/
  4751. /*** Start of inlined file: juce_ScopedLock.h ***/
  4752. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4753. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4754. class JUCE_API ScopedLock
  4755. {
  4756. public:
  4757. inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4758. inline ~ScopedLock() throw() { lock_.exit(); }
  4759. private:
  4760. const CriticalSection& lock_;
  4761. ScopedLock (const ScopedLock&);
  4762. ScopedLock& operator= (const ScopedLock&);
  4763. };
  4764. class ScopedUnlock
  4765. {
  4766. public:
  4767. inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4768. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4769. private:
  4770. const CriticalSection& lock_;
  4771. ScopedUnlock (const ScopedLock&);
  4772. ScopedUnlock& operator= (const ScopedUnlock&);
  4773. };
  4774. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4775. /*** End of inlined file: juce_ScopedLock.h ***/
  4776. class JUCE_API ChangeListenerList : public MessageListener
  4777. {
  4778. public:
  4779. ChangeListenerList() throw();
  4780. ~ChangeListenerList() throw();
  4781. void addChangeListener (ChangeListener* listener) throw();
  4782. void removeChangeListener (ChangeListener* listener) throw();
  4783. void removeAllChangeListeners() throw();
  4784. void sendChangeMessage (void* objectThatHasChanged) throw();
  4785. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4786. void dispatchPendingMessages();
  4787. void handleMessage (const Message&);
  4788. juce_UseDebuggingNewOperator
  4789. private:
  4790. SortedSet <void*> listeners;
  4791. CriticalSection lock;
  4792. void* lastChangedObject;
  4793. bool messagePending;
  4794. ChangeListenerList (const ChangeListenerList&);
  4795. ChangeListenerList& operator= (const ChangeListenerList&);
  4796. };
  4797. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4798. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4799. class JUCE_API ChangeBroadcaster
  4800. {
  4801. public:
  4802. ChangeBroadcaster() throw();
  4803. virtual ~ChangeBroadcaster();
  4804. void addChangeListener (ChangeListener* listener) throw();
  4805. void removeChangeListener (ChangeListener* listener) throw();
  4806. void removeAllChangeListeners() throw();
  4807. void sendChangeMessage (void* objectThatHasChanged) throw();
  4808. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4809. void dispatchPendingMessages();
  4810. private:
  4811. ChangeListenerList changeListenerList;
  4812. ChangeBroadcaster (const ChangeBroadcaster&);
  4813. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4814. };
  4815. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4816. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4817. /*** Start of inlined file: juce_UndoableAction.h ***/
  4818. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4819. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4820. class JUCE_API UndoableAction
  4821. {
  4822. protected:
  4823. UndoableAction() throw() {}
  4824. public:
  4825. virtual ~UndoableAction() {}
  4826. virtual bool perform() = 0;
  4827. virtual bool undo() = 0;
  4828. virtual int getSizeInUnits() { return 10; }
  4829. };
  4830. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4831. /*** End of inlined file: juce_UndoableAction.h ***/
  4832. class JUCE_API UndoManager : public ChangeBroadcaster
  4833. {
  4834. public:
  4835. UndoManager (int maxNumberOfUnitsToKeep = 30000,
  4836. int minimumTransactionsToKeep = 30);
  4837. ~UndoManager();
  4838. void clearUndoHistory();
  4839. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4840. void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
  4841. int minimumTransactionsToKeep);
  4842. bool perform (UndoableAction* action,
  4843. const String& actionName = String::empty);
  4844. void beginNewTransaction (const String& actionName = String::empty);
  4845. void setCurrentTransactionName (const String& newName);
  4846. bool canUndo() const;
  4847. const String getUndoDescription() const;
  4848. bool undo();
  4849. bool undoCurrentTransactionOnly();
  4850. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4851. int getNumActionsInCurrentTransaction() const;
  4852. bool canRedo() const;
  4853. const String getRedoDescription() const;
  4854. bool redo();
  4855. juce_UseDebuggingNewOperator
  4856. private:
  4857. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4858. StringArray transactionNames;
  4859. String currentTransactionName;
  4860. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4861. bool newTransaction, reentrancyCheck;
  4862. // disallow copy constructor
  4863. UndoManager (const UndoManager&);
  4864. UndoManager& operator= (const UndoManager&);
  4865. };
  4866. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4867. /*** End of inlined file: juce_UndoManager.h ***/
  4868. class JUCE_API ValueTree
  4869. {
  4870. public:
  4871. explicit ValueTree (const String& type);
  4872. ValueTree (const ValueTree& other);
  4873. ValueTree& operator= (const ValueTree& other);
  4874. ~ValueTree();
  4875. bool operator== (const ValueTree& other) const;
  4876. bool operator!= (const ValueTree& other) const;
  4877. bool isValid() const { return object != 0; }
  4878. ValueTree createCopy() const;
  4879. const String getType() const;
  4880. bool hasType (const String& typeName) const;
  4881. const var& getProperty (const var::identifier& name) const;
  4882. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  4883. const var& operator[] (const var::identifier& name) const;
  4884. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4885. bool hasProperty (const var::identifier& name) const;
  4886. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4887. void removeAllProperties (UndoManager* const undoManager);
  4888. int getNumProperties() const;
  4889. const var::identifier getPropertyName (int index) const;
  4890. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4891. int getNumChildren() const;
  4892. ValueTree getChild (int index) const;
  4893. ValueTree getChildWithName (const String& type) const;
  4894. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4895. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4896. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4897. void removeChild (const int childIndex, UndoManager* const undoManager);
  4898. void removeAllChildren (UndoManager* const undoManager);
  4899. bool isAChildOf (const ValueTree& possibleParent) const;
  4900. ValueTree getParent() const;
  4901. XmlElement* createXml() const;
  4902. static ValueTree fromXml (const XmlElement& xml);
  4903. void writeToStream (OutputStream& output);
  4904. static ValueTree readFromStream (InputStream& input);
  4905. class JUCE_API Listener
  4906. {
  4907. public:
  4908. virtual ~Listener() {}
  4909. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4910. const var::identifier& property) = 0;
  4911. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4912. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4913. };
  4914. void addListener (Listener* listener);
  4915. void removeListener (Listener* listener);
  4916. template <typename ElementComparator>
  4917. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4918. {
  4919. if (object != 0)
  4920. {
  4921. ComparatorAdapter <ElementComparator> adapter (comparator);
  4922. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4923. object->sendChildChangeMessage();
  4924. }
  4925. }
  4926. static ValueTree invalid;
  4927. juce_UseDebuggingNewOperator
  4928. private:
  4929. friend class ValueTreeSetPropertyAction;
  4930. friend class ValueTreeChildChangeAction;
  4931. class JUCE_API SharedObject : public ReferenceCountedObject
  4932. {
  4933. public:
  4934. SharedObject (const String& type);
  4935. SharedObject (const SharedObject& other);
  4936. ~SharedObject();
  4937. const String type;
  4938. NamedValueSet properties;
  4939. ReferenceCountedArray <SharedObject> children;
  4940. SortedSet <ValueTree*> valueTreesWithListeners;
  4941. SharedObject* parent;
  4942. void sendPropertyChangeMessage (const var::identifier& property);
  4943. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4944. void sendChildChangeMessage();
  4945. void sendChildChangeMessage (ValueTree& tree);
  4946. void sendParentChangeMessage();
  4947. const var& getProperty (const var::identifier& name) const;
  4948. const var getProperty (const var::identifier& name, const var& defaultReturnValue) const;
  4949. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4950. bool hasProperty (const var::identifier& name) const;
  4951. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4952. void removeAllProperties (UndoManager* const undoManager);
  4953. bool isAChildOf (const SharedObject* const possibleParent) const;
  4954. ValueTree getChildWithName (const String& type) const;
  4955. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4956. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4957. void removeChild (const int childIndex, UndoManager* const undoManager);
  4958. void removeAllChildren (UndoManager* const undoManager);
  4959. XmlElement* createXml() const;
  4960. juce_UseDebuggingNewOperator
  4961. private:
  4962. SharedObject& operator= (const SharedObject&);
  4963. };
  4964. template <typename ElementComparator>
  4965. class ComparatorAdapter
  4966. {
  4967. public:
  4968. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4969. int compareElements (SharedObject* const first, SharedObject* const second)
  4970. {
  4971. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4972. }
  4973. private:
  4974. ElementComparator& comparator;
  4975. };
  4976. friend class SharedObject;
  4977. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4978. ReferenceCountedObjectPtr <SharedObject> object;
  4979. ListenerList <Listener> listeners;
  4980. public:
  4981. explicit ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
  4982. };
  4983. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4984. /*** End of inlined file: juce_ValueTree.h ***/
  4985. #endif
  4986. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4987. #endif
  4988. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4989. /*** Start of inlined file: juce_VoidArray.h ***/
  4990. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4991. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4992. typedef Array <void*> VoidArray;
  4993. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4994. /*** End of inlined file: juce_VoidArray.h ***/
  4995. #endif
  4996. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4997. #endif
  4998. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4999. #endif
  5000. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  5001. /*** Start of inlined file: juce_FileLogger.h ***/
  5002. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  5003. #define __JUCE_FILELOGGER_JUCEHEADER__
  5004. class JUCE_API FileLogger : public Logger
  5005. {
  5006. public:
  5007. FileLogger (const File& fileToWriteTo,
  5008. const String& welcomeMessage,
  5009. const int maxInitialFileSizeBytes = 128 * 1024);
  5010. ~FileLogger();
  5011. void logMessage (const String& message);
  5012. const File getLogFile() const { return logFile; }
  5013. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  5014. const String& logFileName,
  5015. const String& welcomeMessage,
  5016. const int maxInitialFileSizeBytes = 128 * 1024);
  5017. juce_UseDebuggingNewOperator
  5018. private:
  5019. File logFile;
  5020. CriticalSection logLock;
  5021. ScopedPointer <FileOutputStream> logStream;
  5022. void trimFileSize (int maxFileSizeBytes) const;
  5023. FileLogger (const FileLogger&);
  5024. FileLogger& operator= (const FileLogger&);
  5025. };
  5026. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  5027. /*** End of inlined file: juce_FileLogger.h ***/
  5028. #endif
  5029. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5030. /*** Start of inlined file: juce_Initialisation.h ***/
  5031. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  5032. #define __JUCE_INITIALISATION_JUCEHEADER__
  5033. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  5034. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  5035. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  5036. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  5037. class ScopedJuceInitialiser_NonGUI
  5038. {
  5039. public:
  5040. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  5041. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  5042. };
  5043. class ScopedJuceInitialiser_GUI
  5044. {
  5045. public:
  5046. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  5047. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  5048. };
  5049. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  5050. /*** End of inlined file: juce_Initialisation.h ***/
  5051. #endif
  5052. #ifndef __JUCE_LOGGER_JUCEHEADER__
  5053. #endif
  5054. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  5055. #endif
  5056. #ifndef __JUCE_MEMORY_JUCEHEADER__
  5057. #endif
  5058. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5059. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  5060. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5061. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5062. class JUCE_API PerformanceCounter
  5063. {
  5064. public:
  5065. PerformanceCounter (const String& counterName,
  5066. int runsPerPrintout = 100,
  5067. const File& loggingFile = File::nonexistent);
  5068. ~PerformanceCounter();
  5069. void start();
  5070. void stop();
  5071. void printStatistics();
  5072. juce_UseDebuggingNewOperator
  5073. private:
  5074. String name;
  5075. int numRuns, runsPerPrint;
  5076. double totalTime;
  5077. int64 started;
  5078. File outputFile;
  5079. };
  5080. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  5081. /*** End of inlined file: juce_PerformanceCounter.h ***/
  5082. #endif
  5083. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  5084. #endif
  5085. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5086. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  5087. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5088. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5089. class JUCE_API PlatformUtilities
  5090. {
  5091. public:
  5092. static void beep();
  5093. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  5094. const String& emailSubject,
  5095. const String& bodyText,
  5096. const StringArray& filesToAttach);
  5097. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  5098. static const String cfStringToJuceString (CFStringRef cfString);
  5099. static CFStringRef juceStringToCFString (const String& s);
  5100. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  5101. static const String makePathFromFSRef (FSRef* file);
  5102. static const String convertToPrecomposedUnicode (const String& s);
  5103. static OSType getTypeOfFile (const String& filename);
  5104. static bool isBundle (const String& filename);
  5105. static void addItemToDock (const File& file);
  5106. static int getOSXMinorVersionNumber();
  5107. #endif
  5108. #if JUCE_WINDOWS || DOXYGEN
  5109. // Some registry helper functions:
  5110. static const String getRegistryValue (const String& regValuePath,
  5111. const String& defaultValue = String::empty);
  5112. static void setRegistryValue (const String& regValuePath,
  5113. const String& value);
  5114. static bool registryValueExists (const String& regValuePath);
  5115. static void deleteRegistryValue (const String& regValuePath);
  5116. static void deleteRegistryKey (const String& regKeyPath);
  5117. static void registerFileAssociation (const String& fileExtension,
  5118. const String& symbolicDescription,
  5119. const String& fullDescription,
  5120. const File& targetExecutable,
  5121. int iconResourceNumber);
  5122. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  5123. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  5124. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  5125. #endif
  5126. static void fpuReset();
  5127. #if JUCE_LINUX || JUCE_WINDOWS
  5128. static void* loadDynamicLibrary (const String& pathOrFilename);
  5129. static void freeDynamicLibrary (void* libraryHandle);
  5130. static void* getProcedureEntryPoint (void* libraryHandle,
  5131. const String& procedureName);
  5132. #endif
  5133. #if JUCE_LINUX || DOXYGEN
  5134. #endif
  5135. private:
  5136. PlatformUtilities();
  5137. PlatformUtilities (const PlatformUtilities&);
  5138. PlatformUtilities& operator= (const PlatformUtilities&);
  5139. };
  5140. #if JUCE_MAC || JUCE_IPHONE
  5141. class ScopedAutoReleasePool
  5142. {
  5143. public:
  5144. ScopedAutoReleasePool();
  5145. ~ScopedAutoReleasePool();
  5146. private:
  5147. void* pool;
  5148. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  5149. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  5150. };
  5151. #endif
  5152. #if JUCE_LINUX
  5153. class ScopedXLock
  5154. {
  5155. public:
  5156. ScopedXLock();
  5157. ~ScopedXLock();
  5158. };
  5159. #endif
  5160. #if JUCE_MAC
  5161. class JUCE_API AppleRemoteDevice
  5162. {
  5163. public:
  5164. AppleRemoteDevice();
  5165. virtual ~AppleRemoteDevice();
  5166. enum ButtonType
  5167. {
  5168. menuButton = 0, /**< The menu button (if it's held for a short time). */
  5169. playButton, /**< The play button. */
  5170. plusButton, /**< The plus or volume-up button. */
  5171. minusButton, /**< The minus or volume-down button. */
  5172. rightButton, /**< The right button (if it's held for a short time). */
  5173. leftButton, /**< The left button (if it's held for a short time). */
  5174. rightButton_Long, /**< The right button (if it's held for a long time). */
  5175. leftButton_Long, /**< The menu button (if it's held for a long time). */
  5176. menuButton_Long, /**< The menu button (if it's held for a long time). */
  5177. playButtonSleepMode,
  5178. switched
  5179. };
  5180. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  5181. bool start (const bool inExclusiveMode);
  5182. void stop();
  5183. bool isActive() const;
  5184. int getRemoteId() const { return remoteId; }
  5185. juce_UseDebuggingNewOperator
  5186. void handleCallbackInternal();
  5187. private:
  5188. void* device;
  5189. void* queue;
  5190. int remoteId;
  5191. bool open (const bool openInExclusiveMode);
  5192. AppleRemoteDevice (const AppleRemoteDevice&);
  5193. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  5194. };
  5195. #endif
  5196. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  5197. /*** End of inlined file: juce_PlatformUtilities.h ***/
  5198. #endif
  5199. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5200. /*** Start of inlined file: juce_Random.h ***/
  5201. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5202. #define __JUCE_RANDOM_JUCEHEADER__
  5203. class JUCE_API Random
  5204. {
  5205. public:
  5206. explicit Random (int64 seedValue) throw();
  5207. ~Random() throw();
  5208. int nextInt() throw();
  5209. int nextInt (int maxValue) throw();
  5210. int64 nextInt64() throw();
  5211. float nextFloat() throw();
  5212. double nextDouble() throw();
  5213. bool nextBool() throw();
  5214. const BigInteger nextLargeNumber (const BigInteger& maximumValue);
  5215. void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
  5216. static Random& getSystemRandom() throw();
  5217. void setSeed (int64 newSeed) throw();
  5218. void combineSeed (int64 seedValue) throw();
  5219. void setSeedRandomly();
  5220. juce_UseDebuggingNewOperator
  5221. private:
  5222. int64 seed;
  5223. };
  5224. #endif // __JUCE_RANDOM_JUCEHEADER__
  5225. /*** End of inlined file: juce_Random.h ***/
  5226. #endif
  5227. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5228. #endif
  5229. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5230. /*** Start of inlined file: juce_Singleton.h ***/
  5231. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5232. #define __JUCE_SINGLETON_JUCEHEADER__
  5233. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5234. \
  5235. static classname* _singletonInstance; \
  5236. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5237. \
  5238. static classname* getInstance() \
  5239. { \
  5240. if (_singletonInstance == 0) \
  5241. {\
  5242. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5243. \
  5244. if (_singletonInstance == 0) \
  5245. { \
  5246. static bool alreadyInside = false; \
  5247. static bool createdOnceAlready = false; \
  5248. \
  5249. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5250. jassert (! problem); \
  5251. if (! problem) \
  5252. { \
  5253. createdOnceAlready = true; \
  5254. alreadyInside = true; \
  5255. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5256. alreadyInside = false; \
  5257. \
  5258. _singletonInstance = newObject; \
  5259. } \
  5260. } \
  5261. } \
  5262. \
  5263. return _singletonInstance; \
  5264. } \
  5265. \
  5266. static inline classname* getInstanceWithoutCreating() throw() \
  5267. { \
  5268. return _singletonInstance; \
  5269. } \
  5270. \
  5271. static void deleteInstance() \
  5272. { \
  5273. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5274. if (_singletonInstance != 0) \
  5275. { \
  5276. classname* const old = _singletonInstance; \
  5277. _singletonInstance = 0; \
  5278. delete old; \
  5279. } \
  5280. } \
  5281. \
  5282. void clearSingletonInstance() throw() \
  5283. { \
  5284. if (_singletonInstance == this) \
  5285. _singletonInstance = 0; \
  5286. }
  5287. #define juce_ImplementSingleton(classname) \
  5288. \
  5289. classname* classname::_singletonInstance = 0; \
  5290. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5291. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5292. \
  5293. static classname* _singletonInstance; \
  5294. \
  5295. static classname* getInstance() \
  5296. { \
  5297. if (_singletonInstance == 0) \
  5298. { \
  5299. static bool alreadyInside = false; \
  5300. static bool createdOnceAlready = false; \
  5301. \
  5302. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5303. jassert (! problem); \
  5304. if (! problem) \
  5305. { \
  5306. createdOnceAlready = true; \
  5307. alreadyInside = true; \
  5308. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5309. alreadyInside = false; \
  5310. \
  5311. _singletonInstance = newObject; \
  5312. } \
  5313. } \
  5314. \
  5315. return _singletonInstance; \
  5316. } \
  5317. \
  5318. static inline classname* getInstanceWithoutCreating() throw() \
  5319. { \
  5320. return _singletonInstance; \
  5321. } \
  5322. \
  5323. static void deleteInstance() \
  5324. { \
  5325. if (_singletonInstance != 0) \
  5326. { \
  5327. classname* const old = _singletonInstance; \
  5328. _singletonInstance = 0; \
  5329. delete old; \
  5330. } \
  5331. } \
  5332. \
  5333. void clearSingletonInstance() throw() \
  5334. { \
  5335. if (_singletonInstance == this) \
  5336. _singletonInstance = 0; \
  5337. }
  5338. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5339. \
  5340. static classname* _singletonInstance; \
  5341. \
  5342. static classname* getInstance() \
  5343. { \
  5344. if (_singletonInstance == 0) \
  5345. _singletonInstance = new classname(); \
  5346. \
  5347. return _singletonInstance; \
  5348. } \
  5349. \
  5350. static inline classname* getInstanceWithoutCreating() throw() \
  5351. { \
  5352. return _singletonInstance; \
  5353. } \
  5354. \
  5355. static void deleteInstance() \
  5356. { \
  5357. if (_singletonInstance != 0) \
  5358. { \
  5359. classname* const old = _singletonInstance; \
  5360. _singletonInstance = 0; \
  5361. delete old; \
  5362. } \
  5363. } \
  5364. \
  5365. void clearSingletonInstance() throw() \
  5366. { \
  5367. if (_singletonInstance == this) \
  5368. _singletonInstance = 0; \
  5369. }
  5370. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5371. \
  5372. classname* classname::_singletonInstance = 0;
  5373. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5374. /*** End of inlined file: juce_Singleton.h ***/
  5375. #endif
  5376. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5377. #endif
  5378. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5379. /*** Start of inlined file: juce_SystemStats.h ***/
  5380. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5381. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5382. class JUCE_API SystemStats
  5383. {
  5384. public:
  5385. static const String getJUCEVersion() throw();
  5386. enum OperatingSystemType
  5387. {
  5388. UnknownOS = 0,
  5389. MacOSX = 0x1000,
  5390. Linux = 0x2000,
  5391. Win95 = 0x4001,
  5392. Win98 = 0x4002,
  5393. WinNT351 = 0x4103,
  5394. WinNT40 = 0x4104,
  5395. Win2000 = 0x4105,
  5396. WinXP = 0x4106,
  5397. WinVista = 0x4107,
  5398. Windows7 = 0x4108,
  5399. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5400. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5401. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5402. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5403. };
  5404. static OperatingSystemType getOperatingSystemType() throw();
  5405. static const String getOperatingSystemName() throw();
  5406. static bool isOperatingSystem64Bit() throw();
  5407. static const String getLogonName();
  5408. static const String getFullUserName();
  5409. // CPU and memory information..
  5410. static int getCpuSpeedInMegaherz() throw();
  5411. static const String getCpuVendor() throw();
  5412. static bool hasMMX() throw();
  5413. static bool hasSSE() throw();
  5414. static bool hasSSE2() throw();
  5415. static bool has3DNow() throw();
  5416. static int getNumCpus() throw();
  5417. static int64 getClockCycleCounter() throw();
  5418. static int getMemorySizeInMegabytes() throw();
  5419. static int getPageSize() throw();
  5420. static int getMACAddresses (int64* addresses, int maxNum,
  5421. #if JUCE_MAC
  5422. bool littleEndian = true);
  5423. #else
  5424. bool littleEndian = false);
  5425. #endif
  5426. static const StringArray getMACAddressStrings();
  5427. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5428. static void initialiseStats() throw();
  5429. private:
  5430. SystemStats();
  5431. SystemStats (const SystemStats&);
  5432. SystemStats& operator= (const SystemStats&);
  5433. };
  5434. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5435. /*** End of inlined file: juce_SystemStats.h ***/
  5436. #endif
  5437. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5438. #endif
  5439. #ifndef __JUCE_TIME_JUCEHEADER__
  5440. #endif
  5441. #ifndef __JUCE_UUID_JUCEHEADER__
  5442. /*** Start of inlined file: juce_Uuid.h ***/
  5443. #ifndef __JUCE_UUID_JUCEHEADER__
  5444. #define __JUCE_UUID_JUCEHEADER__
  5445. class JUCE_API Uuid
  5446. {
  5447. public:
  5448. Uuid();
  5449. ~Uuid() throw();
  5450. Uuid (const Uuid& other);
  5451. Uuid& operator= (const Uuid& other);
  5452. bool isNull() const throw();
  5453. bool operator== (const Uuid& other) const;
  5454. bool operator!= (const Uuid& other) const;
  5455. const String toString() const;
  5456. Uuid (const String& uuidString);
  5457. Uuid& operator= (const String& uuidString);
  5458. const uint8* getRawData() const throw() { return value.asBytes; }
  5459. Uuid (const uint8* const rawData);
  5460. Uuid& operator= (const uint8* const rawData);
  5461. juce_UseDebuggingNewOperator
  5462. private:
  5463. union
  5464. {
  5465. uint8 asBytes [16];
  5466. int asInt[4];
  5467. int64 asInt64[2];
  5468. } value;
  5469. };
  5470. #endif // __JUCE_UUID_JUCEHEADER__
  5471. /*** End of inlined file: juce_Uuid.h ***/
  5472. #endif
  5473. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5474. /*** Start of inlined file: juce_BlowFish.h ***/
  5475. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5476. #define __JUCE_BLOWFISH_JUCEHEADER__
  5477. class JUCE_API BlowFish
  5478. {
  5479. public:
  5480. BlowFish (const void* keyData, int keyBytes);
  5481. BlowFish (const BlowFish& other);
  5482. BlowFish& operator= (const BlowFish& other);
  5483. ~BlowFish();
  5484. void encrypt (uint32& data1, uint32& data2) const throw();
  5485. void decrypt (uint32& data1, uint32& data2) const throw();
  5486. juce_UseDebuggingNewOperator
  5487. private:
  5488. uint32 p[18];
  5489. HeapBlock <uint32> s[4];
  5490. uint32 F (uint32 x) const throw();
  5491. };
  5492. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5493. /*** End of inlined file: juce_BlowFish.h ***/
  5494. #endif
  5495. #ifndef __JUCE_MD5_JUCEHEADER__
  5496. /*** Start of inlined file: juce_MD5.h ***/
  5497. #ifndef __JUCE_MD5_JUCEHEADER__
  5498. #define __JUCE_MD5_JUCEHEADER__
  5499. class JUCE_API MD5
  5500. {
  5501. public:
  5502. MD5();
  5503. MD5 (const MD5& other);
  5504. MD5& operator= (const MD5& other);
  5505. explicit MD5 (const MemoryBlock& data);
  5506. MD5 (const void* data, const size_t numBytes);
  5507. explicit MD5 (const String& text);
  5508. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5509. explicit MD5 (const File& file);
  5510. ~MD5();
  5511. const MemoryBlock getRawChecksumData() const;
  5512. const String toHexString() const;
  5513. bool operator== (const MD5& other) const;
  5514. bool operator!= (const MD5& other) const;
  5515. juce_UseDebuggingNewOperator
  5516. private:
  5517. uint8 result [16];
  5518. struct ProcessContext
  5519. {
  5520. uint8 buffer [64];
  5521. uint32 state [4];
  5522. uint32 count [2];
  5523. ProcessContext();
  5524. void processBlock (const void* data, size_t dataSize);
  5525. void transform (const void* buffer);
  5526. void finish (void* const result);
  5527. };
  5528. void processStream (InputStream& input, int64 numBytesToRead);
  5529. };
  5530. #endif // __JUCE_MD5_JUCEHEADER__
  5531. /*** End of inlined file: juce_MD5.h ***/
  5532. #endif
  5533. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5534. /*** Start of inlined file: juce_Primes.h ***/
  5535. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5536. #define __JUCE_PRIMES_JUCEHEADER__
  5537. class JUCE_API Primes
  5538. {
  5539. public:
  5540. static const BigInteger createProbablePrime (int bitLength,
  5541. int certainty,
  5542. const int* randomSeeds = 0,
  5543. int numRandomSeeds = 0);
  5544. static bool isProbablyPrime (const BigInteger& number, int certainty);
  5545. private:
  5546. Primes();
  5547. Primes (const Primes&);
  5548. Primes& operator= (const Primes&);
  5549. };
  5550. #endif // __JUCE_PRIMES_JUCEHEADER__
  5551. /*** End of inlined file: juce_Primes.h ***/
  5552. #endif
  5553. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5554. /*** Start of inlined file: juce_RSAKey.h ***/
  5555. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5556. #define __JUCE_RSAKEY_JUCEHEADER__
  5557. class JUCE_API RSAKey
  5558. {
  5559. public:
  5560. RSAKey();
  5561. explicit RSAKey (const String& stringRepresentation);
  5562. ~RSAKey();
  5563. const String toString() const;
  5564. bool applyToValue (BigInteger& value) const;
  5565. static void createKeyPair (RSAKey& publicKey,
  5566. RSAKey& privateKey,
  5567. int numBits,
  5568. const int* randomSeeds = 0,
  5569. int numRandomSeeds = 0);
  5570. juce_UseDebuggingNewOperator
  5571. protected:
  5572. BigInteger part1, part2;
  5573. };
  5574. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5575. /*** End of inlined file: juce_RSAKey.h ***/
  5576. #endif
  5577. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5578. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5579. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5580. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5581. class JUCE_API DirectoryIterator
  5582. {
  5583. public:
  5584. DirectoryIterator (const File& directory,
  5585. bool isRecursive,
  5586. const String& wildCard = "*",
  5587. int whatToLookFor = File::findFiles);
  5588. ~DirectoryIterator();
  5589. bool next();
  5590. const File getFile() const;
  5591. float getEstimatedProgress() const;
  5592. juce_UseDebuggingNewOperator
  5593. private:
  5594. Array <File> filesFound;
  5595. Array <File> dirsFound;
  5596. String wildCard;
  5597. int index;
  5598. const int whatToLookFor;
  5599. ScopedPointer <DirectoryIterator> subIterator;
  5600. DirectoryIterator (const DirectoryIterator&);
  5601. DirectoryIterator& operator= (const DirectoryIterator&);
  5602. };
  5603. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5604. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5605. #endif
  5606. #ifndef __JUCE_FILE_JUCEHEADER__
  5607. #endif
  5608. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5609. /*** Start of inlined file: juce_FileInputStream.h ***/
  5610. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5611. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5612. class JUCE_API FileInputStream : public InputStream
  5613. {
  5614. public:
  5615. explicit FileInputStream (const File& fileToRead);
  5616. ~FileInputStream();
  5617. const File& getFile() const throw() { return file; }
  5618. int64 getTotalLength();
  5619. int read (void* destBuffer, int maxBytesToRead);
  5620. bool isExhausted();
  5621. int64 getPosition();
  5622. bool setPosition (int64 pos);
  5623. juce_UseDebuggingNewOperator
  5624. private:
  5625. File file;
  5626. void* fileHandle;
  5627. int64 currentPosition, totalSize;
  5628. bool needToSeek;
  5629. FileInputStream (const FileInputStream&);
  5630. FileInputStream& operator= (const FileInputStream&);
  5631. };
  5632. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5633. /*** End of inlined file: juce_FileInputStream.h ***/
  5634. #endif
  5635. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5636. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5637. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5638. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5639. class JUCE_API FileOutputStream : public OutputStream
  5640. {
  5641. public:
  5642. FileOutputStream (const File& fileToWriteTo,
  5643. int bufferSizeToUse = 16384);
  5644. ~FileOutputStream();
  5645. const File& getFile() const { return file; }
  5646. bool failedToOpen() const { return fileHandle == 0; }
  5647. void flush();
  5648. int64 getPosition();
  5649. bool setPosition (int64 pos);
  5650. bool write (const void* data, int numBytes);
  5651. juce_UseDebuggingNewOperator
  5652. private:
  5653. File file;
  5654. void* fileHandle;
  5655. int64 currentPosition;
  5656. int bufferSize, bytesInBuffer;
  5657. HeapBlock <char> buffer;
  5658. FileOutputStream (const FileOutputStream&);
  5659. FileOutputStream& operator= (const FileOutputStream&);
  5660. };
  5661. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5662. /*** End of inlined file: juce_FileOutputStream.h ***/
  5663. #endif
  5664. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5665. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5666. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5667. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5668. class JUCE_API FileSearchPath
  5669. {
  5670. public:
  5671. FileSearchPath();
  5672. FileSearchPath (const String& path);
  5673. FileSearchPath (const FileSearchPath& other);
  5674. ~FileSearchPath();
  5675. FileSearchPath& operator= (const String& path);
  5676. int getNumPaths() const;
  5677. const File operator[] (int index) const;
  5678. const String toString() const;
  5679. void add (const File& directoryToAdd,
  5680. int insertIndex = -1);
  5681. void addIfNotAlreadyThere (const File& directoryToAdd);
  5682. void remove (int indexToRemove);
  5683. void addPath (const FileSearchPath& other);
  5684. void removeRedundantPaths();
  5685. void removeNonExistentPaths();
  5686. int findChildFiles (Array<File>& results,
  5687. int whatToLookFor,
  5688. bool searchRecursively,
  5689. const String& wildCardPattern = "*") const;
  5690. bool isFileInPath (const File& fileToCheck,
  5691. bool checkRecursively) const;
  5692. juce_UseDebuggingNewOperator
  5693. private:
  5694. StringArray directories;
  5695. void init (const String& path);
  5696. };
  5697. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5698. /*** End of inlined file: juce_FileSearchPath.h ***/
  5699. #endif
  5700. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5701. /*** Start of inlined file: juce_NamedPipe.h ***/
  5702. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5703. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5704. class JUCE_API NamedPipe
  5705. {
  5706. public:
  5707. NamedPipe();
  5708. ~NamedPipe();
  5709. bool openExisting (const String& pipeName);
  5710. bool createNewPipe (const String& pipeName);
  5711. void close();
  5712. bool isOpen() const;
  5713. const String getName() const;
  5714. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5715. int write (const void* sourceBuffer, int numBytesToWrite,
  5716. int timeOutMilliseconds = 2000);
  5717. void cancelPendingReads();
  5718. juce_UseDebuggingNewOperator
  5719. private:
  5720. void* internal;
  5721. String currentPipeName;
  5722. CriticalSection lock;
  5723. NamedPipe (const NamedPipe&);
  5724. NamedPipe& operator= (const NamedPipe&);
  5725. bool openInternal (const String& pipeName, const bool createPipe);
  5726. };
  5727. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5728. /*** End of inlined file: juce_NamedPipe.h ***/
  5729. #endif
  5730. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5731. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5732. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5733. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5734. class JUCE_API TemporaryFile
  5735. {
  5736. public:
  5737. enum OptionFlags
  5738. {
  5739. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5740. i.e. its name should start with a dot. */
  5741. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5742. the file is unique, they should go in brackets rather
  5743. than just being appended (see File::getNonexistentSibling() )*/
  5744. };
  5745. TemporaryFile (const String& suffix = String::empty,
  5746. int optionFlags = 0);
  5747. TemporaryFile (const File& targetFile,
  5748. int optionFlags = 0);
  5749. ~TemporaryFile();
  5750. const File getFile() const { return temporaryFile; }
  5751. const File getTargetFile() const { return targetFile; }
  5752. bool overwriteTargetFileWithTemporary() const;
  5753. juce_UseDebuggingNewOperator
  5754. private:
  5755. File temporaryFile, targetFile;
  5756. void createTempFile (const File& parentDirectory, String name, const String& suffix, int optionFlags);
  5757. TemporaryFile (const TemporaryFile&);
  5758. TemporaryFile& operator= (const TemporaryFile&);
  5759. };
  5760. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5761. /*** End of inlined file: juce_TemporaryFile.h ***/
  5762. #endif
  5763. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5764. /*** Start of inlined file: juce_ZipFile.h ***/
  5765. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5766. #define __JUCE_ZIPFILE_JUCEHEADER__
  5767. /*** Start of inlined file: juce_InputSource.h ***/
  5768. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5769. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5770. class JUCE_API InputSource
  5771. {
  5772. public:
  5773. InputSource() throw() {}
  5774. virtual ~InputSource() {}
  5775. virtual InputStream* createInputStream() = 0;
  5776. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5777. virtual int64 hashCode() const = 0;
  5778. juce_UseDebuggingNewOperator
  5779. };
  5780. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5781. /*** End of inlined file: juce_InputSource.h ***/
  5782. class JUCE_API ZipFile
  5783. {
  5784. public:
  5785. ZipFile (InputStream* inputStream,
  5786. bool deleteStreamWhenDestroyed) throw();
  5787. ZipFile (const File& file);
  5788. ZipFile (InputSource* inputSource);
  5789. ~ZipFile() throw();
  5790. struct ZipEntry
  5791. {
  5792. String filename;
  5793. unsigned int uncompressedSize;
  5794. Time fileTime;
  5795. };
  5796. int getNumEntries() const throw();
  5797. const ZipEntry* getEntry (int index) const throw();
  5798. int getIndexOfFileName (const String& fileName) const throw();
  5799. const ZipEntry* getEntry (const String& fileName) const throw();
  5800. void sortEntriesByFilename();
  5801. InputStream* createStreamForEntry (int index);
  5802. void uncompressTo (const File& targetDirectory,
  5803. bool shouldOverwriteFiles = true);
  5804. juce_UseDebuggingNewOperator
  5805. private:
  5806. class ZipInputStream;
  5807. class ZipFilenameComparator;
  5808. class ZipEntryInfo;
  5809. friend class ZipInputStream;
  5810. friend class ZipFilenameComparator;
  5811. friend class ZipEntryInfo;
  5812. OwnedArray <ZipEntryInfo> entries;
  5813. CriticalSection lock;
  5814. InputStream* inputStream;
  5815. ScopedPointer <InputStream> streamToDelete;
  5816. ScopedPointer <InputSource> inputSource;
  5817. #ifdef JUCE_DEBUG
  5818. int numOpenStreams;
  5819. #endif
  5820. void init();
  5821. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5822. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5823. ZipFile (const ZipFile&);
  5824. ZipFile& operator= (const ZipFile&);
  5825. };
  5826. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5827. /*** End of inlined file: juce_ZipFile.h ***/
  5828. #endif
  5829. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5830. /*** Start of inlined file: juce_Socket.h ***/
  5831. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5832. #define __JUCE_SOCKET_JUCEHEADER__
  5833. class JUCE_API StreamingSocket
  5834. {
  5835. public:
  5836. StreamingSocket();
  5837. ~StreamingSocket();
  5838. bool bindToPort (int localPortNumber);
  5839. bool connect (const String& remoteHostname,
  5840. int remotePortNumber,
  5841. int timeOutMillisecs = 3000);
  5842. bool isConnected() const throw() { return connected; }
  5843. void close();
  5844. const String& getHostName() const throw() { return hostName; }
  5845. int getPort() const throw() { return portNumber; }
  5846. bool isLocal() const throw();
  5847. int waitUntilReady (bool readyForReading,
  5848. int timeoutMsecs) const;
  5849. int read (void* destBuffer, int maxBytesToRead,
  5850. bool blockUntilSpecifiedAmountHasArrived);
  5851. int write (const void* sourceBuffer, int numBytesToWrite);
  5852. bool createListener (int portNumber, const String& localHostName = String::empty);
  5853. StreamingSocket* waitForNextConnection() const;
  5854. juce_UseDebuggingNewOperator
  5855. private:
  5856. String hostName;
  5857. int volatile portNumber, handle;
  5858. bool connected, isListener;
  5859. StreamingSocket (const String& hostname, int portNumber, int handle);
  5860. StreamingSocket (const StreamingSocket&);
  5861. StreamingSocket& operator= (const StreamingSocket&);
  5862. };
  5863. class JUCE_API DatagramSocket
  5864. {
  5865. public:
  5866. DatagramSocket (int localPortNumber,
  5867. bool enableBroadcasting = false);
  5868. ~DatagramSocket();
  5869. bool bindToPort (int localPortNumber);
  5870. bool connect (const String& remoteHostname,
  5871. int remotePortNumber,
  5872. int timeOutMillisecs = 3000);
  5873. bool isConnected() const throw() { return connected; }
  5874. void close();
  5875. const String& getHostName() const throw() { return hostName; }
  5876. int getPort() const throw() { return portNumber; }
  5877. bool isLocal() const throw();
  5878. int waitUntilReady (bool readyForReading,
  5879. int timeoutMsecs) const;
  5880. int read (void* destBuffer, int maxBytesToRead,
  5881. bool blockUntilSpecifiedAmountHasArrived);
  5882. int write (const void* sourceBuffer, int numBytesToWrite);
  5883. DatagramSocket* waitForNextConnection() const;
  5884. juce_UseDebuggingNewOperator
  5885. private:
  5886. String hostName;
  5887. int volatile portNumber, handle;
  5888. bool connected, allowBroadcast;
  5889. void* serverAddress;
  5890. DatagramSocket (const String& hostname, int portNumber, int handle, int localPortNumber);
  5891. DatagramSocket (const DatagramSocket&);
  5892. DatagramSocket& operator= (const DatagramSocket&);
  5893. };
  5894. #endif // __JUCE_SOCKET_JUCEHEADER__
  5895. /*** End of inlined file: juce_Socket.h ***/
  5896. #endif
  5897. #ifndef __JUCE_URL_JUCEHEADER__
  5898. /*** Start of inlined file: juce_URL.h ***/
  5899. #ifndef __JUCE_URL_JUCEHEADER__
  5900. #define __JUCE_URL_JUCEHEADER__
  5901. class JUCE_API URL
  5902. {
  5903. public:
  5904. URL();
  5905. URL (const String& url);
  5906. URL (const URL& other);
  5907. ~URL();
  5908. URL& operator= (const URL& other);
  5909. const String toString (bool includeGetParameters) const;
  5910. bool isWellFormed() const;
  5911. const String getDomain() const;
  5912. const String getSubPath() const;
  5913. const String getScheme() const;
  5914. const URL withNewSubPath (const String& newPath) const;
  5915. const URL withParameter (const String& parameterName,
  5916. const String& parameterValue) const;
  5917. const URL withFileToUpload (const String& parameterName,
  5918. const File& fileToUpload,
  5919. const String& mimeType) const;
  5920. const StringPairArray& getParameters() const;
  5921. const StringPairArray& getFilesToUpload() const;
  5922. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5923. const URL withPOSTData (const String& postData) const;
  5924. const String getPostData() const { return postData; }
  5925. bool launchInDefaultBrowser() const;
  5926. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5927. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5928. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5929. InputStream* createInputStream (bool usePostCommand,
  5930. OpenStreamProgressCallback* progressCallback = 0,
  5931. void* progressCallbackContext = 0,
  5932. const String& extraHeaders = String::empty,
  5933. int connectionTimeOutMs = 0) const;
  5934. bool readEntireBinaryStream (MemoryBlock& destData,
  5935. bool usePostCommand = false) const;
  5936. const String readEntireTextStream (bool usePostCommand = false) const;
  5937. XmlElement* readEntireXmlStream (bool usePostCommand = false) const;
  5938. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5939. bool isParameter);
  5940. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5941. juce_UseDebuggingNewOperator
  5942. private:
  5943. String url, postData;
  5944. StringPairArray parameters, filesToUpload, mimeTypes;
  5945. };
  5946. #endif // __JUCE_URL_JUCEHEADER__
  5947. /*** End of inlined file: juce_URL.h ***/
  5948. #endif
  5949. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5950. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5951. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5952. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5953. class JUCE_API BufferedInputStream : public InputStream
  5954. {
  5955. public:
  5956. BufferedInputStream (InputStream* sourceStream,
  5957. int bufferSize,
  5958. bool deleteSourceWhenDestroyed);
  5959. ~BufferedInputStream();
  5960. int64 getTotalLength();
  5961. int64 getPosition();
  5962. bool setPosition (int64 newPosition);
  5963. int read (void* destBuffer, int maxBytesToRead);
  5964. const String readString();
  5965. bool isExhausted();
  5966. juce_UseDebuggingNewOperator
  5967. private:
  5968. InputStream* const source;
  5969. ScopedPointer <InputStream> sourceToDelete;
  5970. int bufferSize;
  5971. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5972. HeapBlock <char> buffer;
  5973. void ensureBuffered();
  5974. BufferedInputStream (const BufferedInputStream&);
  5975. BufferedInputStream& operator= (const BufferedInputStream&);
  5976. };
  5977. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5978. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5979. #endif
  5980. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5981. /*** Start of inlined file: juce_FileInputSource.h ***/
  5982. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5983. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5984. class JUCE_API FileInputSource : public InputSource
  5985. {
  5986. public:
  5987. FileInputSource (const File& file);
  5988. ~FileInputSource();
  5989. InputStream* createInputStream();
  5990. InputStream* createInputStreamFor (const String& relatedItemPath);
  5991. int64 hashCode() const;
  5992. juce_UseDebuggingNewOperator
  5993. private:
  5994. const File file;
  5995. FileInputSource (const FileInputSource&);
  5996. FileInputSource& operator= (const FileInputSource&);
  5997. };
  5998. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5999. /*** End of inlined file: juce_FileInputSource.h ***/
  6000. #endif
  6001. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6002. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6003. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6004. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6005. class GZIPCompressorHelper;
  6006. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  6007. {
  6008. public:
  6009. GZIPCompressorOutputStream (OutputStream* destStream,
  6010. int compressionLevel = 0,
  6011. bool deleteDestStreamWhenDestroyed = false,
  6012. bool noWrap = false);
  6013. ~GZIPCompressorOutputStream();
  6014. void flush();
  6015. int64 getPosition();
  6016. bool setPosition (int64 newPosition);
  6017. bool write (const void* destBuffer, int howMany);
  6018. juce_UseDebuggingNewOperator
  6019. private:
  6020. OutputStream* const destStream;
  6021. ScopedPointer <OutputStream> streamToDelete;
  6022. HeapBlock <uint8> buffer;
  6023. ScopedPointer <GZIPCompressorHelper> helper;
  6024. bool doNextBlock();
  6025. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  6026. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  6027. };
  6028. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  6029. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  6030. #endif
  6031. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6032. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6033. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6034. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6035. class GZIPDecompressHelper;
  6036. class JUCE_API GZIPDecompressorInputStream : public InputStream
  6037. {
  6038. public:
  6039. GZIPDecompressorInputStream (InputStream* sourceStream,
  6040. bool deleteSourceWhenDestroyed,
  6041. bool noWrap = false,
  6042. int64 uncompressedStreamLength = -1);
  6043. ~GZIPDecompressorInputStream();
  6044. int64 getPosition();
  6045. bool setPosition (int64 pos);
  6046. int64 getTotalLength();
  6047. bool isExhausted();
  6048. int read (void* destBuffer, int maxBytesToRead);
  6049. juce_UseDebuggingNewOperator
  6050. private:
  6051. InputStream* const sourceStream;
  6052. ScopedPointer <InputStream> streamToDelete;
  6053. const int64 uncompressedStreamLength;
  6054. const bool noWrap;
  6055. bool isEof;
  6056. int activeBufferSize;
  6057. int64 originalSourcePos, currentPos;
  6058. HeapBlock <uint8> buffer;
  6059. ScopedPointer <GZIPDecompressHelper> helper;
  6060. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  6061. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  6062. };
  6063. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  6064. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  6065. #endif
  6066. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  6067. #endif
  6068. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  6069. #endif
  6070. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6071. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  6072. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6073. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6074. class JUCE_API MemoryInputStream : public InputStream
  6075. {
  6076. public:
  6077. MemoryInputStream (const void* sourceData,
  6078. size_t sourceDataSize,
  6079. bool keepInternalCopyOfData);
  6080. MemoryInputStream (const MemoryBlock& data,
  6081. bool keepInternalCopyOfData);
  6082. ~MemoryInputStream();
  6083. int64 getPosition();
  6084. bool setPosition (int64 pos);
  6085. int64 getTotalLength();
  6086. bool isExhausted();
  6087. int read (void* destBuffer, int maxBytesToRead);
  6088. juce_UseDebuggingNewOperator
  6089. private:
  6090. const char* data;
  6091. size_t dataSize, position;
  6092. MemoryBlock internalCopy;
  6093. MemoryInputStream (const MemoryInputStream&);
  6094. MemoryInputStream& operator= (const MemoryInputStream&);
  6095. };
  6096. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  6097. /*** End of inlined file: juce_MemoryInputStream.h ***/
  6098. #endif
  6099. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6100. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  6101. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6102. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6103. class JUCE_API MemoryOutputStream : public OutputStream
  6104. {
  6105. public:
  6106. MemoryOutputStream (size_t initialSize = 256,
  6107. size_t granularity = 256,
  6108. MemoryBlock* memoryBlockToWriteTo = 0);
  6109. ~MemoryOutputStream();
  6110. const char* getData() const throw();
  6111. size_t getDataSize() const throw() { return size; }
  6112. void reset() throw();
  6113. const String toUTF8() const;
  6114. void flush();
  6115. bool write (const void* buffer, int howMany);
  6116. int64 getPosition() { return position; }
  6117. bool setPosition (int64 newPosition);
  6118. juce_UseDebuggingNewOperator
  6119. private:
  6120. MemoryBlock* data;
  6121. ScopedPointer <MemoryBlock> dataToDelete;
  6122. size_t position, size, blockSize;
  6123. MemoryOutputStream (const MemoryOutputStream&);
  6124. MemoryOutputStream& operator= (const MemoryOutputStream&);
  6125. };
  6126. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  6127. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  6128. #endif
  6129. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  6130. #endif
  6131. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6132. /*** Start of inlined file: juce_SubregionStream.h ***/
  6133. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6134. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6135. class JUCE_API SubregionStream : public InputStream
  6136. {
  6137. public:
  6138. SubregionStream (InputStream* sourceStream,
  6139. int64 startPositionInSourceStream,
  6140. int64 lengthOfSourceStream,
  6141. bool deleteSourceWhenDestroyed) throw();
  6142. ~SubregionStream() throw();
  6143. int64 getTotalLength();
  6144. int64 getPosition();
  6145. bool setPosition (int64 newPosition);
  6146. int read (void* destBuffer, int maxBytesToRead);
  6147. bool isExhausted();
  6148. juce_UseDebuggingNewOperator
  6149. private:
  6150. InputStream* const source;
  6151. ScopedPointer <InputStream> sourceToDelete;
  6152. const int64 startPositionInSourceStream, lengthOfSourceStream;
  6153. SubregionStream (const SubregionStream&);
  6154. SubregionStream& operator= (const SubregionStream&);
  6155. };
  6156. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  6157. /*** End of inlined file: juce_SubregionStream.h ***/
  6158. #endif
  6159. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  6160. #endif
  6161. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6162. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  6163. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6164. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6165. #define TRANS(stringLiteral) \
  6166. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  6167. class JUCE_API LocalisedStrings
  6168. {
  6169. public:
  6170. LocalisedStrings (const String& fileContents);
  6171. LocalisedStrings (const File& fileToLoad);
  6172. ~LocalisedStrings();
  6173. static void setCurrentMappings (LocalisedStrings* newTranslations);
  6174. static LocalisedStrings* getCurrentMappings();
  6175. static const String translateWithCurrentMappings (const String& text);
  6176. static const String translateWithCurrentMappings (const char* text);
  6177. const String translate (const String& text) const;
  6178. const String getLanguageName() const { return languageName; }
  6179. const StringArray getCountryCodes() const { return countryCodes; }
  6180. void setIgnoresCase (const bool shouldIgnoreCase);
  6181. juce_UseDebuggingNewOperator
  6182. private:
  6183. String languageName;
  6184. StringArray countryCodes;
  6185. StringPairArray translations;
  6186. void loadFromText (const String& fileContents);
  6187. };
  6188. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  6189. /*** End of inlined file: juce_LocalisedStrings.h ***/
  6190. #endif
  6191. #ifndef __JUCE_STRING_JUCEHEADER__
  6192. #endif
  6193. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  6194. #endif
  6195. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  6196. #endif
  6197. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6198. /*** Start of inlined file: juce_XmlDocument.h ***/
  6199. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  6200. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  6201. class JUCE_API XmlDocument
  6202. {
  6203. public:
  6204. XmlDocument (const String& documentText);
  6205. XmlDocument (const File& file);
  6206. ~XmlDocument();
  6207. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  6208. const String& getLastParseError() const throw();
  6209. void setInputSource (InputSource* const newSource) throw();
  6210. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  6211. juce_UseDebuggingNewOperator
  6212. private:
  6213. String originalText;
  6214. const juce_wchar* input;
  6215. bool outOfData, errorOccurred;
  6216. bool identifierLookupTable [128];
  6217. String lastError, dtdText;
  6218. StringArray tokenisedDTD;
  6219. bool needToLoadDTD, ignoreEmptyTextElements;
  6220. ScopedPointer <InputSource> inputSource;
  6221. void setLastError (const String& desc, const bool carryOn);
  6222. void skipHeader();
  6223. void skipNextWhiteSpace();
  6224. juce_wchar readNextChar() throw();
  6225. XmlElement* readNextElement (const bool alsoParseSubElements);
  6226. void readChildElements (XmlElement* parent);
  6227. int findNextTokenLength() throw();
  6228. void readQuotedString (String& result);
  6229. void readEntity (String& result);
  6230. static bool isXmlIdentifierCharSlow (juce_wchar c) throw();
  6231. bool isXmlIdentifierChar (juce_wchar c) const throw();
  6232. const String getFileContents (const String& filename) const;
  6233. const String expandEntity (const String& entity);
  6234. const String expandExternalEntity (const String& entity);
  6235. const String getParameterEntity (const String& entity);
  6236. XmlDocument (const XmlDocument&);
  6237. XmlDocument& operator= (const XmlDocument&);
  6238. };
  6239. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6240. /*** End of inlined file: juce_XmlDocument.h ***/
  6241. #endif
  6242. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6243. #endif
  6244. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6245. #endif
  6246. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6247. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6248. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6249. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6250. class JUCE_API InterProcessLock
  6251. {
  6252. public:
  6253. explicit InterProcessLock (const String& name);
  6254. ~InterProcessLock();
  6255. bool enter (int timeOutMillisecs = -1);
  6256. void exit();
  6257. class ScopedLockType
  6258. {
  6259. public:
  6260. explicit ScopedLockType (InterProcessLock& lock) : lock_ (lock) { lockWasSuccessful = lock.enter(); }
  6261. inline ~ScopedLockType() { lock_.exit(); }
  6262. bool isLocked() const throw() { return lockWasSuccessful; }
  6263. private:
  6264. InterProcessLock& lock_;
  6265. bool lockWasSuccessful;
  6266. ScopedLockType (const ScopedLockType&);
  6267. ScopedLockType& operator= (const ScopedLockType&);
  6268. };
  6269. juce_UseDebuggingNewOperator
  6270. private:
  6271. class Pimpl;
  6272. friend class ScopedPointer <Pimpl>;
  6273. ScopedPointer <Pimpl> pimpl;
  6274. CriticalSection lock;
  6275. String name;
  6276. InterProcessLock (const InterProcessLock&);
  6277. InterProcessLock& operator= (const InterProcessLock&);
  6278. };
  6279. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6280. /*** End of inlined file: juce_InterProcessLock.h ***/
  6281. #endif
  6282. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6283. /*** Start of inlined file: juce_Process.h ***/
  6284. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6285. #define __JUCE_PROCESS_JUCEHEADER__
  6286. class JUCE_API Process
  6287. {
  6288. public:
  6289. enum ProcessPriority
  6290. {
  6291. LowPriority = 0,
  6292. NormalPriority = 1,
  6293. HighPriority = 2,
  6294. RealtimePriority = 3
  6295. };
  6296. static void setPriority (const ProcessPriority priority);
  6297. static void terminate();
  6298. static bool isForegroundProcess();
  6299. static void raisePrivilege();
  6300. static void lowerPrivilege();
  6301. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6302. private:
  6303. Process();
  6304. Process (const Process&);
  6305. Process& operator= (const Process&);
  6306. };
  6307. #endif // __JUCE_PROCESS_JUCEHEADER__
  6308. /*** End of inlined file: juce_Process.h ***/
  6309. #endif
  6310. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6311. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6312. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6313. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6314. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6315. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6316. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6317. class JUCE_API WaitableEvent
  6318. {
  6319. public:
  6320. WaitableEvent (bool manualReset = false) throw();
  6321. ~WaitableEvent() throw();
  6322. bool wait (int timeOutMilliseconds = -1) const throw();
  6323. void signal() const throw();
  6324. void reset() const throw();
  6325. juce_UseDebuggingNewOperator
  6326. private:
  6327. void* internal;
  6328. WaitableEvent (const WaitableEvent&);
  6329. WaitableEvent& operator= (const WaitableEvent&);
  6330. };
  6331. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6332. /*** End of inlined file: juce_WaitableEvent.h ***/
  6333. /*** Start of inlined file: juce_Thread.h ***/
  6334. #ifndef __JUCE_THREAD_JUCEHEADER__
  6335. #define __JUCE_THREAD_JUCEHEADER__
  6336. class JUCE_API Thread
  6337. {
  6338. public:
  6339. explicit Thread (const String& threadName);
  6340. virtual ~Thread();
  6341. virtual void run() = 0;
  6342. // Thread control functions..
  6343. void startThread();
  6344. void startThread (int priority);
  6345. void stopThread (int timeOutMilliseconds);
  6346. bool isThreadRunning() const;
  6347. void signalThreadShouldExit();
  6348. inline bool threadShouldExit() const { return threadShouldExit_; }
  6349. bool waitForThreadToExit (int timeOutMilliseconds) const;
  6350. bool setPriority (int priority);
  6351. static bool setCurrentThreadPriority (int priority);
  6352. void setAffinityMask (uint32 affinityMask);
  6353. static void setCurrentThreadAffinityMask (uint32 affinityMask);
  6354. // this can be called from any thread that needs to pause..
  6355. static void JUCE_CALLTYPE sleep (int milliseconds);
  6356. static void JUCE_CALLTYPE yield();
  6357. bool wait (int timeOutMilliseconds) const;
  6358. void notify() const;
  6359. typedef void* ThreadID;
  6360. static ThreadID getCurrentThreadId();
  6361. static Thread* getCurrentThread();
  6362. ThreadID getThreadId() const throw() { return threadId_; }
  6363. const String getThreadName() const { return threadName_; }
  6364. static int getNumRunningThreads();
  6365. static void stopAllThreads (int timeoutInMillisecs);
  6366. juce_UseDebuggingNewOperator
  6367. private:
  6368. const String threadName_;
  6369. void* volatile threadHandle_;
  6370. CriticalSection startStopLock;
  6371. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6372. int threadPriority_;
  6373. ThreadID threadId_;
  6374. uint32 affinityMask_;
  6375. bool volatile threadShouldExit_;
  6376. friend void JUCE_API juce_threadEntryPoint (void*);
  6377. static void threadEntryPoint (Thread* thread);
  6378. static Array<Thread*> runningThreads;
  6379. static CriticalSection runningThreadsLock;
  6380. Thread (const Thread&);
  6381. Thread& operator= (const Thread&);
  6382. };
  6383. #endif // __JUCE_THREAD_JUCEHEADER__
  6384. /*** End of inlined file: juce_Thread.h ***/
  6385. class JUCE_API ReadWriteLock
  6386. {
  6387. public:
  6388. ReadWriteLock() throw();
  6389. ~ReadWriteLock() throw();
  6390. void enterRead() const throw();
  6391. void exitRead() const throw();
  6392. void enterWrite() const throw();
  6393. bool tryEnterWrite() const throw();
  6394. void exitWrite() const throw();
  6395. juce_UseDebuggingNewOperator
  6396. private:
  6397. CriticalSection accessLock;
  6398. WaitableEvent waitEvent;
  6399. mutable int numWaitingWriters, numWriters;
  6400. mutable Thread::ThreadID writerThreadId;
  6401. mutable Array <Thread::ThreadID> readerThreads;
  6402. ReadWriteLock (const ReadWriteLock&);
  6403. ReadWriteLock& operator= (const ReadWriteLock&);
  6404. };
  6405. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6406. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6407. #endif
  6408. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6409. #endif
  6410. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6411. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6412. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6413. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6414. class JUCE_API ScopedReadLock
  6415. {
  6416. public:
  6417. inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6418. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6419. private:
  6420. const ReadWriteLock& lock_;
  6421. ScopedReadLock (const ScopedReadLock&);
  6422. ScopedReadLock& operator= (const ScopedReadLock&);
  6423. };
  6424. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6425. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6426. #endif
  6427. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6428. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6429. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6430. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6431. class JUCE_API ScopedTryLock
  6432. {
  6433. public:
  6434. inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6435. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6436. bool isLocked() const throw() { return lockWasSuccessful; }
  6437. private:
  6438. const CriticalSection& lock_;
  6439. const bool lockWasSuccessful;
  6440. ScopedTryLock (const ScopedTryLock&);
  6441. ScopedTryLock& operator= (const ScopedTryLock&);
  6442. };
  6443. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6444. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6445. #endif
  6446. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6447. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6448. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6449. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6450. class JUCE_API ScopedWriteLock
  6451. {
  6452. public:
  6453. inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6454. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6455. private:
  6456. const ReadWriteLock& lock_;
  6457. ScopedWriteLock (const ScopedWriteLock&);
  6458. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6459. };
  6460. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6461. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6462. #endif
  6463. #ifndef __JUCE_THREAD_JUCEHEADER__
  6464. #endif
  6465. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6466. /*** Start of inlined file: juce_ThreadPool.h ***/
  6467. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6468. #define __JUCE_THREADPOOL_JUCEHEADER__
  6469. class ThreadPool;
  6470. class ThreadPoolThread;
  6471. class JUCE_API ThreadPoolJob
  6472. {
  6473. public:
  6474. explicit ThreadPoolJob (const String& name);
  6475. virtual ~ThreadPoolJob();
  6476. const String getJobName() const;
  6477. void setJobName (const String& newName);
  6478. enum JobStatus
  6479. {
  6480. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6481. removed from the pool. */
  6482. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6483. should be automatically deleted by the pool. */
  6484. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6485. again when a thread is free. */
  6486. };
  6487. virtual JobStatus runJob() = 0;
  6488. bool isRunning() const { return isActive; }
  6489. bool shouldExit() const { return shouldStop; }
  6490. void signalJobShouldExit();
  6491. juce_UseDebuggingNewOperator
  6492. private:
  6493. friend class ThreadPool;
  6494. friend class ThreadPoolThread;
  6495. String jobName;
  6496. ThreadPool* pool;
  6497. bool shouldStop, isActive, shouldBeDeleted;
  6498. ThreadPoolJob (const ThreadPoolJob&);
  6499. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6500. };
  6501. class JUCE_API ThreadPool
  6502. {
  6503. public:
  6504. ThreadPool (int numberOfThreads,
  6505. bool startThreadsOnlyWhenNeeded = true,
  6506. int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6507. ~ThreadPool();
  6508. class JUCE_API JobSelector
  6509. {
  6510. public:
  6511. virtual ~JobSelector() {}
  6512. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6513. };
  6514. void addJob (ThreadPoolJob* job);
  6515. bool removeJob (ThreadPoolJob* job,
  6516. bool interruptIfRunning,
  6517. int timeOutMilliseconds);
  6518. bool removeAllJobs (bool interruptRunningJobs,
  6519. int timeOutMilliseconds,
  6520. bool deleteInactiveJobs = false,
  6521. JobSelector* selectedJobsToRemove = 0);
  6522. int getNumJobs() const;
  6523. ThreadPoolJob* getJob (int index) const;
  6524. bool contains (const ThreadPoolJob* job) const;
  6525. bool isJobRunning (const ThreadPoolJob* job) const;
  6526. bool waitForJobToFinish (const ThreadPoolJob* job,
  6527. int timeOutMilliseconds) const;
  6528. const StringArray getNamesOfAllJobs (bool onlyReturnActiveJobs) const;
  6529. bool setThreadPriorities (int newPriority);
  6530. juce_UseDebuggingNewOperator
  6531. private:
  6532. const int threadStopTimeout;
  6533. int priority;
  6534. class ThreadPoolThread;
  6535. OwnedArray <ThreadPoolThread> threads;
  6536. Array <ThreadPoolJob*> jobs;
  6537. CriticalSection lock;
  6538. uint32 lastJobEndTime;
  6539. WaitableEvent jobFinishedSignal;
  6540. friend class ThreadPoolThread;
  6541. bool runNextJob();
  6542. ThreadPool (const ThreadPool&);
  6543. ThreadPool& operator= (const ThreadPool&);
  6544. };
  6545. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6546. /*** End of inlined file: juce_ThreadPool.h ***/
  6547. #endif
  6548. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6549. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6550. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6551. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6552. class JUCE_API TimeSliceClient
  6553. {
  6554. public:
  6555. virtual ~TimeSliceClient() {}
  6556. virtual bool useTimeSlice() = 0;
  6557. };
  6558. class JUCE_API TimeSliceThread : public Thread
  6559. {
  6560. public:
  6561. explicit TimeSliceThread (const String& threadName);
  6562. ~TimeSliceThread();
  6563. void addTimeSliceClient (TimeSliceClient* client);
  6564. void removeTimeSliceClient (TimeSliceClient* client);
  6565. int getNumClients() const;
  6566. TimeSliceClient* getClient (int index) const;
  6567. void run();
  6568. juce_UseDebuggingNewOperator
  6569. private:
  6570. CriticalSection callbackLock, listLock;
  6571. Array <TimeSliceClient*> clients;
  6572. int index;
  6573. TimeSliceClient* clientBeingCalled;
  6574. bool clientsChanged;
  6575. TimeSliceThread (const TimeSliceThread&);
  6576. TimeSliceThread& operator= (const TimeSliceThread&);
  6577. };
  6578. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6579. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6580. #endif
  6581. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6582. #endif
  6583. #endif
  6584. /*** End of inlined file: juce_core_includes.h ***/
  6585. // if you're compiling a command-line app, you might want to just include the core headers,
  6586. // so you can set this macro before including juce.h
  6587. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6588. /*** Start of inlined file: juce_app_includes.h ***/
  6589. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6590. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6591. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6592. /*** Start of inlined file: juce_Application.h ***/
  6593. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6594. #define __JUCE_APPLICATION_JUCEHEADER__
  6595. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6596. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6597. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6598. /*** Start of inlined file: juce_Component.h ***/
  6599. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6600. #define __JUCE_COMPONENT_JUCEHEADER__
  6601. /*** Start of inlined file: juce_MouseCursor.h ***/
  6602. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6603. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6604. class Image;
  6605. class ComponentPeer;
  6606. class Component;
  6607. class JUCE_API MouseCursor
  6608. {
  6609. public:
  6610. enum StandardCursorType
  6611. {
  6612. NoCursor = 0, /**< An invisible cursor. */
  6613. NormalCursor, /**< The stardard arrow cursor. */
  6614. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6615. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6616. CrosshairCursor, /**< A pair of crosshairs. */
  6617. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6618. that you're dragging a copy of something. */
  6619. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6620. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6621. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6622. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6623. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6624. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6625. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6626. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6627. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6628. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6629. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6630. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6631. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6632. };
  6633. MouseCursor();
  6634. MouseCursor (StandardCursorType type);
  6635. MouseCursor (const Image& image, int hotSpotX, int hotSpotY);
  6636. MouseCursor (const MouseCursor& other);
  6637. MouseCursor& operator= (const MouseCursor& other);
  6638. ~MouseCursor();
  6639. bool operator== (const MouseCursor& other) const throw();
  6640. bool operator!= (const MouseCursor& other) const throw();
  6641. static void showWaitCursor() throw();
  6642. static void hideWaitCursor() throw();
  6643. juce_UseDebuggingNewOperator
  6644. private:
  6645. class SharedCursorHandle;
  6646. SharedCursorHandle* cursorHandle;
  6647. friend class MouseInputSourceInternal;
  6648. void showInWindow (ComponentPeer* window) const;
  6649. void showInAllWindows() const;
  6650. void* getHandle() const throw();
  6651. };
  6652. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6653. /*** End of inlined file: juce_MouseCursor.h ***/
  6654. /*** Start of inlined file: juce_MouseListener.h ***/
  6655. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6656. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6657. class MouseEvent;
  6658. class JUCE_API MouseListener
  6659. {
  6660. public:
  6661. virtual ~MouseListener() {}
  6662. virtual void mouseMove (const MouseEvent& e);
  6663. virtual void mouseEnter (const MouseEvent& e);
  6664. virtual void mouseExit (const MouseEvent& e);
  6665. virtual void mouseDown (const MouseEvent& e);
  6666. virtual void mouseDrag (const MouseEvent& e);
  6667. virtual void mouseUp (const MouseEvent& e);
  6668. virtual void mouseDoubleClick (const MouseEvent& e);
  6669. virtual void mouseWheelMove (const MouseEvent& e,
  6670. float wheelIncrementX,
  6671. float wheelIncrementY);
  6672. };
  6673. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6674. /*** End of inlined file: juce_MouseListener.h ***/
  6675. /*** Start of inlined file: juce_MouseEvent.h ***/
  6676. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6677. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6678. class Component;
  6679. class MouseInputSource;
  6680. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6681. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6682. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6683. class JUCE_API ModifierKeys
  6684. {
  6685. public:
  6686. ModifierKeys (int flags = 0) throw();
  6687. ModifierKeys (const ModifierKeys& other) throw();
  6688. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6689. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6690. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6691. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6692. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6693. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6694. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6695. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6696. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6697. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6698. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6699. enum Flags
  6700. {
  6701. shiftModifier = 1,
  6702. ctrlModifier = 2,
  6703. altModifier = 4,
  6704. leftButtonModifier = 16,
  6705. rightButtonModifier = 32,
  6706. middleButtonModifier = 64,
  6707. #if JUCE_MAC
  6708. commandModifier = 8,
  6709. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6710. #else
  6711. commandModifier = ctrlModifier,
  6712. popupMenuClickModifier = rightButtonModifier,
  6713. #endif
  6714. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6715. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6716. };
  6717. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6718. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6719. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6720. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6721. inline int getRawFlags() const throw() { return flags; }
  6722. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6723. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6724. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6725. int getNumMouseButtonsDown() const throw();
  6726. static const ModifierKeys getCurrentModifiers() throw();
  6727. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6728. private:
  6729. int flags;
  6730. static ModifierKeys currentModifiers;
  6731. friend class ComponentPeer;
  6732. friend class MouseInputSource;
  6733. friend class MouseInputSourceInternal;
  6734. static void updateCurrentModifiers() throw();
  6735. };
  6736. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6737. /*** End of inlined file: juce_ModifierKeys.h ***/
  6738. /*** Start of inlined file: juce_Point.h ***/
  6739. #ifndef __JUCE_POINT_JUCEHEADER__
  6740. #define __JUCE_POINT_JUCEHEADER__
  6741. /*** Start of inlined file: juce_AffineTransform.h ***/
  6742. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6743. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6744. class JUCE_API AffineTransform
  6745. {
  6746. public:
  6747. AffineTransform() throw();
  6748. AffineTransform (const AffineTransform& other) throw();
  6749. AffineTransform (const float mat00, const float mat01, const float mat02,
  6750. const float mat10, const float mat11, const float mat12) throw();
  6751. AffineTransform& operator= (const AffineTransform& other) throw();
  6752. bool operator== (const AffineTransform& other) const throw();
  6753. bool operator!= (const AffineTransform& other) const throw();
  6754. static const AffineTransform identity;
  6755. void transformPoint (float& x,
  6756. float& y) const throw();
  6757. void transformPoint (double& x,
  6758. double& y) const throw();
  6759. const AffineTransform translated (const float deltaX,
  6760. const float deltaY) const throw();
  6761. static const AffineTransform translation (const float deltaX,
  6762. const float deltaY) throw();
  6763. const AffineTransform rotated (const float angleInRadians) const throw();
  6764. const AffineTransform rotated (const float angleInRadians,
  6765. const float pivotX,
  6766. const float pivotY) const throw();
  6767. static const AffineTransform rotation (const float angleInRadians) throw();
  6768. static const AffineTransform rotation (const float angleInRadians,
  6769. const float pivotX,
  6770. const float pivotY) throw();
  6771. const AffineTransform scaled (const float factorX,
  6772. const float factorY) const throw();
  6773. static const AffineTransform scale (const float factorX,
  6774. const float factorY) throw();
  6775. const AffineTransform sheared (const float shearX,
  6776. const float shearY) const throw();
  6777. const AffineTransform inverted() const throw();
  6778. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6779. bool isIdentity() const throw();
  6780. bool isSingularity() const throw();
  6781. bool isOnlyTranslation() const throw();
  6782. float getTranslationX() const throw() { return mat02; }
  6783. float getTranslationY() const throw() { return mat12; }
  6784. juce_UseDebuggingNewOperator
  6785. float mat00, mat01, mat02;
  6786. float mat10, mat11, mat12;
  6787. private:
  6788. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6789. const float mat10, const float mat11, const float mat12) const throw();
  6790. };
  6791. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6792. /*** End of inlined file: juce_AffineTransform.h ***/
  6793. template <typename ValueType>
  6794. class Point
  6795. {
  6796. public:
  6797. Point() throw() : x (0), y (0) {}
  6798. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6799. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6800. ~Point() throw() {}
  6801. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6802. inline ValueType getX() const throw() { return x; }
  6803. inline ValueType getY() const throw() { return y; }
  6804. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6805. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6806. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6807. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6808. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6809. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6810. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6811. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6812. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6813. const Point operator-() const throw() { return Point (-x, -y); }
  6814. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6815. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6816. const String toString() const { return String (x) + ", " + String (y); }
  6817. juce_UseDebuggingNewOperator
  6818. private:
  6819. ValueType x, y;
  6820. };
  6821. #endif // __JUCE_POINT_JUCEHEADER__
  6822. /*** End of inlined file: juce_Point.h ***/
  6823. class JUCE_API MouseEvent
  6824. {
  6825. public:
  6826. MouseEvent (MouseInputSource& source,
  6827. const Point<int>& position,
  6828. const ModifierKeys& modifiers,
  6829. Component* originator,
  6830. const Time& eventTime,
  6831. const Point<int> mouseDownPos,
  6832. const Time& mouseDownTime,
  6833. int numberOfClicks,
  6834. bool mouseWasDragged) throw();
  6835. ~MouseEvent() throw();
  6836. const int x;
  6837. const int y;
  6838. const ModifierKeys mods;
  6839. Component* const eventComponent;
  6840. Component* const originalComponent;
  6841. const Time eventTime;
  6842. MouseInputSource& source;
  6843. int getMouseDownX() const throw();
  6844. int getMouseDownY() const throw();
  6845. const Point<int> getMouseDownPosition() const throw();
  6846. int getDistanceFromDragStart() const throw();
  6847. int getDistanceFromDragStartX() const throw();
  6848. int getDistanceFromDragStartY() const throw();
  6849. const Point<int> getOffsetFromDragStart() const throw();
  6850. bool mouseWasClicked() const throw();
  6851. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6852. int getLengthOfMousePress() const throw();
  6853. const Point<int> getPosition() const throw();
  6854. int getScreenX() const;
  6855. int getScreenY() const;
  6856. const Point<int> getScreenPosition() const;
  6857. int getMouseDownScreenX() const;
  6858. int getMouseDownScreenY() const;
  6859. const Point<int> getMouseDownScreenPosition() const;
  6860. const MouseEvent getEventRelativeTo (Component* otherComponent) const throw();
  6861. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6862. static void setDoubleClickTimeout (int timeOutMilliseconds) throw();
  6863. static int getDoubleClickTimeout() throw();
  6864. juce_UseDebuggingNewOperator
  6865. private:
  6866. const Point<int> mouseDownPos;
  6867. const Time mouseDownTime;
  6868. const int numberOfClicks;
  6869. const bool wasMovedSinceMouseDown;
  6870. MouseEvent& operator= (const MouseEvent&);
  6871. };
  6872. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6873. /*** End of inlined file: juce_MouseEvent.h ***/
  6874. /*** Start of inlined file: juce_ComponentListener.h ***/
  6875. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6876. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6877. class Component;
  6878. class JUCE_API ComponentListener
  6879. {
  6880. public:
  6881. virtual ~ComponentListener() {}
  6882. virtual void componentMovedOrResized (Component& component,
  6883. bool wasMoved,
  6884. bool wasResized);
  6885. virtual void componentBroughtToFront (Component& component);
  6886. virtual void componentVisibilityChanged (Component& component);
  6887. virtual void componentChildrenChanged (Component& component);
  6888. virtual void componentParentHierarchyChanged (Component& component);
  6889. virtual void componentNameChanged (Component& component);
  6890. virtual void componentBeingDeleted (Component& component);
  6891. };
  6892. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6893. /*** End of inlined file: juce_ComponentListener.h ***/
  6894. /*** Start of inlined file: juce_KeyListener.h ***/
  6895. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6896. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6897. /*** Start of inlined file: juce_KeyPress.h ***/
  6898. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6899. #define __JUCE_KEYPRESS_JUCEHEADER__
  6900. class JUCE_API KeyPress
  6901. {
  6902. public:
  6903. KeyPress() throw();
  6904. KeyPress (int keyCode,
  6905. const ModifierKeys& modifiers,
  6906. juce_wchar textCharacter) throw();
  6907. KeyPress (int keyCode) throw();
  6908. KeyPress (const KeyPress& other) throw();
  6909. KeyPress& operator= (const KeyPress& other) throw();
  6910. bool operator== (const KeyPress& other) const throw();
  6911. bool operator!= (const KeyPress& other) const throw();
  6912. bool isValid() const throw() { return keyCode != 0; }
  6913. int getKeyCode() const throw() { return keyCode; }
  6914. const ModifierKeys getModifiers() const throw() { return mods; }
  6915. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6916. bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6917. static const KeyPress createFromDescription (const String& textVersion);
  6918. const String getTextDescription() const;
  6919. bool isCurrentlyDown() const;
  6920. static bool isKeyCurrentlyDown (int keyCode);
  6921. // Key codes
  6922. //
  6923. // Note that the actual values of these are platform-specific and may change
  6924. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6925. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6926. //
  6927. static const int spaceKey; /**< key-code for the space bar */
  6928. static const int escapeKey; /**< key-code for the escape key */
  6929. static const int returnKey; /**< key-code for the return key*/
  6930. static const int tabKey; /**< key-code for the tab key*/
  6931. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6932. static const int backspaceKey; /**< key-code for the backspace key */
  6933. static const int insertKey; /**< key-code for the insert key */
  6934. static const int upKey; /**< key-code for the cursor-up key */
  6935. static const int downKey; /**< key-code for the cursor-down key */
  6936. static const int leftKey; /**< key-code for the cursor-left key */
  6937. static const int rightKey; /**< key-code for the cursor-right key */
  6938. static const int pageUpKey; /**< key-code for the page-up key */
  6939. static const int pageDownKey; /**< key-code for the page-down key */
  6940. static const int homeKey; /**< key-code for the home key */
  6941. static const int endKey; /**< key-code for the end key */
  6942. static const int F1Key; /**< key-code for the F1 key */
  6943. static const int F2Key; /**< key-code for the F2 key */
  6944. static const int F3Key; /**< key-code for the F3 key */
  6945. static const int F4Key; /**< key-code for the F4 key */
  6946. static const int F5Key; /**< key-code for the F5 key */
  6947. static const int F6Key; /**< key-code for the F6 key */
  6948. static const int F7Key; /**< key-code for the F7 key */
  6949. static const int F8Key; /**< key-code for the F8 key */
  6950. static const int F9Key; /**< key-code for the F9 key */
  6951. static const int F10Key; /**< key-code for the F10 key */
  6952. static const int F11Key; /**< key-code for the F11 key */
  6953. static const int F12Key; /**< key-code for the F12 key */
  6954. static const int F13Key; /**< key-code for the F13 key */
  6955. static const int F14Key; /**< key-code for the F14 key */
  6956. static const int F15Key; /**< key-code for the F15 key */
  6957. static const int F16Key; /**< key-code for the F16 key */
  6958. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6959. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6960. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6961. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6962. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6963. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6964. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6965. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6966. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6967. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6968. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6969. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6970. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6971. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6972. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6973. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6974. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6975. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6976. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6977. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6978. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6979. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6980. juce_UseDebuggingNewOperator
  6981. private:
  6982. int keyCode;
  6983. ModifierKeys mods;
  6984. juce_wchar textCharacter;
  6985. };
  6986. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6987. /*** End of inlined file: juce_KeyPress.h ***/
  6988. class Component;
  6989. class JUCE_API KeyListener
  6990. {
  6991. public:
  6992. virtual ~KeyListener() {}
  6993. virtual bool keyPressed (const KeyPress& key,
  6994. Component* originatingComponent) = 0;
  6995. virtual bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  6996. };
  6997. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6998. /*** End of inlined file: juce_KeyListener.h ***/
  6999. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  7000. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7001. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7002. class Component;
  7003. class JUCE_API KeyboardFocusTraverser
  7004. {
  7005. public:
  7006. KeyboardFocusTraverser();
  7007. virtual ~KeyboardFocusTraverser();
  7008. virtual Component* getNextComponent (Component* current);
  7009. virtual Component* getPreviousComponent (Component* current);
  7010. virtual Component* getDefaultComponent (Component* parentComponent);
  7011. };
  7012. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  7013. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  7014. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  7015. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7016. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  7017. /*** Start of inlined file: juce_Graphics.h ***/
  7018. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  7019. #define __JUCE_GRAPHICS_JUCEHEADER__
  7020. /*** Start of inlined file: juce_Font.h ***/
  7021. #ifndef __JUCE_FONT_JUCEHEADER__
  7022. #define __JUCE_FONT_JUCEHEADER__
  7023. /*** Start of inlined file: juce_Typeface.h ***/
  7024. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  7025. #define __JUCE_TYPEFACE_JUCEHEADER__
  7026. /*** Start of inlined file: juce_Path.h ***/
  7027. #ifndef __JUCE_PATH_JUCEHEADER__
  7028. #define __JUCE_PATH_JUCEHEADER__
  7029. /*** Start of inlined file: juce_Rectangle.h ***/
  7030. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  7031. #define __JUCE_RECTANGLE_JUCEHEADER__
  7032. class RectangleList;
  7033. template <typename ValueType>
  7034. class Rectangle
  7035. {
  7036. public:
  7037. Rectangle() throw()
  7038. : x (0), y (0), w (0), h (0)
  7039. {
  7040. }
  7041. Rectangle (const Rectangle& other) throw()
  7042. : x (other.x), y (other.y),
  7043. w (other.w), h (other.h)
  7044. {
  7045. }
  7046. Rectangle (const ValueType initialX, const ValueType initialY,
  7047. const ValueType width, const ValueType height) throw()
  7048. : x (initialX), y (initialY),
  7049. w (width), h (height)
  7050. {
  7051. }
  7052. Rectangle (const ValueType width, const ValueType height) throw()
  7053. : x (0), y (0), w (width), h (height)
  7054. {
  7055. }
  7056. Rectangle (const Point<ValueType>& corner1, const Point<ValueType>& corner2) throw()
  7057. : x (jmin (corner1.getX(), corner2.getX())),
  7058. y (jmin (corner1.getY(), corner2.getY())),
  7059. w (corner1.getX() - corner2.getX()),
  7060. h (corner1.getY() - corner2.getY())
  7061. {
  7062. if (w < 0) w = -w;
  7063. if (h < 0) h = -h;
  7064. }
  7065. Rectangle& operator= (const Rectangle& other) throw()
  7066. {
  7067. x = other.x; y = other.y;
  7068. w = other.w; h = other.h;
  7069. return *this;
  7070. }
  7071. ~Rectangle() throw() {}
  7072. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  7073. inline ValueType getX() const throw() { return x; }
  7074. inline ValueType getY() const throw() { return y; }
  7075. inline ValueType getWidth() const throw() { return w; }
  7076. inline ValueType getHeight() const throw() { return h; }
  7077. inline ValueType getRight() const throw() { return x + w; }
  7078. inline ValueType getBottom() const throw() { return y + h; }
  7079. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  7080. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  7081. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  7082. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  7083. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  7084. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  7085. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  7086. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  7087. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  7088. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  7089. void setBounds (const ValueType newX, const ValueType newY,
  7090. const ValueType newWidth, const ValueType newHeight) throw()
  7091. {
  7092. x = newX; y = newY; w = newWidth; h = newHeight;
  7093. }
  7094. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  7095. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  7096. void setLeft (const ValueType newLeft) throw()
  7097. {
  7098. w = jmax (ValueType(), x + w - newLeft);
  7099. x = newLeft;
  7100. }
  7101. void setTop (const ValueType newTop) throw()
  7102. {
  7103. h = jmax (ValueType(), y + h - newTop);
  7104. y = newTop;
  7105. }
  7106. void setRight (const ValueType newRight) throw()
  7107. {
  7108. x = jmin (x, newRight);
  7109. w = newRight - x;
  7110. }
  7111. void setBottom (const ValueType newBottom) throw()
  7112. {
  7113. y = jmin (y, newBottom);
  7114. h = newBottom - y;
  7115. }
  7116. void translate (const ValueType deltaX,
  7117. const ValueType deltaY) throw()
  7118. {
  7119. x += deltaX;
  7120. y += deltaY;
  7121. }
  7122. const Rectangle translated (const ValueType deltaX,
  7123. const ValueType deltaY) const throw()
  7124. {
  7125. return Rectangle (x + deltaX, y + deltaY, w, h);
  7126. }
  7127. const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
  7128. {
  7129. return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
  7130. }
  7131. const Rectangle operator- (const Point<ValueType>& deltaPosition) const throw()
  7132. {
  7133. return Rectangle (x - deltaPosition.getX(), y - deltaPosition.getY(), w, h);
  7134. }
  7135. void expand (const ValueType deltaX,
  7136. const ValueType deltaY) throw()
  7137. {
  7138. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7139. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7140. setBounds (x - deltaX, y - deltaY, nw, nh);
  7141. }
  7142. const Rectangle expanded (const ValueType deltaX,
  7143. const ValueType deltaY) const throw()
  7144. {
  7145. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  7146. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  7147. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  7148. }
  7149. void reduce (const ValueType deltaX,
  7150. const ValueType deltaY) throw()
  7151. {
  7152. expand (-deltaX, -deltaY);
  7153. }
  7154. const Rectangle reduced (const ValueType deltaX,
  7155. const ValueType deltaY) const throw()
  7156. {
  7157. return expanded (-deltaX, -deltaY);
  7158. }
  7159. bool operator== (const Rectangle& other) const throw()
  7160. {
  7161. return x == other.x && y == other.y
  7162. && w == other.w && h == other.h;
  7163. }
  7164. bool operator!= (const Rectangle& other) const throw()
  7165. {
  7166. return x != other.x || y != other.y
  7167. || w != other.w || h != other.h;
  7168. }
  7169. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  7170. {
  7171. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  7172. }
  7173. bool contains (const Point<ValueType>& point) const throw()
  7174. {
  7175. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  7176. }
  7177. bool contains (const Rectangle& other) const throw()
  7178. {
  7179. return x <= other.x && y <= other.y
  7180. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  7181. }
  7182. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  7183. {
  7184. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  7185. jlimit (y, y + h, point.getY()));
  7186. }
  7187. bool intersects (const Rectangle& other) const throw()
  7188. {
  7189. return x + w > other.x
  7190. && y + h > other.y
  7191. && x < other.x + other.w
  7192. && y < other.y + other.h
  7193. && w > ValueType() && h > ValueType();
  7194. }
  7195. const Rectangle getIntersection (const Rectangle& other) const throw()
  7196. {
  7197. const ValueType nx = jmax (x, other.x);
  7198. const ValueType ny = jmax (y, other.y);
  7199. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  7200. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  7201. if (nw >= ValueType() && nh >= ValueType())
  7202. return Rectangle (nx, ny, nw, nh);
  7203. return Rectangle();
  7204. }
  7205. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  7206. {
  7207. const int maxX = jmax (otherX, x);
  7208. otherW = jmin (otherX + otherW, x + w) - maxX;
  7209. if (otherW > 0)
  7210. {
  7211. const int maxY = jmax (otherY, y);
  7212. otherH = jmin (otherY + otherH, y + h) - maxY;
  7213. if (otherH > 0)
  7214. {
  7215. otherX = maxX; otherY = maxY;
  7216. return true;
  7217. }
  7218. }
  7219. return false;
  7220. }
  7221. const Rectangle getUnion (const Rectangle& other) const throw()
  7222. {
  7223. const ValueType newX = jmin (x, other.x);
  7224. const ValueType newY = jmin (y, other.y);
  7225. return Rectangle (newX, newY,
  7226. jmax (x + w, other.x + other.w) - newX,
  7227. jmax (y + h, other.y + other.h) - newY);
  7228. }
  7229. bool enlargeIfAdjacent (const Rectangle& other) throw()
  7230. {
  7231. if (x == other.x && getRight() == other.getRight()
  7232. && (other.getBottom() >= y && other.y <= getBottom()))
  7233. {
  7234. const ValueType newY = jmin (y, other.y);
  7235. h = jmax (getBottom(), other.getBottom()) - newY;
  7236. y = newY;
  7237. return true;
  7238. }
  7239. else if (y == other.y && getBottom() == other.getBottom()
  7240. && (other.getRight() >= x && other.x <= getRight()))
  7241. {
  7242. const ValueType newX = jmin (x, other.x);
  7243. w = jmax (getRight(), other.getRight()) - newX;
  7244. x = newX;
  7245. return true;
  7246. }
  7247. return false;
  7248. }
  7249. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  7250. {
  7251. int inside = 0;
  7252. const int otherR = other.getRight();
  7253. if (x >= other.x && x < otherR) inside = 1;
  7254. const int otherB = other.getBottom();
  7255. if (y >= other.y && y < otherB) inside |= 2;
  7256. const int r = x + w;
  7257. if (r >= other.x && r < otherR) inside |= 4;
  7258. const int b = y + h;
  7259. if (b >= other.y && b < otherB) inside |= 8;
  7260. switch (inside)
  7261. {
  7262. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  7263. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  7264. case 2 + 4 + 8: w = other.x - x; return true;
  7265. case 1 + 4 + 8: h = other.y - y; return true;
  7266. }
  7267. return false;
  7268. }
  7269. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  7270. {
  7271. float x1 = x, y1 = y;
  7272. float x2 = x + w, y2 = y;
  7273. float x3 = x, y3 = y + h;
  7274. float x4 = x2, y4 = y3;
  7275. transform.transformPoint (x1, y1);
  7276. transform.transformPoint (x2, y2);
  7277. transform.transformPoint (x3, y3);
  7278. transform.transformPoint (x4, y4);
  7279. const float x = jmin (x1, x2, x3, x4);
  7280. const float y = jmin (y1, y2, y3, y4);
  7281. return Rectangle (x, y,
  7282. jmax (x1, x2, x3, x4) - x,
  7283. jmax (y1, y2, y3, y4) - y);
  7284. }
  7285. const Rectangle<int> getSmallestIntegerContainer() const throw()
  7286. {
  7287. const int x1 = (int) floorf ((float) x);
  7288. const int y1 = (int) floorf ((float) y);
  7289. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  7290. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  7291. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  7292. }
  7293. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  7294. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  7295. {
  7296. const ValueType x = jmax (x1, x2);
  7297. w1 = jmin (x1 + w1, x2 + w2) - x;
  7298. if (w1 > 0)
  7299. {
  7300. const ValueType y = jmax (y1, y2);
  7301. h1 = jmin (y1 + h1, y2 + h2) - y;
  7302. if (h1 > 0)
  7303. {
  7304. x1 = x; y1 = y;
  7305. return true;
  7306. }
  7307. }
  7308. return false;
  7309. }
  7310. const String toString() const
  7311. {
  7312. String s;
  7313. s.preallocateStorage (16);
  7314. s << x << ' ' << y << ' ' << w << ' ' << h;
  7315. return s;
  7316. }
  7317. static const Rectangle fromString (const String& stringVersion)
  7318. {
  7319. StringArray toks;
  7320. toks.addTokens (stringVersion.trim(), ",; \t\r\n", String::empty);
  7321. return Rectangle (toks[0].trim().getIntValue(),
  7322. toks[1].trim().getIntValue(),
  7323. toks[2].trim().getIntValue(),
  7324. toks[3].trim().getIntValue());
  7325. }
  7326. juce_UseDebuggingNewOperator
  7327. private:
  7328. friend class RectangleList;
  7329. ValueType x, y, w, h;
  7330. };
  7331. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7332. /*** End of inlined file: juce_Rectangle.h ***/
  7333. /*** Start of inlined file: juce_Justification.h ***/
  7334. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7335. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7336. class JUCE_API Justification
  7337. {
  7338. public:
  7339. inline Justification (int flags_) throw() : flags (flags_) {}
  7340. Justification (const Justification& other) throw();
  7341. Justification& operator= (const Justification& other) throw();
  7342. inline int getFlags() const throw() { return flags; }
  7343. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7344. int getOnlyVerticalFlags() const throw();
  7345. int getOnlyHorizontalFlags() const throw();
  7346. void applyToRectangle (int& x, int& y, int w, int h,
  7347. int spaceX, int spaceY, int spaceW, int spaceH) const throw();
  7348. enum
  7349. {
  7350. left = 1,
  7351. right = 2,
  7352. horizontallyCentred = 4,
  7353. top = 8,
  7354. bottom = 16,
  7355. verticallyCentred = 32,
  7356. horizontallyJustified = 64,
  7357. centred = 36,
  7358. centredLeft = 33,
  7359. centredRight = 34,
  7360. centredTop = 12,
  7361. centredBottom = 20,
  7362. topLeft = 9,
  7363. topRight = 10,
  7364. bottomLeft = 17,
  7365. bottomRight = 18
  7366. };
  7367. private:
  7368. int flags;
  7369. };
  7370. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7371. /*** End of inlined file: juce_Justification.h ***/
  7372. /*** Start of inlined file: juce_EdgeTable.h ***/
  7373. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7374. #define __JUCE_EDGETABLE_JUCEHEADER__
  7375. class Path;
  7376. class RectangleList;
  7377. class Image;
  7378. class JUCE_API EdgeTable
  7379. {
  7380. public:
  7381. EdgeTable (const Rectangle<int>& clipLimits,
  7382. const Path& pathToAdd,
  7383. const AffineTransform& transform);
  7384. EdgeTable (const Rectangle<int>& rectangleToAdd);
  7385. EdgeTable (const RectangleList& rectanglesToAdd);
  7386. EdgeTable (float x, float y, float w, float h);
  7387. EdgeTable (const EdgeTable& other);
  7388. EdgeTable& operator= (const EdgeTable& other);
  7389. ~EdgeTable();
  7390. void clipToRectangle (const Rectangle<int>& r) throw();
  7391. void excludeRectangle (const Rectangle<int>& r) throw();
  7392. void clipToEdgeTable (const EdgeTable& other);
  7393. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7394. bool isEmpty() throw();
  7395. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7396. void translate (float dx, int dy) throw();
  7397. void optimiseTable() throw();
  7398. template <class EdgeTableIterationCallback>
  7399. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7400. {
  7401. const int* lineStart = table;
  7402. for (int y = 0; y < bounds.getHeight(); ++y)
  7403. {
  7404. const int* line = lineStart;
  7405. lineStart += lineStrideElements;
  7406. int numPoints = line[0];
  7407. if (--numPoints > 0)
  7408. {
  7409. int x = *++line;
  7410. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7411. int levelAccumulator = 0;
  7412. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7413. while (--numPoints >= 0)
  7414. {
  7415. const int level = *++line;
  7416. jassert (((unsigned int) level) < (unsigned int) 256);
  7417. const int endX = *++line;
  7418. jassert (endX >= x);
  7419. const int endOfRun = (endX >> 8);
  7420. if (endOfRun == (x >> 8))
  7421. {
  7422. // small segment within the same pixel, so just save it for the next
  7423. // time round..
  7424. levelAccumulator += (endX - x) * level;
  7425. }
  7426. else
  7427. {
  7428. // plot the fist pixel of this segment, including any accumulated
  7429. // levels from smaller segments that haven't been drawn yet
  7430. levelAccumulator += (0xff - (x & 0xff)) * level;
  7431. levelAccumulator >>= 8;
  7432. x >>= 8;
  7433. if (levelAccumulator > 0)
  7434. {
  7435. if (levelAccumulator >> 8)
  7436. levelAccumulator = 0xff;
  7437. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7438. }
  7439. // if there's a run of similar pixels, do it all in one go..
  7440. if (level > 0)
  7441. {
  7442. jassert (endOfRun <= bounds.getRight());
  7443. const int numPix = endOfRun - ++x;
  7444. if (numPix > 0)
  7445. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7446. }
  7447. // save the bit at the end to be drawn next time round the loop.
  7448. levelAccumulator = (endX & 0xff) * level;
  7449. }
  7450. x = endX;
  7451. }
  7452. if (levelAccumulator > 0)
  7453. {
  7454. levelAccumulator >>= 8;
  7455. if (levelAccumulator >> 8)
  7456. levelAccumulator = 0xff;
  7457. x >>= 8;
  7458. jassert (x >= bounds.getX() && x < bounds.getRight());
  7459. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7460. }
  7461. }
  7462. }
  7463. }
  7464. juce_UseDebuggingNewOperator
  7465. private:
  7466. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7467. HeapBlock<int> table;
  7468. Rectangle<int> bounds;
  7469. int maxEdgesPerLine, lineStrideElements;
  7470. bool needToCheckEmptinesss;
  7471. void addEdgePoint (int x, int y, int winding) throw();
  7472. void remapTableForNumEdges (int newNumEdgesPerLine) throw();
  7473. void intersectWithEdgeTableLine (int y, const int* otherLine) throw();
  7474. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7475. void sanitiseLevels (bool useNonZeroWinding) throw();
  7476. static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw();
  7477. };
  7478. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7479. /*** End of inlined file: juce_EdgeTable.h ***/
  7480. class Image;
  7481. class JUCE_API Path
  7482. {
  7483. public:
  7484. Path();
  7485. Path (const Path& other);
  7486. ~Path();
  7487. Path& operator= (const Path& other);
  7488. bool isEmpty() const throw();
  7489. const Rectangle<float> getBounds() const throw();
  7490. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7491. bool contains (float x, float y,
  7492. float tolerence = 10.0f) const;
  7493. bool intersectsLine (float x1, float y1,
  7494. float x2, float y2,
  7495. float tolerence = 10.0f);
  7496. void clear() throw();
  7497. void startNewSubPath (float startX, float startY);
  7498. void closeSubPath();
  7499. void lineTo (float endX, float endY);
  7500. void quadraticTo (float controlPointX,
  7501. float controlPointY,
  7502. float endPointX,
  7503. float endPointY);
  7504. void cubicTo (float controlPoint1X,
  7505. float controlPoint1Y,
  7506. float controlPoint2X,
  7507. float controlPoint2Y,
  7508. float endPointX,
  7509. float endPointY);
  7510. const Point<float> getCurrentPosition() const;
  7511. void addRectangle (float x, float y, float width, float height);
  7512. void addRectangle (const Rectangle<int>& rectangle);
  7513. void addRoundedRectangle (float x, float y, float width, float height,
  7514. float cornerSize);
  7515. void addRoundedRectangle (float x, float y, float width, float height,
  7516. float cornerSizeX,
  7517. float cornerSizeY);
  7518. void addTriangle (float x1, float y1,
  7519. float x2, float y2,
  7520. float x3, float y3);
  7521. void addQuadrilateral (float x1, float y1,
  7522. float x2, float y2,
  7523. float x3, float y3,
  7524. float x4, float y4);
  7525. void addEllipse (float x, float y, float width, float height);
  7526. void addArc (float x, float y, float width, float height,
  7527. float fromRadians,
  7528. float toRadians,
  7529. bool startAsNewSubPath = false);
  7530. void addCentredArc (float centreX, float centreY,
  7531. float radiusX, float radiusY,
  7532. float rotationOfEllipse,
  7533. float fromRadians,
  7534. float toRadians,
  7535. bool startAsNewSubPath = false);
  7536. void addPieSegment (float x, float y,
  7537. float width, float height,
  7538. float fromRadians,
  7539. float toRadians,
  7540. float innerCircleProportionalSize);
  7541. void addLineSegment (float startX, float startY,
  7542. float endX, float endY,
  7543. float lineThickness);
  7544. void addArrow (float startX, float startY,
  7545. float endX, float endY,
  7546. float lineThickness,
  7547. float arrowheadWidth,
  7548. float arrowheadLength);
  7549. void addStar (float centreX,
  7550. float centreY,
  7551. int numberOfPoints,
  7552. float innerRadius,
  7553. float outerRadius,
  7554. float startAngle = 0.0f);
  7555. void addBubble (float bodyX, float bodyY,
  7556. float bodyW, float bodyH,
  7557. float cornerSize,
  7558. float arrowTipX,
  7559. float arrowTipY,
  7560. int whichSide,
  7561. float arrowPositionAlongEdgeProportional,
  7562. float arrowWidth);
  7563. void addPath (const Path& pathToAppend);
  7564. void addPath (const Path& pathToAppend,
  7565. const AffineTransform& transformToApply);
  7566. void swapWithPath (Path& other);
  7567. void applyTransform (const AffineTransform& transform) throw();
  7568. void scaleToFit (float x, float y, float width, float height,
  7569. bool preserveProportions) throw();
  7570. const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
  7571. bool preserveProportions,
  7572. const Justification& justificationType = Justification::centred) const;
  7573. const Path createPathWithRoundedCorners (float cornerRadius) const;
  7574. void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
  7575. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7576. class JUCE_API Iterator
  7577. {
  7578. public:
  7579. Iterator (const Path& path);
  7580. ~Iterator();
  7581. bool next();
  7582. enum PathElementType
  7583. {
  7584. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7585. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7586. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7587. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7588. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7589. };
  7590. PathElementType elementType;
  7591. float x1, y1, x2, y2, x3, y3;
  7592. private:
  7593. const Path& path;
  7594. size_t index;
  7595. Iterator (const Iterator&);
  7596. Iterator& operator= (const Iterator&);
  7597. };
  7598. void loadPathFromStream (InputStream& source);
  7599. void loadPathFromData (const void* data, int numberOfBytes);
  7600. void writePathToStream (OutputStream& destination) const;
  7601. const String toString() const;
  7602. void restoreFromString (const String& stringVersion);
  7603. juce_UseDebuggingNewOperator
  7604. private:
  7605. friend class PathFlatteningIterator;
  7606. friend class Path::Iterator;
  7607. ArrayAllocationBase <float, DummyCriticalSection> data;
  7608. size_t numElements;
  7609. float pathXMin, pathXMax, pathYMin, pathYMax;
  7610. bool useNonZeroWinding;
  7611. static const float lineMarker;
  7612. static const float moveMarker;
  7613. static const float quadMarker;
  7614. static const float cubicMarker;
  7615. static const float closeSubPathMarker;
  7616. };
  7617. #endif // __JUCE_PATH_JUCEHEADER__
  7618. /*** End of inlined file: juce_Path.h ***/
  7619. class Font;
  7620. class JUCE_API Typeface : public ReferenceCountedObject
  7621. {
  7622. public:
  7623. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7624. const String getName() const throw() { return name; }
  7625. static const Ptr createSystemTypefaceFor (const Font& font);
  7626. virtual ~Typeface();
  7627. virtual float getAscent() const = 0;
  7628. virtual float getDescent() const = 0;
  7629. virtual float getStringWidth (const String& text) = 0;
  7630. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7631. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7632. juce_UseDebuggingNewOperator
  7633. protected:
  7634. String name;
  7635. explicit Typeface (const String& name) throw();
  7636. private:
  7637. Typeface (const Typeface&);
  7638. Typeface& operator= (const Typeface&);
  7639. };
  7640. class JUCE_API CustomTypeface : public Typeface
  7641. {
  7642. public:
  7643. CustomTypeface();
  7644. explicit CustomTypeface (InputStream& serialisedTypefaceStream);
  7645. ~CustomTypeface();
  7646. void clear();
  7647. void setCharacteristics (const String& name, float ascent,
  7648. bool isBold, bool isItalic,
  7649. juce_wchar defaultCharacter) throw();
  7650. void addGlyph (juce_wchar character, const Path& path, float width) throw();
  7651. void addKerningPair (juce_wchar char1, juce_wchar char2, float extraAmount) throw();
  7652. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7653. bool writeToStream (OutputStream& outputStream);
  7654. // The following methods implement the basic Typeface behaviour.
  7655. float getAscent() const;
  7656. float getDescent() const;
  7657. float getStringWidth (const String& text);
  7658. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7659. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7660. int getGlyphForCharacter (juce_wchar character);
  7661. juce_UseDebuggingNewOperator
  7662. protected:
  7663. juce_wchar defaultCharacter;
  7664. float ascent;
  7665. bool isBold, isItalic;
  7666. virtual bool loadGlyphIfPossible (juce_wchar characterNeeded);
  7667. private:
  7668. class GlyphInfo;
  7669. friend class OwnedArray<GlyphInfo>;
  7670. OwnedArray <GlyphInfo> glyphs;
  7671. short lookupTable [128];
  7672. CustomTypeface (const CustomTypeface&);
  7673. CustomTypeface& operator= (const CustomTypeface&);
  7674. GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) throw();
  7675. GlyphInfo* findGlyphSubstituting (juce_wchar character) throw();
  7676. };
  7677. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7678. /*** End of inlined file: juce_Typeface.h ***/
  7679. class LowLevelGraphicsContext;
  7680. class JUCE_API Font
  7681. {
  7682. public:
  7683. enum FontStyleFlags
  7684. {
  7685. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7686. bold = 1, /**< boldens the font. @see setStyleFlags */
  7687. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7688. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7689. };
  7690. Font (float fontHeight,
  7691. int styleFlags = plain) throw();
  7692. Font (const String& typefaceName,
  7693. float fontHeight,
  7694. int styleFlags) throw();
  7695. Font (const Font& other) throw();
  7696. Font (const Typeface::Ptr& typeface) throw();
  7697. Font() throw();
  7698. Font& operator= (const Font& other) throw();
  7699. bool operator== (const Font& other) const throw();
  7700. bool operator!= (const Font& other) const throw();
  7701. ~Font() throw();
  7702. void setTypefaceName (const String& faceName) throw();
  7703. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7704. static const String getDefaultSansSerifFontName() throw();
  7705. static const String getDefaultSerifFontName() throw();
  7706. static const String getDefaultMonospacedFontName() throw();
  7707. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
  7708. float getHeight() const throw() { return font->height; }
  7709. void setHeight (float newHeight) throw();
  7710. void setHeightWithoutChangingWidth (float newHeight) throw();
  7711. float getAscent() const throw();
  7712. float getDescent() const throw();
  7713. int getStyleFlags() const throw() { return font->styleFlags; }
  7714. void setStyleFlags (const int newFlags) throw();
  7715. void setBold (bool shouldBeBold) throw();
  7716. bool isBold() const throw();
  7717. void setItalic (bool shouldBeItalic) throw();
  7718. bool isItalic() const throw();
  7719. void setUnderline (bool shouldBeUnderlined) throw();
  7720. bool isUnderlined() const throw();
  7721. void setHorizontalScale (float scaleFactor) throw();
  7722. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7723. void setExtraKerningFactor (float extraKerning) throw();
  7724. float getExtraKerningFactor() const throw() { return font->kerning; }
  7725. void setSizeAndStyle (float newHeight,
  7726. int newStyleFlags,
  7727. float newHorizontalScale,
  7728. float newKerningAmount) throw();
  7729. int getStringWidth (const String& text) const throw();
  7730. float getStringWidthFloat (const String& text) const throw();
  7731. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7732. Typeface* getTypeface() const throw();
  7733. static void findFonts (Array<Font>& results) throw();
  7734. static const StringArray findAllTypefaceNames();
  7735. static const String getFallbackFontName() throw();
  7736. static void setFallbackFontName (const String& name) throw();
  7737. juce_UseDebuggingNewOperator
  7738. private:
  7739. friend class FontGlyphAlphaMap;
  7740. friend class TypefaceCache;
  7741. class SharedFontInternal : public ReferenceCountedObject
  7742. {
  7743. public:
  7744. SharedFontInternal (const String& typefaceName, float height, float horizontalScale,
  7745. float kerning, float ascent, int styleFlags,
  7746. Typeface* typeface) throw();
  7747. SharedFontInternal (const SharedFontInternal& other) throw();
  7748. String typefaceName;
  7749. float height, horizontalScale, kerning, ascent;
  7750. int styleFlags;
  7751. Typeface::Ptr typeface;
  7752. };
  7753. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7754. void dupeInternalIfShared() throw();
  7755. };
  7756. #endif // __JUCE_FONT_JUCEHEADER__
  7757. /*** End of inlined file: juce_Font.h ***/
  7758. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7759. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7760. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7761. class JUCE_API PathStrokeType
  7762. {
  7763. public:
  7764. enum JointStyle
  7765. {
  7766. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7767. Note that for angles that curve back on themselves, drawing a
  7768. mitre could require extending the point too far away from the
  7769. path, so a mitre limit is imposed and any corners that exceed it
  7770. are drawn as bevelled instead. */
  7771. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7772. beveled /**< Indicates that corners should be drawn with a line flattening their
  7773. outside edge. */
  7774. };
  7775. enum EndCapStyle
  7776. {
  7777. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7778. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7779. the thickness of the stroke. */
  7780. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7781. };
  7782. PathStrokeType (float strokeThickness,
  7783. JointStyle jointStyle = mitered,
  7784. EndCapStyle endStyle = butt) throw();
  7785. PathStrokeType (const PathStrokeType& other) throw();
  7786. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7787. ~PathStrokeType() throw();
  7788. void createStrokedPath (Path& destPath,
  7789. const Path& sourcePath,
  7790. const AffineTransform& transform = AffineTransform::identity,
  7791. float extraAccuracy = 1.0f) const;
  7792. void createDashedStroke (Path& destPath,
  7793. const Path& sourcePath,
  7794. const float* dashLengths,
  7795. int numDashLengths,
  7796. const AffineTransform& transform = AffineTransform::identity,
  7797. float extraAccuracy = 1.0f) const;
  7798. float getStrokeThickness() const throw() { return thickness; }
  7799. JointStyle getJointStyle() const throw() { return jointStyle; }
  7800. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7801. juce_UseDebuggingNewOperator
  7802. bool operator== (const PathStrokeType& other) const throw();
  7803. bool operator!= (const PathStrokeType& other) const throw();
  7804. private:
  7805. float thickness;
  7806. JointStyle jointStyle;
  7807. EndCapStyle endStyle;
  7808. };
  7809. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7810. /*** End of inlined file: juce_PathStrokeType.h ***/
  7811. /*** Start of inlined file: juce_Line.h ***/
  7812. #ifndef __JUCE_LINE_JUCEHEADER__
  7813. #define __JUCE_LINE_JUCEHEADER__
  7814. class JUCE_API Line
  7815. {
  7816. public:
  7817. Line() throw();
  7818. Line (const Line& other) throw();
  7819. Line (float startX,
  7820. float startY,
  7821. float endX,
  7822. float endY) throw();
  7823. Line (const Point<float>& start,
  7824. const Point<float>& end) throw();
  7825. Line& operator= (const Line& other) throw();
  7826. ~Line() throw();
  7827. inline float getStartX() const throw() { return startX; }
  7828. inline float getStartY() const throw() { return startY; }
  7829. inline float getEndX() const throw() { return endX; }
  7830. inline float getEndY() const throw() { return endY; }
  7831. const Point<float> getStart() const throw();
  7832. const Point<float> getEnd() const throw();
  7833. void setStart (float newStartX,
  7834. float newStartY) throw();
  7835. void setEnd (float newEndX,
  7836. float newEndY) throw();
  7837. void setStart (const Point<float>& newStart) throw();
  7838. void setEnd (const Point<float>& newEnd) throw();
  7839. void applyTransform (const AffineTransform& transform) throw();
  7840. float getLength() const throw();
  7841. bool isVertical() const throw();
  7842. bool isHorizontal() const throw();
  7843. float getAngle() const throw();
  7844. bool operator== (const Line& other) const throw();
  7845. bool operator!= (const Line& other) const throw();
  7846. bool intersects (const Line& line,
  7847. float& intersectionX,
  7848. float& intersectionY) const throw();
  7849. const Point<float> getPointAlongLine (float distanceFromStart) const throw();
  7850. const Point<float> getPointAlongLine (float distanceFromStart,
  7851. float perpendicularDistance) const throw();
  7852. const Point<float> getPointAlongLineProportionally (float proportionOfLength) const throw();
  7853. float getDistanceFromLine (float x, float y) const throw();
  7854. float findNearestPointTo (float x, float y) const throw();
  7855. bool isPointAbove (float x, float y) const throw();
  7856. const Line withShortenedStart (float distanceToShortenBy) const throw();
  7857. const Line withShortenedEnd (float distanceToShortenBy) const throw();
  7858. bool clipToPath (const Path& path, bool keepSectionOutsidePath) throw();
  7859. juce_UseDebuggingNewOperator
  7860. private:
  7861. float startX, startY, endX, endY;
  7862. };
  7863. #endif // __JUCE_LINE_JUCEHEADER__
  7864. /*** End of inlined file: juce_Line.h ***/
  7865. /*** Start of inlined file: juce_Colours.h ***/
  7866. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7867. #define __JUCE_COLOURS_JUCEHEADER__
  7868. /*** Start of inlined file: juce_Colour.h ***/
  7869. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7870. #define __JUCE_COLOUR_JUCEHEADER__
  7871. /*** Start of inlined file: juce_PixelFormats.h ***/
  7872. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7873. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7874. #if JUCE_MSVC
  7875. #pragma pack (push, 1)
  7876. #define PACKED
  7877. #elif JUCE_GCC
  7878. #define PACKED __attribute__((packed))
  7879. #else
  7880. #define PACKED
  7881. #endif
  7882. class PixelRGB;
  7883. class PixelAlpha;
  7884. class JUCE_API PixelARGB
  7885. {
  7886. public:
  7887. PixelARGB() throw() {}
  7888. ~PixelARGB() throw() {}
  7889. PixelARGB (const uint32 argb_) throw()
  7890. : argb (argb_)
  7891. {
  7892. }
  7893. forcedinline uint32 getARGB() const throw() { return argb; }
  7894. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7895. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7896. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7897. forcedinline uint8 getRed() const throw() { return components.r; }
  7898. forcedinline uint8 getGreen() const throw() { return components.g; }
  7899. forcedinline uint8 getBlue() const throw() { return components.b; }
  7900. forcedinline void blend (const PixelARGB& src) throw()
  7901. {
  7902. uint32 sargb = src.getARGB();
  7903. const uint32 alpha = 0x100 - (sargb >> 24);
  7904. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7905. sargb += 0xff00ff00 & (getAG() * alpha);
  7906. argb = sargb;
  7907. }
  7908. forcedinline void blend (const PixelAlpha& src) throw();
  7909. forcedinline void blend (const PixelRGB& src) throw();
  7910. template <class Pixel>
  7911. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7912. {
  7913. ++extraAlpha;
  7914. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7915. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7916. const uint32 alpha = 0x100 - (sargb >> 24);
  7917. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7918. sargb += 0xff00ff00 & (getAG() * alpha);
  7919. argb = sargb;
  7920. }
  7921. template <class Pixel>
  7922. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7923. {
  7924. uint32 drb = getRB();
  7925. drb += (((src.getRB() - drb) * amount) >> 8);
  7926. drb &= 0x00ff00ff;
  7927. uint32 dag = getAG();
  7928. dag += (((src.getAG() - dag) * amount) >> 8);
  7929. dag &= 0x00ff00ff;
  7930. dag <<= 8;
  7931. dag |= drb;
  7932. argb = dag;
  7933. }
  7934. template <class Pixel>
  7935. forcedinline void set (const Pixel& src) throw()
  7936. {
  7937. argb = src.getARGB();
  7938. }
  7939. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7940. {
  7941. components.a = newAlpha;
  7942. }
  7943. forcedinline void multiplyAlpha (int multiplier) throw()
  7944. {
  7945. ++multiplier;
  7946. argb = ((multiplier * getAG()) & 0xff00ff00)
  7947. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7948. }
  7949. forcedinline void multiplyAlpha (const float multiplier) throw()
  7950. {
  7951. multiplyAlpha ((int) (multiplier * 256.0f));
  7952. }
  7953. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7954. {
  7955. components.b = b;
  7956. components.g = g;
  7957. components.r = r;
  7958. components.a = a;
  7959. }
  7960. forcedinline void premultiply() throw()
  7961. {
  7962. const uint32 alpha = components.a;
  7963. if (alpha < 0xff)
  7964. {
  7965. if (alpha == 0)
  7966. {
  7967. components.b = 0;
  7968. components.g = 0;
  7969. components.r = 0;
  7970. }
  7971. else
  7972. {
  7973. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7974. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7975. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7976. }
  7977. }
  7978. }
  7979. forcedinline void unpremultiply() throw()
  7980. {
  7981. const uint32 alpha = components.a;
  7982. if (alpha < 0xff)
  7983. {
  7984. if (alpha == 0)
  7985. {
  7986. components.b = 0;
  7987. components.g = 0;
  7988. components.r = 0;
  7989. }
  7990. else
  7991. {
  7992. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7993. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7994. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7995. }
  7996. }
  7997. }
  7998. forcedinline void desaturate() throw()
  7999. {
  8000. if (components.a < 0xff && components.a > 0)
  8001. {
  8002. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  8003. components.r = components.g = components.b
  8004. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  8005. }
  8006. else
  8007. {
  8008. components.r = components.g = components.b
  8009. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  8010. }
  8011. }
  8012. #if JUCE_BIG_ENDIAN
  8013. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  8014. #else
  8015. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  8016. #endif
  8017. private:
  8018. union
  8019. {
  8020. uint32 argb;
  8021. struct
  8022. {
  8023. #if JUCE_BIG_ENDIAN
  8024. uint8 a : 8, r : 8, g : 8, b : 8;
  8025. #else
  8026. uint8 b, g, r, a;
  8027. #endif
  8028. } PACKED components;
  8029. };
  8030. } PACKED;
  8031. class JUCE_API PixelRGB
  8032. {
  8033. public:
  8034. PixelRGB() throw() {}
  8035. ~PixelRGB() throw() {}
  8036. PixelRGB (const uint32 argb) throw()
  8037. {
  8038. r = (uint8) (argb >> 16);
  8039. g = (uint8) (argb >> 8);
  8040. b = (uint8) (argb);
  8041. }
  8042. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  8043. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  8044. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  8045. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  8046. forcedinline uint8 getRed() const throw() { return r; }
  8047. forcedinline uint8 getGreen() const throw() { return g; }
  8048. forcedinline uint8 getBlue() const throw() { return b; }
  8049. forcedinline void blend (const PixelARGB& src) throw()
  8050. {
  8051. uint32 sargb = src.getARGB();
  8052. const uint32 alpha = 0x100 - (sargb >> 24);
  8053. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8054. sargb += 0x0000ff00 & (g * alpha);
  8055. r = (uint8) (sargb >> 16);
  8056. g = (uint8) (sargb >> 8);
  8057. b = (uint8) sargb;
  8058. }
  8059. forcedinline void blend (const PixelRGB& src) throw()
  8060. {
  8061. set (src);
  8062. }
  8063. forcedinline void blend (const PixelAlpha& src) throw();
  8064. template <class Pixel>
  8065. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8066. {
  8067. ++extraAlpha;
  8068. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  8069. const uint32 sag = extraAlpha * src.getAG();
  8070. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  8071. const uint32 alpha = 0x100 - (sargb >> 24);
  8072. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8073. sargb += 0x0000ff00 & (g * alpha);
  8074. b = (uint8) sargb;
  8075. g = (uint8) (sargb >> 8);
  8076. r = (uint8) (sargb >> 16);
  8077. }
  8078. template <class Pixel>
  8079. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8080. {
  8081. uint32 drb = getRB();
  8082. drb += (((src.getRB() - drb) * amount) >> 8);
  8083. uint32 dag = getAG();
  8084. dag += (((src.getAG() - dag) * amount) >> 8);
  8085. b = (uint8) drb;
  8086. g = (uint8) dag;
  8087. r = (uint8) (drb >> 16);
  8088. }
  8089. template <class Pixel>
  8090. forcedinline void set (const Pixel& src) throw()
  8091. {
  8092. b = src.getBlue();
  8093. g = src.getGreen();
  8094. r = src.getRed();
  8095. }
  8096. forcedinline void setAlpha (const uint8) throw() {}
  8097. forcedinline void multiplyAlpha (int) throw() {}
  8098. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  8099. {
  8100. r = r_;
  8101. g = g_;
  8102. b = b_;
  8103. }
  8104. forcedinline void premultiply() throw() {}
  8105. forcedinline void unpremultiply() throw() {}
  8106. forcedinline void desaturate() throw()
  8107. {
  8108. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  8109. }
  8110. #if JUCE_MAC
  8111. enum { indexR = 0, indexG = 1, indexB = 2 };
  8112. #else
  8113. enum { indexR = 2, indexG = 1, indexB = 0 };
  8114. #endif
  8115. private:
  8116. #if JUCE_MAC
  8117. uint8 r, g, b;
  8118. #else
  8119. uint8 b, g, r;
  8120. #endif
  8121. } PACKED;
  8122. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  8123. {
  8124. set (src);
  8125. }
  8126. class JUCE_API PixelAlpha
  8127. {
  8128. public:
  8129. PixelAlpha() throw() {}
  8130. ~PixelAlpha() throw() {}
  8131. PixelAlpha (const uint32 argb) throw()
  8132. {
  8133. a = (uint8) (argb >> 24);
  8134. }
  8135. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  8136. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  8137. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  8138. forcedinline uint8 getAlpha() const throw() { return a; }
  8139. forcedinline uint8 getRed() const throw() { return 0; }
  8140. forcedinline uint8 getGreen() const throw() { return 0; }
  8141. forcedinline uint8 getBlue() const throw() { return 0; }
  8142. template <class Pixel>
  8143. forcedinline void blend (const Pixel& src) throw()
  8144. {
  8145. const int srcA = src.getAlpha();
  8146. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  8147. }
  8148. template <class Pixel>
  8149. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  8150. {
  8151. ++extraAlpha;
  8152. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  8153. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  8154. }
  8155. template <class Pixel>
  8156. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  8157. {
  8158. a += ((src,getAlpha() - a) * amount) >> 8;
  8159. }
  8160. template <class Pixel>
  8161. forcedinline void set (const Pixel& src) throw()
  8162. {
  8163. a = src.getAlpha();
  8164. }
  8165. forcedinline void setAlpha (const uint8 newAlpha) throw()
  8166. {
  8167. a = newAlpha;
  8168. }
  8169. forcedinline void multiplyAlpha (int multiplier) throw()
  8170. {
  8171. ++multiplier;
  8172. a = (uint8) ((a * multiplier) >> 8);
  8173. }
  8174. forcedinline void multiplyAlpha (const float multiplier) throw()
  8175. {
  8176. a = (uint8) (a * multiplier);
  8177. }
  8178. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  8179. {
  8180. a = a_;
  8181. }
  8182. forcedinline void premultiply() throw()
  8183. {
  8184. }
  8185. forcedinline void unpremultiply() throw()
  8186. {
  8187. }
  8188. forcedinline void desaturate() throw()
  8189. {
  8190. }
  8191. enum { indexA = 0 };
  8192. private:
  8193. uint8 a : 8;
  8194. } PACKED;
  8195. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  8196. {
  8197. blend (PixelARGB (src.getARGB()));
  8198. }
  8199. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  8200. {
  8201. uint32 sargb = src.getARGB();
  8202. const uint32 alpha = 0x100 - (sargb >> 24);
  8203. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  8204. sargb += 0xff00ff00 & (getAG() * alpha);
  8205. argb = sargb;
  8206. }
  8207. #if JUCE_MSVC
  8208. #pragma pack (pop)
  8209. #endif
  8210. #undef PACKED
  8211. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  8212. /*** End of inlined file: juce_PixelFormats.h ***/
  8213. class JUCE_API Colour
  8214. {
  8215. public:
  8216. Colour() throw();
  8217. Colour (const Colour& other) throw();
  8218. explicit Colour (uint32 argb) throw();
  8219. Colour (uint8 red,
  8220. uint8 green,
  8221. uint8 blue) throw();
  8222. static const Colour fromRGB (uint8 red,
  8223. uint8 green,
  8224. uint8 blue) throw();
  8225. Colour (uint8 red,
  8226. uint8 green,
  8227. uint8 blue,
  8228. uint8 alpha) throw();
  8229. static const Colour fromRGBA (uint8 red,
  8230. uint8 green,
  8231. uint8 blue,
  8232. uint8 alpha) throw();
  8233. Colour (uint8 red,
  8234. uint8 green,
  8235. uint8 blue,
  8236. float alpha) throw();
  8237. static const Colour fromRGBAFloat (uint8 red,
  8238. uint8 green,
  8239. uint8 blue,
  8240. float alpha) throw();
  8241. Colour (float hue,
  8242. float saturation,
  8243. float brightness,
  8244. uint8 alpha) throw();
  8245. Colour (float hue,
  8246. float saturation,
  8247. float brightness,
  8248. float alpha) throw();
  8249. static const Colour fromHSV (float hue,
  8250. float saturation,
  8251. float brightness,
  8252. float alpha) throw();
  8253. ~Colour() throw();
  8254. Colour& operator= (const Colour& other) throw();
  8255. bool operator== (const Colour& other) const throw();
  8256. bool operator!= (const Colour& other) const throw();
  8257. uint8 getRed() const throw() { return argb.getRed(); }
  8258. uint8 getGreen() const throw() { return argb.getGreen(); }
  8259. uint8 getBlue() const throw() { return argb.getBlue(); }
  8260. float getFloatRed() const throw();
  8261. float getFloatGreen() const throw();
  8262. float getFloatBlue() const throw();
  8263. const PixelARGB getPixelARGB() const throw();
  8264. uint32 getARGB() const throw();
  8265. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  8266. float getFloatAlpha() const throw();
  8267. bool isOpaque() const throw();
  8268. bool isTransparent() const throw();
  8269. const Colour withAlpha (uint8 newAlpha) const throw();
  8270. const Colour withAlpha (float newAlpha) const throw();
  8271. const Colour withMultipliedAlpha (float alphaMultiplier) const throw();
  8272. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  8273. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  8274. float getHue() const throw();
  8275. float getSaturation() const throw();
  8276. float getBrightness() const throw();
  8277. void getHSB (float& hue,
  8278. float& saturation,
  8279. float& brightness) const throw();
  8280. const Colour withHue (float newHue) const throw();
  8281. const Colour withSaturation (float newSaturation) const throw();
  8282. const Colour withBrightness (float newBrightness) const throw();
  8283. const Colour withRotatedHue (float amountToRotate) const throw();
  8284. const Colour withMultipliedSaturation (float multiplier) const throw();
  8285. const Colour withMultipliedBrightness (float amount) const throw();
  8286. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8287. const Colour darker (float amountDarker = 0.4f) const throw();
  8288. const Colour contrasting (float amount = 1.0f) const throw();
  8289. static const Colour contrasting (const Colour& colour1,
  8290. const Colour& colour2) throw();
  8291. static const Colour greyLevel (float brightness) throw();
  8292. const String toString() const;
  8293. static const Colour fromString (const String& encodedColourString);
  8294. const String toDisplayString (bool includeAlphaValue) const;
  8295. juce_UseDebuggingNewOperator
  8296. private:
  8297. PixelARGB argb;
  8298. };
  8299. #endif // __JUCE_COLOUR_JUCEHEADER__
  8300. /*** End of inlined file: juce_Colour.h ***/
  8301. class Colours
  8302. {
  8303. public:
  8304. static JUCE_API const Colour
  8305. transparentBlack, /**< ARGB = 0x00000000 */
  8306. transparentWhite, /**< ARGB = 0x00ffffff */
  8307. black, /**< ARGB = 0xff000000 */
  8308. white, /**< ARGB = 0xffffffff */
  8309. blue, /**< ARGB = 0xff0000ff */
  8310. grey, /**< ARGB = 0xff808080 */
  8311. green, /**< ARGB = 0xff008000 */
  8312. red, /**< ARGB = 0xffff0000 */
  8313. yellow, /**< ARGB = 0xffffff00 */
  8314. aliceblue, antiquewhite, aqua, aquamarine,
  8315. azure, beige, bisque, blanchedalmond,
  8316. blueviolet, brown, burlywood, cadetblue,
  8317. chartreuse, chocolate, coral, cornflowerblue,
  8318. cornsilk, crimson, cyan, darkblue,
  8319. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8320. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8321. darkorchid, darkred, darksalmon, darkseagreen,
  8322. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8323. deeppink, deepskyblue, dimgrey, dodgerblue,
  8324. firebrick, floralwhite, forestgreen, fuchsia,
  8325. gainsboro, gold, goldenrod, greenyellow,
  8326. honeydew, hotpink, indianred, indigo,
  8327. ivory, khaki, lavender, lavenderblush,
  8328. lemonchiffon, lightblue, lightcoral, lightcyan,
  8329. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8330. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8331. lightsteelblue, lightyellow, lime, limegreen,
  8332. linen, magenta, maroon, mediumaquamarine,
  8333. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8334. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8335. midnightblue, mintcream, mistyrose, navajowhite,
  8336. navy, oldlace, olive, olivedrab,
  8337. orange, orangered, orchid, palegoldenrod,
  8338. palegreen, paleturquoise, palevioletred, papayawhip,
  8339. peachpuff, peru, pink, plum,
  8340. powderblue, purple, rosybrown, royalblue,
  8341. saddlebrown, salmon, sandybrown, seagreen,
  8342. seashell, sienna, silver, skyblue,
  8343. slateblue, slategrey, snow, springgreen,
  8344. steelblue, tan, teal, thistle,
  8345. tomato, turquoise, violet, wheat,
  8346. whitesmoke, yellowgreen;
  8347. static JUCE_API const Colour findColourForName (const String& colourName,
  8348. const Colour& defaultColour);
  8349. private:
  8350. // this isn't a class you should ever instantiate - it's just here for the
  8351. // static values in it.
  8352. Colours();
  8353. Colours (const Colours&);
  8354. Colours& operator= (const Colours&);
  8355. };
  8356. #endif // __JUCE_COLOURS_JUCEHEADER__
  8357. /*** End of inlined file: juce_Colours.h ***/
  8358. /*** Start of inlined file: juce_FillType.h ***/
  8359. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8360. #define __JUCE_FILLTYPE_JUCEHEADER__
  8361. /*** Start of inlined file: juce_ColourGradient.h ***/
  8362. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8363. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8364. class JUCE_API ColourGradient
  8365. {
  8366. public:
  8367. ColourGradient (const Colour& colour1, float x1, float y1,
  8368. const Colour& colour2, float x2, float y2,
  8369. bool isRadial) throw();
  8370. ColourGradient() throw();
  8371. ~ColourGradient() throw();
  8372. void clearColours() throw();
  8373. void addColour (double proportionAlongGradient,
  8374. const Colour& colour) throw();
  8375. void multiplyOpacity (float multiplier) throw();
  8376. int getNumColours() const throw();
  8377. double getColourPosition (int index) const throw();
  8378. const Colour getColour (int index) const throw();
  8379. const Colour getColourAtPosition (float position) const throw();
  8380. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8381. bool isOpaque() const throw();
  8382. bool isInvisible() const throw();
  8383. float x1;
  8384. float y1;
  8385. float x2;
  8386. float y2;
  8387. bool isRadial;
  8388. juce_UseDebuggingNewOperator
  8389. private:
  8390. Array <uint32> colours;
  8391. };
  8392. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8393. /*** End of inlined file: juce_ColourGradient.h ***/
  8394. class Image;
  8395. class JUCE_API FillType
  8396. {
  8397. public:
  8398. FillType() throw();
  8399. FillType (const Colour& colour) throw();
  8400. FillType (const ColourGradient& gradient) throw();
  8401. FillType (const Image& image, const AffineTransform& transform) throw();
  8402. FillType (const FillType& other) throw();
  8403. FillType& operator= (const FillType& other) throw();
  8404. ~FillType() throw();
  8405. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8406. bool isGradient() const throw() { return gradient != 0; }
  8407. bool isTiledImage() const throw() { return image != 0; }
  8408. void setColour (const Colour& newColour) throw();
  8409. void setGradient (const ColourGradient& newGradient) throw();
  8410. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8411. void setOpacity (float newOpacity) throw();
  8412. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8413. Colour colour;
  8414. ScopedPointer <ColourGradient> gradient;
  8415. const Image* image;
  8416. AffineTransform transform;
  8417. juce_UseDebuggingNewOperator
  8418. };
  8419. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8420. /*** End of inlined file: juce_FillType.h ***/
  8421. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8422. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8423. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8424. class JUCE_API RectanglePlacement
  8425. {
  8426. public:
  8427. inline RectanglePlacement (int flags_) throw() : flags (flags_) {}
  8428. RectanglePlacement (const RectanglePlacement& other) throw();
  8429. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8430. enum
  8431. {
  8432. xLeft = 1,
  8433. xRight = 2,
  8434. xMid = 4,
  8435. yTop = 8,
  8436. yBottom = 16,
  8437. yMid = 32,
  8438. stretchToFit = 64,
  8439. fillDestination = 128,
  8440. onlyReduceInSize = 256,
  8441. onlyIncreaseInSize = 512,
  8442. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8443. centred = 4 + 32
  8444. };
  8445. inline int getFlags() const throw() { return flags; }
  8446. inline bool testFlags (int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8447. void applyTo (double& sourceX,
  8448. double& sourceY,
  8449. double& sourceW,
  8450. double& sourceH,
  8451. double destinationX,
  8452. double destinationY,
  8453. double destinationW,
  8454. double destinationH) const throw();
  8455. const AffineTransform getTransformToFit (float sourceX,
  8456. float sourceY,
  8457. float sourceW,
  8458. float sourceH,
  8459. float destinationX,
  8460. float destinationY,
  8461. float destinationW,
  8462. float destinationH) const throw();
  8463. private:
  8464. int flags;
  8465. };
  8466. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8467. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8468. class LowLevelGraphicsContext;
  8469. class Image;
  8470. class RectangleList;
  8471. class JUCE_API Graphics
  8472. {
  8473. public:
  8474. explicit Graphics (Image& imageToDrawOnto);
  8475. ~Graphics();
  8476. void setColour (const Colour& newColour);
  8477. void setOpacity (const float newOpacity);
  8478. void setGradientFill (const ColourGradient& gradient);
  8479. void setTiledImageFill (const Image& imageToUse,
  8480. int anchorX, int anchorY,
  8481. float opacity);
  8482. void setFillType (const FillType& newFill);
  8483. void setFont (const Font& newFont);
  8484. void setFont (float newFontHeight, int fontStyleFlags = Font::plain);
  8485. void drawSingleLineText (const String& text,
  8486. int startX, int baselineY) const;
  8487. void drawMultiLineText (const String& text,
  8488. int startX, int baselineY,
  8489. int maximumLineWidth) const;
  8490. void drawTextAsPath (const String& text,
  8491. const AffineTransform& transform) const;
  8492. void drawText (const String& text,
  8493. int x, int y, int width, int height,
  8494. const Justification& justificationType,
  8495. bool useEllipsesIfTooBig) const;
  8496. void drawFittedText (const String& text,
  8497. int x, int y, int width, int height,
  8498. const Justification& justificationFlags,
  8499. int maximumNumberOfLines,
  8500. float minimumHorizontalScale = 0.7f) const;
  8501. void fillAll() const;
  8502. void fillAll (const Colour& colourToUse) const;
  8503. void fillRect (int x, int y, int width, int height) const;
  8504. void fillRect (const Rectangle<int>& rectangle) const;
  8505. void fillRect (float x, float y, float width, float height) const;
  8506. void fillRoundedRectangle (float x, float y, float width, float height,
  8507. float cornerSize) const;
  8508. void fillRoundedRectangle (const Rectangle<float>& rectangle,
  8509. float cornerSize) const;
  8510. void fillCheckerBoard (int x, int y, int width, int height,
  8511. int checkWidth, int checkHeight,
  8512. const Colour& colour1, const Colour& colour2) const;
  8513. void drawRect (int x, int y, int width, int height,
  8514. int lineThickness = 1) const;
  8515. void drawRect (float x, float y, float width, float height,
  8516. float lineThickness = 1.0f) const;
  8517. void drawRect (const Rectangle<int>& rectangle,
  8518. int lineThickness = 1) const;
  8519. void drawRoundedRectangle (float x, float y, float width, float height,
  8520. float cornerSize, float lineThickness) const;
  8521. void drawRoundedRectangle (const Rectangle<float>& rectangle,
  8522. float cornerSize, float lineThickness) const;
  8523. void drawBevel (int x, int y, int width, int height,
  8524. int bevelThickness,
  8525. const Colour& topLeftColour = Colours::white,
  8526. const Colour& bottomRightColour = Colours::black,
  8527. bool useGradient = true,
  8528. bool sharpEdgeOnOutside = true) const;
  8529. void setPixel (int x, int y) const;
  8530. void fillEllipse (float x, float y, float width, float height) const;
  8531. void drawEllipse (float x, float y, float width, float height,
  8532. float lineThickness) const;
  8533. void drawLine (float startX, float startY, float endX, float endY) const;
  8534. void drawLine (float startX, float startY, float endX, float endY,
  8535. float lineThickness) const;
  8536. void drawLine (const Line& line) const;
  8537. void drawLine (const Line& line, float lineThickness) const;
  8538. void drawDashedLine (float startX, float startY,
  8539. float endX, float endY,
  8540. const float* dashLengths, int numDashLengths,
  8541. float lineThickness = 1.0f) const;
  8542. void drawVerticalLine (int x, float top, float bottom) const;
  8543. void drawHorizontalLine (int y, float left, float right) const;
  8544. void fillPath (const Path& path,
  8545. const AffineTransform& transform = AffineTransform::identity) const;
  8546. void strokePath (const Path& path,
  8547. const PathStrokeType& strokeType,
  8548. const AffineTransform& transform = AffineTransform::identity) const;
  8549. void drawArrow (float startX, float startY,
  8550. float endX, float endY,
  8551. float lineThickness,
  8552. float arrowheadWidth,
  8553. float arrowheadLength) const;
  8554. enum ResamplingQuality
  8555. {
  8556. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8557. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8558. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8559. };
  8560. void setImageResamplingQuality (const ResamplingQuality newQuality);
  8561. void drawImageAt (const Image* const imageToDraw, int topLeftX, int topLeftY,
  8562. bool fillAlphaChannelWithCurrentBrush = false) const;
  8563. void drawImage (const Image* const imageToDraw,
  8564. int destX, int destY, int destWidth, int destHeight,
  8565. int sourceX, int sourceY, int sourceWidth, int sourceHeight,
  8566. bool fillAlphaChannelWithCurrentBrush = false) const;
  8567. void drawImageTransformed (const Image* imageToDraw,
  8568. const Rectangle<int>& imageSubRegion,
  8569. const AffineTransform& transform,
  8570. bool fillAlphaChannelWithCurrentBrush = false) const;
  8571. void drawImageWithin (const Image* imageToDraw,
  8572. int destX, int destY, int destWidth, int destHeight,
  8573. const RectanglePlacement& placementWithinTarget,
  8574. bool fillAlphaChannelWithCurrentBrush = false) const;
  8575. const Rectangle<int> getClipBounds() const;
  8576. bool clipRegionIntersects (int x, int y, int width, int height) const;
  8577. bool reduceClipRegion (int x, int y, int width, int height);
  8578. bool reduceClipRegion (const RectangleList& clipRegion);
  8579. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity);
  8580. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8581. const AffineTransform& transform);
  8582. void excludeClipRegion (const Rectangle<int>& rectangleToExclude);
  8583. bool isClipEmpty() const;
  8584. void saveState();
  8585. void restoreState();
  8586. void setOrigin (int newOriginX, int newOriginY);
  8587. void resetToDefaultState();
  8588. bool isVectorDevice() const;
  8589. juce_UseDebuggingNewOperator
  8590. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8591. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8592. private:
  8593. LowLevelGraphicsContext* const context;
  8594. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8595. bool saveStatePending;
  8596. void saveStateIfPending();
  8597. Graphics (const Graphics&);
  8598. Graphics& operator= (const Graphics& other);
  8599. };
  8600. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8601. /*** End of inlined file: juce_Graphics.h ***/
  8602. class JUCE_API ImageEffectFilter
  8603. {
  8604. public:
  8605. virtual void applyEffect (Image& sourceImage,
  8606. Graphics& destContext) = 0;
  8607. virtual ~ImageEffectFilter() {}
  8608. };
  8609. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8610. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8611. /*** Start of inlined file: juce_RectangleList.h ***/
  8612. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8613. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8614. class JUCE_API RectangleList
  8615. {
  8616. public:
  8617. RectangleList() throw();
  8618. RectangleList (const RectangleList& other) throw();
  8619. RectangleList (const Rectangle<int>& rect) throw();
  8620. RectangleList& operator= (const RectangleList& other) throw();
  8621. ~RectangleList() throw();
  8622. bool isEmpty() const throw();
  8623. int getNumRectangles() const throw() { return rects.size(); }
  8624. const Rectangle<int> getRectangle (const int index) const throw();
  8625. void clear() throw();
  8626. void add (int x, int y, int width, int height) throw();
  8627. void add (const Rectangle<int>& rect) throw();
  8628. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8629. void add (const RectangleList& other) throw();
  8630. void subtract (const Rectangle<int>& rect) throw();
  8631. void subtract (const RectangleList& otherList) throw();
  8632. bool clipTo (const Rectangle<int>& rect) throw();
  8633. bool clipTo (const RectangleList& other) throw();
  8634. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8635. void swapWith (RectangleList& otherList) throw();
  8636. bool containsPoint (int x, int y) const throw();
  8637. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8638. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8639. bool intersects (const RectangleList& other) const throw();
  8640. const Rectangle<int> getBounds() const throw();
  8641. void consolidate() throw();
  8642. void offsetAll (int dx, int dy) throw();
  8643. const Path toPath() const throw();
  8644. class Iterator
  8645. {
  8646. public:
  8647. Iterator (const RectangleList& list) throw();
  8648. ~Iterator() throw();
  8649. bool next() throw();
  8650. const Rectangle<int>* getRectangle() const throw() { return current; }
  8651. juce_UseDebuggingNewOperator
  8652. private:
  8653. const Rectangle<int>* current;
  8654. const RectangleList& owner;
  8655. int index;
  8656. Iterator (const Iterator&);
  8657. Iterator& operator= (const Iterator&);
  8658. };
  8659. juce_UseDebuggingNewOperator
  8660. private:
  8661. friend class Iterator;
  8662. Array <Rectangle<int> > rects;
  8663. };
  8664. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8665. /*** End of inlined file: juce_RectangleList.h ***/
  8666. /*** Start of inlined file: juce_BorderSize.h ***/
  8667. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8668. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8669. class JUCE_API BorderSize
  8670. {
  8671. public:
  8672. BorderSize() throw();
  8673. BorderSize (const BorderSize& other) throw();
  8674. BorderSize (int topGap,
  8675. int leftGap,
  8676. int bottomGap,
  8677. int rightGap) throw();
  8678. explicit BorderSize (int allGaps) throw();
  8679. ~BorderSize() throw();
  8680. int getTop() const throw() { return top; }
  8681. int getLeft() const throw() { return left; }
  8682. int getBottom() const throw() { return bottom; }
  8683. int getRight() const throw() { return right; }
  8684. int getTopAndBottom() const throw() { return top + bottom; }
  8685. int getLeftAndRight() const throw() { return left + right; }
  8686. void setTop (int newTopGap) throw();
  8687. void setLeft (int newLeftGap) throw();
  8688. void setBottom (int newBottomGap) throw();
  8689. void setRight (int newRightGap) throw();
  8690. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8691. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8692. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8693. void addTo (Rectangle<int>& original) const throw();
  8694. bool operator== (const BorderSize& other) const throw();
  8695. bool operator!= (const BorderSize& other) const throw();
  8696. juce_UseDebuggingNewOperator
  8697. private:
  8698. int top, left, bottom, right;
  8699. };
  8700. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8701. /*** End of inlined file: juce_BorderSize.h ***/
  8702. class LookAndFeel;
  8703. class MouseInputSource;
  8704. class MouseInputSourceInternal;
  8705. class ComponentPeer;
  8706. class JUCE_API Component : public MouseListener,
  8707. protected MessageListener
  8708. {
  8709. public:
  8710. Component();
  8711. virtual ~Component();
  8712. explicit Component (const String& componentName);
  8713. const String& getName() const throw() { return componentName_; }
  8714. virtual void setName (const String& newName);
  8715. bool isValidComponent() const;
  8716. virtual void setVisible (bool shouldBeVisible);
  8717. bool isVisible() const throw() { return flags.visibleFlag; }
  8718. virtual void visibilityChanged();
  8719. bool isShowing() const;
  8720. void fadeOutComponent (int lengthOfFadeOutInMilliseconds,
  8721. int deltaXToMove = 0,
  8722. int deltaYToMove = 0,
  8723. float scaleFactorAtEnd = 1.0f);
  8724. virtual void addToDesktop (int windowStyleFlags,
  8725. void* nativeWindowToAttachTo = 0);
  8726. void removeFromDesktop();
  8727. bool isOnDesktop() const throw();
  8728. ComponentPeer* getPeer() const;
  8729. virtual void userTriedToCloseWindow();
  8730. virtual void minimisationStateChanged (bool isNowMinimised);
  8731. void toFront (bool shouldAlsoGainFocus);
  8732. void toBack();
  8733. void toBehind (Component* other);
  8734. void setAlwaysOnTop (bool shouldStayOnTop);
  8735. bool isAlwaysOnTop() const throw();
  8736. inline int getX() const throw() { return bounds_.getX(); }
  8737. inline int getY() const throw() { return bounds_.getY(); }
  8738. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8739. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8740. int getRight() const throw() { return bounds_.getRight(); }
  8741. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8742. int getBottom() const throw() { return bounds_.getBottom(); }
  8743. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8744. const Rectangle<int> getLocalBounds() const throw();
  8745. void getVisibleArea (RectangleList& result,
  8746. bool includeSiblings) const;
  8747. int getScreenX() const;
  8748. int getScreenY() const;
  8749. const Point<int> getScreenPosition() const;
  8750. const Rectangle<int> getScreenBounds() const;
  8751. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8752. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8753. const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
  8754. const Point<int>& positionRelativeToThis) const;
  8755. void setTopLeftPosition (int x, int y);
  8756. void setTopRightPosition (int x, int y);
  8757. void setSize (int newWidth, int newHeight);
  8758. void setBounds (int x, int y, int width, int height);
  8759. void setBounds (const Rectangle<int>& newBounds);
  8760. void setBoundsRelative (float proportionalX, float proportionalY,
  8761. float proportionalWidth, float proportionalHeight);
  8762. void setBoundsInset (const BorderSize& borders);
  8763. void setBoundsToFit (int x, int y, int width, int height,
  8764. const Justification& justification,
  8765. bool onlyReduceInSize);
  8766. void setCentrePosition (int x, int y);
  8767. void setCentreRelative (float x, float y);
  8768. void centreWithSize (int width, int height);
  8769. int proportionOfWidth (float proportion) const throw();
  8770. int proportionOfHeight (float proportion) const throw();
  8771. int getParentWidth() const throw();
  8772. int getParentHeight() const throw();
  8773. const Rectangle<int> getParentMonitorArea() const;
  8774. int getNumChildComponents() const throw();
  8775. Component* getChildComponent (int index) const throw();
  8776. int getIndexOfChildComponent (const Component* child) const throw();
  8777. void addChildComponent (Component* child, int zOrder = -1);
  8778. void addAndMakeVisible (Component* child, int zOrder = -1);
  8779. void removeChildComponent (Component* childToRemove);
  8780. Component* removeChildComponent (int childIndexToRemove);
  8781. void removeAllChildren();
  8782. void deleteAllChildren();
  8783. Component* getParentComponent() const throw() { return parentComponent_; }
  8784. template <class TargetClass>
  8785. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8786. {
  8787. (void) dummyParameter;
  8788. Component* p = parentComponent_;
  8789. while (p != 0)
  8790. {
  8791. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8792. if (target != 0)
  8793. return target;
  8794. p = p->parentComponent_;
  8795. }
  8796. return 0;
  8797. }
  8798. Component* getTopLevelComponent() const throw();
  8799. bool isParentOf (const Component* possibleChild) const throw();
  8800. virtual void parentHierarchyChanged();
  8801. virtual void childrenChanged();
  8802. virtual bool hitTest (int x, int y);
  8803. void setInterceptsMouseClicks (bool allowClicksOnThisComponent,
  8804. bool allowClicksOnChildComponents) throw();
  8805. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8806. bool& allowsClicksOnChildComponents) const throw();
  8807. virtual bool contains (int x, int y);
  8808. bool reallyContains (int x, int y, bool returnTrueIfWithinAChild);
  8809. Component* getComponentAt (int x, int y);
  8810. Component* getComponentAt (const Point<int>& position);
  8811. void repaint();
  8812. void repaint (int x, int y, int width, int height);
  8813. void setBufferedToImage (bool shouldBeBuffered);
  8814. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8815. bool clipImageToComponentBounds = true);
  8816. void paintEntireComponent (Graphics& context);
  8817. void setComponentEffect (ImageEffectFilter* newEffect);
  8818. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8819. LookAndFeel& getLookAndFeel() const throw();
  8820. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  8821. virtual void lookAndFeelChanged();
  8822. void sendLookAndFeelChange();
  8823. void setOpaque (bool shouldBeOpaque);
  8824. bool isOpaque() const throw();
  8825. void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) throw();
  8826. bool isBroughtToFrontOnMouseClick() const throw();
  8827. // Keyboard focus methods
  8828. void setWantsKeyboardFocus (bool wantsFocus) throw();
  8829. bool getWantsKeyboardFocus() const throw();
  8830. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8831. bool getMouseClickGrabsKeyboardFocus() const throw();
  8832. void grabKeyboardFocus();
  8833. bool hasKeyboardFocus (bool trueIfChildIsFocused) const;
  8834. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8835. void moveKeyboardFocusToSibling (bool moveToNext);
  8836. virtual KeyboardFocusTraverser* createFocusTraverser();
  8837. int getExplicitFocusOrder() const;
  8838. void setExplicitFocusOrder (int newFocusOrderIndex);
  8839. void setFocusContainer (bool shouldBeFocusContainer) throw();
  8840. bool isFocusContainer() const throw();
  8841. bool isEnabled() const throw();
  8842. void setEnabled (bool shouldBeEnabled);
  8843. virtual void enablementChanged();
  8844. void setMouseCursor (const MouseCursor& cursorType);
  8845. virtual const MouseCursor getMouseCursor();
  8846. void updateMouseCursor() const;
  8847. virtual void paint (Graphics& g);
  8848. virtual void paintOverChildren (Graphics& g);
  8849. virtual void mouseMove (const MouseEvent& e);
  8850. virtual void mouseEnter (const MouseEvent& e);
  8851. virtual void mouseExit (const MouseEvent& e);
  8852. virtual void mouseDown (const MouseEvent& e);
  8853. virtual void mouseDrag (const MouseEvent& e);
  8854. virtual void mouseUp (const MouseEvent& e);
  8855. virtual void mouseDoubleClick (const MouseEvent& e);
  8856. virtual void mouseWheelMove (const MouseEvent& e,
  8857. float wheelIncrementX,
  8858. float wheelIncrementY);
  8859. static void beginDragAutoRepeat (int millisecondIntervalBetweenCallbacks);
  8860. void setRepaintsOnMouseActivity (bool shouldRepaint) throw();
  8861. void addMouseListener (MouseListener* newListener,
  8862. bool wantsEventsForAllNestedChildComponents);
  8863. void removeMouseListener (MouseListener* listenerToRemove);
  8864. void addKeyListener (KeyListener* newListener);
  8865. void removeKeyListener (KeyListener* listenerToRemove);
  8866. virtual bool keyPressed (const KeyPress& key);
  8867. virtual bool keyStateChanged (bool isKeyDown);
  8868. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8869. enum FocusChangeType
  8870. {
  8871. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8872. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8873. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8874. };
  8875. virtual void focusGained (FocusChangeType cause);
  8876. virtual void focusLost (FocusChangeType cause);
  8877. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8878. bool isMouseOver() const throw();
  8879. bool isMouseButtonDown() const throw();
  8880. bool isMouseOverOrDragging() const throw();
  8881. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8882. const Point<int> getMouseXYRelative() const;
  8883. virtual void resized();
  8884. virtual void moved();
  8885. virtual void childBoundsChanged (Component* child);
  8886. virtual void parentSizeChanged();
  8887. virtual void broughtToFront();
  8888. void addComponentListener (ComponentListener* newListener);
  8889. void removeComponentListener (ComponentListener* listenerToRemove);
  8890. void postCommandMessage (int commandId);
  8891. virtual void handleCommandMessage (int commandId);
  8892. int runModalLoop();
  8893. void enterModalState (bool takeKeyboardFocus = true);
  8894. void exitModalState (int returnValue);
  8895. bool isCurrentlyModal() const throw();
  8896. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8897. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8898. bool isCurrentlyBlockedByAnotherModalComponent() const;
  8899. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8900. virtual void inputAttemptWhenModal();
  8901. NamedValueSet& getProperties() throw() { return properties; }
  8902. const NamedValueSet& getProperties() const throw() { return properties; }
  8903. const Colour findColour (int colourId, bool inheritFromParent = false) const;
  8904. void setColour (int colourId, const Colour& colour);
  8905. void removeColour (int colourId);
  8906. bool isColourSpecified (int colourId) const;
  8907. void copyAllExplicitColoursTo (Component& target) const;
  8908. virtual void colourChanged();
  8909. void* getWindowHandle() const;
  8910. uint32 getComponentUID() const throw() { return componentUID; }
  8911. template <class ComponentType>
  8912. class SafePointer : private ComponentListener
  8913. {
  8914. public:
  8915. SafePointer() : comp (0) {}
  8916. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8917. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8918. ~SafePointer() { detach(); }
  8919. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8920. SafePointer& operator= (ComponentType* const newComponent)
  8921. {
  8922. detach();
  8923. comp = newComponent;
  8924. attach();
  8925. return *this;
  8926. }
  8927. operator ComponentType*() const throw() { return comp; }
  8928. ComponentType* getComponent() const throw() { return comp; }
  8929. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8930. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8931. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8932. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8933. juce_UseDebuggingNewOperator
  8934. private:
  8935. ComponentType* comp;
  8936. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8937. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8938. void componentBeingDeleted (Component&) { comp = 0; }
  8939. };
  8940. class BailOutChecker
  8941. {
  8942. public:
  8943. BailOutChecker (Component* component1,
  8944. Component* component2 = 0);
  8945. bool shouldBailOut() const throw();
  8946. private:
  8947. typedef SafePointer<Component> SafeComponentPtr;
  8948. SafeComponentPtr safePointer1, safePointer2;
  8949. Component* const component2;
  8950. BailOutChecker (const BailOutChecker&);
  8951. BailOutChecker& operator= (const BailOutChecker&);
  8952. };
  8953. juce_UseDebuggingNewOperator
  8954. private:
  8955. friend class ComponentPeer;
  8956. friend class InternalDragRepeater;
  8957. friend class MouseInputSource;
  8958. friend class MouseInputSourceInternal;
  8959. static Component* currentlyFocusedComponent;
  8960. String componentName_;
  8961. Component* parentComponent_;
  8962. uint32 componentUID;
  8963. Rectangle<int> bounds_;
  8964. int numDeepMouseListeners;
  8965. Array <Component*> childComponentList_;
  8966. LookAndFeel* lookAndFeel_;
  8967. MouseCursor cursor_;
  8968. ImageEffectFilter* effect_;
  8969. Image* bufferedImage_;
  8970. Array <MouseListener*>* mouseListeners_;
  8971. VoidArray* keyListeners_;
  8972. ListenerList <ComponentListener> componentListeners;
  8973. NamedValueSet properties;
  8974. struct ComponentFlags
  8975. {
  8976. bool hasHeavyweightPeerFlag : 1;
  8977. bool visibleFlag : 1;
  8978. bool opaqueFlag : 1;
  8979. bool ignoresMouseClicksFlag : 1;
  8980. bool allowChildMouseClicksFlag : 1;
  8981. bool wantsFocusFlag : 1;
  8982. bool isFocusContainerFlag : 1;
  8983. bool dontFocusOnMouseClickFlag : 1;
  8984. bool alwaysOnTopFlag : 1;
  8985. bool bufferToImageFlag : 1;
  8986. bool bringToFrontOnClickFlag : 1;
  8987. bool repaintOnMouseActivityFlag : 1;
  8988. bool draggingFlag : 1;
  8989. bool mouseOverFlag : 1;
  8990. bool mouseInsideFlag : 1;
  8991. bool currentlyModalFlag : 1;
  8992. bool isDisabledFlag : 1;
  8993. bool childCompFocusedFlag : 1;
  8994. #ifdef JUCE_DEBUG
  8995. bool isInsidePaintCall : 1;
  8996. #endif
  8997. };
  8998. union
  8999. {
  9000. uint32 componentFlags_;
  9001. ComponentFlags flags;
  9002. };
  9003. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9004. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9005. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9006. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  9007. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9008. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  9009. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, float amountX, float amountY);
  9010. void internalBroughtToFront();
  9011. void internalFocusGain (const FocusChangeType cause);
  9012. void internalFocusLoss (const FocusChangeType cause);
  9013. void internalChildFocusChange (FocusChangeType cause);
  9014. void internalModalInputAttempt();
  9015. void internalModifierKeysChanged();
  9016. void internalChildrenChanged();
  9017. void internalHierarchyChanged();
  9018. void renderComponent (Graphics& context);
  9019. void sendMovedResizedMessages (bool wasMoved, bool wasResized);
  9020. void repaintParent();
  9021. void sendFakeMouseMove() const;
  9022. void takeKeyboardFocus (const FocusChangeType cause);
  9023. void grabFocusInternal (const FocusChangeType cause, bool canTryParent = true);
  9024. static void giveAwayFocus();
  9025. void sendEnablementChangeMessage();
  9026. static void* runModalLoopCallback (void*);
  9027. static void bringModalComponentToFront();
  9028. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  9029. const Rectangle<int>& clipRect,
  9030. const Component* const compToAvoid) const;
  9031. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  9032. int deltaX, int deltaY) const;
  9033. // how much of the component is not off the edges of its parents
  9034. const Rectangle<int> getUnclippedArea() const;
  9035. void sendVisibilityChangeMessage();
  9036. // This is included here just to cause a compile error if your code is still handling
  9037. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  9038. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  9039. // implement its methods instead of this Component method).
  9040. virtual void filesDropped (const StringArray&, int, int) {}
  9041. // components aren't allowed to have copy constructors, as this would mess up parent
  9042. // hierarchies. You might need to give your subclasses a private dummy constructor like
  9043. // this one to avoid compiler warnings.
  9044. Component (const Component&);
  9045. Component& operator= (const Component&);
  9046. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  9047. // subclass to use the new parameters to keyStateChanged)
  9048. virtual void keyStateChanged() {};
  9049. protected:
  9050. virtual void internalRepaint (int x, int y, int w, int h);
  9051. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  9052. void handleMessage (const Message&);
  9053. };
  9054. #endif // __JUCE_COMPONENT_JUCEHEADER__
  9055. /*** End of inlined file: juce_Component.h ***/
  9056. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  9057. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9058. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9059. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  9060. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9061. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9062. typedef int CommandID;
  9063. namespace StandardApplicationCommandIDs
  9064. {
  9065. static const CommandID quit = 0x1001;
  9066. static const CommandID del = 0x1002;
  9067. static const CommandID cut = 0x1003;
  9068. static const CommandID copy = 0x1004;
  9069. static const CommandID paste = 0x1005;
  9070. static const CommandID selectAll = 0x1006;
  9071. static const CommandID deselectAll = 0x1007;
  9072. }
  9073. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9074. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  9075. struct JUCE_API ApplicationCommandInfo
  9076. {
  9077. explicit ApplicationCommandInfo (CommandID commandID) throw();
  9078. void setInfo (const String& shortName,
  9079. const String& description,
  9080. const String& categoryName,
  9081. int flags) throw();
  9082. void setActive (bool isActive) throw();
  9083. void setTicked (bool isTicked) throw();
  9084. void addDefaultKeypress (int keyCode,
  9085. const ModifierKeys& modifiers) throw();
  9086. CommandID commandID;
  9087. String shortName;
  9088. String description;
  9089. String categoryName;
  9090. Array <KeyPress> defaultKeypresses;
  9091. enum CommandFlags
  9092. {
  9093. isDisabled = 1 << 0,
  9094. isTicked = 1 << 1,
  9095. wantsKeyUpDownCallbacks = 1 << 2,
  9096. hiddenFromKeyEditor = 1 << 3,
  9097. readOnlyInKeyEditor = 1 << 4,
  9098. dontTriggerVisualFeedback = 1 << 5
  9099. };
  9100. int flags;
  9101. };
  9102. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9103. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  9104. class JUCE_API ApplicationCommandTarget
  9105. {
  9106. public:
  9107. ApplicationCommandTarget();
  9108. virtual ~ApplicationCommandTarget();
  9109. struct JUCE_API InvocationInfo
  9110. {
  9111. InvocationInfo (const CommandID commandID) throw();
  9112. CommandID commandID;
  9113. int commandFlags;
  9114. enum InvocationMethod
  9115. {
  9116. direct = 0, /**< The command is being invoked directly by a piece of code. */
  9117. fromKeyPress, /**< The command is being invoked by a key-press. */
  9118. fromMenu, /**< The command is being invoked by a menu selection. */
  9119. fromButton /**< The command is being invoked by a button click. */
  9120. };
  9121. InvocationMethod invocationMethod;
  9122. Component* originatingComponent;
  9123. KeyPress keyPress;
  9124. bool isKeyDown;
  9125. int millisecsSinceKeyPressed;
  9126. };
  9127. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9128. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9129. virtual void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) = 0;
  9130. virtual bool perform (const InvocationInfo& info) = 0;
  9131. bool invoke (const InvocationInfo& invocationInfo,
  9132. const bool asynchronously);
  9133. bool invokeDirectly (const CommandID commandID,
  9134. const bool asynchronously);
  9135. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9136. bool isCommandActive (const CommandID commandID);
  9137. ApplicationCommandTarget* findFirstTargetParentComponent();
  9138. juce_UseDebuggingNewOperator
  9139. private:
  9140. // (for async invocation of commands)
  9141. class CommandTargetMessageInvoker : public MessageListener
  9142. {
  9143. public:
  9144. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9145. ~CommandTargetMessageInvoker();
  9146. void handleMessage (const Message& message);
  9147. private:
  9148. ApplicationCommandTarget* const owner;
  9149. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9150. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9151. };
  9152. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9153. friend class CommandTargetMessageInvoker;
  9154. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9155. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9156. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9157. };
  9158. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9159. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9160. /*** Start of inlined file: juce_ActionListener.h ***/
  9161. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9162. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9163. class JUCE_API ActionListener
  9164. {
  9165. public:
  9166. virtual ~ActionListener() {}
  9167. virtual void actionListenerCallback (const String& message) = 0;
  9168. };
  9169. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9170. /*** End of inlined file: juce_ActionListener.h ***/
  9171. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9172. private ActionListener
  9173. {
  9174. protected:
  9175. JUCEApplication();
  9176. public:
  9177. virtual ~JUCEApplication();
  9178. static JUCEApplication* getInstance() throw();
  9179. virtual void initialise (const String& commandLineParameters) = 0;
  9180. bool isInitialising() const throw();
  9181. virtual void shutdown() = 0;
  9182. virtual const String getApplicationName() = 0;
  9183. virtual const String getApplicationVersion();
  9184. virtual bool moreThanOneInstanceAllowed();
  9185. virtual void anotherInstanceStarted (const String& commandLine);
  9186. virtual void systemRequestedQuit();
  9187. virtual void unhandledException (const std::exception* e,
  9188. const String& sourceFilename,
  9189. int lineNumber);
  9190. static void quit();
  9191. void setApplicationReturnValue (int newReturnValue) throw();
  9192. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9193. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9194. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9195. static int main (String& commandLine, JUCEApplication* newApp);
  9196. static int main (int argc, const char* argv[], JUCEApplication* newApp);
  9197. static void sendUnhandledException (const std::exception* e,
  9198. const char* sourceFile,
  9199. int lineNumber);
  9200. ApplicationCommandTarget* getNextCommandTarget();
  9201. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  9202. void getAllCommands (Array <CommandID>& commands);
  9203. bool perform (const InvocationInfo& info);
  9204. void actionListenerCallback (const String& message);
  9205. private:
  9206. String commandLineParameters;
  9207. int appReturnValue;
  9208. bool stillInitialising;
  9209. ScopedPointer<InterProcessLock> appLock;
  9210. JUCEApplication (const JUCEApplication&);
  9211. JUCEApplication& operator= (const JUCEApplication&);
  9212. public:
  9213. bool initialiseApp (String& commandLine);
  9214. static int shutdownAppAndClearUp();
  9215. };
  9216. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9217. /*** End of inlined file: juce_Application.h ***/
  9218. #endif
  9219. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9220. #endif
  9221. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9222. #endif
  9223. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9224. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9225. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9226. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9227. /*** Start of inlined file: juce_Desktop.h ***/
  9228. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9229. #define __JUCE_DESKTOP_JUCEHEADER__
  9230. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9231. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9232. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9233. class JUCE_API DeletedAtShutdown
  9234. {
  9235. protected:
  9236. DeletedAtShutdown();
  9237. virtual ~DeletedAtShutdown();
  9238. public:
  9239. static void deleteAll();
  9240. private:
  9241. DeletedAtShutdown (const DeletedAtShutdown&);
  9242. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9243. };
  9244. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9245. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9246. /*** Start of inlined file: juce_Timer.h ***/
  9247. #ifndef __JUCE_TIMER_JUCEHEADER__
  9248. #define __JUCE_TIMER_JUCEHEADER__
  9249. class InternalTimerThread;
  9250. class JUCE_API Timer
  9251. {
  9252. protected:
  9253. Timer() throw();
  9254. Timer (const Timer& other) throw();
  9255. public:
  9256. virtual ~Timer();
  9257. virtual void timerCallback() = 0;
  9258. void startTimer (int intervalInMilliseconds) throw();
  9259. void stopTimer() throw();
  9260. bool isTimerRunning() const throw() { return periodMs > 0; }
  9261. int getTimerInterval() const throw() { return periodMs; }
  9262. private:
  9263. friend class InternalTimerThread;
  9264. int countdownMs, periodMs;
  9265. Timer* previous;
  9266. Timer* next;
  9267. Timer& operator= (const Timer&);
  9268. };
  9269. #endif // __JUCE_TIMER_JUCEHEADER__
  9270. /*** End of inlined file: juce_Timer.h ***/
  9271. class MouseInputSource;
  9272. class MouseInputSourceInternal;
  9273. class MouseListener;
  9274. class JUCE_API FocusChangeListener
  9275. {
  9276. public:
  9277. virtual ~FocusChangeListener() {}
  9278. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9279. };
  9280. class JUCE_API Desktop : private DeletedAtShutdown,
  9281. private Timer,
  9282. private AsyncUpdater
  9283. {
  9284. public:
  9285. static Desktop& JUCE_CALLTYPE getInstance();
  9286. const RectangleList getAllMonitorDisplayAreas (bool clippedToWorkArea = true) const throw();
  9287. const Rectangle<int> getMainMonitorArea (bool clippedToWorkArea = true) const throw();
  9288. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, bool clippedToWorkArea = true) const;
  9289. static const Point<int> getMousePosition();
  9290. static void setMousePosition (const Point<int>& newPosition);
  9291. static const Point<int> getLastMouseDownPosition() throw();
  9292. static int getMouseButtonClickCounter() throw();
  9293. static void setScreenSaverEnabled (bool isEnabled) throw();
  9294. static bool isScreenSaverEnabled() throw();
  9295. void addGlobalMouseListener (MouseListener* listener);
  9296. void removeGlobalMouseListener (MouseListener* listener);
  9297. void addFocusChangeListener (FocusChangeListener* listener);
  9298. void removeFocusChangeListener (FocusChangeListener* listener);
  9299. void setKioskModeComponent (Component* componentToUse,
  9300. bool allowMenusAndBars = true);
  9301. Component* getKioskModeComponent() const throw() { return kioskModeComponent; }
  9302. int getNumComponents() const throw();
  9303. Component* getComponent (int index) const throw();
  9304. Component* findComponentAt (const Point<int>& screenPosition) const;
  9305. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9306. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9307. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9308. int getNumDraggingMouseSources() const throw();
  9309. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9310. juce_UseDebuggingNewOperator
  9311. void refreshMonitorSizes();
  9312. static bool canUseSemiTransparentWindows() throw();
  9313. private:
  9314. static Desktop* instance;
  9315. friend class Component;
  9316. friend class ComponentPeer;
  9317. friend class MouseInputSource;
  9318. friend class MouseInputSourceInternal;
  9319. friend class DeletedAtShutdown;
  9320. friend class TopLevelWindowManager;
  9321. OwnedArray <MouseInputSource> mouseSources;
  9322. void createMouseInputSources();
  9323. ListenerList <MouseListener> mouseListeners;
  9324. ListenerList <FocusChangeListener> focusListeners;
  9325. Array <Component*> desktopComponents;
  9326. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9327. Point<int> lastFakeMouseMove;
  9328. void sendMouseMove();
  9329. int mouseClickCounter;
  9330. void incrementMouseClickCounter() throw();
  9331. Component* kioskModeComponent;
  9332. Rectangle<int> kioskComponentOriginalBounds;
  9333. void timerCallback();
  9334. void resetTimer();
  9335. int getNumDisplayMonitors() const throw();
  9336. const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const throw();
  9337. void addDesktopComponent (Component* c);
  9338. void removeDesktopComponent (Component* c);
  9339. void componentBroughtToFront (Component* c);
  9340. void triggerFocusCallback();
  9341. void handleAsyncUpdate();
  9342. Desktop();
  9343. ~Desktop();
  9344. Desktop (const Desktop&);
  9345. Desktop& operator= (const Desktop&);
  9346. };
  9347. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9348. /*** End of inlined file: juce_Desktop.h ***/
  9349. class KeyPressMappingSet;
  9350. class ApplicationCommandManagerListener;
  9351. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9352. private FocusChangeListener
  9353. {
  9354. public:
  9355. ApplicationCommandManager();
  9356. virtual ~ApplicationCommandManager();
  9357. void clearCommands();
  9358. void registerCommand (const ApplicationCommandInfo& newCommand);
  9359. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9360. void removeCommand (CommandID commandID);
  9361. void commandStatusChanged();
  9362. int getNumCommands() const throw() { return commands.size(); }
  9363. const ApplicationCommandInfo* getCommandForIndex (int index) const throw() { return commands [index]; }
  9364. const ApplicationCommandInfo* getCommandForID (CommandID commandID) const throw();
  9365. const String getNameOfCommand (CommandID commandID) const throw();
  9366. const String getDescriptionOfCommand (CommandID commandID) const throw();
  9367. const StringArray getCommandCategories() const throw();
  9368. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9369. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9370. bool invokeDirectly (CommandID commandID, bool asynchronously);
  9371. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9372. bool asynchronously);
  9373. virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
  9374. void setFirstCommandTarget (ApplicationCommandTarget* newTarget) throw();
  9375. ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
  9376. ApplicationCommandInfo& upToDateInfo);
  9377. void addListener (ApplicationCommandManagerListener* listener) throw();
  9378. void removeListener (ApplicationCommandManagerListener* listener) throw();
  9379. static ApplicationCommandTarget* findDefaultComponentTarget();
  9380. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9381. juce_UseDebuggingNewOperator
  9382. private:
  9383. OwnedArray <ApplicationCommandInfo> commands;
  9384. ListenerList <ApplicationCommandManagerListener> listeners;
  9385. ScopedPointer <KeyPressMappingSet> keyMappings;
  9386. ApplicationCommandTarget* firstTarget;
  9387. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
  9388. void handleAsyncUpdate();
  9389. void globalFocusChanged (Component*);
  9390. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9391. // version of this method.
  9392. virtual short getFirstCommandTarget() { return 0; }
  9393. ApplicationCommandManager (const ApplicationCommandManager&);
  9394. ApplicationCommandManager& operator= (const ApplicationCommandManager&);
  9395. };
  9396. class JUCE_API ApplicationCommandManagerListener
  9397. {
  9398. public:
  9399. virtual ~ApplicationCommandManagerListener() {}
  9400. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9401. virtual void applicationCommandListChanged() = 0;
  9402. };
  9403. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9404. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9405. #endif
  9406. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9407. #endif
  9408. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9409. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9410. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9411. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9412. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9413. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9414. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9415. class JUCE_API PropertiesFile : public PropertySet,
  9416. public ChangeBroadcaster,
  9417. private Timer
  9418. {
  9419. public:
  9420. enum FileFormatOptions
  9421. {
  9422. ignoreCaseOfKeyNames = 1,
  9423. storeAsBinary = 2,
  9424. storeAsCompressedBinary = 4,
  9425. storeAsXML = 8
  9426. };
  9427. PropertiesFile (const File& file,
  9428. int millisecondsBeforeSaving,
  9429. int optionFlags,
  9430. InterProcessLock* processLock = 0);
  9431. ~PropertiesFile();
  9432. bool isValidFile() const throw() { return loadedOk; }
  9433. bool saveIfNeeded();
  9434. bool save();
  9435. bool needsToBeSaved() const;
  9436. void setNeedsToBeSaved (bool needsToBeSaved);
  9437. const File getFile() const { return file; }
  9438. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9439. const String& fileNameSuffix,
  9440. const String& folderName,
  9441. bool commonToAllUsers,
  9442. int millisecondsBeforeSaving,
  9443. int propertiesFileOptions,
  9444. InterProcessLock* processLock = 0);
  9445. static const File getDefaultAppSettingsFile (const String& applicationName,
  9446. const String& fileNameSuffix,
  9447. const String& folderName,
  9448. bool commonToAllUsers);
  9449. juce_UseDebuggingNewOperator
  9450. protected:
  9451. virtual void propertyChanged();
  9452. private:
  9453. File file;
  9454. int timerInterval;
  9455. const int options;
  9456. bool loadedOk, needsWriting;
  9457. InterProcessLock* processLock;
  9458. typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock;
  9459. InterProcessLock::ScopedLockType* createProcessLock() const;
  9460. void timerCallback();
  9461. PropertiesFile (const PropertiesFile&);
  9462. PropertiesFile& operator= (const PropertiesFile&);
  9463. };
  9464. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9465. /*** End of inlined file: juce_PropertiesFile.h ***/
  9466. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9467. {
  9468. public:
  9469. ApplicationProperties() throw();
  9470. ~ApplicationProperties();
  9471. juce_DeclareSingleton (ApplicationProperties, false)
  9472. void setStorageParameters (const String& applicationName,
  9473. const String& fileNameSuffix,
  9474. const String& folderName,
  9475. int millisecondsBeforeSaving,
  9476. int propertiesFileOptions) throw();
  9477. bool testWriteAccess (bool testUserSettings,
  9478. bool testCommonSettings,
  9479. bool showWarningDialogOnFailure);
  9480. PropertiesFile* getUserSettings() throw();
  9481. PropertiesFile* getCommonSettings (bool returnUserPropsIfReadOnly) throw();
  9482. bool saveIfNeeded();
  9483. void closeFiles();
  9484. juce_UseDebuggingNewOperator
  9485. private:
  9486. ScopedPointer <PropertiesFile> userProps, commonProps;
  9487. String appName, fileSuffix, folderName;
  9488. int msBeforeSaving, options;
  9489. int commonSettingsAreReadOnly;
  9490. ApplicationProperties (const ApplicationProperties&);
  9491. ApplicationProperties& operator= (const ApplicationProperties&);
  9492. void openFiles() throw();
  9493. };
  9494. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9495. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9496. #endif
  9497. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9498. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9499. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9500. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9501. /*** Start of inlined file: juce_AudioFormat.h ***/
  9502. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9503. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9504. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9505. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9506. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9507. class AudioFormat;
  9508. class JUCE_API AudioFormatReader
  9509. {
  9510. protected:
  9511. AudioFormatReader (InputStream* sourceStream,
  9512. const String& formatName);
  9513. public:
  9514. virtual ~AudioFormatReader();
  9515. const String getFormatName() const throw() { return formatName; }
  9516. bool read (int** destSamples,
  9517. int numDestChannels,
  9518. int64 startSampleInSource,
  9519. int numSamplesToRead,
  9520. bool fillLeftoverChannelsWithCopies);
  9521. virtual void readMaxLevels (int64 startSample,
  9522. int64 numSamples,
  9523. float& lowestLeft,
  9524. float& highestLeft,
  9525. float& lowestRight,
  9526. float& highestRight);
  9527. int64 searchForLevel (int64 startSample,
  9528. int64 numSamplesToSearch,
  9529. double magnitudeRangeMinimum,
  9530. double magnitudeRangeMaximum,
  9531. int minimumConsecutiveSamples);
  9532. double sampleRate;
  9533. unsigned int bitsPerSample;
  9534. int64 lengthInSamples;
  9535. unsigned int numChannels;
  9536. bool usesFloatingPointData;
  9537. StringPairArray metadataValues;
  9538. InputStream* input;
  9539. virtual bool readSamples (int** destSamples,
  9540. int numDestChannels,
  9541. int startOffsetInDestBuffer,
  9542. int64 startSampleInFile,
  9543. int numSamples) = 0;
  9544. juce_UseDebuggingNewOperator
  9545. private:
  9546. String formatName;
  9547. AudioFormatReader (const AudioFormatReader&);
  9548. AudioFormatReader& operator= (const AudioFormatReader&);
  9549. };
  9550. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9551. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9552. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9553. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9554. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9555. /*** Start of inlined file: juce_AudioSource.h ***/
  9556. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9557. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9558. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9559. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9560. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9561. class AudioFormatReader;
  9562. class AudioFormatWriter;
  9563. class JUCE_API AudioSampleBuffer
  9564. {
  9565. public:
  9566. AudioSampleBuffer (int numChannels,
  9567. int numSamples) throw();
  9568. AudioSampleBuffer (float** dataToReferTo,
  9569. int numChannels,
  9570. int numSamples) throw();
  9571. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9572. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9573. virtual ~AudioSampleBuffer() throw();
  9574. int getNumChannels() const throw() { return numChannels; }
  9575. int getNumSamples() const throw() { return size; }
  9576. float* getSampleData (const int channelNumber) const throw()
  9577. {
  9578. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9579. return channels [channelNumber];
  9580. }
  9581. float* getSampleData (const int channelNumber,
  9582. const int sampleOffset) const throw()
  9583. {
  9584. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9585. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9586. return channels [channelNumber] + sampleOffset;
  9587. }
  9588. float** getArrayOfChannels() const throw() { return channels; }
  9589. void setSize (int newNumChannels,
  9590. int newNumSamples,
  9591. bool keepExistingContent = false,
  9592. bool clearExtraSpace = false,
  9593. bool avoidReallocating = false) throw();
  9594. void setDataToReferTo (float** dataToReferTo,
  9595. int numChannels,
  9596. int numSamples) throw();
  9597. void clear() throw();
  9598. void clear (int startSample,
  9599. int numSamples) throw();
  9600. void clear (int channel,
  9601. int startSample,
  9602. int numSamples) throw();
  9603. void applyGain (int channel,
  9604. int startSample,
  9605. int numSamples,
  9606. float gain) throw();
  9607. void applyGain (int startSample,
  9608. int numSamples,
  9609. float gain) throw();
  9610. void applyGainRamp (int channel,
  9611. int startSample,
  9612. int numSamples,
  9613. float startGain,
  9614. float endGain) throw();
  9615. void addFrom (int destChannel,
  9616. int destStartSample,
  9617. const AudioSampleBuffer& source,
  9618. int sourceChannel,
  9619. int sourceStartSample,
  9620. int numSamples,
  9621. float gainToApplyToSource = 1.0f) throw();
  9622. void addFrom (int destChannel,
  9623. int destStartSample,
  9624. const float* source,
  9625. int numSamples,
  9626. float gainToApplyToSource = 1.0f) throw();
  9627. void addFromWithRamp (int destChannel,
  9628. int destStartSample,
  9629. const float* source,
  9630. int numSamples,
  9631. float startGain,
  9632. float endGain) throw();
  9633. void copyFrom (int destChannel,
  9634. int destStartSample,
  9635. const AudioSampleBuffer& source,
  9636. int sourceChannel,
  9637. int sourceStartSample,
  9638. int numSamples) throw();
  9639. void copyFrom (int destChannel,
  9640. int destStartSample,
  9641. const float* source,
  9642. int numSamples) throw();
  9643. void copyFrom (int destChannel,
  9644. int destStartSample,
  9645. const float* source,
  9646. int numSamples,
  9647. float gain) throw();
  9648. void copyFromWithRamp (int destChannel,
  9649. int destStartSample,
  9650. const float* source,
  9651. int numSamples,
  9652. float startGain,
  9653. float endGain) throw();
  9654. void findMinMax (int channel,
  9655. int startSample,
  9656. int numSamples,
  9657. float& minVal,
  9658. float& maxVal) const throw();
  9659. float getMagnitude (int channel,
  9660. int startSample,
  9661. int numSamples) const throw();
  9662. float getMagnitude (int startSample,
  9663. int numSamples) const throw();
  9664. float getRMSLevel (int channel,
  9665. int startSample,
  9666. int numSamples) const throw();
  9667. void readFromAudioReader (AudioFormatReader* reader,
  9668. int startSample,
  9669. int numSamples,
  9670. int readerStartSample,
  9671. bool useReaderLeftChan,
  9672. bool useReaderRightChan) throw();
  9673. void writeToAudioWriter (AudioFormatWriter* writer,
  9674. int startSample,
  9675. int numSamples) const throw();
  9676. juce_UseDebuggingNewOperator
  9677. private:
  9678. int numChannels, size;
  9679. size_t allocatedBytes;
  9680. float** channels;
  9681. HeapBlock <char> allocatedData;
  9682. float* preallocatedChannelSpace [32];
  9683. void allocateData();
  9684. void allocateChannels (float** dataToReferTo);
  9685. };
  9686. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9687. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9688. struct JUCE_API AudioSourceChannelInfo
  9689. {
  9690. AudioSampleBuffer* buffer;
  9691. int startSample;
  9692. int numSamples;
  9693. void clearActiveBufferRegion() const
  9694. {
  9695. if (buffer != 0)
  9696. buffer->clear (startSample, numSamples);
  9697. }
  9698. };
  9699. class JUCE_API AudioSource
  9700. {
  9701. protected:
  9702. AudioSource() throw() {}
  9703. public:
  9704. virtual ~AudioSource() {}
  9705. virtual void prepareToPlay (int samplesPerBlockExpected,
  9706. double sampleRate) = 0;
  9707. virtual void releaseResources() = 0;
  9708. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9709. };
  9710. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9711. /*** End of inlined file: juce_AudioSource.h ***/
  9712. class JUCE_API AudioFormatWriter
  9713. {
  9714. protected:
  9715. AudioFormatWriter (OutputStream* destStream,
  9716. const String& formatName,
  9717. double sampleRate,
  9718. unsigned int numberOfChannels,
  9719. unsigned int bitsPerSample);
  9720. public:
  9721. virtual ~AudioFormatWriter();
  9722. const String getFormatName() const throw() { return formatName; }
  9723. virtual bool write (const int** samplesToWrite,
  9724. int numSamples) = 0;
  9725. bool writeFromAudioReader (AudioFormatReader& reader,
  9726. int64 startSample,
  9727. int64 numSamplesToRead);
  9728. bool writeFromAudioSource (AudioSource& source,
  9729. int numSamplesToRead,
  9730. int samplesPerBlock = 2048);
  9731. double getSampleRate() const throw() { return sampleRate; }
  9732. int getNumChannels() const throw() { return numChannels; }
  9733. int getBitsPerSample() const throw() { return bitsPerSample; }
  9734. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9735. juce_UseDebuggingNewOperator
  9736. protected:
  9737. double sampleRate;
  9738. unsigned int numChannels;
  9739. unsigned int bitsPerSample;
  9740. bool usesFloatingPointData;
  9741. OutputStream* output;
  9742. private:
  9743. String formatName;
  9744. AudioFormatWriter (const AudioFormatWriter&);
  9745. AudioFormatWriter& operator= (const AudioFormatWriter&);
  9746. };
  9747. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9748. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9749. class JUCE_API AudioFormat
  9750. {
  9751. public:
  9752. virtual ~AudioFormat();
  9753. const String& getFormatName() const;
  9754. const StringArray& getFileExtensions() const;
  9755. virtual bool canHandleFile (const File& fileToTest);
  9756. virtual const Array <int> getPossibleSampleRates() = 0;
  9757. virtual const Array <int> getPossibleBitDepths() = 0;
  9758. virtual bool canDoStereo() = 0;
  9759. virtual bool canDoMono() = 0;
  9760. virtual bool isCompressed();
  9761. virtual const StringArray getQualityOptions();
  9762. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9763. const bool deleteStreamIfOpeningFails) = 0;
  9764. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9765. double sampleRateToUse,
  9766. unsigned int numberOfChannels,
  9767. int bitsPerSample,
  9768. const StringPairArray& metadataValues,
  9769. int qualityOptionIndex) = 0;
  9770. protected:
  9771. AudioFormat (const String& formatName,
  9772. const juce_wchar** const fileExtensions);
  9773. private:
  9774. String formatName;
  9775. StringArray fileExtensions;
  9776. };
  9777. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9778. /*** End of inlined file: juce_AudioFormat.h ***/
  9779. class JUCE_API AiffAudioFormat : public AudioFormat
  9780. {
  9781. public:
  9782. AiffAudioFormat();
  9783. ~AiffAudioFormat();
  9784. const Array <int> getPossibleSampleRates();
  9785. const Array <int> getPossibleBitDepths();
  9786. bool canDoStereo();
  9787. bool canDoMono();
  9788. #if JUCE_MAC
  9789. bool canHandleFile (const File& fileToTest);
  9790. #endif
  9791. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9792. const bool deleteStreamIfOpeningFails);
  9793. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9794. double sampleRateToUse,
  9795. unsigned int numberOfChannels,
  9796. int bitsPerSample,
  9797. const StringPairArray& metadataValues,
  9798. int qualityOptionIndex);
  9799. juce_UseDebuggingNewOperator
  9800. };
  9801. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9802. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9803. #endif
  9804. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9805. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9806. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9807. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9808. #if JUCE_USE_CDBURNER
  9809. class AudioCDBurner : public ChangeBroadcaster
  9810. {
  9811. public:
  9812. static const StringArray findAvailableDevices();
  9813. static AudioCDBurner* openDevice (const int deviceIndex);
  9814. ~AudioCDBurner();
  9815. enum DiskState
  9816. {
  9817. unknown, /**< An error condition, if the device isn't responding. */
  9818. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9819. may seem to be permanently open. */
  9820. noDisc, /**< The drive has no disk in it. */
  9821. writableDiskPresent, /**< The drive contains a writeable disk. */
  9822. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9823. };
  9824. DiskState getDiskState() const;
  9825. bool isDiskPresent() const;
  9826. bool openTray();
  9827. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9828. const Array<int> getAvailableWriteSpeeds() const;
  9829. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9830. int getNumAvailableAudioBlocks() const;
  9831. bool addAudioTrack (AudioSource* source, int numSamples);
  9832. class BurnProgressListener
  9833. {
  9834. public:
  9835. BurnProgressListener() throw() {}
  9836. virtual ~BurnProgressListener() {}
  9837. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9838. };
  9839. const String burn (BurnProgressListener* listener,
  9840. bool ejectDiscAfterwards,
  9841. bool performFakeBurnForTesting,
  9842. int writeSpeed);
  9843. void abortBurn();
  9844. juce_UseDebuggingNewOperator
  9845. private:
  9846. AudioCDBurner (const int deviceIndex);
  9847. class Pimpl;
  9848. friend class ScopedPointer<Pimpl>;
  9849. ScopedPointer<Pimpl> pimpl;
  9850. };
  9851. #endif
  9852. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9853. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9854. #endif
  9855. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9856. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9857. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9858. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9859. #if JUCE_USE_CDREADER
  9860. #if JUCE_MAC
  9861. #endif
  9862. class JUCE_API AudioCDReader : public AudioFormatReader
  9863. {
  9864. public:
  9865. static const StringArray getAvailableCDNames();
  9866. static AudioCDReader* createReaderForCD (const int index);
  9867. ~AudioCDReader();
  9868. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9869. int64 startSampleInFile, int numSamples);
  9870. bool isCDStillPresent() const;
  9871. int getNumTracks() const;
  9872. int getPositionOfTrackStart (int trackNum) const;
  9873. bool isTrackAudio (int trackNum) const;
  9874. void refreshTrackLengths();
  9875. void enableIndexScanning (bool enabled);
  9876. int getLastIndex() const;
  9877. const Array <int> findIndexesInTrack (const int trackNumber);
  9878. int getCDDBId();
  9879. void ejectDisk();
  9880. juce_UseDebuggingNewOperator
  9881. private:
  9882. #if JUCE_MAC
  9883. File volumeDir;
  9884. Array<File> tracks;
  9885. Array<int> trackStartSamples;
  9886. int currentReaderTrack;
  9887. ScopedPointer <AudioFormatReader> reader;
  9888. AudioCDReader (const File& volume);
  9889. public:
  9890. static int compareElements (const File&, const File&);
  9891. private:
  9892. #elif JUCE_WINDOWS
  9893. int numTracks;
  9894. int trackStarts[100];
  9895. bool audioTracks [100];
  9896. void* handle;
  9897. bool indexingEnabled;
  9898. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9899. MemoryBlock buffer;
  9900. AudioCDReader (void* handle);
  9901. int getIndexAt (int samplePos);
  9902. #elif JUCE_LINUX
  9903. AudioCDReader();
  9904. #endif
  9905. AudioCDReader (const AudioCDReader&);
  9906. AudioCDReader& operator= (const AudioCDReader&);
  9907. };
  9908. #endif
  9909. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9910. /*** End of inlined file: juce_AudioCDReader.h ***/
  9911. #endif
  9912. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9913. #endif
  9914. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9915. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9916. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9917. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9918. class JUCE_API AudioFormatManager
  9919. {
  9920. public:
  9921. AudioFormatManager();
  9922. ~AudioFormatManager();
  9923. juce_DeclareSingleton (AudioFormatManager, false);
  9924. void registerFormat (AudioFormat* newFormat,
  9925. bool makeThisTheDefaultFormat);
  9926. void registerBasicFormats();
  9927. void clearFormats();
  9928. int getNumKnownFormats() const;
  9929. AudioFormat* getKnownFormat (int index) const;
  9930. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9931. AudioFormat* getDefaultFormat() const;
  9932. const String getWildcardForAllFormats() const;
  9933. AudioFormatReader* createReaderFor (const File& audioFile);
  9934. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9935. juce_UseDebuggingNewOperator
  9936. private:
  9937. VoidArray knownFormats;
  9938. int defaultFormatIndex;
  9939. };
  9940. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9941. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9942. #endif
  9943. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9944. #endif
  9945. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9946. #endif
  9947. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9948. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9949. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9950. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9951. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9952. {
  9953. public:
  9954. AudioSubsectionReader (AudioFormatReader* sourceReader,
  9955. int64 subsectionStartSample,
  9956. int64 subsectionLength,
  9957. bool deleteSourceWhenDeleted);
  9958. ~AudioSubsectionReader();
  9959. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9960. int64 startSampleInFile, int numSamples);
  9961. void readMaxLevels (int64 startSample,
  9962. int64 numSamples,
  9963. float& lowestLeft,
  9964. float& highestLeft,
  9965. float& lowestRight,
  9966. float& highestRight);
  9967. juce_UseDebuggingNewOperator
  9968. private:
  9969. AudioFormatReader* const source;
  9970. int64 startSample, length;
  9971. const bool deleteSourceWhenDeleted;
  9972. AudioSubsectionReader (const AudioSubsectionReader&);
  9973. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9974. };
  9975. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9976. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9977. #endif
  9978. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9979. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9980. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9981. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9982. class AudioThumbnailCache;
  9983. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9984. public TimeSliceClient,
  9985. private Timer
  9986. {
  9987. public:
  9988. AudioThumbnail (int sourceSamplesPerThumbnailSample,
  9989. AudioFormatManager& formatManagerToUse,
  9990. AudioThumbnailCache& cacheToUse);
  9991. ~AudioThumbnail();
  9992. void setSource (InputSource* newSource);
  9993. void loadFrom (InputStream& input);
  9994. void saveTo (OutputStream& output) const;
  9995. int getNumChannels() const throw();
  9996. double getTotalLength() const throw();
  9997. void drawChannel (Graphics& g,
  9998. int x, int y, int w, int h,
  9999. double startTimeSeconds,
  10000. double endTimeSeconds,
  10001. int channelNum,
  10002. float verticalZoomFactor);
  10003. bool isFullyLoaded() const throw();
  10004. bool useTimeSlice();
  10005. void timerCallback();
  10006. juce_UseDebuggingNewOperator
  10007. private:
  10008. AudioFormatManager& formatManagerToUse;
  10009. AudioThumbnailCache& cache;
  10010. ScopedPointer <InputSource> source;
  10011. CriticalSection readerLock;
  10012. ScopedPointer <AudioFormatReader> reader;
  10013. MemoryBlock data, cachedLevels;
  10014. int orginalSamplesPerThumbnailSample;
  10015. int numChannelsCached, numSamplesCached;
  10016. double cachedStart, cachedTimePerPixel;
  10017. bool cacheNeedsRefilling;
  10018. void clear();
  10019. AudioFormatReader* createReader() const;
  10020. void generateSection (AudioFormatReader& reader, int64 startSample, int numSamples);
  10021. char* getChannelData (int channel) const;
  10022. void refillCache (int numSamples, double startTime, double timePerPixel);
  10023. friend class AudioThumbnailCache;
  10024. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  10025. bool initialiseFromAudioFile (AudioFormatReader& reader);
  10026. // returns true if more needs to be read
  10027. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  10028. };
  10029. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  10030. /*** End of inlined file: juce_AudioThumbnail.h ***/
  10031. #endif
  10032. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10033. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  10034. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10035. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10036. struct ThumbnailCacheEntry;
  10037. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  10038. {
  10039. public:
  10040. explicit AudioThumbnailCache (int maxNumThumbsToStore);
  10041. ~AudioThumbnailCache();
  10042. void clear();
  10043. bool loadThumb (AudioThumbnail& thumb, int64 hashCode);
  10044. void storeThumb (const AudioThumbnail& thumb, int64 hashCode);
  10045. juce_UseDebuggingNewOperator
  10046. private:
  10047. OwnedArray <ThumbnailCacheEntry> thumbs;
  10048. int maxNumThumbsToStore;
  10049. friend class AudioThumbnail;
  10050. void addThumbnail (AudioThumbnail* thumb);
  10051. void removeThumbnail (AudioThumbnail* thumb);
  10052. };
  10053. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  10054. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  10055. #endif
  10056. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10057. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  10058. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10059. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10060. #if JUCE_USE_FLAC || defined (DOXYGEN)
  10061. class JUCE_API FlacAudioFormat : public AudioFormat
  10062. {
  10063. public:
  10064. FlacAudioFormat();
  10065. ~FlacAudioFormat();
  10066. const Array <int> getPossibleSampleRates();
  10067. const Array <int> getPossibleBitDepths();
  10068. bool canDoStereo();
  10069. bool canDoMono();
  10070. bool isCompressed();
  10071. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10072. const bool deleteStreamIfOpeningFails);
  10073. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10074. double sampleRateToUse,
  10075. unsigned int numberOfChannels,
  10076. int bitsPerSample,
  10077. const StringPairArray& metadataValues,
  10078. int qualityOptionIndex);
  10079. juce_UseDebuggingNewOperator
  10080. };
  10081. #endif
  10082. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  10083. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  10084. #endif
  10085. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10086. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  10087. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10088. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10089. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  10090. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  10091. {
  10092. public:
  10093. OggVorbisAudioFormat();
  10094. ~OggVorbisAudioFormat();
  10095. const Array <int> getPossibleSampleRates();
  10096. const Array <int> getPossibleBitDepths();
  10097. bool canDoStereo();
  10098. bool canDoMono();
  10099. bool isCompressed();
  10100. const StringArray getQualityOptions();
  10101. int estimateOggFileQuality (const File& source);
  10102. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10103. const bool deleteStreamIfOpeningFails);
  10104. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10105. double sampleRateToUse,
  10106. unsigned int numberOfChannels,
  10107. int bitsPerSample,
  10108. const StringPairArray& metadataValues,
  10109. int qualityOptionIndex);
  10110. juce_UseDebuggingNewOperator
  10111. };
  10112. #endif
  10113. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  10114. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  10115. #endif
  10116. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10117. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  10118. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10119. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10120. #if JUCE_QUICKTIME
  10121. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  10122. {
  10123. public:
  10124. QuickTimeAudioFormat();
  10125. ~QuickTimeAudioFormat();
  10126. const Array <int> getPossibleSampleRates();
  10127. const Array <int> getPossibleBitDepths();
  10128. bool canDoStereo();
  10129. bool canDoMono();
  10130. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10131. const bool deleteStreamIfOpeningFails);
  10132. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10133. double sampleRateToUse,
  10134. unsigned int numberOfChannels,
  10135. int bitsPerSample,
  10136. const StringPairArray& metadataValues,
  10137. int qualityOptionIndex);
  10138. juce_UseDebuggingNewOperator
  10139. };
  10140. #endif
  10141. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  10142. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  10143. #endif
  10144. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10145. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  10146. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10147. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10148. class JUCE_API WavAudioFormat : public AudioFormat
  10149. {
  10150. public:
  10151. WavAudioFormat();
  10152. ~WavAudioFormat();
  10153. static const char* const bwavDescription;
  10154. static const char* const bwavOriginator;
  10155. static const char* const bwavOriginatorRef;
  10156. static const char* const bwavOriginationDate;
  10157. static const char* const bwavOriginationTime;
  10158. static const char* const bwavTimeReference;
  10159. static const char* const bwavCodingHistory;
  10160. static const StringPairArray createBWAVMetadata (const String& description,
  10161. const String& originator,
  10162. const String& originatorRef,
  10163. const Time& dateAndTime,
  10164. const int64 timeReferenceSamples,
  10165. const String& codingHistory);
  10166. const Array <int> getPossibleSampleRates();
  10167. const Array <int> getPossibleBitDepths();
  10168. bool canDoStereo();
  10169. bool canDoMono();
  10170. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10171. const bool deleteStreamIfOpeningFails);
  10172. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10173. double sampleRateToUse,
  10174. unsigned int numberOfChannels,
  10175. int bitsPerSample,
  10176. const StringPairArray& metadataValues,
  10177. int qualityOptionIndex);
  10178. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10179. juce_UseDebuggingNewOperator
  10180. };
  10181. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10182. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10183. #endif
  10184. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10185. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10186. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10187. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10188. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10189. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10190. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10191. class JUCE_API PositionableAudioSource : public AudioSource
  10192. {
  10193. protected:
  10194. PositionableAudioSource() throw() {}
  10195. public:
  10196. ~PositionableAudioSource() {}
  10197. virtual void setNextReadPosition (int newPosition) = 0;
  10198. virtual int getNextReadPosition() const = 0;
  10199. virtual int getTotalLength() const = 0;
  10200. virtual bool isLooping() const = 0;
  10201. };
  10202. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10203. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10204. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10205. {
  10206. public:
  10207. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10208. const bool deleteReaderWhenThisIsDeleted);
  10209. ~AudioFormatReaderSource();
  10210. void setLooping (const bool shouldLoop) throw();
  10211. bool isLooping() const { return looping; }
  10212. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  10213. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10214. void releaseResources();
  10215. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10216. void setNextReadPosition (int newPosition);
  10217. int getNextReadPosition() const;
  10218. int getTotalLength() const;
  10219. juce_UseDebuggingNewOperator
  10220. private:
  10221. AudioFormatReader* reader;
  10222. bool deleteReader;
  10223. int volatile nextPlayPos;
  10224. bool volatile looping;
  10225. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10226. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10227. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10228. };
  10229. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10230. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10231. #endif
  10232. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10233. #endif
  10234. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10235. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10236. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10237. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10238. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10239. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10240. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10241. class AudioIODevice;
  10242. class JUCE_API AudioIODeviceCallback
  10243. {
  10244. public:
  10245. virtual ~AudioIODeviceCallback() {}
  10246. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10247. int numInputChannels,
  10248. float** outputChannelData,
  10249. int numOutputChannels,
  10250. int numSamples) = 0;
  10251. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10252. virtual void audioDeviceStopped() = 0;
  10253. };
  10254. class JUCE_API AudioIODevice
  10255. {
  10256. public:
  10257. virtual ~AudioIODevice();
  10258. const String& getName() const throw() { return name; }
  10259. const String& getTypeName() const throw() { return typeName; }
  10260. virtual const StringArray getOutputChannelNames() = 0;
  10261. virtual const StringArray getInputChannelNames() = 0;
  10262. virtual int getNumSampleRates() = 0;
  10263. virtual double getSampleRate (int index) = 0;
  10264. virtual int getNumBufferSizesAvailable() = 0;
  10265. virtual int getBufferSizeSamples (int index) = 0;
  10266. virtual int getDefaultBufferSize() = 0;
  10267. virtual const String open (const BigInteger& inputChannels,
  10268. const BigInteger& outputChannels,
  10269. double sampleRate,
  10270. int bufferSizeSamples) = 0;
  10271. virtual void close() = 0;
  10272. virtual bool isOpen() = 0;
  10273. virtual void start (AudioIODeviceCallback* callback) = 0;
  10274. virtual void stop() = 0;
  10275. virtual bool isPlaying() = 0;
  10276. virtual const String getLastError() = 0;
  10277. virtual int getCurrentBufferSizeSamples() = 0;
  10278. virtual double getCurrentSampleRate() = 0;
  10279. virtual int getCurrentBitDepth() = 0;
  10280. virtual const BigInteger getActiveOutputChannels() const = 0;
  10281. virtual const BigInteger getActiveInputChannels() const = 0;
  10282. virtual int getOutputLatencyInSamples() = 0;
  10283. virtual int getInputLatencyInSamples() = 0;
  10284. virtual bool hasControlPanel() const;
  10285. virtual bool showControlPanel();
  10286. protected:
  10287. AudioIODevice (const String& deviceName,
  10288. const String& typeName);
  10289. String name, typeName;
  10290. };
  10291. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10292. /*** End of inlined file: juce_AudioIODevice.h ***/
  10293. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10294. {
  10295. public:
  10296. AudioSourcePlayer();
  10297. virtual ~AudioSourcePlayer();
  10298. void setSource (AudioSource* newSource);
  10299. AudioSource* getCurrentSource() const throw() { return source; }
  10300. void setGain (const float newGain) throw();
  10301. void audioDeviceIOCallback (const float** inputChannelData,
  10302. int totalNumInputChannels,
  10303. float** outputChannelData,
  10304. int totalNumOutputChannels,
  10305. int numSamples);
  10306. void audioDeviceAboutToStart (AudioIODevice* device);
  10307. void audioDeviceStopped();
  10308. juce_UseDebuggingNewOperator
  10309. private:
  10310. CriticalSection readLock;
  10311. AudioSource* source;
  10312. double sampleRate;
  10313. int bufferSize;
  10314. float* channels [128];
  10315. float* outputChans [128];
  10316. const float* inputChans [128];
  10317. AudioSampleBuffer tempBuffer;
  10318. float lastGain, gain;
  10319. AudioSourcePlayer (const AudioSourcePlayer&);
  10320. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10321. };
  10322. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10323. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10324. #endif
  10325. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10326. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10327. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10328. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10329. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10330. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10331. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10332. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10333. {
  10334. public:
  10335. BufferingAudioSource (PositionableAudioSource* source,
  10336. const bool deleteSourceWhenDeleted,
  10337. int numberOfSamplesToBuffer);
  10338. ~BufferingAudioSource();
  10339. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10340. void releaseResources();
  10341. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10342. void setNextReadPosition (int newPosition);
  10343. int getNextReadPosition() const;
  10344. int getTotalLength() const { return source->getTotalLength(); }
  10345. bool isLooping() const { return source->isLooping(); }
  10346. juce_UseDebuggingNewOperator
  10347. private:
  10348. PositionableAudioSource* source;
  10349. bool deleteSourceWhenDeleted;
  10350. int numberOfSamplesToBuffer;
  10351. AudioSampleBuffer buffer;
  10352. CriticalSection bufferStartPosLock;
  10353. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10354. bool wasSourceLooping;
  10355. double volatile sampleRate;
  10356. friend class SharedBufferingAudioSourceThread;
  10357. bool readNextBufferChunk();
  10358. void readBufferSection (int start, int length, int bufferOffset);
  10359. BufferingAudioSource (const BufferingAudioSource&);
  10360. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10361. };
  10362. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10363. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10364. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10365. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10366. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10367. class JUCE_API ResamplingAudioSource : public AudioSource
  10368. {
  10369. public:
  10370. ResamplingAudioSource (AudioSource* const inputSource,
  10371. const bool deleteInputWhenDeleted);
  10372. ~ResamplingAudioSource();
  10373. void setResamplingRatio (const double samplesInPerOutputSample);
  10374. double getResamplingRatio() const throw() { return ratio; }
  10375. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10376. void releaseResources();
  10377. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10378. juce_UseDebuggingNewOperator
  10379. private:
  10380. AudioSource* const input;
  10381. const bool deleteInputWhenDeleted;
  10382. double ratio, lastRatio;
  10383. AudioSampleBuffer buffer;
  10384. int bufferPos, sampsInBuffer;
  10385. double subSampleOffset;
  10386. double coefficients[6];
  10387. CriticalSection ratioLock;
  10388. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10389. void createLowPass (const double proportionalRate);
  10390. struct FilterState
  10391. {
  10392. double x1, x2, y1, y2;
  10393. };
  10394. FilterState filterStates[2];
  10395. void resetFilters();
  10396. void applyFilter (float* samples, int num, FilterState& fs);
  10397. ResamplingAudioSource (const ResamplingAudioSource&);
  10398. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10399. };
  10400. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10401. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10402. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10403. public ChangeBroadcaster
  10404. {
  10405. public:
  10406. AudioTransportSource();
  10407. ~AudioTransportSource();
  10408. void setSource (PositionableAudioSource* const newSource,
  10409. int readAheadBufferSize = 0,
  10410. double sourceSampleRateToCorrectFor = 0.0);
  10411. void setPosition (double newPosition);
  10412. double getCurrentPosition() const;
  10413. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10414. void start();
  10415. void stop();
  10416. bool isPlaying() const throw() { return playing; }
  10417. void setGain (const float newGain) throw();
  10418. float getGain() const throw() { return gain; }
  10419. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10420. void releaseResources();
  10421. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10422. void setNextReadPosition (int newPosition);
  10423. int getNextReadPosition() const;
  10424. int getTotalLength() const;
  10425. bool isLooping() const;
  10426. juce_UseDebuggingNewOperator
  10427. private:
  10428. PositionableAudioSource* source;
  10429. ResamplingAudioSource* resamplerSource;
  10430. BufferingAudioSource* bufferingSource;
  10431. PositionableAudioSource* positionableSource;
  10432. AudioSource* masterSource;
  10433. CriticalSection callbackLock;
  10434. float volatile gain, lastGain;
  10435. bool volatile playing, stopped;
  10436. double sampleRate, sourceSampleRate;
  10437. int blockSize, readAheadBufferSize;
  10438. bool isPrepared, inputStreamEOF;
  10439. AudioTransportSource (const AudioTransportSource&);
  10440. AudioTransportSource& operator= (const AudioTransportSource&);
  10441. };
  10442. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10443. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10444. #endif
  10445. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10446. #endif
  10447. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10448. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10449. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10450. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10451. class ChannelRemappingAudioSource : public AudioSource
  10452. {
  10453. public:
  10454. ChannelRemappingAudioSource (AudioSource* const source,
  10455. const bool deleteSourceWhenDeleted);
  10456. ~ChannelRemappingAudioSource();
  10457. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10458. void clearAllMappings() throw();
  10459. void setInputChannelMapping (const int destChannelIndex,
  10460. const int sourceChannelIndex) throw();
  10461. void setOutputChannelMapping (const int sourceChannelIndex,
  10462. const int destChannelIndex) throw();
  10463. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10464. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10465. XmlElement* createXml() const throw();
  10466. void restoreFromXml (const XmlElement& e) throw();
  10467. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10468. void releaseResources();
  10469. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10470. juce_UseDebuggingNewOperator
  10471. private:
  10472. int requiredNumberOfChannels;
  10473. Array <int> remappedInputs, remappedOutputs;
  10474. AudioSource* const source;
  10475. const bool deleteSourceWhenDeleted;
  10476. AudioSampleBuffer buffer;
  10477. AudioSourceChannelInfo remappedInfo;
  10478. CriticalSection lock;
  10479. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10480. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10481. };
  10482. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10483. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10484. #endif
  10485. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10486. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10487. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10488. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10489. /*** Start of inlined file: juce_IIRFilter.h ***/
  10490. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10491. #define __JUCE_IIRFILTER_JUCEHEADER__
  10492. class JUCE_API IIRFilter
  10493. {
  10494. public:
  10495. IIRFilter();
  10496. IIRFilter (const IIRFilter& other);
  10497. ~IIRFilter();
  10498. void reset() throw();
  10499. void processSamples (float* samples,
  10500. int numSamples) throw();
  10501. float processSingleSampleRaw (float sample) throw();
  10502. void makeLowPass (double sampleRate,
  10503. double frequency) throw();
  10504. void makeHighPass (double sampleRate,
  10505. double frequency) throw();
  10506. void makeLowShelf (double sampleRate,
  10507. double cutOffFrequency,
  10508. double Q,
  10509. float gainFactor) throw();
  10510. void makeHighShelf (double sampleRate,
  10511. double cutOffFrequency,
  10512. double Q,
  10513. float gainFactor) throw();
  10514. void makeBandPass (double sampleRate,
  10515. double centreFrequency,
  10516. double Q,
  10517. float gainFactor) throw();
  10518. void makeInactive() throw();
  10519. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10520. juce_UseDebuggingNewOperator
  10521. protected:
  10522. CriticalSection processLock;
  10523. void setCoefficients (double c1, double c2, double c3,
  10524. double c4, double c5, double c6) throw();
  10525. bool active;
  10526. float coefficients[6];
  10527. float x1, x2, y1, y2;
  10528. // (use the copyCoefficientsFrom() method instead of this operator)
  10529. IIRFilter& operator= (const IIRFilter&);
  10530. };
  10531. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10532. /*** End of inlined file: juce_IIRFilter.h ***/
  10533. class JUCE_API IIRFilterAudioSource : public AudioSource
  10534. {
  10535. public:
  10536. IIRFilterAudioSource (AudioSource* const inputSource,
  10537. const bool deleteInputWhenDeleted);
  10538. ~IIRFilterAudioSource();
  10539. void setFilterParameters (const IIRFilter& newSettings);
  10540. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10541. void releaseResources();
  10542. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10543. juce_UseDebuggingNewOperator
  10544. private:
  10545. AudioSource* const input;
  10546. const bool deleteInputWhenDeleted;
  10547. OwnedArray <IIRFilter> iirFilters;
  10548. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10549. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10550. };
  10551. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10552. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10553. #endif
  10554. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10555. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10556. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10557. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10558. class JUCE_API MixerAudioSource : public AudioSource
  10559. {
  10560. public:
  10561. MixerAudioSource();
  10562. ~MixerAudioSource();
  10563. void addInputSource (AudioSource* newInput,
  10564. const bool deleteWhenRemoved);
  10565. void removeInputSource (AudioSource* input,
  10566. const bool deleteSource);
  10567. void removeAllInputs();
  10568. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10569. void releaseResources();
  10570. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10571. juce_UseDebuggingNewOperator
  10572. private:
  10573. VoidArray inputs;
  10574. BigInteger inputsToDelete;
  10575. CriticalSection lock;
  10576. AudioSampleBuffer tempBuffer;
  10577. double currentSampleRate;
  10578. int bufferSizeExpected;
  10579. MixerAudioSource (const MixerAudioSource&);
  10580. MixerAudioSource& operator= (const MixerAudioSource&);
  10581. };
  10582. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10583. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10584. #endif
  10585. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10586. #endif
  10587. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10588. #endif
  10589. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10590. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10591. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10592. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10593. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10594. {
  10595. public:
  10596. ToneGeneratorAudioSource();
  10597. ~ToneGeneratorAudioSource();
  10598. void setAmplitude (const float newAmplitude);
  10599. void setFrequency (const double newFrequencyHz);
  10600. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10601. void releaseResources();
  10602. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10603. juce_UseDebuggingNewOperator
  10604. private:
  10605. double frequency, sampleRate;
  10606. double currentPhase, phasePerSample;
  10607. float amplitude;
  10608. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10609. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10610. };
  10611. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10612. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10613. #endif
  10614. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10615. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10616. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10617. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10618. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10619. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10620. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10621. class AudioDeviceManager;
  10622. class Component;
  10623. class JUCE_API AudioIODeviceType
  10624. {
  10625. public:
  10626. const String& getTypeName() const throw() { return typeName; }
  10627. virtual void scanForDevices() = 0;
  10628. virtual const StringArray getDeviceNames (bool wantInputNames = false) const = 0;
  10629. virtual int getDefaultDeviceIndex (bool forInput) const = 0;
  10630. virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
  10631. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10632. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10633. const String& inputDeviceName) = 0;
  10634. struct DeviceSetupDetails
  10635. {
  10636. AudioDeviceManager* manager;
  10637. int minNumInputChannels, maxNumInputChannels;
  10638. int minNumOutputChannels, maxNumOutputChannels;
  10639. bool useStereoPairs;
  10640. };
  10641. virtual ~AudioIODeviceType();
  10642. protected:
  10643. explicit AudioIODeviceType (const String& typeName);
  10644. private:
  10645. String typeName;
  10646. AudioIODeviceType (const AudioIODeviceType&);
  10647. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10648. };
  10649. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10650. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10651. /*** Start of inlined file: juce_MidiInput.h ***/
  10652. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10653. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10654. /*** Start of inlined file: juce_MidiMessage.h ***/
  10655. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10656. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10657. class JUCE_API MidiMessage
  10658. {
  10659. public:
  10660. MidiMessage (int byte1, int byte2, int byte3, double timeStamp = 0) throw();
  10661. MidiMessage (int byte1, int byte2, double timeStamp = 0) throw();
  10662. MidiMessage (int byte1, double timeStamp = 0) throw();
  10663. MidiMessage (const void* data, int numBytes, double timeStamp = 0);
  10664. MidiMessage (const void* data, int maxBytesToUse,
  10665. int& numBytesUsed, uint8 lastStatusByte,
  10666. double timeStamp = 0);
  10667. MidiMessage (const MidiMessage& other);
  10668. MidiMessage (const MidiMessage& other, double newTimeStamp);
  10669. ~MidiMessage();
  10670. MidiMessage& operator= (const MidiMessage& other);
  10671. uint8* getRawData() const throw() { return data; }
  10672. int getRawDataSize() const throw() { return size; }
  10673. double getTimeStamp() const throw() { return timeStamp; }
  10674. void setTimeStamp (double newTimestamp) throw() { timeStamp = newTimestamp; }
  10675. void addToTimeStamp (double delta) throw() { timeStamp += delta; }
  10676. int getChannel() const throw();
  10677. bool isForChannel (int channelNumber) const throw();
  10678. void setChannel (int newChannelNumber) throw();
  10679. bool isSysEx() const throw();
  10680. const uint8* getSysExData() const throw();
  10681. int getSysExDataSize() const throw();
  10682. bool isNoteOn (bool returnTrueForVelocity0 = false) const throw();
  10683. static const MidiMessage noteOn (int channel, int noteNumber, float velocity) throw();
  10684. static const MidiMessage noteOn (int channel, int noteNumber, uint8 velocity) throw();
  10685. bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const throw();
  10686. static const MidiMessage noteOff (int channel, int noteNumber) throw();
  10687. bool isNoteOnOrOff() const throw();
  10688. int getNoteNumber() const throw();
  10689. void setNoteNumber (int newNoteNumber) throw();
  10690. uint8 getVelocity() const throw();
  10691. float getFloatVelocity() const throw();
  10692. void setVelocity (float newVelocity) throw();
  10693. void multiplyVelocity (float scaleFactor) throw();
  10694. bool isProgramChange() const throw();
  10695. int getProgramChangeNumber() const throw();
  10696. static const MidiMessage programChange (int channel, int programNumber) throw();
  10697. bool isPitchWheel() const throw();
  10698. int getPitchWheelValue() const throw();
  10699. static const MidiMessage pitchWheel (int channel, int position) throw();
  10700. bool isAftertouch() const throw();
  10701. int getAfterTouchValue() const throw();
  10702. static const MidiMessage aftertouchChange (int channel,
  10703. int noteNumber,
  10704. int aftertouchAmount) throw();
  10705. bool isChannelPressure() const throw();
  10706. int getChannelPressureValue() const throw();
  10707. static const MidiMessage channelPressureChange (int channel, int pressure) throw();
  10708. bool isController() const throw();
  10709. int getControllerNumber() const throw();
  10710. int getControllerValue() const throw();
  10711. static const MidiMessage controllerEvent (int channel,
  10712. int controllerType,
  10713. int value) throw();
  10714. bool isAllNotesOff() const throw();
  10715. bool isAllSoundOff() const throw();
  10716. static const MidiMessage allNotesOff (int channel) throw();
  10717. static const MidiMessage allSoundOff (int channel) throw();
  10718. static const MidiMessage allControllersOff (int channel) throw();
  10719. bool isMetaEvent() const throw();
  10720. int getMetaEventType() const throw();
  10721. const uint8* getMetaEventData() const throw();
  10722. int getMetaEventLength() const throw();
  10723. bool isTrackMetaEvent() const throw();
  10724. bool isEndOfTrackMetaEvent() const throw();
  10725. static const MidiMessage endOfTrack() throw();
  10726. bool isTrackNameEvent() const throw();
  10727. bool isTextMetaEvent() const throw();
  10728. const String getTextFromTextMetaEvent() const;
  10729. bool isTempoMetaEvent() const throw();
  10730. double getTempoMetaEventTickLength (short timeFormat) const throw();
  10731. double getTempoSecondsPerQuarterNote() const throw();
  10732. static const MidiMessage tempoMetaEvent (int microsecondsPerQuarterNote) throw();
  10733. bool isTimeSignatureMetaEvent() const throw();
  10734. void getTimeSignatureInfo (int& numerator, int& denominator) const throw();
  10735. static const MidiMessage timeSignatureMetaEvent (int numerator, int denominator);
  10736. bool isKeySignatureMetaEvent() const throw();
  10737. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10738. bool isMidiChannelMetaEvent() const throw();
  10739. int getMidiChannelMetaEventChannel() const throw();
  10740. static const MidiMessage midiChannelMetaEvent (int channel) throw();
  10741. bool isActiveSense() const throw();
  10742. bool isMidiStart() const throw();
  10743. static const MidiMessage midiStart() throw();
  10744. bool isMidiContinue() const throw();
  10745. static const MidiMessage midiContinue() throw();
  10746. bool isMidiStop() const throw();
  10747. static const MidiMessage midiStop() throw();
  10748. bool isMidiClock() const throw();
  10749. static const MidiMessage midiClock() throw();
  10750. bool isSongPositionPointer() const throw();
  10751. int getSongPositionPointerMidiBeat() const throw();
  10752. static const MidiMessage songPositionPointer (int positionInMidiBeats) throw();
  10753. bool isQuarterFrame() const throw();
  10754. int getQuarterFrameSequenceNumber() const throw();
  10755. int getQuarterFrameValue() const throw();
  10756. static const MidiMessage quarterFrame (int sequenceNumber, int value) throw();
  10757. enum SmpteTimecodeType
  10758. {
  10759. fps24 = 0,
  10760. fps25 = 1,
  10761. fps30drop = 2,
  10762. fps30 = 3
  10763. };
  10764. bool isFullFrame() const throw();
  10765. void getFullFrameParameters (int& hours,
  10766. int& minutes,
  10767. int& seconds,
  10768. int& frames,
  10769. SmpteTimecodeType& timecodeType) const throw();
  10770. static const MidiMessage fullFrame (int hours,
  10771. int minutes,
  10772. int seconds,
  10773. int frames,
  10774. SmpteTimecodeType timecodeType);
  10775. enum MidiMachineControlCommand
  10776. {
  10777. mmc_stop = 1,
  10778. mmc_play = 2,
  10779. mmc_deferredplay = 3,
  10780. mmc_fastforward = 4,
  10781. mmc_rewind = 5,
  10782. mmc_recordStart = 6,
  10783. mmc_recordStop = 7,
  10784. mmc_pause = 9
  10785. };
  10786. bool isMidiMachineControlMessage() const throw();
  10787. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10788. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10789. bool isMidiMachineControlGoto (int& hours,
  10790. int& minutes,
  10791. int& seconds,
  10792. int& frames) const throw();
  10793. static const MidiMessage midiMachineControlGoto (int hours,
  10794. int minutes,
  10795. int seconds,
  10796. int frames);
  10797. static const MidiMessage masterVolume (float volume);
  10798. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10799. int dataSize);
  10800. static int readVariableLengthVal (const uint8* data,
  10801. int& numBytesUsed) throw();
  10802. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10803. static const String getMidiNoteName (int noteNumber,
  10804. bool useSharps,
  10805. bool includeOctaveNumber,
  10806. int octaveNumForMiddleC) throw();
  10807. static const double getMidiNoteInHertz (int noteNumber) throw();
  10808. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10809. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10810. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10811. static const String getControllerName (int controllerNumber) throw();
  10812. juce_UseDebuggingNewOperator
  10813. private:
  10814. double timeStamp;
  10815. uint8* data;
  10816. int size;
  10817. union
  10818. {
  10819. uint8 asBytes[4];
  10820. uint32 asInt32;
  10821. } preallocatedData;
  10822. };
  10823. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10824. /*** End of inlined file: juce_MidiMessage.h ***/
  10825. class MidiInput;
  10826. class JUCE_API MidiInputCallback
  10827. {
  10828. public:
  10829. virtual ~MidiInputCallback() {}
  10830. virtual void handleIncomingMidiMessage (MidiInput* source,
  10831. const MidiMessage& message) = 0;
  10832. virtual void handlePartialSysexMessage (MidiInput* source,
  10833. const uint8* messageData,
  10834. const int numBytesSoFar,
  10835. const double timestamp)
  10836. {
  10837. // (this bit is just to avoid compiler warnings about unused variables)
  10838. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10839. }
  10840. };
  10841. class JUCE_API MidiInput
  10842. {
  10843. public:
  10844. static const StringArray getDevices();
  10845. static int getDefaultDeviceIndex();
  10846. static MidiInput* openDevice (int deviceIndex,
  10847. MidiInputCallback* callback);
  10848. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10849. static MidiInput* createNewDevice (const String& deviceName,
  10850. MidiInputCallback* callback);
  10851. #endif
  10852. virtual ~MidiInput();
  10853. virtual const String getName() const throw() { return name; }
  10854. virtual void setName (const String& newName) throw() { name = newName; }
  10855. virtual void start();
  10856. virtual void stop();
  10857. juce_UseDebuggingNewOperator
  10858. protected:
  10859. String name;
  10860. void* internal;
  10861. explicit MidiInput (const String& name);
  10862. private:
  10863. MidiInput (const MidiInput&);
  10864. MidiInput& operator= (const MidiInput&);
  10865. };
  10866. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10867. /*** End of inlined file: juce_MidiInput.h ***/
  10868. /*** Start of inlined file: juce_MidiOutput.h ***/
  10869. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10870. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10871. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10872. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10873. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10874. class JUCE_API MidiBuffer
  10875. {
  10876. public:
  10877. MidiBuffer() throw();
  10878. explicit MidiBuffer (const MidiMessage& message) throw();
  10879. MidiBuffer (const MidiBuffer& other) throw();
  10880. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10881. ~MidiBuffer() throw();
  10882. void clear() throw();
  10883. void clear (const int start,
  10884. const int numSamples) throw();
  10885. bool isEmpty() const throw();
  10886. int getNumEvents() const throw();
  10887. void addEvent (const MidiMessage& midiMessage,
  10888. const int sampleNumber) throw();
  10889. void addEvent (const uint8* const rawMidiData,
  10890. const int maxBytesOfMidiData,
  10891. const int sampleNumber) throw();
  10892. void addEvents (const MidiBuffer& otherBuffer,
  10893. const int startSample,
  10894. const int numSamples,
  10895. const int sampleDeltaToAdd) throw();
  10896. int getFirstEventTime() const throw();
  10897. int getLastEventTime() const throw();
  10898. void swapWith (MidiBuffer& other);
  10899. class Iterator
  10900. {
  10901. public:
  10902. Iterator (const MidiBuffer& buffer) throw();
  10903. ~Iterator() throw();
  10904. void setNextSamplePosition (const int samplePosition) throw();
  10905. bool getNextEvent (MidiMessage& result,
  10906. int& samplePosition) throw();
  10907. bool getNextEvent (const uint8* &midiData,
  10908. int& numBytesOfMidiData,
  10909. int& samplePosition) throw();
  10910. juce_UseDebuggingNewOperator
  10911. private:
  10912. const MidiBuffer& buffer;
  10913. const uint8* data;
  10914. Iterator (const Iterator&);
  10915. Iterator& operator= (const Iterator&);
  10916. };
  10917. juce_UseDebuggingNewOperator
  10918. private:
  10919. friend class MidiBuffer::Iterator;
  10920. MemoryBlock data;
  10921. int bytesUsed;
  10922. uint8* getData() const throw();
  10923. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10924. static int getEventTime (const void* d) throw();
  10925. static uint16 getEventDataSize (const void* d) throw();
  10926. static uint16 getEventTotalSize (const void* d) throw();
  10927. };
  10928. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10929. /*** End of inlined file: juce_MidiBuffer.h ***/
  10930. class JUCE_API MidiOutput : private Thread
  10931. {
  10932. public:
  10933. static const StringArray getDevices();
  10934. static int getDefaultDeviceIndex();
  10935. static MidiOutput* openDevice (int deviceIndex);
  10936. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10937. static MidiOutput* createNewDevice (const String& deviceName);
  10938. #endif
  10939. virtual ~MidiOutput();
  10940. virtual void sendMessageNow (const MidiMessage& message);
  10941. virtual void reset();
  10942. virtual bool getVolume (float& leftVol,
  10943. float& rightVol);
  10944. virtual void setVolume (float leftVol,
  10945. float rightVol);
  10946. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10947. double millisecondCounterToStartAt,
  10948. double samplesPerSecondForBuffer);
  10949. virtual void clearAllPendingMessages();
  10950. virtual void startBackgroundThread();
  10951. virtual void stopBackgroundThread();
  10952. juce_UseDebuggingNewOperator
  10953. protected:
  10954. void* internal;
  10955. struct PendingMessage
  10956. {
  10957. PendingMessage (const uint8* data, int len, double sampleNumber);
  10958. MidiMessage message;
  10959. PendingMessage* next;
  10960. juce_UseDebuggingNewOperator
  10961. };
  10962. CriticalSection lock;
  10963. PendingMessage* firstMessage;
  10964. MidiOutput();
  10965. void run();
  10966. private:
  10967. MidiOutput (const MidiOutput&);
  10968. MidiOutput& operator= (const MidiOutput&);
  10969. };
  10970. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10971. /*** End of inlined file: juce_MidiOutput.h ***/
  10972. /*** Start of inlined file: juce_ComboBox.h ***/
  10973. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10974. #define __JUCE_COMBOBOX_JUCEHEADER__
  10975. /*** Start of inlined file: juce_Label.h ***/
  10976. #ifndef __JUCE_LABEL_JUCEHEADER__
  10977. #define __JUCE_LABEL_JUCEHEADER__
  10978. /*** Start of inlined file: juce_TextEditor.h ***/
  10979. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10980. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10981. /*** Start of inlined file: juce_Viewport.h ***/
  10982. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10983. #define __JUCE_VIEWPORT_JUCEHEADER__
  10984. /*** Start of inlined file: juce_ScrollBar.h ***/
  10985. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10986. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10987. /*** Start of inlined file: juce_Button.h ***/
  10988. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10989. #define __JUCE_BUTTON_JUCEHEADER__
  10990. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10991. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10992. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10993. /*** Start of inlined file: juce_TooltipClient.h ***/
  10994. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10995. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10996. class JUCE_API TooltipClient
  10997. {
  10998. public:
  10999. virtual ~TooltipClient() {}
  11000. virtual const String getTooltip() = 0;
  11001. };
  11002. class JUCE_API SettableTooltipClient : public TooltipClient
  11003. {
  11004. public:
  11005. virtual ~SettableTooltipClient() {}
  11006. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  11007. virtual const String getTooltip() { return tooltipString; }
  11008. juce_UseDebuggingNewOperator
  11009. protected:
  11010. String tooltipString;
  11011. };
  11012. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  11013. /*** End of inlined file: juce_TooltipClient.h ***/
  11014. class JUCE_API TooltipWindow : public Component,
  11015. private Timer
  11016. {
  11017. public:
  11018. explicit TooltipWindow (Component* parentComponent = 0,
  11019. int millisecondsBeforeTipAppears = 700);
  11020. ~TooltipWindow();
  11021. void setMillisecondsBeforeTipAppears (int newTimeMs = 700) throw();
  11022. enum ColourIds
  11023. {
  11024. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  11025. textColourId = 0x1001c00, /**< The colour to use for the text. */
  11026. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  11027. };
  11028. juce_UseDebuggingNewOperator
  11029. private:
  11030. int millisecondsBeforeTipAppears;
  11031. Point<int> lastMousePos;
  11032. int mouseClicks;
  11033. unsigned int lastCompChangeTime, lastHideTime;
  11034. Component* lastComponentUnderMouse;
  11035. bool changedCompsSinceShown;
  11036. String tipShowing, lastTipUnderMouse;
  11037. void paint (Graphics& g);
  11038. void mouseEnter (const MouseEvent& e);
  11039. void timerCallback();
  11040. static const String getTipFor (Component* c);
  11041. void showFor (const String& tip);
  11042. void hide();
  11043. TooltipWindow (const TooltipWindow&);
  11044. TooltipWindow& operator= (const TooltipWindow&);
  11045. };
  11046. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  11047. /*** End of inlined file: juce_TooltipWindow.h ***/
  11048. class Button;
  11049. class JUCE_API ButtonListener
  11050. {
  11051. public:
  11052. virtual ~ButtonListener() {}
  11053. virtual void buttonClicked (Button* button) = 0;
  11054. virtual void buttonStateChanged (Button*) {}
  11055. };
  11056. class JUCE_API Button : public Component,
  11057. public SettableTooltipClient,
  11058. public ApplicationCommandManagerListener,
  11059. public Value::Listener,
  11060. private KeyListener
  11061. {
  11062. protected:
  11063. explicit Button (const String& buttonName);
  11064. public:
  11065. virtual ~Button();
  11066. void setButtonText (const String& newText);
  11067. const String getButtonText() const { return text; }
  11068. bool isDown() const throw();
  11069. bool isOver() const throw();
  11070. void setToggleState (bool shouldBeOn,
  11071. bool sendChangeNotification);
  11072. bool getToggleState() const throw() { return isOn.getValue(); }
  11073. Value& getToggleStateValue() { return isOn; }
  11074. void setClickingTogglesState (bool shouldToggle) throw();
  11075. bool getClickingTogglesState() const throw();
  11076. void setRadioGroupId (int newGroupId);
  11077. int getRadioGroupId() const throw() { return radioGroupId; }
  11078. void addButtonListener (ButtonListener* newListener);
  11079. void removeButtonListener (ButtonListener* listener);
  11080. virtual void triggerClick();
  11081. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  11082. int commandID,
  11083. bool generateTooltip);
  11084. int getCommandID() const throw() { return commandID; }
  11085. void addShortcut (const KeyPress& key);
  11086. void clearShortcuts();
  11087. bool isRegisteredForShortcut (const KeyPress& key) const;
  11088. void setRepeatSpeed (int initialDelayInMillisecs,
  11089. int repeatDelayInMillisecs,
  11090. int minimumDelayInMillisecs = -1) throw();
  11091. void setTriggeredOnMouseDown (bool isTriggeredOnMouseDown) throw();
  11092. uint32 getMillisecondsSinceButtonDown() const throw();
  11093. void setVisible (bool shouldBeVisible);
  11094. void setTooltip (const String& newTooltip);
  11095. // (implementation of the TooltipClient method)
  11096. const String getTooltip();
  11097. enum ConnectedEdgeFlags
  11098. {
  11099. ConnectedOnLeft = 1,
  11100. ConnectedOnRight = 2,
  11101. ConnectedOnTop = 4,
  11102. ConnectedOnBottom = 8
  11103. };
  11104. void setConnectedEdges (int connectedEdgeFlags);
  11105. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  11106. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  11107. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  11108. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  11109. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  11110. enum ButtonState
  11111. {
  11112. buttonNormal,
  11113. buttonOver,
  11114. buttonDown
  11115. };
  11116. void setState (const ButtonState newState);
  11117. juce_UseDebuggingNewOperator
  11118. protected:
  11119. virtual void clicked();
  11120. virtual void clicked (const ModifierKeys& modifiers);
  11121. virtual void paintButton (Graphics& g,
  11122. bool isMouseOverButton,
  11123. bool isButtonDown) = 0;
  11124. virtual void buttonStateChanged();
  11125. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11126. void handleCommandMessage (int commandId);
  11127. void mouseEnter (const MouseEvent& e);
  11128. void mouseExit (const MouseEvent& e);
  11129. void mouseDown (const MouseEvent& e);
  11130. void mouseDrag (const MouseEvent& e);
  11131. void mouseUp (const MouseEvent& e);
  11132. bool keyPressed (const KeyPress& key);
  11133. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11134. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  11135. void paint (Graphics& g);
  11136. void parentHierarchyChanged();
  11137. void focusGained (FocusChangeType cause);
  11138. void focusLost (FocusChangeType cause);
  11139. void enablementChanged();
  11140. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11141. void applicationCommandListChanged();
  11142. void valueChanged (Value& value);
  11143. private:
  11144. Array <KeyPress> shortcuts;
  11145. Component::SafePointer<Component> keySource;
  11146. String text;
  11147. ListenerList <ButtonListener> buttonListeners;
  11148. class RepeatTimer;
  11149. friend class RepeatTimer;
  11150. friend class ScopedPointer <RepeatTimer>;
  11151. ScopedPointer <RepeatTimer> repeatTimer;
  11152. uint32 buttonPressTime, lastTimeCallbackTime;
  11153. ApplicationCommandManager* commandManagerToUse;
  11154. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11155. int radioGroupId, commandID, connectedEdgeFlags;
  11156. ButtonState buttonState;
  11157. Value isOn;
  11158. bool lastToggleState : 1;
  11159. bool clickTogglesState : 1;
  11160. bool needsToRelease : 1;
  11161. bool needsRepainting : 1;
  11162. bool isKeyDown : 1;
  11163. bool triggerOnMouseDown : 1;
  11164. bool generateTooltip : 1;
  11165. void repeatTimerCallback();
  11166. RepeatTimer& getRepeatTimer();
  11167. ButtonState updateState (const MouseEvent* const e);
  11168. bool isShortcutPressed() const;
  11169. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11170. void flashButtonState();
  11171. void sendClickMessage (const ModifierKeys& modifiers);
  11172. void sendStateMessage();
  11173. Button (const Button&);
  11174. Button& operator= (const Button&);
  11175. };
  11176. #endif // __JUCE_BUTTON_JUCEHEADER__
  11177. /*** End of inlined file: juce_Button.h ***/
  11178. class ScrollBar;
  11179. class JUCE_API ScrollBarListener
  11180. {
  11181. public:
  11182. virtual ~ScrollBarListener() {}
  11183. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11184. double newRangeStart) = 0;
  11185. };
  11186. class JUCE_API ScrollBar : public Component,
  11187. public AsyncUpdater,
  11188. private Timer
  11189. {
  11190. public:
  11191. ScrollBar (bool isVertical,
  11192. bool buttonsAreVisible = true);
  11193. ~ScrollBar();
  11194. bool isVertical() const throw() { return vertical; }
  11195. void setOrientation (bool shouldBeVertical);
  11196. void setButtonVisibility (bool buttonsAreVisible);
  11197. void setAutoHide (bool shouldHideWhenFullRange);
  11198. void setRangeLimits (const Range<double>& newRangeLimit);
  11199. void setRangeLimits (double minimum, double maximum);
  11200. const Range<double> getRangeLimit() const throw() { return totalRange; }
  11201. double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }
  11202. double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }
  11203. void setCurrentRange (const Range<double>& newRange);
  11204. void setCurrentRange (double newStart, double newSize);
  11205. void setCurrentRangeStart (double newStart);
  11206. const Range<double> getCurrentRange() const throw() { return visibleRange; }
  11207. double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }
  11208. double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }
  11209. void setSingleStepSize (double newSingleStepSize);
  11210. void moveScrollbarInSteps (int howManySteps);
  11211. void moveScrollbarInPages (int howManyPages);
  11212. void scrollToTop();
  11213. void scrollToBottom();
  11214. void setButtonRepeatSpeed (int initialDelayInMillisecs,
  11215. int repeatDelayInMillisecs,
  11216. int minimumDelayInMillisecs = -1);
  11217. enum ColourIds
  11218. {
  11219. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11220. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11221. 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. */
  11222. };
  11223. void addListener (ScrollBarListener* listener);
  11224. void removeListener (ScrollBarListener* listener);
  11225. bool keyPressed (const KeyPress& key);
  11226. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11227. void lookAndFeelChanged();
  11228. void handleAsyncUpdate();
  11229. void mouseDown (const MouseEvent& e);
  11230. void mouseDrag (const MouseEvent& e);
  11231. void mouseUp (const MouseEvent& e);
  11232. void paint (Graphics& g);
  11233. void resized();
  11234. juce_UseDebuggingNewOperator
  11235. private:
  11236. Range <double> totalRange, visibleRange;
  11237. double singleStepSize, dragStartRange;
  11238. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11239. int dragStartMousePos, lastMousePos;
  11240. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11241. bool vertical, isDraggingThumb, alwaysVisible;
  11242. class ScrollbarButton;
  11243. ScrollbarButton* upButton;
  11244. ScrollbarButton* downButton;
  11245. ListenerList <ScrollBarListener> listeners;
  11246. void updateThumbPosition();
  11247. void timerCallback();
  11248. ScrollBar (const ScrollBar&);
  11249. ScrollBar& operator= (const ScrollBar&);
  11250. };
  11251. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11252. /*** End of inlined file: juce_ScrollBar.h ***/
  11253. class JUCE_API Viewport : public Component,
  11254. private ComponentListener,
  11255. private ScrollBarListener
  11256. {
  11257. public:
  11258. explicit Viewport (const String& componentName = String::empty);
  11259. ~Viewport();
  11260. void setViewedComponent (Component* newViewedComponent);
  11261. Component* getViewedComponent() const throw() { return contentComp; }
  11262. void setViewPosition (int xPixelsOffset, int yPixelsOffset);
  11263. void setViewPositionProportionately (double proportionX, double proportionY);
  11264. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11265. int getViewPositionX() const throw() { return lastVX; }
  11266. int getViewPositionY() const throw() { return lastVY; }
  11267. int getViewWidth() const throw() { return lastVW; }
  11268. int getViewHeight() const throw() { return lastVH; }
  11269. int getMaximumVisibleWidth() const throw();
  11270. int getMaximumVisibleHeight() const throw();
  11271. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11272. int visibleW, int visibleH);
  11273. void setScrollBarsShown (bool showVerticalScrollbarIfNeeded,
  11274. bool showHorizontalScrollbarIfNeeded);
  11275. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11276. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11277. void setScrollBarThickness (int thickness);
  11278. int getScrollBarThickness() const throw();
  11279. void setSingleStepSizes (int stepX, int stepY);
  11280. void setScrollBarButtonVisibility (bool buttonsVisible);
  11281. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11282. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11283. juce_UseDebuggingNewOperator
  11284. void resized();
  11285. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  11286. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11287. bool keyPressed (const KeyPress& key);
  11288. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11289. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11290. private:
  11291. Component::SafePointer<Component> contentComp;
  11292. int lastVX, lastVY, lastVW, lastVH;
  11293. int scrollBarThickness;
  11294. int singleStepX, singleStepY;
  11295. bool showHScrollbar, showVScrollbar;
  11296. Component* contentHolder;
  11297. ScrollBar* verticalScrollBar;
  11298. ScrollBar* horizontalScrollBar;
  11299. void updateVisibleRegion();
  11300. Viewport (const Viewport&);
  11301. Viewport& operator= (const Viewport&);
  11302. };
  11303. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11304. /*** End of inlined file: juce_Viewport.h ***/
  11305. /*** Start of inlined file: juce_PopupMenu.h ***/
  11306. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11307. #define __JUCE_POPUPMENU_JUCEHEADER__
  11308. class PopupMenuCustomComponent;
  11309. class JUCE_API PopupMenu
  11310. {
  11311. public:
  11312. PopupMenu();
  11313. PopupMenu (const PopupMenu& other);
  11314. ~PopupMenu();
  11315. PopupMenu& operator= (const PopupMenu& other);
  11316. void clear();
  11317. void addItem (int itemResultId,
  11318. const String& itemText,
  11319. bool isActive = true,
  11320. bool isTicked = false,
  11321. const Image* iconToUse = 0);
  11322. void addCommandItem (ApplicationCommandManager* commandManager,
  11323. int commandID,
  11324. const String& displayName = String::empty);
  11325. void addColouredItem (int itemResultId,
  11326. const String& itemText,
  11327. const Colour& itemTextColour,
  11328. bool isActive = true,
  11329. bool isTicked = false,
  11330. const Image* iconToUse = 0);
  11331. void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent);
  11332. void addCustomItem (int itemResultId,
  11333. Component* customComponent,
  11334. int idealWidth, int idealHeight,
  11335. bool triggerMenuItemAutomaticallyWhenClicked);
  11336. void addSubMenu (const String& subMenuName,
  11337. const PopupMenu& subMenu,
  11338. bool isActive = true,
  11339. Image* iconToUse = 0,
  11340. bool isTicked = false);
  11341. void addSeparator();
  11342. void addSectionHeader (const String& title);
  11343. int getNumItems() const throw();
  11344. bool containsCommandItem (int commandID) const;
  11345. bool containsAnyActiveItems() const throw();
  11346. int show (int itemIdThatMustBeVisible = 0,
  11347. int minimumWidth = 0,
  11348. int maximumNumColumns = 0,
  11349. int standardItemHeight = 0);
  11350. int showAt (int screenX,
  11351. int screenY,
  11352. int itemIdThatMustBeVisible = 0,
  11353. int minimumWidth = 0,
  11354. int maximumNumColumns = 0,
  11355. int standardItemHeight = 0);
  11356. int showAt (Component* componentToAttachTo,
  11357. int itemIdThatMustBeVisible = 0,
  11358. int minimumWidth = 0,
  11359. int maximumNumColumns = 0,
  11360. int standardItemHeight = 0);
  11361. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11362. void setLookAndFeel (LookAndFeel* newLookAndFeel);
  11363. enum ColourIds
  11364. {
  11365. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11366. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11367. colour is specified when the item is added). */
  11368. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11369. addSectionHeader() method). */
  11370. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11371. highlighted menu item. */
  11372. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11373. highlighted item. */
  11374. };
  11375. class JUCE_API MenuItemIterator
  11376. {
  11377. public:
  11378. MenuItemIterator (const PopupMenu& menu);
  11379. ~MenuItemIterator();
  11380. bool next();
  11381. String itemName;
  11382. const PopupMenu* subMenu;
  11383. int itemId;
  11384. bool isSeparator;
  11385. bool isTicked;
  11386. bool isEnabled;
  11387. bool isCustomComponent;
  11388. bool isSectionHeader;
  11389. const Colour* customColour;
  11390. const Image* customImage;
  11391. ApplicationCommandManager* commandManager;
  11392. juce_UseDebuggingNewOperator
  11393. private:
  11394. const PopupMenu& menu;
  11395. int index;
  11396. MenuItemIterator (const MenuItemIterator&);
  11397. MenuItemIterator& operator= (const MenuItemIterator&);
  11398. };
  11399. juce_UseDebuggingNewOperator
  11400. private:
  11401. class Item;
  11402. class ItemComponent;
  11403. class Window;
  11404. friend class MenuItemIterator;
  11405. friend class ItemComponent;
  11406. friend class Window;
  11407. friend class PopupMenuCustomComponent;
  11408. friend class OwnedArray <Item>;
  11409. friend class ScopedPointer <Window>;
  11410. OwnedArray <Item> items;
  11411. LookAndFeel* lookAndFeel;
  11412. bool separatorPending;
  11413. void addSeparatorIfPending();
  11414. int showMenu (int x, int y, int w, int h,
  11415. int itemIdThatMustBeVisible,
  11416. int minimumWidth,
  11417. int maximumNumColumns,
  11418. int standardItemHeight,
  11419. bool alignToRectangle,
  11420. Component* componentAttachedTo);
  11421. friend class MenuBarComponent;
  11422. Component* createMenuComponent (int x, int y, int w, int h,
  11423. int itemIdThatMustBeVisible,
  11424. int minimumWidth,
  11425. int maximumNumColumns,
  11426. int standardItemHeight,
  11427. bool alignToRectangle,
  11428. Component* menuBarComponent,
  11429. ApplicationCommandManager** managerOfChosenCommand,
  11430. Component* componentAttachedTo);
  11431. };
  11432. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11433. /*** End of inlined file: juce_PopupMenu.h ***/
  11434. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11435. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11436. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11437. class JUCE_API TextInputTarget
  11438. {
  11439. public:
  11440. TextInputTarget() {}
  11441. virtual ~TextInputTarget() {}
  11442. virtual const Range<int> getHighlightedRegion() const = 0;
  11443. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11444. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11445. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11446. };
  11447. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11448. /*** End of inlined file: juce_TextInputTarget.h ***/
  11449. class TextEditor;
  11450. class JUCE_API TextEditorListener
  11451. {
  11452. public:
  11453. virtual ~TextEditorListener() {}
  11454. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11455. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11456. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11457. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11458. };
  11459. class JUCE_API TextEditor : public Component,
  11460. public TextInputTarget,
  11461. public SettableTooltipClient
  11462. {
  11463. public:
  11464. explicit TextEditor (const String& componentName = String::empty,
  11465. juce_wchar passwordCharacter = 0);
  11466. virtual ~TextEditor();
  11467. void setMultiLine (bool shouldBeMultiLine,
  11468. bool shouldWordWrap = true);
  11469. bool isMultiLine() const;
  11470. void setReturnKeyStartsNewLine (bool shouldStartNewLine);
  11471. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11472. void setTabKeyUsedAsCharacter (bool shouldTabKeyBeUsed);
  11473. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11474. void setReadOnly (bool shouldBeReadOnly);
  11475. bool isReadOnly() const;
  11476. void setCaretVisible (bool shouldBeVisible);
  11477. bool isCaretVisible() const { return caretVisible; }
  11478. void setScrollbarsShown (bool shouldBeEnabled);
  11479. bool areScrollbarsShown() const { return scrollbarVisible; }
  11480. void setPasswordCharacter (juce_wchar passwordCharacter);
  11481. juce_wchar getPasswordCharacter() const { return passwordCharacter; }
  11482. void setPopupMenuEnabled (bool menuEnabled);
  11483. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11484. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11485. enum ColourIds
  11486. {
  11487. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11488. transparent if necessary. */
  11489. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11490. that because the editor can contain multiple colours, calling this
  11491. method won't change the colour of existing text - to do that, call
  11492. applyFontToAllText() after calling this method.*/
  11493. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11494. the text - this can be transparent if you don't want to show any
  11495. highlighting.*/
  11496. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11497. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11498. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11499. the edge of the component. */
  11500. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11501. the edge of the component when it has focus. */
  11502. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11503. around the edge of the editor. */
  11504. };
  11505. void setFont (const Font& newFont);
  11506. void applyFontToAllText (const Font& newFont);
  11507. const Font getFont() const;
  11508. void setSelectAllWhenFocused (bool b);
  11509. void setInputRestrictions (int maxTextLength,
  11510. const String& allowedCharacters = String::empty);
  11511. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11512. void setScrollBarThickness (int newThicknessPixels);
  11513. void setScrollBarButtonVisibility (bool buttonsVisible);
  11514. void addListener (TextEditorListener* newListener);
  11515. void removeListener (TextEditorListener* listenerToRemove);
  11516. const String getText() const;
  11517. const String getTextInRange (const Range<int>& textRange) const;
  11518. bool isEmpty() const;
  11519. void setText (const String& newText,
  11520. bool sendTextChangeMessage = true);
  11521. Value& getTextValue();
  11522. void insertTextAtCaret (const String& textToInsert);
  11523. void clear();
  11524. void cut();
  11525. void copy();
  11526. void paste();
  11527. void setCaretPosition (int newIndex);
  11528. int getCaretPosition() const;
  11529. void scrollEditorToPositionCaret (int desiredCaretX, int desiredCaretY);
  11530. const Rectangle<int> getCaretRectangle();
  11531. void setHighlightedRegion (const Range<int>& newSelection);
  11532. const Range<int> getHighlightedRegion() const { return selection; }
  11533. const String getHighlightedText() const;
  11534. int getTextIndexAt (int x, int y);
  11535. int getTotalNumChars() const;
  11536. int getTextWidth() const;
  11537. int getTextHeight() const;
  11538. void setIndents (int newLeftIndent, int newTopIndent);
  11539. void setBorder (const BorderSize& border);
  11540. const BorderSize getBorder() const;
  11541. void setScrollToShowCursor (bool shouldScrollToShowCursor);
  11542. void paint (Graphics& g);
  11543. void paintOverChildren (Graphics& g);
  11544. void mouseDown (const MouseEvent& e);
  11545. void mouseUp (const MouseEvent& e);
  11546. void mouseDrag (const MouseEvent& e);
  11547. void mouseDoubleClick (const MouseEvent& e);
  11548. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11549. bool keyPressed (const KeyPress& key);
  11550. bool keyStateChanged (bool isKeyDown);
  11551. void focusGained (FocusChangeType cause);
  11552. void focusLost (FocusChangeType cause);
  11553. void resized();
  11554. void enablementChanged();
  11555. void colourChanged();
  11556. juce_UseDebuggingNewOperator
  11557. protected:
  11558. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11559. const MouseEvent* mouseClickEvent);
  11560. virtual void performPopupMenuAction (int menuItemID);
  11561. void scrollToMakeSureCursorIsVisible();
  11562. void moveCaret (int newCaretPos);
  11563. void moveCursorTo (int newPosition, bool isSelecting);
  11564. void textChanged();
  11565. void newTransaction();
  11566. void doUndoRedo (bool isRedo);
  11567. virtual void returnPressed();
  11568. virtual void escapePressed();
  11569. void handleCommandMessage (int commandId);
  11570. private:
  11571. class Iterator;
  11572. class UniformTextSection;
  11573. class TextHolderComponent;
  11574. class InsertAction;
  11575. class RemoveAction;
  11576. friend class InsertAction;
  11577. friend class RemoveAction;
  11578. ScopedPointer <Viewport> viewport;
  11579. TextHolderComponent* textHolder;
  11580. BorderSize borderSize;
  11581. bool readOnly : 1;
  11582. bool multiline : 1;
  11583. bool wordWrap : 1;
  11584. bool returnKeyStartsNewLine : 1;
  11585. bool caretVisible : 1;
  11586. bool popupMenuEnabled : 1;
  11587. bool selectAllTextWhenFocused : 1;
  11588. bool scrollbarVisible : 1;
  11589. bool wasFocused : 1;
  11590. bool caretFlashState : 1;
  11591. bool keepCursorOnScreen : 1;
  11592. bool tabKeyUsed : 1;
  11593. bool menuActive : 1;
  11594. bool valueTextNeedsUpdating : 1;
  11595. UndoManager undoManager;
  11596. float cursorX, cursorY, cursorHeight;
  11597. int maxTextLength;
  11598. Range<int> selection;
  11599. int leftIndent, topIndent;
  11600. unsigned int lastTransactionTime;
  11601. Font currentFont;
  11602. mutable int totalNumChars;
  11603. int caretPosition;
  11604. Array <UniformTextSection*> sections;
  11605. String textToShowWhenEmpty;
  11606. Colour colourForTextWhenEmpty;
  11607. juce_wchar passwordCharacter;
  11608. Value textValue;
  11609. enum
  11610. {
  11611. notDragging,
  11612. draggingSelectionStart,
  11613. draggingSelectionEnd
  11614. } dragType;
  11615. String allowedCharacters;
  11616. ListenerList <TextEditorListener> listeners;
  11617. void coalesceSimilarSections();
  11618. void splitSection (int sectionIndex, int charToSplitAt);
  11619. void clearInternal (UndoManager* um);
  11620. void insert (const String& text, int insertIndex, const Font& font,
  11621. const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
  11622. void reinsert (int insertIndex, const Array <UniformTextSection*>& sections);
  11623. void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
  11624. void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
  11625. void updateCaretPosition();
  11626. void textWasChangedByValue();
  11627. int indexAtPosition (float x, float y);
  11628. int findWordBreakAfter (int position) const;
  11629. int findWordBreakBefore (int position) const;
  11630. friend class TextHolderComponent;
  11631. friend class TextEditorViewport;
  11632. void drawContent (Graphics& g);
  11633. void updateTextHolderSize();
  11634. float getWordWrapWidth() const;
  11635. void timerCallbackInt();
  11636. void repaintCaret();
  11637. void repaintText (const Range<int>& range);
  11638. UndoManager* getUndoManager() throw();
  11639. TextEditor (const TextEditor&);
  11640. TextEditor& operator= (const TextEditor&);
  11641. };
  11642. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11643. /*** End of inlined file: juce_TextEditor.h ***/
  11644. class Label;
  11645. class JUCE_API LabelListener
  11646. {
  11647. public:
  11648. virtual ~LabelListener() {}
  11649. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11650. };
  11651. class JUCE_API Label : public Component,
  11652. public SettableTooltipClient,
  11653. protected TextEditorListener,
  11654. private ComponentListener,
  11655. private Value::Listener
  11656. {
  11657. public:
  11658. Label (const String& componentName,
  11659. const String& labelText);
  11660. ~Label();
  11661. void setText (const String& newText,
  11662. bool broadcastChangeMessage);
  11663. const String getText (bool returnActiveEditorContents = false) const throw();
  11664. Value& getTextValue() { return textValue; }
  11665. void setFont (const Font& newFont) throw();
  11666. const Font& getFont() const throw();
  11667. enum ColourIds
  11668. {
  11669. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11670. textColourId = 0x1000281, /**< The colour for the text. */
  11671. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11672. Leave this transparent to not have an outline. */
  11673. };
  11674. void setJustificationType (const Justification& justification) throw();
  11675. const Justification getJustificationType() const throw() { return justification; }
  11676. void setBorderSize (int horizontalBorder, int verticalBorder);
  11677. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11678. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11679. void attachToComponent (Component* owner, bool onLeft);
  11680. Component* getAttachedComponent() const;
  11681. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11682. void setMinimumHorizontalScale (float newScale);
  11683. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11684. void addListener (LabelListener* listener) throw();
  11685. void removeListener (LabelListener* listener) throw();
  11686. void setEditable (bool editOnSingleClick,
  11687. bool editOnDoubleClick = false,
  11688. bool lossOfFocusDiscardsChanges = false) throw();
  11689. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11690. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11691. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11692. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11693. void showEditor();
  11694. void hideEditor (bool discardCurrentEditorContents);
  11695. bool isBeingEdited() const throw();
  11696. juce_UseDebuggingNewOperator
  11697. protected:
  11698. virtual TextEditor* createEditorComponent();
  11699. virtual void textWasEdited();
  11700. virtual void textWasChanged();
  11701. virtual void editorShown (TextEditor* editorComponent);
  11702. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11703. void paint (Graphics& g);
  11704. void resized();
  11705. void mouseUp (const MouseEvent& e);
  11706. void mouseDoubleClick (const MouseEvent& e);
  11707. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11708. void componentParentHierarchyChanged (Component& component);
  11709. void componentVisibilityChanged (Component& component);
  11710. void inputAttemptWhenModal();
  11711. void focusGained (FocusChangeType);
  11712. void enablementChanged();
  11713. KeyboardFocusTraverser* createFocusTraverser();
  11714. void textEditorTextChanged (TextEditor& editor);
  11715. void textEditorReturnKeyPressed (TextEditor& editor);
  11716. void textEditorEscapeKeyPressed (TextEditor& editor);
  11717. void textEditorFocusLost (TextEditor& editor);
  11718. void colourChanged();
  11719. void valueChanged (Value&);
  11720. private:
  11721. Value textValue;
  11722. String lastTextValue;
  11723. Font font;
  11724. Justification justification;
  11725. ScopedPointer <TextEditor> editor;
  11726. ListenerList <LabelListener> listeners;
  11727. Component::SafePointer<Component> ownerComponent;
  11728. int horizontalBorderSize, verticalBorderSize;
  11729. float minimumHorizontalScale;
  11730. bool editSingleClick : 1;
  11731. bool editDoubleClick : 1;
  11732. bool lossOfFocusDiscardsChanges : 1;
  11733. bool leftOfOwnerComp : 1;
  11734. bool updateFromTextEditorContents();
  11735. void callChangeListeners();
  11736. Label (const Label&);
  11737. Label& operator= (const Label&);
  11738. };
  11739. #endif // __JUCE_LABEL_JUCEHEADER__
  11740. /*** End of inlined file: juce_Label.h ***/
  11741. class ComboBox;
  11742. class JUCE_API ComboBoxListener
  11743. {
  11744. public:
  11745. virtual ~ComboBoxListener() {}
  11746. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11747. };
  11748. class JUCE_API ComboBox : public Component,
  11749. public SettableTooltipClient,
  11750. private LabelListener,
  11751. private AsyncUpdater,
  11752. private Value::Listener
  11753. {
  11754. public:
  11755. explicit ComboBox (const String& componentName);
  11756. ~ComboBox();
  11757. void setEditableText (bool isEditable);
  11758. bool isTextEditable() const throw();
  11759. void setJustificationType (const Justification& justification) throw();
  11760. const Justification getJustificationType() const throw();
  11761. void addItem (const String& newItemText,
  11762. int newItemId) throw();
  11763. void addSeparator() throw();
  11764. void addSectionHeading (const String& headingName) throw();
  11765. void setItemEnabled (int itemId,
  11766. bool shouldBeEnabled) throw();
  11767. void changeItemText (int itemId,
  11768. const String& newText) throw();
  11769. void clear (bool dontSendChangeMessage = false);
  11770. int getNumItems() const throw();
  11771. const String getItemText (int index) const throw();
  11772. int getItemId (int index) const throw();
  11773. int indexOfItemId (int itemId) const throw();
  11774. int getSelectedId() const throw();
  11775. Value& getSelectedIdAsValue() throw() { return currentId; }
  11776. void setSelectedId (int newItemId,
  11777. bool dontSendChangeMessage = false) throw();
  11778. int getSelectedItemIndex() const throw();
  11779. void setSelectedItemIndex (int newItemIndex,
  11780. bool dontSendChangeMessage = false) throw();
  11781. const String getText() const throw();
  11782. void setText (const String& newText,
  11783. bool dontSendChangeMessage = false) throw();
  11784. void showEditor();
  11785. void addListener (ComboBoxListener* listener) throw();
  11786. void removeListener (ComboBoxListener* listener) throw();
  11787. void setTextWhenNothingSelected (const String& newMessage) throw();
  11788. const String getTextWhenNothingSelected() const throw();
  11789. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11790. const String getTextWhenNoChoicesAvailable() const throw();
  11791. void setTooltip (const String& newTooltip);
  11792. enum ColourIds
  11793. {
  11794. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11795. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11796. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11797. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11798. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11799. };
  11800. void labelTextChanged (Label*);
  11801. void enablementChanged();
  11802. void colourChanged();
  11803. void focusGained (Component::FocusChangeType cause);
  11804. void focusLost (Component::FocusChangeType cause);
  11805. void handleAsyncUpdate();
  11806. const String getTooltip() { return label->getTooltip(); }
  11807. void mouseDown (const MouseEvent&);
  11808. void mouseDrag (const MouseEvent&);
  11809. void mouseUp (const MouseEvent&);
  11810. void lookAndFeelChanged();
  11811. void paint (Graphics&);
  11812. void resized();
  11813. bool keyStateChanged (bool isKeyDown);
  11814. bool keyPressed (const KeyPress&);
  11815. void valueChanged (Value&);
  11816. juce_UseDebuggingNewOperator
  11817. private:
  11818. struct ItemInfo
  11819. {
  11820. String name;
  11821. int itemId;
  11822. bool isEnabled : 1, isHeading : 1;
  11823. bool isSeparator() const throw();
  11824. bool isRealItem() const throw();
  11825. };
  11826. OwnedArray <ItemInfo> items;
  11827. Value currentId;
  11828. int lastCurrentId;
  11829. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11830. ListenerList <ComboBoxListener> listeners;
  11831. ScopedPointer<Label> label;
  11832. String textWhenNothingSelected, noChoicesMessage;
  11833. void showPopup();
  11834. ItemInfo* getItemForId (int itemId) const throw();
  11835. ItemInfo* getItemForIndex (int index) const throw();
  11836. ComboBox (const ComboBox&);
  11837. ComboBox& operator= (const ComboBox&);
  11838. };
  11839. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11840. /*** End of inlined file: juce_ComboBox.h ***/
  11841. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11842. {
  11843. public:
  11844. AudioDeviceManager();
  11845. ~AudioDeviceManager();
  11846. struct JUCE_API AudioDeviceSetup
  11847. {
  11848. AudioDeviceSetup();
  11849. bool operator== (const AudioDeviceSetup& other) const;
  11850. String outputDeviceName;
  11851. String inputDeviceName;
  11852. double sampleRate;
  11853. int bufferSize;
  11854. BigInteger inputChannels;
  11855. bool useDefaultInputChannels;
  11856. BigInteger outputChannels;
  11857. bool useDefaultOutputChannels;
  11858. };
  11859. const String initialise (int numInputChannelsNeeded,
  11860. int numOutputChannelsNeeded,
  11861. const XmlElement* savedState,
  11862. bool selectDefaultDeviceOnFailure,
  11863. const String& preferredDefaultDeviceName = String::empty,
  11864. const AudioDeviceSetup* preferredSetupOptions = 0);
  11865. XmlElement* createStateXml() const;
  11866. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11867. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11868. bool treatAsChosenDevice);
  11869. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11870. const String getCurrentAudioDeviceType() const { return currentDeviceType; }
  11871. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11872. void setCurrentAudioDeviceType (const String& type,
  11873. bool treatAsChosenDevice);
  11874. void closeAudioDevice();
  11875. void restartLastAudioDevice();
  11876. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11877. void removeAudioCallback (AudioIODeviceCallback* callback);
  11878. double getCpuUsage() const;
  11879. void setMidiInputEnabled (const String& midiInputDeviceName,
  11880. bool enabled);
  11881. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11882. void addMidiInputCallback (const String& midiInputDeviceName,
  11883. MidiInputCallback* callback);
  11884. void removeMidiInputCallback (const String& midiInputDeviceName,
  11885. MidiInputCallback* callback);
  11886. void setDefaultMidiOutput (const String& deviceName);
  11887. const String getDefaultMidiOutputName() const { return defaultMidiOutputName; }
  11888. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11889. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11890. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11891. void playTestSound();
  11892. void enableInputLevelMeasurement (bool enableMeasurement);
  11893. double getCurrentInputLevel() const;
  11894. juce_UseDebuggingNewOperator
  11895. private:
  11896. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11897. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11898. AudioDeviceSetup currentSetup;
  11899. ScopedPointer <AudioIODevice> currentAudioDevice;
  11900. SortedSet <AudioIODeviceCallback*> callbacks;
  11901. int numInputChansNeeded, numOutputChansNeeded;
  11902. String currentDeviceType;
  11903. BigInteger inputChannels, outputChannels;
  11904. ScopedPointer <XmlElement> lastExplicitSettings;
  11905. mutable bool listNeedsScanning;
  11906. bool useInputNames;
  11907. int inputLevelMeasurementEnabledCount;
  11908. double inputLevel;
  11909. ScopedPointer <AudioSampleBuffer> testSound;
  11910. int testSoundPosition;
  11911. AudioSampleBuffer tempBuffer;
  11912. StringArray midiInsFromXml;
  11913. OwnedArray <MidiInput> enabledMidiInputs;
  11914. Array <MidiInputCallback*> midiCallbacks;
  11915. Array <MidiInput*> midiCallbackDevices;
  11916. String defaultMidiOutputName;
  11917. ScopedPointer <MidiOutput> defaultMidiOutput;
  11918. CriticalSection audioCallbackLock, midiCallbackLock;
  11919. double cpuUsageMs, timeToCpuScale;
  11920. class CallbackHandler : public AudioIODeviceCallback,
  11921. public MidiInputCallback
  11922. {
  11923. public:
  11924. AudioDeviceManager* owner;
  11925. void audioDeviceIOCallback (const float** inputChannelData,
  11926. int totalNumInputChannels,
  11927. float** outputChannelData,
  11928. int totalNumOutputChannels,
  11929. int numSamples);
  11930. void audioDeviceAboutToStart (AudioIODevice*);
  11931. void audioDeviceStopped();
  11932. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11933. };
  11934. CallbackHandler callbackHandler;
  11935. friend class CallbackHandler;
  11936. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11937. int totalNumInputChannels,
  11938. float** outputChannelData,
  11939. int totalNumOutputChannels,
  11940. int numSamples);
  11941. void audioDeviceAboutToStartInt (AudioIODevice* device);
  11942. void audioDeviceStoppedInt();
  11943. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11944. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11945. const BigInteger& ins, const BigInteger& outs);
  11946. void stopDevice();
  11947. void updateXml();
  11948. void createDeviceTypesIfNeeded();
  11949. void scanDevicesIfNeeded();
  11950. void deleteCurrentDevice();
  11951. double chooseBestSampleRate (double preferred) const;
  11952. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11953. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11954. AudioDeviceManager (const AudioDeviceManager&);
  11955. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11956. };
  11957. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11958. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11959. #endif
  11960. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11961. #endif
  11962. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11963. #endif
  11964. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11965. #endif
  11966. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11967. #endif
  11968. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11969. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11970. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11971. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11972. class JUCE_API AudioDataConverters
  11973. {
  11974. public:
  11975. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  11976. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 2);
  11977. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  11978. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 3);
  11979. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11980. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11981. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11982. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, int destBytesPerSample = 4);
  11983. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  11984. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 2);
  11985. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  11986. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 3);
  11987. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11988. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11989. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11990. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, int srcBytesPerSample = 4);
  11991. enum DataFormat
  11992. {
  11993. int16LE,
  11994. int16BE,
  11995. int24LE,
  11996. int24BE,
  11997. int32LE,
  11998. int32BE,
  11999. float32LE,
  12000. float32BE,
  12001. };
  12002. static void convertFloatToFormat (DataFormat destFormat,
  12003. const float* source, void* dest, int numSamples);
  12004. static void convertFormatToFloat (DataFormat sourceFormat,
  12005. const void* source, float* dest, int numSamples);
  12006. static void interleaveSamples (const float** source, float* dest,
  12007. int numSamples, int numChannels);
  12008. static void deinterleaveSamples (const float* source, float** dest,
  12009. int numSamples, int numChannels);
  12010. private:
  12011. AudioDataConverters();
  12012. AudioDataConverters (const AudioDataConverters&);
  12013. AudioDataConverters& operator= (const AudioDataConverters&);
  12014. };
  12015. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  12016. /*** End of inlined file: juce_AudioDataConverters.h ***/
  12017. #endif
  12018. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  12019. #endif
  12020. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  12021. #endif
  12022. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  12023. #endif
  12024. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12025. /*** Start of inlined file: juce_MidiFile.h ***/
  12026. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  12027. #define __JUCE_MIDIFILE_JUCEHEADER__
  12028. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  12029. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12030. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12031. class JUCE_API MidiMessageSequence
  12032. {
  12033. public:
  12034. MidiMessageSequence();
  12035. MidiMessageSequence (const MidiMessageSequence& other);
  12036. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  12037. ~MidiMessageSequence();
  12038. class MidiEventHolder
  12039. {
  12040. public:
  12041. ~MidiEventHolder();
  12042. MidiMessage message;
  12043. MidiEventHolder* noteOffObject;
  12044. juce_UseDebuggingNewOperator
  12045. private:
  12046. friend class MidiMessageSequence;
  12047. MidiEventHolder (const MidiMessage& message);
  12048. };
  12049. void clear();
  12050. int getNumEvents() const;
  12051. MidiEventHolder* getEventPointer (int index) const;
  12052. double getTimeOfMatchingKeyUp (int index) const;
  12053. int getIndexOfMatchingKeyUp (int index) const;
  12054. int getIndexOf (MidiEventHolder* event) const;
  12055. int getNextIndexAtTime (double timeStamp) const;
  12056. double getStartTime() const;
  12057. double getEndTime() const;
  12058. double getEventTime (int index) const;
  12059. void addEvent (const MidiMessage& newMessage,
  12060. double timeAdjustment = 0);
  12061. void deleteEvent (int index, bool deleteMatchingNoteUp);
  12062. void addSequence (const MidiMessageSequence& other,
  12063. double timeAdjustmentDelta,
  12064. double firstAllowableDestTime,
  12065. double endOfAllowableDestTimes);
  12066. void updateMatchedPairs();
  12067. void extractMidiChannelMessages (int channelNumberToExtract,
  12068. MidiMessageSequence& destSequence,
  12069. bool alsoIncludeMetaEvents) const;
  12070. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  12071. void deleteMidiChannelMessages (int channelNumberToRemove);
  12072. void deleteSysExMessages();
  12073. void addTimeToMessages (double deltaTime);
  12074. void createControllerUpdatesForTime (int channelNumber, double time,
  12075. OwnedArray<MidiMessage>& resultMessages);
  12076. void swapWith (MidiMessageSequence& other) throw();
  12077. juce_UseDebuggingNewOperator
  12078. static int compareElements (const MidiMessageSequence::MidiEventHolder* first,
  12079. const MidiMessageSequence::MidiEventHolder* second) throw();
  12080. private:
  12081. friend class MidiFile;
  12082. OwnedArray <MidiEventHolder> list;
  12083. void sort();
  12084. };
  12085. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12086. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  12087. class JUCE_API MidiFile
  12088. {
  12089. public:
  12090. MidiFile();
  12091. ~MidiFile();
  12092. int getNumTracks() const throw();
  12093. const MidiMessageSequence* getTrack (const int index) const throw();
  12094. void addTrack (const MidiMessageSequence& trackSequence);
  12095. void clear();
  12096. short getTimeFormat() const throw();
  12097. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  12098. void setSmpteTimeFormat (const int framesPerSecond,
  12099. const int subframeResolution) throw();
  12100. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  12101. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  12102. double getLastTimestamp() const;
  12103. bool readFrom (InputStream& sourceStream);
  12104. bool writeTo (OutputStream& destStream);
  12105. void convertTimestampTicksToSeconds();
  12106. juce_UseDebuggingNewOperator
  12107. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  12108. const MidiMessageSequence::MidiEventHolder* const second);
  12109. private:
  12110. OwnedArray <MidiMessageSequence> tracks;
  12111. short timeFormat;
  12112. MidiFile (const MidiFile&);
  12113. MidiFile& operator= (const MidiFile&);
  12114. void readNextTrack (const uint8* data, int size);
  12115. void writeTrack (OutputStream& mainOut, const int trackNum);
  12116. };
  12117. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  12118. /*** End of inlined file: juce_MidiFile.h ***/
  12119. #endif
  12120. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12121. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  12122. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12123. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12124. class MidiKeyboardState;
  12125. class JUCE_API MidiKeyboardStateListener
  12126. {
  12127. public:
  12128. MidiKeyboardStateListener() throw() {}
  12129. virtual ~MidiKeyboardStateListener() {}
  12130. virtual void handleNoteOn (MidiKeyboardState* source,
  12131. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12132. virtual void handleNoteOff (MidiKeyboardState* source,
  12133. int midiChannel, int midiNoteNumber) = 0;
  12134. };
  12135. class JUCE_API MidiKeyboardState
  12136. {
  12137. public:
  12138. MidiKeyboardState();
  12139. ~MidiKeyboardState();
  12140. void reset();
  12141. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12142. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12143. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12144. void noteOff (const int midiChannel, const int midiNoteNumber);
  12145. void allNotesOff (const int midiChannel);
  12146. void processNextMidiEvent (const MidiMessage& message);
  12147. void processNextMidiBuffer (MidiBuffer& buffer,
  12148. const int startSample,
  12149. const int numSamples,
  12150. const bool injectIndirectEvents);
  12151. void addListener (MidiKeyboardStateListener* const listener) throw();
  12152. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12153. juce_UseDebuggingNewOperator
  12154. private:
  12155. CriticalSection lock;
  12156. uint16 noteStates [128];
  12157. MidiBuffer eventsToAdd;
  12158. Array <MidiKeyboardStateListener*> listeners;
  12159. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12160. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12161. MidiKeyboardState (const MidiKeyboardState&);
  12162. MidiKeyboardState& operator= (const MidiKeyboardState&);
  12163. };
  12164. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12165. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12166. #endif
  12167. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12168. #endif
  12169. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12170. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12171. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12172. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12173. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12174. public MidiInputCallback
  12175. {
  12176. public:
  12177. MidiMessageCollector();
  12178. ~MidiMessageCollector();
  12179. void reset (double sampleRate);
  12180. void addMessageToQueue (const MidiMessage& message);
  12181. void removeNextBlockOfMessages (MidiBuffer& destBuffer, int numSamples);
  12182. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12183. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12184. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12185. juce_UseDebuggingNewOperator
  12186. private:
  12187. double lastCallbackTime;
  12188. CriticalSection midiCallbackLock;
  12189. MidiBuffer incomingMessages;
  12190. double sampleRate;
  12191. MidiMessageCollector (const MidiMessageCollector&);
  12192. MidiMessageCollector& operator= (const MidiMessageCollector&);
  12193. };
  12194. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12195. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12196. #endif
  12197. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12198. #endif
  12199. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12200. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12201. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12202. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12203. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12204. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12205. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12206. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12207. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12208. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12209. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12210. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12211. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12212. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12213. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12214. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12215. class AudioProcessor;
  12216. class JUCE_API AudioProcessorEditor : public Component
  12217. {
  12218. protected:
  12219. AudioProcessorEditor (AudioProcessor* const owner);
  12220. public:
  12221. ~AudioProcessorEditor();
  12222. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12223. private:
  12224. AudioProcessor* const owner;
  12225. AudioProcessorEditor (const AudioProcessorEditor&);
  12226. AudioProcessorEditor& operator= (const AudioProcessorEditor&);
  12227. };
  12228. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12229. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12230. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12231. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12232. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12233. class AudioProcessor;
  12234. class JUCE_API AudioProcessorListener
  12235. {
  12236. public:
  12237. virtual ~AudioProcessorListener() {}
  12238. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12239. int parameterIndex,
  12240. float newValue) = 0;
  12241. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12242. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12243. int parameterIndex);
  12244. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12245. int parameterIndex);
  12246. };
  12247. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12248. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12249. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12250. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12251. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12252. class JUCE_API AudioPlayHead
  12253. {
  12254. protected:
  12255. AudioPlayHead() {}
  12256. public:
  12257. virtual ~AudioPlayHead() {}
  12258. enum FrameRateType
  12259. {
  12260. fps24 = 0,
  12261. fps25 = 1,
  12262. fps2997 = 2,
  12263. fps30 = 3,
  12264. fps2997drop = 4,
  12265. fps30drop = 5,
  12266. fpsUnknown = 99
  12267. };
  12268. struct CurrentPositionInfo
  12269. {
  12270. double bpm;
  12271. int timeSigNumerator;
  12272. int timeSigDenominator;
  12273. double timeInSeconds;
  12274. double editOriginTime;
  12275. double ppqPosition;
  12276. double ppqPositionOfLastBarStart;
  12277. FrameRateType frameRate;
  12278. bool isPlaying;
  12279. bool isRecording;
  12280. bool operator== (const CurrentPositionInfo& other) const throw();
  12281. bool operator!= (const CurrentPositionInfo& other) const throw();
  12282. void resetToDefault();
  12283. };
  12284. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12285. };
  12286. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12287. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12288. class JUCE_API AudioProcessor
  12289. {
  12290. protected:
  12291. AudioProcessor();
  12292. public:
  12293. virtual ~AudioProcessor();
  12294. virtual const String getName() const = 0;
  12295. virtual void prepareToPlay (double sampleRate,
  12296. int estimatedSamplesPerBlock) = 0;
  12297. virtual void releaseResources() = 0;
  12298. virtual void processBlock (AudioSampleBuffer& buffer,
  12299. MidiBuffer& midiMessages) = 0;
  12300. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12301. double getSampleRate() const throw() { return sampleRate; }
  12302. int getBlockSize() const throw() { return blockSize; }
  12303. int getNumInputChannels() const throw() { return numInputChannels; }
  12304. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12305. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12306. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12307. virtual bool isInputChannelStereoPair (int index) const = 0;
  12308. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12309. int getLatencySamples() const throw() { return latencySamples; }
  12310. void setLatencySamples (const int newLatency);
  12311. virtual bool acceptsMidi() const = 0;
  12312. virtual bool producesMidi() const = 0;
  12313. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12314. void suspendProcessing (const bool shouldBeSuspended);
  12315. bool isSuspended() const throw() { return suspended; }
  12316. virtual void reset();
  12317. bool isNonRealtime() const throw() { return nonRealtime; }
  12318. void setNonRealtime (const bool isNonRealtime) throw();
  12319. virtual AudioProcessorEditor* createEditor() = 0;
  12320. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12321. AudioProcessorEditor* createEditorIfNeeded();
  12322. virtual int getNumParameters() = 0;
  12323. virtual const String getParameterName (int parameterIndex) = 0;
  12324. virtual float getParameter (int parameterIndex) = 0;
  12325. virtual const String getParameterText (int parameterIndex) = 0;
  12326. virtual void setParameter (int parameterIndex,
  12327. float newValue) = 0;
  12328. void setParameterNotifyingHost (int parameterIndex,
  12329. float newValue);
  12330. virtual bool isParameterAutomatable (int parameterIndex) const;
  12331. virtual bool isMetaParameter (int parameterIndex) const;
  12332. void beginParameterChangeGesture (int parameterIndex);
  12333. void endParameterChangeGesture (int parameterIndex);
  12334. void updateHostDisplay();
  12335. virtual int getNumPrograms() = 0;
  12336. virtual int getCurrentProgram() = 0;
  12337. virtual void setCurrentProgram (int index) = 0;
  12338. virtual const String getProgramName (int index) = 0;
  12339. virtual void changeProgramName (int index, const String& newName) = 0;
  12340. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12341. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12342. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12343. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12344. void addListener (AudioProcessorListener* const newListener) throw();
  12345. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12346. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12347. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12348. void setPlayConfigDetails (const int numIns, const int numOuts,
  12349. const double sampleRate,
  12350. const int blockSize) throw();
  12351. juce_UseDebuggingNewOperator
  12352. protected:
  12353. static void copyXmlToBinary (const XmlElement& xml,
  12354. JUCE_NAMESPACE::MemoryBlock& destData);
  12355. static XmlElement* getXmlFromBinary (const void* data,
  12356. const int sizeInBytes);
  12357. AudioPlayHead* playHead;
  12358. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12359. private:
  12360. VoidArray listeners;
  12361. AudioProcessorEditor* activeEditor;
  12362. double sampleRate;
  12363. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12364. bool suspended, nonRealtime;
  12365. CriticalSection callbackLock, listenerLock;
  12366. #ifdef JUCE_DEBUG
  12367. BigInteger changingParams;
  12368. #endif
  12369. AudioProcessor (const AudioProcessor&);
  12370. AudioProcessor& operator= (const AudioProcessor&);
  12371. };
  12372. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12373. /*** End of inlined file: juce_AudioProcessor.h ***/
  12374. /*** Start of inlined file: juce_PluginDescription.h ***/
  12375. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12376. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12377. class JUCE_API PluginDescription
  12378. {
  12379. public:
  12380. PluginDescription() throw();
  12381. PluginDescription (const PluginDescription& other) throw();
  12382. PluginDescription& operator= (const PluginDescription& other) throw();
  12383. ~PluginDescription() throw();
  12384. String name;
  12385. String pluginFormatName;
  12386. String category;
  12387. String manufacturerName;
  12388. String version;
  12389. String fileOrIdentifier;
  12390. Time lastFileModTime;
  12391. int uid;
  12392. bool isInstrument;
  12393. int numInputChannels;
  12394. int numOutputChannels;
  12395. bool isDuplicateOf (const PluginDescription& other) const;
  12396. const String createIdentifierString() const throw();
  12397. XmlElement* createXml() const;
  12398. bool loadFromXml (const XmlElement& xml);
  12399. juce_UseDebuggingNewOperator
  12400. };
  12401. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12402. /*** End of inlined file: juce_PluginDescription.h ***/
  12403. class JUCE_API AudioPluginInstance : public AudioProcessor
  12404. {
  12405. public:
  12406. virtual ~AudioPluginInstance();
  12407. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12408. juce_UseDebuggingNewOperator
  12409. protected:
  12410. AudioPluginInstance();
  12411. AudioPluginInstance (const AudioPluginInstance&);
  12412. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12413. };
  12414. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12415. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12416. class PluginDescription;
  12417. class JUCE_API AudioPluginFormat
  12418. {
  12419. public:
  12420. virtual ~AudioPluginFormat();
  12421. virtual const String getName() const = 0;
  12422. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12423. const String& fileOrIdentifier) = 0;
  12424. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12425. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12426. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12427. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12428. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12429. bool recursive) = 0;
  12430. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12431. juce_UseDebuggingNewOperator
  12432. protected:
  12433. AudioPluginFormat() throw();
  12434. AudioPluginFormat (const AudioPluginFormat&);
  12435. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12436. };
  12437. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12438. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12439. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12440. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12441. {
  12442. public:
  12443. AudioUnitPluginFormat();
  12444. ~AudioUnitPluginFormat();
  12445. const String getName() const { return "AudioUnit"; }
  12446. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12447. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12448. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12449. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12450. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12451. bool doesPluginStillExist (const PluginDescription& desc);
  12452. const FileSearchPath getDefaultLocationsToSearch();
  12453. juce_UseDebuggingNewOperator
  12454. private:
  12455. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12456. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12457. };
  12458. #endif
  12459. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12460. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12461. #endif
  12462. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12463. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12464. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12465. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12466. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12467. // Sorry, this file is just a placeholder at the moment!...
  12468. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12469. {
  12470. public:
  12471. DirectXPluginFormat();
  12472. ~DirectXPluginFormat();
  12473. const String getName() const { return "DirectX"; }
  12474. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12475. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12476. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12477. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12478. const FileSearchPath getDefaultLocationsToSearch();
  12479. juce_UseDebuggingNewOperator
  12480. private:
  12481. DirectXPluginFormat (const DirectXPluginFormat&);
  12482. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12483. };
  12484. #endif
  12485. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12486. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12487. #endif
  12488. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12489. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12490. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12491. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12492. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12493. // Sorry, this file is just a placeholder at the moment!...
  12494. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12495. {
  12496. public:
  12497. LADSPAPluginFormat();
  12498. ~LADSPAPluginFormat();
  12499. const String getName() const { return "LADSPA"; }
  12500. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12501. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12502. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12503. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12504. const FileSearchPath getDefaultLocationsToSearch();
  12505. juce_UseDebuggingNewOperator
  12506. private:
  12507. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12508. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12509. };
  12510. #endif
  12511. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12512. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12513. #endif
  12514. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12515. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12516. #ifdef __aeffect__
  12517. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12518. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12519. class VSTMidiEventList
  12520. {
  12521. public:
  12522. VSTMidiEventList()
  12523. : numEventsUsed (0), numEventsAllocated (0)
  12524. {
  12525. }
  12526. ~VSTMidiEventList()
  12527. {
  12528. freeEvents();
  12529. }
  12530. void clear()
  12531. {
  12532. numEventsUsed = 0;
  12533. if (events != 0)
  12534. events->numEvents = 0;
  12535. }
  12536. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12537. {
  12538. ensureSize (numEventsUsed + 1);
  12539. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12540. events->numEvents = ++numEventsUsed;
  12541. if (numBytes <= 4)
  12542. {
  12543. if (e->type == kVstSysExType)
  12544. {
  12545. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12546. e->type = kVstMidiType;
  12547. e->byteSize = sizeof (VstMidiEvent);
  12548. e->noteLength = 0;
  12549. e->noteOffset = 0;
  12550. e->detune = 0;
  12551. e->noteOffVelocity = 0;
  12552. }
  12553. e->deltaFrames = frameOffset;
  12554. memcpy (e->midiData, midiData, numBytes);
  12555. }
  12556. else
  12557. {
  12558. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12559. if (se->type == kVstSysExType)
  12560. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12561. else
  12562. se->sysexDump = (char*) juce_malloc (numBytes);
  12563. memcpy (se->sysexDump, midiData, numBytes);
  12564. se->type = kVstSysExType;
  12565. se->byteSize = sizeof (VstMidiSysexEvent);
  12566. se->deltaFrames = frameOffset;
  12567. se->flags = 0;
  12568. se->dumpBytes = numBytes;
  12569. se->resvd1 = 0;
  12570. se->resvd2 = 0;
  12571. }
  12572. }
  12573. // Handy method to pull the events out of an event buffer supplied by the host
  12574. // or plugin.
  12575. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12576. {
  12577. for (int i = 0; i < events->numEvents; ++i)
  12578. {
  12579. const VstEvent* const e = events->events[i];
  12580. if (e != 0)
  12581. {
  12582. if (e->type == kVstMidiType)
  12583. {
  12584. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12585. 4, e->deltaFrames);
  12586. }
  12587. else if (e->type == kVstSysExType)
  12588. {
  12589. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12590. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12591. e->deltaFrames);
  12592. }
  12593. }
  12594. }
  12595. }
  12596. void ensureSize (int numEventsNeeded)
  12597. {
  12598. if (numEventsNeeded > numEventsAllocated)
  12599. {
  12600. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12601. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12602. if (events == 0)
  12603. events.calloc (size, 1);
  12604. else
  12605. events.realloc (size, 1);
  12606. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12607. {
  12608. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12609. (int) sizeof (VstMidiSysexEvent)));
  12610. e->type = kVstMidiType;
  12611. e->byteSize = sizeof (VstMidiEvent);
  12612. events->events[i] = (VstEvent*) e;
  12613. }
  12614. numEventsAllocated = numEventsNeeded;
  12615. }
  12616. }
  12617. void freeEvents()
  12618. {
  12619. if (events != 0)
  12620. {
  12621. for (int i = numEventsAllocated; --i >= 0;)
  12622. {
  12623. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12624. if (e->type == kVstSysExType)
  12625. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12626. juce_free (e);
  12627. }
  12628. events.free();
  12629. numEventsUsed = 0;
  12630. numEventsAllocated = 0;
  12631. }
  12632. }
  12633. HeapBlock <VstEvents> events;
  12634. private:
  12635. int numEventsUsed, numEventsAllocated;
  12636. };
  12637. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12638. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12639. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12640. #endif
  12641. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12642. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12643. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12644. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12645. #if JUCE_PLUGINHOST_VST
  12646. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12647. {
  12648. public:
  12649. VSTPluginFormat();
  12650. ~VSTPluginFormat();
  12651. const String getName() const { return "VST"; }
  12652. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12653. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12654. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12655. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12656. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, bool recursive);
  12657. bool doesPluginStillExist (const PluginDescription& desc);
  12658. const FileSearchPath getDefaultLocationsToSearch();
  12659. juce_UseDebuggingNewOperator
  12660. private:
  12661. VSTPluginFormat (const VSTPluginFormat&);
  12662. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12663. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12664. };
  12665. #endif
  12666. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12667. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12668. #endif
  12669. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12670. #endif
  12671. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12672. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12673. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12674. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12675. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12676. {
  12677. public:
  12678. AudioPluginFormatManager() throw();
  12679. ~AudioPluginFormatManager() throw();
  12680. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12681. void addDefaultFormats();
  12682. int getNumFormats() throw();
  12683. AudioPluginFormat* getFormat (const int index) throw();
  12684. void addFormat (AudioPluginFormat* const format) throw();
  12685. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12686. String& errorMessage) const;
  12687. bool doesPluginStillExist (const PluginDescription& description) const;
  12688. juce_UseDebuggingNewOperator
  12689. private:
  12690. OwnedArray <AudioPluginFormat> formats;
  12691. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12692. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12693. };
  12694. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12695. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12696. #endif
  12697. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12698. #endif
  12699. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12700. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12701. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12702. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12703. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12704. {
  12705. public:
  12706. KnownPluginList();
  12707. ~KnownPluginList();
  12708. void clear();
  12709. int getNumTypes() const throw() { return types.size(); }
  12710. PluginDescription* getType (int index) const throw() { return types [index]; }
  12711. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12712. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12713. bool addType (const PluginDescription& type);
  12714. void removeType (int index) throw();
  12715. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12716. bool dontRescanIfAlreadyInList,
  12717. OwnedArray <PluginDescription>& typesFound,
  12718. AudioPluginFormat& formatToUse);
  12719. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12720. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12721. OwnedArray <PluginDescription>& typesFound);
  12722. enum SortMethod
  12723. {
  12724. defaultOrder = 0,
  12725. sortAlphabetically,
  12726. sortByCategory,
  12727. sortByManufacturer,
  12728. sortByFileSystemLocation
  12729. };
  12730. void addToMenu (PopupMenu& menu,
  12731. const SortMethod sortMethod) const;
  12732. int getIndexChosenByMenu (int menuResultCode) const;
  12733. void sort (const SortMethod method);
  12734. XmlElement* createXml() const;
  12735. void recreateFromXml (const XmlElement& xml);
  12736. juce_UseDebuggingNewOperator
  12737. private:
  12738. OwnedArray <PluginDescription> types;
  12739. KnownPluginList (const KnownPluginList&);
  12740. KnownPluginList& operator= (const KnownPluginList&);
  12741. };
  12742. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12743. /*** End of inlined file: juce_KnownPluginList.h ***/
  12744. #endif
  12745. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12746. #endif
  12747. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12748. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12749. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12750. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12751. class JUCE_API PluginDirectoryScanner
  12752. {
  12753. public:
  12754. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12755. AudioPluginFormat& formatToLookFor,
  12756. FileSearchPath directoriesToSearch,
  12757. bool searchRecursively,
  12758. const File& deadMansPedalFile);
  12759. ~PluginDirectoryScanner();
  12760. bool scanNextFile (bool dontRescanIfAlreadyInList);
  12761. const String getNextPluginFileThatWillBeScanned() const throw();
  12762. float getProgress() const { return progress; }
  12763. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12764. juce_UseDebuggingNewOperator
  12765. private:
  12766. KnownPluginList& list;
  12767. AudioPluginFormat& format;
  12768. StringArray filesOrIdentifiersToScan;
  12769. File deadMansPedalFile;
  12770. StringArray failedFiles;
  12771. int nextIndex;
  12772. float progress;
  12773. const StringArray getDeadMansPedalFile() throw();
  12774. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12775. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12776. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12777. };
  12778. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12779. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12780. #endif
  12781. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12782. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12783. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12784. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12785. /*** Start of inlined file: juce_ListBox.h ***/
  12786. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12787. #define __JUCE_LISTBOX_JUCEHEADER__
  12788. class ListViewport;
  12789. class JUCE_API ListBoxModel
  12790. {
  12791. public:
  12792. virtual ~ListBoxModel() {}
  12793. virtual int getNumRows() = 0;
  12794. virtual void paintListBoxItem (int rowNumber,
  12795. Graphics& g,
  12796. int width, int height,
  12797. bool rowIsSelected) = 0;
  12798. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12799. Component* existingComponentToUpdate);
  12800. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12801. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12802. virtual void backgroundClicked();
  12803. virtual void selectedRowsChanged (int lastRowSelected);
  12804. virtual void deleteKeyPressed (int lastRowSelected);
  12805. virtual void returnKeyPressed (int lastRowSelected);
  12806. virtual void listWasScrolled();
  12807. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12808. virtual const String getTooltipForRow (int row);
  12809. };
  12810. class JUCE_API ListBox : public Component,
  12811. public SettableTooltipClient
  12812. {
  12813. public:
  12814. ListBox (const String& componentName,
  12815. ListBoxModel* model);
  12816. ~ListBox();
  12817. void setModel (ListBoxModel* newModel);
  12818. ListBoxModel* getModel() const throw() { return model; }
  12819. void updateContent();
  12820. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12821. void setMouseMoveSelectsRows (bool shouldSelect);
  12822. void selectRow (int rowNumber,
  12823. bool dontScrollToShowThisRow = false,
  12824. bool deselectOthersFirst = true);
  12825. void selectRangeOfRows (int firstRow,
  12826. int lastRow);
  12827. void deselectRow (int rowNumber);
  12828. void deselectAllRows();
  12829. void flipRowSelection (int rowNumber);
  12830. const SparseSet<int> getSelectedRows() const;
  12831. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12832. bool sendNotificationEventToModel = true);
  12833. bool isRowSelected (int rowNumber) const;
  12834. int getNumSelectedRows() const;
  12835. int getSelectedRow (int index = 0) const;
  12836. int getLastRowSelected() const;
  12837. void selectRowsBasedOnModifierKeys (int rowThatWasClickedOn,
  12838. const ModifierKeys& modifiers);
  12839. void setVerticalPosition (double newProportion);
  12840. double getVerticalPosition() const;
  12841. void scrollToEnsureRowIsOnscreen (int row);
  12842. ScrollBar* getVerticalScrollBar() const throw();
  12843. ScrollBar* getHorizontalScrollBar() const throw();
  12844. int getRowContainingPosition (int x, int y) const throw();
  12845. int getInsertionIndexForPosition (int x, int y) const throw();
  12846. const Rectangle<int> getRowPosition (int rowNumber,
  12847. bool relativeToComponentTopLeft) const throw();
  12848. Component* getComponentForRowNumber (int rowNumber) const throw();
  12849. int getRowNumberOfComponent (Component* rowComponent) const throw();
  12850. int getVisibleRowWidth() const throw();
  12851. void setRowHeight (int newHeight);
  12852. int getRowHeight() const throw() { return rowHeight; }
  12853. int getNumRowsOnScreen() const throw();
  12854. enum ColourIds
  12855. {
  12856. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12857. Make this transparent if you don't want the background to be filled. */
  12858. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12859. Make this transparent to not have an outline. */
  12860. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12861. };
  12862. void setOutlineThickness (int outlineThickness);
  12863. int getOutlineThickness() const throw() { return outlineThickness; }
  12864. void setHeaderComponent (Component* newHeaderComponent);
  12865. void setMinimumContentWidth (int newMinimumWidth);
  12866. int getVisibleContentWidth() const throw();
  12867. void repaintRow (int rowNumber) throw();
  12868. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12869. Viewport* getViewport() const throw();
  12870. bool keyPressed (const KeyPress& key);
  12871. bool keyStateChanged (bool isKeyDown);
  12872. void paint (Graphics& g);
  12873. void paintOverChildren (Graphics& g);
  12874. void resized();
  12875. void visibilityChanged();
  12876. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12877. void mouseMove (const MouseEvent&);
  12878. void mouseExit (const MouseEvent&);
  12879. void mouseUp (const MouseEvent&);
  12880. void colourChanged();
  12881. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12882. juce_UseDebuggingNewOperator
  12883. private:
  12884. friend class ListViewport;
  12885. friend class TableListBox;
  12886. ListBoxModel* model;
  12887. ListViewport* viewport;
  12888. Component* headerComponent;
  12889. int totalItems, rowHeight, minimumRowWidth;
  12890. int outlineThickness;
  12891. int lastRowSelected;
  12892. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12893. SparseSet <int> selected;
  12894. void selectRowInternal (int rowNumber,
  12895. bool dontScrollToShowThisRow,
  12896. bool deselectOthersFirst,
  12897. bool isMouseClick);
  12898. ListBox (const ListBox&);
  12899. ListBox& operator= (const ListBox&);
  12900. };
  12901. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12902. /*** End of inlined file: juce_ListBox.h ***/
  12903. /*** Start of inlined file: juce_TextButton.h ***/
  12904. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12905. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12906. class JUCE_API TextButton : public Button
  12907. {
  12908. public:
  12909. TextButton (const String& buttonName,
  12910. const String& toolTip = String::empty);
  12911. ~TextButton();
  12912. enum ColourIds
  12913. {
  12914. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12915. 'off'). The look-and-feel class might re-interpret this to add
  12916. effects, etc. */
  12917. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12918. 'on'). The look-and-feel class might re-interpret this to add
  12919. effects, etc. */
  12920. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12921. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12922. };
  12923. void changeWidthToFitText (int newHeight = -1);
  12924. virtual const Font getFont();
  12925. juce_UseDebuggingNewOperator
  12926. protected:
  12927. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12928. void colourChanged();
  12929. private:
  12930. TextButton (const TextButton&);
  12931. TextButton& operator= (const TextButton&);
  12932. };
  12933. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12934. /*** End of inlined file: juce_TextButton.h ***/
  12935. class JUCE_API PluginListComponent : public Component,
  12936. public ListBoxModel,
  12937. public ChangeListener,
  12938. public ButtonListener,
  12939. public Timer
  12940. {
  12941. public:
  12942. PluginListComponent (KnownPluginList& listToRepresent,
  12943. const File& deadMansPedalFile,
  12944. PropertiesFile* propertiesToUse);
  12945. ~PluginListComponent();
  12946. void resized();
  12947. bool isInterestedInFileDrag (const StringArray& files);
  12948. void filesDropped (const StringArray& files, int, int);
  12949. int getNumRows();
  12950. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12951. void deleteKeyPressed (int lastRowSelected);
  12952. void buttonClicked (Button* b);
  12953. void changeListenerCallback (void*);
  12954. void timerCallback();
  12955. juce_UseDebuggingNewOperator
  12956. private:
  12957. KnownPluginList& list;
  12958. File deadMansPedalFile;
  12959. ListBox* listBox;
  12960. TextButton* optionsButton;
  12961. PropertiesFile* propertiesToUse;
  12962. int typeToScan;
  12963. void scanFor (AudioPluginFormat* format);
  12964. PluginListComponent (const PluginListComponent&);
  12965. PluginListComponent& operator= (const PluginListComponent&);
  12966. };
  12967. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12968. /*** End of inlined file: juce_PluginListComponent.h ***/
  12969. #endif
  12970. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12971. #endif
  12972. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12973. #endif
  12974. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12975. #endif
  12976. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12977. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12978. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12979. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12980. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12981. public AsyncUpdater
  12982. {
  12983. public:
  12984. AudioProcessorGraph();
  12985. ~AudioProcessorGraph();
  12986. class JUCE_API Node : public ReferenceCountedObject
  12987. {
  12988. public:
  12989. ~Node();
  12990. const uint32 id;
  12991. AudioProcessor* const processor;
  12992. NamedValueSet properties;
  12993. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12994. juce_UseDebuggingNewOperator
  12995. private:
  12996. friend class AudioProcessorGraph;
  12997. bool isPrepared;
  12998. Node (uint32 id, AudioProcessor* processor);
  12999. void prepare (double sampleRate, int blockSize, AudioProcessorGraph* graph);
  13000. void unprepare();
  13001. Node (const Node&);
  13002. Node& operator= (const Node&);
  13003. };
  13004. struct JUCE_API Connection
  13005. {
  13006. public:
  13007. uint32 sourceNodeId;
  13008. int sourceChannelIndex;
  13009. uint32 destNodeId;
  13010. int destChannelIndex;
  13011. juce_UseDebuggingNewOperator
  13012. private:
  13013. };
  13014. void clear();
  13015. int getNumNodes() const { return nodes.size(); }
  13016. Node* getNode (const int index) const { return nodes [index]; }
  13017. Node* getNodeForId (const uint32 nodeId) const;
  13018. Node* addNode (AudioProcessor* newProcessor, uint32 nodeId = 0);
  13019. bool removeNode (uint32 nodeId);
  13020. int getNumConnections() const { return connections.size(); }
  13021. const Connection* getConnection (int index) const { return connections [index]; }
  13022. const Connection* getConnectionBetween (uint32 sourceNodeId,
  13023. int sourceChannelIndex,
  13024. uint32 destNodeId,
  13025. int destChannelIndex) const;
  13026. bool isConnected (uint32 possibleSourceNodeId,
  13027. uint32 possibleDestNodeId) const;
  13028. bool canConnect (uint32 sourceNodeId, int sourceChannelIndex,
  13029. uint32 destNodeId, int destChannelIndex) const;
  13030. bool addConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13031. uint32 destNodeId, int destChannelIndex);
  13032. void removeConnection (int index);
  13033. bool removeConnection (uint32 sourceNodeId, int sourceChannelIndex,
  13034. uint32 destNodeId, int destChannelIndex);
  13035. bool disconnectNode (uint32 nodeId);
  13036. bool removeIllegalConnections();
  13037. static const int midiChannelIndex;
  13038. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  13039. {
  13040. public:
  13041. enum IODeviceType
  13042. {
  13043. audioInputNode, /**< In this mode, the processor has output channels
  13044. representing all the audio input channels that are
  13045. coming into its parent audio graph. */
  13046. audioOutputNode, /**< In this mode, the processor has input channels
  13047. representing all the audio output channels that are
  13048. going out of its parent audio graph. */
  13049. midiInputNode, /**< In this mode, the processor has a midi output which
  13050. delivers the same midi data that is arriving at its
  13051. parent graph. */
  13052. midiOutputNode /**< In this mode, the processor has a midi input and
  13053. any data sent to it will be passed out of the parent
  13054. graph. */
  13055. };
  13056. IODeviceType getType() const { return type; }
  13057. AudioProcessorGraph* getParentGraph() const { return graph; }
  13058. bool isInput() const;
  13059. bool isOutput() const;
  13060. AudioGraphIOProcessor (const IODeviceType type);
  13061. ~AudioGraphIOProcessor();
  13062. const String getName() const;
  13063. void fillInPluginDescription (PluginDescription& d) const;
  13064. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13065. void releaseResources();
  13066. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13067. const String getInputChannelName (const int channelIndex) const;
  13068. const String getOutputChannelName (const int channelIndex) const;
  13069. bool isInputChannelStereoPair (int index) const;
  13070. bool isOutputChannelStereoPair (int index) const;
  13071. bool acceptsMidi() const;
  13072. bool producesMidi() const;
  13073. AudioProcessorEditor* createEditor();
  13074. int getNumParameters();
  13075. const String getParameterName (int);
  13076. float getParameter (int);
  13077. const String getParameterText (int);
  13078. void setParameter (int, float);
  13079. int getNumPrograms();
  13080. int getCurrentProgram();
  13081. void setCurrentProgram (int);
  13082. const String getProgramName (int);
  13083. void changeProgramName (int, const String&);
  13084. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13085. void setStateInformation (const void* data, int sizeInBytes);
  13086. void setParentGraph (AudioProcessorGraph* graph);
  13087. juce_UseDebuggingNewOperator
  13088. private:
  13089. const IODeviceType type;
  13090. AudioProcessorGraph* graph;
  13091. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  13092. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  13093. };
  13094. // AudioProcessor methods:
  13095. const String getName() const;
  13096. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  13097. void releaseResources();
  13098. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  13099. const String getInputChannelName (const int channelIndex) const;
  13100. const String getOutputChannelName (const int channelIndex) const;
  13101. bool isInputChannelStereoPair (int index) const;
  13102. bool isOutputChannelStereoPair (int index) const;
  13103. bool acceptsMidi() const;
  13104. bool producesMidi() const;
  13105. AudioProcessorEditor* createEditor() { return 0; }
  13106. int getNumParameters() { return 0; }
  13107. const String getParameterName (int) { return String::empty; }
  13108. float getParameter (int) { return 0; }
  13109. const String getParameterText (int) { return String::empty; }
  13110. void setParameter (int, float) { }
  13111. int getNumPrograms() { return 0; }
  13112. int getCurrentProgram() { return 0; }
  13113. void setCurrentProgram (int) { }
  13114. const String getProgramName (int) { return String::empty; }
  13115. void changeProgramName (int, const String&) { }
  13116. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  13117. void setStateInformation (const void* data, int sizeInBytes);
  13118. void handleAsyncUpdate();
  13119. juce_UseDebuggingNewOperator
  13120. private:
  13121. ReferenceCountedArray <Node> nodes;
  13122. OwnedArray <Connection> connections;
  13123. int lastNodeId;
  13124. AudioSampleBuffer renderingBuffers;
  13125. OwnedArray <MidiBuffer> midiBuffers;
  13126. CriticalSection renderLock;
  13127. VoidArray renderingOps;
  13128. friend class AudioGraphIOProcessor;
  13129. AudioSampleBuffer* currentAudioInputBuffer;
  13130. AudioSampleBuffer currentAudioOutputBuffer;
  13131. MidiBuffer* currentMidiInputBuffer;
  13132. MidiBuffer currentMidiOutputBuffer;
  13133. void clearRenderingSequence();
  13134. void buildRenderingSequence();
  13135. bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const;
  13136. AudioProcessorGraph (const AudioProcessorGraph&);
  13137. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13138. };
  13139. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13140. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13141. #endif
  13142. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13143. #endif
  13144. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13145. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13146. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13147. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13148. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13149. public MidiInputCallback
  13150. {
  13151. public:
  13152. AudioProcessorPlayer();
  13153. virtual ~AudioProcessorPlayer();
  13154. void setProcessor (AudioProcessor* const processorToPlay);
  13155. AudioProcessor* getCurrentProcessor() const { return processor; }
  13156. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13157. void audioDeviceIOCallback (const float** inputChannelData,
  13158. int totalNumInputChannels,
  13159. float** outputChannelData,
  13160. int totalNumOutputChannels,
  13161. int numSamples);
  13162. void audioDeviceAboutToStart (AudioIODevice* device);
  13163. void audioDeviceStopped();
  13164. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13165. juce_UseDebuggingNewOperator
  13166. private:
  13167. AudioProcessor* processor;
  13168. CriticalSection lock;
  13169. double sampleRate;
  13170. int blockSize;
  13171. bool isPrepared;
  13172. int numInputChans, numOutputChans;
  13173. float* channels [128];
  13174. AudioSampleBuffer tempBuffer;
  13175. MidiBuffer incomingMidi;
  13176. MidiMessageCollector messageCollector;
  13177. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13178. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13179. };
  13180. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13181. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13182. #endif
  13183. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13184. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13185. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13186. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13187. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13188. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13189. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13190. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13191. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13192. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13193. class EditableProperty;
  13194. class JUCE_API PropertyComponent : public Component,
  13195. public SettableTooltipClient
  13196. {
  13197. public:
  13198. PropertyComponent (const String& propertyName,
  13199. int preferredHeight = 25);
  13200. ~PropertyComponent();
  13201. int getPreferredHeight() const throw() { return preferredHeight; }
  13202. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13203. virtual void refresh() = 0;
  13204. void paint (Graphics& g);
  13205. void resized();
  13206. void enablementChanged();
  13207. juce_UseDebuggingNewOperator
  13208. protected:
  13209. int preferredHeight;
  13210. };
  13211. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13212. /*** End of inlined file: juce_PropertyComponent.h ***/
  13213. class JUCE_API PropertyPanel : public Component
  13214. {
  13215. public:
  13216. PropertyPanel();
  13217. ~PropertyPanel();
  13218. void clear();
  13219. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13220. void addSection (const String& sectionTitle,
  13221. const Array <PropertyComponent*>& newPropertyComponents,
  13222. bool shouldSectionInitiallyBeOpen = true);
  13223. void refreshAll() const;
  13224. const StringArray getSectionNames() const;
  13225. bool isSectionOpen (int sectionIndex) const;
  13226. void setSectionOpen (int sectionIndex, bool shouldBeOpen);
  13227. void setSectionEnabled (int sectionIndex, bool shouldBeEnabled);
  13228. XmlElement* getOpennessState() const;
  13229. void restoreOpennessState (const XmlElement& newState);
  13230. void setMessageWhenEmpty (const String& newMessage);
  13231. const String& getMessageWhenEmpty() const;
  13232. void paint (Graphics& g);
  13233. void resized();
  13234. juce_UseDebuggingNewOperator
  13235. private:
  13236. Viewport* viewport;
  13237. class PropertyHolderComponent;
  13238. PropertyHolderComponent* propertyHolderComponent;
  13239. String messageWhenEmpty;
  13240. void updatePropHolderLayout() const;
  13241. void updatePropHolderLayout (int width) const;
  13242. };
  13243. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13244. /*** End of inlined file: juce_PropertyPanel.h ***/
  13245. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13246. {
  13247. public:
  13248. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13249. ~GenericAudioProcessorEditor();
  13250. void paint (Graphics& g);
  13251. void resized();
  13252. juce_UseDebuggingNewOperator
  13253. private:
  13254. PropertyPanel* panel;
  13255. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13256. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13257. };
  13258. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13259. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13260. #endif
  13261. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13262. /*** Start of inlined file: juce_Sampler.h ***/
  13263. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13264. #define __JUCE_SAMPLER_JUCEHEADER__
  13265. /*** Start of inlined file: juce_Synthesiser.h ***/
  13266. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13267. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13268. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13269. {
  13270. protected:
  13271. SynthesiserSound();
  13272. public:
  13273. virtual ~SynthesiserSound();
  13274. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13275. virtual bool appliesToChannel (const int midiChannel) = 0;
  13276. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13277. juce_UseDebuggingNewOperator
  13278. };
  13279. class JUCE_API SynthesiserVoice
  13280. {
  13281. public:
  13282. SynthesiserVoice();
  13283. virtual ~SynthesiserVoice();
  13284. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13285. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13286. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13287. virtual void startNote (const int midiNoteNumber,
  13288. const float velocity,
  13289. SynthesiserSound* sound,
  13290. const int currentPitchWheelPosition) = 0;
  13291. virtual void stopNote (const bool allowTailOff) = 0;
  13292. virtual void pitchWheelMoved (const int newValue) = 0;
  13293. virtual void controllerMoved (const int controllerNumber,
  13294. const int newValue) = 0;
  13295. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13296. int startSample,
  13297. int numSamples) = 0;
  13298. bool isPlayingChannel (int midiChannel) const;
  13299. void setCurrentPlaybackSampleRate (double newRate);
  13300. juce_UseDebuggingNewOperator
  13301. protected:
  13302. double getSampleRate() const { return currentSampleRate; }
  13303. void clearCurrentNote();
  13304. private:
  13305. friend class Synthesiser;
  13306. double currentSampleRate;
  13307. int currentlyPlayingNote;
  13308. uint32 noteOnTime;
  13309. SynthesiserSound::Ptr currentlyPlayingSound;
  13310. };
  13311. class JUCE_API Synthesiser
  13312. {
  13313. public:
  13314. Synthesiser();
  13315. virtual ~Synthesiser();
  13316. void clearVoices();
  13317. int getNumVoices() const { return voices.size(); }
  13318. SynthesiserVoice* getVoice (int index) const;
  13319. void addVoice (SynthesiserVoice* newVoice);
  13320. void removeVoice (int index);
  13321. void clearSounds();
  13322. int getNumSounds() const { return sounds.size(); }
  13323. SynthesiserSound* getSound (int index) const { return sounds [index]; }
  13324. void addSound (const SynthesiserSound::Ptr& newSound);
  13325. void removeSound (int index);
  13326. void setNoteStealingEnabled (bool shouldStealNotes);
  13327. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13328. virtual void noteOn (const int midiChannel,
  13329. const int midiNoteNumber,
  13330. const float velocity);
  13331. virtual void noteOff (const int midiChannel,
  13332. const int midiNoteNumber,
  13333. const bool allowTailOff);
  13334. virtual void allNotesOff (const int midiChannel,
  13335. const bool allowTailOff);
  13336. virtual void handlePitchWheel (const int midiChannel,
  13337. const int wheelValue);
  13338. virtual void handleController (const int midiChannel,
  13339. const int controllerNumber,
  13340. const int controllerValue);
  13341. void setCurrentPlaybackSampleRate (const double sampleRate);
  13342. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13343. const MidiBuffer& inputMidi,
  13344. int startSample,
  13345. int numSamples);
  13346. juce_UseDebuggingNewOperator
  13347. protected:
  13348. CriticalSection lock;
  13349. OwnedArray <SynthesiserVoice> voices;
  13350. ReferenceCountedArray <SynthesiserSound> sounds;
  13351. int lastPitchWheelValues [16];
  13352. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13353. const bool stealIfNoneAvailable) const;
  13354. void startVoice (SynthesiserVoice* voice,
  13355. SynthesiserSound* sound,
  13356. int midiChannel,
  13357. int midiNoteNumber,
  13358. float velocity);
  13359. int findFreeVoice (const bool) const { return 0; }
  13360. private:
  13361. double sampleRate;
  13362. uint32 lastNoteOnCounter;
  13363. bool shouldStealNotes;
  13364. Synthesiser (const Synthesiser&);
  13365. Synthesiser& operator= (const Synthesiser&);
  13366. };
  13367. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13368. /*** End of inlined file: juce_Synthesiser.h ***/
  13369. class JUCE_API SamplerSound : public SynthesiserSound
  13370. {
  13371. public:
  13372. SamplerSound (const String& name,
  13373. AudioFormatReader& source,
  13374. const BigInteger& midiNotes,
  13375. int midiNoteForNormalPitch,
  13376. double attackTimeSecs,
  13377. double releaseTimeSecs,
  13378. double maxSampleLengthSeconds);
  13379. ~SamplerSound();
  13380. const String& getName() const { return name; }
  13381. AudioSampleBuffer* getAudioData() const { return data; }
  13382. bool appliesToNote (const int midiNoteNumber);
  13383. bool appliesToChannel (const int midiChannel);
  13384. juce_UseDebuggingNewOperator
  13385. private:
  13386. friend class SamplerVoice;
  13387. String name;
  13388. ScopedPointer <AudioSampleBuffer> data;
  13389. double sourceSampleRate;
  13390. BigInteger midiNotes;
  13391. int length, attackSamples, releaseSamples;
  13392. int midiRootNote;
  13393. };
  13394. class JUCE_API SamplerVoice : public SynthesiserVoice
  13395. {
  13396. public:
  13397. SamplerVoice();
  13398. ~SamplerVoice();
  13399. bool canPlaySound (SynthesiserSound* sound);
  13400. void startNote (const int midiNoteNumber,
  13401. const float velocity,
  13402. SynthesiserSound* sound,
  13403. const int currentPitchWheelPosition);
  13404. void stopNote (const bool allowTailOff);
  13405. void pitchWheelMoved (const int newValue);
  13406. void controllerMoved (const int controllerNumber,
  13407. const int newValue);
  13408. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13409. juce_UseDebuggingNewOperator
  13410. private:
  13411. double pitchRatio;
  13412. double sourceSamplePosition;
  13413. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13414. bool isInAttack, isInRelease;
  13415. };
  13416. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13417. /*** End of inlined file: juce_Sampler.h ***/
  13418. #endif
  13419. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13420. #endif
  13421. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13422. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13423. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13424. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13425. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13426. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13427. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13428. class JUCE_API ActionListenerList : public MessageListener
  13429. {
  13430. public:
  13431. ActionListenerList() throw();
  13432. ~ActionListenerList() throw();
  13433. void addActionListener (ActionListener* listener) throw();
  13434. void removeActionListener (ActionListener* listener) throw();
  13435. void removeAllActionListeners() throw();
  13436. void sendActionMessage (const String& message) const;
  13437. void handleMessage (const Message&);
  13438. juce_UseDebuggingNewOperator
  13439. private:
  13440. SortedSet <void*> actionListeners_;
  13441. CriticalSection actionListenerLock_;
  13442. ActionListenerList (const ActionListenerList&);
  13443. ActionListenerList& operator= (const ActionListenerList&);
  13444. };
  13445. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13446. /*** End of inlined file: juce_ActionListenerList.h ***/
  13447. class JUCE_API ActionBroadcaster
  13448. {
  13449. public:
  13450. ActionBroadcaster() throw();
  13451. virtual ~ActionBroadcaster();
  13452. void addActionListener (ActionListener* listener);
  13453. void removeActionListener (ActionListener* listener);
  13454. void removeAllActionListeners();
  13455. void sendActionMessage (const String& message) const;
  13456. private:
  13457. ActionListenerList actionListenerList;
  13458. ActionBroadcaster (const ActionBroadcaster&);
  13459. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13460. };
  13461. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13462. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13463. #endif
  13464. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13465. #endif
  13466. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13467. #endif
  13468. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13469. #endif
  13470. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13471. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13472. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13473. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13474. class JUCE_API CallbackMessage : public Message
  13475. {
  13476. public:
  13477. CallbackMessage() throw();
  13478. ~CallbackMessage() throw();
  13479. virtual void messageCallback() = 0;
  13480. void post();
  13481. juce_UseDebuggingNewOperator
  13482. private:
  13483. CallbackMessage (const CallbackMessage&);
  13484. CallbackMessage& operator= (const CallbackMessage&);
  13485. };
  13486. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13487. /*** End of inlined file: juce_CallbackMessage.h ***/
  13488. #endif
  13489. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13490. #endif
  13491. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13492. #endif
  13493. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13494. #endif
  13495. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13496. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13497. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13498. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13499. class InterprocessConnectionServer;
  13500. class JUCE_API InterprocessConnection : public Thread,
  13501. private MessageListener
  13502. {
  13503. public:
  13504. InterprocessConnection (bool callbacksOnMessageThread = true,
  13505. uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13506. ~InterprocessConnection();
  13507. bool connectToSocket (const String& hostName,
  13508. int portNumber,
  13509. int timeOutMillisecs);
  13510. bool connectToPipe (const String& pipeName,
  13511. int pipeReceiveMessageTimeoutMs = -1);
  13512. bool createPipe (const String& pipeName,
  13513. int pipeReceiveMessageTimeoutMs = -1);
  13514. void disconnect();
  13515. bool isConnected() const;
  13516. StreamingSocket* getSocket() const throw() { return socket; }
  13517. NamedPipe* getPipe() const throw() { return pipe; }
  13518. const String getConnectedHostName() const;
  13519. bool sendMessage (const MemoryBlock& message);
  13520. virtual void connectionMade() = 0;
  13521. virtual void connectionLost() = 0;
  13522. virtual void messageReceived (const MemoryBlock& message) = 0;
  13523. juce_UseDebuggingNewOperator
  13524. private:
  13525. CriticalSection pipeAndSocketLock;
  13526. ScopedPointer <StreamingSocket> socket;
  13527. ScopedPointer <NamedPipe> pipe;
  13528. bool callbackConnectionState;
  13529. const bool useMessageThread;
  13530. const uint32 magicMessageHeader;
  13531. int pipeReceiveMessageTimeout;
  13532. friend class InterprocessConnectionServer;
  13533. void initialiseWithSocket (StreamingSocket* socket_);
  13534. void initialiseWithPipe (NamedPipe* pipe_);
  13535. void handleMessage (const Message& message);
  13536. void connectionMadeInt();
  13537. void connectionLostInt();
  13538. void deliverDataInt (const MemoryBlock& data);
  13539. bool readNextMessageInt();
  13540. void run();
  13541. InterprocessConnection (const InterprocessConnection&);
  13542. InterprocessConnection& operator= (const InterprocessConnection&);
  13543. };
  13544. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13545. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13546. #endif
  13547. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13548. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13549. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13550. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13551. class JUCE_API InterprocessConnectionServer : private Thread
  13552. {
  13553. public:
  13554. InterprocessConnectionServer();
  13555. ~InterprocessConnectionServer();
  13556. bool beginWaitingForSocket (int portNumber);
  13557. void stop();
  13558. protected:
  13559. virtual InterprocessConnection* createConnectionObject() = 0;
  13560. public:
  13561. juce_UseDebuggingNewOperator
  13562. private:
  13563. ScopedPointer <StreamingSocket> socket;
  13564. void run();
  13565. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13566. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13567. };
  13568. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13569. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13570. #endif
  13571. #ifndef __JUCE_LISTENERLIST_JUCEHEADER__
  13572. #endif
  13573. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13574. #endif
  13575. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13576. #endif
  13577. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13578. /*** Start of inlined file: juce_MessageManager.h ***/
  13579. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13580. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13581. class Component;
  13582. class MessageManagerLock;
  13583. typedef void* (MessageCallbackFunction) (void* userData);
  13584. class JUCE_API MessageManager
  13585. {
  13586. public:
  13587. static MessageManager* getInstance() throw();
  13588. void runDispatchLoop();
  13589. void stopDispatchLoop();
  13590. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13591. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13592. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13593. void* userData);
  13594. bool isThisTheMessageThread() const throw();
  13595. void setCurrentThreadAsMessageThread();
  13596. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13597. bool currentThreadHasLockedMessageManager() const throw();
  13598. static void broadcastMessage (const String& messageText) throw();
  13599. void registerBroadcastListener (ActionListener* listener) throw();
  13600. void deregisterBroadcastListener (ActionListener* listener) throw();
  13601. void deliverMessage (void*);
  13602. void deliverBroadcastMessage (const String&);
  13603. ~MessageManager() throw();
  13604. juce_UseDebuggingNewOperator
  13605. private:
  13606. MessageManager() throw();
  13607. friend class MessageListener;
  13608. friend class ChangeBroadcaster;
  13609. friend class ActionBroadcaster;
  13610. friend class CallbackMessage;
  13611. static MessageManager* instance;
  13612. SortedSet <const MessageListener*> messageListeners;
  13613. ScopedPointer <ActionListenerList> broadcastListeners;
  13614. friend class JUCEApplication;
  13615. bool quitMessagePosted, quitMessageReceived;
  13616. Thread::ThreadID messageThreadId;
  13617. VoidArray modalComponents;
  13618. static void* exitModalLoopCallback (void*);
  13619. void postMessageToQueue (Message* message);
  13620. void postCallbackMessage (Message* message);
  13621. static void doPlatformSpecificInitialisation();
  13622. static void doPlatformSpecificShutdown();
  13623. friend class MessageManagerLock;
  13624. Thread::ThreadID volatile threadWithLock;
  13625. CriticalSection lockingLock;
  13626. MessageManager (const MessageManager&);
  13627. MessageManager& operator= (const MessageManager&);
  13628. };
  13629. class JUCE_API MessageManagerLock
  13630. {
  13631. public:
  13632. MessageManagerLock (Thread* threadToCheckForExitSignal = 0) throw();
  13633. MessageManagerLock (ThreadPoolJob* jobToCheckForExitSignal) throw();
  13634. ~MessageManagerLock() throw();
  13635. bool lockWasGained() const throw() { return locked; }
  13636. private:
  13637. class SharedEvents;
  13638. class BlockingMessage;
  13639. friend class SharedEvents;
  13640. friend class BlockingMessage;
  13641. SharedEvents* sharedEvents;
  13642. bool locked;
  13643. void init (Thread* thread, ThreadPoolJob* job) throw();
  13644. MessageManagerLock (const MessageManagerLock&);
  13645. MessageManagerLock& operator= (const MessageManagerLock&);
  13646. };
  13647. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13648. /*** End of inlined file: juce_MessageManager.h ***/
  13649. #endif
  13650. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13651. /*** Start of inlined file: juce_MultiTimer.h ***/
  13652. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13653. #define __JUCE_MULTITIMER_JUCEHEADER__
  13654. class JUCE_API MultiTimer
  13655. {
  13656. protected:
  13657. MultiTimer() throw();
  13658. MultiTimer (const MultiTimer& other) throw();
  13659. public:
  13660. virtual ~MultiTimer();
  13661. virtual void timerCallback (int timerId) = 0;
  13662. void startTimer (int timerId, int intervalInMilliseconds) throw();
  13663. void stopTimer (int timerId) throw();
  13664. bool isTimerRunning (int timerId) const throw();
  13665. int getTimerInterval (int timerId) const throw();
  13666. private:
  13667. class MultiTimerCallback;
  13668. CriticalSection timerListLock;
  13669. OwnedArray <MultiTimerCallback> timers;
  13670. MultiTimer& operator= (const MultiTimer&);
  13671. };
  13672. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13673. /*** End of inlined file: juce_MultiTimer.h ***/
  13674. #endif
  13675. #ifndef __JUCE_TIMER_JUCEHEADER__
  13676. #endif
  13677. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13678. /*** Start of inlined file: juce_ArrowButton.h ***/
  13679. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13680. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13681. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13682. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13683. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13684. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13685. {
  13686. public:
  13687. DropShadowEffect();
  13688. ~DropShadowEffect();
  13689. void setShadowProperties (const float newRadius,
  13690. const float newOpacity,
  13691. const int newShadowOffsetX,
  13692. const int newShadowOffsetY);
  13693. void applyEffect (Image& sourceImage, Graphics& destContext);
  13694. juce_UseDebuggingNewOperator
  13695. private:
  13696. int offsetX, offsetY;
  13697. float radius, opacity;
  13698. };
  13699. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13700. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13701. class JUCE_API ArrowButton : public Button
  13702. {
  13703. public:
  13704. ArrowButton (const String& buttonName,
  13705. float arrowDirection,
  13706. const Colour& arrowColour);
  13707. ~ArrowButton();
  13708. juce_UseDebuggingNewOperator
  13709. protected:
  13710. void paintButton (Graphics& g,
  13711. bool isMouseOverButton,
  13712. bool isButtonDown);
  13713. void buttonStateChanged();
  13714. private:
  13715. Colour colour;
  13716. DropShadowEffect shadow;
  13717. Path path;
  13718. int offset;
  13719. ArrowButton (const ArrowButton&);
  13720. ArrowButton& operator= (const ArrowButton&);
  13721. };
  13722. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13723. /*** End of inlined file: juce_ArrowButton.h ***/
  13724. #endif
  13725. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13726. #endif
  13727. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13728. /*** Start of inlined file: juce_DrawableButton.h ***/
  13729. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13730. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13731. /*** Start of inlined file: juce_Drawable.h ***/
  13732. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13733. #define __JUCE_DRAWABLE_JUCEHEADER__
  13734. class JUCE_API Drawable
  13735. {
  13736. protected:
  13737. Drawable();
  13738. public:
  13739. virtual ~Drawable();
  13740. virtual Drawable* createCopy() const = 0;
  13741. void draw (Graphics& g, float opacity,
  13742. const AffineTransform& transform = AffineTransform::identity) const;
  13743. void drawAt (Graphics& g,
  13744. float x, float y,
  13745. float opacity) const;
  13746. void drawWithin (Graphics& g,
  13747. int destX,
  13748. int destY,
  13749. int destWidth,
  13750. int destHeight,
  13751. const RectanglePlacement& placement,
  13752. float opacity) const;
  13753. class RenderingContext
  13754. {
  13755. public:
  13756. RenderingContext (Graphics& g, const AffineTransform& transform, float opacity) throw();
  13757. Graphics& g;
  13758. AffineTransform transform;
  13759. float opacity;
  13760. private:
  13761. RenderingContext& operator= (const RenderingContext&);
  13762. };
  13763. virtual void render (const RenderingContext& context) const = 0;
  13764. virtual const Rectangle<float> getBounds() const = 0;
  13765. virtual bool hitTest (float x, float y) const = 0;
  13766. const String& getName() const throw() { return name; }
  13767. void setName (const String& newName) throw() { name = newName; }
  13768. static Drawable* createFromImageData (const void* data, size_t numBytes);
  13769. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13770. static Drawable* createFromImageFile (const File& file);
  13771. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13772. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13773. virtual ValueTree createValueTree() const throw() = 0;
  13774. juce_UseDebuggingNewOperator
  13775. private:
  13776. Drawable (const Drawable&);
  13777. Drawable& operator= (const Drawable&);
  13778. String name;
  13779. };
  13780. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13781. /*** End of inlined file: juce_Drawable.h ***/
  13782. class JUCE_API DrawableButton : public Button
  13783. {
  13784. public:
  13785. enum ButtonStyle
  13786. {
  13787. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13788. ImageRaw, /**< The button will just display the images in their normal size and position.
  13789. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13790. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13791. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13792. };
  13793. DrawableButton (const String& buttonName,
  13794. ButtonStyle buttonStyle);
  13795. ~DrawableButton();
  13796. void setImages (const Drawable* normalImage,
  13797. const Drawable* overImage = 0,
  13798. const Drawable* downImage = 0,
  13799. const Drawable* disabledImage = 0,
  13800. const Drawable* normalImageOn = 0,
  13801. const Drawable* overImageOn = 0,
  13802. const Drawable* downImageOn = 0,
  13803. const Drawable* disabledImageOn = 0);
  13804. void setButtonStyle (ButtonStyle newStyle);
  13805. void setBackgroundColours (const Colour& toggledOffColour,
  13806. const Colour& toggledOnColour);
  13807. const Colour& getBackgroundColour() const throw();
  13808. void setEdgeIndent (int numPixelsIndent);
  13809. const Drawable* getCurrentImage() const throw();
  13810. const Drawable* getNormalImage() const throw();
  13811. const Drawable* getOverImage() const throw();
  13812. const Drawable* getDownImage() const throw();
  13813. juce_UseDebuggingNewOperator
  13814. protected:
  13815. void paintButton (Graphics& g,
  13816. bool isMouseOverButton,
  13817. bool isButtonDown);
  13818. private:
  13819. ButtonStyle style;
  13820. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13821. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13822. Colour backgroundOff, backgroundOn;
  13823. int edgeIndent;
  13824. void deleteImages();
  13825. DrawableButton (const DrawableButton&);
  13826. DrawableButton& operator= (const DrawableButton&);
  13827. };
  13828. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13829. /*** End of inlined file: juce_DrawableButton.h ***/
  13830. #endif
  13831. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13832. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13833. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13834. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13835. class JUCE_API HyperlinkButton : public Button
  13836. {
  13837. public:
  13838. HyperlinkButton (const String& linkText,
  13839. const URL& linkURL);
  13840. ~HyperlinkButton();
  13841. void setFont (const Font& newFont,
  13842. bool resizeToMatchComponentHeight,
  13843. const Justification& justificationType = Justification::horizontallyCentred);
  13844. enum ColourIds
  13845. {
  13846. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13847. };
  13848. void setURL (const URL& newURL) throw();
  13849. const URL& getURL() const throw() { return url; }
  13850. void changeWidthToFitText();
  13851. juce_UseDebuggingNewOperator
  13852. protected:
  13853. void clicked();
  13854. void colourChanged();
  13855. void paintButton (Graphics& g,
  13856. bool isMouseOverButton,
  13857. bool isButtonDown);
  13858. private:
  13859. URL url;
  13860. Font font;
  13861. bool resizeFont;
  13862. Justification justification;
  13863. const Font getFontToUse() const;
  13864. HyperlinkButton (const HyperlinkButton&);
  13865. HyperlinkButton& operator= (const HyperlinkButton&);
  13866. };
  13867. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13868. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13869. #endif
  13870. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13871. /*** Start of inlined file: juce_ImageButton.h ***/
  13872. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13873. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13874. class JUCE_API ImageButton : public Button
  13875. {
  13876. public:
  13877. explicit ImageButton (const String& name);
  13878. ~ImageButton();
  13879. void setImages (bool resizeButtonNowToFitThisImage,
  13880. bool rescaleImagesWhenButtonSizeChanges,
  13881. bool preserveImageProportions,
  13882. Image* normalImage,
  13883. float imageOpacityWhenNormal,
  13884. const Colour& overlayColourWhenNormal,
  13885. Image* overImage,
  13886. float imageOpacityWhenOver,
  13887. const Colour& overlayColourWhenOver,
  13888. Image* downImage,
  13889. float imageOpacityWhenDown,
  13890. const Colour& overlayColourWhenDown,
  13891. float hitTestAlphaThreshold = 0.0f);
  13892. Image* getNormalImage() const throw();
  13893. Image* getOverImage() const throw();
  13894. Image* getDownImage() const throw();
  13895. juce_UseDebuggingNewOperator
  13896. protected:
  13897. bool hitTest (int x, int y);
  13898. void paintButton (Graphics& g,
  13899. bool isMouseOverButton,
  13900. bool isButtonDown);
  13901. private:
  13902. bool scaleImageToFit, preserveProportions;
  13903. unsigned char alphaThreshold;
  13904. int imageX, imageY, imageW, imageH;
  13905. Image* normalImage;
  13906. Image* overImage;
  13907. Image* downImage;
  13908. float normalOpacity, overOpacity, downOpacity;
  13909. Colour normalOverlay, overOverlay, downOverlay;
  13910. Image* getCurrentImage() const;
  13911. void deleteImages();
  13912. ImageButton (const ImageButton&);
  13913. ImageButton& operator= (const ImageButton&);
  13914. };
  13915. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13916. /*** End of inlined file: juce_ImageButton.h ***/
  13917. #endif
  13918. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13919. /*** Start of inlined file: juce_ShapeButton.h ***/
  13920. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13921. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13922. class JUCE_API ShapeButton : public Button
  13923. {
  13924. public:
  13925. ShapeButton (const String& name,
  13926. const Colour& normalColour,
  13927. const Colour& overColour,
  13928. const Colour& downColour);
  13929. ~ShapeButton();
  13930. void setShape (const Path& newShape,
  13931. bool resizeNowToFitThisShape,
  13932. bool maintainShapeProportions,
  13933. bool hasDropShadow);
  13934. void setColours (const Colour& normalColour,
  13935. const Colour& overColour,
  13936. const Colour& downColour);
  13937. void setOutline (const Colour& outlineColour,
  13938. float outlineStrokeWidth);
  13939. juce_UseDebuggingNewOperator
  13940. protected:
  13941. void paintButton (Graphics& g,
  13942. bool isMouseOverButton,
  13943. bool isButtonDown);
  13944. private:
  13945. Colour normalColour, overColour, downColour, outlineColour;
  13946. DropShadowEffect shadow;
  13947. Path shape;
  13948. bool maintainShapeProportions;
  13949. float outlineWidth;
  13950. ShapeButton (const ShapeButton&);
  13951. ShapeButton& operator= (const ShapeButton&);
  13952. };
  13953. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13954. /*** End of inlined file: juce_ShapeButton.h ***/
  13955. #endif
  13956. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13957. #endif
  13958. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13959. /*** Start of inlined file: juce_ToggleButton.h ***/
  13960. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13961. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13962. class JUCE_API ToggleButton : public Button
  13963. {
  13964. public:
  13965. ToggleButton (const String& buttonText);
  13966. ~ToggleButton();
  13967. void changeWidthToFitText();
  13968. enum ColourIds
  13969. {
  13970. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13971. };
  13972. juce_UseDebuggingNewOperator
  13973. protected:
  13974. void paintButton (Graphics& g,
  13975. bool isMouseOverButton,
  13976. bool isButtonDown);
  13977. void colourChanged();
  13978. private:
  13979. ToggleButton (const ToggleButton&);
  13980. ToggleButton& operator= (const ToggleButton&);
  13981. };
  13982. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13983. /*** End of inlined file: juce_ToggleButton.h ***/
  13984. #endif
  13985. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13986. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13987. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13988. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13989. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13990. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13991. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13992. /*** Start of inlined file: juce_Toolbar.h ***/
  13993. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13994. #define __JUCE_TOOLBAR_JUCEHEADER__
  13995. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13996. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13997. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13998. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13999. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14000. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14001. class JUCE_API DragAndDropTarget
  14002. {
  14003. public:
  14004. virtual ~DragAndDropTarget() {}
  14005. virtual bool isInterestedInDragSource (const String& sourceDescription,
  14006. Component* sourceComponent) = 0;
  14007. virtual void itemDragEnter (const String& sourceDescription,
  14008. Component* sourceComponent,
  14009. int x, int y);
  14010. virtual void itemDragMove (const String& sourceDescription,
  14011. Component* sourceComponent,
  14012. int x, int y);
  14013. virtual void itemDragExit (const String& sourceDescription,
  14014. Component* sourceComponent);
  14015. virtual void itemDropped (const String& sourceDescription,
  14016. Component* sourceComponent,
  14017. int x, int y) = 0;
  14018. virtual bool shouldDrawDragImageWhenOver();
  14019. };
  14020. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  14021. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  14022. class JUCE_API DragAndDropContainer
  14023. {
  14024. public:
  14025. DragAndDropContainer();
  14026. virtual ~DragAndDropContainer();
  14027. void startDragging (const String& sourceDescription,
  14028. Component* sourceComponent,
  14029. Image* dragImage = 0,
  14030. bool allowDraggingToOtherJuceWindows = false,
  14031. const Point<int>* imageOffsetFromMouse = 0);
  14032. bool isDragAndDropActive() const;
  14033. const String getCurrentDragDescription() const;
  14034. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  14035. static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles);
  14036. static bool performExternalDragDropOfText (const String& text);
  14037. juce_UseDebuggingNewOperator
  14038. protected:
  14039. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  14040. Component* dragSourceComponent,
  14041. StringArray& files,
  14042. bool& canMoveFiles);
  14043. private:
  14044. friend class DragImageComponent;
  14045. ScopedPointer <Component> dragImageComponent;
  14046. String currentDragDesc;
  14047. };
  14048. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  14049. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  14050. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  14051. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14052. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14053. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  14054. private Timer
  14055. {
  14056. public:
  14057. ComponentAnimator();
  14058. ~ComponentAnimator();
  14059. void animateComponent (Component* component,
  14060. const Rectangle<int>& finalPosition,
  14061. int millisecondsToSpendMoving,
  14062. double startSpeed = 1.0,
  14063. double endSpeed = 1.0);
  14064. void cancelAnimation (Component* component,
  14065. bool moveComponentToItsFinalPosition);
  14066. void cancelAllAnimations (bool moveComponentsToTheirFinalPositions);
  14067. const Rectangle<int> getComponentDestination (Component* component);
  14068. bool isAnimating (Component* component) const;
  14069. juce_UseDebuggingNewOperator
  14070. private:
  14071. class AnimationTask;
  14072. Array <AnimationTask*> tasks;
  14073. uint32 lastTime;
  14074. AnimationTask* findTaskFor (Component* component) const;
  14075. void timerCallback();
  14076. };
  14077. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  14078. /*** End of inlined file: juce_ComponentAnimator.h ***/
  14079. class ToolbarItemComponent;
  14080. class ToolbarItemFactory;
  14081. class MissingItemsComponent;
  14082. class JUCE_API Toolbar : public Component,
  14083. public DragAndDropContainer,
  14084. public DragAndDropTarget,
  14085. private ButtonListener
  14086. {
  14087. public:
  14088. Toolbar();
  14089. ~Toolbar();
  14090. void setVertical (bool shouldBeVertical);
  14091. bool isVertical() const throw() { return vertical; }
  14092. int getThickness() const throw();
  14093. int getLength() const throw();
  14094. void clear();
  14095. void addItem (ToolbarItemFactory& factory,
  14096. int itemId,
  14097. int insertIndex = -1);
  14098. void removeToolbarItem (int itemIndex);
  14099. int getNumItems() const throw();
  14100. int getItemId (int itemIndex) const throw();
  14101. ToolbarItemComponent* getItemComponent (int itemIndex) const throw();
  14102. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  14103. enum ToolbarItemStyle
  14104. {
  14105. iconsOnly, /**< Means that the toolbar should just contain icons. */
  14106. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  14107. textOnly /**< Means that the toolbar only display text labels for each item. */
  14108. };
  14109. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14110. void setStyle (const ToolbarItemStyle& newStyle);
  14111. enum CustomisationFlags
  14112. {
  14113. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  14114. show the "icons only" option on its choice of toolbar styles. */
  14115. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  14116. show the "icons with text" option on its choice of toolbar styles. */
  14117. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  14118. show the "text only" option on its choice of toolbar styles. */
  14119. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  14120. show a button to reset the toolbar to its default set of items. */
  14121. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  14122. };
  14123. void showCustomisationDialog (ToolbarItemFactory& factory,
  14124. int optionFlags = allCustomisationOptionsEnabled);
  14125. void setEditingActive (bool editingEnabled);
  14126. enum ColourIds
  14127. {
  14128. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  14129. more control over this, override LookAndFeel::paintToolbarBackground(). */
  14130. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  14131. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  14132. over them. */
  14133. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  14134. held down on them. */
  14135. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  14136. when the style is set to iconsWithText or textOnly. */
  14137. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14138. the customisation dialog is active and the mouse moves over them. */
  14139. };
  14140. const String toString() const;
  14141. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14142. const String& savedVersion);
  14143. void paint (Graphics& g);
  14144. void resized();
  14145. void buttonClicked (Button*);
  14146. void mouseDown (const MouseEvent&);
  14147. bool isInterestedInDragSource (const String&, Component*);
  14148. void itemDragMove (const String&, Component*, int, int);
  14149. void itemDragExit (const String&, Component*);
  14150. void itemDropped (const String&, Component*, int, int);
  14151. void updateAllItemPositions (const bool animate);
  14152. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14153. juce_UseDebuggingNewOperator
  14154. private:
  14155. Button* missingItemsButton;
  14156. bool vertical, isEditingActive;
  14157. ToolbarItemStyle toolbarStyle;
  14158. ComponentAnimator animator;
  14159. friend class MissingItemsComponent;
  14160. Array <ToolbarItemComponent*> items;
  14161. friend class ItemDragAndDropOverlayComponent;
  14162. static const char* const toolbarDragDescriptor;
  14163. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14164. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14165. Toolbar (const Toolbar&);
  14166. Toolbar& operator= (const Toolbar&);
  14167. };
  14168. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14169. /*** End of inlined file: juce_Toolbar.h ***/
  14170. class ItemDragAndDropOverlayComponent;
  14171. class JUCE_API ToolbarItemComponent : public Button
  14172. {
  14173. public:
  14174. ToolbarItemComponent (int itemId,
  14175. const String& labelText,
  14176. bool isBeingUsedAsAButton);
  14177. ~ToolbarItemComponent();
  14178. int getItemId() const throw() { return itemId; }
  14179. Toolbar* getToolbar() const;
  14180. bool isToolbarVertical() const;
  14181. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14182. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14183. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14184. virtual bool getToolbarItemSizes (int toolbarThickness,
  14185. bool isToolbarVertical,
  14186. int& preferredSize,
  14187. int& minSize,
  14188. int& maxSize) = 0;
  14189. virtual void paintButtonArea (Graphics& g,
  14190. int width, int height,
  14191. bool isMouseOver, bool isMouseDown) = 0;
  14192. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14193. enum ToolbarEditingMode
  14194. {
  14195. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14196. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14197. customisation mode, and the items can be dragged around. */
  14198. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14199. dragged onto a toolbar to add it to that bar.*/
  14200. };
  14201. void setEditingMode (const ToolbarEditingMode newMode);
  14202. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14203. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14204. void resized();
  14205. juce_UseDebuggingNewOperator
  14206. private:
  14207. friend class Toolbar;
  14208. friend class ItemDragAndDropOverlayComponent;
  14209. const int itemId;
  14210. ToolbarEditingMode mode;
  14211. Toolbar::ToolbarItemStyle toolbarStyle;
  14212. ScopedPointer <Component> overlayComp;
  14213. int dragOffsetX, dragOffsetY;
  14214. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14215. Rectangle<int> contentArea;
  14216. ToolbarItemComponent (const ToolbarItemComponent&);
  14217. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14218. };
  14219. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14220. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14221. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14222. {
  14223. public:
  14224. ToolbarButton (int itemId,
  14225. const String& labelText,
  14226. Drawable* normalImage,
  14227. Drawable* toggledOnImage);
  14228. ~ToolbarButton();
  14229. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14230. int& minSize, int& maxSize);
  14231. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14232. void contentAreaChanged (const Rectangle<int>& newBounds);
  14233. juce_UseDebuggingNewOperator
  14234. private:
  14235. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14236. ToolbarButton (const ToolbarButton&);
  14237. ToolbarButton& operator= (const ToolbarButton&);
  14238. };
  14239. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14240. /*** End of inlined file: juce_ToolbarButton.h ***/
  14241. #endif
  14242. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14243. /*** Start of inlined file: juce_CodeDocument.h ***/
  14244. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14245. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14246. class CodeDocumentLine;
  14247. class JUCE_API CodeDocument
  14248. {
  14249. public:
  14250. CodeDocument();
  14251. ~CodeDocument();
  14252. class JUCE_API Position
  14253. {
  14254. public:
  14255. Position() throw();
  14256. Position (const CodeDocument* ownerDocument,
  14257. int line, int indexInLine) throw();
  14258. Position (const CodeDocument* ownerDocument,
  14259. int charactersFromStartOfDocument) throw();
  14260. Position (const Position& other) throw();
  14261. ~Position() throw();
  14262. Position& operator= (const Position& other) throw();
  14263. bool operator== (const Position& other) const throw();
  14264. bool operator!= (const Position& other) const throw();
  14265. void setPosition (int charactersFromStartOfDocument) throw();
  14266. int getPosition() const throw() { return characterPos; }
  14267. void setLineAndIndex (int newLine, int newIndexInLine) throw();
  14268. int getLineNumber() const throw() { return line; }
  14269. int getIndexInLine() const throw() { return indexInLine; }
  14270. void setPositionMaintained (bool isMaintained) throw();
  14271. void moveBy (int characterDelta) throw();
  14272. const Position movedBy (int characterDelta) const throw();
  14273. const Position movedByLines (int deltaLines) const throw();
  14274. const juce_wchar getCharacter() const throw();
  14275. const String getLineText() const throw();
  14276. private:
  14277. CodeDocument* owner;
  14278. int characterPos, line, indexInLine;
  14279. bool positionMaintained;
  14280. };
  14281. const String getAllContent() const throw();
  14282. const String getTextBetween (const Position& start, const Position& end) const throw();
  14283. const String getLine (int lineIndex) const throw();
  14284. int getNumCharacters() const throw();
  14285. int getNumLines() const throw() { return lines.size(); }
  14286. int getMaximumLineLength() throw();
  14287. void deleteSection (const Position& startPosition, const Position& endPosition);
  14288. void insertText (const Position& position, const String& text);
  14289. void replaceAllContent (const String& newContent);
  14290. bool loadFromStream (InputStream& stream);
  14291. bool writeToStream (OutputStream& stream);
  14292. const String getNewLineCharacters() const throw() { return newLineChars; }
  14293. void setNewLineCharacters (const String& newLine) throw();
  14294. void newTransaction();
  14295. void undo();
  14296. void redo();
  14297. void clearUndoHistory();
  14298. UndoManager& getUndoManager() throw() { return undoManager; }
  14299. void setSavePoint() throw();
  14300. bool hasChangedSinceSavePoint() const throw();
  14301. const Position findWordBreakAfter (const Position& position) const throw();
  14302. const Position findWordBreakBefore (const Position& position) const throw();
  14303. class JUCE_API Listener
  14304. {
  14305. public:
  14306. Listener() {}
  14307. virtual ~Listener() {}
  14308. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14309. const Position& affectedTextEnd) = 0;
  14310. };
  14311. void addListener (Listener* listener) throw();
  14312. void removeListener (Listener* listener) throw();
  14313. class Iterator
  14314. {
  14315. public:
  14316. Iterator (CodeDocument* document);
  14317. Iterator (const Iterator& other);
  14318. Iterator& operator= (const Iterator& other) throw();
  14319. ~Iterator() throw();
  14320. juce_wchar nextChar();
  14321. juce_wchar peekNextChar() const;
  14322. void skip();
  14323. int getPosition() const throw() { return position; }
  14324. void skipWhitespace();
  14325. void skipToEndOfLine();
  14326. int getLine() const throw() { return line; }
  14327. bool isEOF() const throw();
  14328. private:
  14329. CodeDocument* document;
  14330. CodeDocumentLine* currentLine;
  14331. int line, position;
  14332. };
  14333. juce_UseDebuggingNewOperator
  14334. private:
  14335. friend class CodeDocumentInsertAction;
  14336. friend class CodeDocumentDeleteAction;
  14337. friend class Iterator;
  14338. friend class Position;
  14339. OwnedArray <CodeDocumentLine> lines;
  14340. Array <Position*> positionsToMaintain;
  14341. UndoManager undoManager;
  14342. int currentActionIndex, indexOfSavedState;
  14343. int maximumLineLength;
  14344. ListenerList <Listener> listeners;
  14345. String newLineChars;
  14346. void sendListenerChangeMessage (int startLine, int endLine);
  14347. void insert (const String& text, int insertPos, bool undoable);
  14348. void remove (int startPos, int endPos, bool undoable);
  14349. void checkLastLineStatus();
  14350. CodeDocument (const CodeDocument&);
  14351. CodeDocument& operator= (const CodeDocument&);
  14352. };
  14353. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14354. /*** End of inlined file: juce_CodeDocument.h ***/
  14355. #endif
  14356. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14357. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14358. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14359. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14360. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14361. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14362. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14363. class JUCE_API CodeTokeniser
  14364. {
  14365. public:
  14366. CodeTokeniser() {}
  14367. virtual ~CodeTokeniser() {}
  14368. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14369. virtual const StringArray getTokenTypes() = 0;
  14370. virtual const Colour getDefaultColour (int tokenType) = 0;
  14371. juce_UseDebuggingNewOperator
  14372. };
  14373. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14374. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14375. class JUCE_API CodeEditorComponent : public Component,
  14376. public TextInputTarget,
  14377. public Timer,
  14378. public ScrollBarListener,
  14379. public CodeDocument::Listener,
  14380. public AsyncUpdater
  14381. {
  14382. public:
  14383. CodeEditorComponent (CodeDocument& document,
  14384. CodeTokeniser* codeTokeniser);
  14385. ~CodeEditorComponent();
  14386. CodeDocument& getDocument() const throw() { return document; }
  14387. void loadContent (const String& newContent);
  14388. float getCharWidth() const throw() { return charWidth; }
  14389. int getLineHeight() const throw() { return lineHeight; }
  14390. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14391. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14392. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14393. void moveCaretTo (const CodeDocument::Position& newPos, bool selecting);
  14394. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14395. const CodeDocument::Position getPositionAt (int x, int y);
  14396. void cursorLeft (bool moveInWholeWordSteps, bool selecting);
  14397. void cursorRight (bool moveInWholeWordSteps, bool selecting);
  14398. void cursorDown (bool selecting);
  14399. void cursorUp (bool selecting);
  14400. void pageDown (bool selecting);
  14401. void pageUp (bool selecting);
  14402. void scrollDown();
  14403. void scrollUp();
  14404. void scrollToLine (int newFirstLineOnScreen);
  14405. void scrollBy (int deltaLines);
  14406. void scrollToColumn (int newFirstColumnOnScreen);
  14407. void scrollToKeepCaretOnScreen();
  14408. void goToStartOfDocument (bool selecting);
  14409. void goToStartOfLine (bool selecting);
  14410. void goToEndOfDocument (bool selecting);
  14411. void goToEndOfLine (bool selecting);
  14412. void deselectAll();
  14413. void selectAll();
  14414. void insertTextAtCaret (const String& textToInsert);
  14415. void insertTabAtCaret();
  14416. void cut();
  14417. void copy();
  14418. void copyThenCut();
  14419. void paste();
  14420. void backspace (bool moveInWholeWordSteps);
  14421. void deleteForward (bool moveInWholeWordSteps);
  14422. void undo();
  14423. void redo();
  14424. const Range<int> getHighlightedRegion() const;
  14425. void setHighlightedRegion (const Range<int>& newRange);
  14426. const String getTextInRange (const Range<int>& range) const;
  14427. void setTabSize (int numSpacesPerTab,
  14428. bool insertSpacesInsteadOfTabCharacters) throw();
  14429. int getTabSize() const throw() { return spacesPerTab; }
  14430. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14431. void setFont (const Font& newFont);
  14432. void resetToDefaultColours();
  14433. void setColourForTokenType (int tokenType, const Colour& colour);
  14434. const Colour getColourForTokenType (int tokenType) const throw();
  14435. enum ColourIds
  14436. {
  14437. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14438. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14439. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14440. selected text. */
  14441. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14442. enabled. */
  14443. };
  14444. void setScrollbarThickness (int thickness) throw();
  14445. void resized();
  14446. void paint (Graphics& g);
  14447. bool keyPressed (const KeyPress& key);
  14448. void mouseDown (const MouseEvent& e);
  14449. void mouseDrag (const MouseEvent& e);
  14450. void mouseUp (const MouseEvent& e);
  14451. void mouseDoubleClick (const MouseEvent& e);
  14452. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14453. void timerCallback();
  14454. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
  14455. void handleAsyncUpdate();
  14456. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14457. const CodeDocument::Position& affectedTextEnd);
  14458. juce_UseDebuggingNewOperator
  14459. private:
  14460. CodeDocument& document;
  14461. Font font;
  14462. int firstLineOnScreen, gutter, spacesPerTab;
  14463. float charWidth;
  14464. int lineHeight, linesOnScreen, columnsOnScreen;
  14465. int scrollbarThickness, columnToTryToMaintain;
  14466. bool useSpacesForTabs;
  14467. double xOffset;
  14468. CodeDocument::Position caretPos;
  14469. CodeDocument::Position selectionStart, selectionEnd;
  14470. class CaretComponent;
  14471. CaretComponent* caret;
  14472. ScrollBar* verticalScrollBar;
  14473. ScrollBar* horizontalScrollBar;
  14474. enum DragType
  14475. {
  14476. notDragging,
  14477. draggingSelectionStart,
  14478. draggingSelectionEnd
  14479. };
  14480. DragType dragType;
  14481. CodeTokeniser* codeTokeniser;
  14482. Array <Colour> coloursForTokenCategories;
  14483. class CodeEditorLine;
  14484. OwnedArray <CodeEditorLine> lines;
  14485. void rebuildLineTokens();
  14486. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14487. void clearCachedIterators (int firstLineToBeInvalid) throw();
  14488. void updateCachedIterators (int maxLineNum);
  14489. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14490. void moveLineDelta (int delta, bool selecting);
  14491. void updateScrollBars();
  14492. void scrollToLineInternal (int line);
  14493. void scrollToColumnInternal (double column);
  14494. void newTransaction();
  14495. int indexToColumn (int line, int index) const throw();
  14496. int columnToIndex (int line, int column) const throw();
  14497. CodeEditorComponent (const CodeEditorComponent&);
  14498. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14499. };
  14500. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14501. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14502. #endif
  14503. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14504. #endif
  14505. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14506. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14507. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14508. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14509. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14510. {
  14511. public:
  14512. CPlusPlusCodeTokeniser();
  14513. ~CPlusPlusCodeTokeniser();
  14514. enum TokenType
  14515. {
  14516. tokenType_error = 0,
  14517. tokenType_comment,
  14518. tokenType_builtInKeyword,
  14519. tokenType_identifier,
  14520. tokenType_integerLiteral,
  14521. tokenType_floatLiteral,
  14522. tokenType_stringLiteral,
  14523. tokenType_operator,
  14524. tokenType_bracket,
  14525. tokenType_punctuation,
  14526. tokenType_preprocessor
  14527. };
  14528. int readNextToken (CodeDocument::Iterator& source);
  14529. const StringArray getTokenTypes();
  14530. const Colour getDefaultColour (int tokenType);
  14531. juce_UseDebuggingNewOperator
  14532. };
  14533. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14534. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14535. #endif
  14536. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14537. #endif
  14538. #ifndef __JUCE_LABEL_JUCEHEADER__
  14539. #endif
  14540. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14541. #endif
  14542. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14543. /*** Start of inlined file: juce_ProgressBar.h ***/
  14544. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14545. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14546. class JUCE_API ProgressBar : public Component,
  14547. public SettableTooltipClient,
  14548. private Timer
  14549. {
  14550. public:
  14551. explicit ProgressBar (double& progress);
  14552. ~ProgressBar();
  14553. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14554. void setTextToDisplay (const String& text);
  14555. enum ColourIds
  14556. {
  14557. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14558. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14559. classes will probably use variations on this colour. */
  14560. };
  14561. juce_UseDebuggingNewOperator
  14562. protected:
  14563. void paint (Graphics& g);
  14564. void lookAndFeelChanged();
  14565. void visibilityChanged();
  14566. void colourChanged();
  14567. private:
  14568. double& progress;
  14569. double currentValue;
  14570. bool displayPercentage;
  14571. String displayedMessage, currentMessage;
  14572. uint32 lastCallbackTime;
  14573. void timerCallback();
  14574. ProgressBar (const ProgressBar&);
  14575. ProgressBar& operator= (const ProgressBar&);
  14576. };
  14577. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14578. /*** End of inlined file: juce_ProgressBar.h ***/
  14579. #endif
  14580. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14581. /*** Start of inlined file: juce_Slider.h ***/
  14582. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14583. #define __JUCE_SLIDER_JUCEHEADER__
  14584. /*** Start of inlined file: juce_SliderListener.h ***/
  14585. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14586. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14587. class Slider;
  14588. class JUCE_API SliderListener
  14589. {
  14590. public:
  14591. virtual ~SliderListener() {}
  14592. virtual void sliderValueChanged (Slider* slider) = 0;
  14593. virtual void sliderDragStarted (Slider* slider);
  14594. virtual void sliderDragEnded (Slider* slider);
  14595. };
  14596. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14597. /*** End of inlined file: juce_SliderListener.h ***/
  14598. class JUCE_API Slider : public Component,
  14599. public SettableTooltipClient,
  14600. private AsyncUpdater,
  14601. private ButtonListener,
  14602. private LabelListener,
  14603. private Value::Listener
  14604. {
  14605. public:
  14606. explicit Slider (const String& componentName);
  14607. ~Slider();
  14608. enum SliderStyle
  14609. {
  14610. LinearHorizontal, /**< A traditional horizontal slider. */
  14611. LinearVertical, /**< A traditional vertical slider. */
  14612. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14613. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14614. @see setRotaryParameters */
  14615. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14616. @see setRotaryParameters */
  14617. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14618. @see setRotaryParameters */
  14619. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14620. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14621. @see setMinValue, setMaxValue */
  14622. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14623. @see setMinValue, setMaxValue */
  14624. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14625. value, with the current value being somewhere between them.
  14626. @see setMinValue, setMaxValue */
  14627. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14628. value, with the current value being somewhere between them.
  14629. @see setMinValue, setMaxValue */
  14630. };
  14631. void setSliderStyle (SliderStyle newStyle);
  14632. SliderStyle getSliderStyle() const { return style; }
  14633. void setRotaryParameters (float startAngleRadians,
  14634. float endAngleRadians,
  14635. bool stopAtEnd);
  14636. void setMouseDragSensitivity (int distanceForFullScaleDrag);
  14637. void setVelocityBasedMode (bool isVelocityBased);
  14638. bool getVelocityBasedMode() const { return isVelocityBased; }
  14639. void setVelocityModeParameters (double sensitivity = 1.0,
  14640. int threshold = 1,
  14641. double offset = 0.0,
  14642. bool userCanPressKeyToSwapMode = true);
  14643. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14644. int getVelocityThreshold() const { return velocityModeThreshold; }
  14645. double getVelocityOffset() const { return velocityModeOffset; }
  14646. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14647. void setSkewFactor (double factor);
  14648. void setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint);
  14649. double getSkewFactor() const { return skewFactor; }
  14650. enum IncDecButtonMode
  14651. {
  14652. incDecButtonsNotDraggable,
  14653. incDecButtonsDraggable_AutoDirection,
  14654. incDecButtonsDraggable_Horizontal,
  14655. incDecButtonsDraggable_Vertical
  14656. };
  14657. void setIncDecButtonsMode (IncDecButtonMode mode);
  14658. enum TextEntryBoxPosition
  14659. {
  14660. NoTextBox, /**< Doesn't display a text box. */
  14661. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14662. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14663. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14664. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14665. };
  14666. void setTextBoxStyle (TextEntryBoxPosition newPosition,
  14667. bool isReadOnly,
  14668. int textEntryBoxWidth,
  14669. int textEntryBoxHeight);
  14670. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14671. int getTextBoxWidth() const { return textBoxWidth; }
  14672. int getTextBoxHeight() const { return textBoxHeight; }
  14673. void setTextBoxIsEditable (bool shouldBeEditable);
  14674. bool isTextBoxEditable() const { return editableText; }
  14675. void showTextBox();
  14676. void hideTextBox (bool discardCurrentEditorContents);
  14677. void setValue (double newValue,
  14678. bool sendUpdateMessage = true,
  14679. bool sendMessageSynchronously = false);
  14680. double getValue() const;
  14681. Value& getValueObject() { return currentValue; }
  14682. void setRange (double newMinimum,
  14683. double newMaximum,
  14684. double newInterval = 0);
  14685. double getMaximum() const { return maximum; }
  14686. double getMinimum() const { return minimum; }
  14687. double getInterval() const { return interval; }
  14688. double getMinValue() const;
  14689. Value& getMinValueObject() { return valueMin; }
  14690. void setMinValue (double newValue,
  14691. bool sendUpdateMessage = true,
  14692. bool sendMessageSynchronously = false,
  14693. bool allowNudgingOfOtherValues = false);
  14694. double getMaxValue() const;
  14695. Value& getMaxValueObject() { return valueMax; }
  14696. void setMaxValue (double newValue,
  14697. bool sendUpdateMessage = true,
  14698. bool sendMessageSynchronously = false,
  14699. bool allowNudgingOfOtherValues = false);
  14700. void addListener (SliderListener* listener);
  14701. void removeListener (SliderListener* listener);
  14702. void setDoubleClickReturnValue (bool isDoubleClickEnabled,
  14703. double valueToSetOnDoubleClick);
  14704. double getDoubleClickReturnValue (bool& isEnabled) const;
  14705. void setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease);
  14706. void setSliderSnapsToMousePosition (bool shouldSnapToMouse);
  14707. void setPopupDisplayEnabled (bool isEnabled,
  14708. Component* parentComponentToUse);
  14709. void setPopupMenuEnabled (bool menuEnabled);
  14710. void setScrollWheelEnabled (bool enabled);
  14711. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14712. virtual void startedDragging();
  14713. virtual void stoppedDragging();
  14714. virtual void valueChanged();
  14715. /** Callback to indicate that the user has just moved the slider.
  14716. Note - the valueChanged() method has changed its format and now no longer has
  14717. any parameters. Update your code to use the new version.
  14718. This version has been left here with an int as its return value to cause
  14719. a syntax error if you've got existing code that uses the old version.
  14720. */
  14721. virtual int valueChanged (double) { jassertfalse; return 0; }
  14722. virtual double getValueFromText (const String& text);
  14723. virtual const String getTextFromValue (double value);
  14724. void setTextValueSuffix (const String& suffix);
  14725. const String getTextValueSuffix() const;
  14726. virtual double proportionOfLengthToValue (double proportion);
  14727. virtual double valueToProportionOfLength (double value);
  14728. float getPositionOfValue (double value);
  14729. virtual double snapValue (double attemptedValue, bool userIsDragging);
  14730. void updateText();
  14731. bool isHorizontal() const;
  14732. bool isVertical() const;
  14733. enum ColourIds
  14734. {
  14735. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14736. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14737. and feel class how this is used. */
  14738. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14739. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14740. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14741. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14742. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14743. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14744. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14745. };
  14746. juce_UseDebuggingNewOperator
  14747. protected:
  14748. void labelTextChanged (Label*);
  14749. void paint (Graphics& g);
  14750. void resized();
  14751. void mouseDown (const MouseEvent& e);
  14752. void mouseUp (const MouseEvent& e);
  14753. void mouseDrag (const MouseEvent& e);
  14754. void mouseDoubleClick (const MouseEvent& e);
  14755. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14756. void modifierKeysChanged (const ModifierKeys& modifiers);
  14757. void buttonClicked (Button* button);
  14758. void lookAndFeelChanged();
  14759. void enablementChanged();
  14760. void focusOfChildComponentChanged (FocusChangeType cause);
  14761. void handleAsyncUpdate();
  14762. void colourChanged();
  14763. void valueChanged (Value& value);
  14764. int getNumDecimalPlacesToDisplay() const throw() { return numDecimalPlaces; }
  14765. private:
  14766. ListenerList <SliderListener> listeners;
  14767. Value currentValue, valueMin, valueMax;
  14768. double lastCurrentValue, lastValueMin, lastValueMax;
  14769. double minimum, maximum, interval, doubleClickReturnValue;
  14770. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14771. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14772. int velocityModeThreshold;
  14773. float rotaryStart, rotaryEnd;
  14774. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14775. int mouseDragStartX, mouseDragStartY;
  14776. int sliderRegionStart, sliderRegionSize;
  14777. int sliderBeingDragged;
  14778. int pixelsForFullDragExtent;
  14779. Rectangle<int> sliderRect;
  14780. String textSuffix;
  14781. SliderStyle style;
  14782. TextEntryBoxPosition textBoxPos;
  14783. int textBoxWidth, textBoxHeight;
  14784. IncDecButtonMode incDecButtonMode;
  14785. bool editableText : 1, doubleClickToValue : 1;
  14786. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14787. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14788. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14789. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14790. Label* valueBox;
  14791. Button* incButton;
  14792. Button* decButton;
  14793. ScopedPointer <Component> popupDisplay;
  14794. Component* parentForPopupDisplay;
  14795. float getLinearSliderPos (double value);
  14796. void restoreMouseIfHidden();
  14797. void sendDragStart();
  14798. void sendDragEnd();
  14799. double constrainedValue (double value) const;
  14800. void triggerChangeMessage (bool synchronous);
  14801. bool incDecDragDirectionIsHorizontal() const;
  14802. Slider (const Slider&);
  14803. Slider& operator= (const Slider&);
  14804. };
  14805. #endif // __JUCE_SLIDER_JUCEHEADER__
  14806. /*** End of inlined file: juce_Slider.h ***/
  14807. #endif
  14808. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14809. #endif
  14810. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14811. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14812. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14813. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14814. class TableHeaderComponent;
  14815. class JUCE_API TableHeaderListener
  14816. {
  14817. public:
  14818. TableHeaderListener() {}
  14819. virtual ~TableHeaderListener() {}
  14820. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14821. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14822. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14823. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14824. int columnIdNowBeingDragged);
  14825. };
  14826. class JUCE_API TableHeaderComponent : public Component,
  14827. private AsyncUpdater
  14828. {
  14829. public:
  14830. TableHeaderComponent();
  14831. ~TableHeaderComponent();
  14832. enum ColumnPropertyFlags
  14833. {
  14834. 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. */
  14835. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14836. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14837. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14838. 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. */
  14839. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14840. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14841. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14842. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14843. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14844. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14845. };
  14846. void addColumn (const String& columnName,
  14847. int columnId,
  14848. int width,
  14849. int minimumWidth = 30,
  14850. int maximumWidth = -1,
  14851. int propertyFlags = defaultFlags,
  14852. int insertIndex = -1);
  14853. void removeColumn (int columnIdToRemove);
  14854. void removeAllColumns();
  14855. int getNumColumns (bool onlyCountVisibleColumns) const;
  14856. const String getColumnName (int columnId) const;
  14857. void setColumnName (int columnId, const String& newName);
  14858. void moveColumn (int columnId, int newVisibleIndex);
  14859. int getColumnWidth (int columnId) const;
  14860. void setColumnWidth (int columnId, int newWidth);
  14861. void setColumnVisible (int columnId, bool shouldBeVisible);
  14862. bool isColumnVisible (int columnId) const;
  14863. void setSortColumnId (int columnId, bool sortForwards);
  14864. int getSortColumnId() const;
  14865. bool isSortedForwards() const;
  14866. void reSortTable();
  14867. int getTotalWidth() const;
  14868. int getIndexOfColumnId (int columnId, bool onlyCountVisibleColumns) const;
  14869. int getColumnIdOfIndex (int index, bool onlyCountVisibleColumns) const;
  14870. const Rectangle<int> getColumnPosition (int index) const;
  14871. int getColumnIdAtX (int xToFind) const;
  14872. void setStretchToFitActive (bool shouldStretchToFit);
  14873. bool isStretchToFitActive() const;
  14874. void resizeAllColumnsToFit (int targetTotalWidth);
  14875. void setPopupMenuActive (bool hasMenu);
  14876. bool isPopupMenuActive() const;
  14877. const String toString() const;
  14878. void restoreFromString (const String& storedVersion);
  14879. void addListener (TableHeaderListener* newListener);
  14880. void removeListener (TableHeaderListener* listenerToRemove);
  14881. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14882. virtual void addMenuItems (PopupMenu& menu, int columnIdClicked);
  14883. virtual void reactToMenuItem (int menuReturnId, int columnIdClicked);
  14884. void paint (Graphics& g);
  14885. void resized();
  14886. void mouseMove (const MouseEvent&);
  14887. void mouseEnter (const MouseEvent&);
  14888. void mouseExit (const MouseEvent&);
  14889. void mouseDown (const MouseEvent&);
  14890. void mouseDrag (const MouseEvent&);
  14891. void mouseUp (const MouseEvent&);
  14892. const MouseCursor getMouseCursor();
  14893. virtual void showColumnChooserMenu (int columnIdClicked);
  14894. juce_UseDebuggingNewOperator
  14895. private:
  14896. struct ColumnInfo
  14897. {
  14898. String name;
  14899. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14900. double lastDeliberateWidth;
  14901. bool isVisible() const;
  14902. };
  14903. OwnedArray <ColumnInfo> columns;
  14904. Array <TableHeaderListener*> listeners;
  14905. ScopedPointer <Component> dragOverlayComp;
  14906. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14907. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14908. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14909. ColumnInfo* getInfoForId (int columnId) const;
  14910. int visibleIndexToTotalIndex (int visibleIndex) const;
  14911. void sendColumnsChanged();
  14912. void handleAsyncUpdate();
  14913. void beginDrag (const MouseEvent&);
  14914. void endDrag (int finalIndex);
  14915. int getResizeDraggerAt (int mouseX) const;
  14916. void updateColumnUnderMouse (int x, int y);
  14917. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14918. TableHeaderComponent (const TableHeaderComponent&);
  14919. TableHeaderComponent operator= (const TableHeaderComponent&);
  14920. };
  14921. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14922. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14923. #endif
  14924. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14925. /*** Start of inlined file: juce_TableListBox.h ***/
  14926. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14927. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14928. class JUCE_API TableListBoxModel
  14929. {
  14930. public:
  14931. TableListBoxModel() {}
  14932. virtual ~TableListBoxModel() {}
  14933. virtual int getNumRows() = 0;
  14934. virtual void paintRowBackground (Graphics& g,
  14935. int rowNumber,
  14936. int width, int height,
  14937. bool rowIsSelected) = 0;
  14938. virtual void paintCell (Graphics& g,
  14939. int rowNumber,
  14940. int columnId,
  14941. int width, int height,
  14942. bool rowIsSelected) = 0;
  14943. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14944. Component* existingComponentToUpdate);
  14945. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14946. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14947. virtual void backgroundClicked();
  14948. virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
  14949. virtual int getColumnAutoSizeWidth (int columnId);
  14950. virtual const String getCellTooltip (int rowNumber, int columnId);
  14951. virtual void selectedRowsChanged (int lastRowSelected);
  14952. virtual void deleteKeyPressed (int lastRowSelected);
  14953. virtual void returnKeyPressed (int lastRowSelected);
  14954. virtual void listWasScrolled();
  14955. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14956. };
  14957. class JUCE_API TableListBox : public ListBox,
  14958. private ListBoxModel,
  14959. private TableHeaderListener
  14960. {
  14961. public:
  14962. TableListBox (const String& componentName,
  14963. TableListBoxModel* model);
  14964. ~TableListBox();
  14965. void setModel (TableListBoxModel* newModel);
  14966. TableListBoxModel* getModel() const { return model; }
  14967. TableHeaderComponent* getHeader() const { return header; }
  14968. void setHeaderHeight (int newHeight);
  14969. int getHeaderHeight() const;
  14970. void autoSizeColumn (int columnId);
  14971. void autoSizeAllColumns();
  14972. void setAutoSizeMenuOptionShown (bool shouldBeShown);
  14973. bool isAutoSizeMenuOptionShown() const;
  14974. const Rectangle<int> getCellPosition (int columnId,
  14975. int rowNumber,
  14976. bool relativeToComponentTopLeft) const;
  14977. void scrollToEnsureColumnIsOnscreen (int columnId);
  14978. int getNumRows();
  14979. void paintListBoxItem (int, Graphics&, int, int, bool);
  14980. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14981. void selectedRowsChanged (int lastRowSelected);
  14982. void deleteKeyPressed (int currentSelectedRow);
  14983. void returnKeyPressed (int currentSelectedRow);
  14984. void backgroundClicked();
  14985. void listWasScrolled();
  14986. void tableColumnsChanged (TableHeaderComponent*);
  14987. void tableColumnsResized (TableHeaderComponent*);
  14988. void tableSortOrderChanged (TableHeaderComponent*);
  14989. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14990. void resized();
  14991. juce_UseDebuggingNewOperator
  14992. private:
  14993. TableHeaderComponent* header;
  14994. TableListBoxModel* model;
  14995. int columnIdNowBeingDragged;
  14996. bool autoSizeOptionsShown;
  14997. void updateColumnComponents() const;
  14998. TableListBox (const TableListBox&);
  14999. TableListBox& operator= (const TableListBox&);
  15000. };
  15001. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  15002. /*** End of inlined file: juce_TableListBox.h ***/
  15003. #endif
  15004. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  15005. #endif
  15006. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  15007. #endif
  15008. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  15009. #endif
  15010. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15011. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  15012. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15013. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15014. class JUCE_API ToolbarItemFactory
  15015. {
  15016. public:
  15017. ToolbarItemFactory();
  15018. virtual ~ToolbarItemFactory();
  15019. enum SpecialItemIds
  15020. {
  15021. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  15022. can be placed between sets of items to break them into groups. */
  15023. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  15024. items.*/
  15025. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  15026. either side of it, filling any available space. */
  15027. };
  15028. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  15029. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  15030. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  15031. };
  15032. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  15033. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  15034. #endif
  15035. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15036. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  15037. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15038. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15039. class JUCE_API ToolbarItemPalette : public Component,
  15040. public DragAndDropContainer
  15041. {
  15042. public:
  15043. ToolbarItemPalette (ToolbarItemFactory& factory,
  15044. Toolbar* toolbar);
  15045. ~ToolbarItemPalette();
  15046. void resized();
  15047. juce_UseDebuggingNewOperator
  15048. private:
  15049. ToolbarItemFactory& factory;
  15050. Toolbar* toolbar;
  15051. Viewport* viewport;
  15052. friend class Toolbar;
  15053. void replaceComponent (ToolbarItemComponent* comp);
  15054. ToolbarItemPalette (const ToolbarItemPalette&);
  15055. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  15056. };
  15057. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  15058. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  15059. #endif
  15060. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15061. /*** Start of inlined file: juce_TreeView.h ***/
  15062. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  15063. #define __JUCE_TREEVIEW_JUCEHEADER__
  15064. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  15065. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15066. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15067. class JUCE_API FileDragAndDropTarget
  15068. {
  15069. public:
  15070. virtual ~FileDragAndDropTarget() {}
  15071. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  15072. virtual void fileDragEnter (const StringArray& files, int x, int y);
  15073. virtual void fileDragMove (const StringArray& files, int x, int y);
  15074. virtual void fileDragExit (const StringArray& files);
  15075. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  15076. };
  15077. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  15078. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  15079. class TreeView;
  15080. class JUCE_API TreeViewItem
  15081. {
  15082. public:
  15083. TreeViewItem();
  15084. virtual ~TreeViewItem();
  15085. int getNumSubItems() const throw();
  15086. TreeViewItem* getSubItem (int index) const throw();
  15087. void clearSubItems();
  15088. void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
  15089. void removeSubItem (int index, bool deleteItem = true);
  15090. TreeView* getOwnerView() const throw() { return ownerView; }
  15091. TreeViewItem* getParentItem() const throw() { return parentItem; }
  15092. bool isOpen() const throw();
  15093. void setOpen (bool shouldBeOpen);
  15094. bool isSelected() const throw();
  15095. void setSelected (bool shouldBeSelected,
  15096. bool deselectOtherItemsFirst);
  15097. const Rectangle<int> getItemPosition (bool relativeToTreeViewTopLeft) const throw();
  15098. void treeHasChanged() const throw();
  15099. void repaintItem() const;
  15100. int getRowNumberInTree() const throw();
  15101. bool areAllParentsOpen() const throw();
  15102. void setLinesDrawnForSubItems (bool shouldDrawLines) throw();
  15103. virtual bool mightContainSubItems() = 0;
  15104. virtual const String getUniqueName() const;
  15105. virtual void itemOpennessChanged (bool isNowOpen);
  15106. virtual int getItemWidth() const { return -1; }
  15107. virtual int getItemHeight() const { return 20; }
  15108. virtual bool canBeSelected() const { return true; }
  15109. virtual Component* createItemComponent() { return 0; }
  15110. virtual void paintItem (Graphics& g, int width, int height);
  15111. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  15112. virtual void itemClicked (const MouseEvent& e);
  15113. virtual void itemDoubleClicked (const MouseEvent& e);
  15114. virtual void itemSelectionChanged (bool isNowSelected);
  15115. virtual const String getTooltip();
  15116. virtual const String getDragSourceDescription();
  15117. virtual bool isInterestedInFileDrag (const StringArray& files);
  15118. virtual void filesDropped (const StringArray& files, int insertIndex);
  15119. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15120. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  15121. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  15122. XmlElement* getOpennessState() const throw();
  15123. void restoreOpennessState (const XmlElement& xml) throw();
  15124. int getIndexInParent() const throw();
  15125. bool isLastOfSiblings() const throw();
  15126. const String getItemIdentifierString() const;
  15127. juce_UseDebuggingNewOperator
  15128. private:
  15129. TreeView* ownerView;
  15130. TreeViewItem* parentItem;
  15131. OwnedArray <TreeViewItem> subItems;
  15132. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  15133. int uid;
  15134. bool selected : 1;
  15135. bool redrawNeeded : 1;
  15136. bool drawLinesInside : 1;
  15137. bool drawsInLeftMargin : 1;
  15138. unsigned int openness : 2;
  15139. friend class TreeView;
  15140. friend class TreeViewContentComponent;
  15141. void updatePositions (int newY);
  15142. int getIndentX() const throw();
  15143. void setOwnerView (TreeView* newOwner) throw();
  15144. void paintRecursively (Graphics& g, int width);
  15145. TreeViewItem* getTopLevelItem() throw();
  15146. TreeViewItem* findItemRecursively (int y) throw();
  15147. TreeViewItem* getDeepestOpenParentItem() throw();
  15148. int getNumRows() const throw();
  15149. TreeViewItem* getItemOnRow (int index) throw();
  15150. void deselectAllRecursively();
  15151. int countSelectedItemsRecursively() const throw();
  15152. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15153. TreeViewItem* getNextVisibleItem (bool recurse) const throw();
  15154. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15155. TreeViewItem (const TreeViewItem&);
  15156. TreeViewItem& operator= (const TreeViewItem&);
  15157. };
  15158. class JUCE_API TreeView : public Component,
  15159. public SettableTooltipClient,
  15160. public FileDragAndDropTarget,
  15161. public DragAndDropTarget,
  15162. private AsyncUpdater
  15163. {
  15164. public:
  15165. TreeView (const String& componentName = String::empty);
  15166. ~TreeView();
  15167. void setRootItem (TreeViewItem* newRootItem);
  15168. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15169. void deleteRootItem();
  15170. void setRootItemVisible (bool shouldBeVisible);
  15171. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15172. void setDefaultOpenness (bool isOpenByDefault);
  15173. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15174. void setMultiSelectEnabled (bool canMultiSelect);
  15175. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15176. void setOpenCloseButtonsVisible (bool shouldBeVisible);
  15177. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15178. void clearSelectedItems();
  15179. int getNumSelectedItems() const throw();
  15180. TreeViewItem* getSelectedItem (int index) const throw();
  15181. int getNumRowsInTree() const;
  15182. TreeViewItem* getItemOnRow (int index) const;
  15183. TreeViewItem* getItemAt (int yPosition) const throw();
  15184. void scrollToKeepItemVisible (TreeViewItem* item);
  15185. Viewport* getViewport() const throw();
  15186. int getIndentSize() const throw() { return indentSize; }
  15187. void setIndentSize (int newIndentSize);
  15188. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15189. XmlElement* getOpennessState (bool alsoIncludeScrollPosition) const;
  15190. void restoreOpennessState (const XmlElement& newState);
  15191. enum ColourIds
  15192. {
  15193. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15194. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15195. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15196. };
  15197. void paint (Graphics& g);
  15198. void resized();
  15199. bool keyPressed (const KeyPress& key);
  15200. void colourChanged();
  15201. void enablementChanged();
  15202. bool isInterestedInFileDrag (const StringArray& files);
  15203. void fileDragEnter (const StringArray& files, int x, int y);
  15204. void fileDragMove (const StringArray& files, int x, int y);
  15205. void fileDragExit (const StringArray& files);
  15206. void filesDropped (const StringArray& files, int x, int y);
  15207. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15208. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15209. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15210. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15211. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15212. juce_UseDebuggingNewOperator
  15213. private:
  15214. friend class TreeViewItem;
  15215. friend class TreeViewContentComponent;
  15216. class TreeViewport;
  15217. TreeViewport* viewport;
  15218. CriticalSection nodeAlterationLock;
  15219. TreeViewItem* rootItem;
  15220. class InsertPointHighlight;
  15221. class TargetGroupHighlight;
  15222. InsertPointHighlight* dragInsertPointHighlight;
  15223. TargetGroupHighlight* dragTargetGroupHighlight;
  15224. int indentSize;
  15225. bool defaultOpenness : 1;
  15226. bool needsRecalculating : 1;
  15227. bool rootItemVisible : 1;
  15228. bool multiSelectEnabled : 1;
  15229. bool openCloseButtonsVisible : 1;
  15230. void itemsChanged() throw();
  15231. void handleAsyncUpdate();
  15232. void moveSelectedRow (int delta);
  15233. void updateButtonUnderMouse (const MouseEvent& e);
  15234. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15235. void hideDragHighlight() throw();
  15236. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15237. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15238. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15239. const StringArray& files, const String& sourceDescription,
  15240. Component* sourceComponent) const throw();
  15241. TreeView (const TreeView&);
  15242. TreeView& operator= (const TreeView&);
  15243. };
  15244. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15245. /*** End of inlined file: juce_TreeView.h ***/
  15246. #endif
  15247. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15248. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15249. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15250. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15251. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15252. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15253. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15254. /*** Start of inlined file: juce_FileFilter.h ***/
  15255. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15256. #define __JUCE_FILEFILTER_JUCEHEADER__
  15257. class JUCE_API FileFilter
  15258. {
  15259. public:
  15260. FileFilter (const String& filterDescription);
  15261. virtual ~FileFilter();
  15262. const String& getDescription() const throw();
  15263. virtual bool isFileSuitable (const File& file) const = 0;
  15264. virtual bool isDirectorySuitable (const File& file) const = 0;
  15265. protected:
  15266. String description;
  15267. };
  15268. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15269. /*** End of inlined file: juce_FileFilter.h ***/
  15270. /*** Start of inlined file: juce_Image.h ***/
  15271. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15272. #define __JUCE_IMAGE_JUCEHEADER__
  15273. class JUCE_API Image
  15274. {
  15275. public:
  15276. enum PixelFormat
  15277. {
  15278. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15279. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15280. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15281. };
  15282. Image (PixelFormat format,
  15283. int imageWidth,
  15284. int imageHeight,
  15285. bool clearImage);
  15286. Image (const Image& other);
  15287. virtual ~Image();
  15288. static Image* createNativeImage (PixelFormat format,
  15289. int imageWidth,
  15290. int imageHeight,
  15291. bool clearImage);
  15292. int getWidth() const throw() { return imageWidth; }
  15293. int getHeight() const throw() { return imageHeight; }
  15294. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15295. PixelFormat getFormat() const throw() { return format; }
  15296. bool isARGB() const throw() { return format == ARGB; }
  15297. bool isRGB() const throw() { return format == RGB; }
  15298. bool hasAlphaChannel() const throw() { return format != RGB; }
  15299. virtual void clear (int x, int y, int w, int h,
  15300. const Colour& colourToClearTo = Colour (0x00000000));
  15301. virtual Image* createCopy (int newWidth = -1,
  15302. int newHeight = -1,
  15303. Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15304. virtual Image* createCopyOfAlphaChannel() const;
  15305. virtual const Colour getPixelAt (int x, int y) const;
  15306. virtual void setPixelAt (int x, int y, const Colour& colour);
  15307. virtual void multiplyAlphaAt (int x, int y, float multiplier);
  15308. virtual void multiplyAllAlphas (float amountToMultiplyBy);
  15309. virtual void desaturate();
  15310. class BitmapData
  15311. {
  15312. public:
  15313. BitmapData (Image& image, int x, int y, int w, int h, bool needsToBeWritable);
  15314. BitmapData (const Image& image, int x, int y, int w, int h);
  15315. ~BitmapData();
  15316. inline uint8* getLinePointer (int y) const { return data + y * lineStride; }
  15317. inline uint8* getPixelPointer (int x, int y) const { return data + y * lineStride + x * pixelStride; }
  15318. uint8* data;
  15319. int lineStride, pixelStride, width, height;
  15320. private:
  15321. BitmapData (const BitmapData&);
  15322. BitmapData& operator= (const BitmapData&);
  15323. };
  15324. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15325. const uint8* sourcePixelData, int sourceLineStride);
  15326. virtual void moveImageSection (int destX, int destY,
  15327. int sourceX, int sourceY,
  15328. int width, int height);
  15329. void createSolidAreaMask (RectangleList& result,
  15330. float alphaThreshold = 0.5f) const;
  15331. juce_UseDebuggingNewOperator
  15332. virtual LowLevelGraphicsContext* createLowLevelContext();
  15333. protected:
  15334. friend class BitmapData;
  15335. const PixelFormat format;
  15336. const int imageWidth, imageHeight;
  15337. Image (PixelFormat format,
  15338. int imageWidth,
  15339. int imageHeight);
  15340. int pixelStride, lineStride;
  15341. HeapBlock <uint8> imageDataAllocated;
  15342. uint8* imageData;
  15343. private:
  15344. Image& operator= (const Image&);
  15345. };
  15346. #endif // __JUCE_IMAGE_JUCEHEADER__
  15347. /*** End of inlined file: juce_Image.h ***/
  15348. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15349. public TimeSliceClient
  15350. {
  15351. public:
  15352. DirectoryContentsList (const FileFilter* fileFilter,
  15353. TimeSliceThread& threadToUse);
  15354. ~DirectoryContentsList();
  15355. void setDirectory (const File& directory,
  15356. bool includeDirectories,
  15357. bool includeFiles);
  15358. const File& getDirectory() const;
  15359. void clear();
  15360. void refresh();
  15361. bool isStillLoading() const;
  15362. void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
  15363. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15364. struct FileInfo
  15365. {
  15366. String filename;
  15367. int64 fileSize;
  15368. Time modificationTime;
  15369. Time creationTime;
  15370. bool isDirectory;
  15371. bool isReadOnly;
  15372. };
  15373. int getNumFiles() const;
  15374. bool getFileInfo (int index, FileInfo& resultInfo) const;
  15375. const File getFile (int index) const;
  15376. const FileFilter* getFilter() const { return fileFilter; }
  15377. bool useTimeSlice();
  15378. TimeSliceThread& getTimeSliceThread() { return thread; }
  15379. static int compareElements (const DirectoryContentsList::FileInfo* first,
  15380. const DirectoryContentsList::FileInfo* second);
  15381. juce_UseDebuggingNewOperator
  15382. private:
  15383. File root;
  15384. const FileFilter* fileFilter;
  15385. TimeSliceThread& thread;
  15386. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15387. CriticalSection fileListLock;
  15388. OwnedArray <FileInfo> files;
  15389. void* volatile fileFindHandle;
  15390. bool volatile shouldStop;
  15391. void changed();
  15392. bool checkNextFile (bool& hasChanged);
  15393. bool addFile (const String& filename, bool isDir, bool isHidden,
  15394. const int64 fileSize, const Time& modTime,
  15395. const Time& creationTime, bool isReadOnly);
  15396. DirectoryContentsList (const DirectoryContentsList&);
  15397. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15398. };
  15399. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15400. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15401. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15402. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15403. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15404. class JUCE_API FileBrowserListener
  15405. {
  15406. public:
  15407. virtual ~FileBrowserListener();
  15408. virtual void selectionChanged() = 0;
  15409. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15410. virtual void fileDoubleClicked (const File& file) = 0;
  15411. };
  15412. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15413. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15414. class JUCE_API DirectoryContentsDisplayComponent
  15415. {
  15416. public:
  15417. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15418. virtual ~DirectoryContentsDisplayComponent();
  15419. virtual int getNumSelectedFiles() const = 0;
  15420. virtual const File getSelectedFile (int index) const = 0;
  15421. virtual void scrollToTop() = 0;
  15422. void addListener (FileBrowserListener* listener);
  15423. void removeListener (FileBrowserListener* listener);
  15424. enum ColourIds
  15425. {
  15426. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15427. textColourId = 0x1000541, /**< The colour for the text. */
  15428. };
  15429. void sendSelectionChangeMessage();
  15430. void sendDoubleClickMessage (const File& file);
  15431. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15432. juce_UseDebuggingNewOperator
  15433. protected:
  15434. DirectoryContentsList& fileList;
  15435. ListenerList <FileBrowserListener> listeners;
  15436. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15437. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15438. };
  15439. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15440. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15441. #endif
  15442. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15443. #endif
  15444. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15445. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15446. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15447. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15448. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15449. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15450. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15451. class JUCE_API FilePreviewComponent : public Component
  15452. {
  15453. public:
  15454. FilePreviewComponent();
  15455. ~FilePreviewComponent();
  15456. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15457. juce_UseDebuggingNewOperator
  15458. private:
  15459. FilePreviewComponent (const FilePreviewComponent&);
  15460. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15461. };
  15462. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15463. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15464. class JUCE_API FileBrowserComponent : public Component,
  15465. public ChangeBroadcaster,
  15466. private FileBrowserListener,
  15467. private TextEditorListener,
  15468. private ButtonListener,
  15469. private ComboBoxListener,
  15470. private FileFilter
  15471. {
  15472. public:
  15473. enum FileChooserFlags
  15474. {
  15475. openMode = 1, /**< specifies that the component should allow the user to
  15476. choose an existing file with the intention of opening it. */
  15477. saveMode = 2, /**< specifies that the component should allow the user to specify
  15478. the name of a file that will be used to save something. */
  15479. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15480. conjunction with canSelectDirectories). */
  15481. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15482. conjuction with canSelectFiles). */
  15483. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15484. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15485. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15486. };
  15487. FileBrowserComponent (int flags,
  15488. const File& initialFileOrDirectory,
  15489. const FileFilter* fileFilter,
  15490. FilePreviewComponent* previewComp);
  15491. ~FileBrowserComponent();
  15492. int getNumSelectedFiles() const throw();
  15493. const File getSelectedFile (int index) const throw();
  15494. bool currentFileIsValid() const;
  15495. const File getHighlightedFile() const throw();
  15496. const File getRoot() const;
  15497. void setRoot (const File& newRootDirectory);
  15498. void goUp();
  15499. void refresh();
  15500. virtual const String getActionVerb() const;
  15501. bool isSaveMode() const throw();
  15502. void addListener (FileBrowserListener* listener);
  15503. void removeListener (FileBrowserListener* listener);
  15504. void resized();
  15505. void buttonClicked (Button* b);
  15506. void comboBoxChanged (ComboBox*);
  15507. void textEditorTextChanged (TextEditor& editor);
  15508. void textEditorReturnKeyPressed (TextEditor& editor);
  15509. void textEditorEscapeKeyPressed (TextEditor& editor);
  15510. void textEditorFocusLost (TextEditor& editor);
  15511. bool keyPressed (const KeyPress& key);
  15512. void selectionChanged();
  15513. void fileClicked (const File& f, const MouseEvent& e);
  15514. void fileDoubleClicked (const File& f);
  15515. bool isFileSuitable (const File& file) const;
  15516. bool isDirectorySuitable (const File&) const;
  15517. FilePreviewComponent* getPreviewComponent() const throw();
  15518. juce_UseDebuggingNewOperator
  15519. protected:
  15520. virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
  15521. private:
  15522. ScopedPointer <DirectoryContentsList> fileList;
  15523. const FileFilter* fileFilter;
  15524. int flags;
  15525. File currentRoot;
  15526. Array<File> chosenFiles;
  15527. ListenerList <FileBrowserListener> listeners;
  15528. DirectoryContentsDisplayComponent* fileListComponent;
  15529. FilePreviewComponent* previewComp;
  15530. ComboBox* currentPathBox;
  15531. TextEditor* filenameBox;
  15532. Button* goUpButton;
  15533. TimeSliceThread thread;
  15534. void sendListenerChangeMessage();
  15535. bool isFileOrDirSuitable (const File& f) const;
  15536. FileBrowserComponent (const FileBrowserComponent&);
  15537. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15538. };
  15539. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15540. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15541. #endif
  15542. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15543. #endif
  15544. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15545. /*** Start of inlined file: juce_FileChooser.h ***/
  15546. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15547. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15548. class JUCE_API FileChooser
  15549. {
  15550. public:
  15551. FileChooser (const String& dialogBoxTitle,
  15552. const File& initialFileOrDirectory = File::nonexistent,
  15553. const String& filePatternsAllowed = String::empty,
  15554. bool useOSNativeDialogBox = true);
  15555. ~FileChooser();
  15556. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15557. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15558. bool browseForFileToSave (bool warnAboutOverwritingExistingFiles);
  15559. bool browseForDirectory();
  15560. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15561. const File getResult() const;
  15562. const Array<File>& getResults() const;
  15563. juce_UseDebuggingNewOperator
  15564. private:
  15565. String title, filters;
  15566. File startingFile;
  15567. Array<File> results;
  15568. bool useNativeDialogBox;
  15569. bool showDialog (bool selectsDirectories, bool selectsFiles, bool isSave,
  15570. bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15571. FilePreviewComponent* previewComponent);
  15572. static void showPlatformDialog (Array<File>& results, const String& title, const File& file,
  15573. const String& filters, bool selectsDirectories, bool selectsFiles,
  15574. bool isSave, bool warnAboutOverwritingExistingFiles, bool selectMultipleFiles,
  15575. FilePreviewComponent* previewComponent);
  15576. };
  15577. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15578. /*** End of inlined file: juce_FileChooser.h ***/
  15579. #endif
  15580. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15581. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15582. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15583. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15584. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15585. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15586. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15587. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15588. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15589. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15590. /*** Start of inlined file: juce_DropShadower.h ***/
  15591. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15592. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15593. class JUCE_API DropShadower : public ComponentListener
  15594. {
  15595. public:
  15596. DropShadower (float alpha = 0.5f,
  15597. int xOffset = 1,
  15598. int yOffset = 5,
  15599. float blurRadius = 10.0f);
  15600. virtual ~DropShadower();
  15601. void setOwner (Component* componentToFollow);
  15602. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15603. void componentBroughtToFront (Component& component);
  15604. void componentChildrenChanged (Component& component);
  15605. void componentParentHierarchyChanged (Component& component);
  15606. void componentVisibilityChanged (Component& component);
  15607. juce_UseDebuggingNewOperator
  15608. private:
  15609. Component* owner;
  15610. int numShadows;
  15611. Component* shadowWindows[4];
  15612. Image* shadowImageSections[12];
  15613. const int shadowEdge, xOffset, yOffset;
  15614. const float alpha, blurRadius;
  15615. bool inDestructor, reentrant;
  15616. void updateShadows();
  15617. void setShadowImage (Image* const src,
  15618. const int num,
  15619. const int w, const int h,
  15620. const int sx, const int sy);
  15621. void bringShadowWindowsToFront();
  15622. void deleteShadowWindows();
  15623. DropShadower (const DropShadower&);
  15624. DropShadower& operator= (const DropShadower&);
  15625. };
  15626. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15627. /*** End of inlined file: juce_DropShadower.h ***/
  15628. class JUCE_API TopLevelWindow : public Component
  15629. {
  15630. public:
  15631. TopLevelWindow (const String& name, bool addToDesktop);
  15632. ~TopLevelWindow();
  15633. bool isActiveWindow() const throw() { return windowIsActive_; }
  15634. void centreAroundComponent (Component* componentToCentreAround,
  15635. int width, int height);
  15636. void setDropShadowEnabled (bool useShadow);
  15637. void setUsingNativeTitleBar (bool useNativeTitleBar);
  15638. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15639. static int getNumTopLevelWindows() throw();
  15640. static TopLevelWindow* getTopLevelWindow (int index) throw();
  15641. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15642. juce_UseDebuggingNewOperator
  15643. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15644. protected:
  15645. virtual void activeWindowStatusChanged();
  15646. void focusOfChildComponentChanged (FocusChangeType cause);
  15647. void parentHierarchyChanged();
  15648. void visibilityChanged();
  15649. virtual int getDesktopWindowStyleFlags() const;
  15650. void recreateDesktopWindow();
  15651. private:
  15652. friend class TopLevelWindowManager;
  15653. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15654. ScopedPointer <DropShadower> shadower;
  15655. void setWindowActive (bool isNowActive) throw();
  15656. TopLevelWindow (const TopLevelWindow&);
  15657. TopLevelWindow& operator= (const TopLevelWindow&);
  15658. };
  15659. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15660. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15661. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15662. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15663. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15664. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15665. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15666. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15667. class JUCE_API ComponentBoundsConstrainer
  15668. {
  15669. public:
  15670. ComponentBoundsConstrainer() throw();
  15671. virtual ~ComponentBoundsConstrainer();
  15672. void setMinimumWidth (int minimumWidth) throw();
  15673. int getMinimumWidth() const throw() { return minW; }
  15674. void setMaximumWidth (int maximumWidth) throw();
  15675. int getMaximumWidth() const throw() { return maxW; }
  15676. void setMinimumHeight (int minimumHeight) throw();
  15677. int getMinimumHeight() const throw() { return minH; }
  15678. void setMaximumHeight (int maximumHeight) throw();
  15679. int getMaximumHeight() const throw() { return maxH; }
  15680. void setMinimumSize (int minimumWidth,
  15681. int minimumHeight) throw();
  15682. void setMaximumSize (int maximumWidth,
  15683. int maximumHeight) throw();
  15684. void setSizeLimits (int minimumWidth,
  15685. int minimumHeight,
  15686. int maximumWidth,
  15687. int maximumHeight) throw();
  15688. void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
  15689. int minimumWhenOffTheLeft,
  15690. int minimumWhenOffTheBottom,
  15691. int minimumWhenOffTheRight) throw();
  15692. void setFixedAspectRatio (double widthOverHeight) throw();
  15693. double getFixedAspectRatio() const throw();
  15694. virtual void checkBounds (Rectangle<int>& bounds,
  15695. const Rectangle<int>& previousBounds,
  15696. const Rectangle<int>& limits,
  15697. bool isStretchingTop,
  15698. bool isStretchingLeft,
  15699. bool isStretchingBottom,
  15700. bool isStretchingRight);
  15701. virtual void resizeStart();
  15702. virtual void resizeEnd();
  15703. void setBoundsForComponent (Component* const component,
  15704. const Rectangle<int>& bounds,
  15705. bool isStretchingTop,
  15706. bool isStretchingLeft,
  15707. bool isStretchingBottom,
  15708. bool isStretchingRight);
  15709. void checkComponentBounds (Component* component);
  15710. virtual void applyBoundsToComponent (Component* component,
  15711. const Rectangle<int>& bounds);
  15712. juce_UseDebuggingNewOperator
  15713. private:
  15714. int minW, maxW, minH, maxH;
  15715. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15716. double aspectRatio;
  15717. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15718. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15719. };
  15720. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15721. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15722. class JUCE_API ComponentDragger
  15723. {
  15724. public:
  15725. ComponentDragger();
  15726. virtual ~ComponentDragger();
  15727. void startDraggingComponent (Component* const componentToDrag,
  15728. ComponentBoundsConstrainer* constrainer);
  15729. void dragComponent (Component* const componentToDrag,
  15730. const MouseEvent& e);
  15731. juce_UseDebuggingNewOperator
  15732. private:
  15733. ComponentBoundsConstrainer* constrainer;
  15734. Point<int> originalPos;
  15735. ComponentDragger (const ComponentDragger&);
  15736. ComponentDragger& operator= (const ComponentDragger&);
  15737. };
  15738. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15739. /*** End of inlined file: juce_ComponentDragger.h ***/
  15740. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15741. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15742. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15743. class JUCE_API ResizableBorderComponent : public Component
  15744. {
  15745. public:
  15746. ResizableBorderComponent (Component* componentToResize,
  15747. ComponentBoundsConstrainer* constrainer);
  15748. ~ResizableBorderComponent();
  15749. void setBorderThickness (const BorderSize& newBorderSize);
  15750. const BorderSize getBorderThickness() const;
  15751. class Zone
  15752. {
  15753. public:
  15754. enum Zones
  15755. {
  15756. centre = 0,
  15757. left = 1,
  15758. top = 2,
  15759. right = 4,
  15760. bottom = 8
  15761. };
  15762. explicit Zone (int zoneFlags = 0) throw();
  15763. Zone (const Zone& other) throw();
  15764. Zone& operator= (const Zone& other) throw();
  15765. bool operator== (const Zone& other) const throw();
  15766. bool operator!= (const Zone& other) const throw();
  15767. static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
  15768. const BorderSize& border,
  15769. const Point<int>& position);
  15770. const MouseCursor getMouseCursor() const throw();
  15771. bool isDraggingWholeObject() const throw() { return zone == centre; }
  15772. bool isDraggingLeftEdge() const throw() { return (zone & left) != 0; }
  15773. bool isDraggingRightEdge() const throw() { return (zone & right) != 0; }
  15774. bool isDraggingTopEdge() const throw() { return (zone & top) != 0; }
  15775. bool isDraggingBottomEdge() const throw() { return (zone & bottom) != 0; }
  15776. const Rectangle<int> resizeRectangleBy (Rectangle<int> original,
  15777. const Point<int>& distance) const throw();
  15778. int getZoneFlags() const throw() { return zone; }
  15779. private:
  15780. int zone;
  15781. };
  15782. juce_UseDebuggingNewOperator
  15783. protected:
  15784. void paint (Graphics& g);
  15785. void mouseEnter (const MouseEvent& e);
  15786. void mouseMove (const MouseEvent& e);
  15787. void mouseDown (const MouseEvent& e);
  15788. void mouseDrag (const MouseEvent& e);
  15789. void mouseUp (const MouseEvent& e);
  15790. bool hitTest (int x, int y);
  15791. private:
  15792. Component::SafePointer<Component> component;
  15793. ComponentBoundsConstrainer* constrainer;
  15794. BorderSize borderSize;
  15795. Rectangle<int> originalBounds;
  15796. Zone mouseZone;
  15797. void updateMouseZone (const MouseEvent& e);
  15798. ResizableBorderComponent (const ResizableBorderComponent&);
  15799. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15800. };
  15801. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15802. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15803. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15804. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15805. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15806. class JUCE_API ResizableCornerComponent : public Component
  15807. {
  15808. public:
  15809. ResizableCornerComponent (Component* componentToResize,
  15810. ComponentBoundsConstrainer* constrainer);
  15811. ~ResizableCornerComponent();
  15812. juce_UseDebuggingNewOperator
  15813. protected:
  15814. void paint (Graphics& g);
  15815. void mouseDown (const MouseEvent& e);
  15816. void mouseDrag (const MouseEvent& e);
  15817. void mouseUp (const MouseEvent& e);
  15818. bool hitTest (int x, int y);
  15819. private:
  15820. Component::SafePointer<Component> component;
  15821. ComponentBoundsConstrainer* constrainer;
  15822. Rectangle<int> originalBounds;
  15823. ResizableCornerComponent (const ResizableCornerComponent&);
  15824. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15825. };
  15826. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15827. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15828. class JUCE_API ResizableWindow : public TopLevelWindow
  15829. {
  15830. public:
  15831. ResizableWindow (const String& name,
  15832. bool addToDesktop);
  15833. ResizableWindow (const String& name,
  15834. const Colour& backgroundColour,
  15835. bool addToDesktop);
  15836. ~ResizableWindow();
  15837. const Colour getBackgroundColour() const throw();
  15838. void setBackgroundColour (const Colour& newColour);
  15839. void setResizable (bool shouldBeResizable,
  15840. bool useBottomRightCornerResizer);
  15841. bool isResizable() const throw();
  15842. void setResizeLimits (int newMinimumWidth,
  15843. int newMinimumHeight,
  15844. int newMaximumWidth,
  15845. int newMaximumHeight) throw();
  15846. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15847. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15848. void setBoundsConstrained (const Rectangle<int>& bounds);
  15849. bool isFullScreen() const;
  15850. void setFullScreen (bool shouldBeFullScreen);
  15851. bool isMinimised() const;
  15852. void setMinimised (bool shouldMinimise);
  15853. const String getWindowStateAsString();
  15854. bool restoreWindowStateFromString (const String& previousState);
  15855. Component* getContentComponent() const throw() { return contentComponent; }
  15856. void setContentComponent (Component* newContentComponent,
  15857. bool deleteOldOne = true,
  15858. bool resizeToFit = false);
  15859. void setContentComponentSize (int width, int height);
  15860. enum ColourIds
  15861. {
  15862. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15863. };
  15864. juce_UseDebuggingNewOperator
  15865. protected:
  15866. void paint (Graphics& g);
  15867. void moved();
  15868. void resized();
  15869. void mouseDown (const MouseEvent& e);
  15870. void mouseDrag (const MouseEvent& e);
  15871. void lookAndFeelChanged();
  15872. void childBoundsChanged (Component* child);
  15873. void parentSizeChanged();
  15874. void visibilityChanged();
  15875. void activeWindowStatusChanged();
  15876. int getDesktopWindowStyleFlags() const;
  15877. virtual const BorderSize getBorderThickness();
  15878. virtual const BorderSize getContentComponentBorder();
  15879. #ifdef JUCE_DEBUG
  15880. void addChildComponent (Component* child, int zOrder = -1);
  15881. void addAndMakeVisible (Component* child, int zOrder = -1);
  15882. #endif
  15883. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15884. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15885. private:
  15886. ScopedPointer <Component> contentComponent;
  15887. bool resizeToFitContent, fullscreen;
  15888. ComponentDragger dragger;
  15889. Rectangle<int> lastNonFullScreenPos;
  15890. ComponentBoundsConstrainer defaultConstrainer;
  15891. ComponentBoundsConstrainer* constrainer;
  15892. #ifdef JUCE_DEBUG
  15893. bool hasBeenResized;
  15894. #endif
  15895. void updateLastPos();
  15896. ResizableWindow (const ResizableWindow&);
  15897. ResizableWindow& operator= (const ResizableWindow&);
  15898. // (xxx remove these eventually)
  15899. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15900. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15901. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15902. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15903. };
  15904. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15905. /*** End of inlined file: juce_ResizableWindow.h ***/
  15906. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15907. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15908. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15909. class JUCE_API PositionedGlyph
  15910. {
  15911. public:
  15912. juce_wchar getCharacter() const { return character; }
  15913. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15914. float getLeft() const { return x; }
  15915. float getRight() const { return x + w; }
  15916. float getBaselineY() const { return y; }
  15917. float getTop() const { return y - font.getAscent(); }
  15918. float getBottom() const { return y + font.getDescent(); }
  15919. const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
  15920. void moveBy (float deltaX, float deltaY);
  15921. void draw (const Graphics& g) const;
  15922. void draw (const Graphics& g, const AffineTransform& transform) const;
  15923. void createPath (Path& path) const;
  15924. bool hitTest (float x, float y) const;
  15925. juce_UseDebuggingNewOperator
  15926. private:
  15927. friend class GlyphArrangement;
  15928. float x, y, w;
  15929. Font font;
  15930. juce_wchar character;
  15931. int glyph;
  15932. PositionedGlyph (float x, float y, float w, const Font& font, juce_wchar character, int glyph);
  15933. PositionedGlyph (const PositionedGlyph& other);
  15934. };
  15935. class JUCE_API GlyphArrangement
  15936. {
  15937. public:
  15938. GlyphArrangement();
  15939. GlyphArrangement (const GlyphArrangement& other);
  15940. GlyphArrangement& operator= (const GlyphArrangement& other);
  15941. ~GlyphArrangement();
  15942. int getNumGlyphs() const throw() { return glyphs.size(); }
  15943. PositionedGlyph& getGlyph (int index) const;
  15944. void clear();
  15945. void addLineOfText (const Font& font,
  15946. const String& text,
  15947. float x, float y);
  15948. void addCurtailedLineOfText (const Font& font,
  15949. const String& text,
  15950. float x, float y,
  15951. float maxWidthPixels,
  15952. bool useEllipsis);
  15953. void addJustifiedText (const Font& font,
  15954. const String& text,
  15955. float x, float y,
  15956. float maxLineWidth,
  15957. const Justification& horizontalLayout);
  15958. void addFittedText (const Font& font,
  15959. const String& text,
  15960. float x, float y, float width, float height,
  15961. const Justification& layout,
  15962. int maximumLinesToUse,
  15963. float minimumHorizontalScale = 0.7f);
  15964. void addGlyphArrangement (const GlyphArrangement& other);
  15965. void draw (const Graphics& g) const;
  15966. void draw (const Graphics& g, const AffineTransform& transform) const;
  15967. void createPath (Path& path) const;
  15968. int findGlyphIndexAt (float x, float y) const;
  15969. const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
  15970. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15971. float deltaX, float deltaY);
  15972. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15973. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15974. float horizontalScaleFactor);
  15975. void justifyGlyphs (int startIndex, int numGlyphs,
  15976. float x, float y, float width, float height,
  15977. const Justification& justification);
  15978. juce_UseDebuggingNewOperator
  15979. private:
  15980. OwnedArray <PositionedGlyph> glyphs;
  15981. int insertEllipsis (const Font& font, float maxXPos, int startIndex, int endIndex);
  15982. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15983. const Justification& justification, float minimumHorizontalScale);
  15984. void spreadOutLine (int start, int numGlyphs, float targetWidth);
  15985. };
  15986. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15987. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15988. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15989. public ButtonListener,
  15990. public FileBrowserListener
  15991. {
  15992. public:
  15993. FileChooserDialogBox (const String& title,
  15994. const String& instructions,
  15995. FileBrowserComponent& browserComponent,
  15996. bool warnAboutOverwritingExistingFiles,
  15997. const Colour& backgroundColour);
  15998. ~FileChooserDialogBox();
  15999. bool show (int width = 0,int height = 0);
  16000. enum ColourIds
  16001. {
  16002. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  16003. };
  16004. void buttonClicked (Button* button);
  16005. void closeButtonPressed();
  16006. void selectionChanged();
  16007. void fileClicked (const File& file, const MouseEvent& e);
  16008. void fileDoubleClicked (const File& file);
  16009. juce_UseDebuggingNewOperator
  16010. private:
  16011. class ContentComponent : public Component
  16012. {
  16013. public:
  16014. ContentComponent();
  16015. ~ContentComponent();
  16016. void paint (Graphics& g);
  16017. void resized();
  16018. String instructions;
  16019. GlyphArrangement text;
  16020. FileBrowserComponent* chooserComponent;
  16021. FilePreviewComponent* previewComponent;
  16022. TextButton* okButton;
  16023. TextButton* cancelButton;
  16024. };
  16025. ContentComponent* content;
  16026. const bool warnAboutOverwritingExistingFiles;
  16027. FileChooserDialogBox (const FileChooserDialogBox&);
  16028. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  16029. };
  16030. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  16031. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  16032. #endif
  16033. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  16034. #endif
  16035. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16036. /*** Start of inlined file: juce_FileListComponent.h ***/
  16037. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16038. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16039. class JUCE_API FileListComponent : public ListBox,
  16040. public DirectoryContentsDisplayComponent,
  16041. private ListBoxModel,
  16042. private ChangeListener
  16043. {
  16044. public:
  16045. FileListComponent (DirectoryContentsList& listToShow);
  16046. ~FileListComponent();
  16047. int getNumSelectedFiles() const;
  16048. const File getSelectedFile (int index = 0) const;
  16049. void scrollToTop();
  16050. void changeListenerCallback (void*);
  16051. int getNumRows();
  16052. void paintListBoxItem (int, Graphics&, int, int, bool);
  16053. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  16054. void selectedRowsChanged (int lastRowSelected);
  16055. void deleteKeyPressed (int currentSelectedRow);
  16056. void returnKeyPressed (int currentSelectedRow);
  16057. juce_UseDebuggingNewOperator
  16058. private:
  16059. FileListComponent (const FileListComponent&);
  16060. FileListComponent& operator= (const FileListComponent&);
  16061. File lastDirectory;
  16062. };
  16063. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  16064. /*** End of inlined file: juce_FileListComponent.h ***/
  16065. #endif
  16066. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16067. /*** Start of inlined file: juce_FilenameComponent.h ***/
  16068. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16069. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16070. class FilenameComponent;
  16071. class JUCE_API FilenameComponentListener
  16072. {
  16073. public:
  16074. virtual ~FilenameComponentListener() {}
  16075. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  16076. };
  16077. class JUCE_API FilenameComponent : public Component,
  16078. public SettableTooltipClient,
  16079. public FileDragAndDropTarget,
  16080. private AsyncUpdater,
  16081. private ButtonListener,
  16082. private ComboBoxListener
  16083. {
  16084. public:
  16085. FilenameComponent (const String& name,
  16086. const File& currentFile,
  16087. bool canEditFilename,
  16088. bool isDirectory,
  16089. bool isForSaving,
  16090. const String& fileBrowserWildcard,
  16091. const String& enforcedSuffix,
  16092. const String& textWhenNothingSelected);
  16093. ~FilenameComponent();
  16094. const File getCurrentFile() const;
  16095. void setCurrentFile (File newFile,
  16096. bool addToRecentlyUsedList,
  16097. bool sendChangeNotification = true);
  16098. void setFilenameIsEditable (bool shouldBeEditable);
  16099. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16100. const StringArray getRecentlyUsedFilenames() const;
  16101. void setRecentlyUsedFilenames (const StringArray& filenames);
  16102. void addRecentlyUsedFile (const File& file);
  16103. void setMaxNumberOfRecentFiles (int newMaximum);
  16104. void setBrowseButtonText (const String& browseButtonText);
  16105. void addListener (FilenameComponentListener* listener);
  16106. void removeListener (FilenameComponentListener* listener);
  16107. void setTooltip (const String& newTooltip);
  16108. void paintOverChildren (Graphics& g);
  16109. void resized();
  16110. void lookAndFeelChanged();
  16111. bool isInterestedInFileDrag (const StringArray& files);
  16112. void filesDropped (const StringArray& files, int, int);
  16113. void fileDragEnter (const StringArray& files, int, int);
  16114. void fileDragExit (const StringArray& files);
  16115. juce_UseDebuggingNewOperator
  16116. private:
  16117. ComboBox* filenameBox;
  16118. String lastFilename;
  16119. Button* browseButton;
  16120. int maxRecentFiles;
  16121. bool isDir, isSaving, isFileDragOver;
  16122. String wildcard, enforcedSuffix, browseButtonText;
  16123. ListenerList <FilenameComponentListener> listeners;
  16124. File defaultBrowseFile;
  16125. void comboBoxChanged (ComboBox*);
  16126. void buttonClicked (Button* button);
  16127. void handleAsyncUpdate();
  16128. FilenameComponent (const FilenameComponent&);
  16129. FilenameComponent& operator= (const FilenameComponent&);
  16130. };
  16131. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  16132. /*** End of inlined file: juce_FilenameComponent.h ***/
  16133. #endif
  16134. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  16135. #endif
  16136. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16137. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  16138. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16139. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16140. class JUCE_API FileSearchPathListComponent : public Component,
  16141. public SettableTooltipClient,
  16142. public FileDragAndDropTarget,
  16143. private ButtonListener,
  16144. private ListBoxModel
  16145. {
  16146. public:
  16147. FileSearchPathListComponent();
  16148. ~FileSearchPathListComponent();
  16149. const FileSearchPath& getPath() const throw() { return path; }
  16150. void setPath (const FileSearchPath& newPath);
  16151. void setDefaultBrowseTarget (const File& newDefaultDirectory);
  16152. enum ColourIds
  16153. {
  16154. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16155. Make this transparent if you don't want the background to be filled. */
  16156. };
  16157. int getNumRows();
  16158. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16159. void deleteKeyPressed (int lastRowSelected);
  16160. void returnKeyPressed (int lastRowSelected);
  16161. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16162. void selectedRowsChanged (int lastRowSelected);
  16163. void resized();
  16164. void paint (Graphics& g);
  16165. bool isInterestedInFileDrag (const StringArray& files);
  16166. void filesDropped (const StringArray& files, int, int);
  16167. void buttonClicked (Button* button);
  16168. juce_UseDebuggingNewOperator
  16169. private:
  16170. FileSearchPath path;
  16171. File defaultBrowseTarget;
  16172. ListBox* listBox;
  16173. Button* addButton;
  16174. Button* removeButton;
  16175. TextButton* changeButton;
  16176. DrawableButton* upButton;
  16177. DrawableButton* downButton;
  16178. void changed();
  16179. void updateButtons();
  16180. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16181. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16182. };
  16183. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16184. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16185. #endif
  16186. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16187. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16188. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16189. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16190. class JUCE_API FileTreeComponent : public TreeView,
  16191. public DirectoryContentsDisplayComponent
  16192. {
  16193. public:
  16194. FileTreeComponent (DirectoryContentsList& listToShow);
  16195. ~FileTreeComponent();
  16196. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16197. const File getSelectedFile (int index = 0) const;
  16198. void scrollToTop();
  16199. void setDragAndDropDescription (const String& description);
  16200. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16201. juce_UseDebuggingNewOperator
  16202. private:
  16203. String dragAndDropDescription;
  16204. FileTreeComponent (const FileTreeComponent&);
  16205. FileTreeComponent& operator= (const FileTreeComponent&);
  16206. };
  16207. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16208. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16209. #endif
  16210. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16211. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16212. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16213. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16214. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16215. private Timer
  16216. {
  16217. public:
  16218. ImagePreviewComponent();
  16219. ~ImagePreviewComponent();
  16220. void selectedFileChanged (const File& newSelectedFile);
  16221. void paint (Graphics& g);
  16222. void timerCallback();
  16223. juce_UseDebuggingNewOperator
  16224. private:
  16225. File fileToLoad;
  16226. ScopedPointer <Image> currentThumbnail;
  16227. String currentDetails;
  16228. void getThumbSize (int& w, int& h) const;
  16229. ImagePreviewComponent (const ImagePreviewComponent&);
  16230. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16231. };
  16232. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16233. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16234. #endif
  16235. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16236. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16237. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16238. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16239. class JUCE_API WildcardFileFilter : public FileFilter
  16240. {
  16241. public:
  16242. WildcardFileFilter (const String& fileWildcardPatterns,
  16243. const String& directoryWildcardPatterns,
  16244. const String& description);
  16245. ~WildcardFileFilter();
  16246. bool isFileSuitable (const File& file) const;
  16247. bool isDirectorySuitable (const File& file) const;
  16248. juce_UseDebuggingNewOperator
  16249. private:
  16250. StringArray fileWildcards, directoryWildcards;
  16251. static void parse (const String& pattern, StringArray& result);
  16252. static bool match (const File& file, const StringArray& wildcards);
  16253. };
  16254. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16255. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16256. #endif
  16257. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16258. #endif
  16259. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16260. #endif
  16261. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16262. #endif
  16263. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16264. #endif
  16265. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16266. #endif
  16267. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16268. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16269. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16270. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16271. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16272. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16273. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16274. class JUCE_API KeyPressMappingSet : public KeyListener,
  16275. public ChangeBroadcaster,
  16276. public FocusChangeListener
  16277. {
  16278. public:
  16279. explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);
  16280. KeyPressMappingSet (const KeyPressMappingSet& other);
  16281. ~KeyPressMappingSet();
  16282. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16283. const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
  16284. void addKeyPress (CommandID commandID,
  16285. const KeyPress& newKeyPress,
  16286. int insertIndex = -1);
  16287. void resetToDefaultMappings();
  16288. void resetToDefaultMapping (CommandID commandID);
  16289. void clearAllKeyPresses();
  16290. void clearAllKeyPresses (CommandID commandID);
  16291. void removeKeyPress (CommandID commandID, int keyPressIndex);
  16292. void removeKeyPress (const KeyPress& keypress);
  16293. bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();
  16294. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16295. bool restoreFromXml (const XmlElement& xmlVersion);
  16296. XmlElement* createXml (bool saveDifferencesFromDefaultSet) const;
  16297. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16298. bool keyStateChanged (bool isKeyDown, Component* originatingComponent);
  16299. void globalFocusChanged (Component* focusedComponent);
  16300. juce_UseDebuggingNewOperator
  16301. private:
  16302. ApplicationCommandManager* commandManager;
  16303. struct CommandMapping
  16304. {
  16305. CommandID commandID;
  16306. Array <KeyPress> keypresses;
  16307. bool wantsKeyUpDownCallbacks;
  16308. };
  16309. OwnedArray <CommandMapping> mappings;
  16310. struct KeyPressTime
  16311. {
  16312. KeyPress key;
  16313. uint32 timeWhenPressed;
  16314. };
  16315. OwnedArray <KeyPressTime> keysDown;
  16316. void handleMessage (const Message& message);
  16317. void invokeCommand (const CommandID commandID,
  16318. const KeyPress& keyPress,
  16319. const bool isKeyDown,
  16320. const int millisecsSinceKeyPressed,
  16321. Component* const originatingComponent) const;
  16322. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16323. };
  16324. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16325. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16326. class JUCE_API KeyMappingEditorComponent : public Component,
  16327. public TreeViewItem,
  16328. public ChangeListener,
  16329. private ButtonListener
  16330. {
  16331. public:
  16332. KeyMappingEditorComponent (KeyPressMappingSet* mappingSet,
  16333. bool showResetToDefaultButton);
  16334. virtual ~KeyMappingEditorComponent();
  16335. void setColours (const Colour& mainBackground,
  16336. const Colour& textColour);
  16337. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16338. virtual bool shouldCommandBeIncluded (CommandID commandID);
  16339. virtual bool isCommandReadOnly (CommandID commandID);
  16340. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16341. enum ColourIds
  16342. {
  16343. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16344. textColourId = 0x100ad01, /**< The colour for the text. */
  16345. };
  16346. void parentHierarchyChanged();
  16347. void resized();
  16348. void changeListenerCallback (void*);
  16349. bool mightContainSubItems();
  16350. const String getUniqueName() const;
  16351. void buttonClicked (Button* button);
  16352. juce_UseDebuggingNewOperator
  16353. private:
  16354. KeyPressMappingSet* mappings;
  16355. TreeView* tree;
  16356. friend class KeyMappingTreeViewItem;
  16357. friend class KeyCategoryTreeViewItem;
  16358. friend class KeyMappingItemComponent;
  16359. friend class KeyMappingChangeButton;
  16360. TextButton* resetButton;
  16361. void assignNewKey (CommandID commandID, int index);
  16362. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16363. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16364. };
  16365. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16366. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16367. #endif
  16368. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16369. #endif
  16370. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16371. #endif
  16372. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16373. #endif
  16374. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16375. #endif
  16376. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16377. #endif
  16378. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16379. #endif
  16380. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16381. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16382. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16383. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16384. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16385. {
  16386. public:
  16387. ComponentMovementWatcher (Component* component);
  16388. ~ComponentMovementWatcher();
  16389. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16390. virtual void componentPeerChanged() = 0;
  16391. juce_UseDebuggingNewOperator
  16392. void componentParentHierarchyChanged (Component& component);
  16393. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16394. private:
  16395. Component::SafePointer<Component> component;
  16396. ComponentPeer* lastPeer;
  16397. VoidArray registeredParentComps;
  16398. bool reentrant;
  16399. Rectangle<int> lastBounds;
  16400. void unregister() throw();
  16401. void registerWithParentComps() throw();
  16402. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16403. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16404. };
  16405. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16406. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16407. #endif
  16408. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16409. /*** Start of inlined file: juce_GroupComponent.h ***/
  16410. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16411. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16412. class JUCE_API GroupComponent : public Component
  16413. {
  16414. public:
  16415. GroupComponent (const String& componentName,
  16416. const String& labelText);
  16417. ~GroupComponent();
  16418. void setText (const String& newText);
  16419. const String getText() const;
  16420. void setTextLabelPosition (const Justification& justification);
  16421. const Justification getTextLabelPosition() const throw() { return justification; }
  16422. enum ColourIds
  16423. {
  16424. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16425. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16426. };
  16427. void paint (Graphics& g);
  16428. void enablementChanged();
  16429. void colourChanged();
  16430. private:
  16431. String text;
  16432. Justification justification;
  16433. GroupComponent (const GroupComponent&);
  16434. GroupComponent& operator= (const GroupComponent&);
  16435. };
  16436. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16437. /*** End of inlined file: juce_GroupComponent.h ***/
  16438. #endif
  16439. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16440. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16441. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16442. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16443. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16444. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16445. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16446. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16447. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16448. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16449. class TabbedButtonBar;
  16450. class JUCE_API TabBarButton : public Button
  16451. {
  16452. public:
  16453. TabBarButton (const String& name,
  16454. TabbedButtonBar* ownerBar,
  16455. int tabIndex);
  16456. ~TabBarButton();
  16457. virtual int getBestTabLength (int depth);
  16458. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16459. void clicked (const ModifierKeys& mods);
  16460. bool hitTest (int x, int y);
  16461. juce_UseDebuggingNewOperator
  16462. protected:
  16463. friend class TabbedButtonBar;
  16464. TabbedButtonBar* const owner;
  16465. int tabIndex, overlapPixels;
  16466. DropShadowEffect shadow;
  16467. void getActiveArea (int& x, int& y, int& w, int& h);
  16468. private:
  16469. TabBarButton (const TabBarButton&);
  16470. TabBarButton& operator= (const TabBarButton&);
  16471. };
  16472. class JUCE_API TabbedButtonBar : public Component,
  16473. public ChangeBroadcaster,
  16474. public ButtonListener
  16475. {
  16476. public:
  16477. enum Orientation
  16478. {
  16479. TabsAtTop,
  16480. TabsAtBottom,
  16481. TabsAtLeft,
  16482. TabsAtRight
  16483. };
  16484. TabbedButtonBar (Orientation orientation);
  16485. ~TabbedButtonBar();
  16486. void setOrientation (Orientation orientation);
  16487. Orientation getOrientation() const throw() { return orientation; }
  16488. void clearTabs();
  16489. void addTab (const String& tabName,
  16490. const Colour& tabBackgroundColour,
  16491. int insertIndex = -1);
  16492. void setTabName (int tabIndex,
  16493. const String& newName);
  16494. void removeTab (int tabIndex);
  16495. void moveTab (int currentIndex, int newIndex);
  16496. int getNumTabs() const;
  16497. const StringArray getTabNames() const;
  16498. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16499. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16500. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16501. TabBarButton* getTabButton (int index) const;
  16502. virtual void currentTabChanged (int newCurrentTabIndex,
  16503. const String& newCurrentTabName);
  16504. virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
  16505. const Colour getTabBackgroundColour (int tabIndex);
  16506. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16507. enum ColourIds
  16508. {
  16509. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16510. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16511. the look and feel will choose an appropriate colour. */
  16512. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16513. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16514. this isn't specified, the look and feel will choose an appropriate
  16515. colour. */
  16516. };
  16517. void resized();
  16518. void buttonClicked (Button* button);
  16519. void lookAndFeelChanged();
  16520. juce_UseDebuggingNewOperator
  16521. protected:
  16522. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16523. private:
  16524. Orientation orientation;
  16525. StringArray tabs;
  16526. Array <Colour> tabColours;
  16527. int currentTabIndex;
  16528. Component* behindFrontTab;
  16529. Button* extraTabsButton;
  16530. TabbedButtonBar (const TabbedButtonBar&);
  16531. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16532. };
  16533. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16534. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16535. class JUCE_API TabbedComponent : public Component
  16536. {
  16537. public:
  16538. explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
  16539. ~TabbedComponent();
  16540. void setOrientation (TabbedButtonBar::Orientation orientation);
  16541. TabbedButtonBar::Orientation getOrientation() const throw();
  16542. void setTabBarDepth (int newDepth);
  16543. int getTabBarDepth() const throw() { return tabDepth; }
  16544. void setOutline (int newThickness);
  16545. void setIndent (int indentThickness);
  16546. void clearTabs();
  16547. void addTab (const String& tabName,
  16548. const Colour& tabBackgroundColour,
  16549. Component* contentComponent,
  16550. bool deleteComponentWhenNotNeeded,
  16551. int insertIndex = -1);
  16552. void setTabName (int tabIndex, const String& newName);
  16553. void removeTab (int tabIndex);
  16554. int getNumTabs() const;
  16555. const StringArray getTabNames() const;
  16556. Component* getTabContentComponent (int tabIndex) const throw();
  16557. const Colour getTabBackgroundColour (int tabIndex) const throw();
  16558. void setTabBackgroundColour (int tabIndex, const Colour& newColour);
  16559. void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
  16560. int getCurrentTabIndex() const;
  16561. const String& getCurrentTabName() const;
  16562. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16563. virtual void currentTabChanged (int newCurrentTabIndex,
  16564. const String& newCurrentTabName);
  16565. virtual void popupMenuClickOnTab (int tabIndex,
  16566. const String& tabName);
  16567. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16568. enum ColourIds
  16569. {
  16570. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16571. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16572. (See setOutline) */
  16573. };
  16574. void paint (Graphics& g);
  16575. void resized();
  16576. void lookAndFeelChanged();
  16577. juce_UseDebuggingNewOperator
  16578. protected:
  16579. TabbedButtonBar* tabs;
  16580. virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
  16581. private:
  16582. Array <Component*> contentComponents;
  16583. Component* panelComponent;
  16584. int tabDepth;
  16585. int outlineThickness, edgeIndent;
  16586. friend class TabCompButtonBar;
  16587. void changeCallback (int newCurrentTabIndex, const String& newTabName);
  16588. TabbedComponent (const TabbedComponent&);
  16589. TabbedComponent& operator= (const TabbedComponent&);
  16590. };
  16591. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16592. /*** End of inlined file: juce_TabbedComponent.h ***/
  16593. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16594. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16595. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16596. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16597. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16598. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16599. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16600. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16601. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16602. class MenuBarModel;
  16603. class JUCE_API MenuBarModelListener
  16604. {
  16605. public:
  16606. virtual ~MenuBarModelListener() {}
  16607. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16608. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16609. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16610. };
  16611. class JUCE_API MenuBarModel : private AsyncUpdater,
  16612. private ApplicationCommandManagerListener
  16613. {
  16614. public:
  16615. MenuBarModel() throw();
  16616. virtual ~MenuBarModel();
  16617. void menuItemsChanged();
  16618. void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager) throw();
  16619. void addListener (MenuBarModelListener* listenerToAdd) throw();
  16620. void removeListener (MenuBarModelListener* listenerToRemove) throw();
  16621. virtual const StringArray getMenuBarNames() = 0;
  16622. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16623. const String& menuName) = 0;
  16624. virtual void menuItemSelected (int menuItemID,
  16625. int topLevelMenuIndex) = 0;
  16626. #if JUCE_MAC || DOXYGEN
  16627. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16628. const PopupMenu* extraAppleMenuItems = 0);
  16629. static MenuBarModel* getMacMainMenu();
  16630. #endif
  16631. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16632. void applicationCommandListChanged();
  16633. void handleAsyncUpdate();
  16634. juce_UseDebuggingNewOperator
  16635. private:
  16636. ApplicationCommandManager* manager;
  16637. ListenerList <MenuBarModelListener> listeners;
  16638. MenuBarModel (const MenuBarModel&);
  16639. MenuBarModel& operator= (const MenuBarModel&);
  16640. };
  16641. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16642. /*** End of inlined file: juce_MenuBarModel.h ***/
  16643. class JUCE_API MenuBarComponent : public Component,
  16644. private MenuBarModelListener,
  16645. private Timer
  16646. {
  16647. public:
  16648. MenuBarComponent (MenuBarModel* model);
  16649. ~MenuBarComponent();
  16650. void setModel (MenuBarModel* newModel);
  16651. void showMenu (int menuIndex);
  16652. void paint (Graphics& g);
  16653. void resized();
  16654. void mouseEnter (const MouseEvent& e);
  16655. void mouseExit (const MouseEvent& e);
  16656. void mouseDown (const MouseEvent& e);
  16657. void mouseDrag (const MouseEvent& e);
  16658. void mouseUp (const MouseEvent& e);
  16659. void mouseMove (const MouseEvent& e);
  16660. void inputAttemptWhenModal();
  16661. void handleCommandMessage (int commandId);
  16662. bool keyPressed (const KeyPress& key);
  16663. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16664. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16665. const ApplicationCommandTarget::InvocationInfo& info);
  16666. juce_UseDebuggingNewOperator
  16667. private:
  16668. MenuBarModel* model;
  16669. StringArray menuNames;
  16670. Array <int> xPositions;
  16671. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16672. int lastMouseX, lastMouseY;
  16673. bool inModalState;
  16674. ScopedPointer <Component> currentPopup;
  16675. int getItemAt (int x, int y);
  16676. void updateItemUnderMouse (int x, int y);
  16677. void hideCurrentMenu();
  16678. void timerCallback();
  16679. void repaintMenuItem (int index);
  16680. MenuBarComponent (const MenuBarComponent&);
  16681. MenuBarComponent& operator= (const MenuBarComponent&);
  16682. };
  16683. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16684. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16685. class JUCE_API DocumentWindow : public ResizableWindow
  16686. {
  16687. public:
  16688. enum TitleBarButtons
  16689. {
  16690. minimiseButton = 1,
  16691. maximiseButton = 2,
  16692. closeButton = 4,
  16693. allButtons = 7
  16694. };
  16695. DocumentWindow (const String& name,
  16696. const Colour& backgroundColour,
  16697. int requiredButtons,
  16698. bool addToDesktop = true);
  16699. ~DocumentWindow();
  16700. void setName (const String& newName);
  16701. void setIcon (const Image* imageToUse);
  16702. void setTitleBarHeight (int newHeight);
  16703. int getTitleBarHeight() const;
  16704. void setTitleBarButtonsRequired (int requiredButtons,
  16705. bool positionTitleBarButtonsOnLeft);
  16706. void setTitleBarTextCentred (bool textShouldBeCentred);
  16707. void setMenuBar (MenuBarModel* menuBarModel,
  16708. int menuBarHeight = 0);
  16709. virtual void closeButtonPressed();
  16710. virtual void minimiseButtonPressed();
  16711. virtual void maximiseButtonPressed();
  16712. Button* getCloseButton() const throw();
  16713. Button* getMinimiseButton() const throw();
  16714. Button* getMaximiseButton() const throw();
  16715. enum ColourIds
  16716. {
  16717. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16718. and feel class how this is used. */
  16719. };
  16720. void paint (Graphics& g);
  16721. void resized();
  16722. void lookAndFeelChanged();
  16723. const BorderSize getBorderThickness();
  16724. const BorderSize getContentComponentBorder();
  16725. void mouseDoubleClick (const MouseEvent& e);
  16726. void userTriedToCloseWindow();
  16727. void activeWindowStatusChanged();
  16728. int getDesktopWindowStyleFlags() const;
  16729. void parentHierarchyChanged();
  16730. const Rectangle<int> getTitleBarArea();
  16731. juce_UseDebuggingNewOperator
  16732. private:
  16733. int titleBarHeight, menuBarHeight, requiredButtons;
  16734. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16735. ScopedPointer <Button> titleBarButtons [3];
  16736. ScopedPointer <Image> titleBarIcon;
  16737. ScopedPointer <MenuBarComponent> menuBar;
  16738. MenuBarModel* menuBarModel;
  16739. class ButtonListenerProxy;
  16740. friend class ScopedPointer <ButtonListenerProxy>;
  16741. ScopedPointer <ButtonListenerProxy> buttonListener;
  16742. void repaintTitleBar();
  16743. DocumentWindow (const DocumentWindow&);
  16744. DocumentWindow& operator= (const DocumentWindow&);
  16745. };
  16746. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16747. /*** End of inlined file: juce_DocumentWindow.h ***/
  16748. class MultiDocumentPanel;
  16749. class MDITabbedComponentInternal;
  16750. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16751. {
  16752. public:
  16753. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16754. ~MultiDocumentPanelWindow();
  16755. void maximiseButtonPressed();
  16756. void closeButtonPressed();
  16757. void activeWindowStatusChanged();
  16758. void broughtToFront();
  16759. juce_UseDebuggingNewOperator
  16760. private:
  16761. void updateOrder();
  16762. MultiDocumentPanel* getOwner() const throw();
  16763. };
  16764. class JUCE_API MultiDocumentPanel : public Component,
  16765. private ComponentListener
  16766. {
  16767. public:
  16768. MultiDocumentPanel();
  16769. ~MultiDocumentPanel();
  16770. bool closeAllDocuments (bool checkItsOkToCloseFirst);
  16771. bool addDocument (Component* component,
  16772. const Colour& backgroundColour,
  16773. bool deleteWhenRemoved);
  16774. bool closeDocument (Component* component,
  16775. bool checkItsOkToCloseFirst);
  16776. int getNumDocuments() const throw();
  16777. Component* getDocument (int index) const throw();
  16778. Component* getActiveDocument() const throw();
  16779. void setActiveDocument (Component* component);
  16780. virtual void activeDocumentChanged();
  16781. void setMaximumNumDocuments (int maximumNumDocuments);
  16782. void useFullscreenWhenOneDocument (bool shouldUseTabs);
  16783. bool isFullscreenWhenOneDocument() const throw();
  16784. enum LayoutMode
  16785. {
  16786. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16787. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16788. };
  16789. void setLayoutMode (LayoutMode newLayoutMode);
  16790. LayoutMode getLayoutMode() const throw() { return mode; }
  16791. void setBackgroundColour (const Colour& newBackgroundColour);
  16792. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16793. virtual bool tryToCloseDocument (Component* component) = 0;
  16794. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16795. void paint (Graphics& g);
  16796. void resized();
  16797. void componentNameChanged (Component&);
  16798. juce_UseDebuggingNewOperator
  16799. private:
  16800. LayoutMode mode;
  16801. Array <Component*> components;
  16802. TabbedComponent* tabComponent;
  16803. Colour backgroundColour;
  16804. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16805. friend class MultiDocumentPanelWindow;
  16806. friend class MDITabbedComponentInternal;
  16807. Component* getContainerComp (Component* c) const;
  16808. void updateOrder();
  16809. void addWindow (Component* component);
  16810. };
  16811. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16812. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16813. #endif
  16814. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16815. #endif
  16816. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16817. #endif
  16818. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16819. #endif
  16820. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16821. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16822. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16823. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16824. class JUCE_API StretchableLayoutManager
  16825. {
  16826. public:
  16827. StretchableLayoutManager();
  16828. ~StretchableLayoutManager();
  16829. void setItemLayout (int itemIndex,
  16830. double minimumSize,
  16831. double maximumSize,
  16832. double preferredSize);
  16833. bool getItemLayout (int itemIndex,
  16834. double& minimumSize,
  16835. double& maximumSize,
  16836. double& preferredSize) const;
  16837. void clearAllItems();
  16838. void layOutComponents (Component** components,
  16839. int numComponents,
  16840. int x, int y, int width, int height,
  16841. bool vertically,
  16842. bool resizeOtherDimension);
  16843. int getItemCurrentPosition (int itemIndex) const;
  16844. int getItemCurrentAbsoluteSize (int itemIndex) const;
  16845. double getItemCurrentRelativeSize (int itemIndex) const;
  16846. void setItemPosition (int itemIndex,
  16847. int newPosition);
  16848. juce_UseDebuggingNewOperator
  16849. private:
  16850. struct ItemLayoutProperties
  16851. {
  16852. int itemIndex;
  16853. int currentSize;
  16854. double minSize, maxSize, preferredSize;
  16855. };
  16856. OwnedArray <ItemLayoutProperties> items;
  16857. int totalSize;
  16858. static int sizeToRealSize (double size, int totalSpace);
  16859. ItemLayoutProperties* getInfoFor (int itemIndex) const;
  16860. void setTotalSize (int newTotalSize);
  16861. int fitComponentsIntoSpace (int startIndex, int endIndex, int availableSpace, int startPos);
  16862. int getMinimumSizeOfItems (int startIndex, int endIndex) const;
  16863. int getMaximumSizeOfItems (int startIndex, int endIndex) const;
  16864. void updatePrefSizesToMatchCurrentPositions();
  16865. StretchableLayoutManager (const StretchableLayoutManager&);
  16866. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16867. };
  16868. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16869. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16870. #endif
  16871. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16872. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16873. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16874. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16875. class JUCE_API StretchableLayoutResizerBar : public Component
  16876. {
  16877. public:
  16878. StretchableLayoutResizerBar (StretchableLayoutManager* layoutToUse,
  16879. int itemIndexInLayout,
  16880. bool isBarVertical);
  16881. ~StretchableLayoutResizerBar();
  16882. virtual void hasBeenMoved();
  16883. void paint (Graphics& g);
  16884. void mouseDown (const MouseEvent& e);
  16885. void mouseDrag (const MouseEvent& e);
  16886. juce_UseDebuggingNewOperator
  16887. private:
  16888. StretchableLayoutManager* layout;
  16889. int itemIndex, mouseDownPos;
  16890. bool isVertical;
  16891. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16892. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16893. };
  16894. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16895. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16896. #endif
  16897. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16898. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16899. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16900. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16901. class StretchableObjectResizer
  16902. {
  16903. public:
  16904. StretchableObjectResizer();
  16905. ~StretchableObjectResizer();
  16906. void addItem (double currentSize,
  16907. double minSize,
  16908. double maxSize,
  16909. int order = 0);
  16910. void resizeToFit (double targetSize);
  16911. int getNumItems() const throw() { return items.size(); }
  16912. double getItemSize (int index) const throw();
  16913. juce_UseDebuggingNewOperator
  16914. private:
  16915. struct Item
  16916. {
  16917. double size;
  16918. double minSize;
  16919. double maxSize;
  16920. int order;
  16921. };
  16922. OwnedArray <Item> items;
  16923. StretchableObjectResizer (const StretchableObjectResizer&);
  16924. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16925. };
  16926. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16927. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16928. #endif
  16929. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16930. #endif
  16931. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16932. #endif
  16933. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16934. #endif
  16935. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16936. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16937. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16938. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16939. /*** Start of inlined file: juce_AlertWindow.h ***/
  16940. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16941. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16942. /*** Start of inlined file: juce_TextLayout.h ***/
  16943. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16944. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16945. class Graphics;
  16946. class JUCE_API TextLayout
  16947. {
  16948. public:
  16949. TextLayout();
  16950. TextLayout (const TextLayout& other);
  16951. TextLayout (const String& text, const Font& font);
  16952. ~TextLayout();
  16953. TextLayout& operator= (const TextLayout& layoutToCopy);
  16954. void clear();
  16955. void appendText (const String& textToAppend,
  16956. const Font& fontToUse);
  16957. void setText (const String& newText,
  16958. const Font& fontToUse);
  16959. void layout (int maximumWidth,
  16960. const Justification& justification,
  16961. bool attemptToBalanceLineLengths);
  16962. int getWidth() const;
  16963. int getHeight() const;
  16964. int getNumLines() const { return totalLines; }
  16965. int getLineWidth (int lineNumber) const;
  16966. void draw (Graphics& g, int topLeftX, int topLeftY) const;
  16967. void drawWithin (Graphics& g,
  16968. int x, int y, int w, int h,
  16969. const Justification& layoutFlags) const;
  16970. juce_UseDebuggingNewOperator
  16971. private:
  16972. class Token;
  16973. friend class OwnedArray <Token>;
  16974. OwnedArray <Token> tokens;
  16975. int totalLines;
  16976. };
  16977. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16978. /*** End of inlined file: juce_TextLayout.h ***/
  16979. class JUCE_API AlertWindow : public TopLevelWindow,
  16980. private ButtonListener
  16981. {
  16982. public:
  16983. enum AlertIconType
  16984. {
  16985. NoIcon, /**< No icon will be shown on the dialog box. */
  16986. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16987. user to answer a question. */
  16988. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16989. warning about something and shouldn't be ignored. */
  16990. InfoIcon /**< An icon that indicates that the dialog box is just
  16991. giving the user some information, which doesn't require
  16992. a response from them. */
  16993. };
  16994. AlertWindow (const String& title,
  16995. const String& message,
  16996. AlertIconType iconType,
  16997. Component* associatedComponent = 0);
  16998. ~AlertWindow();
  16999. AlertIconType getAlertType() const throw() { return alertIconType; }
  17000. void setMessage (const String& message);
  17001. void addButton (const String& name,
  17002. int returnValue,
  17003. const KeyPress& shortcutKey1 = KeyPress(),
  17004. const KeyPress& shortcutKey2 = KeyPress());
  17005. int getNumButtons() const;
  17006. void addTextEditor (const String& name,
  17007. const String& initialContents,
  17008. const String& onScreenLabel = String::empty,
  17009. bool isPasswordBox = false);
  17010. const String getTextEditorContents (const String& nameOfTextEditor) const;
  17011. void addComboBox (const String& name,
  17012. const StringArray& items,
  17013. const String& onScreenLabel = String::empty);
  17014. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  17015. void addTextBlock (const String& text);
  17016. void addProgressBarComponent (double& progressValue);
  17017. void addCustomComponent (Component* component);
  17018. int getNumCustomComponents() const;
  17019. Component* getCustomComponent (int index) const;
  17020. Component* removeCustomComponent (int index);
  17021. bool containsAnyExtraComponents() const;
  17022. // easy-to-use message box functions:
  17023. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  17024. const String& title,
  17025. const String& message,
  17026. const String& buttonText = String::empty,
  17027. Component* associatedComponent = 0);
  17028. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  17029. const String& title,
  17030. const String& message,
  17031. const String& button1Text = String::empty,
  17032. const String& button2Text = String::empty,
  17033. Component* associatedComponent = 0);
  17034. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  17035. const String& title,
  17036. const String& message,
  17037. const String& button1Text = String::empty,
  17038. const String& button2Text = String::empty,
  17039. const String& button3Text = String::empty,
  17040. Component* associatedComponent = 0);
  17041. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  17042. const String& bodyText,
  17043. bool isOkCancel);
  17044. enum ColourIds
  17045. {
  17046. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  17047. textColourId = 0x1001810, /**< The colour for the text. */
  17048. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  17049. };
  17050. juce_UseDebuggingNewOperator
  17051. protected:
  17052. void paint (Graphics& g);
  17053. void mouseDown (const MouseEvent& e);
  17054. void mouseDrag (const MouseEvent& e);
  17055. bool keyPressed (const KeyPress& key);
  17056. void buttonClicked (Button* button);
  17057. void lookAndFeelChanged();
  17058. void userTriedToCloseWindow();
  17059. int getDesktopWindowStyleFlags() const;
  17060. private:
  17061. String text;
  17062. TextLayout textLayout;
  17063. AlertIconType alertIconType;
  17064. ComponentBoundsConstrainer constrainer;
  17065. ComponentDragger dragger;
  17066. Rectangle<int> textArea;
  17067. VoidArray buttons, textBoxes, comboBoxes;
  17068. VoidArray progressBars, customComps, textBlocks, allComps;
  17069. StringArray textboxNames, comboBoxNames;
  17070. Font font;
  17071. Component* associatedComponent;
  17072. void updateLayout (bool onlyIncreaseSize);
  17073. // disable copy constructor
  17074. AlertWindow (const AlertWindow&);
  17075. AlertWindow& operator= (const AlertWindow&);
  17076. };
  17077. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  17078. /*** End of inlined file: juce_AlertWindow.h ***/
  17079. class ToggleButton;
  17080. class TextButton;
  17081. class AlertWindow;
  17082. class TextLayout;
  17083. class ScrollBar;
  17084. class BubbleComponent;
  17085. class ComboBox;
  17086. class Button;
  17087. class FilenameComponent;
  17088. class DocumentWindow;
  17089. class ResizableWindow;
  17090. class GroupComponent;
  17091. class MenuBarComponent;
  17092. class DropShadower;
  17093. class GlyphArrangement;
  17094. class PropertyComponent;
  17095. class TableHeaderComponent;
  17096. class Toolbar;
  17097. class ToolbarItemComponent;
  17098. class PopupMenu;
  17099. class ProgressBar;
  17100. class FileBrowserComponent;
  17101. class DirectoryContentsDisplayComponent;
  17102. class FilePreviewComponent;
  17103. class ImageButton;
  17104. class JUCE_API LookAndFeel
  17105. {
  17106. public:
  17107. LookAndFeel();
  17108. virtual ~LookAndFeel();
  17109. static LookAndFeel& getDefaultLookAndFeel() throw();
  17110. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  17111. const Colour findColour (int colourId) const throw();
  17112. void setColour (int colourId, const Colour& colour) throw();
  17113. bool isColourSpecified (int colourId) const throw();
  17114. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  17115. void setDefaultSansSerifTypefaceName (const String& newName);
  17116. virtual const MouseCursor getMouseCursorFor (Component& component);
  17117. virtual void drawButtonBackground (Graphics& g,
  17118. Button& button,
  17119. const Colour& backgroundColour,
  17120. bool isMouseOverButton,
  17121. bool isButtonDown);
  17122. virtual const Font getFontForTextButton (TextButton& button);
  17123. virtual void drawButtonText (Graphics& g,
  17124. TextButton& button,
  17125. bool isMouseOverButton,
  17126. bool isButtonDown);
  17127. virtual void drawToggleButton (Graphics& g,
  17128. ToggleButton& button,
  17129. bool isMouseOverButton,
  17130. bool isButtonDown);
  17131. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  17132. virtual void drawTickBox (Graphics& g,
  17133. Component& component,
  17134. float x, float y, float w, float h,
  17135. bool ticked,
  17136. bool isEnabled,
  17137. bool isMouseOverButton,
  17138. bool isButtonDown);
  17139. virtual AlertWindow* createAlertWindow (const String& title,
  17140. const String& message,
  17141. const String& button1,
  17142. const String& button2,
  17143. const String& button3,
  17144. AlertWindow::AlertIconType iconType,
  17145. int numButtons,
  17146. Component* associatedComponent);
  17147. virtual void drawAlertBox (Graphics& g,
  17148. AlertWindow& alert,
  17149. const Rectangle<int>& textArea,
  17150. TextLayout& textLayout);
  17151. virtual int getAlertBoxWindowFlags();
  17152. virtual int getAlertWindowButtonHeight();
  17153. virtual const Font getAlertWindowFont();
  17154. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17155. int width, int height,
  17156. double progress, const String& textToShow);
  17157. // Draws a small image that spins to indicate that something's happening..
  17158. // This method should use the current time to animate itself, so just keep
  17159. // repainting it every so often.
  17160. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17161. int x, int y, int w, int h);
  17162. virtual void drawScrollbarButton (Graphics& g,
  17163. ScrollBar& scrollbar,
  17164. int width, int height,
  17165. int buttonDirection,
  17166. bool isScrollbarVertical,
  17167. bool isMouseOverButton,
  17168. bool isButtonDown);
  17169. virtual void drawScrollbar (Graphics& g,
  17170. ScrollBar& scrollbar,
  17171. int x, int y,
  17172. int width, int height,
  17173. bool isScrollbarVertical,
  17174. int thumbStartPosition,
  17175. int thumbSize,
  17176. bool isMouseOver,
  17177. bool isMouseDown);
  17178. virtual ImageEffectFilter* getScrollbarEffect();
  17179. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17180. virtual int getDefaultScrollbarWidth();
  17181. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17182. virtual const Path getTickShape (float height);
  17183. virtual const Path getCrossShape (float height);
  17184. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17185. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17186. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17187. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17188. virtual Image* getDefaultFolderImage();
  17189. virtual Image* getDefaultDocumentFileImage();
  17190. virtual void createFileChooserHeaderText (const String& title,
  17191. const String& instructions,
  17192. GlyphArrangement& destArrangement,
  17193. int width);
  17194. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17195. const String& filename, Image* icon,
  17196. const String& fileSizeDescription,
  17197. const String& fileTimeDescription,
  17198. bool isDirectory,
  17199. bool isItemSelected,
  17200. int itemIndex);
  17201. virtual Button* createFileBrowserGoUpButton();
  17202. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17203. DirectoryContentsDisplayComponent* fileListComponent,
  17204. FilePreviewComponent* previewComp,
  17205. ComboBox* currentPathBox,
  17206. TextEditor* filenameBox,
  17207. Button* goUpButton);
  17208. virtual void drawBubble (Graphics& g,
  17209. float tipX, float tipY,
  17210. float boxX, float boxY, float boxW, float boxH);
  17211. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17212. virtual void drawPopupMenuItem (Graphics& g,
  17213. int width, int height,
  17214. bool isSeparator,
  17215. bool isActive,
  17216. bool isHighlighted,
  17217. bool isTicked,
  17218. bool hasSubMenu,
  17219. const String& text,
  17220. const String& shortcutKeyText,
  17221. Image* image,
  17222. const Colour* const textColour);
  17223. virtual const Font getPopupMenuFont();
  17224. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17225. int width, int height,
  17226. bool isScrollUpArrow);
  17227. virtual void getIdealPopupMenuItemSize (const String& text,
  17228. bool isSeparator,
  17229. int standardMenuItemHeight,
  17230. int& idealWidth,
  17231. int& idealHeight);
  17232. virtual int getMenuWindowFlags();
  17233. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17234. bool isMouseOverBar,
  17235. MenuBarComponent& menuBar);
  17236. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17237. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17238. virtual void drawMenuBarItem (Graphics& g,
  17239. int width, int height,
  17240. int itemIndex,
  17241. const String& itemText,
  17242. bool isMouseOverItem,
  17243. bool isMenuOpen,
  17244. bool isMouseOverBar,
  17245. MenuBarComponent& menuBar);
  17246. virtual void drawComboBox (Graphics& g, int width, int height,
  17247. bool isButtonDown,
  17248. int buttonX, int buttonY,
  17249. int buttonW, int buttonH,
  17250. ComboBox& box);
  17251. virtual const Font getComboBoxFont (ComboBox& box);
  17252. virtual Label* createComboBoxTextBox (ComboBox& box);
  17253. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17254. virtual void drawLabel (Graphics& g, Label& label);
  17255. virtual void drawLinearSlider (Graphics& g,
  17256. int x, int y,
  17257. int width, int height,
  17258. float sliderPos,
  17259. float minSliderPos,
  17260. float maxSliderPos,
  17261. const Slider::SliderStyle style,
  17262. Slider& slider);
  17263. virtual void drawLinearSliderBackground (Graphics& g,
  17264. int x, int y,
  17265. int width, int height,
  17266. float sliderPos,
  17267. float minSliderPos,
  17268. float maxSliderPos,
  17269. const Slider::SliderStyle style,
  17270. Slider& slider);
  17271. virtual void drawLinearSliderThumb (Graphics& g,
  17272. int x, int y,
  17273. int width, int height,
  17274. float sliderPos,
  17275. float minSliderPos,
  17276. float maxSliderPos,
  17277. const Slider::SliderStyle style,
  17278. Slider& slider);
  17279. virtual int getSliderThumbRadius (Slider& slider);
  17280. virtual void drawRotarySlider (Graphics& g,
  17281. int x, int y,
  17282. int width, int height,
  17283. float sliderPosProportional,
  17284. float rotaryStartAngle,
  17285. float rotaryEndAngle,
  17286. Slider& slider);
  17287. virtual Button* createSliderButton (bool isIncrement);
  17288. virtual Label* createSliderTextBox (Slider& slider);
  17289. virtual ImageEffectFilter* getSliderEffect();
  17290. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17291. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17292. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17293. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17294. ComboBox* filenameBox, Button* browseButton);
  17295. virtual void drawCornerResizer (Graphics& g,
  17296. int w, int h,
  17297. bool isMouseOver,
  17298. bool isMouseDragging);
  17299. virtual void drawResizableFrame (Graphics& g,
  17300. int w, int h,
  17301. const BorderSize& borders);
  17302. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17303. const BorderSize& border,
  17304. ResizableWindow& window);
  17305. virtual void drawResizableWindowBorder (Graphics& g,
  17306. int w, int h,
  17307. const BorderSize& border,
  17308. ResizableWindow& window);
  17309. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17310. Graphics& g, int w, int h,
  17311. int titleSpaceX, int titleSpaceW,
  17312. const Image* icon,
  17313. bool drawTitleTextOnLeft);
  17314. virtual Button* createDocumentWindowButton (int buttonType);
  17315. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17316. int titleBarX, int titleBarY,
  17317. int titleBarW, int titleBarH,
  17318. Button* minimiseButton,
  17319. Button* maximiseButton,
  17320. Button* closeButton,
  17321. bool positionTitleBarButtonsOnLeft);
  17322. virtual int getDefaultMenuBarHeight();
  17323. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17324. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17325. int w, int h,
  17326. bool isVerticalBar,
  17327. bool isMouseOver,
  17328. bool isMouseDragging);
  17329. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17330. const String& text,
  17331. const Justification& position,
  17332. GroupComponent& group);
  17333. virtual void createTabButtonShape (Path& p,
  17334. int width, int height,
  17335. int tabIndex,
  17336. const String& text,
  17337. Button& button,
  17338. TabbedButtonBar::Orientation orientation,
  17339. bool isMouseOver,
  17340. bool isMouseDown,
  17341. bool isFrontTab);
  17342. virtual void fillTabButtonShape (Graphics& g,
  17343. const Path& path,
  17344. const Colour& preferredBackgroundColour,
  17345. int tabIndex,
  17346. const String& text,
  17347. Button& button,
  17348. TabbedButtonBar::Orientation orientation,
  17349. bool isMouseOver,
  17350. bool isMouseDown,
  17351. bool isFrontTab);
  17352. virtual void drawTabButtonText (Graphics& g,
  17353. int x, int y, int w, int h,
  17354. const Colour& preferredBackgroundColour,
  17355. int tabIndex,
  17356. const String& text,
  17357. Button& button,
  17358. TabbedButtonBar::Orientation orientation,
  17359. bool isMouseOver,
  17360. bool isMouseDown,
  17361. bool isFrontTab);
  17362. virtual int getTabButtonOverlap (int tabDepth);
  17363. virtual int getTabButtonSpaceAroundImage();
  17364. virtual int getTabButtonBestWidth (int tabIndex,
  17365. const String& text,
  17366. int tabDepth,
  17367. Button& button);
  17368. virtual void drawTabButton (Graphics& g,
  17369. int w, int h,
  17370. const Colour& preferredColour,
  17371. int tabIndex,
  17372. const String& text,
  17373. Button& button,
  17374. TabbedButtonBar::Orientation orientation,
  17375. bool isMouseOver,
  17376. bool isMouseDown,
  17377. bool isFrontTab);
  17378. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17379. int w, int h,
  17380. TabbedButtonBar& tabBar,
  17381. TabbedButtonBar::Orientation orientation);
  17382. virtual Button* createTabBarExtrasButton();
  17383. virtual void drawImageButton (Graphics& g, Image* image,
  17384. int imageX, int imageY, int imageW, int imageH,
  17385. const Colour& overlayColour,
  17386. float imageOpacity,
  17387. ImageButton& button);
  17388. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17389. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17390. int width, int height,
  17391. bool isMouseOver, bool isMouseDown,
  17392. int columnFlags);
  17393. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17394. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17395. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17396. bool isMouseOver, bool isMouseDown,
  17397. ToolbarItemComponent& component);
  17398. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17399. const String& text, ToolbarItemComponent& component);
  17400. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17401. bool isOpen, int width, int height);
  17402. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17403. PropertyComponent& component);
  17404. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17405. PropertyComponent& component);
  17406. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17407. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17408. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17409. virtual void playAlertSound();
  17410. static void drawGlassSphere (Graphics& g,
  17411. float x, float y,
  17412. float diameter,
  17413. const Colour& colour,
  17414. float outlineThickness) throw();
  17415. static void drawGlassPointer (Graphics& g,
  17416. float x, float y,
  17417. float diameter,
  17418. const Colour& colour, float outlineThickness,
  17419. int direction) throw();
  17420. static void drawGlassLozenge (Graphics& g,
  17421. float x, float y,
  17422. float width, float height,
  17423. const Colour& colour,
  17424. float outlineThickness,
  17425. float cornerSize,
  17426. bool flatOnLeft, bool flatOnRight,
  17427. bool flatOnTop, bool flatOnBottom) throw();
  17428. juce_UseDebuggingNewOperator
  17429. private:
  17430. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17431. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17432. Array <int> colourIds;
  17433. Array <Colour> colours;
  17434. // default typeface names
  17435. String defaultSans, defaultSerif, defaultFixed;
  17436. void drawShinyButtonShape (Graphics& g,
  17437. float x, float y, float w, float h, float maxCornerSize,
  17438. const Colour& baseColour,
  17439. float strokeWidth,
  17440. bool flatOnLeft,
  17441. bool flatOnRight,
  17442. bool flatOnTop,
  17443. bool flatOnBottom) throw();
  17444. LookAndFeel (const LookAndFeel&);
  17445. LookAndFeel& operator= (const LookAndFeel&);
  17446. };
  17447. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17448. /*** End of inlined file: juce_LookAndFeel.h ***/
  17449. #endif
  17450. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17451. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17452. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17453. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17454. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17455. {
  17456. public:
  17457. OldSchoolLookAndFeel();
  17458. virtual ~OldSchoolLookAndFeel();
  17459. virtual void drawButtonBackground (Graphics& g,
  17460. Button& button,
  17461. const Colour& backgroundColour,
  17462. bool isMouseOverButton,
  17463. bool isButtonDown);
  17464. virtual void drawToggleButton (Graphics& g,
  17465. ToggleButton& button,
  17466. bool isMouseOverButton,
  17467. bool isButtonDown);
  17468. virtual void drawTickBox (Graphics& g,
  17469. Component& component,
  17470. float x, float y, float w, float h,
  17471. bool ticked,
  17472. bool isEnabled,
  17473. bool isMouseOverButton,
  17474. bool isButtonDown);
  17475. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17476. int width, int height,
  17477. double progress, const String& textToShow);
  17478. virtual void drawScrollbarButton (Graphics& g,
  17479. ScrollBar& scrollbar,
  17480. int width, int height,
  17481. int buttonDirection,
  17482. bool isScrollbarVertical,
  17483. bool isMouseOverButton,
  17484. bool isButtonDown);
  17485. virtual void drawScrollbar (Graphics& g,
  17486. ScrollBar& scrollbar,
  17487. int x, int y,
  17488. int width, int height,
  17489. bool isScrollbarVertical,
  17490. int thumbStartPosition,
  17491. int thumbSize,
  17492. bool isMouseOver,
  17493. bool isMouseDown);
  17494. virtual ImageEffectFilter* getScrollbarEffect();
  17495. virtual void drawTextEditorOutline (Graphics& g,
  17496. int width, int height,
  17497. TextEditor& textEditor);
  17498. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17499. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17500. bool isMouseOverBar,
  17501. MenuBarComponent& menuBar);
  17502. virtual void drawComboBox (Graphics& g, int width, int height,
  17503. bool isButtonDown,
  17504. int buttonX, int buttonY,
  17505. int buttonW, int buttonH,
  17506. ComboBox& box);
  17507. virtual const Font getComboBoxFont (ComboBox& box);
  17508. virtual void drawLinearSlider (Graphics& g,
  17509. int x, int y,
  17510. int width, int height,
  17511. float sliderPos,
  17512. float minSliderPos,
  17513. float maxSliderPos,
  17514. const Slider::SliderStyle style,
  17515. Slider& slider);
  17516. virtual int getSliderThumbRadius (Slider& slider);
  17517. virtual Button* createSliderButton (bool isIncrement);
  17518. virtual ImageEffectFilter* getSliderEffect();
  17519. virtual void drawCornerResizer (Graphics& g,
  17520. int w, int h,
  17521. bool isMouseOver,
  17522. bool isMouseDragging);
  17523. virtual Button* createDocumentWindowButton (int buttonType);
  17524. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17525. int titleBarX, int titleBarY,
  17526. int titleBarW, int titleBarH,
  17527. Button* minimiseButton,
  17528. Button* maximiseButton,
  17529. Button* closeButton,
  17530. bool positionTitleBarButtonsOnLeft);
  17531. juce_UseDebuggingNewOperator
  17532. private:
  17533. DropShadowEffect scrollbarShadow;
  17534. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17535. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17536. };
  17537. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17538. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17539. #endif
  17540. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17541. #endif
  17542. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17543. #endif
  17544. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17545. #endif
  17546. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17547. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17548. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17549. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17550. class JUCE_API PopupMenuCustomComponent : public Component,
  17551. public ReferenceCountedObject
  17552. {
  17553. public:
  17554. ~PopupMenuCustomComponent();
  17555. virtual void getIdealSize (int& idealWidth,
  17556. int& idealHeight) = 0;
  17557. void triggerMenuItem();
  17558. bool isItemHighlighted() const throw() { return isHighlighted; }
  17559. protected:
  17560. PopupMenuCustomComponent (bool isTriggeredAutomatically = true);
  17561. private:
  17562. friend class PopupMenu;
  17563. friend class PopupMenu::ItemComponent;
  17564. friend class PopupMenu::Window;
  17565. bool isHighlighted, isTriggeredAutomatically;
  17566. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17567. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17568. };
  17569. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17570. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17571. #endif
  17572. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17573. #endif
  17574. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17575. #endif
  17576. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17577. #endif
  17578. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17579. #endif
  17580. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17581. /*** Start of inlined file: juce_LassoComponent.h ***/
  17582. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17583. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17584. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17585. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17586. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17587. template <class SelectableItemType>
  17588. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17589. {
  17590. public:
  17591. typedef SelectableItemType ItemType;
  17592. SelectedItemSet()
  17593. {
  17594. }
  17595. explicit SelectedItemSet (const Array <SelectableItemType>& items)
  17596. : selectedItems (items)
  17597. {
  17598. }
  17599. SelectedItemSet (const SelectedItemSet& other)
  17600. : selectedItems (other.selectedItems)
  17601. {
  17602. }
  17603. SelectedItemSet& operator= (const SelectedItemSet& other)
  17604. {
  17605. if (selectedItems != other.selectedItems)
  17606. {
  17607. selectedItems = other.selectedItems;
  17608. changed();
  17609. }
  17610. return *this;
  17611. }
  17612. ~SelectedItemSet()
  17613. {
  17614. }
  17615. void selectOnly (SelectableItemType item)
  17616. {
  17617. if (isSelected (item))
  17618. {
  17619. for (int i = selectedItems.size(); --i >= 0;)
  17620. {
  17621. if (selectedItems.getUnchecked(i) != item)
  17622. {
  17623. deselect (selectedItems.getUnchecked(i));
  17624. i = jmin (i, selectedItems.size());
  17625. }
  17626. }
  17627. }
  17628. else
  17629. {
  17630. deselectAll();
  17631. changed();
  17632. selectedItems.add (item);
  17633. itemSelected (item);
  17634. }
  17635. }
  17636. void addToSelection (SelectableItemType item)
  17637. {
  17638. if (! isSelected (item))
  17639. {
  17640. changed();
  17641. selectedItems.add (item);
  17642. itemSelected (item);
  17643. }
  17644. }
  17645. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17646. const ModifierKeys& modifiers)
  17647. {
  17648. if (modifiers.isShiftDown())
  17649. {
  17650. addToSelection (item);
  17651. }
  17652. else if (modifiers.isCommandDown())
  17653. {
  17654. if (isSelected (item))
  17655. deselect (item);
  17656. else
  17657. addToSelection (item);
  17658. }
  17659. else
  17660. {
  17661. selectOnly (item);
  17662. }
  17663. }
  17664. bool addToSelectionOnMouseDown (SelectableItemType item,
  17665. const ModifierKeys& modifiers)
  17666. {
  17667. if (isSelected (item))
  17668. {
  17669. return ! modifiers.isPopupMenu();
  17670. }
  17671. else
  17672. {
  17673. addToSelectionBasedOnModifiers (item, modifiers);
  17674. return false;
  17675. }
  17676. }
  17677. void addToSelectionOnMouseUp (SelectableItemType item,
  17678. const ModifierKeys& modifiers,
  17679. const bool wasItemDragged,
  17680. const bool resultOfMouseDownSelectMethod)
  17681. {
  17682. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17683. addToSelectionBasedOnModifiers (item, modifiers);
  17684. }
  17685. void deselect (SelectableItemType item)
  17686. {
  17687. const int i = selectedItems.indexOf (item);
  17688. if (i >= 0)
  17689. {
  17690. changed();
  17691. itemDeselected (selectedItems.remove (i));
  17692. }
  17693. }
  17694. void deselectAll()
  17695. {
  17696. if (selectedItems.size() > 0)
  17697. {
  17698. changed();
  17699. for (int i = selectedItems.size(); --i >= 0;)
  17700. {
  17701. itemDeselected (selectedItems.remove (i));
  17702. i = jmin (i, selectedItems.size());
  17703. }
  17704. }
  17705. }
  17706. int getNumSelected() const throw()
  17707. {
  17708. return selectedItems.size();
  17709. }
  17710. SelectableItemType getSelectedItem (const int index) const throw()
  17711. {
  17712. return selectedItems [index];
  17713. }
  17714. bool isSelected (const SelectableItemType item) const throw()
  17715. {
  17716. return selectedItems.contains (item);
  17717. }
  17718. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17719. virtual void itemSelected (SelectableItemType item) {}
  17720. virtual void itemDeselected (SelectableItemType item) {}
  17721. void changed (const bool synchronous = false)
  17722. {
  17723. if (synchronous)
  17724. sendSynchronousChangeMessage (this);
  17725. else
  17726. sendChangeMessage (this);
  17727. }
  17728. juce_UseDebuggingNewOperator
  17729. private:
  17730. Array <SelectableItemType> selectedItems;
  17731. };
  17732. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17733. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17734. template <class SelectableItemType>
  17735. class LassoSource
  17736. {
  17737. public:
  17738. virtual ~LassoSource() {}
  17739. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17740. int x, int y, int width, int height) = 0;
  17741. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17742. };
  17743. template <class SelectableItemType>
  17744. class LassoComponent : public Component
  17745. {
  17746. public:
  17747. explicit LassoComponent (const int outlineThickness_ = 1)
  17748. : source (0),
  17749. outlineThickness (outlineThickness_)
  17750. {
  17751. }
  17752. ~LassoComponent()
  17753. {
  17754. }
  17755. void beginLasso (const MouseEvent& e,
  17756. LassoSource <SelectableItemType>* const lassoSource)
  17757. {
  17758. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17759. jassert (lassoSource != 0); // the source can't be null!
  17760. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17761. source = lassoSource;
  17762. if (lassoSource != 0)
  17763. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17764. setSize (0, 0);
  17765. }
  17766. void dragLasso (const MouseEvent& e)
  17767. {
  17768. if (source != 0)
  17769. {
  17770. setBounds (Rectangle<int> (e.getMouseDownPosition(), e.getPosition()));
  17771. setVisible (true);
  17772. Array <SelectableItemType> itemsInLasso;
  17773. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17774. if (e.mods.isShiftDown())
  17775. {
  17776. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17777. itemsInLasso.addArray (originalSelection);
  17778. }
  17779. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17780. {
  17781. Array <SelectableItemType> originalMinusNew (originalSelection);
  17782. originalMinusNew.removeValuesIn (itemsInLasso);
  17783. itemsInLasso.removeValuesIn (originalSelection);
  17784. itemsInLasso.addArray (originalMinusNew);
  17785. }
  17786. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17787. }
  17788. }
  17789. void endLasso()
  17790. {
  17791. source = 0;
  17792. originalSelection.clear();
  17793. setVisible (false);
  17794. }
  17795. enum ColourIds
  17796. {
  17797. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17798. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17799. };
  17800. void paint (Graphics& g)
  17801. {
  17802. g.fillAll (findColour (lassoFillColourId));
  17803. g.setColour (findColour (lassoOutlineColourId));
  17804. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17805. // this suggests that you've left a lasso comp lying around after the
  17806. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17807. // mouse-up event.
  17808. jassert (isMouseButtonDownAnywhere());
  17809. }
  17810. bool hitTest (int x, int y) { return false; }
  17811. juce_UseDebuggingNewOperator
  17812. private:
  17813. Array <SelectableItemType> originalSelection;
  17814. LassoSource <SelectableItemType>* source;
  17815. int outlineThickness;
  17816. };
  17817. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17818. /*** End of inlined file: juce_LassoComponent.h ***/
  17819. #endif
  17820. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17821. #endif
  17822. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17823. #endif
  17824. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17825. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17826. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17827. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17828. class JUCE_API MouseHoverDetector
  17829. {
  17830. public:
  17831. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17832. virtual ~MouseHoverDetector();
  17833. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17834. void setHoverComponent (Component* const newSourceComponent);
  17835. protected:
  17836. virtual void mouseHovered (int mouseX,
  17837. int mouseY) = 0;
  17838. virtual void mouseMovedAfterHover() = 0;
  17839. private:
  17840. class JUCE_API HoverDetectorInternal : public MouseListener,
  17841. public Timer
  17842. {
  17843. public:
  17844. MouseHoverDetector* owner;
  17845. int lastX, lastY;
  17846. void timerCallback();
  17847. void mouseEnter (const MouseEvent&);
  17848. void mouseExit (const MouseEvent&);
  17849. void mouseDown (const MouseEvent&);
  17850. void mouseUp (const MouseEvent&);
  17851. void mouseMove (const MouseEvent&);
  17852. void mouseWheelMove (const MouseEvent&, float, float);
  17853. } internalTimer;
  17854. friend class HoverDetectorInternal;
  17855. Component* source;
  17856. int hoverTimeMillisecs;
  17857. bool hasJustHovered;
  17858. void hoverTimerCallback();
  17859. void checkJustHoveredCallback();
  17860. MouseHoverDetector (const MouseHoverDetector&);
  17861. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17862. };
  17863. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17864. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17865. #endif
  17866. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17867. /*** Start of inlined file: juce_MouseInputSource.h ***/
  17868. #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17869. #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17870. class Component;
  17871. class ComponentPeer;
  17872. class MouseInputSourceInternal;
  17873. class JUCE_API MouseInputSource
  17874. {
  17875. public:
  17876. MouseInputSource (int index, bool isMouseDevice);
  17877. ~MouseInputSource();
  17878. bool isMouse() const;
  17879. bool isTouch() const;
  17880. bool canHover() const;
  17881. bool hasMouseWheel() const;
  17882. int getIndex() const;
  17883. bool isDragging() const;
  17884. const Point<int> getScreenPosition() const;
  17885. const ModifierKeys getCurrentModifiers() const;
  17886. Component* getComponentUnderMouse() const;
  17887. void triggerFakeMove() const;
  17888. int getNumberOfMultipleClicks() const throw();
  17889. const Time getLastMouseDownTime() const throw();
  17890. const Point<int> getLastMouseDownPosition() const throw();
  17891. bool hasMouseMovedSignificantlySincePressed() const throw();
  17892. bool hasMouseCursor() const throw();
  17893. void showMouseCursor (const MouseCursor& cursor);
  17894. void hideCursor();
  17895. void revealCursor();
  17896. void forceMouseCursorUpdate();
  17897. bool canDoUnboundedMovement() const throw();
  17898. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  17899. juce_UseDebuggingNewOperator
  17900. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  17901. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  17902. private:
  17903. friend class Desktop;
  17904. friend class ComponentPeer;
  17905. friend class MouseInputSourceInternal;
  17906. ScopedPointer<MouseInputSourceInternal> pimpl;
  17907. MouseInputSource (const MouseInputSource&);
  17908. MouseInputSource& operator= (const MouseInputSource&);
  17909. };
  17910. #endif // __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__
  17911. /*** End of inlined file: juce_MouseInputSource.h ***/
  17912. #endif
  17913. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17914. #endif
  17915. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17916. #endif
  17917. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17918. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17919. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17920. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17921. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17922. private ButtonListener
  17923. {
  17924. protected:
  17925. BooleanPropertyComponent (const String& propertyName,
  17926. const String& buttonTextWhenTrue,
  17927. const String& buttonTextWhenFalse);
  17928. public:
  17929. BooleanPropertyComponent (const Value& valueToControl,
  17930. const String& propertyName,
  17931. const String& buttonText);
  17932. ~BooleanPropertyComponent();
  17933. virtual void setState (bool newState);
  17934. virtual bool getState() const;
  17935. void paint (Graphics& g);
  17936. void refresh();
  17937. void buttonClicked (Button*);
  17938. juce_UseDebuggingNewOperator
  17939. private:
  17940. ToggleButton* button;
  17941. String onText, offText;
  17942. void createButton();
  17943. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17944. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17945. };
  17946. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17947. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17948. #endif
  17949. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17950. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17951. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17952. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17953. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17954. private ButtonListener
  17955. {
  17956. public:
  17957. ButtonPropertyComponent (const String& propertyName,
  17958. bool triggerOnMouseDown);
  17959. ~ButtonPropertyComponent();
  17960. virtual void buttonClicked() = 0;
  17961. virtual const String getButtonText() const = 0;
  17962. void refresh();
  17963. void buttonClicked (Button*);
  17964. juce_UseDebuggingNewOperator
  17965. private:
  17966. TextButton* button;
  17967. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17968. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17969. };
  17970. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17971. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17972. #endif
  17973. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17974. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17975. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17976. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17977. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17978. private ComboBoxListener
  17979. {
  17980. protected:
  17981. ChoicePropertyComponent (const String& propertyName);
  17982. public:
  17983. ChoicePropertyComponent (const Value& valueToControl,
  17984. const String& propertyName,
  17985. const StringArray& choices,
  17986. const Array <int>* choiceIDs = 0);
  17987. ~ChoicePropertyComponent();
  17988. virtual void setIndex (int newIndex);
  17989. virtual int getIndex() const;
  17990. const StringArray& getChoices() const;
  17991. void refresh();
  17992. void comboBoxChanged (ComboBox*);
  17993. juce_UseDebuggingNewOperator
  17994. protected:
  17995. StringArray choices;
  17996. private:
  17997. ComboBox* comboBox;
  17998. void createComboBox (const Array <int>* choiceIDs);
  17999. ChoicePropertyComponent (const ChoicePropertyComponent&);
  18000. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  18001. };
  18002. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  18003. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  18004. #endif
  18005. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  18006. #endif
  18007. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  18008. #endif
  18009. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18010. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  18011. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18012. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18013. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  18014. private SliderListener
  18015. {
  18016. protected:
  18017. SliderPropertyComponent (const String& propertyName,
  18018. double rangeMin,
  18019. double rangeMax,
  18020. double interval,
  18021. double skewFactor = 1.0);
  18022. public:
  18023. SliderPropertyComponent (const Value& valueToControl,
  18024. const String& propertyName,
  18025. double rangeMin,
  18026. double rangeMax,
  18027. double interval,
  18028. double skewFactor = 1.0);
  18029. ~SliderPropertyComponent();
  18030. virtual void setValue (double newValue);
  18031. virtual double getValue() const;
  18032. void refresh();
  18033. void changeListenerCallback (void*);
  18034. void sliderValueChanged (Slider*);
  18035. juce_UseDebuggingNewOperator
  18036. protected:
  18037. Slider* slider;
  18038. SliderPropertyComponent (const SliderPropertyComponent&);
  18039. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  18040. };
  18041. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  18042. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  18043. #endif
  18044. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18045. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  18046. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18047. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18048. class JUCE_API TextPropertyComponent : public PropertyComponent
  18049. {
  18050. protected:
  18051. TextPropertyComponent (const String& propertyName,
  18052. int maxNumChars,
  18053. bool isMultiLine);
  18054. public:
  18055. TextPropertyComponent (const Value& valueToControl,
  18056. const String& propertyName,
  18057. int maxNumChars,
  18058. bool isMultiLine);
  18059. ~TextPropertyComponent();
  18060. virtual void setText (const String& newText);
  18061. virtual const String getText() const;
  18062. void refresh();
  18063. void textWasEdited();
  18064. juce_UseDebuggingNewOperator
  18065. private:
  18066. Label* textEditor;
  18067. void createEditor (int maxNumChars, bool isMultiLine);
  18068. TextPropertyComponent (const TextPropertyComponent&);
  18069. TextPropertyComponent& operator= (const TextPropertyComponent&);
  18070. };
  18071. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  18072. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  18073. #endif
  18074. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18075. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  18076. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18077. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18078. #if JUCE_WINDOWS || DOXYGEN
  18079. class JUCE_API ActiveXControlComponent : public Component
  18080. {
  18081. public:
  18082. ActiveXControlComponent();
  18083. ~ActiveXControlComponent();
  18084. bool createControl (const void* controlIID);
  18085. void deleteControl();
  18086. bool isControlOpen() const throw() { return control != 0; }
  18087. void* queryInterface (const void* iid) const;
  18088. void setMouseEventsAllowed (bool eventsCanReachControl);
  18089. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  18090. void paint (Graphics& g);
  18091. void* originalWndProc;
  18092. juce_UseDebuggingNewOperator
  18093. private:
  18094. class ActiveXControlData;
  18095. friend class ActiveXControlData;
  18096. void* control;
  18097. bool mouseEventsAllowed;
  18098. ActiveXControlComponent (const ActiveXControlComponent&);
  18099. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  18100. void setControlBounds (const Rectangle<int>& bounds) const;
  18101. void setControlVisible (bool b) const;
  18102. };
  18103. #endif
  18104. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  18105. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  18106. #endif
  18107. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18108. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18109. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18110. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18111. class MidiInputSelectorComponentListBox;
  18112. class JUCE_API AudioDeviceSelectorComponent : public Component,
  18113. public ComboBoxListener,
  18114. public ButtonListener,
  18115. public ChangeListener
  18116. {
  18117. public:
  18118. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  18119. const int minAudioInputChannels,
  18120. const int maxAudioInputChannels,
  18121. const int minAudioOutputChannels,
  18122. const int maxAudioOutputChannels,
  18123. const bool showMidiInputOptions,
  18124. const bool showMidiOutputSelector,
  18125. const bool showChannelsAsStereoPairs,
  18126. const bool hideAdvancedOptionsWithButton);
  18127. ~AudioDeviceSelectorComponent();
  18128. void resized();
  18129. void comboBoxChanged (ComboBox*);
  18130. void buttonClicked (Button*);
  18131. void changeListenerCallback (void*);
  18132. void childBoundsChanged (Component*);
  18133. juce_UseDebuggingNewOperator
  18134. private:
  18135. AudioDeviceManager& deviceManager;
  18136. ComboBox* deviceTypeDropDown;
  18137. Label* deviceTypeDropDownLabel;
  18138. Component* audioDeviceSettingsComp;
  18139. String audioDeviceSettingsCompType;
  18140. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  18141. const bool showChannelsAsStereoPairs;
  18142. const bool hideAdvancedOptionsWithButton;
  18143. MidiInputSelectorComponentListBox* midiInputsList;
  18144. Label* midiInputsLabel;
  18145. ComboBox* midiOutputSelector;
  18146. Label* midiOutputLabel;
  18147. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  18148. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  18149. };
  18150. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  18151. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  18152. #endif
  18153. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18154. /*** Start of inlined file: juce_BubbleComponent.h ***/
  18155. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18156. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18157. class JUCE_API BubbleComponent : public Component
  18158. {
  18159. protected:
  18160. BubbleComponent();
  18161. public:
  18162. ~BubbleComponent();
  18163. enum BubblePlacement
  18164. {
  18165. above = 1,
  18166. below = 2,
  18167. left = 4,
  18168. right = 8
  18169. };
  18170. void setAllowedPlacement (int newPlacement);
  18171. void setPosition (Component* componentToPointTo);
  18172. void setPosition (int arrowTipX,
  18173. int arrowTipY);
  18174. void setPosition (const Rectangle<int>& rectangleToPointTo);
  18175. protected:
  18176. virtual void getContentSize (int& width, int& height) = 0;
  18177. virtual void paintContent (Graphics& g, int width, int height) = 0;
  18178. public:
  18179. void paint (Graphics& g);
  18180. juce_UseDebuggingNewOperator
  18181. private:
  18182. Rectangle<int> content;
  18183. int side, allowablePlacements;
  18184. float arrowTipX, arrowTipY;
  18185. DropShadowEffect shadow;
  18186. BubbleComponent (const BubbleComponent&);
  18187. BubbleComponent& operator= (const BubbleComponent&);
  18188. };
  18189. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18190. /*** End of inlined file: juce_BubbleComponent.h ***/
  18191. #endif
  18192. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18193. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18194. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18195. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18196. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18197. private Timer
  18198. {
  18199. public:
  18200. BubbleMessageComponent (int fadeOutLengthMs = 150);
  18201. ~BubbleMessageComponent();
  18202. void showAt (int x, int y,
  18203. const String& message,
  18204. int numMillisecondsBeforeRemoving,
  18205. bool removeWhenMouseClicked = true,
  18206. bool deleteSelfAfterUse = false);
  18207. void showAt (Component* component,
  18208. const String& message,
  18209. int numMillisecondsBeforeRemoving,
  18210. bool removeWhenMouseClicked = true,
  18211. bool deleteSelfAfterUse = false);
  18212. void getContentSize (int& w, int& h);
  18213. void paintContent (Graphics& g, int w, int h);
  18214. void timerCallback();
  18215. juce_UseDebuggingNewOperator
  18216. private:
  18217. int fadeOutLength, mouseClickCounter;
  18218. TextLayout textLayout;
  18219. int64 expiryTime;
  18220. bool deleteAfterUse;
  18221. void init (int numMillisecondsBeforeRemoving,
  18222. bool removeWhenMouseClicked,
  18223. bool deleteSelfAfterUse);
  18224. BubbleMessageComponent (const BubbleMessageComponent&);
  18225. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18226. };
  18227. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18228. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18229. #endif
  18230. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18231. /*** Start of inlined file: juce_ColourSelector.h ***/
  18232. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18233. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18234. class JUCE_API ColourSelector : public Component,
  18235. public ChangeBroadcaster,
  18236. protected SliderListener
  18237. {
  18238. public:
  18239. enum ColourSelectorOptions
  18240. {
  18241. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18242. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18243. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18244. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18245. };
  18246. ColourSelector (int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18247. int edgeGap = 4,
  18248. int gapAroundColourSpaceComponent = 7);
  18249. ~ColourSelector();
  18250. const Colour getCurrentColour() const;
  18251. void setCurrentColour (const Colour& newColour);
  18252. virtual int getNumSwatches() const;
  18253. virtual const Colour getSwatchColour (int index) const;
  18254. virtual void setSwatchColour (int index, const Colour& newColour) const;
  18255. enum ColourIds
  18256. {
  18257. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18258. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18259. };
  18260. juce_UseDebuggingNewOperator
  18261. private:
  18262. class ColourSpaceView;
  18263. class HueSelectorComp;
  18264. class SwatchComponent;
  18265. friend class ColourSpaceView;
  18266. friend class HueSelectorComp;
  18267. Colour colour;
  18268. float h, s, v;
  18269. Slider* sliders[4];
  18270. ColourSpaceView* colourSpace;
  18271. HueSelectorComp* hueSelector;
  18272. OwnedArray <SwatchComponent> swatchComponents;
  18273. const int flags;
  18274. int topSpace, edgeGap;
  18275. void setHue (float newH);
  18276. void setSV (float newS, float newV);
  18277. void updateHSV();
  18278. void update();
  18279. void sliderValueChanged (Slider*);
  18280. void paint (Graphics& g);
  18281. void resized();
  18282. ColourSelector (const ColourSelector&);
  18283. ColourSelector& operator= (const ColourSelector&);
  18284. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18285. // have changed - if you get an error here, update your code to use the new constructor instead..
  18286. // (xxx - note to self: remember to remove this at some point in the future)
  18287. ColourSelector (bool);
  18288. };
  18289. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18290. /*** End of inlined file: juce_ColourSelector.h ***/
  18291. #endif
  18292. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18293. #endif
  18294. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18295. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18296. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18297. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18298. class JUCE_API MagnifierComponent : public Component
  18299. {
  18300. public:
  18301. MagnifierComponent (Component* contentComponent,
  18302. bool deleteContentCompWhenNoLongerNeeded);
  18303. ~MagnifierComponent();
  18304. Component* getContentComponent() const { return content; }
  18305. void setScaleFactor (double newScaleFactor);
  18306. double getScaleFactor() const { return scaleFactor; }
  18307. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18308. juce_UseDebuggingNewOperator
  18309. void childBoundsChanged (Component*);
  18310. private:
  18311. Component* content;
  18312. Component* holderComp;
  18313. double scaleFactor;
  18314. ComponentPeer* peer;
  18315. bool deleteContent;
  18316. Graphics::ResamplingQuality quality;
  18317. MouseInputSource mouseSource;
  18318. void paint (Graphics& g);
  18319. void mouseDown (const MouseEvent& e);
  18320. void mouseUp (const MouseEvent& e);
  18321. void mouseDrag (const MouseEvent& e);
  18322. void mouseMove (const MouseEvent& e);
  18323. void mouseEnter (const MouseEvent& e);
  18324. void mouseExit (const MouseEvent& e);
  18325. void mouseWheelMove (const MouseEvent& e, float, float);
  18326. void passOnMouseEventToPeer (const MouseEvent& e);
  18327. int scaleInt (int n) const;
  18328. MagnifierComponent (const MagnifierComponent&);
  18329. MagnifierComponent& operator= (const MagnifierComponent&);
  18330. };
  18331. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18332. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18333. #endif
  18334. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18335. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18336. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18337. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18338. class JUCE_API MidiKeyboardComponent : public Component,
  18339. public MidiKeyboardStateListener,
  18340. public ChangeBroadcaster,
  18341. private Timer,
  18342. private AsyncUpdater
  18343. {
  18344. public:
  18345. enum Orientation
  18346. {
  18347. horizontalKeyboard,
  18348. verticalKeyboardFacingLeft,
  18349. verticalKeyboardFacingRight,
  18350. };
  18351. MidiKeyboardComponent (MidiKeyboardState& state,
  18352. Orientation orientation);
  18353. ~MidiKeyboardComponent();
  18354. void setVelocity (float velocity, bool useMousePositionForVelocity);
  18355. void setMidiChannel (int midiChannelNumber);
  18356. int getMidiChannel() const throw() { return midiChannel; }
  18357. void setMidiChannelsToDisplay (int midiChannelMask);
  18358. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18359. void setKeyWidth (float widthInPixels);
  18360. float getKeyWidth() const throw() { return keyWidth; }
  18361. void setOrientation (Orientation newOrientation);
  18362. const Orientation getOrientation() const throw() { return orientation; }
  18363. void setAvailableRange (int lowestNote,
  18364. int highestNote);
  18365. int getRangeStart() const throw() { return rangeStart; }
  18366. int getRangeEnd() const throw() { return rangeEnd; }
  18367. void setLowestVisibleKey (int noteNumber);
  18368. int getLowestVisibleKey() const throw() { return firstKey; }
  18369. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18370. void setScrollButtonsVisible (bool canScroll);
  18371. enum ColourIds
  18372. {
  18373. whiteNoteColourId = 0x1005000,
  18374. blackNoteColourId = 0x1005001,
  18375. keySeparatorLineColourId = 0x1005002,
  18376. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18377. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18378. textLabelColourId = 0x1005005,
  18379. upDownButtonBackgroundColourId = 0x1005006,
  18380. upDownButtonArrowColourId = 0x1005007
  18381. };
  18382. int getKeyStartPosition (const int midiNoteNumber) const;
  18383. void clearKeyMappings();
  18384. void setKeyPressForNote (const KeyPress& key,
  18385. int midiNoteOffsetFromC);
  18386. void removeKeyPressForNote (int midiNoteOffsetFromC);
  18387. void setKeyPressBaseOctave (int newOctaveNumber);
  18388. void setOctaveForMiddleC (int octaveNumForMiddleC) throw();
  18389. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18390. void paint (Graphics& g);
  18391. void resized();
  18392. void mouseMove (const MouseEvent& e);
  18393. void mouseDrag (const MouseEvent& e);
  18394. void mouseDown (const MouseEvent& e);
  18395. void mouseUp (const MouseEvent& e);
  18396. void mouseEnter (const MouseEvent& e);
  18397. void mouseExit (const MouseEvent& e);
  18398. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18399. void timerCallback();
  18400. bool keyStateChanged (bool isKeyDown);
  18401. void focusLost (FocusChangeType cause);
  18402. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18403. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18404. void handleAsyncUpdate();
  18405. void colourChanged();
  18406. juce_UseDebuggingNewOperator
  18407. protected:
  18408. friend class MidiKeyboardUpDownButton;
  18409. virtual void drawWhiteNote (int midiNoteNumber,
  18410. Graphics& g,
  18411. int x, int y, int w, int h,
  18412. bool isDown, bool isOver,
  18413. const Colour& lineColour,
  18414. const Colour& textColour);
  18415. virtual void drawBlackNote (int midiNoteNumber,
  18416. Graphics& g,
  18417. int x, int y, int w, int h,
  18418. bool isDown, bool isOver,
  18419. const Colour& noteFillColour);
  18420. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18421. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18422. const bool isMouseOver,
  18423. const bool isButtonPressed,
  18424. const bool movesOctavesUp);
  18425. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18426. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18427. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18428. int& x, int& w) const;
  18429. private:
  18430. MidiKeyboardState& state;
  18431. int xOffset, blackNoteLength;
  18432. float keyWidth;
  18433. Orientation orientation;
  18434. int midiChannel, midiInChannelMask;
  18435. float velocity;
  18436. int noteUnderMouse, mouseDownNote;
  18437. BigInteger keysPressed, keysCurrentlyDrawnDown;
  18438. int rangeStart, rangeEnd, firstKey;
  18439. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18440. Button* scrollDown;
  18441. Button* scrollUp;
  18442. Array <KeyPress> keyPresses;
  18443. Array <int> keyPressNotes;
  18444. int keyMappingOctave;
  18445. int octaveNumForMiddleC;
  18446. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18447. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18448. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18449. void resetAnyKeysInUse();
  18450. void updateNoteUnderMouse (const Point<int>& pos);
  18451. void repaintNote (const int midiNoteNumber);
  18452. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18453. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18454. };
  18455. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18456. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18457. #endif
  18458. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18459. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18460. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18461. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18462. #if ! DOXYGEN
  18463. class NSViewComponentInternal;
  18464. #endif
  18465. #if JUCE_MAC || DOXYGEN
  18466. class JUCE_API NSViewComponent : public Component
  18467. {
  18468. public:
  18469. NSViewComponent();
  18470. ~NSViewComponent();
  18471. void setView (void* nsView);
  18472. void* getView() const;
  18473. void paint (Graphics& g);
  18474. juce_UseDebuggingNewOperator
  18475. private:
  18476. friend class NSViewComponentInternal;
  18477. ScopedPointer <NSViewComponentInternal> info;
  18478. NSViewComponent (const NSViewComponent&);
  18479. NSViewComponent& operator= (const NSViewComponent&);
  18480. };
  18481. #endif
  18482. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18483. /*** End of inlined file: juce_NSViewComponent.h ***/
  18484. #endif
  18485. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18486. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18487. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18488. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18489. // this is used to disable OpenGL, and is defined in juce_Config.h
  18490. #if JUCE_OPENGL || DOXYGEN
  18491. class JUCE_API OpenGLPixelFormat
  18492. {
  18493. public:
  18494. OpenGLPixelFormat (int bitsPerRGBComponent = 8,
  18495. int alphaBits = 8,
  18496. int depthBufferBits = 16,
  18497. int stencilBufferBits = 0);
  18498. OpenGLPixelFormat (const OpenGLPixelFormat&);
  18499. OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
  18500. bool operator== (const OpenGLPixelFormat&) const;
  18501. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18502. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18503. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18504. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18505. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18506. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18507. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18508. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18509. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18510. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18511. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18512. static void getAvailablePixelFormats (Component* component,
  18513. OwnedArray <OpenGLPixelFormat>& results);
  18514. juce_UseDebuggingNewOperator
  18515. };
  18516. class JUCE_API OpenGLContext
  18517. {
  18518. public:
  18519. virtual ~OpenGLContext();
  18520. virtual bool makeActive() const throw() = 0;
  18521. virtual bool makeInactive() const throw() = 0;
  18522. virtual bool isActive() const throw() = 0;
  18523. virtual void swapBuffers() = 0;
  18524. virtual bool setSwapInterval (int numFramesPerSwap) = 0;
  18525. virtual int getSwapInterval() const = 0;
  18526. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18527. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18528. virtual void repaint() = 0;
  18529. virtual void* getRawContext() const throw() = 0;
  18530. static OpenGLContext* getCurrentContext();
  18531. juce_UseDebuggingNewOperator
  18532. protected:
  18533. OpenGLContext() throw();
  18534. };
  18535. class JUCE_API OpenGLComponent : public Component
  18536. {
  18537. public:
  18538. enum OpenGLType
  18539. {
  18540. openGLDefault = 0,
  18541. #if JUCE_IPHONE
  18542. openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */
  18543. openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */
  18544. #endif
  18545. };
  18546. OpenGLComponent (OpenGLType type = openGLDefault);
  18547. ~OpenGLComponent();
  18548. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18549. const OpenGLPixelFormat getPixelFormat() const;
  18550. void shareWith (OpenGLContext* contextToShareListsWith);
  18551. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18552. void swapBuffers();
  18553. virtual void renderOpenGL() = 0;
  18554. virtual void newOpenGLContextCreated() = 0;
  18555. OpenGLContext* getCurrentContext() const throw() { return context; }
  18556. bool makeCurrentContextActive();
  18557. void makeCurrentContextInactive();
  18558. bool isActiveContext() const throw();
  18559. virtual bool renderAndSwapBuffers();
  18560. CriticalSection& getContextLock() throw() { return contextLock; }
  18561. void paint (Graphics& g);
  18562. void* getNativeWindowHandle() const;
  18563. juce_UseDebuggingNewOperator
  18564. private:
  18565. const OpenGLType type;
  18566. class OpenGLComponentWatcher;
  18567. friend class OpenGLComponentWatcher;
  18568. friend class ScopedPointer <OpenGLComponentWatcher>;
  18569. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18570. ScopedPointer <OpenGLContext> context;
  18571. OpenGLContext* contextToShareListsWith;
  18572. CriticalSection contextLock;
  18573. OpenGLPixelFormat preferredPixelFormat;
  18574. bool needToUpdateViewport;
  18575. OpenGLContext* createContext();
  18576. void deleteContext();
  18577. void updateContextPosition();
  18578. void internalRepaint (int x, int y, int w, int h);
  18579. OpenGLComponent (const OpenGLComponent&);
  18580. OpenGLComponent& operator= (const OpenGLComponent&);
  18581. };
  18582. #endif
  18583. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18584. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18585. #endif
  18586. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18587. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18588. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18589. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18590. class JUCE_API PreferencesPanel : public Component,
  18591. private ButtonListener
  18592. {
  18593. public:
  18594. PreferencesPanel();
  18595. ~PreferencesPanel();
  18596. void addSettingsPage (const String& pageTitle,
  18597. const Drawable* normalIcon,
  18598. const Drawable* overIcon,
  18599. const Drawable* downIcon);
  18600. void addSettingsPage (const String& pageTitle,
  18601. const char* imageData,
  18602. int imageDataSize);
  18603. void showInDialogBox (const String& dialogtitle,
  18604. int dialogWidth,
  18605. int dialogHeight,
  18606. const Colour& backgroundColour = Colours::white);
  18607. virtual Component* createComponentForPage (const String& pageName) = 0;
  18608. void setCurrentPage (const String& pageName);
  18609. void resized();
  18610. void paint (Graphics& g);
  18611. void buttonClicked (Button* button);
  18612. juce_UseDebuggingNewOperator
  18613. private:
  18614. String currentPageName;
  18615. ScopedPointer <Component> currentPage;
  18616. int buttonSize;
  18617. PreferencesPanel (const PreferencesPanel&);
  18618. PreferencesPanel& operator= (const PreferencesPanel&);
  18619. };
  18620. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18621. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18622. #endif
  18623. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18624. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18625. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18626. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18627. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18628. // amalgamated build)
  18629. #if JUCE_WINDOWS
  18630. typedef ActiveXControlComponent QTCompBaseClass;
  18631. #elif JUCE_MAC
  18632. typedef NSViewComponent QTCompBaseClass;
  18633. #endif
  18634. // this is used to disable QuickTime, and is defined in juce_Config.h
  18635. #if JUCE_QUICKTIME || DOXYGEN
  18636. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18637. {
  18638. public:
  18639. QuickTimeMovieComponent();
  18640. ~QuickTimeMovieComponent();
  18641. static bool isQuickTimeAvailable() throw();
  18642. bool loadMovie (const File& movieFile,
  18643. bool isControllerVisible);
  18644. bool loadMovie (const URL& movieURL,
  18645. bool isControllerVisible);
  18646. bool loadMovie (InputStream* movieStream,
  18647. bool isControllerVisible);
  18648. void closeMovie();
  18649. const File getCurrentMovieFile() const;
  18650. bool isMovieOpen() const;
  18651. double getMovieDuration() const;
  18652. void getMovieNormalSize (int& width, int& height) const;
  18653. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18654. const RectanglePlacement& placement);
  18655. void play();
  18656. void stop();
  18657. bool isPlaying() const;
  18658. void goToStart();
  18659. void setPosition (double seconds);
  18660. double getPosition() const;
  18661. void setSpeed (float newSpeed);
  18662. void setMovieVolume (float newVolume);
  18663. float getMovieVolume() const;
  18664. void setLooping (bool shouldLoop);
  18665. bool isLooping() const;
  18666. bool isControllerVisible() const;
  18667. void paint (Graphics& g);
  18668. juce_UseDebuggingNewOperator
  18669. private:
  18670. File movieFile;
  18671. bool movieLoaded, controllerVisible, looping;
  18672. #if JUCE_WINDOWS
  18673. void parentHierarchyChanged();
  18674. void visibilityChanged();
  18675. void createControlIfNeeded();
  18676. bool isControlCreated() const;
  18677. class Pimpl;
  18678. friend class ScopedPointer <Pimpl>;
  18679. ScopedPointer <Pimpl> pimpl;
  18680. #else
  18681. void* movie;
  18682. #endif
  18683. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18684. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18685. };
  18686. #endif
  18687. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18688. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18689. #endif
  18690. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18691. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18692. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18693. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18694. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18695. class JUCE_API SystemTrayIconComponent : public Component
  18696. {
  18697. public:
  18698. SystemTrayIconComponent();
  18699. ~SystemTrayIconComponent();
  18700. void setIconImage (const Image& newImage);
  18701. void setIconTooltip (const String& tooltip);
  18702. #if JUCE_LINUX
  18703. void paint (Graphics& g);
  18704. #endif
  18705. juce_UseDebuggingNewOperator
  18706. private:
  18707. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18708. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18709. };
  18710. #endif
  18711. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18712. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18713. #endif
  18714. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18715. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18716. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18717. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18718. #if JUCE_WEB_BROWSER || DOXYGEN
  18719. #if ! DOXYGEN
  18720. class WebBrowserComponentInternal;
  18721. #endif
  18722. class JUCE_API WebBrowserComponent : public Component
  18723. {
  18724. public:
  18725. explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true);
  18726. ~WebBrowserComponent();
  18727. void goToURL (const String& url,
  18728. const StringArray* headers = 0,
  18729. const MemoryBlock* postData = 0);
  18730. void stop();
  18731. void goBack();
  18732. void goForward();
  18733. void refresh();
  18734. virtual bool pageAboutToLoad (const String& newURL);
  18735. void paint (Graphics& g);
  18736. void resized();
  18737. void parentHierarchyChanged();
  18738. void visibilityChanged();
  18739. juce_UseDebuggingNewOperator
  18740. private:
  18741. WebBrowserComponentInternal* browser;
  18742. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18743. String lastURL;
  18744. StringArray lastHeaders;
  18745. MemoryBlock lastPostData;
  18746. void reloadLastURL();
  18747. void checkWindowAssociation();
  18748. WebBrowserComponent (const WebBrowserComponent&);
  18749. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18750. };
  18751. #endif
  18752. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18753. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18754. #endif
  18755. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18756. #endif
  18757. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18758. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18759. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18760. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18761. class ComponentBoundsConstrainer;
  18762. class JUCE_API ComponentPeer
  18763. {
  18764. public:
  18765. enum StyleFlags
  18766. {
  18767. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18768. entry on the taskbar (ignored on MacOSX) */
  18769. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18770. tooltip, etc. */
  18771. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18772. through it (may not be possible on some platforms). */
  18773. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18774. title bar and frame\. if not specified, the window will be
  18775. borderless. */
  18776. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18777. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18778. minimise button on it. */
  18779. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18780. maximise button on it. */
  18781. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18782. close button on it. */
  18783. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18784. not be possible on all platforms). */
  18785. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18786. do its own repainting, but only to repaint when the
  18787. performAnyPendingRepaintsNow() method is called. */
  18788. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18789. be used for things like plugin windows, to stop them interfering
  18790. with the host's shortcut keys */
  18791. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18792. };
  18793. ComponentPeer (Component* component,
  18794. int styleFlags) throw();
  18795. virtual ~ComponentPeer();
  18796. Component* getComponent() const throw() { return component; }
  18797. int getStyleFlags() const throw() { return styleFlags; }
  18798. virtual void* getNativeHandle() const = 0;
  18799. virtual void setVisible (bool shouldBeVisible) = 0;
  18800. virtual void setTitle (const String& title) = 0;
  18801. virtual void setPosition (int x, int y) = 0;
  18802. virtual void setSize (int w, int h) = 0;
  18803. virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0;
  18804. virtual const Rectangle<int> getBounds() const = 0;
  18805. virtual const Point<int> getScreenPosition() const = 0;
  18806. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18807. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18808. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18809. virtual bool isMinimised() const = 0;
  18810. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18811. virtual bool isFullScreen() const = 0;
  18812. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18813. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18814. virtual void setIcon (const Image& newIcon) = 0;
  18815. void setConstrainer (ComponentBoundsConstrainer* newConstrainer) throw();
  18816. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18817. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18818. virtual const BorderSize getFrameSize() const = 0;
  18819. void handleMovedOrResized();
  18820. void handleScreenSizeChange();
  18821. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18822. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18823. virtual void toFront (bool makeActive) = 0;
  18824. virtual void toBehind (ComponentPeer* other) = 0;
  18825. void handleBroughtToFront();
  18826. virtual bool isFocused() const = 0;
  18827. virtual void grabFocus() = 0;
  18828. virtual void textInputRequired (const Point<int>& position) = 0;
  18829. void handleFocusGain();
  18830. void handleFocusLoss();
  18831. Component* getLastFocusedSubcomponent() const throw();
  18832. bool handleKeyPress (int keyCode,
  18833. juce_wchar textCharacter);
  18834. bool handleKeyUpOrDown (bool isKeyDown);
  18835. void handleModifierKeysChange();
  18836. TextInputTarget* findCurrentTextInputTarget();
  18837. virtual void repaint (int x, int y, int w, int h) = 0;
  18838. virtual void performAnyPendingRepaintsNow() = 0;
  18839. void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
  18840. void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18841. void handleUserClosingWindow();
  18842. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18843. void handleFileDragExit (const StringArray& files);
  18844. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18845. void clearMaskedRegion() throw();
  18846. void addMaskedRegion (int x, int y, int w, int h) throw();
  18847. static int getNumPeers() throw();
  18848. static ComponentPeer* getPeer (int index) throw();
  18849. static bool isValidPeer (const ComponentPeer* peer) throw();
  18850. static void bringModalComponentToFront();
  18851. virtual const StringArray getAvailableRenderingEngines() throw();
  18852. virtual int getCurrentRenderingEngine() throw();
  18853. virtual void setCurrentRenderingEngine (int index) throw();
  18854. juce_UseDebuggingNewOperator
  18855. protected:
  18856. Component* const component;
  18857. const int styleFlags;
  18858. RectangleList maskedRegion;
  18859. Rectangle<int> lastNonFullscreenBounds;
  18860. uint32 lastPaintTime;
  18861. ComponentBoundsConstrainer* constrainer;
  18862. static void updateCurrentModifiers() throw();
  18863. private:
  18864. Component::SafePointer<Component> lastFocusedComponent, dragAndDropTargetComponent;
  18865. Component* lastDragAndDropCompUnderMouse;
  18866. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18867. friend class Component;
  18868. static ComponentPeer* getPeerFor (const Component* component) throw();
  18869. void setLastDragDropTarget (Component* comp);
  18870. ComponentPeer (const ComponentPeer&);
  18871. ComponentPeer& operator= (const ComponentPeer&);
  18872. };
  18873. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18874. /*** End of inlined file: juce_ComponentPeer.h ***/
  18875. #endif
  18876. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18877. /*** Start of inlined file: juce_DialogWindow.h ***/
  18878. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18879. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18880. class JUCE_API DialogWindow : public DocumentWindow
  18881. {
  18882. public:
  18883. DialogWindow (const String& name,
  18884. const Colour& backgroundColour,
  18885. bool escapeKeyTriggersCloseButton,
  18886. bool addToDesktop = true);
  18887. ~DialogWindow();
  18888. static int showModalDialog (const String& dialogTitle,
  18889. Component* contentComponent,
  18890. Component* componentToCentreAround,
  18891. const Colour& backgroundColour,
  18892. bool escapeKeyTriggersCloseButton,
  18893. bool shouldBeResizable = false,
  18894. bool useBottomRightCornerResizer = false);
  18895. juce_UseDebuggingNewOperator
  18896. protected:
  18897. void resized();
  18898. private:
  18899. bool escapeKeyTriggersCloseButton;
  18900. DialogWindow (const DialogWindow&);
  18901. DialogWindow& operator= (const DialogWindow&);
  18902. };
  18903. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18904. /*** End of inlined file: juce_DialogWindow.h ***/
  18905. #endif
  18906. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18907. #endif
  18908. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18909. #endif
  18910. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18911. /*** Start of inlined file: juce_SplashScreen.h ***/
  18912. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18913. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18914. class JUCE_API SplashScreen : public Component,
  18915. public Timer,
  18916. private DeletedAtShutdown
  18917. {
  18918. public:
  18919. SplashScreen();
  18920. ~SplashScreen();
  18921. void show (const String& title,
  18922. Image* backgroundImage,
  18923. int minimumTimeToDisplayFor,
  18924. bool useDropShadow,
  18925. bool removeOnMouseClick = true);
  18926. void show (const String& title,
  18927. int width,
  18928. int height,
  18929. int minimumTimeToDisplayFor,
  18930. bool useDropShadow,
  18931. bool removeOnMouseClick = true);
  18932. void paint (Graphics& g);
  18933. void timerCallback();
  18934. juce_UseDebuggingNewOperator
  18935. private:
  18936. Image* backgroundImage;
  18937. Time earliestTimeToDelete;
  18938. int originalClickCounter;
  18939. SplashScreen (const SplashScreen&);
  18940. SplashScreen& operator= (const SplashScreen&);
  18941. };
  18942. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18943. /*** End of inlined file: juce_SplashScreen.h ***/
  18944. #endif
  18945. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18946. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18947. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18948. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18949. class JUCE_API ThreadWithProgressWindow : public Thread,
  18950. private Timer
  18951. {
  18952. public:
  18953. ThreadWithProgressWindow (const String& windowTitle,
  18954. bool hasProgressBar,
  18955. bool hasCancelButton,
  18956. int timeOutMsWhenCancelling = 10000,
  18957. const String& cancelButtonText = "Cancel");
  18958. ~ThreadWithProgressWindow();
  18959. bool runThread (int threadPriority = 5);
  18960. void setProgress (double newProgress);
  18961. void setStatusMessage (const String& newStatusMessage);
  18962. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18963. juce_UseDebuggingNewOperator
  18964. private:
  18965. void timerCallback();
  18966. double progress;
  18967. ScopedPointer <AlertWindow> alertWindow;
  18968. String message;
  18969. CriticalSection messageLock;
  18970. const int timeOutMsWhenCancelling;
  18971. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18972. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18973. };
  18974. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18975. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18976. #endif
  18977. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18978. #endif
  18979. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18980. #endif
  18981. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18982. #endif
  18983. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18984. #endif
  18985. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18986. #endif
  18987. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18988. #endif
  18989. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18990. #endif
  18991. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18992. #endif
  18993. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18994. #endif
  18995. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18996. #endif
  18997. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18998. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18999. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19000. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19001. class JUCE_API LowLevelGraphicsContext
  19002. {
  19003. protected:
  19004. LowLevelGraphicsContext();
  19005. public:
  19006. virtual ~LowLevelGraphicsContext();
  19007. virtual bool isVectorDevice() const = 0;
  19008. virtual void setOrigin (int x, int y) = 0;
  19009. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  19010. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  19011. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  19012. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  19013. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  19014. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  19015. virtual const Rectangle<int> getClipBounds() const = 0;
  19016. virtual bool isClipEmpty() const = 0;
  19017. virtual void saveState() = 0;
  19018. virtual void restoreState() = 0;
  19019. virtual void setFill (const FillType& fillType) = 0;
  19020. virtual void setOpacity (float newOpacity) = 0;
  19021. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  19022. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  19023. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  19024. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19025. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  19026. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  19027. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  19028. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  19029. virtual void setFont (const Font& newFont) = 0;
  19030. virtual const Font getFont() = 0;
  19031. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  19032. };
  19033. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19034. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  19035. #endif
  19036. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19037. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19038. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19039. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19040. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  19041. {
  19042. public:
  19043. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  19044. const String& documentTitle,
  19045. int totalWidth,
  19046. int totalHeight);
  19047. ~LowLevelGraphicsPostScriptRenderer();
  19048. bool isVectorDevice() const;
  19049. void setOrigin (int x, int y);
  19050. bool clipToRectangle (const Rectangle<int>& r);
  19051. bool clipToRectangleList (const RectangleList& clipRegion);
  19052. void excludeClipRectangle (const Rectangle<int>& r);
  19053. void clipToPath (const Path& path, const AffineTransform& transform);
  19054. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19055. void saveState();
  19056. void restoreState();
  19057. bool clipRegionIntersects (const Rectangle<int>& r);
  19058. const Rectangle<int> getClipBounds() const;
  19059. bool isClipEmpty() const;
  19060. void setFill (const FillType& fillType);
  19061. void setOpacity (float opacity);
  19062. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19063. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19064. void fillPath (const Path& path, const AffineTransform& transform);
  19065. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19066. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19067. void drawLine (double x1, double y1, double x2, double y2);
  19068. void drawVerticalLine (int x, double top, double bottom);
  19069. void drawHorizontalLine (int x, double top, double bottom);
  19070. const Font getFont();
  19071. void setFont (const Font& newFont);
  19072. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19073. juce_UseDebuggingNewOperator
  19074. protected:
  19075. OutputStream& out;
  19076. int totalWidth, totalHeight;
  19077. bool needToClip;
  19078. Colour lastColour;
  19079. struct SavedState
  19080. {
  19081. SavedState();
  19082. ~SavedState();
  19083. RectangleList clip;
  19084. int xOffset, yOffset;
  19085. FillType fillType;
  19086. Font font;
  19087. private:
  19088. SavedState& operator= (const SavedState&);
  19089. };
  19090. OwnedArray <SavedState> stateStack;
  19091. void writeClip();
  19092. void writeColour (const Colour& colour);
  19093. void writePath (const Path& path) const;
  19094. void writeXY (float x, float y) const;
  19095. void writeTransform (const AffineTransform& trans) const;
  19096. void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
  19097. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  19098. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  19099. };
  19100. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  19101. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  19102. #endif
  19103. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19104. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19105. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19106. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19107. class LLGCSavedState;
  19108. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  19109. {
  19110. public:
  19111. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  19112. ~LowLevelGraphicsSoftwareRenderer();
  19113. bool isVectorDevice() const;
  19114. void setOrigin (int x, int y);
  19115. bool clipToRectangle (const Rectangle<int>& r);
  19116. bool clipToRectangleList (const RectangleList& clipRegion);
  19117. void excludeClipRectangle (const Rectangle<int>& r);
  19118. void clipToPath (const Path& path, const AffineTransform& transform);
  19119. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  19120. bool clipRegionIntersects (const Rectangle<int>& r);
  19121. const Rectangle<int> getClipBounds() const;
  19122. bool isClipEmpty() const;
  19123. void saveState();
  19124. void restoreState();
  19125. void setFill (const FillType& fillType);
  19126. void setOpacity (float opacity);
  19127. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  19128. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  19129. void fillPath (const Path& path, const AffineTransform& transform);
  19130. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  19131. const AffineTransform& transform, bool fillEntireClipAsTiles);
  19132. void drawLine (double x1, double y1, double x2, double y2);
  19133. void drawVerticalLine (int x, double top, double bottom);
  19134. void drawHorizontalLine (int x, double top, double bottom);
  19135. void setFont (const Font& newFont);
  19136. const Font getFont();
  19137. void drawGlyph (int glyphNumber, float x, float y);
  19138. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  19139. juce_UseDebuggingNewOperator
  19140. protected:
  19141. Image& image;
  19142. ScopedPointer <LLGCSavedState> currentState;
  19143. OwnedArray <LLGCSavedState> stateStack;
  19144. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  19145. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  19146. };
  19147. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19148. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  19149. #endif
  19150. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  19151. #endif
  19152. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  19153. #endif
  19154. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19155. /*** Start of inlined file: juce_DrawableComposite.h ***/
  19156. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19157. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19158. class JUCE_API DrawableComposite : public Drawable
  19159. {
  19160. public:
  19161. DrawableComposite();
  19162. virtual ~DrawableComposite();
  19163. void insertDrawable (Drawable* drawable,
  19164. const AffineTransform& transform = AffineTransform::identity,
  19165. int index = -1);
  19166. void insertDrawable (const Drawable& drawable,
  19167. const AffineTransform& transform = AffineTransform::identity,
  19168. int index = -1);
  19169. void removeDrawable (int index, bool deleteDrawable = true);
  19170. int getNumDrawables() const throw() { return drawables.size(); }
  19171. Drawable* getDrawable (int index) const throw() { return drawables [index]; }
  19172. const AffineTransform* getDrawableTransform (int index) const throw() { return transforms [index]; }
  19173. void bringToFront (int index);
  19174. void render (const Drawable::RenderingContext& context) const;
  19175. const Rectangle<float> getBounds() const;
  19176. bool hitTest (float x, float y) const;
  19177. Drawable* createCopy() const;
  19178. ValueTree createValueTree() const throw();
  19179. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  19180. juce_UseDebuggingNewOperator
  19181. private:
  19182. OwnedArray <Drawable> drawables;
  19183. OwnedArray <AffineTransform> transforms;
  19184. DrawableComposite (const DrawableComposite&);
  19185. DrawableComposite& operator= (const DrawableComposite&);
  19186. };
  19187. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  19188. /*** End of inlined file: juce_DrawableComposite.h ***/
  19189. #endif
  19190. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19191. /*** Start of inlined file: juce_DrawableImage.h ***/
  19192. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19193. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19194. class JUCE_API DrawableImage : public Drawable
  19195. {
  19196. public:
  19197. DrawableImage();
  19198. virtual ~DrawableImage();
  19199. void setImage (const Image& imageToCopy);
  19200. void setImage (Image* imageToUse,
  19201. bool releaseWhenNotNeeded);
  19202. Image* getImage() const throw() { return image; }
  19203. void clearImage();
  19204. void setOpacity (float newOpacity);
  19205. float getOpacity() const throw() { return opacity; }
  19206. void setOverlayColour (const Colour& newOverlayColour);
  19207. const Colour& getOverlayColour() const throw() { return overlayColour; }
  19208. void render (const Drawable::RenderingContext& context) const;
  19209. const Rectangle<float> getBounds() const;
  19210. bool hitTest (float x, float y) const;
  19211. Drawable* createCopy() const;
  19212. ValueTree createValueTree() const throw();
  19213. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  19214. juce_UseDebuggingNewOperator
  19215. private:
  19216. Image* image;
  19217. bool canDeleteImage;
  19218. float opacity;
  19219. Colour overlayColour;
  19220. DrawableImage (const DrawableImage&);
  19221. DrawableImage& operator= (const DrawableImage&);
  19222. };
  19223. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  19224. /*** End of inlined file: juce_DrawableImage.h ***/
  19225. #endif
  19226. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19227. /*** Start of inlined file: juce_DrawablePath.h ***/
  19228. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  19229. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  19230. class JUCE_API DrawablePath : public Drawable
  19231. {
  19232. public:
  19233. DrawablePath();
  19234. virtual ~DrawablePath();
  19235. void setPath (const Path& newPath) throw();
  19236. const Path& getPath() const throw() { return path; }
  19237. void setFill (const FillType& newFill) throw();
  19238. const FillType& getFill() const throw() { return mainFill; }
  19239. void setStrokeFill (const FillType& newStrokeFill) throw();
  19240. const FillType& getStrokeFill() const throw() { return strokeFill; }
  19241. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  19242. void setStrokeThickness (float newThickness) throw();
  19243. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  19244. void render (const Drawable::RenderingContext& context) const;
  19245. const Rectangle<float> getBounds() const;
  19246. bool hitTest (float x, float y) const;
  19247. Drawable* createCopy() const;
  19248. ValueTree createValueTree() const throw();
  19249. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  19250. juce_UseDebuggingNewOperator
  19251. private:
  19252. Path path, stroke;
  19253. FillType mainFill, strokeFill;
  19254. PathStrokeType strokeType;
  19255. void updateOutline();
  19256. DrawablePath (const DrawablePath&);
  19257. DrawablePath& operator= (const DrawablePath&);
  19258. };
  19259. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  19260. /*** End of inlined file: juce_DrawablePath.h ***/
  19261. #endif
  19262. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19263. /*** Start of inlined file: juce_DrawableText.h ***/
  19264. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19265. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19266. class JUCE_API DrawableText : public Drawable
  19267. {
  19268. public:
  19269. DrawableText();
  19270. virtual ~DrawableText();
  19271. void setText (const GlyphArrangement& newText);
  19272. void setText (const String& newText, const Font& fontToUse);
  19273. const GlyphArrangement& getText() const throw() { return text; }
  19274. void setColour (const Colour& newColour);
  19275. const Colour& getColour() const throw() { return colour; }
  19276. void render (const Drawable::RenderingContext& context) const;
  19277. const Rectangle<float> getBounds() const;
  19278. bool hitTest (float x, float y) const;
  19279. Drawable* createCopy() const;
  19280. ValueTree createValueTree() const throw();
  19281. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19282. juce_UseDebuggingNewOperator
  19283. private:
  19284. GlyphArrangement text;
  19285. Colour colour;
  19286. DrawableText (const DrawableText&);
  19287. DrawableText& operator= (const DrawableText&);
  19288. };
  19289. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19290. /*** End of inlined file: juce_DrawableText.h ***/
  19291. #endif
  19292. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19293. #endif
  19294. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19295. /*** Start of inlined file: juce_GlowEffect.h ***/
  19296. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19297. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19298. class JUCE_API GlowEffect : public ImageEffectFilter
  19299. {
  19300. public:
  19301. GlowEffect();
  19302. ~GlowEffect();
  19303. void setGlowProperties (const float newRadius,
  19304. const Colour& newColour);
  19305. void applyEffect (Image& sourceImage, Graphics& destContext);
  19306. juce_UseDebuggingNewOperator
  19307. private:
  19308. float radius;
  19309. Colour colour;
  19310. };
  19311. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19312. /*** End of inlined file: juce_GlowEffect.h ***/
  19313. #endif
  19314. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19315. #endif
  19316. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19317. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19318. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19319. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19320. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19321. {
  19322. public:
  19323. ReduceOpacityEffect (const float opacity = 1.0f);
  19324. ~ReduceOpacityEffect();
  19325. void setOpacity (const float newOpacity);
  19326. void applyEffect (Image& sourceImage, Graphics& destContext);
  19327. juce_UseDebuggingNewOperator
  19328. private:
  19329. float opacity;
  19330. };
  19331. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19332. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19333. #endif
  19334. #ifndef __JUCE_FONT_JUCEHEADER__
  19335. #endif
  19336. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19337. #endif
  19338. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19339. #endif
  19340. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19341. #endif
  19342. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19343. #endif
  19344. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19345. #endif
  19346. #ifndef __JUCE_LINE_JUCEHEADER__
  19347. #endif
  19348. #ifndef __JUCE_PATH_JUCEHEADER__
  19349. #endif
  19350. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19351. /*** Start of inlined file: juce_PathIterator.h ***/
  19352. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19353. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19354. class JUCE_API PathFlatteningIterator
  19355. {
  19356. public:
  19357. PathFlatteningIterator (const Path& path,
  19358. const AffineTransform& transform = AffineTransform::identity,
  19359. float tolerence = 6.0f);
  19360. ~PathFlatteningIterator();
  19361. bool next();
  19362. float x1;
  19363. float y1;
  19364. float x2;
  19365. float y2;
  19366. bool closesSubPath;
  19367. int subPathIndex;
  19368. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19369. && (index >= path.numElements
  19370. || points [index] == Path::moveMarker); }
  19371. juce_UseDebuggingNewOperator
  19372. private:
  19373. const Path& path;
  19374. const AffineTransform transform;
  19375. float* points;
  19376. float tolerence, subPathCloseX, subPathCloseY;
  19377. const bool isIdentityTransform;
  19378. HeapBlock <float> stackBase;
  19379. float* stackPos;
  19380. size_t index, stackSize;
  19381. PathFlatteningIterator (const PathFlatteningIterator&);
  19382. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19383. };
  19384. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19385. /*** End of inlined file: juce_PathIterator.h ***/
  19386. #endif
  19387. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19388. #endif
  19389. #ifndef __JUCE_POINT_JUCEHEADER__
  19390. #endif
  19391. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19392. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19393. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19394. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19395. class JUCE_API PositionedRectangle
  19396. {
  19397. public:
  19398. PositionedRectangle() throw();
  19399. PositionedRectangle (const String& stringVersion) throw();
  19400. PositionedRectangle (const PositionedRectangle& other) throw();
  19401. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19402. ~PositionedRectangle() throw();
  19403. const String toString() const throw();
  19404. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19405. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19406. double& x,
  19407. double& y,
  19408. double& width,
  19409. double& height) const throw();
  19410. void applyToComponent (Component& comp) const throw();
  19411. void updateFrom (const Rectangle<int>& newPosition,
  19412. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19413. void updateFromDouble (double x, double y, double width, double height,
  19414. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19415. void updateFromComponent (const Component& comp) throw();
  19416. enum AnchorPoint
  19417. {
  19418. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19419. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19420. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19421. };
  19422. enum PositionMode
  19423. {
  19424. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19425. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19426. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19427. 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. */
  19428. };
  19429. enum SizeMode
  19430. {
  19431. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19432. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19433. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19434. };
  19435. void setModes (const AnchorPoint xAnchorMode,
  19436. const PositionMode xPositionMode,
  19437. const AnchorPoint yAnchorMode,
  19438. const PositionMode yPositionMode,
  19439. const SizeMode widthMode,
  19440. const SizeMode heightMode,
  19441. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19442. AnchorPoint getAnchorPointX() const throw();
  19443. PositionMode getPositionModeX() const throw();
  19444. double getX() const throw() { return x; }
  19445. void setX (const double newX) throw() { x = newX; }
  19446. AnchorPoint getAnchorPointY() const throw();
  19447. PositionMode getPositionModeY() const throw();
  19448. double getY() const throw() { return y; }
  19449. void setY (const double newY) throw() { y = newY; }
  19450. SizeMode getWidthMode() const throw();
  19451. double getWidth() const throw() { return w; }
  19452. void setWidth (const double newWidth) throw() { w = newWidth; }
  19453. SizeMode getHeightMode() const throw();
  19454. double getHeight() const throw() { return h; }
  19455. void setHeight (const double newHeight) throw() { h = newHeight; }
  19456. bool isPositionAbsolute() const throw();
  19457. bool operator== (const PositionedRectangle& other) const throw();
  19458. bool operator!= (const PositionedRectangle& other) const throw();
  19459. juce_UseDebuggingNewOperator
  19460. private:
  19461. double x, y, w, h;
  19462. uint8 xMode, yMode, wMode, hMode;
  19463. void addPosDescription (String& result, uint8 mode, double value) const throw();
  19464. void addSizeDescription (String& result, uint8 mode, double value) const throw();
  19465. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19466. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19467. void applyPosAndSize (double& xOut, double& wOut, double x, double w,
  19468. uint8 xMode, uint8 wMode,
  19469. int parentPos, int parentSize) const throw();
  19470. void updatePosAndSize (double& xOut, double& wOut, double x, double w,
  19471. uint8 xMode, uint8 wMode,
  19472. int parentPos, int parentSize) const throw();
  19473. };
  19474. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19475. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19476. #endif
  19477. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19478. #endif
  19479. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19480. #endif
  19481. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19482. /*** Start of inlined file: juce_CameraDevice.h ***/
  19483. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19484. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19485. #if JUCE_USE_CAMERA
  19486. class CameraImageListener
  19487. {
  19488. public:
  19489. CameraImageListener() {}
  19490. virtual ~CameraImageListener() {}
  19491. virtual void imageReceived (Image& image) = 0;
  19492. };
  19493. class JUCE_API CameraDevice
  19494. {
  19495. public:
  19496. virtual ~CameraDevice();
  19497. static const StringArray getAvailableDevices();
  19498. static CameraDevice* openDevice (int deviceIndex,
  19499. int minWidth = 128, int minHeight = 64,
  19500. int maxWidth = 1024, int maxHeight = 768);
  19501. const String getName() const { return name; }
  19502. Component* createViewerComponent();
  19503. void startRecordingToFile (const File& file, int quality = 2);
  19504. void stopRecording();
  19505. static const String getFileExtension();
  19506. const Time getTimeOfFirstRecordedFrame() const;
  19507. void addListener (CameraImageListener* listenerToAdd);
  19508. void removeListener (CameraImageListener* listenerToRemove);
  19509. juce_UseDebuggingNewOperator
  19510. protected:
  19511. CameraDevice (const String& name, int index);
  19512. private:
  19513. void* internal;
  19514. bool isRecording;
  19515. String name;
  19516. CameraDevice (const CameraDevice&);
  19517. CameraDevice& operator= (const CameraDevice&);
  19518. };
  19519. #endif
  19520. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19521. /*** End of inlined file: juce_CameraDevice.h ***/
  19522. #endif
  19523. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19524. #endif
  19525. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19526. /*** Start of inlined file: juce_ImageCache.h ***/
  19527. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19528. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19529. class JUCE_API ImageCache : private DeletedAtShutdown,
  19530. private Timer
  19531. {
  19532. public:
  19533. static Image* getFromFile (const File& file);
  19534. static Image* getFromMemory (const void* imageData, int dataSize);
  19535. static void release (Image* imageToRelease);
  19536. static void releaseOrDelete (Image* imageToRelease);
  19537. static bool isImageInCache (Image* imageToLookFor);
  19538. static void incReferenceCount (Image* image);
  19539. static Image* getFromHashCode (int64 hashCode);
  19540. static void addImageToCache (Image* image, int64 hashCode);
  19541. static void setCacheTimeout (int millisecs);
  19542. juce_UseDebuggingNewOperator
  19543. private:
  19544. CriticalSection lock;
  19545. struct Item;
  19546. friend class ScopedPointer<Item>;
  19547. friend class OwnedArray<Item>;
  19548. OwnedArray<Item> images;
  19549. static ImageCache* instance;
  19550. static int cacheTimeout;
  19551. ImageCache();
  19552. ImageCache (const ImageCache&);
  19553. ImageCache& operator= (const ImageCache&);
  19554. ~ImageCache();
  19555. void timerCallback();
  19556. };
  19557. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19558. /*** End of inlined file: juce_ImageCache.h ***/
  19559. #endif
  19560. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19561. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19562. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19563. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19564. class JUCE_API ImageConvolutionKernel
  19565. {
  19566. public:
  19567. ImageConvolutionKernel (int size);
  19568. ~ImageConvolutionKernel();
  19569. void clear();
  19570. float getKernelValue (int x, int y) const throw();
  19571. void setKernelValue (int x, int y, float value) throw();
  19572. void setOverallSum (float desiredTotalSum);
  19573. void rescaleAllValues (float multiplier);
  19574. void createGaussianBlur (float blurRadius);
  19575. int getKernelSize() const { return size; }
  19576. void applyToImage (Image& destImage,
  19577. const Image* sourceImage,
  19578. const Rectangle<int>& destinationArea) const;
  19579. juce_UseDebuggingNewOperator
  19580. private:
  19581. HeapBlock <float> values;
  19582. const int size;
  19583. // no reason not to implement these one day..
  19584. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19585. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19586. };
  19587. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19588. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19589. #endif
  19590. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19591. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19592. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19593. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19594. class JUCE_API ImageFileFormat
  19595. {
  19596. protected:
  19597. ImageFileFormat() {}
  19598. public:
  19599. virtual ~ImageFileFormat() {}
  19600. virtual const String getFormatName() = 0;
  19601. virtual bool canUnderstand (InputStream& input) = 0;
  19602. virtual Image* decodeImage (InputStream& input) = 0;
  19603. virtual bool writeImageToStream (const Image& sourceImage,
  19604. OutputStream& destStream) = 0;
  19605. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19606. static Image* loadFrom (InputStream& input);
  19607. static Image* loadFrom (const File& file);
  19608. static Image* loadFrom (const void* rawData,
  19609. const int numBytesOfData);
  19610. };
  19611. class JUCE_API PNGImageFormat : public ImageFileFormat
  19612. {
  19613. public:
  19614. PNGImageFormat();
  19615. ~PNGImageFormat();
  19616. const String getFormatName();
  19617. bool canUnderstand (InputStream& input);
  19618. Image* decodeImage (InputStream& input);
  19619. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19620. };
  19621. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19622. {
  19623. public:
  19624. JPEGImageFormat();
  19625. ~JPEGImageFormat();
  19626. void setQuality (const float newQuality);
  19627. const String getFormatName();
  19628. bool canUnderstand (InputStream& input);
  19629. Image* decodeImage (InputStream& input);
  19630. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19631. private:
  19632. float quality;
  19633. };
  19634. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19635. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19636. #endif
  19637. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19638. #endif
  19639. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19640. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19641. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19642. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19643. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19644. {
  19645. public:
  19646. FileBasedDocument (const String& fileExtension,
  19647. const String& fileWildCard,
  19648. const String& openFileDialogTitle,
  19649. const String& saveFileDialogTitle);
  19650. virtual ~FileBasedDocument();
  19651. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19652. virtual void changed();
  19653. void setChangedFlag (bool hasChanged);
  19654. bool loadFrom (const File& fileToLoadFrom,
  19655. bool showMessageOnFailure);
  19656. bool loadFromUserSpecifiedFile (bool showMessageOnFailure);
  19657. enum SaveResult
  19658. {
  19659. savedOk = 0, /**< indicates that a file was saved successfully. */
  19660. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19661. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19662. };
  19663. SaveResult save (bool askUserForFileIfNotSpecified,
  19664. bool showMessageOnFailure);
  19665. SaveResult saveIfNeededAndUserAgrees();
  19666. SaveResult saveAs (const File& newFile,
  19667. bool warnAboutOverwritingExistingFiles,
  19668. bool askUserForFileIfNotSpecified,
  19669. bool showMessageOnFailure);
  19670. SaveResult saveAsInteractive (bool warnAboutOverwritingExistingFiles);
  19671. const File getFile() const { return documentFile; }
  19672. void setFile (const File& newFile);
  19673. protected:
  19674. virtual const String getDocumentTitle() = 0;
  19675. virtual const String loadDocument (const File& file) = 0;
  19676. virtual const String saveDocument (const File& file) = 0;
  19677. virtual const File getLastDocumentOpened() = 0;
  19678. virtual void setLastDocumentOpened (const File& file) = 0;
  19679. public:
  19680. juce_UseDebuggingNewOperator
  19681. private:
  19682. File documentFile;
  19683. bool changedSinceSave;
  19684. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19685. FileBasedDocument (const FileBasedDocument&);
  19686. FileBasedDocument& operator= (const FileBasedDocument&);
  19687. };
  19688. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19689. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19690. #endif
  19691. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19692. #endif
  19693. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19694. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19695. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19696. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19697. class JUCE_API RecentlyOpenedFilesList
  19698. {
  19699. public:
  19700. RecentlyOpenedFilesList();
  19701. ~RecentlyOpenedFilesList();
  19702. void setMaxNumberOfItems (int newMaxNumber);
  19703. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19704. int getNumFiles() const;
  19705. const File getFile (int index) const;
  19706. const StringArray& getAllFilenames() const throw() { return files; }
  19707. void clear();
  19708. void addFile (const File& file);
  19709. void removeNonExistentFiles();
  19710. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19711. int baseItemId,
  19712. bool showFullPaths,
  19713. bool dontAddNonExistentFiles,
  19714. const File** filesToAvoid = 0);
  19715. const String toString() const;
  19716. void restoreFromString (const String& stringifiedVersion);
  19717. juce_UseDebuggingNewOperator
  19718. private:
  19719. StringArray files;
  19720. int maxNumberOfItems;
  19721. };
  19722. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19723. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19724. #endif
  19725. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19726. #endif
  19727. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19728. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19729. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19730. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19731. class JUCE_API SystemClipboard
  19732. {
  19733. public:
  19734. static void copyTextToClipboard (const String& text);
  19735. static const String getTextFromClipboard();
  19736. };
  19737. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19738. /*** End of inlined file: juce_SystemClipboard.h ***/
  19739. #endif
  19740. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19741. #endif
  19742. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19743. #endif
  19744. #endif
  19745. /*** End of inlined file: juce_app_includes.h ***/
  19746. #endif
  19747. #if JUCE_MSVC
  19748. #pragma warning (pop)
  19749. #pragma pack (pop)
  19750. #endif
  19751. END_JUCE_NAMESPACE
  19752. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19753. #ifdef JUCE_NAMESPACE
  19754. // this will obviously save a lot of typing, but can be disabled by
  19755. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19756. using namespace JUCE_NAMESPACE;
  19757. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19758. #define Component JUCE_NAMESPACE::Component
  19759. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19760. #define Point JUCE_NAMESPACE::Point
  19761. #define Button JUCE_NAMESPACE::Button
  19762. #endif
  19763. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19764. #define Rectangle JUCE_NAMESPACE::Rectangle
  19765. #endif
  19766. #endif
  19767. #endif
  19768. #if JUCE_MSVC
  19769. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19770. #ifdef JUCE_DLL
  19771. #ifdef JUCE_DEBUG
  19772. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19773. #else
  19774. #define AUTOLINKEDLIB "JUCE.lib"
  19775. #endif
  19776. #else
  19777. #ifdef JUCE_DEBUG
  19778. #ifdef _WIN64
  19779. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19780. #else
  19781. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19782. #endif
  19783. #else
  19784. #ifdef _WIN64
  19785. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19786. #else
  19787. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19788. #endif
  19789. #endif
  19790. #endif
  19791. #pragma comment(lib, AUTOLINKEDLIB)
  19792. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19793. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19794. #endif
  19795. // Auto-link the other win32 libs that are needed by library calls..
  19796. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19797. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19798. // Auto-links to various win32 libs that are needed by library calls..
  19799. #pragma comment(lib, "kernel32.lib")
  19800. #pragma comment(lib, "user32.lib")
  19801. #pragma comment(lib, "shell32.lib")
  19802. #pragma comment(lib, "gdi32.lib")
  19803. #pragma comment(lib, "vfw32.lib")
  19804. #pragma comment(lib, "comdlg32.lib")
  19805. #pragma comment(lib, "winmm.lib")
  19806. #pragma comment(lib, "wininet.lib")
  19807. #pragma comment(lib, "ole32.lib")
  19808. #pragma comment(lib, "oleaut32.lib")
  19809. #pragma comment(lib, "advapi32.lib")
  19810. #pragma comment(lib, "ws2_32.lib")
  19811. #pragma comment(lib, "comsupp.lib")
  19812. #pragma comment(lib, "version.lib")
  19813. #if JUCE_OPENGL
  19814. #pragma comment(lib, "OpenGL32.Lib")
  19815. #pragma comment(lib, "GlU32.Lib")
  19816. #endif
  19817. #if JUCE_QUICKTIME
  19818. #pragma comment (lib, "QTMLClient.lib")
  19819. #endif
  19820. #if JUCE_USE_CAMERA
  19821. #pragma comment (lib, "Strmiids.lib")
  19822. #pragma comment (lib, "wmvcore.lib")
  19823. #endif
  19824. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19825. #endif
  19826. #endif
  19827. #endif
  19828. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19829. #define START_JUCE_APPLICATION(AppClass) \
  19830. int main (int argc, char* argv[]) \
  19831. { \
  19832. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19833. }
  19834. #elif JUCE_WINDOWS
  19835. #ifdef _CONSOLE
  19836. #define START_JUCE_APPLICATION(AppClass) \
  19837. int main (int, char* argv[]) \
  19838. { \
  19839. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19840. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19841. }
  19842. #elif ! defined (_AFXDLL)
  19843. #ifdef _WINDOWS_
  19844. #define START_JUCE_APPLICATION(AppClass) \
  19845. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19846. { \
  19847. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19848. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19849. }
  19850. #else
  19851. #define START_JUCE_APPLICATION(AppClass) \
  19852. int __stdcall WinMain (int, int, const char*, int) \
  19853. { \
  19854. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19855. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19856. }
  19857. #endif
  19858. #endif
  19859. #endif
  19860. #endif // __JUCE_JUCEHEADER__
  19861. /*** End of inlined file: juce.h ***/
  19862. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__