diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-05-13 21:34:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-05-13 21:34:09 +0000 |
commit | 0569107ddc0d2a8df6ca0a2c8cc16ebe8f3dee99 (patch) | |
tree | 81b0a6ffb5cd967d3b205a11ad6d4f8726aa03d2 /gtk2_ardour | |
parent | 7188ec39903e4cef049468c5a0583d9ec67a290d (diff) |
more work on the new all-Processor-all-The-Time redesign of Route - LOTS OF BREAKAGE STILL EXPECTED ; change all(?) methods that pass a start/end frame in to use sframes_t not nframes_t
git-svn-id: svn://localhost/ardour2/branches/3.0@5074 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 39 | ||||
-rw-r--r-- | gtk2_ardour/canvas-waveview.c | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 183 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_grid.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/processor_box.cc | 54 | ||||
-rw-r--r-- | gtk2_ardour/processor_box.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/streamview.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/streamview.h | 5 |
9 files changed, 209 insertions, 107 deletions
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 33d7c2ac1e..35e93b985f 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -28,6 +28,7 @@ #include "region_view.h" #include "route_time_axis.h" + #include "time_axis_view_item.h" #include "automation_line.h" #include "enums.h" diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 8dcee5aaab..772b455f97 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -108,30 +108,32 @@ RegionView* AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait_for_waves, bool recording) { AudioRegionView *region_view = 0; - boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r); if (region == 0) { return NULL; } - for (list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { - if ((*i)->region() == r) { - - /* great. we already have a AudioRegionView for this Region. use it again. */ - - (*i)->set_valid (true); - - // this might not be necessary - AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); - if (arv) { - arv->set_waveform_scale (_waveform_scale); - arv->set_waveform_shape (_waveform_shape); - } +// if(!recording){ +// for (list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { +// if ((*i)->region() == r) { +// cerr << "audio_streamview in add_region_view_internal region found" << endl; + /* great. we already have a AudioRegionView for this Region. use it again. */ - return NULL; - } - } +// (*i)->set_valid (true); + + // this might not be necessary +// AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); + +// if (arv) { +// arv->set_waveform_scale (_waveform_scale); +// arv->set_waveform_shape (_waveform_shape); +// } + +// return NULL; +// } +// } +// } switch (_trackview.audio_track()->mode()) { @@ -173,6 +175,7 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai otherwise, we set it to the current value */ if (region_views.size() == 1) { + if (region_view->waveform_logscaled()) { _waveform_scale = LogWaveform; } else { @@ -191,7 +194,6 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai } /* follow global waveform setting */ - region_view->set_waveform_visible(_trackview.editor().show_waveforms()); /* catch regionview going away */ @@ -396,6 +398,7 @@ AudioStreamView::redisplay_diskstream () } // Add and display region and crossfade views, and flag them as valid + if (_trackview.is_audio_track()) { _trackview.get_diskstream()->playlist()->foreach_region( static_cast<StreamView*>(this), diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 5563fe5a78..8b2a7c8af7 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -764,6 +764,7 @@ gnome_canvas_waveview_set_property (GObject *object, waveview->length_function = g_value_get_pointer(value); redraw = TRUE; break; + case PROP_SOURCEFILE_LENGTH_FUNCTION: waveview->sourcefile_length_function = g_value_get_pointer(value); redraw = TRUE; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index b1ad57f9cd..7e1a303e73 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -199,74 +199,6 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions) _new_regionviews_show_envelope = false; } - -/** Remove `clicked_regionview' */ -void -Editor::remove_clicked_region () -{ - if (clicked_routeview == 0 || clicked_regionview == 0) { - return; - } - - boost::shared_ptr<Playlist> playlist = clicked_routeview->playlist(); - - begin_reversible_command (_("remove region")); - XMLNode &before = playlist->get_state(); - playlist->remove_region (clicked_regionview->region()); - XMLNode &after = playlist->get_state(); - session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after)); - commit_reversible_command (); -} - - -/** Remove the selected regions */ -void -Editor::remove_selected_regions () -{ - RegionSelection rs; - get_regions_for_action (rs); - - if (!session) { - return; - } - - if (rs.empty()) { - return; - } - - begin_reversible_command (_("remove region")); - - list<boost::shared_ptr<Region> > regions_to_remove; - - for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { - // we can't just remove the region(s) in this loop because - // this removes them from the RegionSelection, and they thus - // disappear from underneath the iterator, and the ++i above - // SEGVs in a puzzling fashion. - - // so, first iterate over the regions to be removed from rs and - // add them to the regions_to_remove list, and then - // iterate over the list to actually remove them. - - regions_to_remove.push_back ((*i)->region()); - } - - for (list<boost::shared_ptr<Region> >::iterator rl = regions_to_remove.begin(); rl != regions_to_remove.end(); ++rl) { - boost::shared_ptr<Playlist> playlist = (*rl)->playlist(); - if (!playlist) { - // is this check necessary? - continue; - } - - XMLNode &before = playlist->get_state(); - playlist->remove_region (*rl); - XMLNode &after = playlist->get_state(); - session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after)); - } - - commit_reversible_command (); -} - boost::shared_ptr<Region> Editor::select_region_for_operation (int dir, TimeAxisView **tv) { @@ -4076,13 +4008,106 @@ struct PlaylistMapping { PlaylistMapping (TimeAxisView* tvp) : tv (tvp) {} }; +/** Remove `clicked_regionview' */ +void +Editor::remove_clicked_region () +{ + if (clicked_routeview == 0 || clicked_regionview == 0) { + return; + } + + boost::shared_ptr<Playlist> playlist = clicked_routeview->playlist(); + + begin_reversible_command (_("remove region")); + XMLNode &before = playlist->get_state(); + playlist->remove_region (clicked_regionview->region()); + XMLNode &after = playlist->get_state(); + session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after)); + commit_reversible_command (); +} + + +/** Remove the selected regions */ +void +Editor::remove_selected_regions () +{ + RegionSelection rs; + get_regions_for_action (rs); + + if (!session) { + return; + } + + if (rs.empty()) { + return; + } + + begin_reversible_command (_("remove region")); + + list<boost::shared_ptr<Region> > regions_to_remove; + + for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { + // we can't just remove the region(s) in this loop because + // this removes them from the RegionSelection, and they thus + // disappear from underneath the iterator, and the ++i above + // SEGVs in a puzzling fashion. + + // so, first iterate over the regions to be removed from rs and + // add them to the regions_to_remove list, and then + // iterate over the list to actually remove them. + + regions_to_remove.push_back ((*i)->region()); + } + + vector<PlaylistState> playlists; + + for (list<boost::shared_ptr<Region> >::iterator rl = regions_to_remove.begin(); rl != regions_to_remove.end(); ++rl) { + + boost::shared_ptr<Playlist> playlist = (*rl)->playlist(); + + if (!playlist) { + // is this check necessary? + continue; + } + + vector<PlaylistState>::iterator i; + + //only take state if this is a new playlist. + for (i = playlists.begin(); i != playlists.end(); ++i) { + if ((*i).playlist == playlist) { + break; + } + } + + if (i == playlists.end()) { + + PlaylistState before; + before.playlist = playlist; + before.before = &playlist->get_state(); + + playlist->freeze (); + playlists.push_back(before); + } + + playlist->remove_region (*rl); + } + + vector<PlaylistState>::iterator pl; + + for (pl = playlists.begin(); pl != playlists.end(); ++pl) { + (*pl).playlist->thaw (); + session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state())); + } + + commit_reversible_command (); +} /** Cut, copy or clear selected regions. * @param op Operation (Cut, Copy or Clear) */ void Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) -{ +{ /* we can't use a std::map here because the ordering is important, and we can't trivially sort a map when we want ordered access to both elements. i think. */ @@ -4106,15 +4131,21 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) boost::shared_ptr<Playlist> pl = (*x)->region()->playlist(); if (pl) { + set<PlaylistState, lt_playlist>::iterator fl; - PlaylistState before; - before.playlist = pl; - before.before = &pl->get_state(); - - insert_result = freezelist.insert (before); - - if (insert_result.second) { + //only take state if this is a new playlist. + for (fl = freezelist.begin(); fl != freezelist.end(); ++fl) { + if ((*fl).playlist == pl) { + break; + } + } + + if (fl == freezelist.end()) { + PlaylistState before; + before.playlist = pl; + before.before = &pl->get_state(); pl->freeze (); + insert_result = freezelist.insert (before); } } } diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc index bbf5447160..7c94beaeac 100644 --- a/gtk2_ardour/port_matrix_grid.cc +++ b/gtk2_ardour/port_matrix_grid.cc @@ -141,6 +141,8 @@ PortMatrixGrid::render (cairo_t* cr) case PortMatrixNode::PARTIAL: draw_association_indicator (cr, bx, by, 0.5); break; + default: + break; } by += row_height(); @@ -179,6 +181,9 @@ PortMatrixGrid::render (cairo_t* cr) case PortMatrixNode::NOT_ASSOCIATED: break; + + default: + break; } y += row_height(); @@ -483,6 +488,9 @@ PortMatrixGrid::bundle_to_bundle_state (boost::shared_ptr<ARDOUR::Bundle> a, boo have_diagonal_not_association = true; } break; + + default: + break; } } } diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index f9b4cc0e6e..a259a25695 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -433,7 +433,9 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins) processor->activate (); } - if (_route->add_processor (processor, &err_streams, 0, _placement)) { + assign_default_sort_key (processor); + + if (_route->add_processor (processor, &err_streams)) { weird_plugin_dialog (**p, err_streams, _route); // XXX SHAREDPTR delete plugin here .. do we even need to care? } else { @@ -497,7 +499,9 @@ ProcessorBox::choose_insert () processor->ActiveChanged.connect (bind ( mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr<Processor>(processor))); - _route->add_processor (processor, 0, 0, _placement); + + assign_default_sort_key (processor); + _route->add_processor (processor); } void @@ -549,7 +553,8 @@ ProcessorBox::send_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> break; case IOSelector::Accepted: - _route->add_processor (processor, 0, 0, _placement); + assign_default_sort_key (processor); + _route->add_processor (processor); if (Profile->get_sae()) { processor->activate (); } @@ -606,7 +611,8 @@ ProcessorBox::return_io_finished (IOSelector::Result r, boost::weak_ptr<Processo break; case IOSelector::Accepted: - _route->add_processor (processor, 0, 0, _placement); + assign_default_sort_key (processor); + _route->add_processor (processor); if (Profile->get_sae()) { processor->activate (); } @@ -636,10 +642,10 @@ ProcessorBox::redisplay_processors () switch (_placement) { case PreFader: - build_processor_tooltip(processor_eventbox, _("Pre-fader inserts, sends & plugins:")); + build_processor_tooltip (processor_eventbox, _("Pre-fader inserts, sends & plugins:")); break; case PostFader: - build_processor_tooltip(processor_eventbox, _("Post-fader inserts, sends & plugins:")); + build_processor_tooltip (processor_eventbox, _("Post-fader inserts, sends & plugins:")); break; } } @@ -790,9 +796,15 @@ ProcessorBox::row_deleted (const Gtk::TreeModel::Path& path) void ProcessorBox::compute_processor_sort_keys () { - uint32_t sort_key = 0; + uint32_t sort_key; Gtk::TreeModel::Children children = model->children(); + if (_placement == PreFader) { + sort_key = 0; + } else { + sort_key = _route->fader_sort_key() + 1; + } + for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { boost::shared_ptr<Processor> r = (*iter)[columns.processor]; r->set_sort_key (sort_key); @@ -1013,6 +1025,17 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist) } else if (type->value() == "meter") { p = _route->shared_peak_meter(); + } else if (type->value() == "main-outs") { + /* do not copy-n-paste main outs */ + continue; + + } else if (type->value() == "amp") { + /* do not copy-n-paste amp */ + continue; + + } else if (type->value() == "listen") { + p.reset (new Delivery (_session, **niter)); + } else { p.reset (new PluginInsert (_session, **niter)); } @@ -1024,7 +1047,13 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist) } } - if (_route->add_processors (copies, 0, _placement)) { + if (copies.empty()) { + return; + } + + assign_default_sort_key (copies.front()); + + if (_route->add_processors (copies, 0, copies.front()->sort_key())) { string msg = _( "Copying the set of processors on the clipboard failed,\n\ @@ -1539,3 +1568,12 @@ ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi) return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); } +void +ProcessorBox::assign_default_sort_key (boost::shared_ptr<Processor> p) +{ + p->set_sort_key (_placement == PreFader ? 0 : 9999); + cerr << "default sort key for " + << _placement << " = " << p->sort_key() + << endl; +} + diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 3286c14e6c..f5af4c49dc 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -168,6 +168,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); void compute_processor_sort_keys (); + void assign_default_sort_key (boost::shared_ptr<ARDOUR::Processor>); std::vector<sigc::connection> processor_active_connections; std::vector<sigc::connection> processor_name_connections; diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 6425b84c27..2127d1354c 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -169,9 +169,19 @@ StreamView::set_samples_per_unit (gdouble spp) } void +StreamView::add_region_view_weak (boost::weak_ptr<Region> r) +{ + boost::shared_ptr<Region> sp (r.lock()); + + if (sp) { + add_region_view (sp); + } +} + +void StreamView::add_region_view (boost::shared_ptr<Region> r) { - // ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_region_view), r)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::add_region_view), r)); add_region_view_internal (r, true); if (_layer_display == Stacked) { @@ -284,6 +294,7 @@ void StreamView::playlist_modified_weak (boost::weak_ptr<Diskstream> ds) { boost::shared_ptr<Diskstream> sp (ds.lock()); + if (sp) { playlist_modified (sp); } @@ -300,7 +311,7 @@ StreamView::playlist_modified (boost::shared_ptr<Diskstream> ds) _layers = ds->playlist()->top_layer() + 1; update_contents_height (); update_coverage_frames (); - redisplay_diskstream (); + //redisplay_diskstream (); } } @@ -342,8 +353,13 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) /* catch changes */ playlist_connections.push_back (ds->playlist()->Modified.connect (bind ( - mem_fun (*this, &StreamView::playlist_modified_weak), - ds))); + mem_fun (*this, &StreamView::playlist_modified_weak), ds))); + + playlist_connections.push_back (ds->playlist()->RegionAdded.connect ( + mem_fun (*this, &StreamView::add_region_view_weak))); + + playlist_connections.push_back (ds->playlist()->RegionRemoved.connect ( + mem_fun (*this, &StreamView::remove_region_view))); } void diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index 546d51dee2..bb6047df23 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -93,7 +93,10 @@ public: void get_inverted_selectables (Selection&, std::list<Selectable* >& results); virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region> r) {} + + void add_region_view_weak (boost::weak_ptr<ARDOUR::Region> r); void add_region_view (boost::shared_ptr<ARDOUR::Region>); + void region_layered (RegionView*); virtual void update_contents_height (); @@ -114,7 +117,7 @@ protected: void update_rec_box (); virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, - bool wait_for_waves, bool recording = false) = 0; + bool wait_for_waves, bool recording = false) = 0; virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>); |