/
PseudoTerminal.h
executable file
·200 lines (169 loc) · 6.35 KB
/
PseudoTerminal.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
// -*- mode:objc -*-
// $Id: PseudoTerminal.h,v 1.40 2003-03-13 19:09:55 yfabian Exp $
/*
** PseudoTerminal.h
**
** Copyright (c) 2002, 2003
**
** Author: Fabian, Ujwal S. Sathyam
** Initial code by Kiichi Kusama
**
** Project: iTerm
**
** Description: Session and window controller for iTerm.
**
** 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 "PreferencePanel.h"
#import "MainMenu.h"
#import "PTYTask.h"
#import "PTYTextView.h"
#import "VT100Terminal.h"
#import "VT100Screen.h"
#import "PTYSession.h"
@interface PseudoTerminal : NSWindowController
{
/// MainMenu reference
MainMenu *MAINMENU;
/// Terminal Window
IBOutlet id TABVIEW;
IBOutlet id WINDOW;
// config window
IBOutlet id CONFIG_PANEL;
IBOutlet id CONFIG_COL;
IBOutlet id CONFIG_ROW;
IBOutlet id CONFIG_ENCODING;
IBOutlet id CONFIG_BACKGROUND;
IBOutlet id CONFIG_FOREGROUND;
IBOutlet id CONFIG_EXAMPLE;
IBOutlet id CONFIG_NAEXAMPLE;
IBOutlet id CONFIG_TRANSPARENCY;
IBOutlet id CONFIG_TRANS2;
IBOutlet id CONFIG_NAME;
IBOutlet id CONFIG_ANTIALIAS;
IBOutlet id CONFIG_SELECTION;
// anti-idle
IBOutlet id AI_CODE;
IBOutlet id AI_ON;
char ai_code;
// Session list
NSMutableArray *ptyList;
int currentSessionIndex;
PTYSession *currentPtySession;
NSLock *ptyListLock;
/////////////////////////////////////////////////////////////////////////
int WIDTH,HEIGHT;
NSFont *FONT, *NAFONT;
BOOL pending;
float alpha;
NSFont *configFont, *configNAFont;
BOOL changingNA;
BOOL newwin;
PreferencePanel *pref;
BOOL tabViewDragOperationInProgress;
}
+ (PseudoTerminal *)newTerminalWindow: sender;
- (void) newSession: (id) sender;
- (id)init;
- (void)dealloc;
- (void)releaseObjects;
- (void)initWindow:(int)width
height:(int)height
font:(NSFont *)font
nafont:(NSFont *)nafont;
- (void)initSession:(NSString *)title
foregroundColor:(NSColor *) fg
backgroundColor:(NSColor *) bg
selectionColor: (NSColor*) sc
encoding:(NSStringEncoding)encoding
term:(NSString *)term;
- (void) addSession: (PTYSession *)aSession;
- (void) switchSession: (id) sender;
- (void) selectSession: (int) sessionIndex;
- (void) closeSession: (PTYSession*) aSession;
- (IBAction) closeCurrentSession: (id) sender;
- (IBAction) previousSession:(id)sender;
- (IBAction) nextSession:(id)sender;
- (IBAction) saveSession:(id)sender;
- (PTYSession *) currentSession;
- (NSString *) currentSessionName;
- (void) setCurrentSessionName: (NSString *) theSessionName;
- (void)startProgram:(NSString *)program;
- (void)startProgram:(NSString *)program
arguments:(NSArray *)prog_argv;
- (void)startProgram:(NSString *)program
arguments:(NSArray *)prog_argv
environment:(NSDictionary *)prog_env;
- (void)setWindowSize: (BOOL) resizeContentFrames;
- (void)setWindowTitle;
- (void)setWindowTitle: (NSString *)title;
- (void)setAllFont:(NSFont *)font nafont:(NSFont *)nafont;
// MainMenu
- (void)setMainMenu:(id) sender;
- (void)clearBuffer:(id)sender;
- (IBAction)logStart:(id)sender;
- (IBAction)logStop:(id)sender;
- (BOOL)validateMenuItem:(NSMenuItem *)item;
// PTYTextView
- (void)changeFont:(NSFont *)font;
// NSWindow
- (void)windowDidDeminiaturize:(NSNotification *)aNotification;
- (BOOL)windowShouldClose:(NSNotification *)aNotification;
- (void)windowWillClose:(NSNotification *)aNotification;
- (void)windowDidBecomeKey:(NSNotification *)aNotification;
- (void)windowDidResignMain:(NSNotification *)aNotification;
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
- (void)windowDidResize:(NSNotification *)aNotification;
- (NSWindow *) window;
// Toolbar
- (NSToolbar*) setupToolbar;
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar;
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar;
- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar itemForItemIdentifier: (NSString *) itemIdent willBeInsertedIntoToolbar: (BOOL) willBeInserted;
// Contextual menu
- (void) menuForEvent:(NSEvent *)theEvent menu: (NSMenu *) theMenu;
// Close Window
- (BOOL)showCloseWindow;
// NSTabView
- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)tabView willRemoveTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)tabView willAddTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)tabView willInsertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(int) index;
- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView;
- (void)tabViewWillPerformDragOperation:(NSTabView *)tabView;
- (void)tabViewDidPerformDragOperation:(NSTabView *)tabView;
- (void)tabViewContextualMenu: (NSEvent *)theEvent menu: (NSMenu *)theMenu;
- (void) closeTabContextualMenuAction: (id) sender;
- (void) moveTabToNewWindowContextualMenuAction: (id) sender;
// Config Window
- (IBAction)windowConfigOk:(id)sender;
- (IBAction)windowConfigCancel:(id)sender;
- (IBAction)windowConfigFont:(id)sender;
- (IBAction)windowConfigNAFont:(id)sender;
- (IBAction)windowConfigForeground:(id)sender;
- (IBAction)windowConfigBackground:(id)sender;
- (void) resizeWindow:(int) w height:(int)h;
- (BOOL) pending;
// Preferences
- (void)setPreference:(id)pref;
- (id) preference;
@end
@interface PseudoTerminal (Private)
- (void) _buildToolbarItemPopUpMenu: (NSToolbarItem *) toolbarItem forToolbar: (NSToolbar *)toolbar;
- (void) _reloadAddressBookMenu: (NSNotification *) aNotification;
- (void) _toggleNewWindowState: (id) sender;
@end