From 9c710d1b972141cccf25158f1f0cec4a7684db24 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 10 Jun 2008 13:59:53 -0400 Subject: [PATCH] Hooking up the BSSourceView outlet and implement delegates * English.lproj/Breakpoints.xib: Hook up outlet * Source/BreakpointWindowController.h: Add the ivar * Source/BreakpointWindowController.m: (addBreakpoint:): Show the NSOpenPanel to select a file (gutterClickedAtLine:forFile:): New method --- English.lproj/Breakpoints.xib | 43 ++++++++++++++++++++--------- Source/BreakpointWindowController.h | 3 ++ Source/BreakpointWindowController.m | 28 +++++++++++++++++++ 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/English.lproj/Breakpoints.xib b/English.lproj/Breakpoints.xib index fa608d0..a329921 100644 --- a/English.lproj/Breakpoints.xib +++ b/English.lproj/Breakpoints.xib @@ -314,7 +314,7 @@ {{0, 0}, {1680, 1028}} {3.40282e+38, 3.40282e+38} - + YES file @@ -360,10 +360,10 @@ contentArray: manager.breakpoints - + - + contentArray: manager.breakpoints contentArray @@ -376,7 +376,7 @@ content - + 34 @@ -385,7 +385,7 @@ arrayController - + 35 @@ -393,10 +393,10 @@ value: arrangedObjects.file - + - + value: arrangedObjects.file value arrangedObjects.file @@ -409,10 +409,10 @@ value: arrangedObjects.line - + - + value: arrangedObjects.line value arrangedObjects.line @@ -421,6 +421,14 @@ 39 + + + sourceView + + + + 40 + @@ -593,7 +601,7 @@ 28 - + @@ -683,7 +691,7 @@ - 39 + 40 @@ -725,8 +733,17 @@ - arrayController - NSArrayController + YES + + YES + arrayController + sourceView + + + YES + NSArrayController + BSSourceView + IBProjectSource diff --git a/Source/BreakpointWindowController.h b/Source/BreakpointWindowController.h index 8c42617..9441cf5 100644 --- a/Source/BreakpointWindowController.h +++ b/Source/BreakpointWindowController.h @@ -16,11 +16,14 @@ #import #import "BreakpointManager.h" +#import "BSSourceView.h" @interface BreakpointWindowController : NSWindowController { BreakpointManager *manager; + IBOutlet NSArrayController *arrayController; + IBOutlet BSSourceView *sourceView; } - (IBAction)addBreakpoint:(id)sender; diff --git a/Source/BreakpointWindowController.m b/Source/BreakpointWindowController.m index 71261e8..3235e05 100644 --- a/Source/BreakpointWindowController.m +++ b/Source/BreakpointWindowController.m @@ -38,7 +38,14 @@ */ - (IBAction)addBreakpoint:(id)sender { + NSOpenPanel *panel = [NSOpenPanel openPanel]; + if ([panel runModal] != NSOKButton) + { + return; + } + + [sourceView setFile:[panel filename]]; } /** @@ -49,4 +56,25 @@ } +#pragma mark BSSourceView Delegate + +/** + * The gutter was clicked, which indicates that a breakpoint needs to be changed + */ +- (void)gutterClickedAtLine:(int)line forFile:(NSString *)file +{ + if ([manager hasBreakpointAt:line inFile:file]) + { + [manager removeBreakpointAt:line inFile:file]; + } + else + { + Breakpoint *bp = [[Breakpoint alloc] initWithLine:line inFile:file]; + [manager addBreakpoint:bp]; + } + + [[sourceView numberView] setMarkers:[manager breakpointsForFile:file]]; + [[sourceView numberView] setNeedsDisplay:YES]; +} + @end -- 2.43.5