mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
basics of printing bindings as HTML
This commit is contained in:
parent
4cd6d52013
commit
405fda66f7
2 changed files with 103 additions and 0 deletions
|
|
@ -676,6 +676,107 @@ Bindings::save (XMLNode& root)
|
||||||
root.add_child_nocopy (*releases);
|
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
|
bool
|
||||||
Bindings::load (XMLNode const& node)
|
Bindings::load (XMLNode const& node)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ class LIBGTKMM2EXT_API Bindings {
|
||||||
bool load (XMLNode const& node);
|
bool load (XMLNode const& node);
|
||||||
void load_operation (XMLNode const& node);
|
void load_operation (XMLNode const& node);
|
||||||
void save (XMLNode& root);
|
void save (XMLNode& root);
|
||||||
|
void save_as_html (std::ostream&) const;
|
||||||
|
|
||||||
/* GTK has the following position a Gtk::Action:
|
/* GTK has the following position a Gtk::Action:
|
||||||
*
|
*
|
||||||
|
|
@ -209,6 +210,7 @@ class LIBGTKMM2EXT_API Bindings {
|
||||||
static std::list<Bindings*> bindings;
|
static std::list<Bindings*> bindings;
|
||||||
static Bindings* get_bindings (std::string const& name, ActionMap&);
|
static Bindings* get_bindings (std::string const& name, ActionMap&);
|
||||||
static void associate_all ();
|
static void associate_all ();
|
||||||
|
static void save_all_bindings_as_html (std::ostream&);
|
||||||
|
|
||||||
static PBD::Signal1<void,Bindings*> BindingsChanged;
|
static PBD::Signal1<void,Bindings*> BindingsChanged;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue