Logo Search packages:      
Sourcecode: jokosher version File versions  Download package

def EventViewer::EventViewer::OnDraw (   self,
  widget,
  event 
)

This function blits the waveform data onto the screen, and
      then draws the play cursor over it.

Definition at line 107 of file EventViewer.py.

00107                                      :
            """ This function blits the waveform data onto the screen, and
                  then draws the play cursor over it.
            """
            c = self.cachedDrawArea
            e = event.area
            
            #check if the expose area is within the already cached rectangle
            if e.x < c.x or (e.x + e.width > c.x + c.width) or self.redrawWaveform:
                  self.DrawWaveform(event.area)
            
            # Get a cairo surface for this drawing op
            context = widget.window.cairo_create()

            # Give it our waveform image as a source
            context.set_source_surface(self.source, self.cachedDrawArea.x, self.cachedDrawArea.y)     

            # Blit our waveform across
            context.paint()

            # Overlay an extra rect if we're selected
            if self.event.isSelected:
                  context.rectangle(event.area.x, event.area.y,
                                            event.area.width, event.area.height)
                  context.set_source_rgba(*self._SELECTED_RGBA)
                  context.fill()
            
            
            #Draw play position
            x = int(round((self.project.transport.position - self.event.start) * self.project.viewScale))
            context.set_line_width(1)
            context.set_antialias(cairo.ANTIALIAS_NONE)
            context.move_to(x+1, 0)
            context.line_to(x+1, self.allocation.height)
            context.set_source_rgb(*self._PLAY_POSITION_RGB)
            context.stroke()
            
            # Draw the highlight cursor if it's over us and we're not dragging a fadeMarker
            if self.highlightCursor and not self.isDraggingFade:
                  context.move_to(self.highlightCursor, 0)
                  context.line_to(self.highlightCursor, self.allocation.height)
                  context.set_source_rgb(*self._HIGHLIGHT_POSITION_RGB)
                  context.set_dash([3,1],1)
                  context.stroke()
                  pixbuf = widget.render_icon(gtk.STOCK_CUT, gtk.ICON_SIZE_SMALL_TOOLBAR)
                  widget.window.draw_pixbuf(None, pixbuf, 0, 0, int(self.highlightCursor), 0)
                  

            # Overlay an extra rect if there is a selection
            self.fadeMarkersContext = None
            if self.Selection != [0,0]:
                  x1,x2 = self.Selection[:]
                  if x2 < x1:
                        x2,x1 = x1,x2
                  context.rectangle(event.area.x + x1, event.area.y,
                                            event.area.x + x2 - x1, event.area.height)
                  context.set_source_rgba(*self._SELECTION_RGBA)
                  context.fill()
                  
                  #subtract fade marker height so that it is not drawn partially offscreen
                  padded_height = self.allocation.height - self._PIXY_FADEMARKER_HEIGHT
                  
                  # and overlay the fademarkers
                  context.set_source_rgba(*self._FADEMARKERS_RGBA)
                  
                  pixxFM_left = event.area.x + x1 + 1 - self._PIXX_FADEMARKER_WIDTH
                  pixyFM_left = int(padded_height * (100-self.fadePoints[0]) / 100.0)
                  context.rectangle(pixxFM_left, pixyFM_left,
                                    self._PIXX_FADEMARKER_WIDTH , self._PIXY_FADEMARKER_HEIGHT)
                  
                  pixxFM_right = event.area.x + x2
                  pixyFM_right = int(padded_height * (100-self.fadePoints[1]) / 100.0)
                  context.rectangle(pixxFM_right, pixyFM_right,
                                    self._PIXX_FADEMARKER_WIDTH, self._PIXY_FADEMARKER_HEIGHT)
                  
                  context.fill()
                  
                  context.set_source_rgba(1,1,1,1)
                  context.move_to(pixxFM_left + 1, pixyFM_left + self._PIXY_FADEMARKER_HEIGHT - 1)
                  context.show_text("%s%%" % int(self.fadePoints[0]))
                  context.move_to(pixxFM_right + 1, pixyFM_right + self._PIXY_FADEMARKER_HEIGHT - 1)
                  context.show_text("%s%%"% int(self.fadePoints[1]))
                  context.stroke()
                  
                  # redo the rectangles so they're the path and we can in_fill() check later
                  context.rectangle(pixxFM_left, pixyFM_left,
                                    self._PIXX_FADEMARKER_WIDTH, self._PIXY_FADEMARKER_HEIGHT)
                  context.rectangle(pixxFM_right, pixyFM_right,
                                    self._PIXX_FADEMARKER_WIDTH, self._PIXY_FADEMARKER_HEIGHT)
                  self.fadeMarkersContext = context

            return False
            
      #_____________________________________________________________________

      def DrawWaveform(self, exposeArea):


Generated by  Doxygen 1.6.0   Back to index