diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/PicturePreview.xib | 70 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 85 |
2 files changed, 82 insertions, 73 deletions
diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index d8eba8b82..a27fd608d 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -2,10 +2,10 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10A432</string> - <string key="IBDocument.InterfaceBuilderVersion">732</string> - <string key="IBDocument.AppKitVersion">1038</string> - <string key="IBDocument.HIToolboxVersion">437.00</string> + <string key="IBDocument.SystemVersion">10C540</string> + <string key="IBDocument.InterfaceBuilderVersion">740</string> + <string key="IBDocument.AppKitVersion">1038.25</string> + <string key="IBDocument.HIToolboxVersion">458.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> @@ -15,13 +15,13 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>732</string> - <string>1584</string> + <string>740</string> + <string>1591.3</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="257"/> + <integer value="252"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -139,7 +139,7 @@ <object class="NSButton" id="798240356"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">292</int> - <string key="NSFrame">{{18, 8}, {77, 25}}</string> + <string key="NSFrame">{{18, 7}, {77, 25}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -176,7 +176,7 @@ <object class="NSButton" id="537831590"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{251, 8}, {69, 25}}</string> + <string key="NSFrame">{{253, 7}, {69, 25}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -209,7 +209,7 @@ <object class="NSButton" id="141370142"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{364, 8}, {54, 25}}</string> + <string key="NSFrame">{{366, 7}, {54, 25}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -242,7 +242,7 @@ <object class="NSButton" id="81685190"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{325, 8}, {34, 25}}</string> + <string key="NSFrame">{{327, 7}, {34, 25}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -275,7 +275,7 @@ <object class="NSTextField" id="66510867"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{117, 15}, {75, 11}}</string> + <string key="NSFrame">{{119, 14}, {75, 11}}</string> <reference key="NSSuperview" ref="385854969"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="567286013"> @@ -306,7 +306,7 @@ <object class="NSPopUpButton" id="598619000"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{196, 12}, {45, 15}}</string> + <string key="NSFrame">{{198, 11}, {45, 15}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -390,7 +390,7 @@ <object class="NSSlider" id="396925210"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">290</int> - <string key="NSFrame">{{18, 40}, {400, 16}}</string> + <string key="NSFrame">{{18, 39}, {402, 16}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -425,7 +425,7 @@ <object class="NSTextField" id="628196212"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">290</int> - <string key="NSFrame">{{15, 56}, {406, 20}}</string> + <string key="NSFrame">{{15, 55}, {408, 20}}</string> <reference key="NSSuperview" ref="385854969"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="921881842"> @@ -449,7 +449,7 @@ <object class="NSTextField" id="245200984"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">290</int> - <string key="NSFrame">{{16, 81}, {406, 12}}</string> + <string key="NSFrame">{{16, 80}, {408, 12}}</string> <reference key="NSSuperview" ref="385854969"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1032360651"> @@ -464,11 +464,11 @@ </object> </object> </object> - <string key="NSFrame">{{2, 2}, {436, 96}}</string> + <string key="NSFrame">{{1, 1}, {438, 97}}</string> <reference key="NSSuperview" ref="92351498"/> </object> </object> - <string key="NSFrame">{{21, 90}, {440, 100}}</string> + <string key="NSFrame">{{21, 91}, {440, 99}}</string> <reference key="NSSuperview" ref="353606868"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -499,12 +499,14 @@ <int key="NSBoxType">4</int> <int key="NSTitlePosition">0</int> <bool key="NSTransparent">NO</bool> - <real value="2" key="NSBorderWidth2"/> - <double key="NSCornerRadius2">26</double> - <reference key="NSBorderColor2" ref="978544139"/> + <double key="NSCornerRadius2">12</double> + <object class="NSColor" key="NSBorderColor2"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MSAxIDEgMC41AA</bytes> + </object> <object class="NSColor" key="NSFillColor2"> <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MCAwIDAgMC43NQA</bytes> + <bytes key="NSRGB">MCAwIDAgMC42AA</bytes> </object> </object> <object class="NSBox" id="768906858"> @@ -543,7 +545,7 @@ <object class="NSButton" id="569473100"> <reference key="NSNextResponder" ref="1067699710"/> <int key="NSvFlags">265</int> - <string key="NSFrame">{{366, 21}, {46, 25}}</string> + <string key="NSFrame">{{368, 23}, {46, 25}}</string> <reference key="NSSuperview" ref="1067699710"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -593,11 +595,11 @@ </object> </object> </object> - <string key="NSFrame">{{2, 2}, {436, 96}}</string> + <string key="NSFrame">{{1, 1}, {438, 98}}</string> <reference key="NSSuperview" ref="768906858"/> </object> </object> - <string key="NSFrame">{{21, 90}, {440, 100}}</string> + <string key="NSFrame">{{21, 204}, {440, 100}}</string> <reference key="NSSuperview" ref="353606868"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -616,12 +618,14 @@ <int key="NSBoxType">4</int> <int key="NSTitlePosition">0</int> <bool key="NSTransparent">NO</bool> - <real value="2" key="NSBorderWidth2"/> - <double key="NSCornerRadius2">26</double> - <reference key="NSBorderColor2" ref="978544139"/> + <double key="NSCornerRadius2">11</double> + <object class="NSColor" key="NSBorderColor2"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MSAxIDEgMC41AA</bytes> + </object> <object class="NSColor" key="NSFillColor2"> <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MCAwIDAgMC43NQA</bytes> + <bytes key="NSRGB">MCAwIDAgMC42AA</bytes> </object> </object> </object> @@ -923,8 +927,8 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="844127024"/> <reference ref="92351498"/> - <reference ref="768906858"/> <reference ref="48693112"/> + <reference ref="768906858"/> </object> <reference key="parent" ref="49161063"/> </object> @@ -1322,10 +1326,10 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{411, 519}, {480, 360}}</string> + <string>{{411, 496}, {480, 360}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <boolean value="NO"/> - <string>{{411, 519}, {480, 360}}</string> + <boolean value="YES"/> + <string>{{411, 496}, {480, 360}}</string> <integer value="1"/> <string>{{221, 276}, {533, 580}}</string> <boolean value="NO"/> diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 750a68c4e..f58c1f5d3 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -232,8 +232,6 @@ [fPictureView setHidden:NO]; - //[fHBController writeToActivityLog: "displayPreview called"]; - NSImage *fPreviewImage = [self imageForPicture: fPicture]; NSSize imageScaledSize = [fPreviewImage size]; [fPictureView setImage: fPreviewImage]; @@ -286,47 +284,28 @@ sizeInfoString = [NSString stringWithFormat: @"Source: %dx%d, Output: %dx%d", fTitle->width, fTitle->height, fTitle->job->width, fTitle->job->height]; - + /* original displaySize.width = fTitle->width; displaySize.height = fTitle->height; imageScaledSize.width = fTitle->job->width; imageScaledSize.height = fTitle->job->height; + */ + /* Test ... */ + displaySize.width = fTitle->width; + displaySize.height = fTitle->height; + imageScaledSize.width = fTitle->job->width + fTitle->job->crop[2] + fTitle->job->crop[3]; + imageScaledSize.height = fTitle->job->height + fTitle->job->crop[0] - fTitle->job->crop[1]; } NSSize viewSize = [self optimalViewSizeForImageSize:displaySize]; - /* Initially set our preview image here */ - /* - if (scaleToScreen == YES) - { - viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width); - viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); - [fPreviewImage setSize: viewSize]; - //[fPictureView setFrameSize: viewSize]; - } - - else - { - [fPreviewImage setSize: imageScaledSize]; - [fPictureView setFrameSize: imageScaledSize]; - } - [fPictureView setImage: fPreviewImage]; - // center it vertically and horizontally - NSPoint origin = [fPictureViewArea frame].origin; - origin.y += ([fPictureViewArea frame].size.height - - [fPictureView frame].size.height) / 2.0; - - origin.x += ([fPictureViewArea frame].size.width - - [fPictureView frame].size.width) / 2.0; - [fPictureView setFrameOrigin:origin]; - */ - /* we also need to take into account scaling to full screen to activate switching the view size */ + /* we also need to take into account scaling to full screen to activate switching the view size */ if( [self viewNeedsToResizeToSize:viewSize]) { if (fTitle->job->anamorphic.mode != 2 || (fTitle->job->anamorphic.mode == 2 && fTitle->width == fTitle->job->width)) { [self resizeSheetForViewSize:viewSize]; - //[self setViewSize:viewSize]; + [self setViewSize:viewSize]; } } @@ -343,17 +322,18 @@ } NSString *scaleString; - - if( imageScaledSize.height > [fPictureView frame].size.height) + 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); + //CGFloat scale = ( ( CGFloat )[fPictureView frame].size.width) / ( ( CGFloat )imageScaledSize.width); scaleString = [NSString stringWithFormat: - NSLocalizedString( @" (Scaled to %.0f%% actual size)", + NSLocalizedString( @" (%.0f%% actual size)", @"String shown when a preview is scaled" ), scale * 100.0]; } else { - scaleString = @""; + scaleString = @"(Actual size)"; } /* Set the info fields in the hud controller */ [fInfoField setStringValue: [NSString stringWithFormat: @@ -509,6 +489,7 @@ [self pictureSliderChanged:nil]; [fScaleToScreenToggleButton setTitle:@">-<"]; } + } - (BOOL)fullScreen @@ -1061,7 +1042,8 @@ */ NSSize displaySize = NSMakeSize( ( CGFloat ) movieBounds.size.width, ( CGFloat ) movieBounds.size.height ); NSSize viewSize = [self optimalViewSizeForImageSize:displaySize]; - if( [self viewNeedsToResizeToSize:viewSize] ) { + if( [self viewNeedsToResizeToSize:viewSize] ) + { [self resizeSheetForViewSize:viewSize]; [self setViewSize:viewSize]; } @@ -1213,8 +1195,10 @@ // 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 minSize = [[self window] minSize]; + frame.size.width += deltaX; frame.size.height += deltaY; if( frame.size.width < minSize.width ) @@ -1226,7 +1210,7 @@ { frame.size.height = minSize.height; } - + // But now the sheet is off-center, so also shift the origin to center it and // keep the top aligned. @@ -1256,7 +1240,19 @@ * necessary. */ NSSize screenSize = [[[self window] screen] frame].size; + CGFloat screenWidthMod = screenSize.width - 100; + CGFloat screenHeightMod = screenSize.height - 100; NSPoint screenOrigin = [[[self window] screen] frame].origin; + if (screenHeightMod < frame.size.height) + { + frame.size.height = screenHeightMod; + } + else if (screenWidthMod < frame.size.width) + { + frame.size.width = screenWidthMod; + } + + /* our origin is off the screen to the left*/ if (frame.origin.x < screenOrigin.x) { @@ -1283,10 +1279,12 @@ - (void)setViewSize: (NSSize)viewSize { /* special case for scaleToScreen */ - if (scaleToScreen == YES) + NSSize screenSize = [[[self window] screen] frame].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; + //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 { @@ -1300,7 +1298,8 @@ } } - + + [fPictureView setFrameSize:viewSize]; // center it vertically and horizontally @@ -1315,6 +1314,12 @@ origin.y = floor( origin.y ); [fPictureView setFrameOrigin:origin]; + + /* set the top of the hud controller boxes centered vertically with the origin of our window */ + NSPoint hudControlBoxOrigin = [fPictureControlBox frame].origin; + hudControlBoxOrigin.y = ([[self window] frame].size.height / 2) - [fPictureControlBox frame].size.height; + [fPictureControlBox setFrameOrigin:hudControlBoxOrigin]; + [fEncodingControlBox setFrameOrigin:hudControlBoxOrigin]; } |