Resize the remote progress sheet if the description is larger than the text field

This commit is contained in:
Nathan Kinsinger
2010-07-04 12:02:44 -06:00
parent 6809ac31c6
commit 66e260fa69
2 changed files with 55 additions and 14 deletions
+41 -14
View File
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<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>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">740</string>
<string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -41,12 +41,12 @@
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">1</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 408}, {397, 102}}</string>
<string key="NSWindowRect">{{196, 417}, {397, 93}}</string>
<int key="NSWTFlags">544736256</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
@@ -56,7 +56,7 @@
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">1314</int>
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{23, 24}, {351, 20}}</string>
<string key="NSFrame">{{18, 16}, {361, 20}}</string>
<reference key="NSSuperview" ref="1006"/>
<int key="NSpiFlags">16394</int>
<double key="NSMaxValue">100</double>
@@ -64,7 +64,7 @@
<object class="NSTextField" id="939163389">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{17, 52}, {363, 30}}</string>
<string key="NSFrame">{{17, 56}, {363, 17}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="476186767">
@@ -83,7 +83,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
@@ -98,11 +98,11 @@
</object>
</object>
</object>
<string key="NSFrameSize">{397, 102}</string>
<string key="NSFrameSize">{397, 93}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -220,9 +220,9 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{814, 826}, {397, 102}}</string>
<string>{{814, 835}, {397, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{814, 826}, {397, 102}}</string>
<string>{{814, 835}, {397, 93}}</string>
<boolean value="NO"/>
<string>{196, 240}</string>
<string>{{202, 428}, {480, 270}}</string>
@@ -271,6 +271,25 @@
<string>NSProgressIndicator</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>progressDescription</string>
<string>progressIndicator</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">progressDescription</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">progressIndicator</string>
<string key="candidateClassName">NSProgressIndicator</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">PBRemoteProgressSheet.h</string>
@@ -833,6 +852,13 @@
<string key="NS.key.0">showWindow:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">showWindow:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">showWindow:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
@@ -841,6 +867,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
+14
View File
@@ -73,7 +73,21 @@ NSString * const kGitXProgressErrorInfo = @"PBGitXProgressErrorInfo";
description = theDescription;
[self window]; // loads the window (if it wasn't already)
// resize window if the description is larger than the default text field
NSRect originalFrame = [self.progressDescription frame];
[self.progressDescription setStringValue:[self progressTitle]];
NSAttributedString *attributedTitle = [self.progressDescription attributedStringValue];
NSSize boundingSize = originalFrame.size;
boundingSize.height = 0.0f;
NSRect boundingRect = [attributedTitle boundingRectWithSize:boundingSize options:NSStringDrawingUsesLineFragmentOrigin];
CGFloat heightDelta = boundingRect.size.height - originalFrame.size.height;
if (heightDelta > 0.0f) {
NSRect windowFrame = [[self window] frame];
windowFrame.size.height += heightDelta;
[[self window] setFrame:windowFrame display:NO];
}
[self.progressIndicator startAnimation:nil];
[NSApp beginSheet:[self window] modalForWindow:[controller window] modalDelegate:self didEndSelector:nil contextInfo:nil];