/* ControllerCategory.m created by ovidiu on Thu 20-Mar-1997 */

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import "ControllerCategory.h"

@implementation Controller (GdbDisplayProvider)

- (oneway void) setDebuggerController:(id)dC
{
  id menuItem;

  NSLog (@"setDebuggerController: gdbDisplayController = %x", gdbDisplayController);
  [[NSNotificationCenter defaultCenter]
      addObserver:self
         selector:@selector(connectionDidDie:)
             name:NSConnectionDidDieNotification
           object:[dC connectionForProxy]];
  menuItem = [[NSApp mainMenu] insertItemWithTitle:GDB_MENU_ITEM
                                            action:@selector(display:)
                                     keyEquivalent:@""
                                           atIndex:5];
  [menuItem setTarget:gdbDisplayController];
  [menuItem setEnabled:YES];
  [gdbDisplayController setDebuggerController:dC];
}

- (oneway void) breakpointChanged:(int)bpNum
                         newState:(BreakpointState)state
                           inFile:(NSString *)fileName
                           atLine:(int)lineNumber
{
  [gdbDisplayController breakpointChanged:bpNum
                                 newState:state
                                   inFile:fileName
                                   atLine:lineNumber];
}

- (oneway void) frameChanged:(int)newFrame
{
  [gdbDisplayController frameChanged:newFrame];
}

- (oneway void) stackChanged:(int)newSize limitReached:(BOOL)maxedOut
{
  [gdbDisplayController stackChanged:newSize limitReached:maxedOut];
}

- (oneway void) lineChangedForThread:(int) t
                              inFile:(NSString *)f
                         atStartLine:(int)sl
                           toEndLine:(int)el
{
  [gdbDisplayController lineChangedForThread:t
                                      inFile:f
                                 atStartLine:sl
                                   toEndLine:el];
}

- (oneway void) inferiorStateChanged:(DebuggerState) newState
{
  [gdbDisplayController inferiorStateChanged:newState];
}

- (int)query:(NSString*)queryString
{
  return [gdbDisplayController query:queryString];
}

- (oneway void) outputFromGDB:(NSString*)output
                         type:(GdbOutputType)outputType
{
  [gdbDisplayController outputFromGDB:output type:outputType];
}

@end

