Skip to content

Commit

Permalink
Fixes #304
Browse files Browse the repository at this point in the history
  • Loading branch information
emsquared committed Aug 1, 2012
1 parent dc0a8d8 commit 3898858
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
23 changes: 19 additions & 4 deletions Classes/Controllers/TXMasterController.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (void)awakeFromNib
self.viewTheme = [TPCViewTheme new];
self.viewTheme.name = [TPCPreferences themeName];

[self loadWindowState];
[self loadWindowState:YES];

[self.window setAlphaValue:[TPCPreferences themeTransparency]];

Expand Down Expand Up @@ -397,7 +397,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *)notification

- (void)windowDidExitFullScreen:(NSNotification *)notification
{
[self loadWindowState];
[self loadWindowState:NO];

self.menu.isInFullScreenMode = NO;
}
Expand Down Expand Up @@ -554,6 +554,11 @@ - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
}

- (void)loadWindowState
{
[self loadWindowState:NO];
}

- (void)loadWindowState:(BOOL)honorFullscreen
{
NSDictionary *dic = [TPCPreferences loadWindowStateWithName:@"Window -> Main Window"];

Expand All @@ -562,6 +567,8 @@ - (void)loadWindowState
NSInteger y = [dic integerForKey:@"y"];
NSInteger w = [dic integerForKey:@"w"];
NSInteger h = [dic integerForKey:@"h"];

BOOL fullscreen = [dic boolForKey:@"fullscreen"];

[self.window setFrame:NSMakeRect(x, y, w, h) display:YES animate:self.menu.isInFullScreenMode];

Expand All @@ -579,6 +586,10 @@ - (void)loadWindowState
if (self.memberSplitView.position < _minimumSplitViewWidth) {
self.memberSplitView.position = _defaultSplitViewWidth;
}

if (fullscreen && honorFullscreen) {
[self.menu performSelector:@selector(toggleFullscreenMode:) withObject:nil afterDelay:2.0];
}
} else {
NSScreen *screen = [NSScreen mainScreen];

Expand Down Expand Up @@ -606,8 +617,10 @@ - (void)loadWindowState
- (void)saveWindowState
{
NSMutableDictionary *dic = [NSMutableDictionary dictionary];

if (self.menu.isInFullScreenMode) {

BOOL fullscreen = self.menu.isInFullScreenMode;

if (fullscreen) {
[self.menu toggleFullscreenMode:nil];
}

Expand All @@ -632,6 +645,8 @@ - (void)saveWindowState

[dic setInteger:self.serverSplitView.position forKey:@"serverList"];
[dic setInteger:self.memberSplitView.position forKey:@"memberList"];

[dic setBool:fullscreen forKey:@"fullscreen"];

[_NSUserDefaults() setBool:[self.text isGrammarCheckingEnabled] forKey:@"TextFieldAutomaticGrammarCheck"];
[_NSUserDefaults() setBool:[self.text isContinuousSpellCheckingEnabled] forKey:@"TextFieldAutomaticSpellCheck"];
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controllers/TXMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ - (void)toggleFullscreenMode:(id)sender
if (self.isInFullScreenMode) {
[self.window toggleFullScreen:sender];

[self.master loadWindowState];
[self.master loadWindowState:NO];
} else {
[self.master saveWindowState];

Expand Down Expand Up @@ -1721,7 +1721,7 @@ - (void)toggleFullscreenMode:(id)sender
[[self.window standardWindowButton:NSWindowMiniaturizeButton] setHidden:NO];

[self.window setShowsResizeIndicator:YES];
[self.master loadWindowState];
[self.master loadWindowState:NO];

[NSApp setPresentationOptions:NSApplicationPresentationDefault];
}
Expand Down
4 changes: 3 additions & 1 deletion Classes/Headers/TXMasterController.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
@property (nonatomic, strong) TLONickCompletionStatus *completionStatus;
@property (nonatomic, assign) NSInteger memberSplitViewOldPosition;

- (void)loadWindowState;

- (void)loadWindowState TEXTUAL_DEPRECATED;
- (void)loadWindowState:(BOOL)honorFullscreen;
- (void)saveWindowState;
- (void)showMemberListSplitView:(BOOL)showList;

Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<key>TXBundleBuildCodeName</key>
<string>Turtle Soup</string>
<key>TXBundleBuildNumber</key>
<string>12175</string>
<string>12187</string>
<key>TXBundleBuildReference</key>
<string>2.1.1-269-g942f7ff-debug</string>
<string>2.1.1-270-gdc0a8d8-appstore</string>
</dict>
</plist>

0 comments on commit 3898858

Please sign in to comment.