Merge commit 'v3.3.0' into upstream
[debian/gnuradio] / grc / gui / DrawingArea.py
index 6f90049c50b4e162db97cbb7636dda32e710ff9a..790df7c3fa6c282c353e698c883e77d45a01ee63 100644 (file)
@@ -1,5 +1,5 @@
 """
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 This file is part of GNU Radio
 
 GNU Radio Companion is free software; you can redistribute it and/or
@@ -62,6 +62,11 @@ class DrawingArea(gtk.DrawingArea):
                self.connect('enter-notify-event', _handle_focus_event, True)
 
        def new_pixmap(self, width, height): return gtk.gdk.Pixmap(self.window, width, height, -1)
+       def get_pixbuf(self):
+               width, height = self._pixmap.get_size()
+               pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, width, height)
+               pixbuf.get_from_drawable(self._pixmap, self._pixmap.get_colormap(), 0, 0, 0, 0, width, height)
+               return pixbuf
 
        ##########################################################################
        ## Handlers
@@ -77,19 +82,21 @@ class DrawingArea(gtk.DrawingArea):
                Forward button click information to the flow graph.
                """
                self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
-               self._flow_graph.handle_mouse_button_press(
-                       left_click=(event.button == 1),
+               if event.button == 1: self._flow_graph.handle_mouse_selector_press(
                        double_click=(event.type == gtk.gdk._2BUTTON_PRESS),
                        coordinate=(event.x, event.y),
                )
+               if event.button == 3: self._flow_graph.handle_mouse_context_press(
+                       coordinate=(event.x, event.y),
+                       event=event,
+               )
 
        def _handle_mouse_button_release(self, widget, event):
                """
                Forward button release information to the flow graph.
                """
                self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
-               self._flow_graph.handle_mouse_button_release(
-                       left_click=(event.button == 1),
+               if event.button == 1: self._flow_graph.handle_mouse_selector_release(
                        coordinate=(event.x, event.y),
                )