]> granicus.if.org Git - handbrake/commitdiff
MacGui: Preview, use screens visibleFrame instead of frame to get better scale to...
authordynaflash <dynaflashtech@gmail.com>
Thu, 18 Feb 2010 16:49:45 +0000 (16:49 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Thu, 18 Feb 2010 16:49:45 +0000 (16:49 +0000)
- Some other code additions to troubleshoot initial window scaling where there shouldn't be any.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3122 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBPreviewController.m

index f58c1f5d326cdacebe33bfb50eb3deee62e6851f..5fdef7edbb8be865b34df0fa2fedc8cc598f0b94 100644 (file)
     MaxOutputWidth = title->width - job->crop[2] - job->crop[3];
     MaxOutputHeight = title->height - job->crop[0] - job->crop[1];
     [self SettingsChanged: nil];
+
 }
 
 
     NSString *scaleString;
     CGFloat scale = ( ( CGFloat )[fPictureView frame].size.width) / ( ( CGFloat )imageScaledSize.width);
     if (scale * 100.0 != 100)
-    //if( imageScaledSize.height > [fPictureView frame].size.height)
     {
         //CGFloat scale = ( ( CGFloat )[fPictureView frame].size.width) / ( ( CGFloat )imageScaledSize.width);        
         scaleString = [NSString stringWithFormat:
     // Now resize the whole panel by those same deltas, but don't exceed the min
     NSRect frame = [[self window] frame];
     NSSize screenSize = [[[self window] screen] frame].size;
-    NSSize maxSize = [[self window] maxSize];
+    //NSSize maxSize = [[self window] maxSize];
+    NSSize maxSize = [[[self window] screen] visibleFrame].size;
     NSSize minSize = [[self window] minSize];
     
     frame.size.width += deltaX;
     {
         frame.size.height = minSize.height;
     }
+    /* compare frame to max size of screen */
+    if( frame.size.width > maxSize.width )
+    {
+        frame.size.width = maxSize.width;
+    }
+    
+    if( frame.size.height > maxSize.height )
+    {
+        frame.size.height = maxSize.height;
+    }
+    
+    
 
     
     // But now the sheet is off-center, so also shift the origin to center it and
          * So check the origin against the screen origin and adjust if
          * necessary.
          */
-        NSSize screenSize = [[[self window] screen] frame].size;
-        CGFloat screenWidthMod = screenSize.width - 100;
-        CGFloat screenHeightMod = screenSize.height - 100;
+        NSSize screenSize = [[[self window] screen] visibleFrame].size;
         NSPoint screenOrigin = [[[self window] screen] frame].origin;
-        if (screenHeightMod < frame.size.height)
+        if (screenSize.height < frame.size.height)
         {
-            frame.size.height = screenHeightMod;
+            frame.size.height = screenSize.height;
         }
-        else if (screenWidthMod < frame.size.width)
+        if (screenSize.width < frame.size.width)
         {
-            frame.size.width = screenWidthMod;
+            frame.size.width = screenSize.width;
         }
         
         
 - (void)setViewSize: (NSSize)viewSize
 {   
     /* special case for scaleToScreen */
-    NSSize screenSize = [[[self window] screen] frame].size;
+    NSSize screenSize = [[[self window] screen] visibleFrame].size;
     NSSize areaSize = [fPictureViewArea frame].size;
     if (scaleToScreen == YES || viewSize.width > areaSize.width || viewSize.height > areaSize.height)
     {
         /* for scaleToScreen, we expand the fPictureView to fit the entire screen */
-        //NSSize areaSize = [fPictureViewArea frame].size;
         CGFloat viewSizeAspect = viewSize.width / viewSize.height;
         if (viewSizeAspect > 1.0) // we are wider than taller, so expand the width to fill the area and scale the height
         {