I have e-mail but I don't have web access. So I don't know how I can
put my patches in the bug-tracking system. Do you have any suggestions?
Here is what was in my attachment. The attachment came through fine,
since I get the group messages by e-mail. But maybe it doesn't show up
if you access the group messages on the web site.
diff --git a/AppKit/NSControl.m b/AppKit/NSControl.m
index 2af7f82..0302d44 100755
--- a/AppKit/NSControl.m
+++ b/AppKit/NSControl.m
@@ -15,6 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSClipView.h>
#import <Foundation/NSKeyedArchiver.h>
#import <AppKit/NSRaise.h>
+#import <AppKit/NSObject+BindingSupport.h>
NSString
*NSControlTextDidBeginEditingNotification
=@"NSControlTextDidBeginEditingNotification";
NSString
*NSControlTextDidChangeNotification
=@"NSControlTextDidChangeNotification";
@@ -366,6 +367,15 @@ static NSMutableDictionary *cellClassDictionary =
nil;
[[NSNotificationCenter defaultCenter]
postNotificationName:NSControlTextDidBeginEditingNotification
object:self userInfo:[NSDictionary dictionaryWithObject:[note
object] forKey:@"NSFieldEditor"]];
+
+ // If this control's value is bound to an object that conforms to
NSEditorRegistration, register as an editor.
+ NSDictionary * bindingInfo = [self infoForBinding:@"value"];
+ if (bindingInfo)
+ {
+ id observedObject = [bindingInfo
objectForKey:NSObservedObjectKey];
+ if ([observedObject
respondsToSelector:@selector(objectDidBeginEditing:)])
+ [observedObject objectDidBeginEditing:self];
+ }
}
-(void)textDidChange:(NSNotification *)note {
@@ -390,6 +400,15 @@ static NSMutableDictionary *cellClassDictionary =
nil;
[[NSNotificationCenter defaultCenter]
postNotificationName:NSControlTextDidEndEditingNotification
object:self userInfo:[NSDictionary dictionaryWithObject:[note
object] forKey:@"NSFieldEditor"]];
+ // If this control's value is bound to an object that conforms to
NSEditorRegistration, unregister as an editor.
+ NSDictionary * bindingInfo = [self infoForBinding:@"value"];
+ if (bindingInfo)
+ {
+ id observedObject = [bindingInfo
objectForKey:NSObservedObjectKey];
+ if ([observedObject
respondsToSelector:@selector(objectDidEndEditing:)])
+ [observedObject objectDidEndEditing:self];
+ }
+
[self setNeedsDisplay:YES];
}
@@ -438,4 +457,15 @@ static NSMutableDictionary *cellClassDictionary =
nil;
}
}
+// NSEditor methods
+
+-(BOOL)commitEditing {
+ [self validateEditing];
+ return YES;
+}
+
+- (void)discardEditing {
+ [self abortEditing];
+}
+
@end
diff --git a/AppKit/NSController/NSController.h b/AppKit/NSController/
NSController.h
index 0dab4e0..f155edf 100644
--- a/AppKit/NSController/NSController.h
+++ b/AppKit/NSController/NSController.h
@@ -6,6 +6,7 @@ The above copyright notice and this permission notice
shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
+#import <Foundation/NSMutableArray.h>
#import <AppKit/AppKitExport.h>
APPKIT_EXPORT NSString *NSNoSelectionMarker;
@@ -15,7 +16,7 @@ APPKIT_EXPORT NSString *NSNotApplicableMarker;
APPKIT_EXPORT BOOL NSIsControllerMarker(id object);
@interface NSController : NSObject <NSCoding> {
-
+ NSMutableArray *_editors;
}
-(BOOL)commitEditing;
diff --git a/AppKit/NSController/NSController.m b/AppKit/NSController/
NSController.m
index 8cd637a..c2aecd0 100644
--- a/AppKit/NSController/NSController.m
+++ b/AppKit/NSController/NSController.m
@@ -32,6 +32,20 @@ BOOL NSIsControllerMarker(id object)
}
}
+-init {
+ self = [super init];
+ if (self)
+ {
+ _editors = [[NSMutableArray alloc] init];
+ }
+ return self;
+}
+
+-(void)dealloc {
+ [_editors release];
+ [super dealloc];
+}
+
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
@@ -42,25 +56,35 @@ BOOL NSIsControllerMarker(id object)
}
-(BOOL)commitEditing {
- NSUnimplementedMethod();
- return NO;
+ if ([_editors count] == 0)
+ return YES;
+
+ NSEnumerator * e = [_editors objectEnumerator];
+ id editor;
+ while ((editor = [e nextObject]))
+ if ([editor commitEditing] == NO)
+ return NO;
+
+ return YES;
}
-(void)discardEditing {
- NSUnimplementedMethod();
+ NSEnumerator * e = [_editors objectEnumerator];
+ id editor;
+ while ((editor = [e nextObject]))
+ [editor discardEditing];
}
-(BOOL)isEditing {
- NSUnimplementedMethod();
- return NO;
+ return [_editors count] > 0;
}
-(void)objectDidBeginEditing:editor {
- NSUnimplementedMethod();
+ [_editors addObject:editor];
}
-(void)objectDidEndEditing:editor {
- NSUnimplementedMethod();
+ [_editors removeObject:editor];
}
@end
diff --git a/AppKit/NSKeyValueBinding/NSObject+BindingSupport.h b/
AppKit/NSKeyValueBinding/NSObject+BindingSupport.h
index 13af090..908ac96 100644
--- a/AppKit/NSKeyValueBinding/NSObject+BindingSupport.h
+++ b/AppKit/NSKeyValueBinding/NSObject+BindingSupport.h
@@ -47,6 +47,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLI
-(id)_setCurrentValueIsPlaceholder:(BOOL)isPlaceholder;
@end
+@interface NSObject (NSEditor)
+-(BOOL)commitEditing;
+-(void)discardEditing;
+@end
+
+@interface NSObject (NSEditorRegistration)
+-(void)objectDidBeginEditing:editor;
+-(void)objectDidEndEditing:editor;
+@end
+
APPKIT_EXPORT NSString* NSObservedObjectKey;
APPKIT_EXPORT NSString* NSObservedKeyPathKey;
APPKIT_EXPORT NSString* NSOptionsKey;
Andy Balholm
(509) 276-9718
an...@balholm.com