mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
use Gtkmm2ext::BindingSet inside libgtkmm2ext
This commit is contained in:
parent
9472ca1a14
commit
effe0bd879
3 changed files with 26 additions and 10 deletions
|
|
@ -1158,16 +1158,22 @@ std::ostream& operator<<(std::ostream& out, Gtkmm2ext::KeyboardKey const & k) {
|
|||
<< hex << k.state() << dec << ' ' << show_gdk_event_state (k.state());
|
||||
}
|
||||
|
||||
void
|
||||
set_widget_bindings (Gtk::Widget& w, Bindings& b, char const * const name)
|
||||
static void
|
||||
delete_binding_set (void* p)
|
||||
{
|
||||
BindingSet* bs = new BindingSet;
|
||||
bs->push_back (&b);
|
||||
w.set_data (name, bs);
|
||||
delete (BindingSet*) p;
|
||||
}
|
||||
|
||||
void
|
||||
set_widget_bindings (Gtk::Widget& w, BindingSet& bs, char const * const name)
|
||||
Gtkmm2ext::set_widget_bindings (Gtk::Widget& w, Bindings& b, char const * const name)
|
||||
{
|
||||
BindingSet* bs = new BindingSet;
|
||||
bs->push_back (&b);
|
||||
g_object_set_data_full (G_OBJECT(w.gobj()), name, bs, (GDestroyNotify) delete_binding_set);
|
||||
}
|
||||
|
||||
void
|
||||
Gtkmm2ext::set_widget_bindings (Gtk::Widget& w, BindingSet& bs, char const * const name)
|
||||
{
|
||||
w.set_data (name, &bs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -387,17 +387,25 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
|
|||
if (action) {
|
||||
/* get_bindings_from_widget_hierarchy */
|
||||
Widget* ww = w;
|
||||
Bindings* bindings = NULL;
|
||||
BindingSet* binding_set = nullptr;
|
||||
do {
|
||||
bindings = (Bindings*) ww->get_data ("ardour-bindings");
|
||||
if (bindings) {
|
||||
binding_set = (BindingSet*) ww->get_data ("ardour-bindings");
|
||||
if (binding_set) {
|
||||
break;
|
||||
}
|
||||
ww = ww->get_parent ();
|
||||
} while (ww);
|
||||
|
||||
if (!bindings) {
|
||||
Bindings* bindings;
|
||||
|
||||
if (!binding_set) {
|
||||
bindings = global_bindings;
|
||||
} else {
|
||||
/* Use only the first bindings for the widget when
|
||||
looking up keys.
|
||||
*/
|
||||
assert (!binding_set->empty());
|
||||
bindings = binding_set->front ();
|
||||
}
|
||||
|
||||
if (bindings) {
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ typedef std::vector<Bindings*> BindingSet;
|
|||
void set_widget_bindings (Gtk::Widget&, Bindings&, char const * const name);
|
||||
void set_widget_bindings (Gtk::Widget&, BindingSet&, char const * const name);
|
||||
|
||||
static char const * const ARDOUR_BINDING_KEY = "ardour-bindings";
|
||||
|
||||
} // namespace
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, Gtkmm2ext::KeyboardKey const & k);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue