From 9fc507268a5158ae0045b753a288f2df6500e0c5 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 22 Jan 2011 23:45:03 +0000 Subject: - Manually restore autosave value for bundle editor splitview width, as this doesn't appear to be restored automatically - Remove unused delegate methods --- Source/SPBundleEditorController.h | 4 ++-- Source/SPBundleEditorController.m | 33 +++++++++++---------------------- 2 files changed, 13 insertions(+), 24 deletions(-) (limited to 'Source') diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h index d8c2d5df..1c3c0dab 100644 --- a/Source/SPBundleEditorController.h +++ b/Source/SPBundleEditorController.h @@ -27,7 +27,7 @@ #import "SPBundleCommandTextView.h" #import "SPOutlineView.h" -@class SRRecorderControl, BWAnchoredButtonBar; +@class SRRecorderControl, BWSplitView; @interface SPBundleEditorController : NSWindowController { @@ -63,7 +63,7 @@ IBOutlet NSButton *disabledCheckbox; IBOutlet NSScrollView *commandScrollView; IBOutlet NSScrollView *descriptionScrollView; - IBOutlet BWAnchoredButtonBar *splitViewButtonBar; + IBOutlet BWSplitView *splitView; IBOutlet id undeleteSheet; IBOutlet NSTableView *undeleteTableView; diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index a4a9a36b..279002f4 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -38,6 +38,8 @@ #define SP_BUNDLEEDITOR_SCOPE_GENERAL_STRING NSLocalizedString(@"General", @"Bundle Editor : Scope dropdown : 'general' item") #define SP_BUNDLEEDITOR_OUTLINE_BUNDLE_TOOLTIP_STRING NSLocalizedString(@"“%@” Bundle",@"Bundle Editor : Outline View : Bundle item : tooltip") +#define SP_BUNDLEEDITOR_SPLITVIEW_AUTOSAVE_STRING @"SPBundleEditorSplitView" + @interface SPBundleEditorController (PrivateAPI) - (void)_updateBundleDataView; @@ -116,6 +118,15 @@ - (void)awakeFromNib { + // Set up the splitview width manually; autosave appears to save but not restore this value + // here, so restore in code if present. + NSString *splitViewKeyName = [NSString stringWithFormat:@"NSSplitView Subview Frames %@", SP_BUNDLEEDITOR_SPLITVIEW_AUTOSAVE_STRING]; + if ([[NSUserDefaults standardUserDefaults] arrayForKey:splitViewKeyName]) { + NSString *detailString = [[[NSUserDefaults standardUserDefaults] arrayForKey:splitViewKeyName] objectAtIndex:0]; + float dividerPosition = [[[detailString componentsSeparatedByString:@", "] objectAtIndex:2] floatValue]; + [splitView setPosition:dividerPosition ofDividerAtIndex:0]; + } + // Init all needed variables; popup menus (with the chance for localization); and set // defaults @@ -363,9 +374,6 @@ [deletedDefaultBundles setArray:[[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey]]; } - // Set the button bar delegate - [splitViewButtonBar setSplitViewDelegate:self]; - [self _initTree]; } @@ -1190,25 +1198,6 @@ } -#pragma mark - -#pragma mark SplitView delegate methods - -/** - * Return the maximum possible size of the splitview. - */ -- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset -{ - return (proposedMax - 240); -} - -/** - * Return the minimum possible size of the splitview. - */ -- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset -{ - return (proposedMin + 120); -} - #pragma mark - #pragma mark TableView delegates -- cgit v1.2.3