mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Update GUI Region[s]PropertyChanged signal handlers (2/3)
This commit is contained in:
parent
2ff8f5a5de
commit
283cade057
10 changed files with 78 additions and 64 deletions
|
|
@ -363,7 +363,7 @@ EditorRegions::set_session (ARDOUR::Session* s)
|
||||||
{
|
{
|
||||||
SessionHandlePtr::set_session (s);
|
SessionHandlePtr::set_session (s);
|
||||||
|
|
||||||
ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::region_changed, this, _1, _2), gui_context ());
|
ARDOUR::Region::RegionsPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::regions_changed, this, _1, _2), gui_context ());
|
||||||
ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context ());
|
ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context ());
|
||||||
|
|
||||||
redisplay ();
|
redisplay ();
|
||||||
|
|
@ -390,7 +390,9 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChange pc;
|
PropertyChange pc;
|
||||||
region_changed (region, pc);
|
boost::shared_ptr<RegionList> rl (new RegionList);
|
||||||
|
rl->push_back (region);
|
||||||
|
regions_changed (rl, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -435,38 +437,42 @@ EditorRegions::remove_unused_regions ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRegions::region_changed (boost::shared_ptr<Region> r, const PropertyChange& what_changed)
|
EditorRegions::regions_changed (boost::shared_ptr<RegionList> rl, const PropertyChange& what_changed)
|
||||||
{
|
{
|
||||||
RegionRowMap::iterator map_it = region_row_map.find (r);
|
for (RegionList::const_iterator i = rl->begin (); i != rl->end(); ++i) {
|
||||||
|
boost::shared_ptr<Region> r = *i;
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Playlist> pl = r->playlist ();
|
RegionRowMap::iterator map_it = region_row_map.find (r);
|
||||||
if (!(pl && _session && _session->playlist_is_active (pl))) {
|
|
||||||
/* this region is not on an active playlist
|
boost::shared_ptr<ARDOUR::Playlist> pl = r->playlist ();
|
||||||
* maybe it got deleted, or whatever */
|
if (!(pl && _session && _session->playlist_is_active (pl))) {
|
||||||
if (map_it != region_row_map.end ()) {
|
/* this region is not on an active playlist
|
||||||
Gtk::TreeModel::iterator r = map_it->second;
|
* maybe it got deleted, or whatever */
|
||||||
region_row_map.erase (map_it);
|
if (map_it != region_row_map.end ()) {
|
||||||
_model->erase (r);
|
Gtk::TreeModel::iterator r = map_it->second;
|
||||||
|
region_row_map.erase (map_it);
|
||||||
|
_model->erase (r);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (map_it != region_row_map.end ()) {
|
if (map_it != region_row_map.end ()) {
|
||||||
/* found the region, update its row properties */
|
/* found the region, update its row properties */
|
||||||
TreeModel::Row row = *(map_it->second);
|
TreeModel::Row row = *(map_it->second);
|
||||||
populate_row (r, row, what_changed);
|
populate_row (r, row, what_changed);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* new region, add it to the list */
|
/* new region, add it to the list */
|
||||||
TreeModel::iterator iter = _model->append ();
|
TreeModel::iterator iter = _model->append ();
|
||||||
TreeModel::Row row = *iter;
|
TreeModel::Row row = *iter;
|
||||||
region_row_map.insert (pair<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> (r, iter));
|
region_row_map.insert (pair<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> (r, iter));
|
||||||
|
|
||||||
/* set the properties that don't change */
|
/* set the properties that don't change */
|
||||||
row[_columns.region] = r;
|
row[_columns.region] = r;
|
||||||
|
|
||||||
/* now populate the properties that might change... */
|
/* now populate the properties that might change... */
|
||||||
populate_row (r, row, PropertyChange ());
|
populate_row (r, row, PropertyChange ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ private:
|
||||||
|
|
||||||
void freeze_tree_model ();
|
void freeze_tree_model ();
|
||||||
void thaw_tree_model ();
|
void thaw_tree_model ();
|
||||||
void region_changed (boost::shared_ptr<ARDOUR::Region>, PBD::PropertyChange const &);
|
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const &);
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
|
|
||||||
sigc::connection _change_connection;
|
sigc::connection _change_connection;
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ EditorSources::set_session (ARDOUR::Session* s)
|
||||||
SessionHandlePtr::set_session (s);
|
SessionHandlePtr::set_session (s);
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
ARDOUR::Region::RegionPropertyChanged.connect (source_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::source_changed, this, _1, _2), gui_context ());
|
ARDOUR::Region::RegionsPropertyChanged.connect (source_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::regions_changed, this, _1, _2), gui_context ());
|
||||||
|
|
||||||
ARDOUR::RegionFactory::CheckNewRegion.connect (add_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::add_source, this, _1), gui_context());
|
ARDOUR::RegionFactory::CheckNewRegion.connect (add_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::add_source, this, _1), gui_context());
|
||||||
|
|
||||||
|
|
@ -506,21 +506,25 @@ EditorSources::add_source (boost::shared_ptr<ARDOUR::Region> region)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorSources::source_changed (boost::shared_ptr<ARDOUR::Region> region, PBD::PropertyChange const &)
|
EditorSources::regions_changed (boost::shared_ptr<ARDOUR::RegionList> rl, PBD::PropertyChange const &)
|
||||||
{
|
{
|
||||||
if (!region->whole_file ()) {
|
for (RegionList::const_iterator r = rl->begin (); r != rl->end(); ++r) {
|
||||||
/*this isn't on our list anyway; we can ignore it*/
|
boost::shared_ptr<Region> region = *r;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeModel::iterator i;
|
if (!region->whole_file ()) {
|
||||||
TreeModel::Children rows = _model->children();
|
/*this isn't on our list anyway; we can ignore it*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
TreeModel::iterator i;
|
||||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
TreeModel::Children rows = _model->children();
|
||||||
if (region == rr) {
|
|
||||||
populate_row(*i, region);
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||||
break;
|
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||||
|
if (region == rr) {
|
||||||
|
populate_row(*i, region);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
|
|
||||||
void freeze_tree_model ();
|
void freeze_tree_model ();
|
||||||
void thaw_tree_model ();
|
void thaw_tree_model ();
|
||||||
void source_changed (boost::shared_ptr<ARDOUR::Region>, PBD::PropertyChange const&);
|
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
||||||
void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region);
|
void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region);
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ EditorSummary::set_session (Session* s)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (_session) {
|
if (_session) {
|
||||||
Region::RegionPropertyChanged.connect (region_property_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
Region::RegionsPropertyChanged.connect (region_property_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
||||||
PresentationInfo::Change.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
PresentationInfo::Change.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
||||||
_editor->playhead_cursor()->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
|
_editor->playhead_cursor()->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
|
||||||
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ STATIC(DiskOverrun, &ARDOUR::DiskWriter::Overrun, 0)
|
||||||
STATIC(DiskUnderrun, &ARDOUR::DiskReader::Underrun, 0)
|
STATIC(DiskUnderrun, &ARDOUR::DiskReader::Underrun, 0)
|
||||||
|
|
||||||
// Region static
|
// Region static
|
||||||
STATIC(RegionPropertyChanged, &ARDOUR::Region::RegionPropertyChanged, 2)
|
STATIC(RegionsPropertyChanged, &ARDOUR::Region::RegionsPropertyChanged, 2)
|
||||||
|
|
||||||
// Timers
|
// Timers
|
||||||
STATIC(LuaTimerS, &LuaInstance::LuaTimerS, 0)
|
STATIC(LuaTimerS, &LuaInstance::LuaTimerS, 0)
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ RecorderUI::set_session (Session* s)
|
||||||
|
|
||||||
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::parameter_changed, this, _1), gui_context ());
|
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::parameter_changed, this, _1), gui_context ());
|
||||||
|
|
||||||
Region::RegionPropertyChanged.connect (*this, invalidator (*this), boost::bind (&RecorderUI::region_changed, this, _1, _2), gui_context());
|
Region::RegionsPropertyChanged.connect (*this, invalidator (*this), boost::bind (&RecorderUI::regions_changed, this, _1, _2), gui_context());
|
||||||
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::gui_extents_changed, this), gui_context());
|
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::gui_extents_changed, this), gui_context());
|
||||||
_session->EndTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::gui_extents_changed, this), gui_context());
|
_session->EndTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::gui_extents_changed, this), gui_context());
|
||||||
_session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::update_sensitivity, this), gui_context());
|
_session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::update_sensitivity, this), gui_context());
|
||||||
|
|
@ -795,7 +795,7 @@ RecorderUI::port_pretty_name_changed (string pn)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RecorderUI::region_changed (boost::shared_ptr<ARDOUR::Region>, PBD::PropertyChange const& what_changed)
|
RecorderUI::regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const& what_changed)
|
||||||
{
|
{
|
||||||
PBD::PropertyChange interests;
|
PBD::PropertyChange interests;
|
||||||
interests.add (ARDOUR::Properties::position);
|
interests.add (ARDOUR::Properties::position);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ private:
|
||||||
void parameter_changed (std::string const&);
|
void parameter_changed (std::string const&);
|
||||||
void presentation_info_changed (PBD::PropertyChange const&);
|
void presentation_info_changed (PBD::PropertyChange const&);
|
||||||
void gui_extents_changed ();
|
void gui_extents_changed ();
|
||||||
void region_changed (boost::shared_ptr<ARDOUR::Region>, PBD::PropertyChange const&);
|
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
||||||
|
|
||||||
void start_updating ();
|
void start_updating ();
|
||||||
void stop_updating ();
|
void stop_updating ();
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ ardour {
|
||||||
|
|
||||||
function signals ()
|
function signals ()
|
||||||
s = LuaSignal.Set()
|
s = LuaSignal.Set()
|
||||||
--s:add ({[LuaSignal.SoloActive] = true, [LuaSignal.RegionPropertyChanged] = true})
|
--s:add ({[LuaSignal.SoloActive] = true, [LuaSignal.RegionsPropertyChanged] = true})
|
||||||
s:add (
|
s:add (
|
||||||
{
|
{
|
||||||
[LuaSignal.SoloActive] = true,
|
[LuaSignal.SoloActive] = true,
|
||||||
[LuaSignal.RegionPropertyChanged] = true
|
[LuaSignal.RegionsPropertyChanged] = true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
--for k,v in pairs (s:table()) do print (k, v) end
|
--for k,v in pairs (s:table()) do print (k, v) end
|
||||||
|
|
@ -26,15 +26,17 @@ function factory (params)
|
||||||
Session:goto_start()
|
Session:goto_start()
|
||||||
end
|
end
|
||||||
|
|
||||||
if (signal == LuaSignal.RegionPropertyChanged) then
|
if (signal == LuaSignal.RegionsPropertyChanged) then
|
||||||
obj,pch = ...
|
rl,pch = ...
|
||||||
file = io.open ("/tmp/test" ,"a")
|
file = io.open ("/tmp/test" ,"a")
|
||||||
io.output (file)
|
io.output (file)
|
||||||
io.write (string.format ("Region: '%s' pos-changed: %s, length-changed: %s\n",
|
for region in rl:iter() do
|
||||||
obj:name (),
|
io.write (string.format ("Region: '%s' pos-changed: %s, length-changed: %s\n",
|
||||||
tostring (pch:containsSamplePos (ARDOUR.Properties.Start)),
|
region:name (),
|
||||||
tostring (pch:containsSamplePos (ARDOUR.Properties.Length))
|
tostring (pch:containsSamplePos (ARDOUR.Properties.Position)),
|
||||||
))
|
tostring (pch:containsSamplePos (ARDOUR.Properties.Length))
|
||||||
|
))
|
||||||
|
end
|
||||||
io.close (file)
|
io.close (file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function signals ()
|
||||||
s:add (
|
s:add (
|
||||||
{
|
{
|
||||||
[LuaSignal.SoloActive] = true,
|
[LuaSignal.SoloActive] = true,
|
||||||
[LuaSignal.RegionPropertyChanged] = true,
|
[LuaSignal.RegionsPropertyChanged] = true,
|
||||||
[LuaSignal.Exported] = true,
|
[LuaSignal.Exported] = true,
|
||||||
[LuaSignal.TransportStateChange] = true
|
[LuaSignal.TransportStateChange] = true
|
||||||
}
|
}
|
||||||
|
|
@ -40,13 +40,15 @@ function factory (params)
|
||||||
elseif (signal == LuaSignal.TransportStateChange) then
|
elseif (signal == LuaSignal.TransportStateChange) then
|
||||||
tx:send ("/session/transport", "if",
|
tx:send ("/session/transport", "if",
|
||||||
Session:transport_sample(), Session:transport_speed())
|
Session:transport_sample(), Session:transport_speed())
|
||||||
elseif (signal == LuaSignal.RegionPropertyChanged) then
|
elseif (signal == LuaSignal.RegionsPropertyChanged) then
|
||||||
obj,pch = ...
|
rl,pch = ...
|
||||||
tx:send ("/region_property_changed", "sTTiii",
|
for region in rl:iter() do
|
||||||
obj:name (),
|
tx:send ("/region_property_changed", "sTTiii",
|
||||||
(pch:containsSamplePos (ARDOUR.Properties.Start)),
|
region:name (),
|
||||||
(pch:containsSamplePos (ARDOUR.Properties.Length)),
|
(pch:containsSamplePos (ARDOUR.Properties.Start)),
|
||||||
obj:position (), obj:start (), obj:length ())
|
(pch:containsSamplePos (ARDOUR.Properties.Length)),
|
||||||
|
region:position (), region:start (), region:length ())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue