summaryrefslogtreecommitdiff
path: root/grc/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'grc/src/gui')
-rw-r--r--grc/src/gui/ActionHandler.py7
-rw-r--r--grc/src/gui/DrawingArea.py20
2 files changed, 18 insertions, 9 deletions
diff --git a/grc/src/gui/ActionHandler.py b/grc/src/gui/ActionHandler.py
index 27f19cbf9..f5f349d4a 100644
--- a/grc/src/gui/ActionHandler.py
+++ b/grc/src/gui/ActionHandler.py
@@ -345,8 +345,13 @@ class ActionHandler:
#saved status
Actions.get_action_from_name(Actions.FLOW_GRAPH_SAVE).set_sensitive(not self.get_page().get_saved())
self.main_window.update()
+ try: #set the size of the flow graph area (if changed)
+ new_size = self.get_flow_graph().get_option('window_size')
+ if self.get_flow_graph().get_size() != tuple(new_size):
+ self.get_flow_graph().set_size(*new_size)
+ except: pass
#draw the flow graph
- self.get_flow_graph().update_highlighting()
+ self.get_flow_graph().update_selected()
self.get_flow_graph().queue_draw()
def update_exec_stop(self):
diff --git a/grc/src/gui/DrawingArea.py b/grc/src/gui/DrawingArea.py
index 5258979d8..feb401978 100644
--- a/grc/src/gui/DrawingArea.py
+++ b/grc/src/gui/DrawingArea.py
@@ -40,11 +40,12 @@ class DrawingArea(gtk.DrawingArea):
self._main_window.drawing_area = self
gtk.DrawingArea.__init__(self)
self.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
+ self.connect('configure-event', self._handle_window_configure)
self.connect('expose-event', self._handle_window_expose)
self.connect('motion-notify-event', self._handle_mouse_motion)
self.connect('button-press-event', self._handle_mouse_button_press)
self.connect('button-release-event', self._handle_mouse_button_release)
- self.set_events(
+ self.add_events(
gtk.gdk.BUTTON_PRESS_MASK | \
gtk.gdk.POINTER_MOTION_MASK | \
gtk.gdk.BUTTON_RELEASE_MASK | \
@@ -59,8 +60,6 @@ class DrawingArea(gtk.DrawingArea):
self.get_focus_flag = lambda: self._focus_flag
self.connect('leave-notify-event', self._handle_focus_event, False)
self.connect('enter-notify-event', self._handle_focus_event, True)
- #pixmap for drawing
- self.pixmap = None
##########################################################################
## Handlers
@@ -105,14 +104,19 @@ class DrawingArea(gtk.DrawingArea):
coordinate=(event.x, event.y),
)
+ def _handle_window_configure(self, widget, event):
+ """
+ Called when the window is resized.
+ Create a new pixmap for background buffer.
+ """
+ width, height = self.get_size_request()
+ self.pixmap = gtk.gdk.Pixmap(self.window, width, height, -1)
+
def _handle_window_expose(self, widget, event):
"""
- Called when window is exposed, resized, or queue_draw is called.
+ Called when window is exposed, or queue_draw is called.
+ Double buffering: draw to pixmap, then draw pixmap to window.
"""
gc = self.window.new_gc()
- width, height = self.get_size_request()
- if not self.pixmap or (width, height) != self.pixmap.get_size():
- self.pixmap = gtk.gdk.Pixmap(self.window, width, height, -1)
- #double buffering: draw to pixmap, then draw pixmap
self._main_window.get_flow_graph().draw(gc, self.pixmap)
self.window.draw_drawable(gc, self.pixmap, 0, 0, 0, 0, -1, -1)