diff --git a/CMakeLists.txt b/CMakeLists.txt index a45fc95..bef0c80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(juci) -set(JUCI_VERSION "1.7.2") +set(JUCI_VERSION "1.7.2.1") set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim ") diff --git a/src/config.cpp b/src/config.cpp index 43cdc08..5e4e3b5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -153,6 +153,7 @@ void Config::read(const JSON &cfg) { source.enable_multiple_cursors = source_json.boolean("enable_multiple_cursors", JSON::ParseOptions::accept_string); source.auto_reload_changed_files = source_json.boolean("auto_reload_changed_files", JSON::ParseOptions::accept_string); source.search_for_selection = source_json.boolean("search_for_selection", JSON::ParseOptions::accept_string); + source.tooltip_top_offset = source_json.integer("tooltip_top_offset", JSON::ParseOptions::accept_string); source.clang_format_style = source_json.string("clang_format_style"); source.clang_usages_threads = static_cast(source_json.integer("clang_usages_threads", JSON::ParseOptions::accept_string)); source.clang_tidy_enable = source_json.boolean("clang_tidy_enable", JSON::ParseOptions::accept_string); @@ -289,6 +290,7 @@ std::string Config::default_config() { "enable_multiple_cursors": false, "auto_reload_changed_files": true, "search_for_selection": true, + "tooltip_top_offset": 0, "clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html", "clang_format_style": "ColumnLimit: 0, NamespaceIndentation: All", "clang_tidy_enable_comment": "Enable clang-tidy in new C/C++ buffers", diff --git a/src/config.hpp b/src/config.hpp index a3b6a6f..5d39cc0 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -95,6 +95,7 @@ public: bool enable_multiple_cursors; bool auto_reload_changed_files; bool search_for_selection; + int tooltip_top_offset; std::string clang_format_style; unsigned clang_usages_threads; diff --git a/src/tooltips.cpp b/src/tooltips.cpp index 1643666..7b9826b 100644 --- a/src/tooltips.cpp +++ b/src/tooltips.cpp @@ -266,9 +266,9 @@ void Tooltip::show(bool disregard_drawn, const std::function &on_motion) view->get_window(Gtk::TextWindowType::TEXT_WINDOW_TEXT)->get_root_coords(window_x, window_y, root_x, root_y); root_x -= 3; // -1xpadding - if(root_y < size.second) - root_x += visible_rect.get_width() * 0.1; // Adjust tooltip right if it might be above cursor - rectangle.set_y(std::max(0, root_y - size.second)); // Move tooptip down if it is above screen + if(root_y < size.second + Config::get().source.tooltip_top_offset) + root_x += visible_rect.get_width() * 0.1; // Adjust tooltip right if it might be above cursor + rectangle.set_y(std::max(Config::get().source.tooltip_top_offset, root_y - size.second)); // Move tooptip down if it is above screen // Move tooltip left if it is right of screen auto screen_width = Gdk::Screen::get_default()->get_width(); @@ -282,7 +282,7 @@ void Tooltip::show(bool disregard_drawn, const std::function &on_motion) if(Tooltips::drawn_tooltips_rectangle.get_width() != 0) { if(rectangle.intersects(Tooltips::drawn_tooltips_rectangle)) { // Put tooltip above other tooltips int new_y = Tooltips::drawn_tooltips_rectangle.get_y() - size.second; - if(new_y >= 0) + if(new_y >= Config::get().source.tooltip_top_offset) rectangle.set_y(new_y); else { // Put tooltip to the right if the tooltip would be placed above the screen int new_x = Tooltips::drawn_tooltips_rectangle.get_x() + Tooltips::drawn_tooltips_rectangle.get_width() + 2;