diff options
author | amartin <olpc@localhost.localdomain> | 2007-02-11 19:23:12 (GMT) |
---|---|---|
committer | amartin <olpc@localhost.localdomain> | 2007-02-11 19:23:12 (GMT) |
commit | 39683b9e0d4f29ba071e85c6d8a89bb40b43ca1b (patch) | |
tree | ad9bf48be25544d4e9bc085286413ece8c3eb619 /Edit/NoteInterface.py | |
parent | 4ebd04f319ea60f8e593ecd1f1d1e68d68be8c13 (diff) |
note step buttons, redid note drag updates as streams
Diffstat (limited to 'Edit/NoteInterface.py')
-rw-r--r-- | Edit/NoteInterface.py | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/Edit/NoteInterface.py b/Edit/NoteInterface.py index 20886b5..25a160d 100644 --- a/Edit/NoteInterface.py +++ b/Edit/NoteInterface.py @@ -196,24 +196,23 @@ class NoteInterface: return True - def noteDrag( self, emitter, do, dp, dd ): - self.potentialDeselect = False - + def noteDragOnset( self, do, stream ): + self. potentialDeselect = False if do != self.lastDragO: self.lastDragO = do - self.noteDB.updateNote( self.note.page, self.note.track, self.note.id, PARAMETER.ONSET, self.baseOnset + do ) - self.end = self.note.cs.onset + self.note.cs.duration + stream += [ self.note.id, self.baseOnset + do ] + def noteDragPitch( self, dp, stream ): + self.potentialDeselect = False if dp != self.lastDragP: self.lastDragP = dp - newPitch = self.basePitch + dp - self.noteDB.updateNote( self.note.page, self.note.track, self.note.id, PARAMETER.PITCH, newPitch ) - self.updateSampleNote( newPitch ) + stream += [ self.note.id, self.basePitch + dp ] + def noteDragDuration( self, dd, stream ): + self.potentialDeselect = False if dd != self.lastDragD: self.lastDragD = dd - self.noteDB.updateNote( self.note.page, self.note.track, self.note.id, PARAMETER.DURATION, self.baseDuration + dd ) - self.end = self.note.cs.onset + self.note.cs.duration + stream += [ self.note.id, self.baseDuration + dd ] def doneNoteDrag( self, emitter ): self.baseOnset = self.note.cs.onset @@ -226,6 +225,47 @@ class NoteInterface: self.clearSampleNote() + def noteDecOnset( self, step, leftBound, stream ): + if self.selected: + if leftBound < self.note.cs.onset: + onset = max( self.note.cs.onset+step, leftBound ) + stream += [ self.note.id, onset ] + return onset + self.note.cs.duration + return self.end + + def noteIncOnset( self, step, rightBound, stream ): + if self.selected: + if rightBound > self.end: + onset = min( self.end+step, rightBound ) - self.note.cs.duration + stream += [ self.note.id, onset ] + return onset + return self.note.cs.onset + + def noteDecPitch( self, step, stream ): + if self.note.cs.pitch > Config.MINIMUM_PITCH: + stream += [ self.note.id, max( self.note.cs.pitch+step, Config.MINIMUM_PITCH ) ] + + def noteIncPitch( self, step, stream ): + if self.note.cs.pitch < Config.MAXIMUM_PITCH: + stream += [ self.note.id, min( self.note.cs.pitch+step, Config.MAXIMUM_PITCH ) ] + + def noteDecDuration( self, step, stream ): + if self.note.cs.duration > Config.MINIMUM_NOTE_DURATION: + stream += [ self.note.id, max( self.note.cs.duration+step, Config.MINIMUM_NOTE_DURATION ) ] + + def noteIncDuration( self, step, rightBound, stream ): + if self.selected: + if self.end < rightBound: + stream += [ self.note.id, min( self.end+step, rightBound ) - self.note.cs.onset ] + + def noteDecVolume( self, step, stream ): + if self.note.cs.amplitude > 0: + stream += [ self.note.id, max( self.note.cs.amplitude+step, 0 ) ] + + def noteIncVolume( self, step, stream ): + if self.note.cs.amplitude < 1: + stream += [ self.note.id, min( self.note.cs.amplitude+step, 1 ) ] + def handleMarqueeSelect( self, emitter, start, stop ): intersectionY = [ max(start[1],self.y), min(stop[1],self.y+self.height) ] if intersectionY[0] > intersectionY[1]: |