mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
add rc-config widget to display text-config/paths (read only)
This commit is contained in:
parent
239ea8670b
commit
bb7c857a69
2 changed files with 55 additions and 0 deletions
|
|
@ -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)
|
BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
|
||||||
: Option (i, n),
|
: Option (i, n),
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,22 @@ protected:
|
||||||
Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
|
Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RcConfigDisplay : public OptionEditorComponent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RcConfigDisplay (std::string const &, std::string const &, sigc::slot<std::string>, char s = '\0');
|
||||||
|
void add_to_page (OptionEditorPage *);
|
||||||
|
void parameter_changed (std::string const & p);
|
||||||
|
void set_state_from_config ();
|
||||||
|
Gtk::Widget& tip_widget() { return *_info; }
|
||||||
|
protected:
|
||||||
|
sigc::slot<std::string> _get;
|
||||||
|
Gtk::Label* _label;
|
||||||
|
Gtk::Label* _info;
|
||||||
|
std::string _id;
|
||||||
|
char _sep;
|
||||||
|
};
|
||||||
|
|
||||||
class RcActionButton : public OptionEditorComponent
|
class RcActionButton : public OptionEditorComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue