Browse Source

Now only reparse clang files if a header is saved.

merge-requests/365/head
eidheim 10 years ago
parent
commit
f468a601d5
  1. 10
      src/notebook.cc
  2. 2
      src/source.cc
  3. 1
      src/source.h
  4. 2
      src/window.cc

10
src/notebook.cc

@ -165,10 +165,12 @@ bool Notebook::save(int page, bool reparse_needed) {
if(juci::filesystem::write(view->file_path, view->get_buffer())) { if(juci::filesystem::write(view->file_path, view->get_buffer())) {
if(reparse_needed) { if(reparse_needed) {
if(auto clang_view=dynamic_cast<Source::ClangView*>(view)) { if(auto clang_view=dynamic_cast<Source::ClangView*>(view)) {
for(auto a_view: source_views) { if(clang_view->language->get_id()=="chdr" || clang_view->language->get_id()=="cpphdr") {
if(auto a_clang_view=dynamic_cast<Source::ClangView*>(a_view)) { for(auto a_view: source_views) {
if(clang_view!=a_clang_view) if(auto a_clang_view=dynamic_cast<Source::ClangView*>(a_view)) {
a_clang_view->reparse_needed=true; if(clang_view!=a_clang_view)
a_clang_view->reparse_needed=true;
}
} }
} }
} }

2
src/source.cc

@ -79,7 +79,7 @@ std::string Source::FixIt::string() {
////////////// //////////////
AspellConfig* Source::View::spellcheck_config=NULL; AspellConfig* Source::View::spellcheck_config=NULL;
Source::View::View(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language): file_path(file_path) { Source::View::View(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language): file_path(file_path), language(language) {
get_source_buffer()->begin_not_undoable_action(); get_source_buffer()->begin_not_undoable_action();
if(language) { if(language) {
if(juci::filesystem::read_non_utf8(file_path, get_buffer())==-1) if(juci::filesystem::read_non_utf8(file_path, get_buffer())==-1)

1
src/source.h

@ -98,6 +98,7 @@ namespace Source {
void paste(); void paste();
boost::filesystem::path file_path; boost::filesystem::path file_path;
Glib::RefPtr<Gsv::Language> language;
std::function<std::pair<std::string, clang::Offset>()> get_declaration_location; std::function<std::pair<std::string, clang::Offset>()> get_declaration_location;
std::function<void()> goto_method; std::function<void()> goto_method;

2
src/window.cc

@ -303,7 +303,7 @@ void Window::create_menu() {
} }
} }
}); });
menu.action_group->add(Gtk::Action::create("SourceApplyFixIts", "Apply Fix Its"), Gtk::AccelKey(menu.key_map["source_apply_fix_its"]), [this]() { menu.action_group->add(Gtk::Action::create("SourceApplyFixIts", "Apply Fix-Its"), Gtk::AccelKey(menu.key_map["source_apply_fix_its"]), [this]() {
if(notebook.get_current_page()!=-1) { if(notebook.get_current_page()!=-1) {
if(notebook.get_current_view()->apply_fix_its) { if(notebook.get_current_view()->apply_fix_its) {
notebook.get_current_view()->apply_fix_its(); notebook.get_current_view()->apply_fix_its();

Loading…
Cancel
Save