From dfad9cfeb95d3caa0db27b5581ced5cc98f13e34 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Tue, 15 Jan 2013 13:14:59 +0000 Subject: Fixing the tune interface. Other bug fixes Signed-off-by: Aaron Gordon --- diff --git a/Edit/HitInterface.py b/Edit/HitInterface.py index db8700f..b93f38a 100644 --- a/Edit/HitInterface.py +++ b/Edit/HitInterface.py @@ -103,7 +103,7 @@ class HitInterface( NoteInterface ): check += 1 while stop < check: stop += Config.TICKS_PER_BEAT emitter.selectNotesByBar( self.note.track, start, stop ) - elif event.type == gtk.gdk._3BUTTON_PRESS: # select track + elif event.type == Gdk.EventType._3BUTTON_PRESS: # select track self.potentialDeselect = False emitter.selectNotesByTrack( self.note.track ) else: @@ -183,8 +183,8 @@ class HitInterface( 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+2, self.y+2, self.width-4, self.height-4) diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py index 26f779b..a7103d4 100644 --- a/Edit/TrackInterface.py +++ b/Edit/TrackInterface.py @@ -385,7 +385,6 @@ class TrackInterface( Gtk.EventBox ): def handleButtonPress( self, widget, event ): TP.ProfileBegin( "TI::handleButtonPress" ) - print event.x, event.y self.clickButton = event.button if event.type == Gdk.EventType._2BUTTON_PRESS: self.buttonPressCount = 2 @@ -671,11 +670,9 @@ 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": diff --git a/Edit/TuneInterface.py b/Edit/TuneInterface.py index fb145c4..ee30874 100644 --- a/Edit/TuneInterface.py +++ b/Edit/TuneInterface.py @@ -77,8 +77,8 @@ class TuneInterfaceParasite: self.owner.invalidate_thumbnail( self.note.page, x, y, width, 1 ) def draw( self, win, startX, stopX ): - if stopX < self.x: return False # we don't need to draw and no one after us will draw - if startX > self.endx: return True # we don't need to draw, but maybe a later note does + #if stopX < self.x: return False # we don't need to draw and no one after us will draw + #if startX > self.endx: return True # we don't need to draw, but maybe a later note does cxt = cairo.Context(win) cxt.move_to(self.x, self.y) @@ -130,7 +130,7 @@ class TuneInterface( Gtk.EventBox ): self.thumbnailBG = [] #self.gc.foreground = self.bgColor for i in range(4): - pix = cairo.ImageSurface.create_from_png("common/Resources/Images/" + 'pageThumbnailBG%d.png' % i) + pix = cairo.ImageSurface.create_from_png(imagefile('pageThumbnailBG%d.png' % i)) #pix = gtk.gdk.pixbuf_new_from_file(imagefile('pageThumbnailBG%d.png' % i)) self.thumbnailBG.append(cairo.ImageSurface(cairo.FORMAT_RGB24, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT)) cxt = cairo.Context(self.thumbnailBG[i]) @@ -142,7 +142,7 @@ class TuneInterface( Gtk.EventBox ): # load clipmask #pix = gtk.gdk.pixbuf_new_from_file(imagefile('pageThumbnailMask.png')) - pix = cairo.ImageSurface.create_from_png("common/Resources/Images/"+ "pageThumbnailMask.png") + pix = cairo.ImageSurface.create_from_png(imagefile("pageThumbnailMask.png")) pixels = pix.get_data() stride = pix.get_stride() #channels = pix.get_n_channels() @@ -553,7 +553,7 @@ class TuneInterface( Gtk.EventBox ): cxt = cairo.Context(pixmap) # draw background - cxt.set_source_surface(self.thumbnailBG[self.noteDB.getPage(id).color], startX, startY) + cxt.set_source_surface(self.thumbnailBG[self.noteDB.getPage(id).color], 0, 0) cxt.paint() # draw regular tracks @@ -563,8 +563,8 @@ class TuneInterface( Gtk.EventBox ): cxt.set_line_join(cairo.LINE_JOIN_MITER) #self.gc.set_line_attributes( 1, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER ) for i in range(self.drumIndex): - if startY >= self.trackRect[i+1][1]: continue - if stopY < self.trackRect[i][1]: break + #if startY >= self.trackRect[i+1][1]: continue + #if stopY < self.trackRect[i][1]: break # draw notes notes = self.noteDB.getNotesByTrack( id, i, self ) @@ -579,10 +579,7 @@ class TuneInterface( Gtk.EventBox ): if not notes[n].draw( pixmap, startX, stopX ): break self.thumbnailDirty[id] = False - #f = open("test%d.png" % self.num, "w") - #pixmap.write_to_png(f) - #f.close() - #self.num += 1 + def draw( self, drawingArea, cr): -- cgit v0.9.1