3 * Copyright (c) 2007 - 2011, Blue Static <http://www.bluestatic.org>
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #import "AppDelegate.h"
19 #import <Sparkle/Sparkle.h>
21 @implementation AppDelegate
24 @synthesize breakpoint
;
25 @synthesize loggingController
= loggingController_
;
28 * Initialize method that is called before all other messages. This will set the default
34 NSDictionary
* defaults
= @
{
36 @
"BreakpointsWindowVisible" : @YES,
37 @
"InspectorWindowVisible" : @YES,
38 @
"PathReplacements" : [NSMutableArray array
],
39 @
"BreakOnFirstLine" : @YES,
40 @
"DebuggerAttached" : @YES
42 [[NSUserDefaults standardUserDefaults
] registerDefaults
:defaults
];
46 + (AppDelegate
*)instance
48 return (AppDelegate
*)[NSApp delegate
];
51 - (void)applicationDidFinishLaunching
:(NSNotification
*)notification
53 // Record whether this user ever used the beta VersionCast feed. In the
54 // future, we will use this bit to query for unstable releases after the user
55 // has upgraded to a stable version.
56 NSString
* const kUsesUnstableVersionCast
= @
"UnstableVersionCast";
57 NSUserDefaults
* defaults
= [NSUserDefaults standardUserDefaults
];
59 BOOL usesUnstable
= [defaults boolForKey
:kUsesUnstableVersionCast
];
60 NSURL
* feedURL
= [[SUUpdater sharedUpdater
] feedURL
];
61 usesUnstable
= usesUnstable ||
62 [[feedURL absoluteString
] rangeOfString
:@
"?unstable"].location
!= NSNotFound
;
63 [defaults setBool
:usesUnstable forKey
:kUsesUnstableVersionCast
];
66 - (void)applicationWillTerminate
:(NSNotification
*)notification
68 [[NSUserDefaults standardUserDefaults
] setBool
:self.debugger.connection.autoAttach
69 forKey
:@
"DebuggerAttached"];
73 * Shows the debugger window
75 - (IBAction
)showDebuggerWindow
:(id)sender
77 [[debugger window
] makeKeyAndOrderFront
:self];
81 * Shows the breakpoints window
83 - (IBAction
)showBreakpointWindow
:(id)sender
85 if (![[breakpoint window
] isVisible
] ||
![[breakpoint window
] isKeyWindow
])
86 [[breakpoint window
] makeKeyAndOrderFront
:sender
];
88 [[breakpoint window
] orderOut
:sender
];
92 * Shows the preferences window. Lazily loads the PreferencesController.
94 - (IBAction
)showPreferences
:(id)sender
97 prefs
= [[PreferencesController alloc
] init
];
99 [prefs showPreferencesWindow
];
103 * Opens the URL to the help page
105 - (IBAction
)openHelpPage
:(id)sender
107 [[NSWorkspace sharedWorkspace
] openURL
:[NSURL URLWithString
:@
"https://www.bluestatic.org/software/macgdbp/help.php"]];