Browse Source

Now only reparse clang files if a header is saved.

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

2
src/notebook.cc

@ -165,6 +165,7 @@ bool Notebook::save(int page, bool reparse_needed) {
if(juci::filesystem::write(view->file_path, view->get_buffer())) {
if(reparse_needed) {
if(auto clang_view=dynamic_cast<Source::ClangView*>(view)) {
if(clang_view->language->get_id()=="chdr" || clang_view->language->get_id()=="cpphdr") {
for(auto a_view: source_views) {
if(auto a_clang_view=dynamic_cast<Source::ClangView*>(a_view)) {
if(clang_view!=a_clang_view)
@ -173,6 +174,7 @@ bool Notebook::save(int page, bool reparse_needed) {
}
}
}
}
view->get_buffer()->set_modified(false);
Singleton::terminal()->print("File saved to: " +view->file_path.string()+"\n");

2
src/source.cc

@ -79,7 +79,7 @@ std::string Source::FixIt::string() {
//////////////
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();
if(language) {
if(juci::filesystem::read_non_utf8(file_path, get_buffer())==-1)

1
src/source.h

@ -98,6 +98,7 @@ namespace Source {
void paste();
boost::filesystem::path file_path;
Glib::RefPtr<Gsv::Language> language;
std::function<std::pair<std::string, clang::Offset>()> get_declaration_location;
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_view()->apply_fix_its) {
notebook.get_current_view()->apply_fix_its();

Loading…
Cancel
Save