| @@ -10362,8 +10362,7 @@ public: | |||||
| static const String createRandomWideCharString() | static const String createRandomWideCharString() | ||||
| { | { | ||||
| juce_wchar buffer [50]; | |||||
| zerostruct (buffer); | |||||
| juce_wchar buffer [50] = { 0 }; | |||||
| for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | ||||
| { | { | ||||
| @@ -11686,65 +11685,20 @@ String::String (const char* const t, const size_t maxChars) | |||||
| jassert (t == 0 || CharPointer_ASCII::isValidString (t, (int) maxChars)); | jassert (t == 0 || CharPointer_ASCII::isValidString (t, (int) maxChars)); | ||||
| } | } | ||||
| String::String (const CharPointer_UTF8& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& start, const CharPointer_UTF8& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& start, const CharPointer_UTF16& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF32& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const wchar_t* const t) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) {} | |||||
| String::String (const CharPointer_UTF8& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF16& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF32& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_ASCII& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF32& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const CharPointer_UTF16& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const CharPointer_UTF32& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const wchar_t* const t, size_t maxChars) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t), maxChars)) {} | |||||
| String::String (const CharPointer_UTF32& start, const CharPointer_UTF32& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_ASCII& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const wchar_t* const t) | |||||
| : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) | |||||
| { | |||||
| } | |||||
| String::String (const wchar_t* const t, size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t), maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& start, const CharPointer_UTF8& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| String::String (const CharPointer_UTF16& start, const CharPointer_UTF16& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| String::String (const CharPointer_UTF32& start, const CharPointer_UTF32& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| const String String::charToString (const juce_wchar character) | const String String::charToString (const juce_wchar character) | ||||
| { | { | ||||
| @@ -11827,11 +11781,13 @@ namespace NumberToStringConverters | |||||
| char getDecimalPoint() | char getDecimalPoint() | ||||
| { | { | ||||
| #if JUCE_VC7_OR_EARLIER | |||||
| static char dp = (char) std::_USE (std::locale(), std::numpunct <char>).decimal_point(); | |||||
| #else | |||||
| static char dp = (char) std::use_facet <std::numpunct <char> > (std::locale()).decimal_point(); | |||||
| #endif | |||||
| static char dp = (char) | |||||
| #if JUCE_VC7_OR_EARLIER | |||||
| std::_USE (std::locale(), std::numpunct <char>).decimal_point(); | |||||
| #else | |||||
| std::use_facet <std::numpunct <char> > (std::locale()).decimal_point(); | |||||
| #endif | |||||
| return dp; | return dp; | ||||
| } | } | ||||
| @@ -11887,45 +11843,15 @@ namespace NumberToStringConverters | |||||
| } | } | ||||
| } | } | ||||
| String::String (const int number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const int number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const unsigned int number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const short number) : text (NumberToStringConverters::createFromInteger ((int) number)) {} | |||||
| String::String (const unsigned short number) : text (NumberToStringConverters::createFromInteger ((unsigned int) number)) {} | |||||
| String::String (const int64 number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const uint64 number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const unsigned int number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const short number) | |||||
| : text (NumberToStringConverters::createFromInteger ((int) number)) | |||||
| { | |||||
| } | |||||
| String::String (const unsigned short number) | |||||
| : text (NumberToStringConverters::createFromInteger ((unsigned int) number)) | |||||
| { | |||||
| } | |||||
| String::String (const int64 number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const uint64 number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const float number, const int numberOfDecimalPlaces) | |||||
| : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) | |||||
| { | |||||
| } | |||||
| String::String (const double number, const int numberOfDecimalPlaces) | |||||
| : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) | |||||
| { | |||||
| } | |||||
| String::String (const float number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) {} | |||||
| String::String (const double number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) {} | |||||
| int String::length() const throw() | int String::length() const throw() | ||||
| { | { | ||||
| @@ -11970,12 +11896,12 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& str | |||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| @@ -12000,12 +11926,12 @@ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& str | |||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| @@ -12240,12 +12166,18 @@ JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const double number) { | |||||
| JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text) | JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text) | ||||
| { | { | ||||
| const int numBytes = text.getNumBytesAsUTF8(); | |||||
| #if (JUCE_STRING_UTF_TYPE == 8) | |||||
| stream.write (text.getCharPointer().getAddress(), numBytes); | |||||
| #else | |||||
| // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind | // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind | ||||
| // if lots of large, persistent strings were to be written to streams). | // if lots of large, persistent strings were to be written to streams). | ||||
| const int numBytes = text.getNumBytesAsUTF8(); | |||||
| HeapBlock<char> temp (numBytes + 1); | HeapBlock<char> temp (numBytes + 1); | ||||
| text.copyToUTF8 (temp, numBytes + 1); | |||||
| CharPointer_UTF8 (temp).writeAll (text.getCharPointer()); | |||||
| stream.write (temp, numBytes); | stream.write (temp, numBytes); | ||||
| #endif | |||||
| return stream; | return stream; | ||||
| } | } | ||||
| @@ -12873,7 +12805,7 @@ const String String::toUpperCase() const | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| juce_wchar c = builder.source.toUpperCase(); | |||||
| const juce_wchar c = builder.source.toUpperCase(); | |||||
| ++(builder.source); | ++(builder.source); | ||||
| builder.write (c); | builder.write (c); | ||||
| @@ -12890,7 +12822,7 @@ const String String::toLowerCase() const | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| juce_wchar c = builder.source.toLowerCase(); | |||||
| const juce_wchar c = builder.source.toLowerCase(); | |||||
| ++(builder.source); | ++(builder.source); | ||||
| builder.write (c); | builder.write (c); | ||||
| @@ -13309,7 +13241,7 @@ int String::getTrailingIntValue() const throw() | |||||
| int mult = 1; | int mult = 1; | ||||
| CharPointerType t (text.findTerminatingNull()); | CharPointerType t (text.findTerminatingNull()); | ||||
| while ((--t).getAddress() >= text) | |||||
| while (--t >= text) | |||||
| { | { | ||||
| if (! t.isDigit()) | if (! t.isDigit()) | ||||
| { | { | ||||
| @@ -13423,12 +13355,12 @@ const String String::toHexString (const unsigned char* data, const int size, con | |||||
| int String::getHexValue32() const throw() | int String::getHexValue32() const throw() | ||||
| { | { | ||||
| return HexConverter <int>::stringToHex (text); | |||||
| return HexConverter<int>::stringToHex (text); | |||||
| } | } | ||||
| int64 String::getHexValue64() const throw() | int64 String::getHexValue64() const throw() | ||||
| { | { | ||||
| return HexConverter <int64>::stringToHex (text); | |||||
| return HexConverter<int64>::stringToHex (text); | |||||
| } | } | ||||
| const String String::createStringFromData (const void* const data_, const int size) | const String String::createStringFromData (const void* const data_, const int size) | ||||
| @@ -13658,8 +13590,7 @@ public: | |||||
| static const String createRandomWideCharString() | static const String createRandomWideCharString() | ||||
| { | { | ||||
| juce_wchar buffer [50]; | |||||
| zerostruct (buffer); | |||||
| juce_wchar buffer[50] = { 0 }; | |||||
| for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | ||||
| { | { | ||||
| @@ -50552,14 +50483,14 @@ void Slider::mouseUp (const MouseEvent&) | |||||
| sendDragEnd(); | sendDragEnd(); | ||||
| popupDisplay = 0; | |||||
| if (style == IncDecButtons) | if (style == IncDecButtons) | ||||
| { | { | ||||
| incButton->setState (Button::buttonNormal); | incButton->setState (Button::buttonNormal); | ||||
| decButton->setState (Button::buttonNormal); | decButton->setState (Button::buttonNormal); | ||||
| } | } | ||||
| } | } | ||||
| popupDisplay = 0; | |||||
| } | } | ||||
| void Slider::restoreMouseIfHidden() | void Slider::restoreMouseIfHidden() | ||||
| @@ -60704,24 +60635,15 @@ const KeyPress KeyPress::createFromDescription (const String& desc) | |||||
| { | { | ||||
| const juce_wchar lastChar = desc.trimEnd().getLastCharacter(); | const juce_wchar lastChar = desc.trimEnd().getLastCharacter(); | ||||
| if (lastChar >= '0' && lastChar <= '9') | |||||
| key = numberPad0 + lastChar - '0'; | |||||
| else if (lastChar == '+') | |||||
| key = numberPadAdd; | |||||
| else if (lastChar == '-') | |||||
| key = numberPadSubtract; | |||||
| else if (lastChar == '*') | |||||
| key = numberPadMultiply; | |||||
| else if (lastChar == '/') | |||||
| key = numberPadDivide; | |||||
| else if (lastChar == '.') | |||||
| key = numberPadDecimalPoint; | |||||
| else if (lastChar == '=') | |||||
| key = numberPadEquals; | |||||
| else if (desc.endsWith ("separator")) | |||||
| key = numberPadSeparator; | |||||
| else if (desc.endsWith ("delete")) | |||||
| key = numberPadDelete; | |||||
| if (lastChar >= '0' && lastChar <= '9') key = numberPad0 + lastChar - '0'; | |||||
| else if (lastChar == '+') key = numberPadAdd; | |||||
| else if (lastChar == '-') key = numberPadSubtract; | |||||
| else if (lastChar == '*') key = numberPadMultiply; | |||||
| else if (lastChar == '/') key = numberPadDivide; | |||||
| else if (lastChar == '.') key = numberPadDecimalPoint; | |||||
| else if (lastChar == '=') key = numberPadEquals; | |||||
| else if (desc.endsWith ("separator")) key = numberPadSeparator; | |||||
| else if (desc.endsWith ("delete")) key = numberPadDelete; | |||||
| } | } | ||||
| if (key == 0) | if (key == 0) | ||||
| @@ -60785,28 +60707,17 @@ const String KeyPress::getTextDescription() const | |||||
| if (keyCode == KeyPressHelpers::translations[i].code) | if (keyCode == KeyPressHelpers::translations[i].code) | ||||
| return desc + KeyPressHelpers::translations[i].name; | return desc + KeyPressHelpers::translations[i].name; | ||||
| if (keyCode >= F1Key && keyCode <= F16Key) | |||||
| desc << 'F' << (1 + keyCode - F1Key); | |||||
| else if (keyCode >= numberPad0 && keyCode <= numberPad9) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << (keyCode - numberPad0); | |||||
| else if (keyCode >= 33 && keyCode < 176) | |||||
| desc += CharacterFunctions::toUpperCase ((juce_wchar) keyCode); | |||||
| else if (keyCode == numberPadAdd) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '+'; | |||||
| else if (keyCode == numberPadSubtract) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '-'; | |||||
| else if (keyCode == numberPadMultiply) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '*'; | |||||
| else if (keyCode == numberPadDivide) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '/'; | |||||
| else if (keyCode == numberPadSeparator) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << "separator"; | |||||
| else if (keyCode == numberPadDecimalPoint) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '.'; | |||||
| else if (keyCode == numberPadDelete) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << "delete"; | |||||
| else | |||||
| desc << '#' << String::toHexString (keyCode); | |||||
| if (keyCode >= F1Key && keyCode <= F16Key) desc << 'F' << (1 + keyCode - F1Key); | |||||
| else if (keyCode >= numberPad0 && keyCode <= numberPad9) desc << KeyPressHelpers::numberPadPrefix() << (keyCode - numberPad0); | |||||
| else if (keyCode >= 33 && keyCode < 176) desc += CharacterFunctions::toUpperCase ((juce_wchar) keyCode); | |||||
| else if (keyCode == numberPadAdd) desc << KeyPressHelpers::numberPadPrefix() << '+'; | |||||
| else if (keyCode == numberPadSubtract) desc << KeyPressHelpers::numberPadPrefix() << '-'; | |||||
| else if (keyCode == numberPadMultiply) desc << KeyPressHelpers::numberPadPrefix() << '*'; | |||||
| else if (keyCode == numberPadDivide) desc << KeyPressHelpers::numberPadPrefix() << '/'; | |||||
| else if (keyCode == numberPadSeparator) desc << KeyPressHelpers::numberPadPrefix() << "separator"; | |||||
| else if (keyCode == numberPadDecimalPoint) desc << KeyPressHelpers::numberPadPrefix() << '.'; | |||||
| else if (keyCode == numberPadDelete) desc << KeyPressHelpers::numberPadPrefix() << "delete"; | |||||
| else desc << '#' << String::toHexString (keyCode); | |||||
| } | } | ||||
| return desc; | return desc; | ||||
| @@ -60817,7 +60728,15 @@ const String KeyPress::getTextDescriptionWithIcons() const | |||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| return getTextDescription().replace ("shift + ", String::charToString (0x21e7)) | return getTextDescription().replace ("shift + ", String::charToString (0x21e7)) | ||||
| .replace ("command + ", String::charToString (0x2318)) | .replace ("command + ", String::charToString (0x2318)) | ||||
| .replace ("option + ", String::charToString (0x2325)); | |||||
| .replace ("option + ", String::charToString (0x2325)) | |||||
| .replace ("ctrl + ", String::charToString (0x2303)) | |||||
| .replace ("return", String::charToString (0x23ce)) | |||||
| .replace ("cursor left", String::charToString (0x2190)) | |||||
| .replace ("cursor right", String::charToString (0x2192)) | |||||
| .replace ("cursor up", String::charToString (0x2191)) | |||||
| .replace ("cursor down", String::charToString (0x2193)) | |||||
| .replace ("backspace", String::charToString (0x232b)) | |||||
| .replace ("delete", String::charToString (0x2326)); | |||||
| #else | #else | ||||
| return getTextDescription(); | return getTextDescription(); | ||||
| #endif | #endif | ||||
| @@ -283910,15 +283829,12 @@ public: | |||||
| } | } | ||||
| void initialise (JNIEnv* env, jobject activity_, | void initialise (JNIEnv* env, jobject activity_, | ||||
| jstring appFile_, jstring appDataDir_, | |||||
| int screenWidth_, int screenHeight_) | |||||
| jstring appFile_, jstring appDataDir_) | |||||
| { | { | ||||
| threadLocalJNIEnvHolder.initialise (env); | threadLocalJNIEnvHolder.initialise (env); | ||||
| activity = GlobalRef (activity_); | activity = GlobalRef (activity_); | ||||
| appFile = juceString (appFile_); | appFile = juceString (appFile_); | ||||
| appDataDir = juceString (appDataDir_); | appDataDir = juceString (appDataDir_); | ||||
| screenWidth = screenWidth_; | |||||
| screenHeight = screenHeight_; | |||||
| #define CREATE_JNI_CLASS(className, path) \ | #define CREATE_JNI_CLASS(className, path) \ | ||||
| className = (jclass) env->NewGlobalRef (env->FindClass (path)); \ | className = (jclass) env->NewGlobalRef (env->FindClass (path)); \ | ||||
| @@ -284015,10 +283931,9 @@ extern JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication(); // (from START | |||||
| BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
| JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activity, | JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activity, | ||||
| jstring appFile, jstring appDataDir, | |||||
| int screenWidth, int screenHeight)) | |||||
| jstring appFile, jstring appDataDir)) | |||||
| { | { | ||||
| android.initialise (env, activity, appFile, appDataDir, screenWidth, screenHeight); | |||||
| android.initialise (env, activity, appFile, appDataDir); | |||||
| JUCEApplication::createInstance = &juce_CreateApplication; | JUCEApplication::createInstance = &juce_CreateApplication; | ||||
| @@ -286603,7 +286518,9 @@ public: | |||||
| AndroidComponentPeer (Component* const component, const int windowStyleFlags) | AndroidComponentPeer (Component* const component, const int windowStyleFlags) | ||||
| : ComponentPeer (component, windowStyleFlags), | : ComponentPeer (component, windowStyleFlags), | ||||
| view (android.activity.callObjectMethod (android.createNewView, component->isOpaque())), | view (android.activity.callObjectMethod (android.createNewView, component->isOpaque())), | ||||
| usingAndroidGraphics (false), sizeAllocated (0) | |||||
| usingAndroidGraphics (false), | |||||
| fullScreen (false), | |||||
| sizeAllocated (0) | |||||
| { | { | ||||
| if (isFocused()) | if (isFocused()) | ||||
| handleFocusGain(); | handleFocusGain(); | ||||
| @@ -286698,6 +286615,10 @@ public: | |||||
| { | { | ||||
| if (MessageManager::getInstance()->isThisTheMessageThread()) | if (MessageManager::getInstance()->isThisTheMessageThread()) | ||||
| { | { | ||||
| fullScreen = isNowFullScreen; | |||||
| w = jmax (0, w); | |||||
| h = jmax (0, h); | |||||
| view.callVoidMethod (android.layout, x, y, x + w, y + h); | view.callVoidMethod (android.layout, x, y, x + w, y + h); | ||||
| } | } | ||||
| else | else | ||||
| @@ -286751,7 +286672,7 @@ public: | |||||
| void setMinimised (bool shouldBeMinimised) | void setMinimised (bool shouldBeMinimised) | ||||
| { | { | ||||
| // TODO | |||||
| // n/a | |||||
| } | } | ||||
| bool isMinimised() const | bool isMinimised() const | ||||
| @@ -286761,18 +286682,27 @@ public: | |||||
| void setFullScreen (bool shouldBeFullScreen) | void setFullScreen (bool shouldBeFullScreen) | ||||
| { | { | ||||
| // TODO | |||||
| Rectangle<int> r (shouldBeFullScreen ? Desktop::getInstance().getMainMonitorArea() | |||||
| : lastNonFullscreenBounds); | |||||
| if ((! shouldBeFullScreen) && r.isEmpty()) | |||||
| r = getBounds(); | |||||
| // (can't call the component's setBounds method because that'll reset our fullscreen flag) | |||||
| if (! r.isEmpty()) | |||||
| setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen); | |||||
| component->repaint(); | |||||
| } | } | ||||
| bool isFullScreen() const | bool isFullScreen() const | ||||
| { | { | ||||
| // TODO | |||||
| return false; | |||||
| return fullScreen; | |||||
| } | } | ||||
| void setIcon (const Image& newIcon) | void setIcon (const Image& newIcon) | ||||
| { | { | ||||
| // TODO | |||||
| // n/a | |||||
| } | } | ||||
| bool contains (const Point<int>& position, bool trueIfInAChildWindow) const | bool contains (const Point<int>& position, bool trueIfInAChildWindow) const | ||||
| @@ -286991,7 +286921,7 @@ private: | |||||
| GlobalRef view; | GlobalRef view; | ||||
| GlobalRef buffer; | GlobalRef buffer; | ||||
| bool usingAndroidGraphics; | |||||
| bool usingAndroidGraphics, fullScreen; | |||||
| int sizeAllocated; | int sizeAllocated; | ||||
| class PreallocatedImage : public Image::SharedImage | class PreallocatedImage : public Image::SharedImage | ||||
| @@ -287084,7 +287014,7 @@ ComponentPeer* Component::createNewPeer (int styleFlags, void*) | |||||
| bool Desktop::canUseSemiTransparentWindows() throw() | bool Desktop::canUseSemiTransparentWindows() throw() | ||||
| { | { | ||||
| return true; // TODO | |||||
| return true; | |||||
| } | } | ||||
| Desktop::DisplayOrientation Desktop::getCurrentOrientation() const | Desktop::DisplayOrientation Desktop::getCurrentOrientation() const | ||||
| @@ -287159,6 +287089,13 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const | |||||
| monitorCoords.add (Rectangle<int> (0, 0, android.screenWidth, android.screenHeight)); | monitorCoords.add (Rectangle<int> (0, 0, android.screenWidth, android.screenHeight)); | ||||
| } | } | ||||
| JUCE_JNI_CALLBACK (JuceAppActivity, setScreenSize, void, (JNIEnv* env, jobject activity, | |||||
| jint screenWidth, jint screenHeight)) | |||||
| { | |||||
| android.screenWidth = screenWidth; | |||||
| android.screenHeight = screenHeight; | |||||
| } | |||||
| const Image juce_createIconForFile (const File& file) | const Image juce_createIconForFile (const File& file) | ||||
| { | { | ||||
| Image image; | Image image; | ||||
| @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 53 | #define JUCE_MINOR_VERSION 53 | ||||
| #define JUCE_BUILDNUMBER 38 | |||||
| #define JUCE_BUILDNUMBER 39 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -11152,19 +11152,16 @@ public: | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| /** Returns the object that this ScopedPointer refers to. | |||||
| */ | |||||
| /** Returns the object that this ScopedPointer refers to. */ | |||||
| inline operator ObjectType*() const throw() { return object; } | inline operator ObjectType*() const throw() { return object; } | ||||
| /** Returns the object that this ScopedPointer refers to. | |||||
| */ | |||||
| /** Returns the object that this ScopedPointer refers to. */ | |||||
| inline ObjectType& operator*() const throw() { return *object; } | inline ObjectType& operator*() const throw() { return *object; } | ||||
| /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ | /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ | ||||
| inline ObjectType* operator->() const throw() { return object; } | inline ObjectType* operator->() const throw() { return object; } | ||||
| /** Removes the current object from this ScopedPointer without deleting it. | /** Removes the current object from this ScopedPointer without deleting it. | ||||
| This will return the current object, and set the ScopedPointer to a null pointer. | This will return the current object, and set the ScopedPointer to a null pointer. | ||||
| */ | */ | ||||
| ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | ||||
| @@ -33,7 +33,7 @@ | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 53 | #define JUCE_MINOR_VERSION 53 | ||||
| #define JUCE_BUILDNUMBER 38 | |||||
| #define JUCE_BUILDNUMBER 39 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -1147,14 +1147,14 @@ void Slider::mouseUp (const MouseEvent&) | |||||
| sendDragEnd(); | sendDragEnd(); | ||||
| popupDisplay = 0; | |||||
| if (style == IncDecButtons) | if (style == IncDecButtons) | ||||
| { | { | ||||
| incButton->setState (Button::buttonNormal); | incButton->setState (Button::buttonNormal); | ||||
| decButton->setState (Button::buttonNormal); | decButton->setState (Button::buttonNormal); | ||||
| } | } | ||||
| } | } | ||||
| popupDisplay = 0; | |||||
| } | } | ||||
| void Slider::restoreMouseIfHidden() | void Slider::restoreMouseIfHidden() | ||||
| @@ -170,24 +170,15 @@ const KeyPress KeyPress::createFromDescription (const String& desc) | |||||
| { | { | ||||
| const juce_wchar lastChar = desc.trimEnd().getLastCharacter(); | const juce_wchar lastChar = desc.trimEnd().getLastCharacter(); | ||||
| if (lastChar >= '0' && lastChar <= '9') | |||||
| key = numberPad0 + lastChar - '0'; | |||||
| else if (lastChar == '+') | |||||
| key = numberPadAdd; | |||||
| else if (lastChar == '-') | |||||
| key = numberPadSubtract; | |||||
| else if (lastChar == '*') | |||||
| key = numberPadMultiply; | |||||
| else if (lastChar == '/') | |||||
| key = numberPadDivide; | |||||
| else if (lastChar == '.') | |||||
| key = numberPadDecimalPoint; | |||||
| else if (lastChar == '=') | |||||
| key = numberPadEquals; | |||||
| else if (desc.endsWith ("separator")) | |||||
| key = numberPadSeparator; | |||||
| else if (desc.endsWith ("delete")) | |||||
| key = numberPadDelete; | |||||
| if (lastChar >= '0' && lastChar <= '9') key = numberPad0 + lastChar - '0'; | |||||
| else if (lastChar == '+') key = numberPadAdd; | |||||
| else if (lastChar == '-') key = numberPadSubtract; | |||||
| else if (lastChar == '*') key = numberPadMultiply; | |||||
| else if (lastChar == '/') key = numberPadDivide; | |||||
| else if (lastChar == '.') key = numberPadDecimalPoint; | |||||
| else if (lastChar == '=') key = numberPadEquals; | |||||
| else if (desc.endsWith ("separator")) key = numberPadSeparator; | |||||
| else if (desc.endsWith ("delete")) key = numberPadDelete; | |||||
| } | } | ||||
| if (key == 0) | if (key == 0) | ||||
| @@ -251,28 +242,17 @@ const String KeyPress::getTextDescription() const | |||||
| if (keyCode == KeyPressHelpers::translations[i].code) | if (keyCode == KeyPressHelpers::translations[i].code) | ||||
| return desc + KeyPressHelpers::translations[i].name; | return desc + KeyPressHelpers::translations[i].name; | ||||
| if (keyCode >= F1Key && keyCode <= F16Key) | |||||
| desc << 'F' << (1 + keyCode - F1Key); | |||||
| else if (keyCode >= numberPad0 && keyCode <= numberPad9) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << (keyCode - numberPad0); | |||||
| else if (keyCode >= 33 && keyCode < 176) | |||||
| desc += CharacterFunctions::toUpperCase ((juce_wchar) keyCode); | |||||
| else if (keyCode == numberPadAdd) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '+'; | |||||
| else if (keyCode == numberPadSubtract) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '-'; | |||||
| else if (keyCode == numberPadMultiply) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '*'; | |||||
| else if (keyCode == numberPadDivide) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '/'; | |||||
| else if (keyCode == numberPadSeparator) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << "separator"; | |||||
| else if (keyCode == numberPadDecimalPoint) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << '.'; | |||||
| else if (keyCode == numberPadDelete) | |||||
| desc << KeyPressHelpers::numberPadPrefix() << "delete"; | |||||
| else | |||||
| desc << '#' << String::toHexString (keyCode); | |||||
| if (keyCode >= F1Key && keyCode <= F16Key) desc << 'F' << (1 + keyCode - F1Key); | |||||
| else if (keyCode >= numberPad0 && keyCode <= numberPad9) desc << KeyPressHelpers::numberPadPrefix() << (keyCode - numberPad0); | |||||
| else if (keyCode >= 33 && keyCode < 176) desc += CharacterFunctions::toUpperCase ((juce_wchar) keyCode); | |||||
| else if (keyCode == numberPadAdd) desc << KeyPressHelpers::numberPadPrefix() << '+'; | |||||
| else if (keyCode == numberPadSubtract) desc << KeyPressHelpers::numberPadPrefix() << '-'; | |||||
| else if (keyCode == numberPadMultiply) desc << KeyPressHelpers::numberPadPrefix() << '*'; | |||||
| else if (keyCode == numberPadDivide) desc << KeyPressHelpers::numberPadPrefix() << '/'; | |||||
| else if (keyCode == numberPadSeparator) desc << KeyPressHelpers::numberPadPrefix() << "separator"; | |||||
| else if (keyCode == numberPadDecimalPoint) desc << KeyPressHelpers::numberPadPrefix() << '.'; | |||||
| else if (keyCode == numberPadDelete) desc << KeyPressHelpers::numberPadPrefix() << "delete"; | |||||
| else desc << '#' << String::toHexString (keyCode); | |||||
| } | } | ||||
| return desc; | return desc; | ||||
| @@ -283,7 +263,15 @@ const String KeyPress::getTextDescriptionWithIcons() const | |||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| return getTextDescription().replace ("shift + ", String::charToString (0x21e7)) | return getTextDescription().replace ("shift + ", String::charToString (0x21e7)) | ||||
| .replace ("command + ", String::charToString (0x2318)) | .replace ("command + ", String::charToString (0x2318)) | ||||
| .replace ("option + ", String::charToString (0x2325)); | |||||
| .replace ("option + ", String::charToString (0x2325)) | |||||
| .replace ("ctrl + ", String::charToString (0x2303)) | |||||
| .replace ("return", String::charToString (0x23ce)) | |||||
| .replace ("cursor left", String::charToString (0x2190)) | |||||
| .replace ("cursor right", String::charToString (0x2192)) | |||||
| .replace ("cursor up", String::charToString (0x2191)) | |||||
| .replace ("cursor down", String::charToString (0x2193)) | |||||
| .replace ("backspace", String::charToString (0x232b)) | |||||
| .replace ("delete", String::charToString (0x2326)); | |||||
| #else | #else | ||||
| return getTextDescription(); | return getTextDescription(); | ||||
| #endif | #endif | ||||
| @@ -136,8 +136,7 @@ public: | |||||
| static const String createRandomWideCharString() | static const String createRandomWideCharString() | ||||
| { | { | ||||
| juce_wchar buffer [50]; | |||||
| zerostruct (buffer); | |||||
| juce_wchar buffer [50] = { 0 }; | |||||
| for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | ||||
| { | { | ||||
| @@ -128,12 +128,10 @@ public: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the object that this ScopedPointer refers to. | |||||
| */ | |||||
| /** Returns the object that this ScopedPointer refers to. */ | |||||
| inline operator ObjectType*() const throw() { return object; } | inline operator ObjectType*() const throw() { return object; } | ||||
| /** Returns the object that this ScopedPointer refers to. | |||||
| */ | |||||
| /** Returns the object that this ScopedPointer refers to. */ | |||||
| inline ObjectType& operator*() const throw() { return *object; } | inline ObjectType& operator*() const throw() { return *object; } | ||||
| /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ | /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ | ||||
| @@ -141,7 +139,6 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Removes the current object from this ScopedPointer without deleting it. | /** Removes the current object from this ScopedPointer without deleting it. | ||||
| This will return the current object, and set the ScopedPointer to a null pointer. | This will return the current object, and set the ScopedPointer to a null pointer. | ||||
| */ | */ | ||||
| ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } | ||||
| @@ -1,195 +1,199 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-10 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| package com.juce; | |||||
| import android.app.Activity; | |||||
| import android.os.Bundle; | |||||
| import android.content.Context; | |||||
| import android.view.ViewGroup; | |||||
| import android.view.Display; | |||||
| import android.view.WindowManager; | |||||
| import android.graphics.Paint; | |||||
| import android.graphics.Canvas; | |||||
| import android.graphics.Path; | |||||
| import android.graphics.Bitmap; | |||||
| import android.graphics.Matrix; | |||||
| import android.graphics.RectF; | |||||
| import android.graphics.Rect; | |||||
| import android.text.ClipboardManager; | |||||
| import com.juce.ComponentPeerView; | |||||
| //============================================================================== | |||||
| public final class JuceAppActivity extends Activity | |||||
| { | |||||
| //============================================================================== | |||||
| static | |||||
| { | |||||
| System.loadLibrary ("juce_jni"); | |||||
| } | |||||
| @Override | |||||
| public final void onCreate (Bundle savedInstanceState) | |||||
| { | |||||
| super.onCreate (savedInstanceState); | |||||
| viewHolder = new ViewHolder (this); | |||||
| setContentView (viewHolder); | |||||
| WindowManager wm = (WindowManager) getSystemService (WINDOW_SERVICE); | |||||
| Display display = wm.getDefaultDisplay(); | |||||
| launchApp (getApplicationInfo().publicSourceDir, | |||||
| getApplicationInfo().dataDir, | |||||
| display.getWidth(), display.getHeight()); | |||||
| } | |||||
| @Override | |||||
| protected final void onDestroy() | |||||
| { | |||||
| quitApp(); | |||||
| super.onDestroy(); | |||||
| } | |||||
| //============================================================================== | |||||
| public native void launchApp (String appFile, String appDataDir, | |||||
| int screenWidth, int screenHeight); | |||||
| public native void quitApp(); | |||||
| //============================================================================== | |||||
| public static final void printToConsole (String s) | |||||
| { | |||||
| android.util.Log.i ("Juce", s); | |||||
| } | |||||
| //============================================================================== | |||||
| public native void deliverMessage (long value); | |||||
| private android.os.Handler messageHandler = new android.os.Handler(); | |||||
| public final void postMessage (long value) | |||||
| { | |||||
| messageHandler.post (new MessageCallback (this, value)); | |||||
| } | |||||
| final class MessageCallback implements Runnable | |||||
| { | |||||
| public MessageCallback (JuceAppActivity app_, long value_) | |||||
| { | |||||
| app = app_; | |||||
| value = value_; | |||||
| } | |||||
| public final void run() | |||||
| { | |||||
| app.deliverMessage (value); | |||||
| } | |||||
| private JuceAppActivity app; | |||||
| private long value; | |||||
| } | |||||
| //============================================================================== | |||||
| private ViewHolder viewHolder; | |||||
| public final ComponentPeerView createNewView (boolean opaque) | |||||
| { | |||||
| ComponentPeerView v = new ComponentPeerView (this, opaque); | |||||
| viewHolder.addView (v); | |||||
| return v; | |||||
| } | |||||
| public final void deleteView (ComponentPeerView view) | |||||
| { | |||||
| viewHolder.removeView (view); | |||||
| } | |||||
| final class ViewHolder extends ViewGroup | |||||
| { | |||||
| public ViewHolder (Context context) | |||||
| { | |||||
| super (context); | |||||
| setDescendantFocusability (ViewGroup.FOCUS_AFTER_DESCENDANTS); | |||||
| setFocusable (false); | |||||
| } | |||||
| protected final void onLayout (boolean changed, int left, int top, int right, int bottom) | |||||
| { | |||||
| } | |||||
| } | |||||
| public final void excludeClipRegion (android.graphics.Canvas canvas, float left, float top, float right, float bottom) | |||||
| { | |||||
| canvas.clipRect (left, top, right, bottom, android.graphics.Region.Op.DIFFERENCE); | |||||
| } | |||||
| //============================================================================== | |||||
| public final String getClipboardContent() | |||||
| { | |||||
| ClipboardManager clipboard = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); | |||||
| return clipboard.getText().toString(); | |||||
| } | |||||
| public final void setClipboardContent (String newText) | |||||
| { | |||||
| ClipboardManager clipboard = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); | |||||
| clipboard.setText (newText); | |||||
| } | |||||
| //============================================================================== | |||||
| public final int[] renderGlyph (char glyph, Paint paint, Matrix matrix, Rect bounds) | |||||
| { | |||||
| Path p = new Path(); | |||||
| paint.getTextPath (String.valueOf (glyph), 0, 1, 0.0f, 0.0f, p); | |||||
| RectF boundsF = new RectF(); | |||||
| p.computeBounds (boundsF, true); | |||||
| matrix.mapRect (boundsF); | |||||
| boundsF.roundOut (bounds); | |||||
| bounds.left--; | |||||
| bounds.right++; | |||||
| final int w = bounds.width(); | |||||
| final int h = bounds.height(); | |||||
| Bitmap bm = Bitmap.createBitmap (w, h, Bitmap.Config.ARGB_8888); | |||||
| Canvas c = new Canvas (bm); | |||||
| matrix.postTranslate (-bounds.left, -bounds.top); | |||||
| c.setMatrix (matrix); | |||||
| c.drawPath (p, paint); | |||||
| int sizeNeeded = w * h; | |||||
| if (cachedRenderArray.length < sizeNeeded) | |||||
| cachedRenderArray = new int [sizeNeeded]; | |||||
| bm.getPixels (cachedRenderArray, 0, w, 0, 0, w, h); | |||||
| bm.recycle(); | |||||
| return cachedRenderArray; | |||||
| } | |||||
| private int[] cachedRenderArray = new int [256]; | |||||
| } | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-10 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| package com.juce; | |||||
| import android.app.Activity; | |||||
| import android.os.Bundle; | |||||
| import android.content.Context; | |||||
| import android.view.ViewGroup; | |||||
| import android.graphics.Paint; | |||||
| import android.graphics.Canvas; | |||||
| import android.graphics.Path; | |||||
| import android.graphics.Bitmap; | |||||
| import android.graphics.Matrix; | |||||
| import android.graphics.RectF; | |||||
| import android.graphics.Rect; | |||||
| import android.text.ClipboardManager; | |||||
| import com.juce.ComponentPeerView; | |||||
| //============================================================================== | |||||
| public final class JuceAppActivity extends Activity | |||||
| { | |||||
| //============================================================================== | |||||
| static | |||||
| { | |||||
| System.loadLibrary ("juce_jni"); | |||||
| } | |||||
| @Override | |||||
| public final void onCreate (Bundle savedInstanceState) | |||||
| { | |||||
| super.onCreate (savedInstanceState); | |||||
| viewHolder = new ViewHolder (this); | |||||
| setContentView (viewHolder); | |||||
| } | |||||
| @Override | |||||
| protected final void onDestroy() | |||||
| { | |||||
| quitApp(); | |||||
| super.onDestroy(); | |||||
| } | |||||
| private void callAppLauncher() | |||||
| { | |||||
| launchApp (getApplicationInfo().publicSourceDir, | |||||
| getApplicationInfo().dataDir); | |||||
| } | |||||
| //============================================================================== | |||||
| public native void launchApp (String appFile, String appDataDir); | |||||
| public native void quitApp(); | |||||
| public native void setScreenSize (int screenWidth, int screenHeight); | |||||
| //============================================================================== | |||||
| public static final void printToConsole (String s) | |||||
| { | |||||
| android.util.Log.i ("Juce", s); | |||||
| } | |||||
| //============================================================================== | |||||
| public native void deliverMessage (long value); | |||||
| private android.os.Handler messageHandler = new android.os.Handler(); | |||||
| public final void postMessage (long value) | |||||
| { | |||||
| messageHandler.post (new MessageCallback (value)); | |||||
| } | |||||
| final class MessageCallback implements Runnable | |||||
| { | |||||
| public MessageCallback (long value_) | |||||
| { | |||||
| value = value_; | |||||
| } | |||||
| public final void run() | |||||
| { | |||||
| deliverMessage (value); | |||||
| } | |||||
| private long value; | |||||
| } | |||||
| //============================================================================== | |||||
| private ViewHolder viewHolder; | |||||
| public final ComponentPeerView createNewView (boolean opaque) | |||||
| { | |||||
| ComponentPeerView v = new ComponentPeerView (this, opaque); | |||||
| viewHolder.addView (v); | |||||
| return v; | |||||
| } | |||||
| public final void deleteView (ComponentPeerView view) | |||||
| { | |||||
| viewHolder.removeView (view); | |||||
| } | |||||
| final class ViewHolder extends ViewGroup | |||||
| { | |||||
| public ViewHolder (Context context) | |||||
| { | |||||
| super (context); | |||||
| setDescendantFocusability (ViewGroup.FOCUS_AFTER_DESCENDANTS); | |||||
| setFocusable (false); | |||||
| } | |||||
| protected final void onLayout (boolean changed, int left, int top, int right, int bottom) | |||||
| { | |||||
| setScreenSize (getWidth(), getHeight()); | |||||
| if (isFirstResize) | |||||
| { | |||||
| isFirstResize = false; | |||||
| callAppLauncher(); | |||||
| } | |||||
| } | |||||
| private boolean isFirstResize = true; | |||||
| } | |||||
| public final void excludeClipRegion (android.graphics.Canvas canvas, float left, float top, float right, float bottom) | |||||
| { | |||||
| canvas.clipRect (left, top, right, bottom, android.graphics.Region.Op.DIFFERENCE); | |||||
| } | |||||
| //============================================================================== | |||||
| public final String getClipboardContent() | |||||
| { | |||||
| ClipboardManager clipboard = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); | |||||
| return clipboard.getText().toString(); | |||||
| } | |||||
| public final void setClipboardContent (String newText) | |||||
| { | |||||
| ClipboardManager clipboard = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); | |||||
| clipboard.setText (newText); | |||||
| } | |||||
| //============================================================================== | |||||
| public final int[] renderGlyph (char glyph, Paint paint, Matrix matrix, Rect bounds) | |||||
| { | |||||
| Path p = new Path(); | |||||
| paint.getTextPath (String.valueOf (glyph), 0, 1, 0.0f, 0.0f, p); | |||||
| RectF boundsF = new RectF(); | |||||
| p.computeBounds (boundsF, true); | |||||
| matrix.mapRect (boundsF); | |||||
| boundsF.roundOut (bounds); | |||||
| bounds.left--; | |||||
| bounds.right++; | |||||
| final int w = bounds.width(); | |||||
| final int h = bounds.height(); | |||||
| Bitmap bm = Bitmap.createBitmap (w, h, Bitmap.Config.ARGB_8888); | |||||
| Canvas c = new Canvas (bm); | |||||
| matrix.postTranslate (-bounds.left, -bounds.top); | |||||
| c.setMatrix (matrix); | |||||
| c.drawPath (p, paint); | |||||
| int sizeNeeded = w * h; | |||||
| if (cachedRenderArray.length < sizeNeeded) | |||||
| cachedRenderArray = new int [sizeNeeded]; | |||||
| bm.getPixels (cachedRenderArray, 0, w, 0, 0, w, h); | |||||
| bm.recycle(); | |||||
| return cachedRenderArray; | |||||
| } | |||||
| private int[] cachedRenderArray = new int [256]; | |||||
| } | |||||
| @@ -33,10 +33,9 @@ BEGIN_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activity, | JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activity, | ||||
| jstring appFile, jstring appDataDir, | |||||
| int screenWidth, int screenHeight)) | |||||
| jstring appFile, jstring appDataDir)) | |||||
| { | { | ||||
| android.initialise (env, activity, appFile, appDataDir, screenWidth, screenHeight); | |||||
| android.initialise (env, activity, appFile, appDataDir); | |||||
| JUCEApplication::createInstance = &juce_CreateApplication; | JUCEApplication::createInstance = &juce_CreateApplication; | ||||
| @@ -501,15 +501,12 @@ public: | |||||
| } | } | ||||
| void initialise (JNIEnv* env, jobject activity_, | void initialise (JNIEnv* env, jobject activity_, | ||||
| jstring appFile_, jstring appDataDir_, | |||||
| int screenWidth_, int screenHeight_) | |||||
| jstring appFile_, jstring appDataDir_) | |||||
| { | { | ||||
| threadLocalJNIEnvHolder.initialise (env); | threadLocalJNIEnvHolder.initialise (env); | ||||
| activity = GlobalRef (activity_); | activity = GlobalRef (activity_); | ||||
| appFile = juceString (appFile_); | appFile = juceString (appFile_); | ||||
| appDataDir = juceString (appDataDir_); | appDataDir = juceString (appDataDir_); | ||||
| screenWidth = screenWidth_; | |||||
| screenHeight = screenHeight_; | |||||
| #define CREATE_JNI_CLASS(className, path) \ | #define CREATE_JNI_CLASS(className, path) \ | ||||
| className = (jclass) env->NewGlobalRef (env->FindClass (path)); \ | className = (jclass) env->NewGlobalRef (env->FindClass (path)); \ | ||||
| @@ -36,7 +36,9 @@ public: | |||||
| AndroidComponentPeer (Component* const component, const int windowStyleFlags) | AndroidComponentPeer (Component* const component, const int windowStyleFlags) | ||||
| : ComponentPeer (component, windowStyleFlags), | : ComponentPeer (component, windowStyleFlags), | ||||
| view (android.activity.callObjectMethod (android.createNewView, component->isOpaque())), | view (android.activity.callObjectMethod (android.createNewView, component->isOpaque())), | ||||
| usingAndroidGraphics (false), sizeAllocated (0) | |||||
| usingAndroidGraphics (false), | |||||
| fullScreen (false), | |||||
| sizeAllocated (0) | |||||
| { | { | ||||
| if (isFocused()) | if (isFocused()) | ||||
| handleFocusGain(); | handleFocusGain(); | ||||
| @@ -131,6 +133,10 @@ public: | |||||
| { | { | ||||
| if (MessageManager::getInstance()->isThisTheMessageThread()) | if (MessageManager::getInstance()->isThisTheMessageThread()) | ||||
| { | { | ||||
| fullScreen = isNowFullScreen; | |||||
| w = jmax (0, w); | |||||
| h = jmax (0, h); | |||||
| view.callVoidMethod (android.layout, x, y, x + w, y + h); | view.callVoidMethod (android.layout, x, y, x + w, y + h); | ||||
| } | } | ||||
| else | else | ||||
| @@ -184,7 +190,7 @@ public: | |||||
| void setMinimised (bool shouldBeMinimised) | void setMinimised (bool shouldBeMinimised) | ||||
| { | { | ||||
| // TODO | |||||
| // n/a | |||||
| } | } | ||||
| bool isMinimised() const | bool isMinimised() const | ||||
| @@ -194,18 +200,27 @@ public: | |||||
| void setFullScreen (bool shouldBeFullScreen) | void setFullScreen (bool shouldBeFullScreen) | ||||
| { | { | ||||
| // TODO | |||||
| Rectangle<int> r (shouldBeFullScreen ? Desktop::getInstance().getMainMonitorArea() | |||||
| : lastNonFullscreenBounds); | |||||
| if ((! shouldBeFullScreen) && r.isEmpty()) | |||||
| r = getBounds(); | |||||
| // (can't call the component's setBounds method because that'll reset our fullscreen flag) | |||||
| if (! r.isEmpty()) | |||||
| setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen); | |||||
| component->repaint(); | |||||
| } | } | ||||
| bool isFullScreen() const | bool isFullScreen() const | ||||
| { | { | ||||
| // TODO | |||||
| return false; | |||||
| return fullScreen; | |||||
| } | } | ||||
| void setIcon (const Image& newIcon) | void setIcon (const Image& newIcon) | ||||
| { | { | ||||
| // TODO | |||||
| // n/a | |||||
| } | } | ||||
| bool contains (const Point<int>& position, bool trueIfInAChildWindow) const | bool contains (const Point<int>& position, bool trueIfInAChildWindow) const | ||||
| @@ -428,7 +443,7 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| GlobalRef view; | GlobalRef view; | ||||
| GlobalRef buffer; | GlobalRef buffer; | ||||
| bool usingAndroidGraphics; | |||||
| bool usingAndroidGraphics, fullScreen; | |||||
| int sizeAllocated; | int sizeAllocated; | ||||
| class PreallocatedImage : public Image::SharedImage | class PreallocatedImage : public Image::SharedImage | ||||
| @@ -526,7 +541,7 @@ ComponentPeer* Component::createNewPeer (int styleFlags, void*) | |||||
| //============================================================================== | //============================================================================== | ||||
| bool Desktop::canUseSemiTransparentWindows() throw() | bool Desktop::canUseSemiTransparentWindows() throw() | ||||
| { | { | ||||
| return true; // TODO | |||||
| return true; | |||||
| } | } | ||||
| Desktop::DisplayOrientation Desktop::getCurrentOrientation() const | Desktop::DisplayOrientation Desktop::getCurrentOrientation() const | ||||
| @@ -607,6 +622,13 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const | |||||
| monitorCoords.add (Rectangle<int> (0, 0, android.screenWidth, android.screenHeight)); | monitorCoords.add (Rectangle<int> (0, 0, android.screenWidth, android.screenHeight)); | ||||
| } | } | ||||
| JUCE_JNI_CALLBACK (JuceAppActivity, setScreenSize, void, (JNIEnv* env, jobject activity, | |||||
| jint screenWidth, jint screenHeight)) | |||||
| { | |||||
| android.screenWidth = screenWidth; | |||||
| android.screenHeight = screenHeight; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| const Image juce_createIconForFile (const File& file) | const Image juce_createIconForFile (const File& file) | ||||
| { | { | ||||
| @@ -262,6 +262,7 @@ String::String (const PreallocationBytes& preallocationSize) | |||||
| { | { | ||||
| } | } | ||||
| //============================================================================== | |||||
| String::String (const char* const t) | String::String (const char* const t) | ||||
| : text (StringHolder::createFromCharPointer (CharPointer_ASCII (t))) | : text (StringHolder::createFromCharPointer (CharPointer_ASCII (t))) | ||||
| { | { | ||||
| @@ -300,65 +301,20 @@ String::String (const char* const t, const size_t maxChars) | |||||
| jassert (t == 0 || CharPointer_ASCII::isValidString (t, (int) maxChars)); | jassert (t == 0 || CharPointer_ASCII::isValidString (t, (int) maxChars)); | ||||
| } | } | ||||
| String::String (const CharPointer_UTF8& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& start, const CharPointer_UTF8& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF16& start, const CharPointer_UTF16& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF32& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF32& t, const size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (t, maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const wchar_t* const t) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) {} | |||||
| String::String (const CharPointer_UTF8& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF16& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF32& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_ASCII& t) : text (StringHolder::createFromCharPointer (t)) {} | |||||
| String::String (const CharPointer_UTF32& start, const CharPointer_UTF32& end) | |||||
| : text (StringHolder::createFromCharPointer (start, end)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_ASCII& t) | |||||
| : text (StringHolder::createFromCharPointer (t)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const CharPointer_UTF16& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const CharPointer_UTF32& t, const size_t maxChars) : text (StringHolder::createFromCharPointer (t, maxChars)) {} | |||||
| String::String (const wchar_t* const t, size_t maxChars) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t), maxChars)) {} | |||||
| String::String (const wchar_t* const t) | |||||
| : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) | |||||
| { | |||||
| } | |||||
| String::String (const wchar_t* const t, size_t maxChars) | |||||
| : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t), maxChars)) | |||||
| { | |||||
| } | |||||
| String::String (const CharPointer_UTF8& start, const CharPointer_UTF8& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| String::String (const CharPointer_UTF16& start, const CharPointer_UTF16& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| String::String (const CharPointer_UTF32& start, const CharPointer_UTF32& end) : text (StringHolder::createFromCharPointer (start, end)) {} | |||||
| const String String::charToString (const juce_wchar character) | const String String::charToString (const juce_wchar character) | ||||
| { | { | ||||
| @@ -442,11 +398,13 @@ namespace NumberToStringConverters | |||||
| char getDecimalPoint() | char getDecimalPoint() | ||||
| { | { | ||||
| #if JUCE_VC7_OR_EARLIER | |||||
| static char dp = (char) std::_USE (std::locale(), std::numpunct <char>).decimal_point(); | |||||
| #else | |||||
| static char dp = (char) std::use_facet <std::numpunct <char> > (std::locale()).decimal_point(); | |||||
| #endif | |||||
| static char dp = (char) | |||||
| #if JUCE_VC7_OR_EARLIER | |||||
| std::_USE (std::locale(), std::numpunct <char>).decimal_point(); | |||||
| #else | |||||
| std::use_facet <std::numpunct <char> > (std::locale()).decimal_point(); | |||||
| #endif | |||||
| return dp; | return dp; | ||||
| } | } | ||||
| @@ -503,45 +461,15 @@ namespace NumberToStringConverters | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| String::String (const int number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const unsigned int number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const short number) | |||||
| : text (NumberToStringConverters::createFromInteger ((int) number)) | |||||
| { | |||||
| } | |||||
| String::String (const int number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const unsigned int number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const short number) : text (NumberToStringConverters::createFromInteger ((int) number)) {} | |||||
| String::String (const unsigned short number) : text (NumberToStringConverters::createFromInteger ((unsigned int) number)) {} | |||||
| String::String (const int64 number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const uint64 number) : text (NumberToStringConverters::createFromInteger (number)) {} | |||||
| String::String (const unsigned short number) | |||||
| : text (NumberToStringConverters::createFromInteger ((unsigned int) number)) | |||||
| { | |||||
| } | |||||
| String::String (const int64 number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const uint64 number) | |||||
| : text (NumberToStringConverters::createFromInteger (number)) | |||||
| { | |||||
| } | |||||
| String::String (const float number, const int numberOfDecimalPlaces) | |||||
| : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) | |||||
| { | |||||
| } | |||||
| String::String (const double number, const int numberOfDecimalPlaces) | |||||
| : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) | |||||
| { | |||||
| } | |||||
| String::String (const float number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) {} | |||||
| String::String (const double number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) {} | |||||
| //============================================================================== | //============================================================================== | ||||
| int String::length() const throw() | int String::length() const throw() | ||||
| @@ -588,12 +516,12 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& str | |||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) == 0; | return string1.compare (string2) == 0; | ||||
| } | } | ||||
| @@ -618,12 +546,12 @@ JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& str | |||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) throw() | |||||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* const string2) throw() | |||||
| { | { | ||||
| return string1.compare (string2) != 0; | return string1.compare (string2) != 0; | ||||
| } | } | ||||
| @@ -860,12 +788,18 @@ JUCE_API String& JUCE_CALLTYPE operator<< (String& s1, const double number) | |||||
| JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text) | JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& text) | ||||
| { | { | ||||
| const int numBytes = text.getNumBytesAsUTF8(); | |||||
| #if (JUCE_STRING_UTF_TYPE == 8) | |||||
| stream.write (text.getCharPointer().getAddress(), numBytes); | |||||
| #else | |||||
| // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind | // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind | ||||
| // if lots of large, persistent strings were to be written to streams). | // if lots of large, persistent strings were to be written to streams). | ||||
| const int numBytes = text.getNumBytesAsUTF8(); | |||||
| HeapBlock<char> temp (numBytes + 1); | HeapBlock<char> temp (numBytes + 1); | ||||
| text.copyToUTF8 (temp, numBytes + 1); | |||||
| CharPointer_UTF8 (temp).writeAll (text.getCharPointer()); | |||||
| stream.write (temp, numBytes); | stream.write (temp, numBytes); | ||||
| #endif | |||||
| return stream; | return stream; | ||||
| } | } | ||||
| @@ -1499,7 +1433,7 @@ const String String::toUpperCase() const | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| juce_wchar c = builder.source.toUpperCase(); | |||||
| const juce_wchar c = builder.source.toUpperCase(); | |||||
| ++(builder.source); | ++(builder.source); | ||||
| builder.write (c); | builder.write (c); | ||||
| @@ -1516,7 +1450,7 @@ const String String::toLowerCase() const | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| juce_wchar c = builder.source.toLowerCase(); | |||||
| const juce_wchar c = builder.source.toLowerCase(); | |||||
| ++(builder.source); | ++(builder.source); | ||||
| builder.write (c); | builder.write (c); | ||||
| @@ -1939,7 +1873,7 @@ int String::getTrailingIntValue() const throw() | |||||
| int mult = 1; | int mult = 1; | ||||
| CharPointerType t (text.findTerminatingNull()); | CharPointerType t (text.findTerminatingNull()); | ||||
| while ((--t).getAddress() >= text) | |||||
| while (--t >= text) | |||||
| { | { | ||||
| if (! t.isDigit()) | if (! t.isDigit()) | ||||
| { | { | ||||
| @@ -2053,12 +1987,12 @@ const String String::toHexString (const unsigned char* data, const int size, con | |||||
| int String::getHexValue32() const throw() | int String::getHexValue32() const throw() | ||||
| { | { | ||||
| return HexConverter <int>::stringToHex (text); | |||||
| return HexConverter<int>::stringToHex (text); | |||||
| } | } | ||||
| int64 String::getHexValue64() const throw() | int64 String::getHexValue64() const throw() | ||||
| { | { | ||||
| return HexConverter <int64>::stringToHex (text); | |||||
| return HexConverter<int64>::stringToHex (text); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -2300,8 +2234,7 @@ public: | |||||
| static const String createRandomWideCharString() | static const String createRandomWideCharString() | ||||
| { | { | ||||
| juce_wchar buffer [50]; | |||||
| zerostruct (buffer); | |||||
| juce_wchar buffer[50] = { 0 }; | |||||
| for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (buffer) - 1; ++i) | ||||
| { | { | ||||