#include "ardour/audioregion.h"
#include "ardour/audiofilesource.h"
+#include "ardour/region_factory.h"
+#include "ardour/session.h"
#include "ardour/silentfilesource.h"
-#include "ardour/session_region.h"
#include "ardour/profile.h"
#include <gtkmm2ext/stop_signal.h>
if (_session) {
_session->RegionsAdded.connect (_session_connections, ui_bind (&EditorRegions::handle_new_regions, this, _1), gui_context());
- _session->RegionRemoved.connect (_session_connections, ui_bind (&EditorRegions::handle_region_removed, this, _1), gui_context());
_session->RegionHiddenChange.connect (_session_connections, ui_bind (&EditorRegions::region_hidden, this, _1), gui_context());
}
}
void
-EditorRegions::handle_region_removed (boost::weak_ptr<Region> wregion)
-{
- ENSURE_GUI_THREAD (*this, &EditorRegions::handle_region_removed, wregion)
-
- redisplay ();
-}
-
-void
-EditorRegions::handle_new_regions (vector<boost::weak_ptr<Region> >& v)
+EditorRegions::handle_new_regions (vector<boost::shared_ptr<Region> >& v)
{
ENSURE_GUI_THREAD (*this, &EditorRegions::handle_new_regions, v)
add_regions (v);
void
-EditorRegions::add_regions (vector<boost::weak_ptr<Region> >& regions)
+EditorRegions::add_regions (vector<boost::shared_ptr<Region> >& regions)
{
- for (vector<boost::weak_ptr<Region> >::iterator x = regions.begin(); x != regions.end(); ++x) {
- boost::shared_ptr<Region> region ((*x).lock());
- if (region) {
- add_region (region);
- }
+ for (vector<boost::shared_ptr<Region> >::iterator x = regions.begin(); x != regions.end(); ++x) {
+ add_region (*x);
}
}
void
-EditorRegions::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> region)
+EditorRegions::region_changed (const PropertyChange& what_changed, boost::weak_ptr<Region> region)
{
ENSURE_GUI_THREAD (*this, &EditorRegions::region_changed, what_changed, region)
return;
}
- if (what_changed & ARDOUR::NameChanged) {
+ if (what_changed.contains (ARDOUR::Properties::name)) {
/* find the region in our model and change its name */
TreeModel::Children rows = _model->children ();
TreeModel::iterator i = rows.begin ();
*/
tmp_region_list.clear();
- _session->foreach_region (this, &EditorRegions::insert_into_tmp_regionlist);
+
+ const RegionFactory::RegionMap& regions (RegionFactory::regions());
+ for (RegionFactory::RegionMap::const_iterator i = regions.begin(); i != regions.end(); ++i) {
+ insert_into_tmp_regionlist (i->second);
+ }
for (list<boost::shared_ptr<Region> >::iterator r = tmp_region_list.begin(); r != tmp_region_list.end(); ++r) {
add_region (*r);
break;
case AudioClock::Frames:
- snprintf (start_str, sizeof (start_str), "%u", region->position());
- snprintf (end_str, sizeof (end_str), "%u", (region->position() + region->length() - 1));
- snprintf (length_str, sizeof (length_str), "%u", region->length());
- snprintf (sync_str, sizeof (sync_str), "%u", region->sync_position() + region->position());
+ snprintf (start_str, sizeof (start_str), "%" PRId64, region->position());
+ snprintf (end_str, sizeof (end_str), "%" PRId64, (region->position() + region->length() - 1));
+ snprintf (length_str, sizeof (length_str), "%" PRId64, region->length());
+ snprintf (sync_str, sizeof (sync_str), "%" PRId64, region->sync_position() + region->position());
if (audioRegion && !fades_in_seconds) {
snprintf (fadein_str, sizeof (fadein_str), "%u", uint (audioRegion->fade_in()->back()->when));
}
if (region && Keyboard::is_delete_event (ev)) {
- _session->remove_region_from_region_list (region);
+ // _session->remove_region_from_region_list (region);
return true;
}