mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
show first word of comment on track's comment-button
This commit is contained in:
parent
791cff6f46
commit
e4ba62e4c4
2 changed files with 25 additions and 22 deletions
|
|
@ -263,7 +263,9 @@ MixerStrip::init ()
|
||||||
group_button.set_name ("mixer strip button");
|
group_button.set_name ("mixer strip button");
|
||||||
|
|
||||||
_comment_button.set_name (X_("mixer strip button"));
|
_comment_button.set_name (X_("mixer strip button"));
|
||||||
|
_comment_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
|
||||||
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
|
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
|
||||||
|
_comment_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::comment_button_resized));
|
||||||
|
|
||||||
// TODO implement ArdourKnob::on_size_request properly
|
// TODO implement ArdourKnob::on_size_request properly
|
||||||
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
|
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
|
||||||
|
|
@ -1487,33 +1489,27 @@ MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::wea
|
||||||
void
|
void
|
||||||
MixerStrip::setup_comment_button ()
|
MixerStrip::setup_comment_button ()
|
||||||
{
|
{
|
||||||
switch (_width) {
|
std::string comment = _route->comment();
|
||||||
|
|
||||||
case Wide:
|
set_tooltip (_comment_button, comment.empty() ? _("Click to add/edit comments") : _route->comment());
|
||||||
if (_route->comment().empty ()) {
|
|
||||||
_comment_button.set_name ("generic button");
|
|
||||||
_comment_button.set_text (_("Comments"));
|
|
||||||
} else {
|
|
||||||
_comment_button.set_name ("comment button");
|
|
||||||
_comment_button.set_text (_("*Comments*"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Narrow:
|
if (comment.empty ()) {
|
||||||
if (_route->comment().empty ()) {
|
_comment_button.set_name ("generic button");
|
||||||
_comment_button.set_name ("generic button");
|
_comment_button.set_text (_width == Wide ? _("Comments") : _("Cmt"));
|
||||||
_comment_button.set_text (_("Cmt"));
|
return;
|
||||||
} else {
|
|
||||||
_comment_button.set_name ("comment button");
|
|
||||||
_comment_button.set_text (_("*Cmt*"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_tooltip (
|
_comment_button.set_name ("comment button");
|
||||||
_comment_button, _route->comment().empty() ? _("Click to add/edit comments") : _route->comment()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
string::size_type pos = comment.find_first_of (" \t\n");
|
||||||
|
if (pos != string::npos) {
|
||||||
|
comment = comment.substr (0, pos);
|
||||||
|
}
|
||||||
|
if (comment.empty()) {
|
||||||
|
_comment_button.set_text (_width == Wide ? _("Comments") : _("Cmt"));
|
||||||
|
} else {
|
||||||
|
_comment_button.set_text (comment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -1791,6 +1787,12 @@ MixerStrip::name_button_resized (Gtk::Allocation& alloc)
|
||||||
name_button.set_layout_ellipsize_width (alloc.get_width() * PANGO_SCALE);
|
name_button.set_layout_ellipsize_width (alloc.get_width() * PANGO_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MixerStrip::comment_button_resized (Gtk::Allocation& alloc)
|
||||||
|
{
|
||||||
|
_comment_button.set_layout_ellipsize_width (alloc.get_width() * PANGO_SCALE);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MixerStrip::width_button_pressed (GdkEventButton* ev)
|
MixerStrip::width_button_pressed (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
|
||||||
|
|
||||||
void input_button_resized (Gtk::Allocation&);
|
void input_button_resized (Gtk::Allocation&);
|
||||||
void output_button_resized (Gtk::Allocation&);
|
void output_button_resized (Gtk::Allocation&);
|
||||||
|
void comment_button_resized (Gtk::Allocation&);
|
||||||
|
|
||||||
ArdourButton* midi_input_enable_button;
|
ArdourButton* midi_input_enable_button;
|
||||||
Gtk::HBox input_button_box;
|
Gtk::HBox input_button_box;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue