}
void
-Editor::handle_new_audio_region (boost::weak_ptr<AudioRegion> wregion)
+Editor::handle_new_audio_regions (vector<boost::weak_ptr<AudioRegion> >& v)
{
- ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_new_audio_region), wregion));
-
- /* don't copy region - the one we are being notified
- about belongs to the session, and so it will
- never be edited.
- */
-
- boost::shared_ptr<AudioRegion> region (wregion.lock());
-
- if (region) {
- add_audio_region_to_region_display (region);
- }
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_new_audio_regions), v));
+ add_audio_regions_to_region_display (v);
}
void
redisplay_regions ();
}
+void
+Editor::add_audio_regions_to_region_display (vector<boost::weak_ptr<AudioRegion> >& regions)
+{
+ region_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+ for (vector<boost::weak_ptr<AudioRegion> >::iterator x = regions.begin(); x != regions.end(); ++x) {
+ boost::shared_ptr<AudioRegion> region ((*x).lock());
+ if (region) {
+ add_audio_region_to_region_display (region);
+ }
+ }
+ region_list_display.set_model (region_list_model);
+}
+
void
Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> region)
{
} else if (region->whole_file()) {
+ TreeModel::iterator i;
+ TreeModel::Children rows = region_list_model->children();
+
+ for (i = rows.begin(); i != rows.end(); ++i) {
+
+ boost::shared_ptr<Region> rr = (*i)[region_list_columns.region];
+
+ if (rr && region->region_list_equivalent (rr)) {
+ return;
+ }
+ }
+
row = *(region_list_model->append());
if (missing_source) {
c.set_rgb(65535,0,0); // FIXME: error color from style
break;
}
}
+
+ TreeModel::iterator ii;
+ TreeModel::Children subrows = (*i).children();
+
+ for (ii = subrows.begin(); ii != subrows.end(); ++ii) {
+
+ boost::shared_ptr<Region> rrr = (*ii)[region_list_columns.region];
+
+ if (region->region_list_equivalent (rrr)) {
+ return;
+ }
+ }
}
if (!found_parent) {
void
Editor::redisplay_regions ()
{
+ if (no_region_list_redisplay) {
+ return;
+ }
+
if (session) {
region_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
int cellx;
int celly;
+ // cerr << "Button press release, button = " << ev->button << endl;
+
if (region_list_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
if ((iter = region_list_model->get_iter (path))) {
region = (*iter)[region_list_columns.region];
if (Keyboard::is_context_menu_event (ev)) {
show_region_list_display_context_menu (ev->button, ev->time);
+ cerr << "\tcontext menu event, event handled\n";
return true;
}
if (region == 0) {
+ cerr << "\tno region, event not handled\n";
return false;
}
if (!Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
consider_auditioning (region);
}
+ cerr << "\taudition, event handled\n";
return true;
break;
break;
}
+ cerr << "\tnot handled\n";
return false;
}
{
vector<ustring> paths;
+ if (data.get_target() == "GTK_TREE_MODEL_ROW") {
+ cerr << "Delete drag data drop to treeview\n";
+ region_list_display.on_drag_data_received (context, x, y, data, info, time);
+ return;
+ }
+
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
nframes64_t pos = 0;
do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);