• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

TextMate is a graphical text editor for OS X 10.7+


Commit MetaInfo

Revision9d17d74b1bdb0f87b46644f9fda91a14d1ed02b5 (tree)
Time2012-08-22 22:48:34
AuthorGerd Knops <gerti@bita...>
CommiterAllan Odgaard

Log Message

File Browser will now remember it's width

This closes issue #5.

Change Summary

Incremental Difference

--- a/Frameworks/DocumentWindow/src/DocumentController.mm
+++ b/Frameworks/DocumentWindow/src/DocumentController.mm
@@ -359,6 +359,12 @@ NSString* const kUserDefaultsFileBrowserPlacementKey = @"fileBrowserPlacement";
359359 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActiveNotification:) name:NSApplicationDidResignActiveNotification object:NSApp];
360360 }
361361
362++ (void)initialize
363+{
364+ if(self == [DocumentController class])
365+ [[NSUserDefaults standardUserDefaults] registerDefaults:@{ kUserDefaultsFileBrowserWidthKey : @250 }];
366+}
367+
362368 + (void)applicationDidBecomeActiveNotification:(NSNotification*)aNotification
363369 {
364370 for(NSWindow* window in [NSApp orderedWindows])
@@ -1408,7 +1414,7 @@ static std::string file_chooser_glob (std::string const& path)
14081414
14091415 fileBrowser = [OakFileBrowser new];
14101416 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];
14121418 [self updateFileBrowserStatus:self];
14131419 }
14141420
--- a/Frameworks/OakFileBrowser/src/OakFileBrowser.h
+++ b/Frameworks/OakFileBrowser/src/OakFileBrowser.h
@@ -1,5 +1,7 @@
11 #import <oak/debug.h>
22
3+PUBLIC extern NSString* const kUserDefaultsFileBrowserWidthKey;
4+
35 @class OakFileBrowser;
46 @class OakFileBrowserView;
57 @class OakHistoryController;
--- a/Frameworks/OakFileBrowser/src/OakFileBrowser.mm
+++ b/Frameworks/OakFileBrowser/src/OakFileBrowser.mm
@@ -30,6 +30,8 @@
3030 #import <text/ctype.h>
3131 #import <regexp/format_string.h>
3232
33+NSString* const kUserDefaultsFileBrowserWidthKey = @"fileBrowserWidth";
34+
3335 OAK_DEBUG_VAR(FileBrowser_Controller);
3436
3537 @interface OakFileBrowser ()
--- a/Frameworks/OakFileBrowser/src/ui/OakFileBrowserView.mm
+++ b/Frameworks/OakFileBrowser/src/ui/OakFileBrowserView.mm
@@ -4,6 +4,7 @@
44 #import <OakAppKit/NSImage Additions.h>
55 #import <OakAppKit/OakStatusBar.h>
66 #import <OakAppKit/OakFileIconImage.h>
7+#import <OakFileBrowser/OakFileBrowser.h>
78
89 @interface OakFileBrowserView ()
910 - (void)setupViews;
@@ -94,6 +95,8 @@ OAK_DEBUG_VAR(FileBrowser_View);
9495 {
9596 headerView.frame = NSMakeRect(0, NSHeight(self.frame) - OakStatusBarHeight, NSWidth(self.frame), OakStatusBarHeight);
9697 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];
97100 }
98101
99102 - (BOOL)isOpaque