From 814bfea231075043a97b778e09b2ffb510b4f768 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Tue, 15 Jan 2013 13:09:27 +0000 Subject: Now editing notes works properly Signed-off-by: Aaron Gordon --- diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py index 3ea2a19..237aae0 100644 --- a/Edit/MainWindow.py +++ b/Edit/MainWindow.py @@ -721,7 +721,7 @@ class MainWindow(Gtk.EventBox): self._play_button.set_active(False) self.handleAudioRecord(widget, data) if widget.get_active(): - gobject.timeout_add(500, self._startAudioRecord) + GObject.timeout_add(500, self._startAudioRecord) def _startAudioRecord(self): self._play_button.set_active(True) @@ -767,7 +767,7 @@ class MainWindow(Gtk.EventBox): self.csnd.loopStart() if not self.playbackTimeout: - self.playbackTimeout = gobject.timeout_add(50, self.onTimeout) + self.playbackTimeout = GObject.timeout_add(50, self.onTimeout) @@ -783,7 +783,7 @@ class MainWindow(Gtk.EventBox): time.sleep(0.01) if self.playbackTimeout: - gobject.source_remove(self.playbackTimeout) + GObject.source_remove(self.playbackTimeout) self.playbackTimeout = False self.csnd.loopPause() @@ -1562,7 +1562,7 @@ class MainWindow(Gtk.EventBox): self._loadFile( chooser.get_filename() ) chooser.destroy() - self.delay = gobject.timeout_add(1000, self.waitToSet) + self.delay = GObject.timeout_add(1000, self.waitToSet) def handleJournalLoad(self,file_path): self.journalCalled = True @@ -1679,7 +1679,7 @@ class MainWindow(Gtk.EventBox): if len(self.kb_keydict) > 1: for k in self.kb_keydict.keys(): if k != key: - gobject.source_remove( self.durUpdate ) + GObject.source_remove( self.durUpdate ) self.durUpdate = False self.kb_keydict[k].duration = 0.5 self.kb_keydict[k].amplitude = 0 @@ -1750,7 +1750,7 @@ class MainWindow(Gtk.EventBox): # csId: PageId, TrackId, Onset, Key, DurationSetOnce self.csId = [pid, tid, id, csnote.onset, key, False ] if tid < Config.NUMBER_OF_TRACKS-1: - self.durUpdate = gobject.timeout_add( 25, self.durationUpdate ) + self.durUpdate = GObject.timeout_add( 25, self.durationUpdate ) def onKeyRelease(self,widget,event): @@ -1766,7 +1766,7 @@ class MainWindow(Gtk.EventBox): if KEY_MAP_PIANO.has_key(key) and self.kb_keydict.has_key(key): if self.kb_record and self.durUpdate: - gobject.source_remove( self.durUpdate ) + GObject.source_remove( self.durUpdate ) self.durUpdate = False if self.instrumentDB.instId[ self.kb_keydict[key].instrumentId ].csoundInstrumentId == Config.INST_TIED: @@ -2018,8 +2018,7 @@ class InstrumentButton(Gtk.DrawingArea): if self.clicked != None: return - x, y = widget.get_pointer() - + x, y = event.x, event.y #if event.is_hint: # x, y, state = widget.window.get_pointer() # event.x = float(x) diff --git a/Edit/NoteInterface.py b/Edit/NoteInterface.py index 7ba04b8..c1f4e90 100644 --- a/Edit/NoteInterface.py +++ b/Edit/NoteInterface.py @@ -333,8 +333,8 @@ class NoteInterface: # Draw def draw(self, surface, startX, stopX): - if stopX < self.imgX: return False # we don't need to draw and no one after us will draw - if startX > self.imgX + self.imgWidth: return True # we don't need to draw, but maybe a later note does + #if stopX < self.imgX: return False # we don't need to draw and no one after us will draw + #if startX > self.imgX + self.imgWidth: return True # we don't need to draw, but maybe a later note does cxt = cairo.Context(surface) cxt.set_source_rgb(*gdk_color_to_cairo(self.color)) cxt.rectangle(self.x+1, self.y, self.width-2, self.height-2 ) diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py index ea50dab..26f779b 100644 --- a/Edit/TrackInterface.py +++ b/Edit/TrackInterface.py @@ -644,12 +644,12 @@ class TrackInterface( Gtk.EventBox ): TP.ProfileEnd( "TI::handleMotion::Common" ) - if not self.clickButton and self.curAction != "paste": # we recieved this event but were never clicked! (probably a popup window was open) TP.ProfileBegin( "TI::handleMotion::Hover" ) self.updateTooltip( event ) TP.ProfileEnd( "TI::handleMotion::Hover" ) return + if self.curAction == "paste": TP.ProfileBegin( "TI::handleMotion::Paste" ) top = Config.NUMBER_OF_TRACKS @@ -661,7 +661,7 @@ class TrackInterface( Gtk.EventBox ): self.updatePaste( self.pixelsToTicksFloor( self.curBeats, event.x ), top ) TP.ProfileEnd( "TI::handleMotion::Paste" ) - elif event.state & Gdk.EventMask.BUTTON1_MOTION_MASK: + elif event.state & Gdk.ModifierType.BUTTON1_MASK: TP.ProfileBegin( "TI::handleMotion::Drag" ) if not self.curAction: # no action is in progress yet we're dragging, start a marquee @@ -671,9 +671,11 @@ class TrackInterface( Gtk.EventBox ): self.noteDragOnset( event ) elif self.curAction == "note-drag-duration": + print "note drag duration" self.noteDragDuration( event ) elif self.curAction == "note-drag-pitch": + print "note drag pitch" self.noteDragPitch( event ) elif self.curAction == "note-drag-pitch-drum": @@ -906,8 +908,8 @@ class TrackInterface( Gtk.EventBox ): self.curActionObject.playSampleNote( False ) def doneNoteDrag( self, action ): - # if action == "note-drag-pitch" or action == "note-drag-pitch-drum": - # self.curActionObject.playSampleNote() + if action == "note-drag-pitch" or action == "note-drag-pitch-drum": + self.curActionObject.playSampleNote() self.lastDO = self.lastDP = self.lastDrumDP = self.lastDD = None diff --git a/TamTamEdit.py b/TamTamEdit.py index fc4973d..c40991a 100644 --- a/TamTamEdit.py +++ b/TamTamEdit.py @@ -139,7 +139,7 @@ class TamTamEdit(activity.Activity): if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()' - #self.edit.onDestroy() + self.edit.onDestroy() csnd = new_csound_client() csnd.connect(False) -- cgit v0.9.1