From fcf886321fa25e7aebd0267e5733bc3e0a2c06f3 Mon Sep 17 00:00:00 2001 From: vspader Date: Sun, 22 Feb 2009 11:56:28 -0800 Subject: [PATCH] Mini window will now reopen on launch if it. --- Application/AppController.m | 3 --- Application/DualWindow.h | 3 ++- Application/DualWindow.m | 16 ++++++++++++--- Application/MainWindow.h | 16 +++++++++++++++ Application/MainWindow.m | 38 +++++++++++++++++++++++++++++++++++ Cog.xcodeproj/project.pbxproj | 6 ++++++ English.lproj/MainMenu.xib | 16 +++++++++++---- 7 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 Application/MainWindow.h create mode 100644 Application/MainWindow.m diff --git a/Application/AppController.m b/Application/AppController.m index b3fe7391f..c46cd3a70 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -229,9 +229,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ - (void)awakeFromNib { - [mainWindow setExcludedFromWindowsMenu:YES]; - [mainWindow setContentBorderThickness:24.0 forEdge:NSMinYEdge]; - [[totalTimeField cell] setBackgroundStyle:NSBackgroundStyleRaised]; [[playbackButtons cell] setToolTip:NSLocalizedString(@"PlayButtonTooltip", @"") forSegment: 1]; diff --git a/Application/DualWindow.h b/Application/DualWindow.h index 48e32e4f7..de291f362 100644 --- a/Application/DualWindow.h +++ b/Application/DualWindow.h @@ -13,8 +13,9 @@ IBOutlet DualWindow *otherWindow; } -- (void)showWindow; +- (void)show; +- (NSString *)hiddenDefaultsKey; - (BOOL)isHidden; - (void)setHidden:(BOOL)h; diff --git a/Application/DualWindow.m b/Application/DualWindow.m index a61584221..23ca3aad9 100644 --- a/Application/DualWindow.m +++ b/Application/DualWindow.m @@ -21,11 +21,19 @@ return self; } +- (void)awakeFromNib +{ + if (![self isHidden]) + { + [self show]; + } +} + - (NSString *)hiddenDefaultsKey { if ([self frameAutosaveName]) { - return [[self frameAutosaveName] stringByAppendingString:@" Window Content Height"]; + return [[self frameAutosaveName] stringByAppendingString:@" Window Hidden"]; } return nil; @@ -43,11 +51,13 @@ - (void)toggleToolbarShown:(id)sender { - [otherWindow showWindow]; + [otherWindow show]; } -- (void)showWindow +- (void)show { + [self setHidden:NO]; + [otherWindow setHidden:YES]; [otherWindow close]; [self makeKeyAndOrderFront:self]; } diff --git a/Application/MainWindow.h b/Application/MainWindow.h new file mode 100644 index 000000000..d5e94c28f --- /dev/null +++ b/Application/MainWindow.h @@ -0,0 +1,16 @@ +// +// MainWindow.h +// Cog +// +// Created by Vincent Spader on 2/22/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import +#import "DualWindow.h" + +@interface MainWindow : DualWindow { + +} + +@end diff --git a/Application/MainWindow.m b/Application/MainWindow.m new file mode 100644 index 000000000..ebb16f8c6 --- /dev/null +++ b/Application/MainWindow.m @@ -0,0 +1,38 @@ +// +// MainWindow.m +// Cog +// +// Created by Vincent Spader on 2/22/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "MainWindow.h" + + +@implementation MainWindow + +- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation +{ + self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation]; + if (self) + { + [self setExcludedFromWindowsMenu:YES]; + [self setContentBorderThickness:24.0 forEdge:NSMinYEdge]; + } + + return self; +} + +- (void)awakeFromNib +{ + if ([self hiddenDefaultsKey]) { + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:[self hiddenDefaultsKey]]]; + } + + [super awakeFromNib]; +} + + + + +@end diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index ef6b1595a..9cb22ee3d 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -71,6 +71,7 @@ 1791005F0CB44D6D0070BC5C /* Cog.scriptTerminology in Resources */ = {isa = PBXBuildFile; fileRef = 1791005D0CB44D6D0070BC5C /* Cog.scriptTerminology */; }; 1791FF900CB43A2C0070BC5C /* MediaKeysApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1791FF8E0CB43A2C0070BC5C /* MediaKeysApplication.m */; }; 179571590F51DF4100E4168D /* MiniWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 179571580F51DF4100E4168D /* MiniWindow.m */; }; + 179571730F51E21400E4168D /* MainWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 179571720F51E21400E4168D /* MainWindow.m */; }; 179790E10C087AB7001D6996 /* OpenURLPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 179790DF0C087AB7001D6996 /* OpenURLPanel.m */; }; 179D02EE0E0CB0B00064A77A /* SideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D02EB0E0CB0B00064A77A /* SideView.m */; }; 179D02EF0E0CB0B00064A77A /* SideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D02ED0E0CB0B00064A77A /* SideViewController.m */; }; @@ -598,6 +599,8 @@ 1791FF8E0CB43A2C0070BC5C /* MediaKeysApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MediaKeysApplication.m; sourceTree = ""; }; 179571570F51DF4100E4168D /* MiniWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MiniWindow.h; sourceTree = ""; }; 179571580F51DF4100E4168D /* MiniWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MiniWindow.m; sourceTree = ""; }; + 179571710F51E21400E4168D /* MainWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainWindow.h; sourceTree = ""; }; + 179571720F51E21400E4168D /* MainWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainWindow.m; sourceTree = ""; }; 179790DE0C087AB7001D6996 /* OpenURLPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenURLPanel.h; sourceTree = ""; }; 179790DF0C087AB7001D6996 /* OpenURLPanel.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OpenURLPanel.m; sourceTree = ""; }; 179D02EA0E0CB0B00064A77A /* SideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SideView.h; path = SideView/SideView.h; sourceTree = ""; }; @@ -835,6 +838,8 @@ 17BBE5BB0CD95CFA00258F7A /* DualWindow.m */, 179571570F51DF4100E4168D /* MiniWindow.h */, 179571580F51DF4100E4168D /* MiniWindow.m */, + 179571710F51E21400E4168D /* MainWindow.h */, + 179571720F51E21400E4168D /* MainWindow.m */, ); path = Application; sourceTree = ""; @@ -1826,6 +1831,7 @@ 173A43B80F3FD3B200676A7B /* VolumeButton.m in Sources */, 1752C6B00F3FE3CC00FC3235 /* VolumeSlider.m in Sources */, 179571590F51DF4100E4168D /* MiniWindow.m in Sources */, + 179571730F51E21400E4168D /* MainWindow.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 40121870c..004541c94 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -8,9 +8,9 @@ 353.00 YES - + YES @@ -42,7 +42,7 @@ {{1051, 196}, {691, 397}} 1618479104 Cog - DualWindow + MainWindow B4998081-90DD-45DD-8243-0F7039C7DEA2 @@ -9982,7 +9982,7 @@ OQA {{218, 54}, {691, 397}} {{218, 54}, {691, 397}} - + {{25, 14}, {683, 396}} {3.40282e+38, 3.40282e+38} @@ -10033,7 +10033,7 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin {{398, 631}, {481, 0}} {{398, 631}, {481, 0}} - + {10000, 100000} com.apple.InterfaceBuilder.CocoaPlugin @@ -10525,6 +10525,14 @@ OQA + + MainWindow + DualWindow + + IBProjectSource + Application/MainWindow.h + + MiniWindow DualWindow