Browse Source

Fixed multiple inheritance in source_clang, making refactor and autocomplete classes testable if needed in the future

merge-requests/365/head
eidheim 10 years ago
parent
commit
16315b5a25
  1. 8
      src/source_clang.cc
  2. 5
      src/source_clang.h

8
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<Gsv::Language> language):
Source::ClangViewParse(file_path, language), autocomplete_state(AutocompleteState::IDLE) {
get_buffer()->signal_changed().connect([this](){ get_buffer()->signal_changed().connect([this](){
if(autocomplete_dialog && autocomplete_dialog->shown) if(autocomplete_dialog && autocomplete_dialog->shown)
delayed_reparse_connection.disconnect(); 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<Gsv::Language> language) :
Source::ClangViewParse(file_path, language) {
similar_identifiers_tag=get_buffer()->create_tag(); 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) 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<Gsv::Language> language): Source::ClangView::ClangView(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language):
ClangViewParse(file_path, language), ClangViewAutocomplete(), ClangViewRefactor() { ClangViewParse(file_path, language), ClangViewAutocomplete(file_path, language), ClangViewRefactor(file_path, language) {
if(language) { if(language) {
get_source_buffer()->set_highlight_syntax(true); get_source_buffer()->set_highlight_syntax(true);
get_source_buffer()->set_language(language); get_source_buffer()->set_language(language);

5
src/source_clang.h

@ -24,7 +24,6 @@ namespace Source {
void soft_reparse() override; void soft_reparse() override;
protected: protected:
ClangViewParse() : View("", Glib::RefPtr<Gsv::Language>()) {}
Dispatcher dispatcher; Dispatcher dispatcher;
void parse_initialize(); void parse_initialize();
std::unique_ptr<clang::TranslationUnit> clang_tu; std::unique_ptr<clang::TranslationUnit> clang_tu;
@ -68,7 +67,7 @@ namespace Source {
std::string brief_comments; std::string brief_comments;
}; };
ClangViewAutocomplete(); ClangViewAutocomplete(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
virtual void async_delete(); virtual void async_delete();
bool full_reparse() override; bool full_reparse() override;
@ -109,7 +108,7 @@ namespace Source {
clang::Cursor cursor; clang::Cursor cursor;
}; };
public: public:
ClangViewRefactor(); ClangViewRefactor(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
protected: protected:
sigc::connection delayed_tag_similar_identifiers_connection; sigc::connection delayed_tag_similar_identifiers_connection;
private: private:

Loading…
Cancel
Save