2
copyright 2002, 2003 Alexander Malmberg <alexander@malmberg.org>
4
This file is a part of Terminal.app. Terminal.app is free software; you
5
can redistribute it and/or modify it under the terms of the GNU General
6
Public License as published by the Free Software Foundation; version 2
7
of the License. See COPYING or main.m for more information.
10
#include <Foundation/NSBundle.h>
11
#include <Foundation/NSString.h>
12
#include <Foundation/NSUserDefaults.h>
13
#include <AppKit/NSBox.h>
14
#include <AppKit/NSButton.h>
15
#include <AppKit/NSMatrix.h>
16
#include <AppKit/NSTextField.h>
17
#include <GNUstepGUI/GSTable.h>
18
#include <GNUstepGUI/GSVbox.h>
21
#include "TerminalWindowPrefs.h"
24
static NSUserDefaults *ud;
28
*WindowCloseBehaviorKey=@"WindowCloseBehavior",
29
*WindowHeightKey=@"WindowHeight",
30
*WindowWidthKey=@"WindowWidth",
31
*AddYBordersKey=@"AddYBorders";
34
static int windowCloseBehavior;
35
static int windowWidth,windowHeight;
36
static BOOL addYBorders;
39
@implementation TerminalWindowPrefs
45
ud=[NSUserDefaults standardUserDefaults];
47
windowCloseBehavior=[ud integerForKey: WindowCloseBehaviorKey];
48
windowWidth=[ud integerForKey: WindowWidthKey];
49
windowHeight=[ud integerForKey: WindowHeightKey];
50
addYBorders=[ud boolForKey: AddYBordersKey];
59
+(int) windowCloseBehavior
61
return windowCloseBehavior;
64
+(int) defaultWindowWidth
68
+(int) defaultWindowHeight
83
windowCloseBehavior=[[m_close selectedCell] tag];
84
[ud setInteger: windowCloseBehavior forKey: WindowCloseBehaviorKey];
86
addYBorders=[b_addYBorders state];
87
[ud setBool: addYBorders forKey: AddYBordersKey];
89
windowWidth=[tf_width intValue];
90
windowHeight=[tf_height intValue];
97
[ud setInteger: windowWidth forKey: WindowWidthKey];
98
[ud setInteger: windowHeight forKey: WindowHeightKey];
103
[m_close selectCellWithTag: windowCloseBehavior];
105
[tf_width setIntValue: windowWidth];
106
[tf_height setIntValue: windowHeight];
108
[b_addYBorders setState: addYBorders];
114
return _(@"Terminal Window");
117
-(void) setupButton: (NSButton *)b
119
[b setTitle: _(@"Terminal\nWindow")];
131
top=[[GSVbox alloc] init];
132
[top setDefaultMinYMargin: 1];
139
NSButtonCell *b=[NSButtonCell new];
142
[b setButtonType: NSRadioButton];
144
m=m_close=[[NSMatrix alloc] initWithFrame: NSMakeRect(0,0,1,1)
145
mode: NSRadioModeMatrix
149
[m setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin|
150
NSViewMinYMargin|NSViewMaxYMargin];
152
[[m cellAtRow: 0 column: 0] setTitle: _(@"Close new windows when idle")];
153
[[m cellAtRow: 1 column: 0] setTitle: _(@"Don't close new windows")];
154
[[m cellAtRow: 0 column: 0] setTag: 0];
155
[[m cellAtRow: 1 column: 0] setTag: 1];
157
s=[[m cellAtRow: 0 column: 0] cellSize];
158
s2=[[m cellAtRow: 0 column: 0] cellSize];
159
if (s2.width>s.width) s.width=s2.width;
162
[m setIntercellSpacing: NSMakeSize(0,3)];
165
[top addView: m enablingYResizing: YES];
173
b=[[NSBox alloc] init];
174
[b setAutoresizingMask:
175
NSViewWidthSizable|NSViewMinYMargin|NSViewMaxYMargin];
176
[b setTitle: _(@"Default size")];
178
t=[[GSTable alloc] initWithNumberOfRows: 2 numberOfColumns: 2];
180
f=[NSTextField newLabel: _(@"Width:")];
181
[f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin];
182
[t putView: f atRow: 1 column: 0
183
withXMargins: 2 yMargins: 2];
184
tf_width=f=[[NSTextField alloc] init];
185
[f setAutoresizingMask: NSViewWidthSizable];
187
[t putView: f atRow: 1 column: 1];
189
f=[NSTextField newLabel: _(@"Height:")];
190
[f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin];
191
[t putView: f atRow: 0 column: 0
192
withXMargins: 2 yMargins: 2];
193
tf_height=f=[[NSTextField alloc] init];
194
[f setAutoresizingMask: NSViewWidthSizable];
196
[t putView: f atRow: 0 column: 1];
198
[b setContentView: t];
202
[top addView: b enablingYResizing: YES];
209
b=b_addYBorders=[[NSButton alloc] init];
210
[b setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin|NSViewMinYMargin|NSViewMaxYMargin];
211
[b setButtonType: NSSwitchButton];
212
[b setTitle: _(@"Add top and bottom border")];
214
[top addView: b enablingYResizing: YES];