From 7020755290f5de84778010189601d83da3aa72cf Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 14 Jun 2013 12:04:16 -0600 Subject: [PATCH] allow clicking to set a breakpoint Clicking in the left gutter of the source window will set a breakpoint. Currently the effect of this is somewhat invisible, because there is no way for the GUI to notice when breakpoints are created. --- gui/source.py | 12 +++++++++++- gui/sourcewindow.xml | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gui/source.py b/gui/source.py index 488bd7a..3d49f21 100644 --- a/gui/source.py +++ b/gui/source.py @@ -22,7 +22,7 @@ import gui.startup import os.path import gui.toplevel -from gi.repository import Gtk, GtkSource, GObject +from gi.repository import Gtk, GtkSource, GObject, Gdk class BufferManager: def __init__(self): @@ -45,6 +45,7 @@ class BufferManager: buff.set_text(contents) buff.end_not_undoable_action() buff.set_modified(False) + buff.filename = filename self.buffers[filename] = buff return buff @@ -168,6 +169,15 @@ class SourceWindow(Toplevel): def deleted(self, widget, event): lru_handler.remove(self) + def line_mark_activated(self, view, textiter, event): + if event.type != Gdk.EventType.BUTTON_PRESS: + return + if event.button.get_button()[1] != 1: + return + fun = Invoker("break %s:%d" % (self.view.get_buffer().filename, + textiter.get_line() + 1)) + fun() + def _do_scroll(self, buff, srcline): buff.place_cursor(buff.get_iter_at_line(srcline)) self.view.scroll_mark_onscreen(buff.get_insert()) diff --git a/gui/sourcewindow.xml b/gui/sourcewindow.xml index 798129c..79ebf3c 100644 --- a/gui/sourcewindow.xml +++ b/gui/sourcewindow.xml @@ -1,7 +1,7 @@ - + True False @@ -132,15 +132,18 @@ True True + GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK True False 2 2 False + True 4 True True False +