[vlc-commits] macosx: fixed too early reset when scrolling the credits

Felix Paul Kühne git at videolan.org
Sat Apr 16 22:16:07 CEST 2011


vlc/vlc-1.1 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Apr 16 22:16:03 2011 +0200| [efc88959332afcd364d80e3f041991263d0aded6] | committer: Felix Paul Kühne

macosx: fixed too early reset when scrolling the credits

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=efc88959332afcd364d80e3f041991263d0aded6
---

 modules/gui/macosx/about.m |   52 ++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/modules/gui/macosx/about.m b/modules/gui/macosx/about.m
index 1423de7..e0ebf78 100644
--- a/modules/gui/macosx/about.m
+++ b/modules/gui/macosx/about.m
@@ -57,7 +57,7 @@ static VLAboutBox *_o_sharedInstance = nil;
     } else {
         _o_sharedInstance = [super init];
     }
- 
+
     return _o_sharedInstance;
 }
 
@@ -68,8 +68,8 @@ static VLAboutBox *_o_sharedInstance = nil;
 }
 
 /*****************************************************************************
-* VLC About Window
-*****************************************************************************/
+ * VLC About Window
+ *****************************************************************************/
 
 - (void)showAbout
 {
@@ -93,25 +93,25 @@ static VLAboutBox *_o_sharedInstance = nil;
 
         /* setup the creator / revision field */
         NSString *compiler;
-        #ifdef __clang__
+#ifdef __clang__
         compiler = [NSString stringWithFormat:@"clang %s", __clang_version__];
-        #elif __llvm__
+#elif __llvm__
         compiler = [NSString stringWithFormat:@"llvm-gcc %s", __VERSION__];
-        #else
+#else
         compiler = [NSString stringWithFormat:@"gcc %s", __VERSION__];
-        #endif
+#endif
         [o_revision_field setStringValue: 
-            [NSString stringWithFormat: _NS("Compiled by %s with %@"), VLC_CompileBy(), compiler]];
- 
+         [NSString stringWithFormat: _NS("Compiled by %s with %@"), VLC_CompileBy(), compiler]];
+
         /* Setup the nameversion field */
         [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM]];
 
         /* setup the authors and thanks field */
         [o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n%@\n%@\n\n%@", 
-                                            _NS(INTF_ABOUT_MSG), 
-                                            _NS("VLC was brought to you by:"),
-                                            [NSString stringWithUTF8String: psz_authors], 
-                                            [NSString stringWithUTF8String: psz_thanks]]];
+                                        _NS(INTF_ABOUT_MSG), 
+                                        _NS("VLC was brought to you by:"),
+                                        [NSString stringWithUTF8String: psz_authors], 
+                                        [NSString stringWithUTF8String: psz_thanks]]];
 
         /* Setup the window */
         [o_credits_textview setDrawsBackground: NO];
@@ -123,7 +123,7 @@ static VLAboutBox *_o_sharedInstance = nil;
         
         b_isSetUp = YES;
     }
- 
+
     /* Show the window */
     b_restart = YES;
     [o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
@@ -159,15 +159,21 @@ static VLAboutBox *_o_sharedInstance = nil;
     {
         /* Scroll to the position */
         [o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
- 
+
         /* Increment the scroll position */
         f_current += 0.005;
- 
+
         /* If at end, restart at the top */
         if( f_current >= f_end )
         {
-            [o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
-            b_restart = YES;
+            /* f_end may be wrong on first run, so don't trust it too much */
+            if( f_end == [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height ) 
+            {
+                b_restart = YES;
+                [o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
+            }
+            else
+                f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
         }
     }
 }
@@ -179,8 +185,8 @@ static VLAboutBox *_o_sharedInstance = nil;
 }
 
 /*****************************************************************************
-* VLC GPL Window, action called from the about window and the help menu
-*****************************************************************************/
+ * VLC GPL Window, action called from the about window and the help menu
+ *****************************************************************************/
 
 - (IBAction)showGPL:(id)sender
 {
@@ -192,8 +198,8 @@ static VLAboutBox *_o_sharedInstance = nil;
 }
 
 /*****************************************************************************
-* VLC Generic Help Window
-*****************************************************************************/
+ * VLC Generic Help Window
+ *****************************************************************************/
 
 - (void)showHelp
 {
@@ -203,7 +209,7 @@ static VLAboutBox *_o_sharedInstance = nil;
     [o_help_home_btn setToolTip: _NS("Index")];
 
     [o_help_window makeKeyAndOrderFront: self];
-    
+
     [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
                                         baseURL: [NSURL URLWithString:@"http://videolan.org"]];
 }



More information about the vlc-commits mailing list