Browse files

fixed bug in duplicate creation of terminal window objects when calle…

…d from Applescript.
  • Loading branch information...
1 parent 70c62ca commit 1c6d54c09bd334779257e541546006a210c8a5b5 Ujwal S. Setlur committed Apr 28, 2003
Showing with 18 additions and 10 deletions.
  1. +5 −4 MainMenu.m
  2. +13 −6 PseudoTerminal.m
View
9 MainMenu.m
@@ -1,5 +1,5 @@
// -*- mode:objc -*-
-// $Id: MainMenu.m,v 1.50 2003-04-28 08:03:13 ujwal Exp $
+// $Id: MainMenu.m,v 1.51 2003-04-28 15:18:55 ujwal Exp $
/*
** MainMenu.m
**
@@ -581,7 +581,7 @@ - (void) executeABCommandAtIndex: (int) theIndex inTerminal: (PseudoTerminal *)
if(theTerm == nil)
{
term = [[PseudoTerminal alloc] init];
- [term setPreference:PREF_PANEL];
+ [term setPreference:PREF_PANEL];
[term setColumns: [[entry objectForKey:@"Col"]intValue]];
[term setRows: [[entry objectForKey:@"Row"]intValue]];
[term setAllFont: [entry objectForKey:@"Font"] nafont: [entry objectForKey:@"NAFont"]];
@@ -742,12 +742,13 @@ - (void) insertInTerminals: (PseudoTerminal *) object
-(void)insertInTerminals:(PseudoTerminal *)object atIndex:(unsigned)index
{
- // NSLog(@"iTerm: insertInTerminals 0x%x atIndex; %d", object, index);
+ if([terminalWindows containsObject: object] == YES)
+ return;
[object setPreference:PREF_PANEL];
[object initWindow:[PREF_PANEL col]
height:[PREF_PANEL row]
font:[PREF_PANEL font]
- nafont:[PREF_PANEL nafont]];
+ nafont:[PREF_PANEL nafont]];
[terminalWindows insertObject: object atIndex: index];
}
View
19 PseudoTerminal.m
@@ -1,5 +1,5 @@
// -*- mode:objc -*-
-// $Id: PseudoTerminal.m,v 1.155 2003-04-28 08:03:14 ujwal Exp $
+// $Id: PseudoTerminal.m,v 1.156 2003-04-28 15:18:57 ujwal Exp $
//
/*
** PseudoTerminal.m
@@ -75,6 +75,10 @@ - (void) newSession: (id) sender
aSession = [[PTYSession alloc] init];
[self setupSession:aSession title: nil];
+ // Add this session to our list and make it current
+ [self addInSessions: aSession];
+ [aSession release];
+
[aSession setForegroundColor: [pref foreground]];
[aSession setBackgroundColor: [[pref background] colorWithAlphaComponent: (1.0-[pref transparency]/100.0)]];
[aSession setSelectionColor: [pref selectionColor]];
@@ -83,11 +87,6 @@ - (void) newSession: (id) sender
[aSession setEncoding:[pref encoding]];
// term value
[aSession setTERM_VALUE: [pref terminalType]];
-
- // Add this session to our list and make it current
- [self addInSessions: aSession];
- [aSession release];
-
[self startProgram:cmd arguments:arg];
[self setCurrentSessionName:nil];
@@ -140,6 +139,7 @@ - (void)initWindow:(int)width
font:(NSFont *)font
nafont:(NSFont *)nafont
{
+
WIDTH=width;
HEIGHT=height;
NSRect tabviewRect;
@@ -1732,6 +1732,13 @@ -(void)insertInSessions:(PTYSession *)object atIndex:(unsigned)index
{
// NSLog(@"PseudoTerminal: -insertInSessions: 0x%x atIndex: %d", object, index);
[self setupSession: object title: nil];
+ [object setForegroundColor: [pref foreground]];
+ [object setBackgroundColor: [[pref background] colorWithAlphaComponent: (1.0-[pref transparency]/100.0)]];
+ [object setSelectionColor: [pref selectionColor]];
+ [object setBoldColor: [pref boldColor]];
+ [object setEncoding: [pref encoding]];
+ // term value
+ [object setTERM_VALUE: [pref terminalType]];
[self insertSession: object atIndex: index];
}

0 comments on commit 1c6d54c

Please sign in to comment.