diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/PicturePreview.xib | 4 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index afb3b3dcb..77013fe9f 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9052" systemVersion="15B22c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9052" systemVersion="15B30a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment identifier="macosx"/> <development version="6300" identifier="xcode"/> @@ -29,7 +29,7 @@ </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/> - <window title="Preview" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="Preview" animationBehavior="default" id="5" userLabel="PreviewPanel"> + <window title="Preview" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="5" userLabel="PreviewPanel"> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <rect key="contentRect" x="221" y="837" width="500" height="360"/> <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/> diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index e3ebde368..df6dff6a2 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -81,7 +81,24 @@ typedef enum ViewMode : NSUInteger { { [self.window.contentView setWantsLayer:YES]; - self.windowCenterPoint = [self centerPoint]; + // Read the window center position + // We need the center and we can't use the + // standard NSWindow autosave because we change + // the window size at startup. + NSString *centerString = [[NSUserDefaults standardUserDefaults] objectForKey:@"HBPreviewWindowCenter"]; + if (centerString.length) + { + NSPoint center = NSPointFromString(centerString); + NSRect frame = self.window.frame; + [self.window setFrameOrigin:NSMakePoint(center.x - floor(frame.size.width / 2), + center.y - floor(frame.size.height / 2))]; + + self.windowCenterPoint = center; + } + else + { + self.windowCenterPoint = [self centerPoint]; + } self.window.excludedFromWindowsMenu = YES; self.window.acceptsMouseMovedEvents = YES; @@ -231,6 +248,7 @@ typedef enum ViewMode : NSUInteger { if (self.previewView.fitToView == NO) { self.windowCenterPoint = [self centerPoint]; + [[NSUserDefaults standardUserDefaults] setObject:NSStringFromPoint(self.windowCenterPoint) forKey:@"HBPreviewWindowCenter"]; } } |