basics of printing bindings as HTML
This commit is contained in:
parent
4cd6d52013
commit
405fda66f7
@ -676,6 +676,107 @@ Bindings::save (XMLNode& root)
|
||||
root.add_child_nocopy (*releases);
|
||||
}
|
||||
|
||||
void
|
||||
Bindings::save_all_bindings_as_html (ostream& ostr)
|
||||
{
|
||||
if (bindings.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ostr << "<http>\n<head>\n<title>";
|
||||
ostr << PROGRAM_NAME;
|
||||
ostr << "</title>\n</head>\n<body>\n";
|
||||
|
||||
for (list<Bindings*>::const_iterator b = bindings.begin(); b != bindings.end(); ++b) {
|
||||
(*b)->save_as_html (ostr);
|
||||
}
|
||||
|
||||
ostr << "</body>\n";
|
||||
ostr << "</http>\n";
|
||||
}
|
||||
|
||||
void
|
||||
Bindings::save_as_html (ostream& ostr) const
|
||||
{
|
||||
ostr << "<h1 class=\"binding-set-name\">";
|
||||
ostr << name();
|
||||
ostr << "</h1>\n";
|
||||
|
||||
if (!press_bindings.empty() || !button_press_bindings.empty()) {
|
||||
|
||||
ostr << "<h2 class=\"action-title\">";
|
||||
ostr << _("Press");
|
||||
ostr << "</h2>\n";
|
||||
|
||||
if (!press_bindings.empty()) {
|
||||
|
||||
ostr << "<dl class=\"key-binding\">\n";
|
||||
|
||||
for (KeybindingMap::const_iterator k = press_bindings.begin(); k != press_bindings.end(); ++k) {
|
||||
if (k->first.name().empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RefPtr<Action> action;
|
||||
|
||||
if (k->second.action) {
|
||||
action = k->second.action;
|
||||
} else {
|
||||
if (_action_map) {
|
||||
action = _action_map->find_action (k->second.action_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!action) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ostr << "<dt class=\"key-name\">" << k->first.name() << "</dt>\n";
|
||||
ostr << "<dd class=\"key-action\">" << action->get_label() << "</dd>\n";
|
||||
}
|
||||
|
||||
ostr << "</dl>\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!release_bindings.empty() || !release_bindings.empty()) {
|
||||
|
||||
ostr << "<h2 class=\"action-title\">";
|
||||
ostr << _("Release");
|
||||
ostr << "</h2>\n";
|
||||
|
||||
if (!release_bindings.empty()) {
|
||||
ostr << "<dl class=\"key-binding\">\n";
|
||||
|
||||
for (KeybindingMap::const_iterator k = release_bindings.begin(); k != release_bindings.end(); ++k) {
|
||||
|
||||
if (k->first.name().empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RefPtr<Action> action;
|
||||
|
||||
if (k->second.action) {
|
||||
action = k->second.action;
|
||||
} else {
|
||||
if (_action_map) {
|
||||
action = _action_map->find_action (k->second.action_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!action) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ostr << "<dt class=\"key-name\">" << k->first.name() << "</dt>\n";
|
||||
ostr << "<dd class=\"key-action\">" << action->get_label() << "</dd>\n";
|
||||
}
|
||||
|
||||
ostr << "</dl>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Bindings::load (XMLNode const& node)
|
||||
{
|
||||
|
@ -180,6 +180,7 @@ class LIBGTKMM2EXT_API Bindings {
|
||||
bool load (XMLNode const& node);
|
||||
void load_operation (XMLNode const& node);
|
||||
void save (XMLNode& root);
|
||||
void save_as_html (std::ostream&) const;
|
||||
|
||||
/* GTK has the following position a Gtk::Action:
|
||||
*
|
||||
@ -209,6 +210,7 @@ class LIBGTKMM2EXT_API Bindings {
|
||||
static std::list<Bindings*> bindings;
|
||||
static Bindings* get_bindings (std::string const& name, ActionMap&);
|
||||
static void associate_all ();
|
||||
static void save_all_bindings_as_html (std::ostream&);
|
||||
|
||||
static PBD::Signal1<void,Bindings*> BindingsChanged;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user