summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-10-21 22:59:29 +0000
committerDavid Robillard <d@drobilla.net>2006-10-21 22:59:29 +0000
commit22e41063d5b0c4c80eab3e3a375b734ca7d76169 (patch)
treee95cc99ff4e2f12bb41d1fdb0d1abf9525e92416 /gtk2_ardour
parentfedf3d34f32264ac57c6a222b678dc90f2bb1a88 (diff)
Merged with trunk R999.
git-svn-id: svn://localhost/ardour2/branches/midi@1000 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_streamview.cc10
-rw-r--r--gtk2_ardour/crossfade_view.cc12
-rw-r--r--gtk2_ardour/editor.cc29
-rw-r--r--gtk2_ardour/editor.h2
-rw-r--r--gtk2_ardour/editor_actions.cc14
-rw-r--r--gtk2_ardour/editor_mouse.cc2
-rw-r--r--gtk2_ardour/editor_ops.cc33
-rw-r--r--gtk2_ardour/midi_streamview.cc4
-rw-r--r--gtk2_ardour/route_time_axis.cc3
-rw-r--r--gtk2_ardour/route_time_axis.h1
-rw-r--r--gtk2_ardour/streamview.cc15
-rw-r--r--gtk2_ardour/streamview.h1
12 files changed, 69 insertions, 57 deletions
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index f88b04ae1d..bef35c572c 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -253,7 +253,7 @@ AudioStreamView::add_crossfade (Crossfade *crossfade)
/* first see if we already have a CrossfadeView for this Crossfade */
for (list<CrossfadeView *>::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
- if (&(*i)->crossfade == crossfade) {
+ if ((*i)->crossfade == *crossfade) {
if (!crossfades_visible) {
(*i)->hide();
} else {
@@ -287,7 +287,7 @@ AudioStreamView::add_crossfade (Crossfade *crossfade)
crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade));
crossfade_views.push_back (cv);
- if (!crossfades_visible) {
+ if (!Config->get_xfades_visible() || !crossfades_visible) {
cv->hide ();
}
}
@@ -312,7 +312,6 @@ AudioStreamView::redisplay_diskstream ()
list<RegionView *>::iterator i, tmp;
list<CrossfadeView*>::iterator xi, tmpx;
-
for (i = region_views.begin(); i != region_views.end(); ++i) {
(*i)->set_valid (false);
}
@@ -326,6 +325,7 @@ AudioStreamView::redisplay_diskstream ()
if (_trackview.is_audio_track()) {
_trackview.get_diskstream()->playlist()->foreach_region (static_cast<StreamView*>(this), &StreamView::add_region_view);
+
AudioPlaylist* apl = dynamic_cast<AudioPlaylist*>(_trackview.get_diskstream()->playlist());
if (apl)
apl->foreach_crossfade (this, &AudioStreamView::add_crossfade);
@@ -357,7 +357,9 @@ AudioStreamView::redisplay_diskstream ()
/* now fix layering */
- playlist_modified ();
+ for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+ region_layered (*i);
+ }
}
void
diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc
index baf0f2a346..42a1a47227 100644
--- a/gtk2_ardour/crossfade_view.cc
+++ b/gtk2_ardour/crossfade_view.cc
@@ -127,6 +127,10 @@ CrossfadeView::crossfade_changed (Change what_changed)
set_duration (crossfade.overlap_length(), this);
need_redraw_curves = true;
}
+
+ if (what_changed & Crossfade::FollowOverlapChanged) {
+ need_redraw_curves = true;
+ }
if (what_changed & Crossfade::ActiveChanged) {
/* calls redraw_curves */
@@ -142,9 +146,15 @@ CrossfadeView::redraw_curves ()
Points* points;
int32_t npoints;
float* vec;
-
double h;
+ if (!crossfade.following_overlap()) {
+ /* curves should not be visible */
+ fade_in->hide ();
+ fade_out->hide ();
+ return;
+ }
+
/*
At "height - 3.0" the bottom of the crossfade touches the name highlight or the bottom of the track (if the
track is either Small or Smaller.
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 9924a2a929..b3e2285714 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1691,7 +1691,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
become selected.
*/
- region_menu->signal_map_event().connect (bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, region));
+ region_menu->signal_map_event().connect (bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region)));
items.push_back (MenuElem (_("Popup region editor"), mem_fun(*this, &Editor::edit_region)));
items.push_back (MenuElem (_("Raise to top layer"), mem_fun(*this, &Editor::raise_region_to_top)));
@@ -3074,9 +3074,6 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
switch (clicked_regionview->region()->coverage (first_frame, last_frame)) {
case OverlapNone:
- cerr << "no overlap, first = " << first_frame << " last = " << last_frame << " region = "
- << clicked_regionview->region()->first_frame() << " .. " << clicked_regionview->region()->last_frame() << endl;
-
if (last_frame < clicked_regionview->region()->first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region()->last_frame();
@@ -3087,9 +3084,6 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
break;
case OverlapExternal:
- cerr << "external overlap, first = " << first_frame << " last = " << last_frame << " region = "
- << clicked_regionview->region()->first_frame() << " .. " << clicked_regionview->region()->last_frame() << endl;
-
if (last_frame < clicked_regionview->region()->first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region()->last_frame();
@@ -3100,9 +3094,6 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
break;
case OverlapInternal:
- cerr << "internal overlap, first = " << first_frame << " last = " << last_frame << " region = "
- << clicked_regionview->region()->first_frame() << " .. " << clicked_regionview->region()->last_frame() << endl;
-
if (last_frame < clicked_regionview->region()->first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region()->last_frame();
@@ -3207,9 +3198,15 @@ Editor::set_selected_regionview_from_region_list (boost::shared_ptr<Region> regi
}
bool
-Editor::set_selected_regionview_from_map_event (GdkEventAny* ev, StreamView* sv, boost::shared_ptr<Region> r)
+Editor::set_selected_regionview_from_map_event (GdkEventAny* ev, StreamView* sv, boost::weak_ptr<Region> weak_r)
{
RegionView* rv;
+ boost::shared_ptr<Region> r (weak_r.lock());
+
+ if (!r) {
+ return true;
+ }
+
boost::shared_ptr<AudioRegion> ar;
if ((ar = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) {
@@ -3533,15 +3530,15 @@ Editor::zoom_focus_selection_done ()
string choice = zoom_focus_selector.get_active_text();
ZoomFocus focus_type = ZoomFocusLeft;
- if (choice == _("Focus Left")) {
+ if (choice == _("Left")) {
focus_type = ZoomFocusLeft;
- } else if (choice == _("Focus Right")) {
+ } else if (choice == _("Right")) {
focus_type = ZoomFocusRight;
- } else if (choice == _("Focus Center")) {
+ } else if (choice == _("Center")) {
focus_type = ZoomFocusCenter;
- } else if (choice == _("Focus Playhead")) {
+ } else if (choice == _("Playhead")) {
focus_type = ZoomFocusPlayhead;
- } else if (choice == _("Focus Edit Cursor")) {
+ } else if (choice == _("Edit Cursor")) {
focus_type = ZoomFocusEdit;
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index c26248c1e7..e604053254 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -441,7 +441,7 @@ class Editor : public PublicEditor
bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
- bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::shared_ptr<ARDOUR::Region>);
+ bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
void collect_new_region_view (RegionView *);
Gtk::Menu track_context_menu;
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 6fb8950047..0485f4cc8a 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -782,13 +782,13 @@ Editor::toggle_auto_xfade ()
void
Editor::toggle_xfades_active ()
{
- ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_crossfades_active, &Configuration::get_crossfades_active);
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_xfades_active, &Configuration::get_xfades_active);
}
void
Editor::toggle_xfade_visibility ()
{
- ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_crossfades_visible, &Configuration::get_crossfades_visible);
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
}
void
@@ -811,12 +811,14 @@ Editor::parameter_changed (const char* parameter_name)
update_just_smpte ();
} else if (PARAM_IS ("video-pullup")) {
update_video_pullup ();
- } else if (PARAM_IS ("crossfades-active")) {
- ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_crossfades_active);
- } else if (PARAM_IS ("crossfades-visible")) {
- ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_crossfades_visible);
+ } else if (PARAM_IS ("xfades-active")) {
+ ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
+ } else if (PARAM_IS ("xfades-visible")) {
+ ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
} else if (PARAM_IS ("auto-xfade")) {
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
+ } else if (PARAM_IS ("xfade-model")) {
+ update_crossfade_model ();
} else if (PARAM_IS ("edit-mode")) {
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
}
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index ae76025cc6..e3954f00de 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -4833,7 +4833,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes_t pos)
// playlist is frozen, so we have to update manually
- playlist->StateChanged (Change (~0)); /* EMIT SIGNAL */
+ playlist->Modified(); /* EMIT SIGNAL */
}
gint
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 6a96b57795..7122d4663c 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2910,14 +2910,26 @@ Editor::cut_copy_points (CutCopyOp op)
}
}
+struct PlaylistState {
+ Playlist* playlist;
+ XMLNode* before;
+};
+
+struct lt_playlist {
+ bool operator () (const PlaylistState& a, const PlaylistState& b) {
+ return a.playlist < b.playlist;
+ }
+};
+
void
Editor::cut_copy_regions (CutCopyOp op)
{
typedef std::map<AudioPlaylist*,AudioPlaylist*> PlaylistMapping;
PlaylistMapping pmap;
nframes_t first_position = max_frames;
- set<Playlist*> freezelist;
- pair<set<Playlist*>::iterator,bool> insert_result;
+
+ set<PlaylistState, lt_playlist> freezelist;
+ pair<set<PlaylistState, lt_playlist>::iterator,bool> insert_result;
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
first_position = min ((*x)->region()->position(), first_position);
@@ -2925,10 +2937,15 @@ Editor::cut_copy_regions (CutCopyOp op)
if (op == Cut || op == Clear) {
AudioPlaylist *pl = dynamic_cast<AudioPlaylist*>((*x)->region()->playlist());
if (pl) {
- insert_result = freezelist.insert (pl);
+
+ PlaylistState before;
+ before.playlist = pl;
+ before.before = &pl->get_state();
+
+ insert_result = freezelist.insert (before);
+
if (insert_result.second) {
pl->freeze ();
- session->add_command (new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
}
}
}
@@ -2990,9 +3007,9 @@ Editor::cut_copy_regions (CutCopyOp op)
cut_buffer->set (foo);
}
- for (set<Playlist*>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
- (*pl)->thaw ();
- session->add_command (new MementoCommand<Playlist>(*(*pl), 0, &(*pl)->get_state()));
+ for (set<PlaylistState, lt_playlist>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
+ (*pl).playlist->thaw ();
+ session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
}
}
@@ -3323,7 +3340,7 @@ Editor::normalize_region ()
continue;
XMLNode &before = arv->region()->get_state();
arv->audio_region()->normalize_to (0.0f);
- session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ // session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}
commit_reversible_command ();
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index d718cc9802..1b3879024a 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -142,7 +142,9 @@ MidiStreamView::redisplay_diskstream ()
/* now fix layering */
- playlist_modified ();
+ for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+ region_layered (*i);
+ }
}
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index e0d976c233..eb96791d28 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -244,9 +244,6 @@ RouteTimeAxisView::set_playlist (Playlist *newplaylist)
assert(pl);
modified_connection.disconnect ();
- state_changed_connection.disconnect ();
-
- state_changed_connection = pl->StateChanged.connect (mem_fun(*this, &RouteTimeAxisView::playlist_state_changed));
modified_connection = pl->Modified.connect (mem_fun(*this, &RouteTimeAxisView::playlist_modified));
}
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 65d82506b8..1eb0cea00b 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -248,7 +248,6 @@ protected:
vector<RedirectAutomationLine*> redirect_automation_curves;
sigc::connection modified_connection;
- sigc::connection state_changed_connection;
};
#endif /* __ardour_route_time_axis_h__ */
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 0b06858536..191a9ffb54 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -207,9 +207,7 @@ StreamView::playlist_modified ()
{
ENSURE_GUI_THREAD (mem_fun (*this, &StreamView::playlist_modified));
- for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
- region_layered (*i);
- }
+ redisplay_diskstream ();
}
void
@@ -232,21 +230,10 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
/* catch changes */
- playlist_connections.push_back (ds->playlist()->RegionAdded.connect (mem_fun (*this, &StreamView::add_region_view)));
- playlist_connections.push_back (ds->playlist()->RegionRemoved.connect (mem_fun (*this, &StreamView::remove_region_view)));
- playlist_connections.push_back (ds->playlist()->StateChanged.connect (mem_fun (*this, &StreamView::playlist_state_changed)));
playlist_connections.push_back (ds->playlist()->Modified.connect (mem_fun (*this, &StreamView::playlist_modified)));
}
void
-StreamView::playlist_state_changed (Change ignored)
-{
- ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_state_changed), ignored));
-
- redisplay_diskstream ();
-}
-
-void
StreamView::diskstream_changed ()
{
Track *t;
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index 3774fd4dbb..39c04aea7f 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -116,7 +116,6 @@ protected:
virtual void redisplay_diskstream () = 0;
void diskstream_changed ();
- void playlist_state_changed (ARDOUR::Change);
virtual void playlist_changed (boost::shared_ptr<ARDOUR::Diskstream>);
virtual void playlist_modified ();