forked from gnachman/iTerm2
/
iTermApplicationDelegate.h
217 lines (173 loc) · 6.99 KB
/
iTermApplicationDelegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
// -*- mode:objc -*-
// $Id: iTermApplicationDelegate.h,v 1.21 2006-11-21 19:24:29 yfabian Exp $
/*
** iTermApplicationDelegate.h
**
** Copyright (c) 2002, 2003
**
** Author: Fabian, Ujwal S. Setlur
** Initial code by Kiichi Kusama
**
** Project: iTerm
**
** Description: Implements the main application delegate and handles the addressbook functions.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
// I use a variadic macro here because of an apparent compiler bug in XCode 4.2 that thinks a
// variadaic objc call as an argument is not a single value.
#define DebugLog(args...) DebugLogImpl(__FILE__, __LINE__, __FUNCTION__, args)
//#define GENERAL_VERBOSE_LOGGING
#ifdef GENERAL_VERBOSE_LOGGING
#define DLog NSLog
#else
#define DLog(args...) \
do { \
if (gDebugLogging) { \
DebugLogImpl(__FILE__, __LINE__, __FUNCTION__, [NSString stringWithFormat:args]); \
} \
} while (0)
#endif
@class PseudoTerminal;
extern BOOL gDebugLogging;
extern NSString *kUseBackgroundPatternIndicatorChangedNotification;
int DebugLogImpl(const char *file, int line, const char *function, NSString* value);
@interface iTermAboutWindow : NSPanel
{
}
- (IBAction)closeCurrentSession:(id)sender;
@end
@interface iTermApplicationDelegate : NSObject
{
// about window
NSWindowController *aboutController;
IBOutlet id ABOUT;
IBOutlet NSTextView *AUTHORS;
// Menu items
IBOutlet NSMenu *bookmarkMenu;
IBOutlet NSMenu *toolbeltMenu;
IBOutlet NSMenuItem *showToolbeltItem;
IBOutlet NSMenuItem *selectTab;
IBOutlet NSMenuItem *previousTerminal;
IBOutlet NSMenuItem *nextTerminal;
IBOutlet NSMenuItem *logStart;
IBOutlet NSMenuItem *logStop;
IBOutlet NSMenuItem *closeTab;
IBOutlet NSMenuItem *closeWindow;
IBOutlet NSMenuItem *sendInputToAllSessions;
IBOutlet NSMenuItem *sendInputToAllPanes;
IBOutlet NSMenuItem *sendInputNormally;
IBOutlet NSMenuItem *toggleBookmarksView;
IBOutlet NSMenuItem *irNext;
IBOutlet NSMenuItem *irPrev;
IBOutlet NSMenuItem *windowArrangements_;
IBOutlet NSMenuItem *secureInput;
IBOutlet NSMenuItem *showFullScreenTabs;
IBOutlet NSMenuItem *useTransparency;
IBOutlet NSMenuItem *maximizePane;
BOOL secureInputDesired_;
BOOL quittingBecauseLastWindowClosed_;
// If set, skip performing launch actions.
BOOL quiet_;
NSDate* launchTime_;
// Cross app request forgery prevention token. Get this with applescript and then include
// in a URI request.
NSString *token_;
// Set to YES when applicationDidFinishLaunching: is called.
BOOL finishedLaunching_;
BOOL userHasInteractedWithAnySession_; // Disables min 10-second running time
}
- (void)awakeFromNib;
// NSApplication Delegate methods
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification;
- (BOOL)applicationShouldTerminate: (NSNotification *) theNotification;
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
- (BOOL)applicationOpenUntitledFile:(NSApplication *)app;
- (NSMenu *)applicationDockMenu:(NSApplication *)sender;
- (NSMenu*)bookmarksMenu;
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app;
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;
- (void)applicationDidBecomeActive:(NSNotification *)aNotification;
- (void)applicationDidResignActive:(NSNotification *)aNotification;
- (IBAction)toggleToolbelt:(id)sender;
- (IBAction)toggleFullScreenTabBar:(id)sender;
- (IBAction)maximizePane:(id)sender;
- (IBAction)toggleUseTransparency:(id)sender;
- (IBAction)toggleSecureInput:(id)sender;
- (IBAction)newWindow:(id)sender;
- (IBAction)newSessionWithSameProfile:(id)sender;
- (IBAction)newSession:(id)sender;
- (IBAction)buildScriptMenu:(id)sender;
- (IBAction)debugLogging:(id)sender;
- (IBAction)toggleSecureInput:(id)sender;
- (void)updateMaximizePaneMenuItem;
- (void)updateUseTransparencyMenuItem;
// About window
- (IBAction)showAbout:(id)sender;
- (IBAction)makeDefaultTerminal:(id)sender;
- (IBAction)unmakeDefaultTerminal:(id)sender;
- (IBAction)saveWindowArrangement:(id)sender;
- (IBAction)loadWindowArrangement:(id)sender;
- (IBAction)showPrefWindow:(id)sender;
- (IBAction)showBookmarkWindow:(id)sender;
- (IBAction)instantReplayPrev:(id)sender;
- (IBAction)instantReplayNext:(id)sender;
// navigation
- (IBAction)previousTerminal: (id) sender;
- (IBAction)nextTerminal: (id) sender;
- (IBAction)arrangeHorizontally:(id)sender;
// Notifications
- (void) reloadMenus: (NSNotification *) aNotification;
- (void) buildSessionSubmenu: (NSNotification *) aNotification;
- (void) reloadSessionMenus: (NSNotification *) aNotification;
- (void) nonTerminalWindowBecameKey: (NSNotification *) aNotification;
// font control
- (IBAction) biggerFont: (id) sender;
- (IBAction) smallerFont: (id) sender;
// size
- (IBAction)returnToDefaultSize:(id)sender;
- (IBAction)exposeForTabs:(id)sender;
- (IBAction)editCurrentSession:(id)sender;
- (IBAction)toggleUseBackgroundPatternIndicator:(id)sender;
- (BOOL)useBackgroundPatternIndicator;
- (void)makeHotKeyWindowKeyIfOpen;
// Implements the 10.6 api but is callable in 10.5 and tries to implement
// some subset of the flags.
- (void)setFutureApplicationPresentationOptions:(int)flags unset:(int)antiflags;
- (void)updateBroadcastMenuState;
- (BOOL)showToolbelt;
// Call this when the user has any nontrivial interaction with a session, such as typing in it or closing a window.
- (void)userDidInteractWithASession;
@end
// Scripting support
@interface iTermApplicationDelegate (KeyValueCoding)
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key;
- (PseudoTerminal *)currentTerminal;
- (NSString *)uriToken;
// accessors for to-many relationships:
-(NSArray*)terminals;
-(void)setTerminals: (NSArray*)terminals;
- (void) setCurrentTerminal: (PseudoTerminal *) aTerminal;
-(id)valueInTerminalsAtIndex:(unsigned)index;
-(void)replaceInTerminals:(PseudoTerminal *)object atIndex:(unsigned)index;
- (void) addInTerminals: (PseudoTerminal *) object;
- (void) insertInTerminals: (PseudoTerminal *) object;
-(void)insertInTerminals:(PseudoTerminal *)object atIndex:(unsigned)index;
-(void)removeFromTerminalsAtIndex:(unsigned)index;
// a class method to provide the keys for KVC:
+(NSArray*)kvcKeys;
@end