From 44f7f22f2faf92e814663c26ef2687ffdf202885 Mon Sep 17 00:00:00 2001 From: ritsuka Date: Wed, 18 Feb 2015 07:47:23 +0000 Subject: MacGui: do not make the output panel textview scroll to the bottom if the window is not visible. The scroll operation is expensive. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6923 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/HBAppDelegate.m | 2 +- macosx/HBOutputPanelController.h | 1 - macosx/HBOutputPanelController.m | 13 ++++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m index b87a77b07..c28164a9e 100644 --- a/macosx/HBAppDelegate.m +++ b/macosx/HBAppDelegate.m @@ -418,7 +418,7 @@ */ - (IBAction)showOutputPanel:(id)sender { - [self.outputPanel showOutputPanel:sender]; + [self.outputPanel showWindow:sender]; } - (IBAction)showPicturePanel:(id)sender diff --git a/macosx/HBOutputPanelController.h b/macosx/HBOutputPanelController.h index 14ab72dee..38a9f867c 100644 --- a/macosx/HBOutputPanelController.h +++ b/macosx/HBOutputPanelController.h @@ -13,7 +13,6 @@ */ @interface HBOutputPanelController : NSWindowController -- (IBAction)showOutputPanel:(id)sender; - (IBAction)clearOutput:(id)sender; - (IBAction)copyAllOutputToPasteboard:(id)sender; - (IBAction)openActivityLogFile:(id)sender; diff --git a/macosx/HBOutputPanelController.m b/macosx/HBOutputPanelController.m index 8b6e955d7..c275c3970 100644 --- a/macosx/HBOutputPanelController.m +++ b/macosx/HBOutputPanelController.m @@ -114,7 +114,7 @@ /** * Loads output panel from OutputPanel.nib and shows it. */ -- (IBAction)showOutputPanel:(id)sender +- (IBAction)showWindow:(id)sender { if ([[self window] isVisible]) { @@ -122,10 +122,10 @@ } else { - [textView scrollRangeToVisible:NSMakeRange([outputTextStorage length], 0)]; - [self showWindow:sender]; + [textView scrollToEndOfDocument:self]; + [super showWindow:sender]; - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"OutputPanelIsOpen"]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"OutputPanelIsOpen"]; } } @@ -209,7 +209,10 @@ if (outputTextStorage.length > TextStorageUpperSizeLimit) [outputTextStorage deleteCharactersInRange:NSMakeRange(0, [outputTextStorage length] - TextStorageLowerSizeLimit)]; - [textView scrollRangeToVisible:NSMakeRange([outputTextStorage length], 0)]; + if (self.window.isVisible) + { + [textView scrollToEndOfDocument:self]; + } FILE *f = fopen(_outputLogFile.fileSystemRepresentation, "a"); fprintf(f, "%s", text.UTF8String); -- cgit v1.2.3