Add keyboard shortcut to tooltip text where possible.

git-svn-id: svn://localhost/ardour2/branches/3.0@6657 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2010-02-09 00:50:24 +00:00
parent 535d602374
commit b5148d93d5
23 changed files with 148 additions and 103 deletions

View file

@ -38,6 +38,7 @@
#include <gtkmm2ext/popup.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
#include <gtkmm2ext/actions.h>
#include "i18n.h"
@ -297,17 +298,40 @@ UI::touch_display (Touchable *display)
send_request (req);
}
void
UI::set_tip (Widget &w, const gchar *tip)
{
set_tip(&w, tip, "");
}
void
UI::set_tip (Widget &w, const std::string& tip)
{
set_tip(&w, tip.c_str(), "");
}
void
UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
{
UIRequest *req = get_request (SetTip);
std::string msg(tip);
Glib::RefPtr<Gtk::Action> action = w->get_action();
if (action) {
Gtk::AccelKey key;
bool has_key = ActionManager::lookup_entry(action->get_accel_path(), key);
if (has_key && key.get_abbrev() != "") {
msg.append("\n\n Key: ").append(key.get_abbrev());
}
}
if (req == 0) {
return;
}
req->widget = w;
req->msg = tip;
req->msg = msg.c_str();
req->msg2 = hlp;
send_request (req);

View file

@ -113,7 +113,9 @@ class UI : public Receiver, public AbstractUI<UIRequest>
void flush_pending ();
void toggle_errors ();
void touch_display (Touchable *);
void set_tip (Gtk::Widget *w, const gchar *tip, const gchar *hlp);
void set_tip (Gtk::Widget &w, const gchar *tip);
void set_tip (Gtk::Widget &w, const std::string &tip);
void set_tip (Gtk::Widget *w, const gchar *tip, const gchar *hlp="");
void idle_add (int (*func)(void *), void *arg);
Gtk::Main& main() const { return *theMain; }