mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-05 10:23:39 +00:00
fixed: reverse setting did not work
This commit is contained in:
@@ -471,6 +471,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
[self _reverseSetBinding];
|
||||
[_caret stopBlinking];
|
||||
[self setNeedsDisplay:YES];
|
||||
[_CPNativeInputManager cancelCurrentInputSessionIfNeeded];
|
||||
@@ -579,6 +580,12 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
}
|
||||
- (CPString)setObjectValue:(id)aValue
|
||||
{
|
||||
if (!aValue)
|
||||
aValue = @"";
|
||||
|
||||
if (![aValue isKindOfClass:[CPAttributedString class]] && ![aValue isKindOfClass:[CPString class]] && [aValue respondsToSelector:@selector(description)])
|
||||
aValue = [aValue description];
|
||||
|
||||
[self setString:aValue];
|
||||
}
|
||||
|
||||
@@ -607,17 +614,6 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
return [_textStorage string];
|
||||
}
|
||||
|
||||
// KVO support
|
||||
- (void)setValue:(CPString)aValue
|
||||
{
|
||||
[self setString:[aValue description]];
|
||||
}
|
||||
|
||||
- (id)value
|
||||
{
|
||||
[self string];
|
||||
}
|
||||
|
||||
- (void)setTextContainer:(CPTextContainer)aContainer
|
||||
{
|
||||
_textContainer = aContainer;
|
||||
@@ -711,7 +707,10 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
withAttributedString:[_textStorage attributedSubstringFromRange:CPMakeRangeCopy(_selectionRange)]
|
||||
selectionRange:CPMakeRangeCopy(_selectionRange)];
|
||||
|
||||
[self willChangeValueForKey:@"objectValue"];
|
||||
[_textStorage replaceCharactersInRange:CPMakeRangeCopy(_selectionRange) withAttributedString:aString];
|
||||
[self didChangeValueForKey:@"objectValue"];
|
||||
[self _continuouslyReverseSetBinding];
|
||||
|
||||
[self _setSelectedRange:CPMakeRange(_selectionRange.location + [string length], 0) affinity:0 stillSelecting:NO overwriteTypingAttributes:NO];
|
||||
_startTrackingLocation = _selectionRange.location;
|
||||
@@ -1476,7 +1475,10 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
[[[_window undoManager] prepareWithInvocationTarget:self] _replaceCharactersInRange:CPMakeRange(changedRange.location, 0)
|
||||
withAttributedString:[_textStorage attributedSubstringFromRange:CPMakeRangeCopy(changedRange)]
|
||||
selectionRange:CPMakeRangeCopy(_selectionRange)];
|
||||
[self willChangeValueForKey:@"objectValue"];
|
||||
[_textStorage deleteCharactersInRange:CPMakeRangeCopy(changedRange)];
|
||||
[self didChangeValueForKey:@"objectValue"];
|
||||
[self _continuouslyReverseSetBinding];
|
||||
|
||||
[self setSelectedRange:CPMakeRange(changedRange.location, 0)];
|
||||
[self didChangeText];
|
||||
@@ -2080,6 +2082,30 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
[self setTextColor:[CPKeyedUnarchiver unarchiveObjectWithData:[pasteboard dataForType:CPColorDragType]] range:_selectionRange];
|
||||
}
|
||||
|
||||
- (void)_setPlaceholderString:(CPString)aString
|
||||
{
|
||||
// <!> fixme
|
||||
}
|
||||
|
||||
- (void)_continuouslyReverseSetBinding
|
||||
{
|
||||
var binderClass = [[self class] _binderClassForBinding:CPAttributedStringBinding] ||
|
||||
[[self class] _binderClassForBinding:CPValueBinding],
|
||||
theBinding = [binderClass getBinding:CPAttributedStringBinding forObject:self] || [binderClass getBinding:CPValueBinding forObject:self];
|
||||
|
||||
if ([theBinding continuouslyUpdatesValue])
|
||||
[theBinding reverseSetValueFor:@"objectValue"];
|
||||
}
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
var binderClass = [[self class] _binderClassForBinding:CPAttributedStringBinding] ||
|
||||
[[self class] _binderClassForBinding:CPValueBinding],
|
||||
theBinding = [binderClass getBinding:CPAttributedStringBinding forObject:self] || [binderClass getBinding:CPValueBinding forObject:self];
|
||||
|
||||
[theBinding reverseSetValueFor:@"objectValue"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -2658,9 +2684,6 @@ var _CPCopyPlaceholder = '-';
|
||||
_CPNativeInputField.style.left = "-10000px";
|
||||
#endif
|
||||
|
||||
}
|
||||
- (void)_setPlaceholderString:(CPString)aString
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2683,7 +2706,7 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
[_source setObjectValue:aValue];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -705,12 +705,12 @@
|
||||
</textField>
|
||||
<scrollView misplaced="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="Ff5-4Z-qv6">
|
||||
<rect key="frame" x="19" y="54" width="222" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<clipView key="contentView" id="iBn-dR-GkU">
|
||||
<rect key="frame" x="1" y="1" width="205" height="68"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textView importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" smartInsertDelete="YES" id="xCr-yo-JbT">
|
||||
<textView importsGraphics="NO" richText="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" smartInsertDelete="YES" id="xCr-yo-JbT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="205" height="68"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@@ -718,7 +718,11 @@
|
||||
<size key="maxSize" width="463" height="10000000"/>
|
||||
<color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<connections>
|
||||
<binding destination="562" name="attributedString" keyPath="selection.volume" id="7En-3t-nN4"/>
|
||||
<binding destination="562" name="attributedString" keyPath="selection.volume" id="lYe-VE-R5X">
|
||||
<dictionary key="options">
|
||||
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</textView>
|
||||
</subviews>
|
||||
@@ -735,7 +739,7 @@
|
||||
</scrollView>
|
||||
<textField verticalHuggingPriority="750" misplaced="YES" id="LZg-jC-bXw">
|
||||
<rect key="frame" x="17" y="12" width="332" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="This is to check whether the attributedString binding of CPTextView works" id="jB1-Qh-L4O">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
Reference in New Issue
Block a user