Browse Source

Minor cleanups. Added override keywords in some header files.

merge-requests/365/head
eidheim 10 years ago
parent
commit
81f50bef10
  1. 4
      src/selectiondialog.h
  2. 2
      src/source.h
  3. 18
      src/source_clang.h
  4. 31
      src/window.cc

4
src/selectiondialog.h

@ -58,13 +58,13 @@ class SelectionDialog : public SelectionDialogBase {
public:
SelectionDialog(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark, bool show_search_entry=true, bool use_markup=false);
bool on_key_press(GdkEventKey* key);
void show();
void show() override;
};
class CompletionDialog : public SelectionDialogBase {
public:
CompletionDialog(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark);
void show();
void show() override;
bool on_key_release(GdkEventKey* key);
bool on_key_press(GdkEventKey* key);

2
src/source.h

@ -104,6 +104,8 @@ namespace Source {
bool soft_reparse_needed=false;
bool full_reparse_needed=false;
virtual void soft_reparse() {}
virtual bool full_reparse() {return true;}
protected:
bool parsed=false;
Tooltips diagnostic_tooltips;

18
src/source_clang.h

@ -22,12 +22,13 @@ namespace Source {
};
ClangViewParse(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language);
virtual void configure();
bool on_key_press_event(GdkEventKey* key) override;
void soft_reparse();
void configure() override;
void soft_reparse() override;
protected:
void init_parse();
bool on_key_press_event(GdkEventKey* key);
std::unique_ptr<clang::TranslationUnit> clang_tu;
std::mutex parsing_mutex;
std::unique_ptr<clang::Tokens> clang_tokens;
@ -38,8 +39,8 @@ namespace Source {
std::atomic<bool> parse_thread_stop;
std::atomic<bool> parse_error;
virtual void show_diagnostic_tooltips(const Gdk::Rectangle &rectangle);
virtual void show_type_tooltips(const Gdk::Rectangle &rectangle);
void show_diagnostic_tooltips(const Gdk::Rectangle &rectangle) override;
void show_type_tooltips(const Gdk::Rectangle &rectangle) override;
boost::regex bracket_regex;
boost::regex no_bracket_statement_regex;
@ -80,10 +81,11 @@ namespace Source {
};
ClangViewAutocomplete(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language);
bool on_key_press_event(GdkEventKey* key) override;
virtual void async_delete();
bool full_reparse();
bool full_reparse() override;
protected:
bool on_key_press_event(GdkEventKey* key);
std::thread autocomplete_thread;
sigc::connection autocomplete_done_connection;
sigc::connection autocomplete_fail_connection;
@ -126,7 +128,7 @@ namespace Source {
class ClangView : public ClangViewRefactor {
public:
ClangView(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language);
virtual void async_delete();
void async_delete() override;
};
}

31
src/window.cc

@ -81,31 +81,30 @@ Window::Window() : compiling(false) {
notebook.signal_switch_page().connect([this](Gtk::Widget* page, guint page_num) {
if(notebook.get_current_page()!=-1) {
auto view=notebook.get_current_view();
if(search_entry_shown && entry_box.labels.size()>0) {
notebook.get_current_view()->update_search_occurrences=[this](int number){
view->update_search_occurrences=[this](int number){
entry_box.labels.begin()->update(0, std::to_string(number));
};
notebook.get_current_view()->search_highlight(last_search, case_sensitive_search, regex_search);
view->search_highlight(last_search, case_sensitive_search, regex_search);
}
activate_menu_items();
Singleton::directories->select(notebook.get_current_view()->file_path);
Singleton::directories->select(view->file_path);
if(auto source_view=dynamic_cast<Source::ClangView*>(notebook.get_current_view())) {
if(source_view->full_reparse_needed) {
if(!source_view->full_reparse())
Singleton::terminal->async_print("Error: failed to reparse "+source_view->file_path.string()+". Please reopen the file manually.\n", true);
source_view->full_reparse_needed=false;
}
else if(source_view->soft_reparse_needed) {
source_view->soft_reparse();
source_view->soft_reparse_needed=false;
}
if(view->full_reparse_needed) {
if(!view->full_reparse())
Singleton::terminal->async_print("Error: failed to reparse "+view->file_path.string()+". Please reopen the file manually.\n", true);
view->full_reparse_needed=false;
}
else if(view->soft_reparse_needed) {
view->soft_reparse();
view->soft_reparse_needed=false;
}
notebook.get_current_view()->set_status(notebook.get_current_view()->status);
notebook.get_current_view()->set_info(notebook.get_current_view()->info);
view->set_status(view->status);
view->set_info(view->info);
}
});
notebook.signal_page_removed().connect([this](Gtk::Widget* page, guint page_num) {
@ -679,7 +678,7 @@ bool Window::on_key_press_event(GdkEventKey *event) {
}
#endif
return Gtk::Window::on_key_press_event(event);
return Gtk::ApplicationWindow::on_key_press_event(event);
}
bool Window::on_delete_event(GdkEventAny *event) {

Loading…
Cancel
Save