Implement Editor Region Properties
This commit is contained in:
parent
00f3ce2e76
commit
d8a197a63f
@ -63,6 +63,8 @@ public:
|
|||||||
RegionEditor (ARDOUR::Session*, RegionView*);
|
RegionEditor (ARDOUR::Session*, RegionView*);
|
||||||
virtual ~RegionEditor ();
|
virtual ~RegionEditor ();
|
||||||
|
|
||||||
|
std::shared_ptr<ARDOUR::Region> region () const { return _region; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void region_changed (const PBD::PropertyChange&);
|
virtual void region_changed (const PBD::PropertyChange&);
|
||||||
virtual void region_fx_changed ();
|
virtual void region_fx_changed ();
|
||||||
|
@ -41,6 +41,7 @@ using std::min;
|
|||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
SelectionPropertiesBox::SelectionPropertiesBox ()
|
SelectionPropertiesBox::SelectionPropertiesBox ()
|
||||||
|
: _region_editor (nullptr)
|
||||||
{
|
{
|
||||||
init ();
|
init ();
|
||||||
|
|
||||||
@ -49,9 +50,11 @@ SelectionPropertiesBox::SelectionPropertiesBox ()
|
|||||||
|
|
||||||
pack_start(*_time_info_box, false, false, 0);
|
pack_start(*_time_info_box, false, false, 0);
|
||||||
pack_start(*_route_prop_box, true, true, 0);
|
pack_start(*_route_prop_box, true, true, 0);
|
||||||
|
pack_start(_region_editor_box, false, false, 0);
|
||||||
|
|
||||||
_time_info_box->set_no_show_all ();
|
_time_info_box->set_no_show_all ();
|
||||||
_route_prop_box->set_no_show_all ();
|
_route_prop_box->set_no_show_all ();
|
||||||
|
_region_editor_box.set_no_show_all ();
|
||||||
|
|
||||||
_time_info_box->hide ();
|
_time_info_box->hide ();
|
||||||
_route_prop_box->hide ();
|
_route_prop_box->hide ();
|
||||||
@ -61,6 +64,7 @@ SelectionPropertiesBox::~SelectionPropertiesBox ()
|
|||||||
{
|
{
|
||||||
delete _time_info_box;
|
delete _time_info_box;
|
||||||
delete _route_prop_box;
|
delete _route_prop_box;
|
||||||
|
delete _region_editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -104,12 +108,25 @@ SelectionPropertiesBox::track_mouse_mode ()
|
|||||||
/* maybe do something here? */
|
/* maybe do something here? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SelectionPropertiesBox::delete_region_editor ()
|
||||||
|
{
|
||||||
|
if (!_region_editor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_region_editor_box.remove ();
|
||||||
|
delete _region_editor;
|
||||||
|
_region_editor = nullptr;
|
||||||
|
_region_editor_box.hide ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SelectionPropertiesBox::selection_changed ()
|
SelectionPropertiesBox::selection_changed ()
|
||||||
{
|
{
|
||||||
if (!_session || _session->inital_connect_or_deletion_in_progress ()) {
|
if (!_session || _session->inital_connect_or_deletion_in_progress ()) {
|
||||||
_time_info_box->hide ();
|
_time_info_box->hide ();
|
||||||
_route_prop_box->hide ();
|
_route_prop_box->hide ();
|
||||||
|
delete_region_editor ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,5 +147,29 @@ SelectionPropertiesBox::selection_changed ()
|
|||||||
_route_prop_box->hide();
|
_route_prop_box->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selection.regions.size () == 1) {
|
||||||
|
RegionView* rv = (selection.regions.front ());
|
||||||
|
if (!_region_editor || _region_editor->region () != rv->region ()) {
|
||||||
|
delete_region_editor ();
|
||||||
|
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (rv);
|
||||||
|
if (arv) {
|
||||||
|
_region_editor = new AudioRegionEditor (_session, arv);
|
||||||
|
} else {
|
||||||
|
_region_editor = new RegionEditor (_session, rv);
|
||||||
|
}
|
||||||
|
// TODO subscribe to region name changes
|
||||||
|
_region_editor->set_label (string_compose (_("Region '%1'"), rv->region()->name ()));
|
||||||
|
_region_editor->set_padding (4);
|
||||||
|
_region_editor->set_edge_color (0x000000ff); // black
|
||||||
|
_region_editor->show_all ();
|
||||||
|
_region_editor_box.add (*_region_editor);
|
||||||
|
rv->RegionViewGoingAway.connect_same_thread (_region_connection, std::bind (&SelectionPropertiesBox::delete_region_editor, this));
|
||||||
|
}
|
||||||
|
_region_editor_box.show ();
|
||||||
|
} else {
|
||||||
|
/* only hide region props when selecting a track or trigger ..*/
|
||||||
|
if (_route_prop_box->get_visible () || !selection.markers.empty () || !selection.playlists.empty () || !selection.triggers.empty ()) {
|
||||||
|
delete_region_editor ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
#include "ardour/session_handle.h"
|
#include "ardour/session_handle.h"
|
||||||
|
|
||||||
|
#include "widgets/eventboxext.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Session;
|
class Session;
|
||||||
@ -48,10 +49,14 @@ private:
|
|||||||
void init ();
|
void init ();
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
void track_mouse_mode ();
|
void track_mouse_mode ();
|
||||||
|
void delete_region_editor ();
|
||||||
|
|
||||||
TimeInfoBox* _time_info_box;
|
TimeInfoBox* _time_info_box;
|
||||||
RoutePropertiesBox* _route_prop_box;
|
RoutePropertiesBox* _route_prop_box;
|
||||||
|
ArdourWidgets::EventBoxExt _region_editor_box;
|
||||||
|
RegionEditor* _region_editor;
|
||||||
|
|
||||||
|
PBD::ScopedConnection _region_connection;
|
||||||
PBD::ScopedConnection _editor_connection;
|
PBD::ScopedConnection _editor_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user