summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-04-06 23:42:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-04-06 23:42:07 +0000
commit2dd0b9321c87838e9f2276c02f5942daac2b836e (patch)
tree662e7204c0d3a3eea3183a9407a6b46871d0d152 /gtk2_ardour
parentfacf6168681010134085145b5b480d864d780cd4 (diff)
modified fix from carl for region copy-moves-original-to-start bug; change verbose canvas cursor color to be more distinct and readable; fix naming issues with imported files containing ':'; make sure [N] channels count shows up for whole files in region list; fix #1575, a subtle and nasty bug; improve positioning of verbose canvas cursor for ruler drags (but has a wierd side effect
git-svn-id: svn://localhost/ardour2/trunk@1675 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour.colors2
-rw-r--r--gtk2_ardour/editor_mouse.cc42
-rw-r--r--gtk2_ardour/editor_ops.cc5
-rw-r--r--gtk2_ardour/editor_region_list.cc14
-rw-r--r--gtk2_ardour/editor_rulers.cc13
-rw-r--r--gtk2_ardour/region_selection.cc8
-rw-r--r--gtk2_ardour/region_view.cc1
7 files changed, 58 insertions, 27 deletions
diff --git a/gtk2_ardour/ardour.colors b/gtk2_ardour/ardour.colors
index b68d270e6e..fa89646e09 100644
--- a/gtk2_ardour/ardour.colors
+++ b/gtk2_ardour/ardour.colors
@@ -42,7 +42,7 @@ cLocationRange 0.29 0.48 0.35 1.0
cLocationCDMarker 0.12 0.91 0.77 1.0
cLocationLoop 0.21 0.59 0.31 1.0
cLocationPunch 0.49 0.23 0.23 1.0
-cVerboseCanvasCursor 0 0 0 0.74
+cVerboseCanvasCursor 0.96 0.95 0.08 0.74
cRangeDragBarRect 0.59 0.59 0.59 0.78
cRangeDragBarRectFill 0.78 0.82 0.70 0.43
cRangeDragRect 0.59 0.59 0.59 0.78
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index b5c8042672..39680980d6 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -323,8 +323,8 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool press = (event->type == GDK_BUTTON_PRESS);
- begin_reversible_command (_("select on click"));
-
+ // begin_reversible_command (_("select on click"));
+
switch (item_type) {
case RegionItem:
if (mouse_mode != MouseRange) {
@@ -379,9 +379,9 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
break;
}
- if (commit) {
- commit_reversible_command ();
- }
+// if (commit) {
+// commit_reversible_command ();
+// }
}
bool
@@ -3287,12 +3287,10 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
if (regionview_y_movement) {
/* moved to a different audio track. */
+
+ vector<RegionView*> new_selection;
- list<RegionView*> new_selection;
- new_selection = selection->regions.by_layer();
- selection->clear_regions ();
-
- for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
+ for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
RegionView* rv = (*i);
@@ -3334,15 +3332,37 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
c.disconnect ();
if (latest_regionview) {
- selection->add (latest_regionview);
+ new_selection.push_back (latest_regionview);
}
if (drag_info.copy) {
// get rid of the copy
delete rv;
}
+
+ /* OK, this is where it gets tricky. If the playlist was being used by >1 tracks, and the region
+ was selected in all of them, then removing it from the playlist will have removed all
+ trace of it from the selection (i.e. there were N regions selected, we removed 1,
+ but since its the same playlist for N tracks, all N tracks updated themselves, removed the
+ corresponding regionview, and the selection is now empty).
+
+ this could have invalidated any and all iterators into the region selection.
+
+ the heuristic we use here is: if the region selection is empty, break out of the loop
+ here. if the region selection is not empty, then restart the loop because we know that
+ we must have removed at least the region(view) we've just been working on as well as any
+ that we processed on previous iterations.
+ */
+
+ if (selection->regions.empty()) {
+ break;
+ } else {
+ i = selection->regions.by_layer().begin();
+ }
}
+ selection->set (new_selection);
+
} else {
/* motion within a single track */
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index f8e6f41a9e..f80ec708eb 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2831,8 +2831,9 @@ Editor::cut_copy_regions (CutCopyOp op)
case Copy:
if (!ar) break;
-
- npl->add_region ((*x)->region(), (*x)->region()->position() - first_position);
+
+ /* copy region before adding, so we're not putting same object into two different playlists */
+ npl->add_region (RegionFactory::create ((*x)->region()), (*x)->region()->position() - first_position);
break;
case Clear:
diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc
index 56196623ed..df23ac503c 100644
--- a/gtk2_ardour/editor_region_list.cc
+++ b/gtk2_ardour/editor_region_list.cc
@@ -21,6 +21,7 @@
#include <cmath>
#include <algorithm>
#include <string>
+#include <sstream>
#include <pbd/basename.h>
@@ -138,12 +139,13 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
if (region->source()->name()[0] == '/') { // external file
if (region->whole_file()) {
- str = ".../";
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(region->source());
+ str = ".../";
+
if (afs) {
- str += region_name_from_path (afs->path(), region->n_channels() > 1);
+ str = region_name_from_path (afs->path(), region->n_channels() > 1);
} else {
str += region->source()->name();
}
@@ -158,6 +160,14 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
}
+ if (region->n_channels() > 1) {
+ std::stringstream foo;
+ foo << region->n_channels ();
+ str += " [";
+ str += foo.str();
+ str += ']';
+ }
+
if (missing_source) {
str += _(" (MISSING)");
}
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 6338993ae2..992d67b9be 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -260,12 +260,12 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
/* need to use the correct x,y, the event lies */
time_canvas_event_box.get_window()->get_pointer (x, y, state);
-
- track_canvas.c2w (x, y, wcx, wcy);
- track_canvas.w2c (wcx, wcy, cx, cy);
-
- nframes_t where = leftmost_frame + pixel_to_frame (x);
+ time_canvas.c2w (x, y, wcx, wcy);
+ time_canvas.w2c (wcx, wcy, cx, cy);
+ wcx = x;
+ nframes_t where = event_frame ((GdkEvent*) ev, &wcx, (double *) 0);
+ cx = wcx;
/// ripped from maybe_autoscroll, and adapted to work here
nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit);
@@ -307,8 +307,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
break;
}
- if (cursor)
- {
+ if (cursor) {
cursor->set_position (where);
if (cursor == edit_cursor) {
diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc
index 34810691f5..7ac7763773 100644
--- a/gtk2_ardour/region_selection.cc
+++ b/gtk2_ardour/region_selection.cc
@@ -31,12 +31,16 @@ using namespace sigc;
RegionSelection::RegionSelection ()
{
+ RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+
_current_start = 0;
_current_end = 0;
}
RegionSelection::RegionSelection (const RegionSelection& other)
{
+ RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+
for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
add (*i);
}
@@ -44,8 +48,6 @@ RegionSelection::RegionSelection (const RegionSelection& other)
_current_end = other._current_end;
}
-
-
RegionSelection&
RegionSelection::operator= (const RegionSelection& other)
{
@@ -86,8 +88,6 @@ RegionSelection::add (RegionView* rv)
return false;
}
- rv->RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
-
if (rv->region()->first_frame() < _current_start || empty()) {
_current_start = rv->region()->first_frame();
}
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 3e6921aab9..7a8f9b5d6a 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -24,6 +24,7 @@
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
+#include <pbd/stacktrace.h>
#include <ardour/playlist.h>
#include <ardour/audioregion.h>