mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-12 00:16:25 +01:00
backport use of GtkAccelGroup::get_label() from a3 so that we use "nice" accelerator key descriptions in the key editor (i.e. "cauliflower" icon instead of "Command" or "Primary")
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@11513 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
345eca0fcf
commit
eeffd3faa9
3 changed files with 20 additions and 25 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include "actions.h"
|
||||
#include "opts.h"
|
||||
#include "i18n.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Gtk;
|
||||
|
|
@ -240,21 +241,29 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve
|
|||
|
||||
names.push_back (label);
|
||||
paths.push_back (accel_path);
|
||||
|
||||
|
||||
AccelKey key;
|
||||
bool known = lookup_entry (accel_path, key);
|
||||
|
||||
if (known) {
|
||||
keys.push_back (ui_manager->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod())));
|
||||
} else {
|
||||
keys.push_back (unbound_string);
|
||||
}
|
||||
|
||||
keys.push_back (get_key_representation (accel_path, key));
|
||||
bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
ActionManager::get_key_representation (const string& accel_path, AccelKey& key)
|
||||
{
|
||||
bool known = lookup_entry (accel_path, key);
|
||||
|
||||
if (known) {
|
||||
|
||||
uint32_t k = key.get_key();
|
||||
possibly_translate_keyval_to_make_legal_accelerator (k);
|
||||
key = AccelKey (k, Gdk::ModifierType (key.get_mod()));
|
||||
return ui_manager->get_accel_group()->get_label (key.get_key(), Gdk::ModifierType (key.get_mod()));
|
||||
}
|
||||
|
||||
return unbound_string;
|
||||
}
|
||||
|
||||
void
|
||||
ActionManager::add_action_group (RefPtr<ActionGroup> grp)
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ class ActionManager
|
|||
std::vector<Gtk::AccelKey>& bindings);
|
||||
|
||||
static void uncheck_toggleaction (const char * actionname);
|
||||
|
||||
static string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key);
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_actions_h__ */
|
||||
|
|
|
|||
|
|
@ -255,23 +255,7 @@ KeyEditor::populate ()
|
|||
if (*k == ActionManager::unbound_string) {
|
||||
row[columns.binding] = string();
|
||||
} else {
|
||||
|
||||
#ifdef GTKOSX
|
||||
string label = (*k);
|
||||
|
||||
/* Gtk/Quartz maps:
|
||||
NSAlternate/NSOption key to Mod1
|
||||
NSCommand key to Meta
|
||||
*/
|
||||
|
||||
replace_all (label, "<Meta>", _("Command-"));
|
||||
replace_all (label, "<Alt>", _("Option-"));
|
||||
replace_all (label, "<Shift>", _("Shift-"));
|
||||
replace_all (label, "<Control>", _("Control-"));
|
||||
row[columns.binding] = label;
|
||||
#else
|
||||
row[columns.binding] = (*k);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue