Browse Source

Minor autocomplete fixes.

merge-requests/365/head
eidheim 11 years ago
parent
commit
4f7afedcc4
  1. 2
      juci/selectiondialog.cc
  2. 12
      juci/source.cc
  3. 3
      juci/source.h

2
juci/selectiondialog.cc

@ -61,8 +61,8 @@ void SelectionDialog::show() {
} }
void SelectionDialog::hide() { void SelectionDialog::hide() {
window->hide();
shown=false; shown=false;
window->hide();
if(tooltips) if(tooltips)
tooltips->hide(); tooltips->hide();
} }

12
juci/source.cc

@ -580,7 +580,6 @@ bool Source::ClangView::on_key_press_event(GdkEventKey* key) {
////////////////////////////// //////////////////////////////
//// ClangViewAutocomplete /// //// ClangViewAutocomplete ///
////////////////////////////// //////////////////////////////
//TODO: Raise autocomplete window after alt-tab back to application
Source::ClangViewAutocomplete::ClangViewAutocomplete(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal): Source::ClangViewAutocomplete::ClangViewAutocomplete(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal):
Source::ClangView(file_path, project_path, terminal), selection_dialog(*this), autocomplete_cancel_starting(false) { Source::ClangView(file_path, project_path, terminal), selection_dialog(*this), autocomplete_cancel_starting(false) {
get_buffer()->signal_changed().connect([this](){ get_buffer()->signal_changed().connect([this](){
@ -625,7 +624,7 @@ Source::ClangView(file_path, project_path, terminal), selection_dialog(*this), a
}); });
signal_scroll_event().connect([this](GdkEventScroll* event){ signal_scroll_event().connect([this](GdkEventScroll* event){
if(selection_dialog.shown) if(selection_dialog.shown)
selection_dialog.move(); selection_dialog.hide();
return false; return false;
}, false); }, false);
signal_key_release_event().connect([this](GdkEventKey* key){ signal_key_release_event().connect([this](GdkEventKey* key){
@ -647,6 +646,15 @@ bool Source::ClangViewAutocomplete::on_key_press_event(GdkEventKey *key) {
} }
return ClangView::on_key_press_event(key); return ClangView::on_key_press_event(key);
} }
bool Source::ClangViewAutocomplete::on_focus_out_event(GdkEventFocus* event) {
if(selection_dialog.shown) {
selection_dialog.hide();
}
return Source::ClangView::on_focus_out_event(event);
}
void Source::ClangViewAutocomplete::autocomplete() { void Source::ClangViewAutocomplete::autocomplete() {
if(!autocomplete_starting) { if(!autocomplete_starting) {
autocomplete_starting=true; autocomplete_starting=true;

3
juci/source.h

@ -83,6 +83,7 @@ namespace Source {
std::mutex parsing_mutex; std::mutex parsing_mutex;
sigc::connection delayed_reparse_connection; sigc::connection delayed_reparse_connection;
bool on_key_press_event(GdkEventKey* key); bool on_key_press_event(GdkEventKey* key);
bool on_focus_out_event(GdkEventFocus* event);
private: private:
// inits the syntax highligthing on file open // inits the syntax highligthing on file open
void init_syntax_highlighting(const std::map<std::string, std::string> void init_syntax_highlighting(const std::map<std::string, std::string>
@ -99,7 +100,6 @@ namespace Source {
bool on_motion_notify_event(GdkEventMotion* event); bool on_motion_notify_event(GdkEventMotion* event);
void on_mark_set(const Gtk::TextBuffer::iterator& iterator, const Glib::RefPtr<Gtk::TextBuffer::Mark>& mark); void on_mark_set(const Gtk::TextBuffer::iterator& iterator, const Glib::RefPtr<Gtk::TextBuffer::Mark>& mark);
sigc::connection delayed_tooltips_connection; sigc::connection delayed_tooltips_connection;
bool on_focus_out_event(GdkEventFocus* event);
bool on_scroll_event(GdkEventScroll* event); bool on_scroll_event(GdkEventScroll* event);
static clang::Index clang_index; static clang::Index clang_index;
std::unique_ptr<clang::Tokens> clang_tokens; std::unique_ptr<clang::Tokens> clang_tokens;
@ -128,6 +128,7 @@ namespace Source {
ClangViewAutocomplete(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal); ClangViewAutocomplete(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal);
protected: protected:
bool on_key_press_event(GdkEventKey* key); bool on_key_press_event(GdkEventKey* key);
bool on_focus_out_event(GdkEventFocus* event);
private: private:
void autocomplete(); void autocomplete();
SelectionDialog selection_dialog; SelectionDialog selection_dialog;

Loading…
Cancel
Save