Commits

Jason Harris  committed 8e5c791

- Add RelativePositionedBox to keep the position of a box relatively located at relative
x% and relative y% of the parent enclosing view.

  • Participants
  • Parent commits 3f0dc7c

Comments (0)

Files changed (4)

File Classes/UtilityClasses/RelativePositionedBox/RelativePositionedBox.h

+//
+//  LocatedBox.h
+//  MacHg
+//
+//  Created by Jason Harris on 6/1/10.
+//  Copyright 2010 Jason F Harris. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface RelativePositionedBox : NSBox
+{
+}
+
+@end

File Classes/UtilityClasses/RelativePositionedBox/RelativePositionedBox.m

+//
+//  LocatedBox.m
+//  MacHg
+//
+//  Created by Jason Harris on 6/1/10.
+//  Copyright 2010 Jason F Harris. All rights reserved.
+//
+
+#import "RelativePositionedBox.h"
+
+
+@implementation RelativePositionedBox
+
+
+- (void) viewWillDraw
+{
+	static CGFloat relativeXPosition = 0.35;
+	static CGFloat relativeYPosition = 0.7;
+
+	NSRect f = [self frame];
+	NSRect bounds = [[super superview] bounds];
+	f.origin.x = round((bounds.size.width  - f.size.width ) * relativeXPosition);
+	f.origin.y = round((bounds.size.height - f.size.height) * relativeYPosition);
+	if (f.origin.x < 0)
+		f.origin.x = 0;
+	if (f.origin.y > f.size.height)
+		f.origin.y = f.size.height;
+	[self setFrame:f];
+	[super viewWillDraw];
+}
+
+@end

File English.lproj/BackingPane.xib

 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
 			<string key="NS.object.0">740</string>
 		</object>
-		<array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
-			<integer value="38"/>
-		</array>
+		<array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
 		<array key="IBDocument.PluginDependencies">
 			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 		</array>
 				<string key="NSClassName">NSApplication</string>
 			</object>
 			<object class="NSCustomView" id="93727628">
-				<reference key="NSNextResponder"/>
+				<nil key="NSNextResponder"/>
 				<int key="NSvFlags">4370</int>
 				<array class="NSMutableArray" key="NSSubviews">
 					<object class="NSBox" id="545855797">
 					</object>
 				</array>
 				<string key="NSFrameSize">{817, 465}</string>
-				<reference key="NSSuperview"/>
 				<bool key="NSViewIsLayerTreeHost">YES</bool>
 				<int key="NSViewLayerContentsRedrawPolicy">2</int>
 				<string key="NSClassName">NSView</string>
 				<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
 				<string key="1.editorWindowContentRectSynchronizationRect">{{305, 620}, {664, 405}}</string>
 				<string key="37.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="38.CustomClassName">RelativePositionedBox</string>
 				<string key="38.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
 				<dictionary class="NSMutableDictionary" key="39.IBAttributePlaceholdersKey"/>
 				<string key="39.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
 						<string key="backingBox">NSBox</string>
 						<string key="buttonBox">NSBox</string>
 					</dictionary>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="539633709">
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
 						<string key="minorKey">Classes/BackingPane/BackingPaneController.h</string>
 					</object>
 						<string key="NS.key.0">centeringObject</string>
 						<string key="NS.object.0">NSView</string>
 					</object>
-					<reference key="sourceIdentifier" ref="539633709"/>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">Classes/UtilityClasses/RadialGradiantBox/RadialGradiantBox.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">RelativePositionedBox</string>
+					<string key="superclassName">NSBox</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBUserSource</string>
+						<string key="minorKey"/>
+					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">Sidebar</string>

File MacHg.xcodeproj/project.pbxproj

 		96DD29CA112AE56200A57BD3 /* CollapseSheetController.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DD29C9112AE56200A57BD3 /* CollapseSheetController.m */; };
 		96DD29CD112AE56D00A57BD3 /* CollapseSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96DD29CB112AE56D00A57BD3 /* CollapseSheet.xib */; };
 		96DF426511B48DC700D986FF /* RadialGradiantBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DF426411B48DC700D986FF /* RadialGradiantBox.m */; };
+		96DF437111B5209C00D986FF /* RelativePositionedBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DF437011B5209C00D986FF /* RelativePositionedBox.m */; };
 		96F5A4DE11A8185800707404 /* TextButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F5A4DD11A8185800707404 /* TextButtonCell.m */; };
 		96F5A4FA11A81B5B00707404 /* DiffTextButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F5A4F911A81B5B00707404 /* DiffTextButtonCell.m */; };
 		96F5A70D11A879F100707404 /* LabelTextButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F5A70C11A879F100707404 /* LabelTextButtonCell.m */; };
 		96DD29CC112AE56D00A57BD3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/CollapseSheet.xib; sourceTree = SOURCE_ROOT; };
 		96DF426311B48DC700D986FF /* RadialGradiantBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadialGradiantBox.h; sourceTree = "<group>"; };
 		96DF426411B48DC700D986FF /* RadialGradiantBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RadialGradiantBox.m; sourceTree = "<group>"; };
+		96DF436F11B5209C00D986FF /* RelativePositionedBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RelativePositionedBox.h; sourceTree = "<group>"; };
+		96DF437011B5209C00D986FF /* RelativePositionedBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RelativePositionedBox.m; sourceTree = "<group>"; };
 		96F5A4DC11A8185800707404 /* TextButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextButtonCell.h; sourceTree = "<group>"; };
 		96F5A4DD11A8185800707404 /* TextButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextButtonCell.m; sourceTree = "<group>"; };
 		96F5A4F811A81B5B00707404 /* DiffTextButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiffTextButtonCell.h; sourceTree = "<group>"; };
 		9672AC50114B796A00312CE2 /* UtilityClasses */ = {
 			isa = PBXGroup;
 			children = (
-				96DF426211B48DC700D986FF /* RadialGradiantBox */,
-				9606EE15115670FD00968DE8 /* Help Button */,
 				9672ADCA114BD22A00312CE2 /* CommandKeyTextField */,
 				9672AC51114B796A00312CE2 /* ConnectionValidation */,
 				9672AC54114B796A00312CE2 /* DsiclosureBoxController */,
+				9606EE15115670FD00968DE8 /* Help Button */,
 				9672AC57114B796A00312CE2 /* OptionController */,
+				96DF426211B48DC700D986FF /* RadialGradiantBox */,
+				96DF436E11B5209C00D986FF /* RelativePositionedBox */,
 				9672AC5A114B796A00312CE2 /* ResultsWindow */,
 				9672AC5D114B796A00312CE2 /* SingleTimedQueue */,
 				9637C8B0118E9BB40000C14B /* ScrollToForLogTable */,
 			path = RadialGradiantBox;
 			sourceTree = "<group>";
 		};
+		96DF436E11B5209C00D986FF /* RelativePositionedBox */ = {
+			isa = PBXGroup;
+			children = (
+				96DF436F11B5209C00D986FF /* RelativePositionedBox.h */,
+				96DF437011B5209C00D986FF /* RelativePositionedBox.m */,
+			);
+			path = RelativePositionedBox;
+			sourceTree = "<group>";
+		};
 		96F5A4DB11A8185800707404 /* TextButtonCell */ = {
 			isa = PBXGroup;
 			children = (
 				96F5A4FA11A81B5B00707404 /* DiffTextButtonCell.m in Sources */,
 				96F5A70D11A879F100707404 /* LabelTextButtonCell.m in Sources */,
 				96DF426511B48DC700D986FF /* RadialGradiantBox.m in Sources */,
+				96DF437111B5209C00D986FF /* RelativePositionedBox.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};