Browse Source

Minor fixes to tooltip, now hides more often.

merge-requests/365/head
eidheim 11 years ago
parent
commit
6e99d4bcc9
  1. 2
      juci/selectiondialog.cc
  2. 7
      juci/source.cc
  3. 1
      juci/source.h
  4. 7
      juci/tooltips.cc
  5. 2
      juci/tooltips.h
  6. 2
      juci/window.cc

2
juci/selectiondialog.cc

@ -2,6 +2,8 @@
SelectionDialog::SelectionDialog(Gtk::TextView& text_view): Gtk::Dialog(), text_view(text_view), SelectionDialog::SelectionDialog(Gtk::TextView& text_view): Gtk::Dialog(), text_view(text_view),
list_view_text(1, false, Gtk::SelectionMode::SELECTION_SINGLE) { list_view_text(1, false, Gtk::SelectionMode::SELECTION_SINGLE) {
property_decorated()=false;
set_skip_taskbar_hint(true);
scrolled_window.set_policy(Gtk::PolicyType::POLICY_NEVER, Gtk::PolicyType::POLICY_NEVER); scrolled_window.set_policy(Gtk::PolicyType::POLICY_NEVER, Gtk::PolicyType::POLICY_NEVER);
list_view_text.set_enable_search(true); list_view_text.set_enable_search(true);
list_view_text.set_headers_visible(false); list_view_text.set_headers_visible(false);

7
juci/source.cc

@ -218,6 +218,7 @@ parse_thread_go(true), parse_thread_mapped(false), parse_thread_stop(false) {
signal_key_press_event().connect(sigc::mem_fun(*this, &Source::ClangView::on_key_press), false); signal_key_press_event().connect(sigc::mem_fun(*this, &Source::ClangView::on_key_press), false);
signal_key_release_event().connect(sigc::mem_fun(*this, &Source::ClangView::on_key_release), false); signal_key_release_event().connect(sigc::mem_fun(*this, &Source::ClangView::on_key_release), false);
signal_motion_notify_event().connect(sigc::mem_fun(*this, &Source::ClangView::clangview_on_motion_notify_event), false); signal_motion_notify_event().connect(sigc::mem_fun(*this, &Source::ClangView::clangview_on_motion_notify_event), false);
signal_focus_out_event().connect(sigc::mem_fun(*this, &Source::ClangView::clangview_on_focus_out_event), false);
get_buffer()->signal_mark_set().connect(sigc::mem_fun(*this, &Source::ClangView::clangview_on_mark_set), false); get_buffer()->signal_mark_set().connect(sigc::mem_fun(*this, &Source::ClangView::clangview_on_mark_set), false);
} }
@ -438,6 +439,12 @@ void Source::ClangView::clangview_on_mark_set(const Gtk::TextBuffer::iterator& i
} }
} }
bool Source::ClangView::clangview_on_focus_out_event(GdkEventFocus* event) {
diagnostic_tooltips.hide();
type_tooltips.hide();
return false;
}
void Source::ClangView:: void Source::ClangView::
highlight_cursor(clang::Token *token, highlight_cursor(clang::Token *token,
std::vector<Source::Range> *source_ranges) { std::vector<Source::Range> *source_ranges) {

1
juci/source.h

@ -102,6 +102,7 @@ namespace Source {
Tooltips type_tooltips; Tooltips type_tooltips;
bool clangview_on_motion_notify_event(GdkEventMotion* event); bool clangview_on_motion_notify_event(GdkEventMotion* event);
void clangview_on_mark_set(const Gtk::TextBuffer::iterator& iterator, const Glib::RefPtr<Gtk::TextBuffer::Mark>& mark); void clangview_on_mark_set(const Gtk::TextBuffer::iterator& iterator, const Glib::RefPtr<Gtk::TextBuffer::Mark>& mark);
bool clangview_on_focus_out_event(GdkEventFocus* event);
static clang::Index clang_index; static clang::Index clang_index;
std::map<std::string, std::string> get_buffer_map() const; std::map<std::string, std::string> get_buffer_map() const;

7
juci/tooltips.cc

@ -37,6 +37,8 @@ void Tooltip::adjust() {
//init window //init window
window=std::unique_ptr<Gtk::Window>(new Gtk::Window(Gtk::WindowType::WINDOW_POPUP)); window=std::unique_ptr<Gtk::Window>(new Gtk::Window(Gtk::WindowType::WINDOW_POPUP));
window->set_events(Gdk::POINTER_MOTION_MASK);
window->signal_motion_notify_event().connect(sigc::mem_fun(*this, &Tooltip::tooltip_on_motion_notify_event), false);
window->property_decorated()=false; window->property_decorated()=false;
window->set_accept_focus(false); window->set_accept_focus(false);
window->set_skip_taskbar_hint(true); window->set_skip_taskbar_hint(true);
@ -70,6 +72,11 @@ void Tooltip::adjust() {
window->move(rectangle.get_x(), rectangle.get_y()); window->move(rectangle.get_x(), rectangle.get_y());
} }
bool Tooltip::tooltip_on_motion_notify_event(GdkEventMotion* event) {
window->hide();
return false;
}
void Tooltips::show(const Gdk::Rectangle& rectangle) { void Tooltips::show(const Gdk::Rectangle& rectangle) {
for(auto& tooltip: *this) { for(auto& tooltip: *this) {
tooltip.update(); tooltip.update();

2
juci/tooltips.h

@ -15,6 +15,8 @@ public:
Gdk::Rectangle activation_rectangle; Gdk::Rectangle activation_rectangle;
std::unique_ptr<Gtk::Window> window; std::unique_ptr<Gtk::Window> window;
private: private:
bool tooltip_on_motion_notify_event(GdkEventMotion* event);
std::function<Glib::RefPtr<Gtk::TextBuffer>()> get_buffer; std::function<Glib::RefPtr<Gtk::TextBuffer>()> get_buffer;
std::unique_ptr<Gtk::TextView> tooltip_widget; std::unique_ptr<Gtk::TextView> tooltip_widget;
Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark; Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark;

2
juci/window.cc

@ -14,7 +14,7 @@ Window::Window() :
INFO("Create Window"); INFO("Create Window");
set_title("juCi++"); set_title("juCi++");
set_default_size(600, 400); set_default_size(600, 400);
set_events(Gdk::POINTER_MOTION_MASK); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK);
add(window_box_); add(window_box_);
keybindings_.action_group_menu()->add(Gtk::Action::create("FileQuit", keybindings_.action_group_menu()->add(Gtk::Action::create("FileQuit",
"Quit juCi++"), "Quit juCi++"),

Loading…
Cancel
Save