From 013bc0fb8c48c4227a0eac4a74cb2648c6c14fd9 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 24 Sep 2011 21:11:46 +0200 Subject: [PATCH] Implement selectAll --- Sources/VLSheetViewSelection.mm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Sources/VLSheetViewSelection.mm b/Sources/VLSheetViewSelection.mm index 3b50fd2..07827f0 100644 --- a/Sources/VLSheetViewSelection.mm +++ b/Sources/VLSheetViewSelection.mm @@ -29,6 +29,7 @@ } - (VLMeasureEditable *)initWithView:(VLSheetView *)view anchor:(uint32_t)anchor; +- (VLMeasureEditable *)initWithView:(VLSheetView *)view anchor:(uint32_t)anchor to:(uint32_t)end; - (BOOL)canExtendSelection:(VLRegion)region; - (void)extendSelection:(VLLocation)at; - (BOOL)hidden; @@ -37,17 +38,22 @@ @implementation VLMeasureEditable -- (VLMeasureEditable *)initWithView:(VLSheetView *)view anchor:(uint32_t)anchor +- (VLMeasureEditable *)initWithView:(VLSheetView *)view anchor:(uint32_t)anchor to:(uint32_t)end { fView = view; fAnchor = anchor; dispatch_async(dispatch_get_main_queue(), ^{ - [fView selectMeasure:fAnchor to:fAnchor]; + [fView selectMeasure:fAnchor to:end]; }); return self; } +- (VLMeasureEditable *)initWithView:(VLSheetView *)view anchor:(uint32_t)anchor +{ + return [self initWithView:view anchor:anchor to:anchor]; +} + - (void)dealloc { [fView selectMeasure:0 to:kNoMeasure]; @@ -334,6 +340,12 @@ VLSequenceCallback( } } +- (IBAction)selectAll:(id)sender +{ + [self setEditTarget:[[VLMeasureEditable alloc] + initWithView:self anchor:0 to:[self song]->fMeasures.size()]]; +} + - (IBAction)delete:(id)sender { [[self document] willChangeSong];