From 16315b5a2562687337c6ac88999a8afbc6c1d707 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 7 Jun 2016 20:33:47 +0200 Subject: [PATCH] Fixed multiple inheritance in source_clang, making refactor and autocomplete classes testable if needed in the future --- src/source_clang.cc | 8 +++++--- src/source_clang.h | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/source_clang.cc b/src/source_clang.cc index 4b9c2ca..b4cf264 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -487,7 +487,8 @@ void Source::ClangViewParse::show_type_tooltips(const Gdk::Rectangle &rectangle) } -Source::ClangViewAutocomplete::ClangViewAutocomplete(): autocomplete_state(AutocompleteState::IDLE) { +Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::path &file_path, Glib::RefPtr language): + Source::ClangViewParse(file_path, language), autocomplete_state(AutocompleteState::IDLE) { get_buffer()->signal_changed().connect([this](){ if(autocomplete_dialog && autocomplete_dialog->shown) delayed_reparse_connection.disconnect(); @@ -848,7 +849,8 @@ bool Source::ClangViewAutocomplete::full_reparse() { } -Source::ClangViewRefactor::ClangViewRefactor() { +Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file_path, Glib::RefPtr language) : + Source::ClangViewParse(file_path, language) { similar_identifiers_tag=get_buffer()->create_tag(); similar_identifiers_tag->property_weight()=1000; //TODO: replace with Pango::WEIGHT_ULTRAHEAVY in 2016 or so (when Ubuntu 14 is history) @@ -1356,7 +1358,7 @@ void Source::ClangViewRefactor::tag_similar_identifiers(const Identifier &identi Source::ClangView::ClangView(const boost::filesystem::path &file_path, Glib::RefPtr language): - ClangViewParse(file_path, language), ClangViewAutocomplete(), ClangViewRefactor() { + ClangViewParse(file_path, language), ClangViewAutocomplete(file_path, language), ClangViewRefactor(file_path, language) { if(language) { get_source_buffer()->set_highlight_syntax(true); get_source_buffer()->set_language(language); diff --git a/src/source_clang.h b/src/source_clang.h index 85686bb..b9b74ad 100644 --- a/src/source_clang.h +++ b/src/source_clang.h @@ -24,7 +24,6 @@ namespace Source { void soft_reparse() override; protected: - ClangViewParse() : View("", Glib::RefPtr()) {} Dispatcher dispatcher; void parse_initialize(); std::unique_ptr clang_tu; @@ -68,7 +67,7 @@ namespace Source { std::string brief_comments; }; - ClangViewAutocomplete(); + ClangViewAutocomplete(const boost::filesystem::path &file_path, Glib::RefPtr language); virtual void async_delete(); bool full_reparse() override; @@ -109,7 +108,7 @@ namespace Source { clang::Cursor cursor; }; public: - ClangViewRefactor(); + ClangViewRefactor(const boost::filesystem::path &file_path, Glib::RefPtr language); protected: sigc::connection delayed_tag_similar_identifiers_connection; private: