Browse Source

Merge branch 'breakpoint_onclick_squashed' of https://github.com/d3rrial/jucipp

merge-requests/365/head
eidheim 9 years ago
parent
commit
74175f50bd
  1. 25
      src/source.cc
  2. 2
      src/source.h

25
src/source.cc

@ -4,6 +4,7 @@
#include "terminal.h"
#include "info.h"
#include "directories.h"
#include "project.h"
#include <gtksourceview/gtksource.h>
#include <boost/property_tree/json_parser.hpp>
#include <boost/spirit/home/qi/char.hpp>
@ -144,6 +145,15 @@ Source::View::View(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::L
set_info(info);
});
signal_realize().connect([this] {
auto gutter=get_gutter(Gtk::TextWindowType::TEXT_WINDOW_LEFT);
auto render=gutter->get_renderer_at_pos(30, 0);
if(render)
render->signal_activate().connect([this](const Gtk::TextIter& iter, const Gdk::Rectangle&, GdkEvent*) {
Source::View::toggle_breakpoint(iter.get_line());
});
});
set_tooltip_and_dialog_events();
if(language && (language->get_id()=="chdr" || language->get_id()=="cpphdr" || language->get_id()=="c" ||
@ -522,6 +532,21 @@ void Source::View::configure() {
}
}
void Source::View::toggle_breakpoint(int line_nr){
if(get_source_buffer()->get_source_marks_at_line(line_nr, "debug_breakpoint").size()>0) {
auto start_iter=get_buffer()->get_iter_at_line(line_nr);
auto end_iter=get_iter_at_line_end(line_nr);
get_source_buffer()->remove_source_marks(start_iter, end_iter, "debug_breakpoint");
if(Project::current && Project::debugging)
Project::current->debug_remove_breakpoint(file_path, line_nr+1, get_buffer()->get_line_count()+1);
}
else {
get_source_buffer()->create_source_mark("debug_breakpoint", get_buffer()->get_iter_at_line(line_nr));
if(Project::current && Project::debugging)
Project::current->debug_add_breakpoint(file_path, line_nr+1);
}
}
void Source::View::set_tooltip_and_dialog_events() {
get_buffer()->signal_changed().connect([this] {
hide_tooltips();

2
src/source.h

@ -46,6 +46,8 @@ namespace Source {
virtual bool save(const std::vector<Source::View*> &views);
void configure() override;
void toggle_breakpoint(int line_nr);
void search_highlight(const std::string &text, bool case_sensitive, bool regex);
std::function<void(int number)> update_search_occurrences;
void search_forward();

Loading…
Cancel
Save