Commits

Jason Harris  committed cbead80

- Fix #issue 311 part 1 by making the maximized / minimized state of a document window
persistent.

  • Participants
  • Parent commits 2a85427

Comments (0)

Files changed (3)

File Classes/FilesView/FilesViewController.h

 
 @interface StatusSidebarSplitView : NSSplitView <NSSplitViewDelegate, NSAnimationDelegate>
 {
+	IBOutlet FilesView*		parentView;
 	IBOutlet NSView*		theContent;
 	IBOutlet NSView*		theSidebar;
 

File Classes/FilesView/FilesViewController.m

 
 @implementation StatusSidebarSplitView
 
+- (NSString*) isMinimizedAutoSaveName { return fstr(@"File:%@:StatusSidebarIsMinimized", [[parentView myDocument] documentNameForAutosave]); }
+
 - (void) awakeFromNib
 {
 	[self setDelegate:self];
 	[viewAnimation setAnimationCurve:NSAnimationEaseInOut];
 	[viewAnimation setDelegate:self];
 	
-	[self maximize:self];
+	BOOL shouldBeMinimized = [[NSUserDefaults standardUserDefaults] boolForKey:[self isMinimizedAutoSaveName]];
+	if (shouldBeMinimized)
+		[self minimize:self];
+	else
+		[self maximize:self];
 }
 
 - (CGFloat) targetDividerPosition					{ return self.frame.size.width - (minimized ? collapsedWidth : expandedWidth); }
 
 - (IBAction) maximize:(id)sender
 {
+	[[NSUserDefaults standardUserDefaults] setBool:NO  forKey:[self isMinimizedAutoSaveName]];
 	if (!minimized)
 		return;
 
 
 - (IBAction) minimize:(id)sender
 {
+	[[NSUserDefaults standardUserDefaults] setBool:YES  forKey:[self isMinimizedAutoSaveName]];
 	if (minimized)
 		return;
 

File English.lproj/FilesView.xib

       <string key="com.apple.WebKitIBPlugin">851</string>
     </dictionary>
     <array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+      <integer value="316"/>
+      <integer value="230"/>
+      <integer value="419"/>
+      <integer value="190"/>
+      <integer value="184"/>
       <integer value="201"/>
-      <integer value="419"/>
-      <integer value="184"/>
-      <integer value="316"/>
-      <integer value="190"/>
-      <integer value="230"/>
     </array>
     <array key="IBDocument.PluginDependencies">
       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           </object>
           <int key="connectionID">541</int>
         </object>
+        <object class="IBConnectionRecord">
+          <object class="IBOutletConnection" key="connection">
+            <string key="label">parentView</string>
+            <reference key="source" ref="460990162"/>
+            <reference key="destination" ref="453712496"/>
+          </object>
+          <int key="connectionID">542</int>
+        </object>
       </array>
       <object class="IBMutableOrderedSet" key="objectRecords">
         <array key="orderedObjects">
       <nil key="activeLocalization"/>
       <dictionary class="NSMutableDictionary" key="localizations"/>
       <nil key="sourceID"/>
-      <int key="maxID">541</int>
+      <int key="maxID">542</int>
     </object>
     <object class="IBClassDescriber" key="IBDocument.Classes">
       <array class="NSMutableArray" key="referencedPartialClassDescriptions">
           <dictionary class="NSMutableDictionary" key="outlets">
             <string key="dividerStatusBox">NSBox</string>
             <string key="expandedStatusSidebarGroup">NSView</string>
+            <string key="parentView">FilesView</string>
             <string key="statusSidebarContent">NSBox</string>
             <string key="theContent">NSView</string>
             <string key="theSidebar">NSView</string>
               <string key="name">expandedStatusSidebarGroup</string>
               <string key="candidateClassName">NSView</string>
             </object>
+            <object class="IBToOneOutletInfo" key="parentView">
+              <string key="name">parentView</string>
+              <string key="candidateClassName">FilesView</string>
+            </object>
             <object class="IBToOneOutletInfo" key="statusSidebarContent">
               <string key="name">statusSidebarContent</string>
               <string key="candidateClassName">NSBox</string>