summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_routes.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-07-09 13:39:45 +0000
committerCarl Hetherington <carl@carlh.net>2009-07-09 13:39:45 +0000
commit4297071b3f7360b17d81ef9cf36b8d75d46d2818 (patch)
tree13cbb169cfcf79a2e845d8860f0f98e192f3a8d3 /gtk2_ardour/editor_routes.cc
parent0f8031da06e131595b3625169f9687c1a1ab2f3a (diff)
Use shared_ptr for the TimeAxisView hierarchy.
git-svn-id: svn://localhost/ardour2/branches/3.0@5339 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_routes.cc')
-rw-r--r--gtk2_ardour/editor_routes.cc55
1 files changed, 29 insertions, 26 deletions
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 46fd4548b3..e3f3c9d736 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -122,8 +122,8 @@ EditorRoutes::on_tv_rec_enable_toggled (Glib::ustring const & path_string)
// Get the model row that has been toggled.
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
- TimeAxisView *tv = row[_columns.tv];
- AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+ TimeAxisViewPtr tv = row[_columns.tv];
+ AudioTimeAxisViewPtr atv = boost::dynamic_pointer_cast<AudioTimeAxisView> (tv);
if (atv != 0 && atv->is_audio_track()){
atv->get_diskstream()->set_record_enabled(!atv->get_diskstream()->record_enabled());
@@ -173,7 +173,7 @@ EditorRoutes::redisplay ()
}
for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
- TimeAxisView *tv = (*i)[_columns.tv];
+ TimeAxisViewPtr tv = (*i)[_columns.tv];
boost::shared_ptr<Route> route = (*i)[_columns.route];
if (tv == 0) {
@@ -192,7 +192,7 @@ EditorRoutes::redisplay ()
bool visible = (*i)[_columns.visible];
- /* show or hide the TimeAxisView */
+ /* show or hide the TimeAxisViewPtr */
if (visible) {
tv->set_marked_for_display (true);
position += tv->show_at (position, n, &_editor->edit_controls_vbox);
@@ -250,14 +250,14 @@ EditorRoutes::changed (Gtk::TreeModel::Path const & path, Gtk::TreeModel::iterat
}
void
-EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
+EditorRoutes::routes_added (list<RouteTimeAxisViewPtr> routes)
{
TreeModel::Row row;
_redisplay_does_not_sync_order_keys = true;
suspend_redisplay ();
- for (list<RouteTimeAxisView*>::iterator x = routes.begin(); x != routes.end(); ++x) {
+ for (list<RouteTimeAxisViewPtr>::iterator x = routes.begin(); x != routes.end(); ++x) {
row = *(_model->append ());
@@ -310,7 +310,7 @@ EditorRoutes::handle_gui_changes (string const & what, void *src)
}
void
-EditorRoutes::route_removed (TimeAxisView *tv)
+EditorRoutes::route_removed (TimeAxisViewPtr tv)
{
ENSURE_GUI_THREAD (bind (mem_fun(*this, &EditorRoutes::route_removed), tv));
@@ -324,7 +324,8 @@ EditorRoutes::route_removed (TimeAxisView *tv)
_redisplay_does_not_sync_order_keys = true;
for (ri = rows.begin(); ri != rows.end(); ++ri) {
- if ((*ri)[_columns.tv] == tv) {
+ TimeAxisViewPtr t = (*ri)[_columns.tv];
+ if (t == tv) {
_model->erase (ri);
break;
}
@@ -364,7 +365,7 @@ EditorRoutes::update_visibility ()
suspend_redisplay ();
for (i = rows.begin(); i != rows.end(); ++i) {
- TimeAxisView *tv = (*i)[_columns.tv];
+ TimeAxisViewPtr tv = (*i)[_columns.tv];
(*i)[_columns.visible] = tv->marked_for_display ();
cerr << "marked " << tv->name() << " for display = " << tv->marked_for_display() << endl;
}
@@ -373,13 +374,14 @@ EditorRoutes::update_visibility ()
}
void
-EditorRoutes::hide_track_in_display (TimeAxisView& tv)
+EditorRoutes::hide_track_in_display (TimeAxisViewPtr tv)
{
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
for (i = rows.begin(); i != rows.end(); ++i) {
- if ((*i)[_columns.tv] == &tv) {
+ TimeAxisViewPtr t = (*i)[_columns.tv];
+ if (t == tv) {
(*i)[_columns.visible] = false;
break;
}
@@ -387,13 +389,14 @@ EditorRoutes::hide_track_in_display (TimeAxisView& tv)
}
void
-EditorRoutes::show_track_in_display (TimeAxisView& tv)
+EditorRoutes::show_track_in_display (TimeAxisViewPtr tv)
{
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
for (i = rows.begin(); i != rows.end(); ++i) {
- if ((*i)[_columns.tv] == &tv) {
+ TimeAxisViewPtr t = (*i)[_columns.tv];
+ if (t == tv) {
(*i)[_columns.visible] = true;
break;
}
@@ -459,7 +462,7 @@ EditorRoutes::hide_all_tracks (bool with_select)
for (i = rows.begin(); i != rows.end(); ++i) {
TreeModel::Row row = (*i);
- TimeAxisView *tv = row[_columns.tv];
+ TimeAxisViewPtr tv = row[_columns.tv];
if (tv == 0) {
continue;
@@ -488,7 +491,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn)
for (i = rows.begin(); i != rows.end(); ++i) {
TreeModel::Row row = (*i);
- TimeAxisView* tv = row[_columns.tv];
+ TimeAxisViewPtr tv = row[_columns.tv];
if (tv == 0) {
continue;
@@ -510,14 +513,14 @@ EditorRoutes::set_all_audio_visibility (int tracks, bool yn)
for (i = rows.begin(); i != rows.end(); ++i) {
TreeModel::Row row = (*i);
- TimeAxisView* tv = row[_columns.tv];
- AudioTimeAxisView* atv;
+ TimeAxisViewPtr tv = row[_columns.tv];
+ AudioTimeAxisViewPtr atv;
if (tv == 0) {
continue;
}
- if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) {
+ if ((atv = boost::dynamic_pointer_cast<AudioTimeAxisView>(tv)) != 0) {
switch (tracks) {
case 0:
(*i)[_columns.visible] = yn;
@@ -600,7 +603,7 @@ EditorRoutes::button_press (GdkEventButton* ev)
return false;
case 1:
if ((iter = _model->get_iter (path))) {
- TimeAxisView* tv = (*iter)[_columns.tv];
+ TimeAxisViewPtr tv = (*iter)[_columns.tv];
if (tv) {
bool visible = (*iter)[_columns.visible];
(*iter)[_columns.visible] = !visible;
@@ -656,10 +659,10 @@ EditorRoutes::initial_display ()
_no_redisplay = true;
for (i = rows.begin(); i != rows.end(); ++i) {
- TimeAxisView *tv = (*i)[_columns.tv];
- RouteTimeAxisView *rtv;
+ TimeAxisViewPtr tv = (*i)[_columns.tv];
+ RouteTimeAxisViewPtr rtv;
- if ((rtv = dynamic_cast<RouteTimeAxisView*>(tv)) != 0) {
+ if ((rtv = boost::dynamic_pointer_cast<RouteTimeAxisView>(tv)) != 0) {
if (rtv->route()->is_master()) {
_display.get_selection()->unselect (i);
}
@@ -703,14 +706,14 @@ EditorRoutes::move_selected_tracks (bool up)
return;
}
- typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
+ typedef std::pair<TimeAxisViewPtr,boost::shared_ptr<Route> > ViewRoute;
std::list<ViewRoute> view_routes;
std::vector<int> neworder;
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator ri;
for (ri = rows.begin(); ri != rows.end(); ++ri) {
- TimeAxisView* tv = (*ri)[_columns.tv];
+ TimeAxisViewPtr tv = (*ri)[_columns.tv];
boost::shared_ptr<Route> route = (*ri)[_columns.route];
view_routes.push_back (ViewRoute (tv, route));
@@ -828,10 +831,10 @@ EditorRoutes::update_rec_display ()
}
}
-list<TimeAxisView*>
+list<TimeAxisViewPtr>
EditorRoutes::views () const
{
- list<TimeAxisView*> v;
+ list<TimeAxisViewPtr> v;
for (TreeModel::Children::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
v.push_back ((*i)[_columns.tv]);
}