diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/rhythm_ferret.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/rhythm_ferret.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 8 |
7 files changed, 71 insertions, 19 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 281ccff95b..ca5ab79bda 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -159,6 +159,7 @@ class Editor : public PublicEditor void connect_to_image_compositor() ; void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ; TimeAxisView* get_named_time_axis(const std::string & name) ; + void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>); void consider_auditioning (boost::shared_ptr<ARDOUR::Region>); void hide_a_region (boost::shared_ptr<ARDOUR::Region>); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 4bf73ecaff..306129b97d 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -566,3 +566,11 @@ Editor::route_list_display_drag_data_received (const RefPtr<Gdk::DragContext>& c cerr << "some other kind of drag\n"; context->drag_finish (true, false, time); } + +void +Editor::foreach_time_axis_view (sigc::slot<void,TimeAxisView&> theslot) +{ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + theslot (**i); + } +} diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 0c8734a753..4f23483b49 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -161,6 +161,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void toggle_meter_updating() = 0; virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0; virtual void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false) = 0; + virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0; sigc::signal<void> ZoomFocusChanged; sigc::signal<void> ZoomChanged; diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc index 83852b33b3..63440e7ab1 100644 --- a/gtk2_ardour/rhythm_ferret.cc +++ b/gtk2_ardour/rhythm_ferret.cc @@ -191,7 +191,7 @@ RhythmFerret::run_analysis () } for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) { - (*i)->get_time_axis_view().show_temporary_lines (current_results); + (*i)->get_time_axis_view().show_feature_lines (current_results); } } @@ -269,7 +269,7 @@ RhythmFerret::do_split_action () tmp = i; ++tmp; - (*i)->get_time_axis_view().hide_temporary_lines (); + (*i)->get_time_axis_view().hide_feature_lines (); editor.split_region_at_points ((*i)->region(), current_results, false); @@ -286,3 +286,16 @@ RhythmFerret::set_session (Session* s) ArdourDialog::set_session (s); current_results.clear (); } + +static void hide_time_axis_features (TimeAxisView& tav) +{ + tav.hide_feature_lines (); +} + +void +RhythmFerret::on_hide () +{ + editor.foreach_time_axis_view (sigc::ptr_fun (hide_time_axis_features)); + ArdourDialog::on_hide (); +} + diff --git a/gtk2_ardour/rhythm_ferret.h b/gtk2_ardour/rhythm_ferret.h index 891b447a11..2ddb2a4ffd 100644 --- a/gtk2_ardour/rhythm_ferret.h +++ b/gtk2_ardour/rhythm_ferret.h @@ -41,6 +41,9 @@ class RhythmFerret : public ArdourDialog { ~RhythmFerret (); void set_session (ARDOUR::Session*); + + protected: + void on_hide (); private: PublicEditor& editor; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 316d46e113..207402a7cb 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -171,6 +171,10 @@ TimeAxisView::~TimeAxisView() delete (*i)->end_trim; } + for (list<SimpleLine*>::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) { + delete (*i); + } + if (selection_group) { delete selection_group; selection_group = 0; @@ -618,6 +622,14 @@ TimeAxisView::build_display_menu () void TimeAxisView::set_samples_per_unit (double spu) { + AnalysisFeatureList::const_iterator i; + list<ArdourCanvas::SimpleLine*>::iterator l; + + for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) { + (*l)->property_x1() = editor.frame_to_pixel (*i); + (*l)->property_x2() = editor.frame_to_pixel (*i); + } + for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) { (*i)->set_samples_per_unit (spu); } @@ -1113,35 +1125,47 @@ TimeAxisView::covers_y_position (double y) } void -TimeAxisView::show_temporary_lines (const AnalysisFeatureList& pos) +TimeAxisView::show_feature_lines (const AnalysisFeatureList& pos) { - while (temp_lines.size()< pos.size()) { + analysis_features = pos; + reshow_feature_lines (); +} + + +void +TimeAxisView::hide_feature_lines () +{ + list<ArdourCanvas::SimpleLine*>::iterator l; + + for (l = feature_lines.begin(); l != feature_lines.end(); ++l) { + (*l)->hide(); + } +} + +void +TimeAxisView::reshow_feature_lines () +{ + while (feature_lines.size()< analysis_features.size()) { ArdourCanvas::SimpleLine* l = new ArdourCanvas::SimpleLine (*canvas_display); l->property_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get(); l->property_y1() = 0; l->property_y2() = height; - temp_lines.push_back (l); + feature_lines.push_back (l); } - while (temp_lines.size() > pos.size()) { - ArdourCanvas::SimpleLine *line = temp_lines.back(); - temp_lines.pop_back (); + while (feature_lines.size() > analysis_features.size()) { + ArdourCanvas::SimpleLine *line = feature_lines.back(); + feature_lines.pop_back (); delete line; } AnalysisFeatureList::const_iterator i; list<ArdourCanvas::SimpleLine*>::iterator l; - for (i = pos.begin(), l = temp_lines.begin(); i != pos.end() && l != temp_lines.end(); ++i, ++l) { + for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) { (*l)->property_x1() = editor.frame_to_pixel (*i); (*l)->property_x2() = editor.frame_to_pixel (*i); + (*l)->show (); } } -void -TimeAxisView::hide_temporary_lines () -{ - for (list<ArdourCanvas::SimpleLine*>::iterator l = temp_lines.begin(); l != temp_lines.end(); ++l) { - (*l)->hide (); - } -} diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index b966f2b59e..7faf0e344f 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -176,8 +176,8 @@ class TimeAxisView : public virtual AxisView virtual ARDOUR::RouteGroup* edit_group() const { return 0; } virtual boost::shared_ptr<ARDOUR::Playlist> playlist() const { return boost::shared_ptr<ARDOUR::Playlist> (); } - virtual void show_temporary_lines (const ARDOUR::AnalysisFeatureList&); - virtual void hide_temporary_lines (); + virtual void show_feature_lines (const ARDOUR::AnalysisFeatureList&); + virtual void hide_feature_lines (); virtual void set_samples_per_unit (double); virtual void show_selection (TimeSelection&); @@ -332,7 +332,9 @@ class TimeAxisView : public virtual AxisView void set_height_pixels (uint32_t h); void color_handler (); - list<ArdourCanvas::SimpleLine*> temp_lines; + list<ArdourCanvas::SimpleLine*> feature_lines; + ARDOUR::AnalysisFeatureList analysis_features; + void reshow_feature_lines (); }; /* class TimeAxisView */ |