| @@ -52658,14 +52658,15 @@ public: | |||
| g.fillRect (startX, y, endX - startX, nextY - y); | |||
| } | |||
| void drawUnderline (Graphics& g, const Range<int>& underline) const | |||
| void drawUnderline (Graphics& g, const Range<int>& underline, const Colour& colour) const | |||
| { | |||
| const float startX = indexToX (underline.getStart()); | |||
| const float endX = indexToX (underline.getEnd()); | |||
| const float baselineY = lineY + currentSection->font.getAscent(); | |||
| const float dashes[] = { 4.0f, 4.0f }; | |||
| const int startX = roundToInt (indexToX (underline.getStart())); | |||
| const int endX = roundToInt (indexToX (underline.getEnd())); | |||
| const int baselineY = roundToInt (lineY + currentSection->font.getAscent() + 0.5f); | |||
| g.drawDashedLine (Line<float> (startX, baselineY, endX, baselineY), dashes, 2, 1.0f, 0); | |||
| Graphics::ScopedSaveState state (g); | |||
| g.reduceClipRegion (Rectangle<int> (startX, baselineY, endX - startX, 1)); | |||
| g.fillCheckerBoard (Rectangle<int> (0, 0, endX, baselineY + 1), 3, 1, colour, Colours::transparentBlack); | |||
| } | |||
| void drawSelectedText (Graphics& g, | |||
| @@ -53045,6 +53046,13 @@ TextEditor::TextEditor (const String& name, | |||
| TextEditor::~TextEditor() | |||
| { | |||
| if (wasFocused) | |||
| { | |||
| ComponentPeer* const peer = getPeer(); | |||
| if (peer != 0) | |||
| peer->dismissPendingTextInput(); | |||
| } | |||
| textValue.referTo (Value()); | |||
| clearInternal (0); | |||
| viewport = 0; | |||
| @@ -53687,8 +53695,7 @@ void TextEditor::drawContent (Graphics& g) | |||
| if (! selection.isEmpty()) | |||
| { | |||
| g.setColour (findColour (highlightColourId) | |||
| .withMultipliedAlpha (hasKeyboardFocus (true) ? 1.0f : 0.5f)); | |||
| g.setColour (findColour (highlightColourId).withMultipliedAlpha (hasKeyboardFocus (true) ? 1.0f : 0.5f)); | |||
| selectedTextColour = findColour (highlightedTextColourId); | |||
| @@ -53726,8 +53733,6 @@ void TextEditor::drawContent (Graphics& g) | |||
| { | |||
| const Range<int>& underlinedSection = underlinedSections.getReference (i); | |||
| g.setColour (findColour (highlightColourId)); | |||
| Iterator i2 (sections, wordWrapWidth, passwordCharacter); | |||
| while (i2.next() && i2.lineY < clip.getBottom()) | |||
| @@ -53735,7 +53740,7 @@ void TextEditor::drawContent (Graphics& g) | |||
| if (i2.lineY + i2.lineHeight >= clip.getY() | |||
| && underlinedSection.intersects (Range<int> (i2.indexInText, i2.indexInText + i2.atom->numChars))) | |||
| { | |||
| i2.drawUnderline (g, underlinedSection); | |||
| i2.drawUnderline (g, underlinedSection, findColour (textColourId)); | |||
| } | |||
| } | |||
| } | |||
| @@ -54170,7 +54175,7 @@ void TextEditor::focusLost (FocusChangeType) | |||
| ComponentPeer* const peer = getPeer(); | |||
| if (peer != 0) | |||
| peer->cancelPendingTextInput(); | |||
| peer->dismissPendingTextInput(); | |||
| updateCaretPosition(); | |||
| @@ -77480,7 +77485,7 @@ TextInputTarget* ComponentPeer::findCurrentTextInputTarget() | |||
| return 0; | |||
| } | |||
| void ComponentPeer::cancelPendingTextInput() | |||
| void ComponentPeer::dismissPendingTextInput() | |||
| { | |||
| } | |||
| @@ -246630,7 +246635,7 @@ public: | |||
| SetCaretPos (0, 0); | |||
| } | |||
| void cancelPendingTextInput() | |||
| void dismissPendingTextInput() | |||
| { | |||
| imeHandler.handleSetContext (hwnd, false); | |||
| } | |||
| @@ -247513,6 +247518,13 @@ private: | |||
| return handleKeyPress (key, textChar); | |||
| } | |||
| void forwardMessageToParent (UINT message, WPARAM wParam, LPARAM lParam) const | |||
| { | |||
| HWND parentH = GetParent (hwnd); | |||
| if (parentH != 0) | |||
| PostMessage (parentH, message, wParam, lParam); | |||
| } | |||
| bool doAppCommand (const LPARAM lParam) | |||
| { | |||
| int key = 0; | |||
| @@ -247623,6 +247635,34 @@ private: | |||
| } | |||
| } | |||
| void handleLeftClickInNCArea (WPARAM wParam) | |||
| { | |||
| if (! sendInputAttemptWhenModalMessage()) | |||
| { | |||
| switch (wParam) | |||
| { | |||
| case HTBOTTOM: | |||
| case HTBOTTOMLEFT: | |||
| case HTBOTTOMRIGHT: | |||
| case HTGROWBOX: | |||
| case HTLEFT: | |||
| case HTRIGHT: | |||
| case HTTOP: | |||
| case HTTOPLEFT: | |||
| case HTTOPRIGHT: | |||
| if (isConstrainedNativeWindow()) | |||
| { | |||
| constrainerIsResizing = true; | |||
| constrainer->resizeStart(); | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| class JuceDropTarget : public ComBaseClassHelper <IDropTarget> | |||
| { | |||
| public: | |||
| @@ -247862,6 +247902,8 @@ private: | |||
| case WM_SYSKEYDOWN: | |||
| if (doKeyDown (wParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| @@ -247869,12 +247911,16 @@ private: | |||
| case WM_SYSKEYUP: | |||
| if (doKeyUp (wParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| case WM_CHAR: | |||
| if (doKeyChar ((int) wParam, lParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| @@ -248049,30 +248095,7 @@ private: | |||
| break; | |||
| case WM_NCLBUTTONDOWN: | |||
| if (! sendInputAttemptWhenModalMessage()) | |||
| { | |||
| switch (wParam) | |||
| { | |||
| case HTBOTTOM: | |||
| case HTBOTTOMLEFT: | |||
| case HTBOTTOMRIGHT: | |||
| case HTGROWBOX: | |||
| case HTLEFT: | |||
| case HTRIGHT: | |||
| case HTTOP: | |||
| case HTTOPLEFT: | |||
| case HTTOPRIGHT: | |||
| if (isConstrainedNativeWindow()) | |||
| { | |||
| constrainerIsResizing = true; | |||
| constrainer->resizeStart(); | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| }; | |||
| } | |||
| handleLeftClickInNCArea (wParam); | |||
| break; | |||
| case WM_NCRBUTTONDOWN: | |||
| @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 53 | |||
| #define JUCE_BUILDNUMBER 58 | |||
| #define JUCE_BUILDNUMBER 59 | |||
| /** Current Juce version number. | |||
| @@ -64328,8 +64328,8 @@ public: | |||
| */ | |||
| virtual void textInputRequired (const Point<int>& position) = 0; | |||
| /** If there's some kind of OS input-method in progress, this should cancel it. */ | |||
| virtual void cancelPendingTextInput(); | |||
| /** If there's some kind of OS input-method in progress, this should dismiss it. */ | |||
| virtual void dismissPendingTextInput(); | |||
| /** Returns the currently focused TextInputTarget, or null if none is found. */ | |||
| TextInputTarget* findCurrentTextInputTarget(); | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 53 | |||
| #define JUCE_BUILDNUMBER 58 | |||
| #define JUCE_BUILDNUMBER 59 | |||
| /** Current Juce version number. | |||
| @@ -614,14 +614,15 @@ public: | |||
| g.fillRect (startX, y, endX - startX, nextY - y); | |||
| } | |||
| void drawUnderline (Graphics& g, const Range<int>& underline) const | |||
| void drawUnderline (Graphics& g, const Range<int>& underline, const Colour& colour) const | |||
| { | |||
| const float startX = indexToX (underline.getStart()); | |||
| const float endX = indexToX (underline.getEnd()); | |||
| const float baselineY = lineY + currentSection->font.getAscent(); | |||
| const float dashes[] = { 4.0f, 4.0f }; | |||
| const int startX = roundToInt (indexToX (underline.getStart())); | |||
| const int endX = roundToInt (indexToX (underline.getEnd())); | |||
| const int baselineY = roundToInt (lineY + currentSection->font.getAscent() + 0.5f); | |||
| g.drawDashedLine (Line<float> (startX, baselineY, endX, baselineY), dashes, 2, 1.0f, 0); | |||
| Graphics::ScopedSaveState state (g); | |||
| g.reduceClipRegion (Rectangle<int> (startX, baselineY, endX - startX, 1)); | |||
| g.fillCheckerBoard (Rectangle<int> (0, 0, endX, baselineY + 1), 3, 1, colour, Colours::transparentBlack); | |||
| } | |||
| void drawSelectedText (Graphics& g, | |||
| @@ -1011,6 +1012,13 @@ TextEditor::TextEditor (const String& name, | |||
| TextEditor::~TextEditor() | |||
| { | |||
| if (wasFocused) | |||
| { | |||
| ComponentPeer* const peer = getPeer(); | |||
| if (peer != 0) | |||
| peer->dismissPendingTextInput(); | |||
| } | |||
| textValue.referTo (Value()); | |||
| clearInternal (0); | |||
| viewport = 0; | |||
| @@ -1664,8 +1672,7 @@ void TextEditor::drawContent (Graphics& g) | |||
| if (! selection.isEmpty()) | |||
| { | |||
| g.setColour (findColour (highlightColourId) | |||
| .withMultipliedAlpha (hasKeyboardFocus (true) ? 1.0f : 0.5f)); | |||
| g.setColour (findColour (highlightColourId).withMultipliedAlpha (hasKeyboardFocus (true) ? 1.0f : 0.5f)); | |||
| selectedTextColour = findColour (highlightedTextColourId); | |||
| @@ -1703,8 +1710,6 @@ void TextEditor::drawContent (Graphics& g) | |||
| { | |||
| const Range<int>& underlinedSection = underlinedSections.getReference (i); | |||
| g.setColour (findColour (highlightColourId)); | |||
| Iterator i2 (sections, wordWrapWidth, passwordCharacter); | |||
| while (i2.next() && i2.lineY < clip.getBottom()) | |||
| @@ -1712,7 +1717,7 @@ void TextEditor::drawContent (Graphics& g) | |||
| if (i2.lineY + i2.lineHeight >= clip.getY() | |||
| && underlinedSection.intersects (Range<int> (i2.indexInText, i2.indexInText + i2.atom->numChars))) | |||
| { | |||
| i2.drawUnderline (g, underlinedSection); | |||
| i2.drawUnderline (g, underlinedSection, findColour (textColourId)); | |||
| } | |||
| } | |||
| } | |||
| @@ -2151,7 +2156,7 @@ void TextEditor::focusLost (FocusChangeType) | |||
| ComponentPeer* const peer = getPeer(); | |||
| if (peer != 0) | |||
| peer->cancelPendingTextInput(); | |||
| peer->dismissPendingTextInput(); | |||
| updateCaretPosition(); | |||
| @@ -286,7 +286,7 @@ TextInputTarget* ComponentPeer::findCurrentTextInputTarget() | |||
| return 0; | |||
| } | |||
| void ComponentPeer::cancelPendingTextInput() | |||
| void ComponentPeer::dismissPendingTextInput() | |||
| { | |||
| } | |||
| @@ -282,8 +282,8 @@ public: | |||
| */ | |||
| virtual void textInputRequired (const Point<int>& position) = 0; | |||
| /** If there's some kind of OS input-method in progress, this should cancel it. */ | |||
| virtual void cancelPendingTextInput(); | |||
| /** If there's some kind of OS input-method in progress, this should dismiss it. */ | |||
| virtual void dismissPendingTextInput(); | |||
| /** Returns the currently focused TextInputTarget, or null if none is found. */ | |||
| TextInputTarget* findCurrentTextInputTarget(); | |||
| @@ -805,7 +805,7 @@ public: | |||
| SetCaretPos (0, 0); | |||
| } | |||
| void cancelPendingTextInput() | |||
| void dismissPendingTextInput() | |||
| { | |||
| imeHandler.handleSetContext (hwnd, false); | |||
| } | |||
| @@ -1700,6 +1700,13 @@ private: | |||
| return handleKeyPress (key, textChar); | |||
| } | |||
| void forwardMessageToParent (UINT message, WPARAM wParam, LPARAM lParam) const | |||
| { | |||
| HWND parentH = GetParent (hwnd); | |||
| if (parentH != 0) | |||
| PostMessage (parentH, message, wParam, lParam); | |||
| } | |||
| bool doAppCommand (const LPARAM lParam) | |||
| { | |||
| int key = 0; | |||
| @@ -1810,6 +1817,34 @@ private: | |||
| } | |||
| } | |||
| void handleLeftClickInNCArea (WPARAM wParam) | |||
| { | |||
| if (! sendInputAttemptWhenModalMessage()) | |||
| { | |||
| switch (wParam) | |||
| { | |||
| case HTBOTTOM: | |||
| case HTBOTTOMLEFT: | |||
| case HTBOTTOMRIGHT: | |||
| case HTGROWBOX: | |||
| case HTLEFT: | |||
| case HTRIGHT: | |||
| case HTTOP: | |||
| case HTTOPLEFT: | |||
| case HTTOPRIGHT: | |||
| if (isConstrainedNativeWindow()) | |||
| { | |||
| constrainerIsResizing = true; | |||
| constrainer->resizeStart(); | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| class JuceDropTarget : public ComBaseClassHelper <IDropTarget> | |||
| { | |||
| @@ -2055,6 +2090,8 @@ private: | |||
| case WM_SYSKEYDOWN: | |||
| if (doKeyDown (wParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| @@ -2062,12 +2099,16 @@ private: | |||
| case WM_SYSKEYUP: | |||
| if (doKeyUp (wParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| case WM_CHAR: | |||
| if (doKeyChar ((int) wParam, lParam)) | |||
| return 0; | |||
| else | |||
| forwardMessageToParent (message, wParam, lParam); | |||
| break; | |||
| @@ -2243,30 +2284,7 @@ private: | |||
| break; | |||
| case WM_NCLBUTTONDOWN: | |||
| if (! sendInputAttemptWhenModalMessage()) | |||
| { | |||
| switch (wParam) | |||
| { | |||
| case HTBOTTOM: | |||
| case HTBOTTOMLEFT: | |||
| case HTBOTTOMRIGHT: | |||
| case HTGROWBOX: | |||
| case HTLEFT: | |||
| case HTRIGHT: | |||
| case HTTOP: | |||
| case HTTOPLEFT: | |||
| case HTTOPRIGHT: | |||
| if (isConstrainedNativeWindow()) | |||
| { | |||
| constrainerIsResizing = true; | |||
| constrainer->resizeStart(); | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| }; | |||
| } | |||
| handleLeftClickInNCArea (wParam); | |||
| break; | |||
| case WM_NCRBUTTONDOWN: | |||