From 60f85cac42cdad6603869ffe9c2da9a8dc9a6f61 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 14 Nov 2012 23:23:53 +0000 Subject: [PATCH] provide the ability to enable + disable tooltips git-svn-id: svn://localhost/ardour2/branches/3.0@13505 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_actions.cc | 10 ++++++++++ gtk2_ardour/rc_option_editor.cc | 8 ++++++++ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/gtkmm2ext/gtkmm2ext/utils.h | 2 ++ libs/gtkmm2ext/utils.cc | 12 ++++++++++++ 5 files changed, 33 insertions(+) diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index a8b9f0da0c..b2f11bb367 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -23,6 +23,7 @@ #include "pbd/file_utils.h" #include "gtkmm2ext/tearoff.h" +#include "gtkmm2ext/utils.h" #include "ardour/filesystem_paths.h" #include "ardour/profile.h" @@ -1489,6 +1490,15 @@ Editor::parameter_changed (std::string p) if (_routes) { _routes->reset_remote_control_ids (); } + } else if (p == "use-tooltips") { + + /* this doesn't really belong here but it has to go somewhere */ + + if (Config->get_use_tooltips()) { + Gtkmm2ext::enable_tooltips (); + } else { + Gtkmm2ext::disable_tooltips (); + } } } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 978cea87cc..c52764d8fe 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1707,6 +1707,14 @@ RCOptionEditor::RCOptionEditor () sigc::mem_fun (*_rc_config, &RCConfiguration::set_widget_prelight) )); + add_option (S_("GUI"), + new BoolOption ( + "use-tooltips", + _("Show tooltips if mouse hovers over a control"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_tooltips), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_tooltips) + )); + #ifndef GTKOSX /* font scaling does nothing with GDK/Quartz */ add_option (S_("GUI"), new FontScalingOptions (_rc_config)); diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index a8912e3ef9..ef697b4043 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -202,6 +202,7 @@ CONFIG_VARIABLE (DenormalModel, denormal_model, "denormal-model", DenormalFTZDAZ CONFIG_VARIABLE (bool, show_zoom_tools, "show-zoom-tools", true) CONFIG_VARIABLE (bool, widget_prelight, "widget-prelight", true) +CONFIG_VARIABLE (bool, use_tooltips, "use-tooltips", true) CONFIG_VARIABLE (std::string, mixer_strip_visibility, "mixer-strip-visibility", "PhaseInvert,SoloSafe,SoloIsolated,Group,MeterPoint") CONFIG_VARIABLE (bool, allow_non_quarter_pulse, "allow-non-quarter-pulse", false) CONFIG_VARIABLE (bool, show_region_gain, "show-region-gain", false) diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index c4c9a4125c..1b0a9f5725 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -110,6 +110,8 @@ namespace Gtkmm2ext { Gtk::Label* left_aligned_label (std::string const &); void set_no_tooltip_whatsoever (Gtk::Widget &); + void enable_tooltips (); + void disable_tooltips (); }; #endif /* __gtkmm2ext_utils_h__ */ diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 11c5b90722..c0c7a88362 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -650,3 +650,15 @@ Gtkmm2ext::set_no_tooltip_whatsoever (Gtk::Widget& w) w.property_has_tooltip() = true; w.signal_query_tooltip().connect (sigc::ptr_fun (make_null_tooltip)); } + +void +Gtkmm2ext::enable_tooltips () +{ + gtk_rc_parse_string ("gtk-enable-tooltips = 1"); +} + +void +Gtkmm2ext::disable_tooltips () +{ + gtk_rc_parse_string ("gtk-enable-tooltips = 0"); +}