* Headers/AppKit/NSTableView.h: Add _isValidating

* Source/NSCell.m (+initialize): Expose title binding.
	* Source/NSOpenPanel.m (-runModal): Use _directory if it is set.
	* Source/NSTableView.m (-validateEditing): Check _isValidating to
	prevent recursive calls into validateEditing.
	* Source/NSTabView.m (-initWithCoder:): Set _selected_item to
	NSNotFound.
	* Source/NSView.m (-addSubview:): Do not throw an exception when
	adding a nil subview, just ignore it.  This matches behavior on
	Cocoa.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35562 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2012-09-11 04:16:51 +00:00
parent 3945e35d2c
commit c06308b00a
7 changed files with 38 additions and 4 deletions

View file

@ -1,3 +1,17 @@
2012-09-11 00:08-EDT Gregory John Casamento <greg.casamento@gmail.com>
Merged from the TestPlant brach. Changes by Marcian Llytwyn
* Headers/AppKit/NSTableView.h: Add _isValidating
* Source/NSCell.m (+initialize): Expose title binding.
* Source/NSOpenPanel.m (-runModal): Use _directory if it is set.
* Source/NSTableView.m (-validateEditing): Check _isValidating to
prevent recursive calls into validateEditing.
* Source/NSTabView.m (-initWithCoder:): Set _selected_item to
NSNotFound.
* Source/NSView.m (-addSubview:): Do not throw an exception when
adding a nil subview, just ignore it. This matches behavior on
Cocoa.
2012-09-04 Wolfgang Lux <wolfgang.lux@gmail.com> 2012-09-04 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSSavePanel.m (-ok:): Restore ability to create nested * Source/NSSavePanel.m (-ok:): Restore ability to create nested

View file

@ -107,6 +107,11 @@ typedef enum _NSTableViewColumnAutoresizingStyle
BOOL _verticalMotionDrag; BOOL _verticalMotionDrag;
NSArray *_sortDescriptors; NSArray *_sortDescriptors;
/*
* Ivars Acting as Control...
*/
BOOL _isValidating;
/* /*
* Ivars Acting as Cache * Ivars Acting as Cache
*/ */

View file

@ -63,6 +63,8 @@
#import "AppKit/NSTextContainer.h" #import "AppKit/NSTextContainer.h"
#import "AppKit/NSView.h" #import "AppKit/NSView.h"
#import "AppKit/NSWindow.h" #import "AppKit/NSWindow.h"
#import "AppKit/NSKeyValueBinding.h"
#import "GSBindingHelpers.h"
#import "GNUstepGUI/GSTheme.h" #import "GNUstepGUI/GSTheme.h"
#import "GSGuiPrivate.h" #import "GSGuiPrivate.h"
@ -116,6 +118,9 @@ static NSColor *dtxtCol;
name: NSSystemColorsDidChangeNotification name: NSSystemColorsDidChangeNotification
object: nil]; object: nil];
[self _systemColorsChanged: nil]; [self _systemColorsChanged: nil];
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
[self exposeBinding: NSTitleBinding];
#endif
} }
} }
@ -216,6 +221,8 @@ static NSColor *dtxtCol;
- (void) dealloc - (void) dealloc
{ {
// Remove all key value bindings for this object.
[GSKeyValueBinding unbindAllForObject: self];
TEST_RELEASE (_contents); TEST_RELEASE (_contents);
TEST_RELEASE (_cell_image); TEST_RELEASE (_cell_image);
TEST_RELEASE (_font); TEST_RELEASE (_font);

View file

@ -395,7 +395,7 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
*/ */
- (NSInteger) runModalForTypes: (NSArray *)fileTypes - (NSInteger) runModalForTypes: (NSArray *)fileTypes
{ {
return [self runModalForDirectory: nil return [self runModalForDirectory: [self directory]
file: @"" file: @""
types: fileTypes]; types: fileTypes];
} }

View file

@ -558,6 +558,8 @@
{ {
self = [super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
_selected_item = NSNotFound;
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
if ([aDecoder containsValueForKey: @"NSAllowTruncatedLabels"]) if ([aDecoder containsValueForKey: @"NSAllowTruncatedLabels"])

View file

@ -2007,6 +2007,7 @@ static void computeNewSelection
- (void) _initDefaults - (void) _initDefaults
{ {
_isValidating = NO;
_drawsGrid = YES; _drawsGrid = YES;
_rowHeight = 16.0; _rowHeight = 16.0;
_intercellSpacing = NSMakeSize (5.0, 2.0); _intercellSpacing = NSMakeSize (5.0, 2.0);
@ -3207,13 +3208,16 @@ byExtendingSelection: (BOOL)flag
- (void) validateEditing - (void) validateEditing
{ {
if (_textObject) if (_textObject && (_isValidating == NO))
{ {
NSFormatter *formatter; NSFormatter *formatter;
NSString *string; NSString *string;
id newObjectValue = nil; id newObjectValue = nil;
BOOL validatedOK = YES; BOOL validatedOK = YES;
// Avoid potential recursive sequences...
_isValidating = YES;
formatter = [_editedCell formatter]; formatter = [_editedCell formatter];
string = AUTORELEASE([[_textObject text] copy]); string = AUTORELEASE([[_textObject text] copy]);
@ -3272,6 +3276,9 @@ byExtendingSelection: (BOOL)flag
row: _editedRow]; row: _editedRow];
} }
} }
// Avoid potential recursive sequences...
_isValidating = NO;
} }
} }

View file

@ -781,8 +781,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
if (aView == nil) if (aView == nil)
{ {
[NSException raise: NSInvalidArgumentException return;
format: @"Adding a nil subview"];
} }
if ([self isDescendantOf: aView]) if ([self isDescendantOf: aView])
{ {