mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Fix bugs in Delete, add Delete Melody
This commit is contained in:
parent
93d835d975
commit
07c3318006
2113
English.lproj/MainMenu.nib/designable.nib
generated
2113
English.lproj/MainMenu.nib/designable.nib
generated
File diff suppressed because it is too large
Load Diff
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -2259,8 +2259,16 @@ void VLSong::PasteMeasures(size_t beginMeasure, const VLSong & measures, int mod
|
|||
}
|
||||
}
|
||||
|
||||
void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure)
|
||||
void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure, int mode)
|
||||
{
|
||||
if (mode == kOverwriteMelody) {
|
||||
VLLyricsNote rest(VLRest(fProperties.front().fTime));
|
||||
for (size_t m=beginMeasure; m<endMeasure; ++m) {
|
||||
fMeasures[m].fMelody.clear();
|
||||
fMeasures[m].fMelody.push_back(rest);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int8_t firstProp = fMeasures[beginMeasure].fPropIdx;
|
||||
int8_t lastProp = fMeasures[endMeasure-1].fPropIdx+1;
|
||||
|
||||
|
@ -2268,6 +2276,8 @@ void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure)
|
|||
++firstProp;
|
||||
if (endMeasure < CountMeasures() && fMeasures[endMeasure].fPropIdx == lastProp)
|
||||
--lastProp;
|
||||
if (lastProp - firstProp == fProperties.size())
|
||||
++firstProp;
|
||||
if (lastProp > firstProp) {
|
||||
fProperties.erase(fProperties.begin()+firstProp,
|
||||
fProperties.begin()+lastProp);
|
||||
|
@ -2300,6 +2310,11 @@ void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure)
|
|||
++r;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Keep an empty meausure at the end
|
||||
//
|
||||
if (!EmptyEnding())
|
||||
AddMeasure();
|
||||
}
|
||||
|
||||
VLFract VLSong::TiedDuration(size_t measure)
|
||||
|
|
|
@ -352,7 +352,7 @@ struct VLSong {
|
|||
VLSong CopyMeasures(size_t beginMeasure, size_t endMeasure);
|
||||
void PasteMeasures(size_t beginMeasure, const VLSong & measures,
|
||||
int mode = kInsert);
|
||||
void DeleteMeasures(size_t beginMeasure, size_t endMeasure);
|
||||
void DeleteMeasures(size_t beginMeasure, size_t endMeasure, int mode = kInsert);
|
||||
|
||||
size_t CountMeasures() const { return fMeasures.size(); }
|
||||
size_t EmptyEnding() const;
|
||||
|
|
|
@ -136,7 +136,7 @@ static VLSong sPasteboard;
|
|||
- (IBAction)delete:(id)sender
|
||||
{
|
||||
[[self document] willChangeSong];
|
||||
[self song]->DeleteMeasures(fSelStart, fSelEnd);
|
||||
[self song]->DeleteMeasures(fSelStart, fSelEnd, [sender tag]);
|
||||
[[self document] didChangeSong];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user