mirror of
https://github.com/tromey/gdb-gui.git
synced 2026-01-04 23:50:08 +01:00
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.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtksourceview 3.0 -->
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-requires gtksourceview 3.0 -->
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -132,15 +132,18 @@
|
||||
<object class="GtkSourceView" id="view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="left_margin">2</property>
|
||||
<property name="right_margin">2</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<property name="show_line_marks">True</property>
|
||||
<property name="tab_width">4</property>
|
||||
<property name="auto_indent">True</property>
|
||||
<property name="highlight_current_line">True</property>
|
||||
<property name="indent_on_tab">False</property>
|
||||
<signal name="line-mark-activated" handler="line_mark_activated" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user