Extend selection with shift-click

This commit is contained in:
Matthias Neeracher 2011-09-08 03:19:41 +02:00
parent 0ddfe26ffb
commit b8e4c614f3
3 changed files with 13 additions and 6 deletions

View File

@ -850,7 +850,7 @@ const float kSemiFloor = -1.0f*kLineH;
[self editLyrics];
break;
case kRegionMeasure:
[self editSelection];
[self editSelection:([event modifierFlags] & NSShiftKeyMask) != 0];
break;
default:
break;

View File

@ -5,14 +5,14 @@
//
// (MN) Matthias Neeracher
//
// Copyright © 2006-2007 Matthias Neeracher
// Copyright © 2006-2011 Matthias Neeracher
//
#import "VLMIDIWriter.h"
@interface VLSheetView (Selection)
- (void)editSelection;
- (void)editSelection:(BOOL)extend;
- (void)adjustSelection:(NSEvent *)event;
- (NSRange)sectionsInSelection;

View File

@ -5,7 +5,7 @@
//
// (MN) Matthias Neeracher
//
// Copyright © 2006-2007 Matthias Neeracher
// Copyright © 2006-2011 Matthias Neeracher
//
#import "VLSheetView.h"
@ -109,9 +109,16 @@ VLSequenceCallback(
@implementation VLSheetView (Selection)
- (void)editSelection
- (void)editSelection:(BOOL)extend
{
if (extend && fSelStart > -1) {
if (fCursorMeasure > fSelEnd)
fSelEnd = fCursorMeasure;
else if (fCursorMeasure < fSelStart)
fSelStart = fCursorMeasure;
} else {
fSelStart = fSelEnd = fSelAnchor = fCursorMeasure;
}
[self updateMenus];
[self setNeedsDisplay:YES];
}