scroll the message log to the bottom on update of the message log when it's already scrolled to the bottom

This commit is contained in:
Mitchell Livingston 2007-12-28 03:19:30 +00:00
parent e781dfb03d
commit 0eec065df9
2 changed files with 7 additions and 2 deletions

View File

@ -28,10 +28,10 @@
@implementation GradientCell
#warning switch to image cell
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
{
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: cellFrame radius: 4.0];
[[self objectValue] fillBezierPath: bp angle: 90];
[[self objectValue] fillBezierPath: [NSBezierPath bezierPathWithRoundedRect: cellFrame radius: 4.0] angle: 90];
}
@end

View File

@ -135,6 +135,9 @@
tr_freeMessageList(messages);
NSScroller * scroller = [[fMessageTable enclosingScrollView] verticalScroller];
BOOL shouldScroll = [scroller floatValue] == 1.0 || [scroller isHidden] || [scroller knobProportion] == 1.0;
int total = [fMessages count];
if (total > MAX_MESSAGES)
{
@ -152,6 +155,8 @@
[fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
[fMessageTable reloadData];
if (shouldScroll)
[fMessageTable scrollRowToVisible: total-1];
}
- (int) numberOfRowsInTableView: (NSTableView *) tableView