mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:50:48 +00:00
Patch by Quentin Mathe <qmathe@club-internet.fr>.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26247 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8d420a08d8
commit
5af5609402
2 changed files with 516 additions and 511 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSOutlineView.m (-_initOutlineDefaults): New helper
|
||||
method extracting code from initWithFrame: and initWithCoder:.
|
||||
* Source/NSOutlineView.m (-itemAtRow:): Return nil for invalid row
|
||||
numbers.
|
||||
Patch by Quentin Mathe <qmathe@club-internet.fr>.
|
||||
|
||||
2008-03-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSWindow.m: deminiaturize window in -makeKeyAndOrderFront:
|
||||
|
|
|
@ -105,6 +105,7 @@ static NSImage *unexpandable = nil;
|
|||
|
||||
// These methods are private...
|
||||
@interface NSOutlineView (TableViewInternalPrivate)
|
||||
- (void) _initOutlineDefaults;
|
||||
- (void) _autosaveExpandedItems;
|
||||
- (void) _autoloadExpandedItems;
|
||||
- (void) _collectItemsStartingWith: (id)startitem
|
||||
|
@ -140,22 +141,14 @@ static NSImage *unexpandable = nil;
|
|||
*/
|
||||
- (id)initWithFrame: (NSRect)frame
|
||||
{
|
||||
[super initWithFrame: frame];
|
||||
self = [super initWithFrame: frame];
|
||||
|
||||
if (self != nil)
|
||||
{
|
||||
[self _initOutlineDefaults];
|
||||
//_outlineTableColumn = nil;
|
||||
}
|
||||
|
||||
// Initial values
|
||||
_indentationMarkerFollowsCell = YES;
|
||||
_autoResizesOutlineColumn = NO;
|
||||
_autosaveExpandedItems = NO;
|
||||
_indentationPerLevel = 0.0;
|
||||
_outlineTableColumn = nil;
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -391,10 +384,15 @@ static NSImage *unexpandable = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the item at a given row.
|
||||
* Returns the item at a given row. If no item exists for the given row,
|
||||
* returns nil.
|
||||
*/
|
||||
- (id)itemAtRow: (int)row
|
||||
{
|
||||
if ((row >= [_items count]) || (row < 0))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [_items objectAtIndex: row];
|
||||
}
|
||||
|
||||
|
@ -704,23 +702,13 @@ static NSImage *unexpandable = nil;
|
|||
{
|
||||
// Since we only have one version....
|
||||
self = [super initWithCoder: aDecoder];
|
||||
if (self == nil)
|
||||
return self;
|
||||
|
||||
[self _initOutlineDefaults];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
|
||||
// these can't be chosen on IB.
|
||||
_indentationPerLevel = 10.0;
|
||||
_indentationMarkerFollowsCell = YES;
|
||||
_autoResizesOutlineColumn = NO;
|
||||
_autosaveExpandedItems = NO;
|
||||
|
||||
// init the table column... (this can't be chosen on IB either)...
|
||||
if ([_tableColumns count] > 0)
|
||||
{
|
||||
|
@ -729,6 +717,7 @@ static NSImage *unexpandable = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
// overrides outline defaults with archived values
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_autoResizesOutlineColumn];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||
|
@ -738,15 +727,6 @@ static NSImage *unexpandable = nil;
|
|||
[aDecoder decodeValueOfObjCType: @encode(float)
|
||||
at: &_indentationPerLevel];
|
||||
_outlineTableColumn = [aDecoder decodeObject];
|
||||
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -1645,6 +1625,23 @@ static NSImage *unexpandable = nil;
|
|||
|
||||
@implementation NSOutlineView (TableViewInternalPrivate)
|
||||
|
||||
- (void) _initOutlineDefaults
|
||||
{
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
|
||||
_indentationMarkerFollowsCell = YES;
|
||||
_autoResizesOutlineColumn = NO;
|
||||
_autosaveExpandedItems = NO;
|
||||
_indentationPerLevel = 10.0;
|
||||
}
|
||||
|
||||
- (void) _autosaveExpandedItems
|
||||
{
|
||||
if (_autosaveExpandedItems && _autosaveName != nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue