| @@ -299,7 +299,7 @@ | |||||
| reduce code size. | reduce code size. | ||||
| */ | */ | ||||
| #ifndef JUCE_USE_CDREADER | #ifndef JUCE_USE_CDREADER | ||||
| #define JUCE_USE_CDREADER 1 | |||||
| #define JUCE_USE_CDREADER 0 | |||||
| #endif | #endif | ||||
| /** JUCE_USE_CAMERA: Enables web-cam support using the CameraDevice class (Mac and Windows). | /** JUCE_USE_CAMERA: Enables web-cam support using the CameraDevice class (Mac and Windows). | ||||
| @@ -265390,11 +265390,11 @@ END_JUCE_NAMESPACE | |||||
| #define JuceUIView MakeObjCClassName(JuceUIView) | #define JuceUIView MakeObjCClassName(JuceUIView) | ||||
| @interface JuceUIView : UIView <UITextFieldDelegate> | |||||
| @interface JuceUIView : UIView <UITextViewDelegate> | |||||
| { | { | ||||
| @public | @public | ||||
| UIViewComponentPeer* owner; | UIViewComponentPeer* owner; | ||||
| UITextField *hiddenTextField; | |||||
| UITextView* hiddenTextView; | |||||
| } | } | ||||
| - (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | - (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | ||||
| @@ -265413,9 +265413,7 @@ END_JUCE_NAMESPACE | |||||
| - (void) asyncRepaint: (id) rect; | - (void) asyncRepaint: (id) rect; | ||||
| - (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string; | |||||
| - (BOOL) textFieldShouldClear: (UITextField*) textField; | |||||
| - (BOOL) textFieldShouldReturn: (UITextField*) textField; | |||||
| - (BOOL) textView: (UITextView*) textView shouldChangeTextInRange: (NSRange) range replacementText: (NSString*) text; | |||||
| @end | @end | ||||
| #define JuceUIWindow MakeObjCClassName(JuceUIWindow) | #define JuceUIWindow MakeObjCClassName(JuceUIWindow) | ||||
| @@ -265480,9 +265478,7 @@ public: | |||||
| void grabFocus(); | void grabFocus(); | ||||
| void textInputRequired (const Point<int>& position); | void textInputRequired (const Point<int>& position); | ||||
| virtual BOOL textFieldReplaceCharacters (const Range<int>& range, const String& text); | |||||
| virtual BOOL textFieldShouldClear(); | |||||
| virtual BOOL textFieldShouldReturn(); | |||||
| virtual BOOL textViewReplaceCharacters (const Range<int>& range, const String& text); | |||||
| void updateHiddenTextContent (TextInputTarget* target); | void updateHiddenTextContent (TextInputTarget* target); | ||||
| void globalFocusChanged (Component*); | void globalFocusChanged (Component*); | ||||
| @@ -265517,20 +265513,20 @@ END_JUCE_NAMESPACE | |||||
| [super initWithFrame: frame]; | [super initWithFrame: frame]; | ||||
| owner = owner_; | owner = owner_; | ||||
| hiddenTextField = [[UITextField alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||||
| [self addSubview: hiddenTextField]; | |||||
| hiddenTextField.delegate = self; | |||||
| hiddenTextView = [[UITextView alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||||
| [self addSubview: hiddenTextView]; | |||||
| hiddenTextView.delegate = self; | |||||
| hiddenTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; | |||||
| hiddenTextField.autocorrectionType = UITextAutocorrectionTypeNo; | |||||
| hiddenTextView.autocapitalizationType = UITextAutocapitalizationTypeNone; | |||||
| hiddenTextView.autocorrectionType = UITextAutocorrectionTypeNo; | |||||
| return self; | return self; | ||||
| } | } | ||||
| - (void) dealloc | - (void) dealloc | ||||
| { | { | ||||
| [hiddenTextField removeFromSuperview]; | |||||
| [hiddenTextField release]; | |||||
| [hiddenTextView removeFromSuperview]; | |||||
| [hiddenTextView release]; | |||||
| [super dealloc]; | [super dealloc]; | ||||
| } | } | ||||
| @@ -265613,20 +265609,10 @@ JUCE_NAMESPACE::Point<int> juce_lastMousePos; | |||||
| [self setNeedsDisplayInRect: *r]; | [self setNeedsDisplayInRect: *r]; | ||||
| } | } | ||||
| - (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) text | |||||
| { | |||||
| return owner->textFieldReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||||
| nsStringToJuce (text)); | |||||
| } | |||||
| - (BOOL) textFieldShouldClear: (UITextField*) textField | |||||
| - (BOOL) textView: (UITextView*) textView shouldChangeTextInRange: (NSRange) range replacementText: (NSString*) text | |||||
| { | { | ||||
| return owner->textFieldShouldClear(); | |||||
| } | |||||
| - (BOOL) textFieldShouldReturn: (UITextField*) textField | |||||
| { | |||||
| return owner->textFieldShouldReturn(); | |||||
| return owner->textViewReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||||
| nsStringToJuce (text)); | |||||
| } | } | ||||
| @end | @end | ||||
| @@ -266061,10 +266047,11 @@ void UIViewComponentPeer::textInputRequired (const Point<int>&) | |||||
| void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | ||||
| { | { | ||||
| view->hiddenTextField.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||||
| view->hiddenTextView.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||||
| view->hiddenTextView.selectedRange = NSMakeRange (target->getHighlightedRegion().getStart(), 0); | |||||
| } | } | ||||
| BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, const String& text) | |||||
| BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, const String& text) | |||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | TextInputTarget* const target = findCurrentTextInputTarget(); | ||||
| @@ -266083,33 +266070,6 @@ BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, c | |||||
| return NO; | return NO; | ||||
| } | } | ||||
| BOOL UIViewComponentPeer::textFieldShouldClear() | |||||
| { | |||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != 0) | |||||
| { | |||||
| target->setHighlightedRegion (Range<int> (0, std::numeric_limits<int>::max())); | |||||
| target->insertTextAtCaret (String::empty); | |||||
| updateHiddenTextContent (target); | |||||
| } | |||||
| return YES; | |||||
| } | |||||
| BOOL UIViewComponentPeer::textFieldShouldReturn() | |||||
| { | |||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != 0) | |||||
| { | |||||
| target->insertTextAtCaret ("\n"); | |||||
| updateHiddenTextContent (target); | |||||
| } | |||||
| return YES; | |||||
| } | |||||
| void UIViewComponentPeer::globalFocusChanged (Component*) | void UIViewComponentPeer::globalFocusChanged (Component*) | ||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | TextInputTarget* const target = findCurrentTextInputTarget(); | ||||
| @@ -266119,14 +266079,14 @@ void UIViewComponentPeer::globalFocusChanged (Component*) | |||||
| Component* comp = dynamic_cast<Component*> (target); | Component* comp = dynamic_cast<Component*> (target); | ||||
| Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | ||||
| view->hiddenTextField.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||||
| view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||||
| updateHiddenTextContent (target); | updateHiddenTextContent (target); | ||||
| [view->hiddenTextField becomeFirstResponder]; | |||||
| [view->hiddenTextView becomeFirstResponder]; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| [view->hiddenTextField resignFirstResponder]; | |||||
| [view->hiddenTextView resignFirstResponder]; | |||||
| } | } | ||||
| } | } | ||||
| @@ -64,7 +64,7 @@ | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 52 | #define JUCE_MINOR_VERSION 52 | ||||
| #define JUCE_BUILDNUMBER 45 | |||||
| #define JUCE_BUILDNUMBER 46 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -338,7 +338,7 @@ | |||||
| reduce code size. | reduce code size. | ||||
| */ | */ | ||||
| #ifndef JUCE_USE_CDREADER | #ifndef JUCE_USE_CDREADER | ||||
| #define JUCE_USE_CDREADER 1 | |||||
| #define JUCE_USE_CDREADER 0 | |||||
| #endif | #endif | ||||
| /** JUCE_USE_CAMERA: Enables web-cam support using the CameraDevice class (Mac and Windows). | /** JUCE_USE_CAMERA: Enables web-cam support using the CameraDevice class (Mac and Windows). | ||||
| @@ -33,7 +33,7 @@ | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 52 | #define JUCE_MINOR_VERSION 52 | ||||
| #define JUCE_BUILDNUMBER 45 | |||||
| #define JUCE_BUILDNUMBER 46 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -34,11 +34,11 @@ END_JUCE_NAMESPACE | |||||
| #define JuceUIView MakeObjCClassName(JuceUIView) | #define JuceUIView MakeObjCClassName(JuceUIView) | ||||
| @interface JuceUIView : UIView <UITextFieldDelegate> | |||||
| @interface JuceUIView : UIView <UITextViewDelegate> | |||||
| { | { | ||||
| @public | @public | ||||
| UIViewComponentPeer* owner; | UIViewComponentPeer* owner; | ||||
| UITextField *hiddenTextField; | |||||
| UITextView* hiddenTextView; | |||||
| } | } | ||||
| - (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | - (JuceUIView*) initWithOwner: (UIViewComponentPeer*) owner withFrame: (CGRect) frame; | ||||
| @@ -57,9 +57,7 @@ END_JUCE_NAMESPACE | |||||
| - (void) asyncRepaint: (id) rect; | - (void) asyncRepaint: (id) rect; | ||||
| - (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string; | |||||
| - (BOOL) textFieldShouldClear: (UITextField*) textField; | |||||
| - (BOOL) textFieldShouldReturn: (UITextField*) textField; | |||||
| - (BOOL) textView: (UITextView*) textView shouldChangeTextInRange: (NSRange) range replacementText: (NSString*) text; | |||||
| @end | @end | ||||
| @@ -129,9 +127,7 @@ public: | |||||
| void grabFocus(); | void grabFocus(); | ||||
| void textInputRequired (const Point<int>& position); | void textInputRequired (const Point<int>& position); | ||||
| virtual BOOL textFieldReplaceCharacters (const Range<int>& range, const String& text); | |||||
| virtual BOOL textFieldShouldClear(); | |||||
| virtual BOOL textFieldShouldReturn(); | |||||
| virtual BOOL textViewReplaceCharacters (const Range<int>& range, const String& text); | |||||
| void updateHiddenTextContent (TextInputTarget* target); | void updateHiddenTextContent (TextInputTarget* target); | ||||
| void globalFocusChanged (Component*); | void globalFocusChanged (Component*); | ||||
| @@ -169,20 +165,20 @@ END_JUCE_NAMESPACE | |||||
| [super initWithFrame: frame]; | [super initWithFrame: frame]; | ||||
| owner = owner_; | owner = owner_; | ||||
| hiddenTextField = [[UITextField alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||||
| [self addSubview: hiddenTextField]; | |||||
| hiddenTextField.delegate = self; | |||||
| hiddenTextView = [[UITextView alloc] initWithFrame: CGRectMake (0, 0, 0, 0)]; | |||||
| [self addSubview: hiddenTextView]; | |||||
| hiddenTextView.delegate = self; | |||||
| hiddenTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; | |||||
| hiddenTextField.autocorrectionType = UITextAutocorrectionTypeNo; | |||||
| hiddenTextView.autocapitalizationType = UITextAutocapitalizationTypeNone; | |||||
| hiddenTextView.autocorrectionType = UITextAutocorrectionTypeNo; | |||||
| return self; | return self; | ||||
| } | } | ||||
| - (void) dealloc | - (void) dealloc | ||||
| { | { | ||||
| [hiddenTextField removeFromSuperview]; | |||||
| [hiddenTextField release]; | |||||
| [hiddenTextView removeFromSuperview]; | |||||
| [hiddenTextView release]; | |||||
| [super dealloc]; | [super dealloc]; | ||||
| } | } | ||||
| @@ -269,20 +265,10 @@ JUCE_NAMESPACE::Point<int> juce_lastMousePos; | |||||
| [self setNeedsDisplayInRect: *r]; | [self setNeedsDisplayInRect: *r]; | ||||
| } | } | ||||
| - (BOOL) textField: (UITextField*) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) text | |||||
| - (BOOL) textView: (UITextView*) textView shouldChangeTextInRange: (NSRange) range replacementText: (NSString*) text | |||||
| { | { | ||||
| return owner->textFieldReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||||
| nsStringToJuce (text)); | |||||
| } | |||||
| - (BOOL) textFieldShouldClear: (UITextField*) textField | |||||
| { | |||||
| return owner->textFieldShouldClear(); | |||||
| } | |||||
| - (BOOL) textFieldShouldReturn: (UITextField*) textField | |||||
| { | |||||
| return owner->textFieldShouldReturn(); | |||||
| return owner->textViewReplaceCharacters (Range<int> (range.location, range.location + range.length), | |||||
| nsStringToJuce (text)); | |||||
| } | } | ||||
| @end | @end | ||||
| @@ -724,10 +710,11 @@ void UIViewComponentPeer::textInputRequired (const Point<int>&) | |||||
| void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | ||||
| { | { | ||||
| view->hiddenTextField.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||||
| view->hiddenTextView.text = juceStringToNS (target->getTextInRange (Range<int> (0, target->getHighlightedRegion().getStart()))); | |||||
| view->hiddenTextView.selectedRange = NSMakeRange (target->getHighlightedRegion().getStart(), 0); | |||||
| } | } | ||||
| BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, const String& text) | |||||
| BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, const String& text) | |||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | TextInputTarget* const target = findCurrentTextInputTarget(); | ||||
| @@ -746,33 +733,6 @@ BOOL UIViewComponentPeer::textFieldReplaceCharacters (const Range<int>& range, c | |||||
| return NO; | return NO; | ||||
| } | } | ||||
| BOOL UIViewComponentPeer::textFieldShouldClear() | |||||
| { | |||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != 0) | |||||
| { | |||||
| target->setHighlightedRegion (Range<int> (0, std::numeric_limits<int>::max())); | |||||
| target->insertTextAtCaret (String::empty); | |||||
| updateHiddenTextContent (target); | |||||
| } | |||||
| return YES; | |||||
| } | |||||
| BOOL UIViewComponentPeer::textFieldShouldReturn() | |||||
| { | |||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != 0) | |||||
| { | |||||
| target->insertTextAtCaret ("\n"); | |||||
| updateHiddenTextContent (target); | |||||
| } | |||||
| return YES; | |||||
| } | |||||
| void UIViewComponentPeer::globalFocusChanged (Component*) | void UIViewComponentPeer::globalFocusChanged (Component*) | ||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | TextInputTarget* const target = findCurrentTextInputTarget(); | ||||
| @@ -782,14 +742,14 @@ void UIViewComponentPeer::globalFocusChanged (Component*) | |||||
| Component* comp = dynamic_cast<Component*> (target); | Component* comp = dynamic_cast<Component*> (target); | ||||
| Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>())); | ||||
| view->hiddenTextField.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||||
| view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); | |||||
| updateHiddenTextContent (target); | updateHiddenTextContent (target); | ||||
| [view->hiddenTextField becomeFirstResponder]; | |||||
| [view->hiddenTextView becomeFirstResponder]; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| [view->hiddenTextField resignFirstResponder]; | |||||
| [view->hiddenTextView resignFirstResponder]; | |||||
| } | } | ||||
| } | } | ||||