mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
the wrapper should be property of the controller, not the view
This commit is contained in:
parent
67381ab3cc
commit
7adfa56357
4 changed files with 19 additions and 38 deletions
|
@ -27,6 +27,7 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <Protocols/CodeDebugger.h>
|
||||
#import "PCDebuggerWrapperProtocol.h"
|
||||
|
||||
extern const NSString *PCBreakTypeKey;
|
||||
extern NSString *PCBreakTypeByLine;
|
||||
|
@ -49,8 +50,10 @@ extern NSString *PCDBDebuggerStartedNotification;
|
|||
NSString *lastFileNameParsed;
|
||||
NSUInteger lastLineNumberParsed;
|
||||
NSMutableArray *breakpoints;
|
||||
id <PCDebuggerWrapperProtocol> debuggerWrapper;
|
||||
}
|
||||
|
||||
- (id <PCDebuggerWrapperProtocol>)debuggerWrapper;
|
||||
- (void) setStatus: (NSString *) status;
|
||||
- (NSString *) status;
|
||||
- (NSString *)executablePath;
|
||||
|
|
|
@ -139,8 +139,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
{
|
||||
if((self = [super init]) != nil)
|
||||
{
|
||||
NSLog(@"PCDebugger Init");
|
||||
id <PCDebuggerWrapperProtocol> debuggerWrapper;
|
||||
NSLog(@"PCDebugger Init");
|
||||
// initialization here...
|
||||
if([NSBundle loadNibNamed: @"PCDebugger" owner: self] == NO)
|
||||
{
|
||||
|
@ -149,10 +148,8 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
|
||||
[(PCDebuggerView *)debuggerView setDebugger:self];
|
||||
debuggerWrapper = [[GDBWrapper alloc] init];
|
||||
[debuggerView setDebuggerWrapper:debuggerWrapper];
|
||||
[debuggerWrapper setTextView:debuggerView];
|
||||
[debuggerWrapper setDebugger:self];
|
||||
[debuggerWrapper release];
|
||||
[debuggerView setFont: [self consoleFont]];
|
||||
|
||||
subProcessId = 0;
|
||||
|
@ -196,8 +193,6 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
|
||||
- (void) initBreakpoints
|
||||
{
|
||||
id <PCDebuggerWrapperProtocol> debuggerWrapper;
|
||||
|
||||
breakpoints = [[NSMutableArray alloc] init];
|
||||
/* CRUDE EXAMPLES * TODO FIXME *
|
||||
NSDictionary *dP;
|
||||
|
@ -208,15 +203,11 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
dP = [NSDictionary dictionaryWithObjectsAndKeys: PCBreakTypeByLine, PCBreakTypeKey, @"AppController.m", PCBreakFilename, [NSNumber numberWithInt:100], PCBreakLineNumber, nil];
|
||||
[breakpoints addObject:dP];
|
||||
*/
|
||||
|
||||
debuggerWrapper = [debuggerView debuggerWrapper];
|
||||
[debuggerWrapper setBreakpoints:breakpoints];
|
||||
}
|
||||
|
||||
- (void) debuggerSetup
|
||||
{
|
||||
id <PCDebuggerWrapperProtocol> debuggerWrapper;
|
||||
debuggerWrapper = [debuggerView debuggerWrapper];
|
||||
[debuggerWrapper debuggerSetup];
|
||||
}
|
||||
|
||||
|
@ -239,6 +230,11 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
[self setStatus: @"Idle."];
|
||||
}
|
||||
|
||||
- (id <PCDebuggerWrapperProtocol>)debuggerWrapper
|
||||
{
|
||||
return debuggerWrapper;
|
||||
}
|
||||
|
||||
- (NSWindow *)debuggerWindow
|
||||
{
|
||||
return debuggerWindow;
|
||||
|
@ -413,6 +409,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[debuggerWrapper release];
|
||||
[breakpoints release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
|
@ -24,20 +24,16 @@
|
|||
#import <Foundation/NSString.h>
|
||||
#import <AppKit/NSTextView.h>
|
||||
|
||||
#import "PCDebuggerWrapperProtocol.h"
|
||||
|
||||
@class PCDebugger;
|
||||
|
||||
@interface PCDebuggerView : NSTextView
|
||||
{
|
||||
PCDebugger *debugger;
|
||||
id <PCDebuggerWrapperProtocol> debuggerWrapper;
|
||||
NSString *currentFile;
|
||||
}
|
||||
|
||||
- (void) setDebugger:(PCDebugger *)theDebugger;
|
||||
- (id <PCDebuggerWrapperProtocol>)debuggerWrapper;
|
||||
- (void) setDebuggerWrapper:(id <PCDebuggerWrapperProtocol>) dw;
|
||||
- (void) setCurrentFile: (NSString *)fileName;
|
||||
- (NSString *) currentFile;
|
||||
|
||||
|
|
|
@ -41,25 +41,10 @@
|
|||
debugger = theDebugger;
|
||||
}
|
||||
|
||||
- (id <PCDebuggerWrapperProtocol>)debuggerWrapper
|
||||
{
|
||||
return debuggerWrapper;
|
||||
}
|
||||
|
||||
- (void) setDebuggerWrapper:(id <PCDebuggerWrapperProtocol>) dw
|
||||
{
|
||||
if (debuggerWrapper != dw)
|
||||
{
|
||||
[debuggerWrapper release];
|
||||
debuggerWrapper = dw;
|
||||
[debuggerWrapper retain];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setFont:(NSFont *)aFont
|
||||
{
|
||||
[debuggerWrapper setFont:aFont];
|
||||
[[debugger debuggerWrapper] setFont:aFont];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +53,7 @@
|
|||
- (void) logString:(NSString *)str
|
||||
newLine:(BOOL)newLine
|
||||
{
|
||||
[debuggerWrapper logString: str newLine: newLine withColor:[debuggerWrapper debuggerColor]];
|
||||
[[debugger debuggerWrapper] logString: str newLine: newLine withColor:[[debugger debuggerWrapper] debuggerColor]];
|
||||
}
|
||||
|
||||
- (void) setCurrentFile: (NSString *)fileName
|
||||
|
@ -83,7 +68,7 @@
|
|||
|
||||
- (void) terminate
|
||||
{
|
||||
[debuggerWrapper terminate];
|
||||
[[debugger debuggerWrapper] terminate];
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *)event
|
||||
|
@ -99,10 +84,10 @@
|
|||
withArguments: (NSArray *)array
|
||||
logStandardError: (BOOL)logError
|
||||
{
|
||||
[debuggerWrapper runProgram: path
|
||||
inCurrentDirectory: directory
|
||||
withArguments: array
|
||||
logStandardError: logError];
|
||||
[[debugger debuggerWrapper] runProgram: path
|
||||
inCurrentDirectory: directory
|
||||
withArguments: array
|
||||
logStandardError: logError];
|
||||
}
|
||||
|
||||
- (void) putString: (NSString *)string
|
||||
|
@ -110,12 +95,12 @@
|
|||
NSAttributedString* attr = [[NSAttributedString alloc] initWithString:string];
|
||||
[[self textStorage] appendAttributedString:attr];
|
||||
[self scrollRangeToVisible:NSMakeRange([[self string] length], 0)];
|
||||
[debuggerWrapper putString:string];
|
||||
[[debugger debuggerWrapper] putString:string];
|
||||
}
|
||||
|
||||
- (void) keyDown: (NSEvent*)theEvent
|
||||
{
|
||||
[debuggerWrapper keyDown:theEvent];
|
||||
[[debugger debuggerWrapper] keyDown:theEvent];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue