From ba9605ec3a15f6cf83b4c7550eaffb671c06e089 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 1 May 2011 12:32:33 -0400 Subject: [PATCH] Add |-[DebuggerBackEndDelegate scriptWasEvaluatedWithResult:]| and plumb it through --- Source/DebuggerBackEnd.h | 3 +++ Source/DebuggerController.m | 5 +++++ Source/EvalController.h | 6 ++++++ Source/EvalController.m | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/Source/DebuggerBackEnd.h b/Source/DebuggerBackEnd.h index 21b5580..25d7851 100644 --- a/Source/DebuggerBackEnd.h +++ b/Source/DebuggerBackEnd.h @@ -127,5 +127,8 @@ // Callback from |-getProperty:|. - (void)receivedProperties:(NSArray*)properties forTransaction:(NSInteger)transaction; +// Callback for the result of |-evalScript:|. +- (void)scriptWasEvaluatedWithResult:(NSString*)result; + @end diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index ed4d852..7c0f8f6 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -402,4 +402,9 @@ } } +- (void)scriptWasEvaluatedWithResult:(NSString*)result +{ + [EvalController scriptWasEvaluatedWithResult:result]; +} + @end diff --git a/Source/EvalController.h b/Source/EvalController.h index 542aa94..5a99149 100644 --- a/Source/EvalController.h +++ b/Source/EvalController.h @@ -37,4 +37,10 @@ - (IBAction)evaluateScript:(id)sender; - (IBAction)closeWindow:(id)sender; +// Callback from the DebuggerBackEnd that is routed through the +// DebuggerController. This will message the current EvalController if it is +// running modally. If the controller is not running, the message will be +// dropped. ++ (void)scriptWasEvaluatedWithResult:(NSString*)result; + @end diff --git a/Source/EvalController.m b/Source/EvalController.m index 7e1cb52..30536ab 100644 --- a/Source/EvalController.m +++ b/Source/EvalController.m @@ -18,6 +18,8 @@ #import "DebuggerBackEnd.h" +static EvalController* g_activeEvalController = nil; + @implementation EvalController @synthesize dataField = dataField_; @@ -40,6 +42,8 @@ - (void)runModalForWindow:(NSWindow*)parent { + assert(!g_activeEvalController); + g_activeEvalController = self; [NSApp beginSheet:[self window] modalForWindow:parent modalDelegate:self @@ -51,6 +55,7 @@ returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo { + g_activeEvalController = nil; [self autorelease]; } @@ -66,4 +71,9 @@ [NSApp endSheet:[self window]]; } ++ (void)scriptWasEvaluatedWithResult:(NSString*)result +{ + g_activeEvalController.resultField.value = result; +} + @end -- 2.22.5