From f0984f261dd3f22c8ec6129b7163b054b757384f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 4 Dec 2016 18:51:46 -0500 Subject: [PATCH] Make the add breakpoint button a pull-down menu. --- English.lproj/Breakpoints.xib | 37 ++++++++++++++++++++++++----------- Source/BreakpointController.h | 1 + Source/BreakpointController.m | 14 +++++++++++-- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/English.lproj/Breakpoints.xib b/English.lproj/Breakpoints.xib index 832ff6a..d92bd0e 100644 --- a/English.lproj/Breakpoints.xib +++ b/English.lproj/Breakpoints.xib @@ -8,6 +8,7 @@ + @@ -29,17 +30,6 @@ - @@ -106,6 +96,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/BreakpointController.h b/Source/BreakpointController.h index f4ccc8b..54714df 100644 --- a/Source/BreakpointController.h +++ b/Source/BreakpointController.h @@ -21,6 +21,7 @@ @interface BreakpointController : NSViewController +@property(nonatomic, assign) IBOutlet NSPopUpButton* addBreakpointButton; @property(nonatomic, assign) IBOutlet NSArrayController* arrayController; - (instancetype)initWithBreakpointManager:(BreakpointManager*)breakpointManager diff --git a/Source/BreakpointController.m b/Source/BreakpointController.m index 941ab88..8cc1cf4 100644 --- a/Source/BreakpointController.m +++ b/Source/BreakpointController.m @@ -23,6 +23,7 @@ BreakpointManager* _manager; BSSourceView* _sourceView; + NSArrayController* _arrayController; } @@ -39,6 +40,12 @@ return self; } +- (void)awakeFromNib +{ + [[self.addBreakpointButton cell] setUsesItemFromMenu:NO]; + [self.addBreakpointButton.cell setMenuItem:[self.addBreakpointButton.menu itemAtIndex:0]]; +} + /** * Adds a breakpoint by calling up a file chooser and selecting a file for * breaking in @@ -81,12 +88,15 @@ - (void)tableViewSelectionDidChange:(NSNotification*)notif { NSArray* selection = [_arrayController selectedObjects]; - if ([selection count] < 1) - { + if ([selection count] < 1) { return; } Breakpoint* bp = [selection objectAtIndex:0]; + if (bp.type != kBreakpointTypeFile) { + return; + } + [_sourceView setFile:[bp file]]; [_sourceView scrollToLine:[bp line]]; [_sourceView setMarkers:[_manager breakpointsForFile:bp.file]]; -- 2.43.5