13
0

Add some convenient public editor methods (for lua-bindings)

and s/get// in the old API for consistency.
This commit is contained in:
Robin Gareus 2017-02-24 13:03:24 +01:00
parent 89c02f4fd7
commit 9e543beb56
5 changed files with 57 additions and 18 deletions

View File

@ -5088,7 +5088,7 @@ Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<R
}
RegionView*
Editor::get_regionview_from_region (boost::shared_ptr<Region> region) const
Editor::regionview_from_region (boost::shared_ptr<Region> region) const
{
for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
RouteTimeAxisView* tatv;
@ -5105,6 +5105,20 @@ Editor::get_regionview_from_region (boost::shared_ptr<Region> region) const
return NULL;
}
RouteTimeAxisView*
Editor::rtav_from_route (boost::shared_ptr<Route> route) const
{
for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
RouteTimeAxisView* rtav;
if ((rtav = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
if (rtav->route() == route) {
return rtav;
}
}
}
return NULL;
}
void
Editor::show_rhythm_ferret ()
{
@ -5484,6 +5498,9 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
void
Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
{
if (!tv) {
return;
}
if (apply_to_selection) {
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) {
@ -5506,6 +5523,18 @@ Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
}
}
void
Editor::show_track_in_display (TimeAxisView* tv, bool move_into_view)
{
if (!tv) {
return;
}
_routes->show_track_in_display (*tv);
if (move_into_view) {
ensure_time_axis_view_is_visible (*tv, false);
}
}
bool
Editor::sync_track_view_list_and_routes ()
{

View File

@ -331,6 +331,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_selected_mixer_strip (TimeAxisView&);
void mixer_strip_width_changed ();
void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
void show_track_in_display (TimeAxisView* tv, bool move_into_view = false);
/* nudge is initiated by transport controls owned by ARDOUR_UI */
@ -734,7 +735,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
RegionView* get_regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const;
RegionView* regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const;
RouteTimeAxisView* rtav_from_route (boost::shared_ptr<ARDOUR::Route>) const;
void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
void mapover_tracks_with_unique_playlists (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;

View File

@ -597,9 +597,15 @@ LuaInstance::register_classes (lua_State* L)
.addCast<TimeAxisView> ("to_timeaxisview")
.endClass ()
// std::list<Selectable*>
.beginStdCPtrList <Selectable> ("SelectionList")
.endClass ()
// std::list<TimeAxisView*>
.beginStdCPtrList <TimeAxisView> ("TrackViewStdList")
.endClass ()
.beginClass <RegionSelection> ("RegionSelection")
.addFunction ("start", &RegionSelection::start)
.addFunction ("end_frame", &RegionSelection::end_frame)
@ -616,8 +622,9 @@ LuaInstance::register_classes (lua_State* L)
.deriveClass <MarkerSelection, std::list<ArdourMarker*> > ("MarkerSelection")
.endClass ()
.beginClass <TrackViewList> ("TrackViewList")
.addFunction ("routelist", &TrackViewList::routelist) // XXX check windows binding (libardour)
.deriveClass <TrackViewList, std::list<TimeAxisView*> > ("TrackViewList")
.addFunction ("contains", &TrackViewList::contains)
.addFunction ("routelist", &TrackViewList::routelist)
.endClass ()
.deriveClass <TrackSelection, TrackViewList> ("TrackSelection")
@ -695,23 +702,23 @@ LuaInstance::register_classes (lua_State* L)
.addFunction ("get_current_zoom", &PublicEditor::get_current_zoom)
.addFunction ("reset_zoom", &PublicEditor::reset_zoom)
#if 0 // These need TimeAxisView* which isn't exposed, yet
.addFunction ("playlist_selector", &PublicEditor::playlist_selector)
.addFunction ("clear_playlist", &PublicEditor::clear_playlist)
.addFunction ("new_playlists", &PublicEditor::new_playlists)
.addFunction ("copy_playlists", &PublicEditor::copy_playlists)
.addFunction ("clear_playlists", &PublicEditor::clear_playlists)
#endif
.addFunction ("select_all_tracks", &PublicEditor::select_all_tracks)
.addFunction ("deselect_all", &PublicEditor::deselect_all)
#if 0
#if 0 // TimeAxisView& can't be bound (pure virtual fn)
.addFunction ("set_selected_track", &PublicEditor::set_selected_track)
.addFunction ("set_selected_mixer_strip", &PublicEditor::set_selected_mixer_strip)
.addFunction ("hide_track_in_display", &PublicEditor::hide_track_in_display)
.addFunction ("ensure_time_axis_view_is_visible", &PublicEditor::ensure_time_axis_view_is_visible)
#endif
.addFunction ("hide_track_in_display", &PublicEditor::hide_track_in_display)
.addFunction ("show_track_in_display", &PublicEditor::show_track_in_display)
.addFunction ("get_regionview_from_region", &PublicEditor::get_regionview_from_region)
.addFunction ("regionview_from_region", &PublicEditor::regionview_from_region)
.addFunction ("set_stationary_playhead", &PublicEditor::set_stationary_playhead)
.addFunction ("stationary_playhead", &PublicEditor::stationary_playhead)
.addFunction ("set_follow_playhead", &PublicEditor::set_follow_playhead)
@ -722,7 +729,6 @@ LuaInstance::register_classes (lua_State* L)
.addFunction ("current_page_samples", &PublicEditor::current_page_samples)
.addFunction ("visible_canvas_height", &PublicEditor::visible_canvas_height)
.addFunction ("temporal_zoom_step", &PublicEditor::temporal_zoom_step)
//.addFunction ("ensure_time_axis_view_is_visible", &PublicEditor::ensure_time_axis_view_is_visible)
.addFunction ("override_visible_track_count", &PublicEditor::override_visible_track_count)
.addFunction ("scroll_tracks_down_line", &PublicEditor::scroll_tracks_down_line)
@ -754,15 +760,15 @@ LuaInstance::register_classes (lua_State* L)
.addFunction ("set_video_timeline_height", &PublicEditor::set_video_timeline_height)
#if 0
.addFunction ("get_route_view_by_route_id", &PublicEditor::get_route_view_by_route_id)
.addFunction ("get_equivalent_regions", &PublicEditor::get_equivalent_regions)
.addFunction ("axis_view_from_route", &PublicEditor::axis_view_from_route)
.addFunction ("axis_views_from_routes", &PublicEditor::axis_views_from_routes)
.addFunction ("get_track_views", &PublicEditor::get_track_views)
.addFunction ("drags", &PublicEditor::drags)
#endif
.addFunction ("get_route_view_by_route_id", &PublicEditor::get_route_view_by_route_id)
.addFunction ("get_track_views", &PublicEditor::get_track_views)
.addFunction ("rtav_from_route", &PublicEditor::rtav_from_route)
.addFunction ("axis_views_from_routes", &PublicEditor::axis_views_from_routes)
.addFunction ("center_screen", &PublicEditor::center_screen)
.addFunction ("get_smart_mode", &PublicEditor::get_smart_mode)

View File

@ -286,6 +286,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 0;
virtual void show_track_in_display (TimeAxisView* tv, bool move_into_view = false) = 0;
virtual void set_stationary_playhead (bool yn) = 0;
virtual void toggle_stationary_playhead () = 0;
@ -352,7 +353,8 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0;
virtual void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&, PBD::PropertyID) const = 0;
virtual RegionView* get_regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const = 0;
virtual RegionView* regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const = 0;
virtual RouteTimeAxisView* rtav_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
sigc::signal<void> ZoomChanged;
sigc::signal<void> Realized;

View File

@ -29,7 +29,7 @@ function factory () return function ()
else
skip = true;
-- get RegionView (GUI object to be selected)
local rv = Editor:get_regionview_from_region (region)
local rv = Editor:regionview_from_region (region)
-- add it to the list of Objects to be selected
sl:push_back (rv);
end