TextMate is a graphical text editor for OS X 10.7+
Revision | 9d17d74b1bdb0f87b46644f9fda91a14d1ed02b5 (tree) |
---|---|
Time | 2012-08-22 22:48:34 |
Author | Gerd Knops <gerti@bita...> |
Commiter | Allan Odgaard |
File Browser will now remember it's width
This closes issue #5.
@@ -359,6 +359,12 @@ NSString* const kUserDefaultsFileBrowserPlacementKey = @"fileBrowserPlacement"; | ||
359 | 359 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActiveNotification:) name:NSApplicationDidResignActiveNotification object:NSApp]; |
360 | 360 | } |
361 | 361 | |
362 | ++ (void)initialize | |
363 | +{ | |
364 | + if(self == [DocumentController class]) | |
365 | + [[NSUserDefaults standardUserDefaults] registerDefaults:@{ kUserDefaultsFileBrowserWidthKey : @250 }]; | |
366 | +} | |
367 | + | |
362 | 368 | + (void)applicationDidBecomeActiveNotification:(NSNotification*)aNotification |
363 | 369 | { |
364 | 370 | for(NSWindow* window in [NSApp orderedWindows]) |
@@ -1408,7 +1414,7 @@ static std::string file_chooser_glob (std::string const& path) | ||
1408 | 1414 | |
1409 | 1415 | fileBrowser = [OakFileBrowser new]; |
1410 | 1416 | fileBrowser.delegate = self; |
1411 | - [fileBrowser setupViewWithSize:NSMakeSize(fileBrowserWidth ?: 250, 100) resizeIndicatorOnRight:!placeOnRight state:fileBrowserState]; | |
1417 | + [fileBrowser setupViewWithSize:NSMakeSize(fileBrowserWidth ?: [[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsFileBrowserWidthKey], 100) resizeIndicatorOnRight:!placeOnRight state:fileBrowserState]; | |
1412 | 1418 | [self updateFileBrowserStatus:self]; |
1413 | 1419 | } |
1414 | 1420 |
@@ -1,5 +1,7 @@ | ||
1 | 1 | #import <oak/debug.h> |
2 | 2 | |
3 | +PUBLIC extern NSString* const kUserDefaultsFileBrowserWidthKey; | |
4 | + | |
3 | 5 | @class OakFileBrowser; |
4 | 6 | @class OakFileBrowserView; |
5 | 7 | @class OakHistoryController; |
@@ -30,6 +30,8 @@ | ||
30 | 30 | #import <text/ctype.h> |
31 | 31 | #import <regexp/format_string.h> |
32 | 32 | |
33 | +NSString* const kUserDefaultsFileBrowserWidthKey = @"fileBrowserWidth"; | |
34 | + | |
33 | 35 | OAK_DEBUG_VAR(FileBrowser_Controller); |
34 | 36 | |
35 | 37 | @interface OakFileBrowser () |
@@ -4,6 +4,7 @@ | ||
4 | 4 | #import <OakAppKit/NSImage Additions.h> |
5 | 5 | #import <OakAppKit/OakStatusBar.h> |
6 | 6 | #import <OakAppKit/OakFileIconImage.h> |
7 | +#import <OakFileBrowser/OakFileBrowser.h> | |
7 | 8 | |
8 | 9 | @interface OakFileBrowserView () |
9 | 10 | - (void)setupViews; |
@@ -94,6 +95,8 @@ OAK_DEBUG_VAR(FileBrowser_View); | ||
94 | 95 | { |
95 | 96 | headerView.frame = NSMakeRect(0, NSHeight(self.frame) - OakStatusBarHeight, NSWidth(self.frame), OakStatusBarHeight); |
96 | 97 | outlineView.enclosingScrollView.frame = NSMakeRect(0, 0, NSWidth(self.frame), NSHeight(self.frame) - NSHeight(headerView.frame)); |
98 | + | |
99 | + [[NSUserDefaults standardUserDefaults] setInteger:NSWidth(self.frame) forKey:kUserDefaultsFileBrowserWidthKey]; | |
97 | 100 | } |
98 | 101 | |
99 | 102 | - (BOOL)isOpaque |