summaryrefslogtreecommitdiff
path: root/gtk2_ardour/option_editor.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-12-12 20:39:38 +0100
committerRobin Gareus <robin@gareus.org>2015-12-12 20:39:38 +0100
commitbb7c857a698f1eb208bd83a57eeca2b81b75cdb5 (patch)
treefa5630a19d2660d2ec81fa1e825176ce4c63cd02 /gtk2_ardour/option_editor.cc
parent239ea8670b8f341887bc09bbdd9cb67e1e02b788 (diff)
add rc-config widget to display text-config/paths (read only)
Diffstat (limited to 'gtk2_ardour/option_editor.cc')
-rw-r--r--gtk2_ardour/option_editor.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index cd9ff81d1e..e963726531 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -137,6 +137,45 @@ RcActionButton::add_to_page (OptionEditorPage *p)
}
}
+RcConfigDisplay::RcConfigDisplay (string const & i, string const & n, sigc::slot<string> g, char s)
+ : _get (g)
+ , _id (i)
+ , _sep (s)
+{
+ _label = manage (right_aligned_label (n));
+ _info = manage (new Label);
+ _info-> set_line_wrap (true);
+ set_state_from_config ();
+}
+
+void
+RcConfigDisplay::set_state_from_config ()
+{
+ string p = _get();
+ if (_sep) {
+ std::replace (p.begin(), p.end(), _sep, '\n');
+ }
+ _info->set_text (p);
+}
+
+void
+RcConfigDisplay::parameter_changed (std::string const & p)
+{
+ if (p == _id) {
+ set_state_from_config ();
+ }
+}
+
+void
+RcConfigDisplay::add_to_page (OptionEditorPage *p)
+{
+ int const n = p->table.property_n_rows();
+ int m = n + 1;
+ p->table.resize (m, 3);
+ p->table.attach (*_label, 1, 2, n, n + 1, FILL | EXPAND);
+ p->table.attach (*_info, 2, 3, n, n + 1, FILL | EXPAND);
+}
+
BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
: Option (i, n),