Author: rmottola
Date: Wed Mar 23 01:19:46 2016
New Revision: 39589
URL: http://svn.gna.org/viewcvs/gnustep?rev=39589&view=rev
Log:
make ptyview follow the delegate protocol
Modified:
apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.h
apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.m
Modified: apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.h
URL:
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.h?rev=39589&r1=39588&r2=39589&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.h
(original)
+++ apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.h Wed Mar
23 01:19:46 2016
@@ -1,7 +1,7 @@
/*
** PTYView
**
-** Copyright (c) 2008
+** Copyright (c) 2008-2016
**
** Author: Gregory Casamento <[email protected]>
**
@@ -23,8 +23,11 @@
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
-@interface PTYView : NSTextView
+#import "PCDebuggerViewDelegateProtocol.h"
+
+@interface PTYView : NSObject <PCDebuggerViewDelegateProtocol>
{
+ NSTextView *tView;
NSTask *task;
NSFileHandle *master_handle;
NSFileHandle *slave_handle;
@@ -33,9 +36,6 @@
}
- (int)openpty;
-
-- (void)logString:(NSString *)str
- newLine:(BOOL)newLine;
- (void)logData:(NSData *)data;
Modified: apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.m
URL:
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.m?rev=39589&r1=39588&r2=39589&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.m
(original)
+++ apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PTYView.m Wed Mar
23 01:19:46 2016
@@ -1,9 +1,10 @@
/*
** PTYView
**
-** Copyright (c) 2008-2012 Free Software Foundation
+** Copyright (c) 2008-2016 Free Software Foundation
**
-** Author: Gregory Casamento <[email protected]>
+** Author: Gregory Casamento <[email protected]>
+** Riccardo Mottola <[email protected]>
**
** 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
@@ -141,6 +142,22 @@
#endif
@implementation PTYView
+
+- (NSTextView *)textView
+{
+ return tView;
+}
+
+- (void)setTextView: (NSTextView *)tv
+{
+ if (tView != tv)
+ {
+ [tView release];
+ tView = tv;
+ [tView retain];
+ }
+}
+
/**
* Creates master device.
*/
@@ -158,16 +175,17 @@
*/
- (void) logString:(NSString *)str
newLine:(BOOL)newLine
+ withColor:(NSColor *)color
{
NSRange range;
- [self replaceCharactersInRange:
- NSMakeRange([[self string] length],0) withString:str];
+ [tView replaceCharactersInRange:
+ NSMakeRange([[tView string] length],0) withString:str];
if (newLine)
{
- [self replaceCharactersInRange:
- NSMakeRange([[self string] length], 0) withString:@"\n"];
+ [tView replaceCharactersInRange:
+ NSMakeRange([[tView string] length], 0) withString:@"\n"];
}
//
@@ -178,12 +196,12 @@
range = [str rangeOfString: @"\b"];
if (range.location != NSNotFound)
{
- NSString *newString = [[self string] substringToIndex: [[self string]
length] - 4];
- [self setString: newString];
- }
-
- [self scrollRangeToVisible:NSMakeRange([[self string] length], 0)];
- [self setNeedsDisplay:YES];
+ NSString *newString = [[tView string] substringToIndex: [[tView string]
length] - 4];
+ [tView setString: newString];
+ }
+
+ [tView scrollRangeToVisible:NSMakeRange([[tView string] length], 0)];
+ [tView setNeedsDisplay:YES];
}
/**
@@ -195,7 +213,7 @@
dataString = [[NSString alloc]
initWithData:data
encoding:[NSString defaultCStringEncoding]];
- [self logString: dataString newLine: NO];
+ [self logString: dataString newLine: NO withColor:nil];
RELEASE(dataString);
}
@@ -257,7 +275,8 @@
{
NSLog(@"Task Terminated...");
[self logString: [self stopMessage]
- newLine:YES];
+ newLine:YES
+ withColor:nil];
}
/**
@@ -330,7 +349,8 @@
NS_DURING
{
[self logString: [self startMessage]
- newLine:YES];
+ newLine:YES
+ withColor:nil];
[task launch];
}
NS_HANDLER
@@ -342,7 +362,8 @@
NSLog(@"Task Terminated Unexpectedly...");
[self logString: @"\n=== Task Terminated Unexpectedly ===\n"
- newLine:YES];
+ newLine:YES
+ withColor:nil];
//Clean up after task is terminated
[[NSNotificationCenter defaultCenter]
@@ -366,6 +387,7 @@
{
[NOTIFICATION_CENTER removeObserver: self];
[self terminate];
+ [tView release];
[super dealloc];
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs