mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
trigger_ui: TriggerEntry is-a TriggerUI
This commit is contained in:
parent
f35020fc59
commit
c5b6d7f9d2
7 changed files with 51 additions and 50 deletions
|
|
@ -716,7 +716,7 @@ Editor::Editor ()
|
||||||
VBox* summary_arrows_right = manage (new VBox);
|
VBox* summary_arrows_right = manage (new VBox);
|
||||||
summary_arrows_right->pack_start (*summary_arrow_right);
|
summary_arrows_right->pack_start (*summary_arrow_right);
|
||||||
|
|
||||||
Frame* summary_frame = manage (new Frame);
|
Gtk::Frame* summary_frame = manage (new Gtk::Frame);
|
||||||
summary_frame->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
|
summary_frame->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
|
||||||
|
|
||||||
summary_frame->add (*_summary);
|
summary_frame->add (*_summary);
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@ SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SlotPropertyTable::on_trigger_changed (PropertyChange pc)
|
SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||||
{
|
{
|
||||||
if (pc.contains (Properties::name)) {
|
if (pc.contains (Properties::name)) {
|
||||||
_name_label.set_text (trigger()->name());
|
_name_label.set_text (trigger()->name());
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table
|
||||||
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
|
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
|
||||||
void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t);
|
void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t);
|
||||||
|
|
||||||
void on_trigger_changed (PBD::PropertyChange);
|
void on_trigger_changed (PBD::PropertyChange const& );
|
||||||
|
|
||||||
bool follow_action_button_event (GdkEvent*);
|
bool follow_action_button_event (GdkEvent*);
|
||||||
bool legato_button_event (GdkEvent*);
|
bool legato_button_event (GdkEvent*);
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,23 @@ TriggerUI::TriggerUI ()
|
||||||
|
|
||||||
TriggerUI::~TriggerUI()
|
TriggerUI::~TriggerUI()
|
||||||
{
|
{
|
||||||
|
trigger_swap_connection.disconnect ();
|
||||||
|
trigger_connections.disconnect ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TriggerUI::trigger_swap (uint32_t n)
|
||||||
|
{
|
||||||
|
if (n != tref.slot) {
|
||||||
|
/* some other slot in the same box got swapped. we don't care */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trigger_connections.disconnect ();
|
||||||
|
trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::trigger_changed, this, _1), gui_context ());
|
||||||
|
trigger_changed (Properties::name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerUI::setup_actions_and_bindings ()
|
TriggerUI::setup_actions_and_bindings ()
|
||||||
{
|
{
|
||||||
|
|
@ -458,7 +473,7 @@ TriggerUI::trigger() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerUI::trigger_changed (PropertyChange what)
|
TriggerUI::trigger_changed (PropertyChange const& what)
|
||||||
{
|
{
|
||||||
on_trigger_changed(what);
|
on_trigger_changed(what);
|
||||||
}
|
}
|
||||||
|
|
@ -467,6 +482,9 @@ TriggerUI::trigger_changed (PropertyChange what)
|
||||||
void
|
void
|
||||||
TriggerUI::set_trigger (ARDOUR::TriggerReference tr)
|
TriggerUI::set_trigger (ARDOUR::TriggerReference tr)
|
||||||
{
|
{
|
||||||
|
// trigger_connections.clear();
|
||||||
|
// trigger_swap_connection.clear();
|
||||||
|
|
||||||
tref = tr;
|
tref = tr;
|
||||||
|
|
||||||
PropertyChange pc;
|
PropertyChange pc;
|
||||||
|
|
@ -486,4 +504,6 @@ TriggerUI::set_trigger (ARDOUR::TriggerReference tr)
|
||||||
trigger_changed (pc);
|
trigger_changed (pc);
|
||||||
|
|
||||||
trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
|
trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
|
||||||
|
|
||||||
|
tref.box->TriggerSwapped.connect (trigger_swap_connection, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_swap, this, _1), gui_context ());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@
|
||||||
#include "widgets/slider_controller.h"
|
#include "widgets/slider_controller.h"
|
||||||
#include "widgets/frame.h"
|
#include "widgets/frame.h"
|
||||||
|
|
||||||
|
namespace Gtk
|
||||||
|
{
|
||||||
|
class FileChooserDialog;
|
||||||
|
class Menu;
|
||||||
|
}
|
||||||
|
|
||||||
class TriggerUI
|
class TriggerUI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -37,7 +43,7 @@ public:
|
||||||
|
|
||||||
void set_trigger (ARDOUR::TriggerReference);
|
void set_trigger (ARDOUR::TriggerReference);
|
||||||
|
|
||||||
virtual void on_trigger_changed (PBD::PropertyChange) = 0;
|
virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
|
||||||
|
|
||||||
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
|
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
|
||||||
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
|
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
|
||||||
|
|
@ -53,8 +59,11 @@ public:
|
||||||
|
|
||||||
static void setup_actions_and_bindings ();
|
static void setup_actions_and_bindings ();
|
||||||
|
|
||||||
|
ARDOUR::TriggerReference trigger_reference() const { return tref; }
|
||||||
|
ARDOUR::TriggerPtr trigger() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void trigger_changed (PBD::PropertyChange); //calls on_trigger_changed to subclasses
|
void trigger_changed (PBD::PropertyChange const& ); //calls on_trigger_changed to subclasses
|
||||||
|
|
||||||
/* Actions for Triggers: accessed via ardour_ui and shortcuts and lua */
|
/* Actions for Triggers: accessed via ardour_ui and shortcuts and lua */
|
||||||
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
||||||
|
|
@ -92,9 +101,11 @@ protected:
|
||||||
sigc::connection _file_chooser_connection;
|
sigc::connection _file_chooser_connection;
|
||||||
Gtk::FileChooserDialog* _file_chooser;
|
Gtk::FileChooserDialog* _file_chooser;
|
||||||
|
|
||||||
|
void trigger_swap (uint32_t);
|
||||||
|
PBD::ScopedConnection trigger_swap_connection;
|
||||||
|
|
||||||
ARDOUR::TriggerReference tref;
|
ARDOUR::TriggerReference tref;
|
||||||
ARDOUR::TriggerPtr trigger() const;
|
PBD::ScopedConnection trigger_connections;
|
||||||
PBD::ScopedConnectionList trigger_connections;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,18 +66,17 @@ using namespace PBD;
|
||||||
|
|
||||||
TriggerEntry::TriggerEntry (Item* item, TriggerReference tr)
|
TriggerEntry::TriggerEntry (Item* item, TriggerReference tr)
|
||||||
: ArdourCanvas::Rectangle (item)
|
: ArdourCanvas::Rectangle (item)
|
||||||
, tref (tr)
|
|
||||||
{
|
{
|
||||||
set_layout_sensitive (true); // why???
|
set_layout_sensitive (true); // why???
|
||||||
|
|
||||||
name = string_compose ("trigger %1", tref.slot);
|
name = string_compose ("trigger %1", tr.slot);
|
||||||
|
|
||||||
set_outline (false);
|
set_outline (false);
|
||||||
|
|
||||||
play_button = new ArdourCanvas::Rectangle (this);
|
play_button = new ArdourCanvas::Rectangle (this);
|
||||||
play_button->set_outline (false);
|
play_button->set_outline (false);
|
||||||
play_button->set_fill (true);
|
play_button->set_fill (true);
|
||||||
play_button->name = string_compose ("playbutton %1", tref.slot);
|
play_button->name = string_compose ("playbutton %1", tr.slot);
|
||||||
play_button->show ();
|
play_button->show ();
|
||||||
|
|
||||||
follow_button = new ArdourCanvas::Rectangle (this);
|
follow_button = new ArdourCanvas::Rectangle (this);
|
||||||
|
|
@ -96,19 +95,15 @@ TriggerEntry::TriggerEntry (Item* item, TriggerReference tr)
|
||||||
name_text->set_ignore_events (false);
|
name_text->set_ignore_events (false);
|
||||||
name_text->show ();
|
name_text->show ();
|
||||||
|
|
||||||
|
/* this will trigger a call to on_trigger_changed() */
|
||||||
|
set_trigger(tr);
|
||||||
|
|
||||||
/* watch for change in theme */
|
/* watch for change in theme */
|
||||||
UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &TriggerEntry::ui_parameter_changed));
|
UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &TriggerEntry::ui_parameter_changed));
|
||||||
set_default_colors ();
|
set_default_colors ();
|
||||||
|
|
||||||
trigger()->PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::prop_change, this, _1), gui_context ());
|
|
||||||
tref.box->TriggerSwapped.connect (trigger_swap_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::trigger_swap, this, _1), gui_context ());
|
|
||||||
dynamic_cast<Stripable*> (tref.box->owner ())->presentation_info ().Change.connect (owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::owner_prop_change, this, _1), gui_context ());
|
dynamic_cast<Stripable*> (tref.box->owner ())->presentation_info ().Change.connect (owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::owner_prop_change, this, _1), gui_context ());
|
||||||
|
|
||||||
PropertyChange changed;
|
|
||||||
changed.add (ARDOUR::Properties::name);
|
|
||||||
changed.add (ARDOUR::Properties::running);
|
|
||||||
prop_change (changed);
|
|
||||||
|
|
||||||
selection_change ();
|
selection_change ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,18 +111,6 @@ TriggerEntry::~TriggerEntry ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TriggerEntry::trigger_swap (uint32_t n)
|
|
||||||
{
|
|
||||||
if (n != tref.slot) {
|
|
||||||
/* some other slot in the same box got swapped. we don't care */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
trigger_prop_connection.disconnect ();
|
|
||||||
trigger()->PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::prop_change, this, _1), gui_context ());
|
|
||||||
prop_change (Properties::name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerEntry::owner_prop_change (PropertyChange const& pc)
|
TriggerEntry::owner_prop_change (PropertyChange const& pc)
|
||||||
{
|
{
|
||||||
|
|
@ -420,7 +403,7 @@ TriggerEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Conte
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerEntry::prop_change (PropertyChange const& change)
|
TriggerEntry::on_trigger_changed (PropertyChange const& change)
|
||||||
{
|
{
|
||||||
if (change.contains (ARDOUR::Properties::name)) {
|
if (change.contains (ARDOUR::Properties::name)) {
|
||||||
if (trigger()->region ()) {
|
if (trigger()->region ()) {
|
||||||
|
|
@ -1175,6 +1158,8 @@ TriggerBoxUI::rapid_update ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ********************************************** */
|
||||||
|
|
||||||
TriggerBoxWidget::TriggerBoxWidget (float w, float h)
|
TriggerBoxWidget::TriggerBoxWidget (float w, float h)
|
||||||
: FittedCanvasWidget (w, h)
|
: FittedCanvasWidget (w, h)
|
||||||
, ui (0)
|
, ui (0)
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,7 @@
|
||||||
|
|
||||||
#include "fitted_canvas_widget.h"
|
#include "fitted_canvas_widget.h"
|
||||||
|
|
||||||
namespace Gtk
|
#include "trigger_ui.h"
|
||||||
{
|
|
||||||
class FileChooserDialog;
|
|
||||||
class Menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Temporal
|
namespace Temporal
|
||||||
{
|
{
|
||||||
|
|
@ -47,18 +43,12 @@ namespace ArdourCanvas
|
||||||
class Polygon;
|
class Polygon;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TriggerEntry : public ArdourCanvas::Rectangle
|
class TriggerEntry : public ArdourCanvas::Rectangle, public TriggerUI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriggerEntry (ArdourCanvas::Item* item, ARDOUR::TriggerReference rf);
|
TriggerEntry (ArdourCanvas::Item* item, ARDOUR::TriggerReference rf);
|
||||||
~TriggerEntry ();
|
~TriggerEntry ();
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Trigger> trigger () const
|
|
||||||
{
|
|
||||||
return tref.trigger();
|
|
||||||
}
|
|
||||||
ARDOUR::TriggerReference trigger_reference() const { return tref; }
|
|
||||||
|
|
||||||
ArdourCanvas::Rectangle* play_button;
|
ArdourCanvas::Rectangle* play_button;
|
||||||
ArdourCanvas::Rectangle* name_button;
|
ArdourCanvas::Rectangle* name_button;
|
||||||
ArdourCanvas::Rectangle* follow_button;
|
ArdourCanvas::Rectangle* follow_button;
|
||||||
|
|
@ -72,21 +62,16 @@ public:
|
||||||
void _size_allocate (ArdourCanvas::Rect const&);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
void maybe_update ();
|
void maybe_update ();
|
||||||
|
|
||||||
|
void on_trigger_changed (PBD::PropertyChange const& change);
|
||||||
|
|
||||||
void selection_change ();
|
void selection_change ();
|
||||||
|
|
||||||
void set_default_colors ();
|
void set_default_colors ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::TriggerReference tref;
|
|
||||||
double _poly_size;
|
double _poly_size;
|
||||||
double _poly_margin;
|
double _poly_margin;
|
||||||
|
|
||||||
PBD::ScopedConnection trigger_prop_connection;
|
|
||||||
PBD::ScopedConnection trigger_swap_connection;
|
|
||||||
void prop_change (PBD::PropertyChange const& change);
|
|
||||||
|
|
||||||
void trigger_swap (uint32_t);
|
|
||||||
|
|
||||||
PBD::ScopedConnection owner_prop_connection;
|
PBD::ScopedConnection owner_prop_connection;
|
||||||
void owner_prop_change (PBD::PropertyChange const&);
|
void owner_prop_change (PBD::PropertyChange const&);
|
||||||
void owner_color_changed ();
|
void owner_color_changed ();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue