triggerbox (UI): set displayed name when region/name changes
This commit is contained in:
parent
a8f32b28e1
commit
f681212f42
@ -34,6 +34,7 @@
|
|||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
|
#include "gui_thread.h"
|
||||||
#include "triggerbox_ui.h"
|
#include "triggerbox_ui.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "ui_config.h"
|
#include "ui_config.h"
|
||||||
@ -75,20 +76,34 @@ TriggerEntry::TriggerEntry (Canvas* canvas, ARDOUR::Trigger& t)
|
|||||||
|
|
||||||
name_text = new Text (this);
|
name_text = new Text (this);
|
||||||
name_text->set_font_description (UIConfiguration::instance().get_NormalFont());
|
name_text->set_font_description (UIConfiguration::instance().get_NormalFont());
|
||||||
if (_trigger.region()) {
|
|
||||||
name_text->set (short_version (_trigger.region()->name(), 20));
|
|
||||||
} else {
|
|
||||||
/* we need some spaces to have something to click on */
|
|
||||||
name_text->set (X_(" "));
|
|
||||||
}
|
|
||||||
name_text->set_color (Gtkmm2ext::contrasting_text_color (fill_color()));
|
name_text->set_color (Gtkmm2ext::contrasting_text_color (fill_color()));
|
||||||
name_text->set_position (Duple (50, 4. * scale));
|
name_text->set_position (Duple (50, 4. * scale));
|
||||||
|
|
||||||
|
_trigger.PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::prop_change, this, _1), gui_context());
|
||||||
|
|
||||||
|
prop_change (PropertyChange (ARDOUR::Properties::name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TriggerEntry::~TriggerEntry ()
|
TriggerEntry::~TriggerEntry ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TriggerEntry::prop_change (PropertyChange const & change)
|
||||||
|
{
|
||||||
|
if (change.contains (ARDOUR::Properties::name)) {
|
||||||
|
if (_trigger.region()) {
|
||||||
|
name_text->set (short_version (_trigger.region()->name(), 20));
|
||||||
|
} else {
|
||||||
|
/* we need some spaces to have something to click on */
|
||||||
|
name_text->set (X_(" "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- */
|
/* ---------------------------- */
|
||||||
|
|
||||||
TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
||||||
@ -358,7 +373,6 @@ TriggerBoxUI::sample_chosen (int response, size_t n)
|
|||||||
std::string path = file_chooser->get_filename ();
|
std::string path = file_chooser->get_filename ();
|
||||||
|
|
||||||
_triggerbox.set_from_path (n, path);
|
_triggerbox.set_from_path (n, path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------ */
|
/* ------------ */
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
|
|
||||||
|
#include "pbd/properties.h"
|
||||||
|
|
||||||
#include "ardour/triggerbox.h"
|
#include "ardour/triggerbox.h"
|
||||||
|
|
||||||
#include "canvas/box.h"
|
#include "canvas/box.h"
|
||||||
@ -56,6 +58,9 @@ class TriggerEntry : public ArdourCanvas::Rectangle
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::Trigger& _trigger;
|
ARDOUR::Trigger& _trigger;
|
||||||
|
|
||||||
|
PBD::ScopedConnection trigger_prop_connection;
|
||||||
|
void prop_change (PBD::PropertyChange const & change);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TriggerBoxUI : public ArdourCanvas::Box
|
class TriggerBoxUI : public ArdourCanvas::Box
|
||||||
|
Loading…
Reference in New Issue
Block a user