summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-04 18:45:27 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-04 18:45:27 -0400
commit19bd6419157119b976393a0c5966b4be4c962119 (patch)
treebf27f7ea6402f39a0f3744ed6b298d91ed7f7c0e
parentaaea166135ace01709f7e0be64f40be80f4107ec (diff)
commit immediately post linking
-rw-r--r--gtk2_ardour/audio_region_view.cc131
-rw-r--r--gtk2_ardour/audio_region_view.h8
-rw-r--r--gtk2_ardour/audio_streamview.cc14
-rw-r--r--gtk2_ardour/automation_line.cc4
-rw-r--r--gtk2_ardour/edit_note_dialog.cc14
-rw-r--r--gtk2_ardour/editor.cc11
-rw-r--r--gtk2_ardour/editor.h16
-rw-r--r--gtk2_ardour/editor_audiotrack.cc2
-rw-r--r--gtk2_ardour/editor_canvas.cc102
-rw-r--r--gtk2_ardour/editor_canvas_events.cc4
-rw-r--r--gtk2_ardour/editor_cursors.h4
-rw-r--r--gtk2_ardour/editor_drag.cc43
-rw-r--r--gtk2_ardour/editor_mouse.cc37
-rw-r--r--gtk2_ardour/editor_ops.cc2
-rw-r--r--gtk2_ardour/editor_routes.cc4
-rw-r--r--gtk2_ardour/editor_summary.cc6
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc2
-rw-r--r--gtk2_ardour/ghostregion.cc40
-rw-r--r--gtk2_ardour/ghostregion.h18
-rw-r--r--gtk2_ardour/marker.cc10
-rw-r--r--gtk2_ardour/midi_region_view.cc119
-rw-r--r--gtk2_ardour/midi_region_view.h65
-rw-r--r--gtk2_ardour/midi_streamview.cc2
-rw-r--r--gtk2_ardour/midi_time_axis.cc2
-rw-r--r--gtk2_ardour/patch_change.cc88
-rw-r--r--gtk2_ardour/patch_change.h10
-rw-r--r--gtk2_ardour/public_editor.h2
-rw-r--r--gtk2_ardour/region_view.cc17
-rw-r--r--gtk2_ardour/streamview.cc2
-rw-r--r--gtk2_ardour/tempo_lines.cc5
-rw-r--r--gtk2_ardour/theme_manager.cc4
-rw-r--r--gtk2_ardour/time_axis_view.cc14
-rw-r--r--gtk2_ardour/time_axis_view_item.cc13
-rw-r--r--gtk2_ardour/verbose_cursor.cc24
-rw-r--r--gtk2_ardour/verbose_cursor.h14
-rw-r--r--gtk2_ardour/wscript1
-rw-r--r--libs/canvas/canvas/item.h10
-rw-r--r--libs/canvas/canvas/text.h8
-rw-r--r--libs/canvas/canvas/types.h3
-rw-r--r--libs/canvas/canvas/wave_view.h9
-rw-r--r--libs/canvas/group.cc1
-rw-r--r--libs/canvas/item.cc14
-rw-r--r--libs/canvas/text.cc9
-rw-r--r--libs/canvas/types.cc6
44 files changed, 506 insertions, 408 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 2ffbfb15e2..1e1e2f9883 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -39,6 +39,7 @@
#include "canvas/rectangle.h"
#include "canvas/polygon.h"
+#include "canvas/poly_line.h"
#include "canvas/pixbuf.h"
#include "streamview.h"
@@ -172,7 +173,7 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
fade_out_handle = new ArdourCanvas::Rectangle (group);
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
- fade_out_handle->set_outline_color_rgba (RGBA_TO_UINT (0, 0, 0, 0));
+ fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_out_handle->set_data ("regionview", this);
}
@@ -719,7 +720,7 @@ AudioRegionView::set_frames_per_pixel (gdouble fpp)
if (Config->get_show_waveforms ()) {
for (uint32_t n = 0; n < waves.size(); ++n) {
- waves[n]->set_frames_per_pixel() (fpp);
+ waves[n]->set_frames_per_pixel (fpp);
}
}
@@ -777,7 +778,8 @@ AudioRegionView::setup_waveform_visibility ()
/* make sure the zoom level is correct, since we don't update
this when waveforms are hidden.
*/
- waves[n]->property_samples_per_unit() = samples_per_unit;
+ // CAIROCANVAS
+ //waves[n]->set_frames_per_pixel (_frames_per_pixel);
waves[n]->show();
}
} else {
@@ -889,8 +891,6 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
gdouble yoff = which * ht;
- WaveView *wave = new WaveView(*group);
-
WaveView *wave = new WaveView (group, audio_region ());
wave->set_channel (which);
@@ -910,9 +910,10 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
- wave->property_zero_line() = true;
+ // CAIROCANVAS
+ // wave->property_zero_line() = true;
- wave->set_region_start() = _region->start();
+ wave->set_region_start (_region->start());
wave->property_rectified() = Config->get_waveform_shape() == Rectified;
wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
@@ -1085,7 +1086,7 @@ AudioRegionView::entered (bool internal_editing)
}
if (fade_in_handle && !internal_editing) {
- fade_in_handle->set_outline_color_ (RGBA_TO_UINT (0, 0, 0, 255));
+ fade_in_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
fade_in_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 255));
fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 255));
@@ -1262,7 +1263,7 @@ AudioRegionView::transients_changed ()
canvas_item->show ();
canvas_item->set_data ("regionview", this);
- canvas_item->Event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
+ canvas_item->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
feature_lines.push_back (make_pair(0, canvas_item));
}
@@ -1365,29 +1366,32 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
}
if (!start_xfade_in) {
- start_xfade_in = new ArdourCanvas::Line (*group);
- start_xfade_in->property_width_pixels() = 1;
- start_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
+ start_xfade_in = new ArdourCanvas::PolyLine (group);
+ // CAIROCANVAS
+ // start_xfade_in->set_width_pixels (1);
+ start_xfade_in->set_outline_color (ARDOUR_UI::config()->canvasvar_GainLine.get());
}
if (!start_xfade_out) {
- start_xfade_out = new ArdourCanvas::Line (*group);
- start_xfade_out->property_width_pixels() = 1;
+ start_xfade_out = new ArdourCanvas::PolyLine (group);
+ // CAIROCANVAS
+ // start_xfade_out->set_width_pixels (1);
uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128);
- start_xfade_out->property_fill_color_rgba() = col;
+ start_xfade_out->set_outline_color (col);
}
if (!start_xfade_rect) {
- start_xfade_rect = new ArdourCanvas::Rectangle (*group);
- start_xfade_rect->property_draw() = true;
- start_xfade_rect->property_fill() = true;;
- start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
- start_xfade_rect->property_outline_pixels() = 0;
- start_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
+ start_xfade_rect = new ArdourCanvas::Rectangle (group);
+ // CAIROCANVAS
+ // start_xfade_rect->property_draw() = true;
+ start_xfade_rect->set_fill (true);
+ start_xfade_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get());
+ start_xfade_rect->set_outline (false);
+ start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
start_xfade_rect->set_data ("regionview", this);
}
- Points* points = get_canvas_points ("xfade edit redraw", npoints);
+ ArdourCanvas::Points* points = get_canvas_points ("xfade edit redraw", npoints);
boost::scoped_array<float> vec (new float[npoints]);
double effective_height;
@@ -1400,18 +1404,15 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = i;
+ p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
}
- start_xfade_rect->property_x1() = ((*points)[0]).get_x();
- start_xfade_rect->property_y1() = 1.0;
- start_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
- start_xfade_rect->property_y2() = effective_height;
+ start_xfade_rect->set (ArdourCanvas::Rect (((*points)[0]).x, 1.0, ((*points)[npoints-1]).x, effective_height));
start_xfade_rect->show ();
- start_xfade_in->property_points() = *points;
+ start_xfade_in->set (*points);
start_xfade_in->show ();
start_xfade_in->raise_to_top ();
@@ -1422,23 +1423,23 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
if (!inverse) {
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = i;
+ p.y = 1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]));
}
} else {
inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints);
-
+
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = i;
+ p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
}
}
- start_xfade_out->property_points() = *points;
+ start_xfade_out->set (*points);
start_xfade_out->show ();
start_xfade_out->raise_to_top ();
@@ -1473,25 +1474,28 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
}
if (!end_xfade_in) {
- end_xfade_in = new ArdourCanvas::Line (*group);
- end_xfade_in->property_width_pixels() = 1;
- end_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
+ end_xfade_in = new ArdourCanvas::PolyLine (group);
+ // CAIROCANVAS
+ // end_xfade_in->property_width_pixels() = 1;
+ end_xfade_in->set_outline_color (ARDOUR_UI::config()->canvasvar_GainLine.get());
}
if (!end_xfade_out) {
- end_xfade_out = new ArdourCanvas::Line (*group);
- end_xfade_out->property_width_pixels() = 1;
+ end_xfade_out = new ArdourCanvas::PolyLine (group);
+ // CAIROCANVAS
+ // end_xfade_out->property_width_pixels() = 1;
uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128);
- end_xfade_out->property_fill_color_rgba() = col;
+ end_xfade_out->set_outline_color (col);
}
if (!end_xfade_rect) {
- end_xfade_rect = new ArdourCanvas::Rectangle (*group);
- end_xfade_rect->property_draw() = true;
- end_xfade_rect->property_fill() = true;;
- end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
- end_xfade_rect->property_outline_pixels() = 0;
- end_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
+ end_xfade_rect = new ArdourCanvas::Rectangle (group);
+ // CAIROCANVAS
+ // end_xfade_rect->property_draw() = true;
+ end_xfade_rect->set_fill (true);
+ end_xfade_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get());
+ end_xfade_rect->set_outline (0);
+ end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
end_xfade_rect->set_data ("regionview", this);
}
@@ -1510,18 +1514,15 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
}
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = rend + i;
+ p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
}
- end_xfade_rect->property_x1() = ((*points)[0]).get_x();
- end_xfade_rect->property_y1() = 1;
- end_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
- end_xfade_rect->property_y2() = effective_height;
+ end_xfade_rect->set (ArdourCanvas::Rect (((*points)[0]).x, 1.0, ((*points)[npoints-1]).x, effective_height));
end_xfade_rect->show ();
- end_xfade_in->property_points() = *points;
+ end_xfade_in->set (*points);
end_xfade_in->show ();
end_xfade_in->raise_to_top ();
@@ -1532,9 +1533,9 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
if (!inverse) {
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = rend + i;
+ p.y = 1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]));
}
} else {
@@ -1542,13 +1543,13 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
+ ArdourCanvas::Duple &p ((*points)[pci++]);
+ p.x = rend + i;
+ p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
}
}
- end_xfade_out->property_points() = *points;
+ end_xfade_out->set (*points);
end_xfade_out->show ();
end_xfade_out->raise_to_top ();
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h
index 01eb8870c5..827de1a3dc 100644
--- a/gtk2_ardour/audio_region_view.h
+++ b/gtk2_ardour/audio_region_view.h
@@ -156,13 +156,13 @@ class AudioRegionView : public RegionView
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
- ArdourCanvas::Line *start_xfade_in;
- ArdourCanvas::Line *start_xfade_out;
+ ArdourCanvas::PolyLine *start_xfade_in;
+ ArdourCanvas::PolyLine *start_xfade_out;
ArdourCanvas::Rectangle* start_xfade_rect;
bool _start_xfade_visible;
- ArdourCanvas::Line *end_xfade_in;
- ArdourCanvas::Line *end_xfade_out;
+ ArdourCanvas::PolyLine *end_xfade_in;
+ ArdourCanvas::PolyLine *end_xfade_out;
ArdourCanvas::Rectangle* end_xfade_rect;
bool _end_xfade_visible;
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 9527b63382..fee25569f8 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -98,19 +98,19 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
case Normal:
if (recording) {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
- TimeAxisViewItem::ShowFrame |
- TimeAxisViewItem::HideFrameRight |
- TimeAxisViewItem::HideFrameLeft |
- TimeAxisViewItem::HideFrameTB));
+ _frames_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
+ TimeAxisViewItem::ShowFrame |
+ TimeAxisViewItem::HideFrameRight |
+ TimeAxisViewItem::HideFrameLeft |
+ TimeAxisViewItem::HideFrameTB));
} else {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color);
+ _frames_per_pixel, region_color);
}
break;
case Destructive:
region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color);
+ _frames_per_pixel, region_color);
break;
default:
fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg;
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index d9cdf1f51f..02ce72149f 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -984,8 +984,8 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
}
for (uint32_t n = 0; n < vp; ++n) {
- line_points[n].x (control_points[n]->get_x());
- line_points[n].y (control_points[n]->get_y());
+ line_points[n].x = control_points[n]->get_x();
+ line_points[n].y = control_points[n]->get_y();
}
line->set (line_points);
diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc
index 2056b5b18e..2782122dbf 100644
--- a/gtk2_ardour/edit_note_dialog.cc
+++ b/gtk2_ardour/edit_note_dialog.cc
@@ -119,7 +119,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
double test_time = (*_events.begin())->note()->time ();
double test_length = (*_events.begin())->note()->length ();
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if ((*i)->note()->channel() != test_channel) {
_channel_all.set_sensitive (true);
}
@@ -170,7 +170,7 @@ EditNoteDialog::run ()
bool had_change = false;
if (!_channel_all.get_sensitive() || _channel_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_channel.get_value_as_int() - 1 != (*i)->note()->channel()) {
_region_view->change_note_channel (*i, _channel.get_value_as_int () - 1);
had_change = true;
@@ -179,7 +179,7 @@ EditNoteDialog::run ()
}
if (!_pitch_all.get_sensitive() || _pitch_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_pitch.get_value_as_int() != (*i)->note()->note()) {
_region_view->change_note_note (*i, _pitch.get_value_as_int ());
had_change = true;
@@ -188,7 +188,7 @@ EditNoteDialog::run ()
}
if (!_velocity_all.get_sensitive() || _velocity_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_velocity.get_value_as_int() != (*i)->note()->velocity()) {
_region_view->change_note_velocity (*i, _velocity.get_value_as_int ());
had_change = true;
@@ -199,7 +199,7 @@ EditNoteDialog::run ()
double const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ());
if (!_time_all.get_sensitive() || _time_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (t != (*i)->note()->time()) {
_region_view->change_note_time (*i, t);
had_change = true;
@@ -210,7 +210,7 @@ EditNoteDialog::run ()
double const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ());
if (!_length_all.get_sensitive() || _length_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (d != (*i)->note()->length()) {
_region_view->change_note_length (*i, d);
had_change = true;
@@ -224,7 +224,7 @@ EditNoteDialog::run ()
_region_view->apply_diff ();
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
(*i)->set_selected ((*i)->selected()); // change color
}
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 1b9e463c2c..bbf4ccde49 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -496,14 +496,15 @@ Editor::Editor ()
_cursors = new MouseCursors;
- ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::GtkCanvas());
- ArdourCanvas::Line* pad_line_1 = manage(new ArdourCanvas::Line(time_pad->root()));
- pad_line_1->set (ArdourCanvas::Duple (0.0, 1.0), ArdourCanvas::Duple (100.0, 1.0));
+ ArdourCanvas::Canvas* time_pad = new ArdourCanvas::GtkCanvas ();
+ ArdourCanvas::Line* pad_line_1 = new ArdourCanvas::Line (time_pad->root());
+ pad_line_1->set (ArdourCanvas::Duple (0.0, 1.0), ArdourCanvas::Duple (100.0, 1.0));
pad_line_1->set_outline_color (0xFF0000FF);
pad_line_1->show();
- time_pad->show();
+ // CAIROCANVAS
+ //time_pad->show();
time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
time_canvas_vbox.set_size_request (-1, -1);
@@ -4315,7 +4316,7 @@ Editor::ensure_visual_change_idle_handler ()
{
if (pending_visual_change.idle_handler_id < 0) {
pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
- pending_visual_change.executing = false;
+ pending_visual_change.being_handled = false;
}
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index ed7c3f0791..3adcfc8ab4 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -25,12 +25,10 @@
#include <set>
#include <string>
#include <sys/time.h>
+#include <cmath>
#include <boost/optional.hpp>
-
-#include <cmath>
-
#include <gtkmm/comboboxtext.h>
#include <gtkmm/layout.h>
@@ -48,6 +46,8 @@
#include "ardour/location.h"
#include "ardour/types.h"
+#include "canvas/fwd.h"
+
#include "gtk-custom-ruler.h"
#include "ardour_button.h"
#include "ardour_dialog.h"
@@ -58,8 +58,6 @@
#include "region_selection.h"
#include "window_proxy.h"
-#include "canvas/fwd.h"
-
namespace Gtkmm2ext {
class TearOff;
class Bindings;
@@ -103,6 +101,7 @@ class GUIObjectState;
class Marker;
class MidiRegionView;
class MixerStrip;
+class NoteBase;
class PlaylistSelector;
class PluginSelector;
class RhythmFerret;
@@ -460,6 +459,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return _verbose_cursor;
}
+ double clamp_verbose_cursor_x (double);
+ double clamp_verbose_cursor_y (double);
+
void get_pointer_position (double &, double &) const;
TimeAxisView* stepping_axis_view () {
@@ -711,7 +713,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_canvas_cursor ();
ArdourCanvas::GtkCanvas* _track_canvas;
- ArdourCanvas::GtkCanvasViewPort* _track_canvas_viewport;
+ ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport;
Gtk::Adjustment* _track_canvas_hadj;
Gtk::Adjustment* _track_canvas_vadj;
@@ -1531,7 +1533,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void edit_tempo_marker (ArdourCanvas::Item*);
void edit_meter_marker (ArdourCanvas::Item*);
void edit_control_point (ArdourCanvas::Item*);
- void edit_notes (std::set<Gnome::Canvas::CanvasNoteEvent *> const &);
+ void edit_notes (std::set<NoteBase*> const & s);
void marker_menu_edit ();
void marker_menu_remove ();
diff --git a/gtk2_ardour/editor_audiotrack.cc b/gtk2_ardour/editor_audiotrack.cc
index 87e85ca687..a60a25cefd 100644
--- a/gtk2_ardour/editor_audiotrack.cc
+++ b/gtk2_ardour/editor_audiotrack.cc
@@ -75,6 +75,6 @@ Editor::toggle_meter_updating()
stop_updating_meters ();
}
- track_canvas_viewport_allocate (track_canvas->get_allocation());
+ track_canvas_viewport_allocate (_track_canvas->get_allocation());
}
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 8f85e81867..a8de8266a5 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -95,13 +95,13 @@ Editor::initialize_canvas ()
}
/* a group to hold time (measure) lines */
- time_line_group = new ArdourCanvas::Group (track_canvas->root());
+ time_line_group = new ArdourCanvas::Group (_track_canvas->root());
- transport_loop_range_rect = new ArdourCanvas::Rectangle (*time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
+ transport_loop_range_rect = new ArdourCanvas::Rectangle (time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
transport_loop_range_rect->set_outline_width (1);
transport_loop_range_rect->hide();
- transport_punch_range_rect = new ArdourCanvas::Rectangle (*time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
+ transport_punch_range_rect = new ArdourCanvas::Rectangle (time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
transport_punch_range_rect->set_outline_width (0);
transport_punch_range_rect->hide();
@@ -150,66 +150,56 @@ Editor::initialize_canvas ()
transport_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 2.0));
marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height));
cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0));
+#ifdef WITH_VIDEOTIMELINE
+ videotl_group = new ArdourCanvas::Group (_time_markers_group, 0.0, 0.0);
+#endif
#ifdef WITH_VIDEOTIMELINE
- videotl_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ videotl_bar_group = new ArdourCanvas::Group (track_canvas->root ());
if (Profile->get_sae()) {
- videotl_bar = new ArdourCanvas::Rectangle (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
+ videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
videotl_bar->property_outline_pixels() = 1;
} else {
- videotl_bar = new ArdourCanvas::Rectangle (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
+ videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
videotl_bar->property_outline_pixels() = 0;
}
videotl_bar->property_outline_what() = (0x1 | 0x8);
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height));
#endif
- timebar_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
- cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
-
- meter_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 5.0);
- tempo_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 4.0);
- range_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 3.0);
- transport_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 2.0);
- marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height);
- cd_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
-#ifdef WITH_VIDEOTIMELINE
- videotl_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
-#endif
-
cd_marker_bar_drag_rect = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
cd_marker_bar_drag_rect->set_outline (false);
cd_marker_bar_drag_rect->hide ();
- range_bar_drag_rect = new ArdourCanvas::Rectangle (range_marker_group, Ardour::Rect (0.0, 0.0, 100, timebar_height));
+ range_bar_drag_rect = new ArdourCanvas::Rectangle (range_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
range_bar_drag_rect->set_outline (false);
range_bar_drag_rect->hide ();
- transport_bar_drag_rect = new ArdourCanvas::Rectangle (transport_marker_group, Ardour::Rect (0.0, 0.0, 100, timebar_height));
+ transport_bar_drag_rect = new ArdourCanvas::Rectangle (transport_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
transport_bar_drag_rect->set_outline (false);
transport_bar_drag_rect->hide ();
transport_punchin_line = new ArdourCanvas::Line (_master_group);
+ transport_punchin_line->set_x0 (0);
+ transport_punchin_line->set_y0 (0);
transport_punchin_line->set_x1 (0);
- transport_punchin_line->set_y1 (0);
- transport_punchin_line->set_x2 (0);
- transport_punchin_line->set_y2 (ArdourCanvas::COORD_MAX);
+ transport_punchin_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchin_line->hide ();
transport_punchout_line = new ArdourCanvas::Line (_master_group);
+ transport_punchout_line->set_x0 (0);
+ transport_punchout_line->set_y0 (0);
transport_punchout_line->set_x1 (0);
- transport_punchout_line->set_y1 (0);
- transport_punchout_line->set_x2 (0);
- transport_punchout_line->set_y2 (ArdourCanvas::COORD_MAX);
+ transport_punchout_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchout_line->hide();
// used to show zoom mode active zooming
- zoom_rect = new ArdourCanvas::Rectangle (_master_group, 0.0, 0.0, 0.0, 0.0);
+ zoom_rect = new ArdourCanvas::Rectangle (_master_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
zoom_rect->set_outline_width (1);
zoom_rect->hide();
- zoom_rect->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
+ zoom_rect->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
// used as rubberband rect
rubberband_rect = new ArdourCanvas::Rectangle (_trackview_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
@@ -217,16 +207,16 @@ Editor::initialize_canvas ()
rubberband_rect->set_outline_width (1);
rubberband_rect->hide();
- tempo_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
- meter_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
- marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
- cd_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
+ tempo_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
+ meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
+ marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
+ cd_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
#ifdef WITH_VIDEOTIMELINE
- videotl_bar_group->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
- //videotl_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
+ videotl_bar_group->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
+ //videotl_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
#endif
- range_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
- transport_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
+ range_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
+ transport_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
playhead_cursor = new EditorCursor (*this, &Editor::canvas_playhead_cursor_event);
@@ -757,10 +747,10 @@ Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
double v = vertical_adjustment.get_value ();
- if (begin < v || begin + tav.current_height() > v + _canvas_height - canvas_timebars_vsize) {
+ if (begin < v || begin + tav.current_height() > v + _visible_canvas_height) {
/* try to put the TimeAxisView roughly central */
- if (begin >= _canvas_height/2.0) {
- begin -= _canvas_height/2.0;
+ if (begin >= _visible_canvas_height/2.0) {
+ begin -= _visible_canvas_height/2.0;
}
vertical_adjustment.set_value (begin);
}
@@ -820,6 +810,8 @@ Editor::set_horizontal_position (double p)
#endif
}
+// CAIROCANVAS
+#if 0
void
Editor::scroll_canvas_vertically ()
{
@@ -838,11 +830,12 @@ Editor::scroll_canvas_vertically ()
/* required to keep the controls_layout in lock step with the canvas group */
update_canvas_now ();
}
+#endif
void
Editor::color_handler()
{
- playhead_cursor->canvas_item.set_fill_color (ARDOUR_UI::config()->canvasvar_PlayHead.get());
+ playhead_cursor->set_color (ARDOUR_UI::config()->canvasvar_PlayHead.get());
_verbose_cursor->set_color (ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get());
meter_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_MeterBar.get());
@@ -883,8 +876,8 @@ Editor::color_handler()
transport_punch_range_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TransportPunchRect.get());
transport_punch_range_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TransportPunchRect.get());
- transport_punchin_line->set_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
- transport_punchout_line->set_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
+ transport_punchin_line->set_outline_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
+ transport_punchout_line->set_outline_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
zoom_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ZoomRect.get());
zoom_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_ZoomRect.get());
@@ -948,10 +941,10 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor, bool save)
current_canvas_cursor = cursor;
}
- Glib::RefPtr<Gdk::Window> win = track_canvas->get_window();
+ Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
if (win) {
- track_canvas->get_window()->set_cursor (*cursor);
+ _track_canvas->get_window()->set_cursor (*cursor);
}
}
@@ -975,3 +968,22 @@ Editor::track_canvas_key_release (GdkEventKey*)
return false;
}
+
+double
+Editor::clamp_verbose_cursor_x (double x)
+{
+ if (x < 0) {
+ x = 0;
+ } else {
+ x = min (_visible_canvas_width - 200.0, x);
+ }
+ return x;
+}
+
+double
+Editor::clamp_verbose_cursor_y (double y)
+{
+ y = max (0.0, y);
+ y = min (_visible_canvas_height - 50, y);
+ return y;
+}
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index e9d74ed2dc..9bceb1c26c 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -1014,7 +1014,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
double px;
double py;
- string target = track_canvas->drag_dest_find_target (context, track_canvas->drag_dest_get_target_list());
+ string target = _track_canvas->drag_dest_find_target (context, _track_canvas->drag_dest_get_target_list());
if (target.empty()) {
return false;
@@ -1107,7 +1107,7 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
double px;
double py;
- track_canvas->window_to_world (x, y, wx, wy);
+ _track_canvas_viewport->window_to_canvas (x, y, wx, wy);
event.type = GDK_MOTION_NOTIFY;
event.button.x = wx;
diff --git a/gtk2_ardour/editor_cursors.h b/gtk2_ardour/editor_cursors.h
index 0cc6eae5b8..a58a46bd5d 100644
--- a/gtk2_ardour/editor_cursors.h
+++ b/gtk2_ardour/editor_cursors.h
@@ -19,6 +19,10 @@
#include "pbd/signals.h"
+#include "canvas/arrow.h"
+#include "canvas/line.h"
+#include "canvas/types.h"
+
class Editor;
class EditorCursor {
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 20ca13f949..701181d009 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -202,7 +202,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
}
void
-Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t time)
+Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t /*time*/)
{
_item->ungrab ();
_item = new_item;
@@ -371,7 +371,7 @@ Drag::show_verbose_cursor_time (framepos_t frame)
_editor->verbose_cursor()->set_time (
frame,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value()
);
_editor->verbose_cursor()->show ();
@@ -385,7 +385,7 @@ Drag::show_verbose_cursor_duration (framepos_t start, framepos_t end, double xof
_editor->verbose_cursor()->set_duration (
start, end,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value()
);
}
@@ -397,7 +397,7 @@ Drag::show_verbose_cursor_text (string const & text)
_editor->verbose_cursor()->set (
text,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value()
);
}
@@ -683,7 +683,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
later, as the two parent groups have different coordinates.
*/
- rv->get_canvas_group()->reparent (*(_editor->_region_motion_group));
+ rv->get_canvas_group()->reparent (_editor->_region_motion_group);
rv->fake_set_opaque (true);
}
@@ -751,7 +751,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
}
/* Now move the region view */
- rv->move (Ardour::Duple (x_delta, y - rv->get_canvas_group()->property_y()));
+ rv->move (x_delta, y - rv->get_canvas_group()->position().y);
}
} /* foreach region */
@@ -2405,7 +2405,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
{
Drag::start_grab (event, c);
- _grab_zoom = _editor->frames_per_unit;
+ _grab_zoom = _editor->frames_per_pixel;
framepos_t where = _editor->event_frame (event, 0, 0);
_editor->snap_to_with_modifier (where, event);
@@ -3963,12 +3963,13 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat
{
DEBUG_TRACE (DEBUG::Drags, "New RangeMarkerBarDrag\n");
- _drag_rect = new ArdourCanvas::Rectangle (*_editor->time_line_group, 0.0, 0.0, 0.0,
- physical_screen_height (_editor->get_window()));
+ _drag_rect = new ArdourCanvas::Rectangle (_editor->time_line_group,
+ ArdourCanvas::Rect (0.0, 0.0, 0.0,
+ physical_screen_height (_editor->get_window())));
_drag_rect->hide ();
_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeDragRect.get());
- _drag_rect->set_outline_color() (ARDOUR_UI::config()->canvasvar_RangeDragRect.get());
+ _drag_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_RangeDragRect.get());
}
void
@@ -4819,7 +4820,7 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
Drag::start_grab (event, cursor);
- _drag_rect = new ArdourCanvas::Rectangle (*_region_view->get_canvas_group ());
+ _drag_rect = new ArdourCanvas::Rectangle (_region_view->get_canvas_group ());
framepos_t pf = _drags->current_pointer_frame ();
framecnt_t const g = grid_frames (pf);
@@ -4837,14 +4838,10 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
double const x = _editor->frame_to_pixel (_note[0]);
double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y)));
- _drag_rect->property_x1() = x;
- _drag_rect->property_y1() = y;
- _drag_rect->property_x2() = x;
- _drag_rect->property_y2() = y + floor (_region_view->midi_stream_view()->note_height ());
-
- _drag_rect->property_outline_what() = 0xff;
- _drag_rect->property_outline_color_rgba() = 0xffffff99;
- _drag_rect->property_fill_color_rgba() = 0xffffff66;
+ _drag_rect->set (ArdourCanvas::Rect (x, y, x, y + floor (_region_view->midi_stream_view()->note_height ())));
+ _drag_rect->set_outline_what (0xff);
+ _drag_rect->set_outline_color (0xffffff99);
+ _drag_rect->set_fill_color (0xffffff66);
}
void
@@ -4853,9 +4850,9 @@ NoteCreateDrag::motion (GdkEvent* event, bool)
_note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ());
double const x = _editor->frame_to_pixel (_note[1]);
if (_note[1] > _note[0]) {
- _drag_rect->property_x2() = x;
+ _drag_rect->set_x1 (x);
} else {
- _drag_rect->property_x1() = x;
+ _drag_rect->set_x0 (x);
}
}
@@ -4878,14 +4875,14 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement)
double const length_beats = max (one_tick, _region_view->region_frames_to_region_beats (length));
- _region_view->create_note_at (start, _drag_rect->property_y1(), length_beats, false);
+ _region_view->create_note_at (start, _drag_rect->y0(), length_beats, false);
}
double
NoteCreateDrag::y_to_region (double y) const
{
double x = 0;
- _region_view->get_canvas_group()->w2i (x, y);
+ _region_view->get_canvas_group()->canvas_to_item (x, y);
return y;
}
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 2fefdd02ad..3ab2e95f56 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -310,11 +310,18 @@ Editor::set_canvas_cursor ()
if (!_internal_editing && get_smart_mode() ) {
double x, y;
get_pointer_position (x, y);
- ArdourCanvas::Item* i = track_canvas->get_item_at (x, y);
- if (i && i->property_parent() && (*i->property_parent()).get_data (X_("timeselection"))) {
- pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value());
- if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
- current_canvas_cursor = _cursors->up_down;
+ vector<ArdourCanvas::Item const *> items;
+ _track_canvas->root()->add_items_at_point (ArdourCanvas::Duple (x,y), items);
+
+ // CAIROCANVAS: need upper-most item, not all items
+
+ if (!items.empty()) {
+ const ArdourCanvas::Item* i = items.front();
+ if (i && i->parent() && i->parent()->get_data (X_("timeselection"))) {
+ pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value());
+ if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
+ current_canvas_cursor = _cursors->up_down;
+ }
}
}
}
@@ -892,7 +899,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case NoteItem:
if (internal_editing()) {
/* trim notes if we're in internal edit mode and near the ends of the note */
- Notebase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
+ NoteBase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
assert (cn);
if (cn && cn->big_enough_to_trim() && cn->mouse_near_ends()) {
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
@@ -1319,7 +1326,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return false;
}
- Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->track_canvas->get_window();
+ Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas_viewport->get_window();
if (canvas_window) {
Glib::RefPtr<const Gdk::Window> pointer_window;
@@ -1329,8 +1336,8 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
pointer_window = canvas_window->get_pointer (x, y, mask);
- if (pointer_window == track_canvas->get_bin_window()) {
- track_canvas->window_to_world (x, y, wx, wy);
+ if (pointer_window == _track_canvas->get_window()) {
+ _track_canvas_viewport->window_to_canvas (x, y, wx, wy);
}
}
@@ -1861,7 +1868,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line) {
- line->set_fill_color (ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get());
+ line->set_outline_color (ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get());
}
if (is_drawable()) {
set_canvas_cursor (_cursors->fader);
@@ -2568,7 +2575,7 @@ Editor::reposition_zoom_rect (framepos_t start, framepos_t end)
double x2 = frame_to_pixel (end);
double y2 = _full_canvas_height - 1.0;
- zoom_rect->set (ArdourCanvas::Rect (x1, 1, x2, y2);
+ zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2));
}
@@ -2898,7 +2905,7 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
assert (rv);
- ArdourCanvas::Group* g = rv->get_parent_group ();
+ ArdourCanvas::Group* g = rv->get_canvas_group ();
ArdourCanvas::Group* p = g->parent ();
/* Compute x in region view parent coordinates */
@@ -2928,11 +2935,11 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
}
}
-/** Obtain the pointer position in world coordinates */
+/** Obtain the pointer position in canvas coordinates */
void
Editor::get_pointer_position (double& x, double& y) const
{
int px, py;
- track_canvas->get_pointer (px, py);
- track_canvas->window_to_world (px, py, x, y);
+ _track_canvas->get_pointer (px, py);
+ _track_canvas_viewport->window_to_canvas (px, py, x, y);
}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 672ae083f6..7fed4fc410 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1397,7 +1397,7 @@ Editor::temporal_zoom (double fpp)
nfpp = 8e+08;
}
- new_page_size = (framepos_t) floor (_canvas_width * nfpp);
+ new_page_size = (framepos_t) floor (_visible_canvas_width * nfpp);
half_page_size = new_page_size / 2;
switch (zoom_focus) {
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 6a60623cb1..bf629ea27d 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -1305,8 +1305,8 @@ EditorRoutes::button_press (GdkEventButton* ev)
int y_pos = tv->y_position();
//Clamp the y pos so that we do not extend beyond the canvas full height.
- if (_editor->full_canvas_height - y_pos < _editor->_visible_canvas_height){
- y_pos = _editor->full_canvas_height - _editor->_visible_canvas_height;
+ if (_editor->_full_canvas_height - y_pos < _editor->_visible_canvas_height){
+ y_pos = _editor->_full_canvas_height - _editor->_visible_canvas_height;
}
//Only scroll to if the track is visible
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index 287b6d1213..c7aef99389 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -440,7 +440,7 @@ EditorSummary::get_editor (pair<double, double>* x, pair<double, double>* y) con
x->second = x->first + _editor->current_page_frames() * _x_scale;
y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ());
- y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height())
+ y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height());
}
}
@@ -681,7 +681,7 @@ void
EditorSummary::set_editor (double const x, double const y)
{
ArdourCanvas::checkpoint ("editor", "-> set editor");
- if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.executing == true) {
+ if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.being_handled == true) {
/* As a side-effect, the Editor's visual change idle handler processes
pending GTK events. Hence this motion notify handler can be called
@@ -796,7 +796,7 @@ void
EditorSummary::set_editor_y (double const y)
{
double y1 = summary_y_to_editor (y);
- double const eh = _editor->visible_canvas_height()
+ double const eh = _editor->visible_canvas_height();
double y2 = y1 + eh;
double const full_editor_height = _editor->_full_canvas_height;
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index 8342d5eb1f..0a84bcbf26 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -191,7 +191,7 @@ Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
}
if (tempo_lines == 0) {
- tempo_lines = new TempoLines (*_track_canvas, time_line_group, physical_screen_height(get_window()));
+ tempo_lines = new TempoLines (*_track_canvas_viewport, time_line_group, physical_screen_height(get_window()));
}
// CAIROCANVAS
diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc
index e21f77f654..caab67ef44 100644
--- a/gtk2_ardour/ghostregion.cc
+++ b/gtk2_ardour/ghostregion.cc
@@ -107,7 +107,7 @@ AudioGhostRegion::AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, do
}
-ovoid
+void
AudioGhostRegion::set_frames_per_pixel (double fpp)
{
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
@@ -187,13 +187,13 @@ MidiGhostRegion::~MidiGhostRegion()
clear_events ();
}
-MidiGhostRegion::Event::Event (NoteBase* e, ArdourCanvas::Group* g)
+MidiGhostRegion::GhostEvent::GhostEvent (NoteBase* e, ArdourCanvas::Group* g)
: event (e)
{
- rect = new ArdourCanvas::Rectangle (*g, e->x1(), e->y1(), e->x2(), e->y2());
+ rect = new ArdourCanvas::Rectangle (g, ArdourCanvas::Rect (e->x0(), e->y0(), e->x1(), e->y1()));
}
-MidiGhostRegion::Event::~Event ()
+MidiGhostRegion::GhostEvent::~GhostEvent ()
{
/* event is not ours to delete */
delete rect;
@@ -231,8 +231,8 @@ MidiGhostRegion::set_colors()
GhostRegion::set_colors();
for (EventList::iterator it = events.begin(); it != events.end(); ++it) {
- (*it)->rect->property_fill_color_rgba() = fill;
- (*it)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get();
+ (*it)->rect->set_fill_color (fill);
+ (*it)->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get());
}
}
@@ -255,20 +255,20 @@ MidiGhostRegion::update_range ()
} else {
(*it)->rect->show();
double const y = trackview.current_height() - (note_num + 1 - mv->lowest_note()) * h + 1;
- (*it)->rect->property_y1() = y;
- (*it)->rect->property_y2() = y + h;
+ (*it)->rect->set_y0 (y);
+ (*it)->rect->set_y1 (y + h);
}
}
}
void
-MidiGhostRegion::add_note(NoteBase* n)
+MidiGhostRegion::add_note (NoteBase* n)
{
- Event* event = new Event (n, group);
+ GhostEvent* event = new GhostEvent (n, group);
events.push_back (event);
- event->rect->property_fill_color_rgba() = source_track_color(200);
- event->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get();
+ event->rect->set_fill_color (source_track_color(200));
+ event->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get());
MidiStreamView* mv = midi_view();
@@ -279,8 +279,8 @@ MidiGhostRegion::add_note(NoteBase* n)
event->rect->hide();
} else {
const double y = mv->note_to_y(note_num);
- event->rect->property_y1() = y;
- event->rect->property_y2() = y + mv->note_height();
+ event->rect->set_y0 (y);
+ event->rect->set_y1 (y + mv->note_height());
}
}
}
@@ -300,9 +300,9 @@ MidiGhostRegion::clear_events()
* @param parent The CanvasNote from the parent MidiRegionView.
*/
void
-MidiGhostRegion::update_note (Note* parent)
+MidiGhostRegion::update_note (NoteBase* parent)
{
- Event* ev = find_event (parent);
+ GhostEvent* ev = find_event (parent);
if (!ev) {
return;
}
@@ -314,9 +314,9 @@ MidiGhostRegion::update_note (Note* parent)
}
void
-MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
+MidiGhostRegion::remove_note (NoteBase* note)
{
- Event* ev = find_event (note);
+ GhostEvent* ev = find_event (note);
if (!ev) {
return;
}
@@ -331,8 +331,8 @@ MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
* @return Our Event, or 0 if not found.
*/
-MidiGhostRegion::Event *
-MidiGhostRegion::find_event (Note* parent)
+MidiGhostRegion::GhostEvent *
+MidiGhostRegion::find_event (NoteBase* parent)
{
/* we are using _optimization_iterator to speed up the common case where a caller
is going through our notes in order.
diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h
index 384127150a..646de24dfc 100644
--- a/gtk2_ardour/ghostregion.h
+++ b/gtk2_ardour/ghostregion.h
@@ -72,12 +72,12 @@ public:
class MidiGhostRegion : public GhostRegion {
public:
class GhostEvent : public sigc::trackable {
- public:
+ public:
GhostEvent(::NoteBase *, ArdourCanvas::Group *);
- virtual ~GhostEvent () {}
-
- NoteBase* event;
- ArdourCanvas::Rectangle* rect;
+ virtual ~GhostEvent ();
+
+ NoteBase* event;
+ ArdourCanvas::Rectangle* rect;
};
MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
@@ -92,15 +92,15 @@ public:
void update_range();
- void add_note(Note*);
- void update_note (Note*);
- void remove_note (Note*);
+ void add_note(NoteBase*);
+ void update_note (NoteBase*);
+ void remove_note (NoteBase*);
void clear_events();
private:
- MidiGhostRegion::Event* find_event (Note*);
+ MidiGhostRegion::GhostEvent* find_event (NoteBase*);
typedef std::list<MidiGhostRegion::GhostEvent*> EventList;
EventList events;
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index ce21533af6..75919f339a 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -324,10 +324,10 @@ Marker::setup_line ()
if (_line == 0) {
- _line = new ArdourCanvas::Line (*group);
+ _line = new ArdourCanvas::Line (group);
_line->set_outline_color (ARDOUR_UI::config()->canvasvar_EditPoint.get());
- _line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
+ _line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
}
/* work out where to start the line from so that it extends from the top of the canvas */
@@ -405,10 +405,10 @@ Marker::setup_name_display ()
if (label_on_left ()) {
_name_background->set_x0 (name_pixbuf->position().x - 2);
- _name_background->property_x1() = name_pixbuf->position().x + name_width + _shift;
+ _name_background->set_x1 (name_pixbuf->position().x + name_width + _shift);
} else {
- _name_background->x0 (name_pixbuf->position().x - _label_offset + 2);
- _name_background->property_x1() = name_pixbuf->position().x + name_width;
+ _name_background->set_x0 (name_pixbuf->position().x - _label_offset + 2);
+ _name_background->set_x1 (name_pixbuf->position().x + name_width);
}
_name_background->set_y0 (0);
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 056665eefd..ed1708a7a9 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -82,7 +82,6 @@
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
-using namespace ArdourCanvas;
using Gtkmm2ext::Keyboard;
PBD::Signal1<void, MidiRegionView *> MidiRegionView::SelectionCleared;
@@ -243,10 +242,10 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
{
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
- NoteBase::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
- boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
- gui_context());
-
+ NoteBase::NoteBaseDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
+ boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
+ gui_context());
+
if (wfd) {
midi_region()->midi_source(0)->load_model();
}
@@ -1005,7 +1004,7 @@ MidiRegionView::note_diff_remove_note (NoteBase* ev)
}
void
-MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property,
uint8_t val)
{
@@ -1015,7 +1014,7 @@ MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
}
void
-MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property,
Evoral::MusicalTime val)
{
@@ -1091,7 +1090,7 @@ MidiRegionView::get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::No
_model->get_notes (notes, op, val, chan_mask);
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
- CanvasNoteEvent* cne = find_canvas_note (*n);
+ NoteBase* cne = find_canvas_note (*n);
if (cne) {
e.push_back (cne);
}
@@ -1295,8 +1294,11 @@ MidiRegionView::display_sysexes()
double height = midi_stream_view()->contents_height();
- boost::shared_ptr<CanvasSysEx> sysex = boost::shared_ptr<CanvasSysEx>(
- new CanvasSysEx(*this, *_note_group, text, height, x, 1.0, (*i)));
+ // CAIROCANVAS: no longer passing *i (the sysex event) to the
+ // SysEx canvas object!!!
+
+ boost::shared_ptr<SysEx> sysex = boost::shared_ptr<SysEx>(
+ new SysEx (*this, _note_group, text, height, x, 1.0));
// Show unless message is beyond the region bounds
if (time - _region->start() >= _region->length() || time < _region->start()) {
@@ -1358,6 +1360,8 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
redisplay_model();
}
+// CAIROCANVAS
+#if 0
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
if ((*x)->width() >= _pixel_width) {
(*x)->hide();
@@ -1365,6 +1369,7 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
(*x)->show();
}
}
+#endif
move_step_edit_cursor (_step_edit_cursor_position);
set_step_edit_cursor_width (_step_edit_cursor_width);
@@ -1720,7 +1725,7 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible)
const double diamond_size = midi_stream_view()->note_height() / 2.0;
- Hit* ev_diamond = new CanvasHit (*this, _note_group, diamond_size, note);
+ Hit* ev_diamond = new Hit (*this, _note_group, diamond_size, note);
update_hit (ev_diamond);
@@ -1797,23 +1802,27 @@ MidiRegionView::step_sustain (Evoral::MusicalTime beats)
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
*/
void
-MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool active_channel)
+MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/)
{
framecnt_t region_frames = source_beats_to_region_frames (patch->time());
const double x = trackview.editor().frame_to_pixel (region_frames);
double const height = midi_stream_view()->contents_height();
- boost::shared_ptr<CanvasPatchChange> patch_change = boost::shared_ptr<CanvasPatchChange>(
- new CanvasPatchChange(*this, group,
- displaytext,
- height,
- x, 1.0,
- instrument_info(),
- patch,
- active_channel));
+ // CAIROCANVAS: active_channel info removed from PatcChange constructor
+ // so we need to do something more sophisticated to keep its color
+ // appearance (MidiPatchChangeFill/MidiPatchChangeInactiveChannelFill)
+ // up to date.
+
+ boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
+ new PatchChange(*this, group,
+ displaytext,
+ height,
+ x, 1.0,
+ instrument_info(),
+ patch));
- if (patch_change->width() < _pixel_width) {
+ if (patch_change->item().width() < _pixel_width) {
// Show unless patch change is beyond the region bounds
if (region_frames < 0 || region_frames >= _region->length()) {
patch_change->hide();
@@ -1981,7 +1990,7 @@ MidiRegionView::next_patch (PatchChange& patch)
}
void
-MidiRegionView::next_bank (CanvasPatchChange& patch)
+MidiRegionView::next_bank (PatchChange& patch)
{
if (patch.patch()->program() < 127) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@@ -1993,7 +2002,7 @@ MidiRegionView::next_bank (CanvasPatchChange& patch)
}
void
-MidiRegionView::previous_bank (CanvasPatchChange& patch)
+MidiRegionView::previous_bank (PatchChange& patch)
{
if (patch.patch()->program() > 0) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@@ -2271,14 +2280,14 @@ MidiRegionView::note_deselected(NoteBase* ev)
}
void
-MidiRegionView::update_drag_selection(double x1, double x2, double y1, double y2, bool extend)
+MidiRegionView::update_drag_selection(double x0, double x1, double y0, double y1, bool extend)
{
// TODO: Make this faster by storing the last updated selection rect, and only
// adjusting things that are in the area that appears/disappeared.
// We probably need a tree to be able to find events in O(log(n)) time.
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
- if ((*i)->x1() < x2 && (*i)->x2() > x1 && (*i)->y1() < y2 && (*i)->y2() > y1) {
+ if ((*i)->x0() < x1 && (*i)->x1() > x0 && (*i)->y0() < y1 && (*i)->y1() > y0) {
// Rectangles intersect
if (!(*i)->selected()) {
add_to_selection (*i);
@@ -2531,7 +2540,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
_resize_data.clear();
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
- Note *note = dynamic_cast<Note**> (*i);
+ Note *note = dynamic_cast<Note*> (*i);
// only insert CanvasNotes into the map
if (note) {
@@ -2539,7 +2548,8 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
resize_data->note = note;
// create a new SimpleRect from the note which will be the resize preview
- Rectangle *resize_rect = new SimpleRect (_note_group, note->x1(), note->y1(), note->x2(), note->y2());
+ ArdourCanvas::Rectangle *resize_rect = new ArdourCanvas::Rectangle (_note_group,
+ ArdourCanvas::Rect (note->x0(), note->y0(), note->x0(), note->y1()));
// calculate the colors: get the color settings
uint32_t fill_color = UINT_RGBA_CHANGE_A(
@@ -2551,7 +2561,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
// calculate color based on note velocity
resize_rect->set_fill_color (UINT_INTERPOLATE(
- CanvasNoteEvent::meter_style_fill_color(note->note()->velocity(), note->selected()),
+ NoteBase::meter_style_fill_color(note->note()->velocity(), note->selected()),
fill_color,
0.85));
@@ -2579,19 +2589,19 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
bool cursor_set = false;
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
- Rectangle* resize_rect = (*i)->resize_rect;
+ ArdourCanvas::Rectangle* resize_rect = (*i)->resize_rect;
Note* canvas_note = (*i)->note;
double current_x;
if (at_front) {
if (relative) {
- current_x = note->x0() + delta_x;
+ current_x = canvas_note->x0() + delta_x;
} else {
current_x = primary->x0() + delta_x;
}
} else {
if (relative) {
- current_x = note->x1() + delta_x;
+ current_x = canvas_note->x1() + delta_x;
} else {
current_x = primary->x1() + delta_x;
}
@@ -2649,7 +2659,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
Note* canvas_note = (*i)->note;
- Rectangle* resize_rect = (*i)->resize_rect;
+ ArdourCanvas::Rectangle* resize_rect = (*i)->resize_rect;
/* Get the new x position for this resize, which is in pixels relative
* to the region position.
@@ -2659,13 +2669,13 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
if (at_front) {
if (relative) {
- current_x = note->x0() + delta_x;
+ current_x = canvas_note->x0() + delta_x;
} else {
current_x = primary->x0() + delta_x;
}
} else {
if (relative) {
- current_x = note->x1() + delta_x;
+ current_x = canvas_note->x1() + delta_x;
} else {
current_x = primary->x1() + delta_x;
}
@@ -2822,7 +2832,7 @@ MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evo
}
void
-MidiRegionView::change_note_channel (NoteBse* event, int8_t chn, bool relative)
+MidiRegionView::change_note_channel (NoteBase* event, int8_t chn, bool relative)
{
uint8_t new_channel;
@@ -3132,7 +3142,7 @@ MidiRegionView::patch_entered (PatchChange* p)
<< _("Program ") << ((int) p->patch()->program()) + MIDI_BP_ZERO << '\n'
<< _("Channel ") << ((int) p->patch()->channel() + 1);
show_verbose_cursor (s.str(), 10, 20);
- p->grab_focus();
+ p->item().grab_focus();
}
void
@@ -3145,16 +3155,18 @@ MidiRegionView::patch_left (PatchChange *)
}
void
-MidiRegionView::sysex_entered (ArdourCanvas::CanvasSysEx* p)
+MidiRegionView::sysex_entered (SysEx* p)
{
ostringstream s;
- s << p->text();
- show_verbose_cursor (s.str(), 10, 20);
- p->grab_focus();
+ // CAIROCANVAS
+ // need a way to extract text from p->_flag->_text
+ // s << p->text();
+ // show_verbose_cursor (s.str(), 10, 20);
+ p->item().grab_focus();
}
void
-MidiRegionView::sysex_left (ArdourCanvas::CanvasSysEx *)
+MidiRegionView::sysex_left (SysEx *)
{
trackview.editor().verbose_cursor()->hide ();
/* focus will transfer back via the enter-notify event sent to this
@@ -3357,7 +3369,7 @@ MidiRegionView::paste (framepos_t pos, float times, const MidiCutBuffer& mcb)
}
struct EventNoteTimeEarlyFirstComparator {
- bool operator() (CanvasNoteEvent* a, CanvasNoteEvent* b) {
+ bool operator() (NoteBase* a, NoteBase* b) {
return a->note()->time() < b->note()->time();
}
};
@@ -3606,7 +3618,7 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos)
if (_step_edit_cursor == 0) {
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
- _step_edit_cursor = new ArdourCanvas::Rectangle (*group);
+ _step_edit_cursor = new ArdourCanvas::Rectangle (group);
_step_edit_cursor->set_y0 (0);
_step_edit_cursor->set_y1 (midi_stream_view()->contents_height());
_step_edit_cursor->set_fill_color (RGBA_TO_UINT (45,0,0,90));
@@ -3760,14 +3772,16 @@ MidiRegionView::edit_patch_change (PatchChange* pc)
}
void
-MidiRegionView::delete_sysex (CanvasSysEx* sysex)
+MidiRegionView::delete_sysex (SysEx* /*sysex*/)
{
- MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
- c->remove (sysex->sysex());
- _model->apply_command (*trackview.session(), c);
+ // CAIROCANVAS
+ // sysyex object doesn't have a pointer to a sysex event
+ // MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
+ // c->remove (sysex->sysex());
+ // _model->apply_command (*trackview.session(), c);
- _sys_exes.clear ();
- display_sysexes();
+ //_sys_exes.clear ();
+ // display_sysexes();
}
void
@@ -3813,11 +3827,10 @@ MidiRegionView::show_verbose_cursor (string const & text, double xoffset, double
/* Flip the cursor above the mouse pointer if it would overlap the bottom of the canvas */
- double x1, y1, x2, y2;
- trackview.editor().verbose_cursor()->canvas_item()->get_bounds (x1, y1, x2, y2);
+ ArdourCanvas::Rect bb = trackview.editor().verbose_cursor()->item().bounding_box().get();
- if ((wy + y2 - y1) > trackview.editor().canvas_height()) {
- wy -= (y2 - y1) + 2 * yoffset;
+ if ((wy + bb.y1 - bb.y0) > trackview.editor().visible_canvas_height()) {
+ wy -= (bb.y1 - bb.y0) + 2 * yoffset;
}
trackview.editor().verbose_cursor()->set (text, wx, wy);
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index b64ab729b0..d1b646ce61 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -59,6 +59,7 @@ class MidiCutBuffer;
class MidiListEditor;
class EditNoteDialog;
class NotePlayer;
+class PatchChange;
class MidiRegionView : public RegionView
{
@@ -139,7 +140,7 @@ public:
void delete_patch_change (PatchChange *);
void edit_patch_change (PatchChange *);
- void delete_sysex (ArdourCanvas::CanvasSysEx*);
+ void delete_sysex (SysEx*);
/** Alter a given patch to be its predecessor in the MIDNAM file.
*/
@@ -167,24 +168,24 @@ public:
void display_model(boost::shared_ptr<ARDOUR::MidiModel> model);
void start_note_diff_command (std::string name = "midi edit");
- void note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val);
- void note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::MusicalTime val);
+ void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val);
+ void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::MusicalTime val);
void note_diff_add_note (const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity = false);
- void note_diff_remove_note (ArdourCanvas::CanvasNoteEvent* ev);
+ void note_diff_remove_note (NoteBase* ev);
void apply_diff (bool as_subcommand = false);
void abort_command();
- void note_entered(ArdourCanvas::CanvasNoteEvent* ev);
- void note_left(ArdourCanvas::CanvasNoteEvent* ev);
+ void note_entered(NoteBase* ev);
+ void note_left(NoteBase* ev);
void patch_entered (PatchChange *);
void patch_left (PatchChange *);
- void sysex_entered (ArdourCanvas::CanvasSysEx* p);
- void sysex_left (ArdourCanvas::CanvasSysEx* p);
+ void sysex_entered (SysEx* p);
+ void sysex_left (SysEx* p);
void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
- void unique_select(ArdourCanvas::CanvasNoteEvent* ev);
- void note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool extend=false);
- void note_deselected(ArdourCanvas::CanvasNoteEvent* ev);
+ void unique_select(NoteBase* ev);
+ void note_selected(NoteBase* ev, bool add, bool extend=false);
+ void note_deselected(NoteBase* ev);
void delete_selection();
void delete_note (boost::shared_ptr<NoteType>);
size_t selection_size() { return _selection.size(); }
@@ -193,7 +194,7 @@ public:
void invert_selection ();
void move_selection(double dx, double dy, double cumulative_dy);
- void note_dropped (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::frameoffset_t, int8_t d_note);
+ void note_dropped (NoteBase* ev, ARDOUR::frameoffset_t, int8_t d_note);
void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
@@ -215,8 +216,8 @@ public:
*/
void begin_resizing(bool at_front);
- void update_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
- void commit_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
+ void update_resizing (NoteBase*, bool, double, bool);
+ void commit_resizing (NoteBase*, bool, double, bool);
void abort_resizing ();
/** Change the channel of the selection.
@@ -283,7 +284,7 @@ public:
void show_list_editor ();
- typedef std::set<ArdourCanvas::CanvasNoteEvent*> Selection;
+ typedef std::set<NoteBase*> Selection;
Selection selection () const {
return _selection;
}
@@ -292,8 +293,8 @@ public:
void enable_display (bool);
- void set_channel_selector_scoped_note(ArdourCanvas::CanvasNoteEvent* note){ _channel_selection_scoped_note = note; }
- ArdourCanvas::CanvasNoteEvent* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
+ void set_channel_selector_scoped_note(NoteBase* note){ _channel_selection_scoped_note = note; }
+ NoteBase* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
void trim_front_starting ();
void trim_front_ending ();
@@ -356,20 +357,20 @@ private:
void instrument_settings_changed ();
PBD::ScopedConnection _instrument_changed_connection;
- void change_note_channel (ArdourCanvas::CanvasNoteEvent *, int8_t, bool relative=false);
- void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false);
- void change_note_note(ArdourCanvas::CanvasNoteEvent* ev, int8_t note, bool relative=false);
- void change_note_time(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
- void change_note_length (ArdourCanvas::CanvasNoteEvent *, ARDOUR::MidiModel::TimeType);
- void trim_note(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType start_delta,
+ void change_note_channel (NoteBase *, int8_t, bool relative=false);
+ void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
+ void change_note_note(NoteBase* ev, int8_t note, bool relative=false);
+ void change_note_time(NoteBase* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
+ void change_note_length (NoteBase *, ARDOUR::MidiModel::TimeType);
+ void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_delta);
- void clear_selection_except (ArdourCanvas::CanvasNoteEvent* ev, bool signal = true);
+ void clear_selection_except (NoteBase* ev, bool signal = true);
void update_drag_selection (double last_x, double x, double last_y, double y, bool extend);
void update_vertical_drag_selection (double last_y, double y, bool extend);
- void add_to_selection (ArdourCanvas::CanvasNoteEvent*);
- void remove_from_selection (ArdourCanvas::CanvasNoteEvent*);
+ void add_to_selection (NoteBase*);
+ void remove_from_selection (NoteBase*);
void show_verbose_cursor (std::string const &, double, double) const;
void show_verbose_cursor (boost::shared_ptr<NoteType>) const;
@@ -377,24 +378,24 @@ private:
uint8_t _current_range_min;
uint8_t _current_range_max;
- typedef std::list<ArdourCanvas::CanvasNoteEvent*> Events;
+ typedef std::list<NoteBase*> Events;
typedef std::vector< boost::shared_ptr<PatchChange> > PatchChanges;
- typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasSysEx> > SysExes;
+ typedef std::vector< boost::shared_ptr<SysEx> > SysExes;
boost::shared_ptr<ARDOUR::MidiModel> _model;
Events _events;
PatchChanges _patch_changes;
SysExes _sys_exes;
- ArdourCanvas::CanvasNote** _active_notes;
+ Note** _active_notes;
ArdourCanvas::Group* _note_group;
ARDOUR::MidiModel::NoteDiffCommand* _note_diff_command;
- ArdourCanvas::CanvasNote* _ghost_note;
+ Note* _ghost_note;
double _last_ghost_x;
double _last_ghost_y;
ArdourCanvas::Rectangle* _step_edit_cursor;
Evoral::MusicalTime _step_edit_cursor_width;
Evoral::MusicalTime _step_edit_cursor_position;
- ArdourCanvas::CanvasNoteEvent* _channel_selection_scoped_note;
+ NoteBase* _channel_selection_scoped_note;
/** A group used to temporarily reparent _note_group to during start trims, so
@@ -405,7 +406,7 @@ private:
MouseState _mouse_state;
int _pressed_button;
- /** Currently selected CanvasNoteEvents */
+ /** Currently selected NoteBase objects */
Selection _selection;
bool _sort_needed;
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index 3ef5bf4870..5198841291 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -76,7 +76,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
*/
_note_lines = new ArdourCanvas::LineSet (_canvas_group);
- _note_lines->Event().connect(
+ _note_lines->Event.connect(
sigc::bind(sigc::mem_fun(_trackview.editor(),
&PublicEditor::canvas_stream_view_event),
_note_lines, &_trackview));
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index b1d898c426..1b0db3edb5 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -1034,7 +1034,7 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo
if (_channel_selector) {
if (mode == ChannelColors) {
- _channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+ _channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
} else {
_channel_selector->set_default_channel_color();
}
diff --git a/gtk2_ardour/patch_change.cc b/gtk2_ardour/patch_change.cc
index b5d9c6c8a7..23592dcc88 100644
--- a/gtk2_ardour/patch_change.cc
+++ b/gtk2_ardour/patch_change.cc
@@ -19,6 +19,8 @@
#include <iostream>
+#include <boost/algorithm/string.hpp>
+
#include <glibmm/regex.h>
#include "gtkmm2ext/keyboard.h"
@@ -41,12 +43,10 @@ PatchChange::PatchChange(
double height,
double x,
double y,
- string& model_name,
- string& custom_device_mode,
+ ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch)
: _region (region)
- , _model_name(model_name)
- , _custom_device_mode(custom_device_mode)
+ , _info (info)
, _patch (patch)
, _popup_initialized(false)
{
@@ -69,9 +69,9 @@ PatchChange::~PatchChange()
void
PatchChange::initialize_popup_menus()
{
- boost::shared_ptr<ChannelNameSet> channel_name_set =
- MidiPatchManager::instance()
- .find_channel_name_set(_model_name, _custom_device_mode, _patch->channel());
+ using namespace MIDI::Name;
+
+ boost::shared_ptr<ChannelNameSet> channel_name_set = _info.get_patches (_patch->channel());
if (!channel_name_set) {
return;
@@ -79,40 +79,62 @@ PatchChange::initialize_popup_menus()
const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks();
- // fill popup menu:
- Gtk::Menu::MenuList& patch_bank_menus = _popup.items();
-
- for (ChannelNameSet::PatchBanks::const_iterator bank = patch_banks.begin();
- bank != patch_banks.end();
- ++bank) {
- Glib::RefPtr<Glib::Regex> underscores = Glib::Regex::create("_");
- std::string replacement(" ");
-
- Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu());
+ if (patch_banks.size() > 1) {
+
+ // fill popup menu:
+ Gtk::Menu::MenuList& patch_bank_menus = _popup.items();
+
+ for (ChannelNameSet::PatchBanks::const_iterator bank = patch_banks.begin();
+ bank != patch_banks.end();
+ ++bank) {
+ Glib::RefPtr<Glib::Regex> underscores = Glib::Regex::create("_");
+ std::string replacement(" ");
+
+ Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu());
+
+ const PatchNameList& patches = (*bank)->patch_name_list();
+ Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items();
+
+ for (PatchNameList::const_iterator patch = patches.begin();
+ patch != patches.end();
+ ++patch) {
+ std::string name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement);
+
+ patch_menus.push_back(
+ Gtk::Menu_Helpers::MenuElem(
+ name,
+ sigc::bind(
+ sigc::mem_fun(*this, &PatchChange::on_patch_menu_selected),
+ (*patch)->patch_primary_key())) );
+ }
- const PatchBank::PatchNameList& patches = (*bank)->patch_name_list();
- Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items();
- for (PatchBank::PatchNameList::const_iterator patch = patches.begin();
- patch != patches.end();
- ++patch) {
- std::string name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement);
+ std::string name = underscores->replace((*bank)->name().c_str(), -1, 0, replacement);
- patch_menus.push_back(
+ patch_bank_menus.push_back(
Gtk::Menu_Helpers::MenuElem(
name,
- sigc::bind(
- sigc::mem_fun(*this, &PatchChange::on_patch_menu_selected),
- (*patch)->patch_primary_key())) );
+ patch_bank_menu) );
}
+ } else {
+ /* only one patch bank, so make it the initial menu */
- std::string name = underscores->replace((*bank)->name().c_str(), -1, 0, replacement);
-
- patch_bank_menus.push_back(
- Gtk::Menu_Helpers::MenuElem(
- name,
- patch_bank_menu) );
+ const PatchNameList& patches = patch_banks.front()->patch_name_list();
+ Gtk::Menu::MenuList& patch_menus = _popup.items();
+
+ for (PatchNameList::const_iterator patch = patches.begin();
+ patch != patches.end();
+ ++patch) {
+ std::string name = (*patch)->name();
+ boost::replace_all (name, "_", " ");
+
+ patch_menus.push_back (
+ Gtk::Menu_Helpers::MenuElem (
+ name,
+ sigc::bind (sigc::mem_fun(*this, &PatchChange::on_patch_menu_selected),
+ (*patch)->patch_primary_key())));
+ }
}
}
diff --git a/gtk2_ardour/patch_change.h b/gtk2_ardour/patch_change.h
index fe54426e5f..652f9d66c1 100644
--- a/gtk2_ardour/patch_change.h
+++ b/gtk2_ardour/patch_change.h
@@ -40,15 +40,12 @@ public:
double height,
double x,
double y,
- string& model_name,
- string& custom_device_mode,
+ ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch
);
~PatchChange();
- string model_name () const { return _model_name; }
- string custom_device_mode () const { return _custom_device_mode; }
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
void initialize_popup_menus();
@@ -64,12 +61,13 @@ public:
void hide ();
void show ();
+ ArdourCanvas::Item& item() const { return *_flag; }
+
private:
bool event_handler (GdkEvent *);
MidiRegionView& _region;
- string _model_name;
- string _custom_device_mode;
+ ARDOUR::InstrumentInfo& _info;
ARDOUR::MidiModel::PatchChangePtr _patch;
Gtk::Menu _popup;
bool _popup_initialized;
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index c921f410fb..c3de82daab 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -270,7 +270,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void show_window () = 0;
virtual framepos_t leftmost_position() const = 0;
virtual framecnt_t current_page_frames() const = 0;
- virtual double canvas_height () const = 0;
+ virtual double visible_canvas_height () const = 0;
virtual void temporal_zoom_step (bool coarser) = 0;
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
virtual void scroll_tracks_down_line () = 0;
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 4bddc117eb..8451497289 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -195,7 +195,7 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
- group->Event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
+ group->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
set_colors ();
@@ -237,7 +237,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- ArdourCanvas::Rectangle* cr = new ArdourCanvas::NoEventSimpleRect (group);
+ ArdourCanvas::Rectangle* cr = new ArdourCanvas::Rectangle (group);
+ cr->set_ignore_events (true);
_silent_frames.push_back (cr);
/* coordinates for the rect are relative to the regionview origin */
@@ -272,8 +273,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
_silence_text = new ArdourCanvas::Text (group);
_silence_text->set_ignore_events (true);
- _silence_text->set_font_description() = get_font_for_style (N_("SilenceText"));
- _silence_text->set_fill_color (ARDOUR_UI::config()->canvasvar_SilenceText.get());
+ _silence_text->set_font_description (get_font_for_style (N_("SilenceText")));
+ _silence_text->set_color (ARDOUR_UI::config()->canvasvar_SilenceText.get());
/* both positions are relative to the region start offset in source */
@@ -318,7 +319,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
text += string_compose (_("\n (shortest audible segment = %1 %2)"), ma, aunits);
}
- _silence_text->set_text (text.c_str ());
+ _silence_text->set (text);
}
void
@@ -634,10 +635,10 @@ RegionView::region_sync_changed ()
/* points set below */
sync_mark = new ArdourCanvas::Polygon (group);
- sync_mark->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // fill_color; // FIXME make a themeable colour
+ sync_mark->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // FIXME make a themeable colour
sync_line = new ArdourCanvas::Line (group);
- sync_line->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // fill_color // FIXME make a themeable colour
+ sync_line->set_outline_color (RGBA_TO_UINT(0,255,0,255)); // FIXME make a themeable colour
sync_line->set_outline_width (1);
}
@@ -800,7 +801,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* finish off any old rect, if required */
if (cr && me != new_me) {
- cr->property_x2() = trackview.editor().frame_to_pixel (t - position);
+ cr->set_x1 (trackview.editor().frame_to_pixel (t - position));
}
/* start off any new rect, if required */
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index db6f60f3b0..9934048d66 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -609,7 +609,7 @@ StreamView::update_contents_height ()
case Expanded:
/* In stacked displays, the recregion is always at the top */
i->rectangle->set_y0 (0);
- i->rectangle->set_y1 (h)
+ i->rectangle->set_y1 (h);
break;
}
}
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index f9899b8712..208ba4af13 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -80,8 +80,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator i;
ArdourCanvas::Line *line = 0;
gdouble xpos;
- double who_cares;
- double x1, x2, y1, beat_density;
+ double beat_density;
uint32_t beats = 0;
uint32_t bars = 0;
@@ -216,7 +215,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
//cout << "*** CREATING LINE" << endl;
/* if we already have a line there ... don't sweat it */
if (_lines.find (xpos) == _lines.end()) {
- line = new ArdourCanvas::Line (*_group);
+ line = new ArdourCanvas::Line (_group);
line->set_x0 (xpos);
line->set_x1 (xpos);
line->set_y0 (0.0);
diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc
index 4d7599bb78..a2624c562f 100644
--- a/gtk2_ardour/theme_manager.cc
+++ b/gtk2_ardour/theme_manager.cc
@@ -35,7 +35,6 @@
#include "ardour/filesystem_paths.h"
#include "ardour_button.h"
-#include "canvas-waveview.h"
#include "theme_manager.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
@@ -248,6 +247,8 @@ ThemeManager::on_flat_buttons_toggled ()
void
ThemeManager::on_gradient_waveforms_toggled ()
{
+ // CAIROCANVAS
+#if 0
ARDOUR_UI::config()->gradient_waveforms.set (gradient_waveforms.get_active());
ARDOUR_UI::config()->set_dirty ();
@@ -255,6 +256,7 @@ ThemeManager::on_gradient_waveforms_toggled ()
/* force a redraw */
gtk_rc_reset_styles (gtk_settings_get_default());
+#endif
}
void
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 927229d56e..859cb1cba1 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -289,7 +289,7 @@ TimeAxisView::clip_to_viewport ()
{
if (marked_for_display()) {
if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () ||
- _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->get_canvas()->get_height() {
+ _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->height()) {
_canvas_background->hide ();
_canvas_display->hide ();
return;
@@ -967,21 +967,21 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect = new SelectionRect;
- rect->rect = new SimpleRect (selection_group);
+ rect->rect = new ArdourCanvas::Rectangle (selection_group);
rect->rect->set_outline_what (0);
rect->rect->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectionRect.get());
- rect->start_trim = new SimpleRect (selection_group);
+ rect->start_trim = new ArdourCanvas::Rectangle (selection_group);
rect->start_trim->set_outline_what (0);
- rect->end_trim = new SimpleRect (selection_group);
+ rect->end_trim = new ArdourCanvas::Rectangle (selection_group);
rect->end_trim->set_outline_what (0);
free_selection_rects.push_front (rect);
- rect->rect->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
- rect->start_trim->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
- rect->end_trim->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
+ rect->rect->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
+ rect->start_trim->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
+ rect->end_trim->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
}
rect = free_selection_rects.front();
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index a86b8b7561..c675d7f570 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -146,7 +146,7 @@ void
TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & base_color, framepos_t start, framepos_t duration, Visibility vis, bool wide, bool high)
{
item_name = it_name;
- frame_per_pixel = fpp;
+ frames_per_pixel = fpp;
frame_position = start;
item_duration = duration;
name_connected = false;
@@ -174,9 +174,12 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
vestigial_frame->set_fill_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
if (visibility & ShowFrame) {
- frame = new ArdourCanvas::Rectangle (*group, 0.0, 1.0, trackview.editor().frame_to_pixel(duration), trackview.current_height());
+ frame = new ArdourCanvas::Rectangle (group,
+ ArdourCanvas::Rect (0.0, 1.0,
+ trackview.editor().frame_to_pixel(duration),
+ trackview.current_height()));
- frame->set_outline_pixels (1);
+ frame->set_outline_width (1);
frame->set_outline_what (0xF);
if (_recregion) {
@@ -185,7 +188,7 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
frame->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get());
}
- frame->property_outline_what() = 0x1|0x2|0x4|0x8;
+ frame->set_outline_what (0x1|0x2|0x4|0x8);
} else {
frame = 0;
@@ -522,7 +525,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
last_item_width = trackview.editor().frame_to_pixel(item_duration);
name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2;
- name_pixbuf->set (pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")))
+ name_pixbuf->set (pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")));
}
diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc
index db9721beb4..1f43f754e6 100644
--- a/gtk2_ardour/verbose_cursor.cc
+++ b/gtk2_ardour/verbose_cursor.cc
@@ -41,9 +41,11 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0)
, _yoffset (0)
{
- _canvas_item = new ArdourCanvas::Text (*_editor->track_canvas->root());
- _canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor"));
- _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
+ _canvas_item = new ArdourCanvas::Text (_editor->_track_canvas->root());
+ _canvas_item->set_ignore_events (true);
+ _canvas_item->set_font_description (get_font_for_style (N_("VerboseCanvasCursor")));
+ // CAIROCANVAS
+ // _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
}
ArdourCanvas::Item *
@@ -62,7 +64,7 @@ VerboseCursor::set (string const & text, double x, double y)
void
VerboseCursor::set_text (string const & text)
{
- _canvas_item->property_text() = text.c_str();
+ _canvas_item->set (text);
}
/** @param xoffset x offset to be applied on top of any set_position() call
@@ -94,22 +96,14 @@ VerboseCursor::hide ()
double
VerboseCursor::clamp_x (double x)
{
- if (x < 0) {
- x = 0;
- } else {
- x = min (_editor->_canvas_width - 200.0, x);
- }
+ _editor->clamp_verbose_cursor_x (x);
return x;
}
double
VerboseCursor::clamp_y (double y)
{
- if (y < _editor->canvas_timebars_vsize) {
- y = _editor->canvas_timebars_vsize;
- } else {
- y = min (_editor->_canvas_height - 50, y);
- }
+ _editor->clamp_verbose_cursor_y (y);
return y;
}
@@ -254,7 +248,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double
void
VerboseCursor::set_color (uint32_t color)
{
- _canvas_item->set_fill_color (color);
+ _canvas_item->set_color (color);
}
/** Set the position of the verbose cursor. Any x/y offsets
diff --git a/gtk2_ardour/verbose_cursor.h b/gtk2_ardour/verbose_cursor.h
index 751a567a80..8db45608cd 100644
--- a/gtk2_ardour/verbose_cursor.h
+++ b/gtk2_ardour/verbose_cursor.h
@@ -19,7 +19,7 @@
#include "ardour/types.h"
#include "canvas/text.h"
-#include "canvas.h"
+#include "canvas/canvas.h"
class Editor;
@@ -42,13 +42,15 @@ public:
void show (double xoffset = 0, double yoffset = 0);
void hide ();
+ ArdourCanvas::Item& item() { return *_canvas_item; }
+
private:
double clamp_x (double);
double clamp_y (double);
- Editor* _editor;
- ArdourCanvas::NoEventText* _canvas_item;
- bool _visible;
- double _xoffset;
- double _yoffset;
+ Editor* _editor;
+ ArdourCanvas::Text* _canvas_item;
+ bool _visible;
+ double _xoffset;
+ double _yoffset;
};
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index a05a71247f..dbf69f2cb7 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -151,6 +151,7 @@ gtk2_ardour_sources = [
'new_plugin_preset_dialog.cc',
'normalize_dialog.cc',
'note.cc',
+ 'note_base.cc',
'note_player.cc',
'nsm.cc',
'nsmclient.cc',
diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h
index bd16fff67d..7898fb2bc8 100644
--- a/libs/canvas/canvas/item.h
+++ b/libs/canvas/canvas/item.h
@@ -79,7 +79,9 @@ public:
}
boost::optional<Rect> bounding_box () const;
-
+ Coord height() const;
+ Coord width() const;
+
Duple item_to_parent (Duple const &) const;
Rect item_to_parent (Rect const &) const;
Duple parent_to_item (Duple const &) const;
@@ -118,7 +120,9 @@ public:
void set_data (std::string const &, void *);
void* get_data (std::string const &) const;
- /* XXX: maybe this should be a PBD::Signal */
+ /* This is a sigc++ signal because it is solely
+ concerned with GUI stuff and is thus single-threaded
+ */
template <class T>
struct EventAccumulator {
@@ -135,7 +139,7 @@ public:
}
};
- sigc::signal<bool, GdkEvent*>::accumulated<EventAccumulator<bool> > Event;
+ sigc::signal1<bool, GdkEvent*, EventAccumulator<bool> > Event;
#ifdef CANVAS_DEBUG
std::string name;
diff --git a/libs/canvas/canvas/text.h b/libs/canvas/canvas/text.h
index ccc8d04dd5..08e2a469a7 100644
--- a/libs/canvas/canvas/text.h
+++ b/libs/canvas/canvas/text.h
@@ -1,3 +1,6 @@
+#ifndef __ardour_canvas_text_h__
+#define __ardour_canvas_text_h__
+
#include <pangomm/fontdescription.h>
#include <pangomm/layout.h>
@@ -9,6 +12,7 @@ class Text : public Item
{
public:
Text (Group *);
+ ~Text();
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;
@@ -17,7 +21,7 @@ public:
void set (std::string const &);
void set_color (uint32_t);
- void set_font_description (Pango::FontDescription *);
+ void set_font_description (Pango::FontDescription);
void set_alignment (Pango::Alignment);
private:
@@ -30,3 +34,5 @@ private:
};
}
+
+#endif /* __ardour_canvas_text_h__ */
diff --git a/libs/canvas/canvas/types.h b/libs/canvas/canvas/types.h
index 20b0799ea6..2cace4868b 100644
--- a/libs/canvas/canvas/types.h
+++ b/libs/canvas/canvas/types.h
@@ -12,11 +12,10 @@ namespace ArdourCanvas
typedef double Coord;
typedef double Distance;
typedef uint32_t Color;
+
extern Coord const COORD_MAX;
extern Coord const CAIRO_MAX;
-extern Coord safe_add (Coord, Coord);
-
struct Duple
{
Duple ()
diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h
index 8ef0ce9868..b8c96cb672 100644
--- a/libs/canvas/canvas/wave_view.h
+++ b/libs/canvas/canvas/wave_view.h
@@ -1,6 +1,11 @@
#include <boost/shared_ptr.hpp>
+
#include "pbd/properties.h"
+
#include "ardour/types.h"
+
+#include <glibmm/refptr.h>
+
#include "canvas/item.h"
#include "canvas/fill.h"
#include "canvas/outline.h"
@@ -9,6 +14,10 @@ namespace ARDOUR {
class AudioRegion;
}
+namespace Gdk {
+ class Pixbuf;
+}
+
class WaveViewTest;
namespace ArdourCanvas {
diff --git a/libs/canvas/group.cc b/libs/canvas/group.cc
index c6af74229b..adb4b206a8 100644
--- a/libs/canvas/group.cc
+++ b/libs/canvas/group.cc
@@ -192,6 +192,7 @@ void
Group::add_items_at_point (Duple const point, vector<Item const *>& items) const
{
boost::optional<Rect> const bbox = bounding_box ();
+
if (!bbox || !bbox.get().contains (point)) {
return;
}
diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc
index ef207c448f..570eff9f14 100644
--- a/libs/canvas/item.cc
+++ b/libs/canvas/item.cc
@@ -192,6 +192,20 @@ Item::bounding_box () const
return _bounding_box;
}
+Coord
+Item::height () const
+{
+ boost::optional<Rect> bb = bounding_box().get();
+ return bb->height ();
+}
+
+Coord
+Item::width () const
+{
+ boost::optional<Rect> bb = bounding_box().get();
+ return bb->width ();
+}
+
/* XXX may be called even if bbox is not changing ... bit grotty */
void
Item::begin_change ()
diff --git a/libs/canvas/text.cc b/libs/canvas/text.cc
index 541a5f7fc0..feb88e1996 100644
--- a/libs/canvas/text.cc
+++ b/libs/canvas/text.cc
@@ -16,6 +16,11 @@ Text::Text (Group* parent)
}
+Text::~Text ()
+{
+ delete _font_description;
+}
+
void
Text::set (string const & text)
{
@@ -97,11 +102,11 @@ Text::set_alignment (Pango::Alignment alignment)
}
void
-Text::set_font_description (Pango::FontDescription* font_description)
+Text::set_font_description (Pango::FontDescription font_description)
{
begin_change ();
- _font_description = font_description;
+ _font_description = new Pango::FontDescription (font_description);
_bounding_box_dirty = true;
end_change ();
diff --git a/libs/canvas/types.cc b/libs/canvas/types.cc
index 02ab77e000..56312741cf 100644
--- a/libs/canvas/types.cc
+++ b/libs/canvas/types.cc
@@ -10,10 +10,10 @@ Coord const ArdourCanvas::COORD_MAX = DBL_MAX;
/* XXX: empirically arrived at */
Coord const ArdourCanvas::CAIRO_MAX = 65536;
-Coord
-ArdourCanvas::safe_add (Coord a, Coord b)
+static inline Coord
+safe_add (Coord a, Coord b)
{
- if (a == COORD_MAX || b == COORD_MAX) {
+ if (((COORD_MAX - a) > b) || ((COORD_MAX - b) > a)) {
return COORD_MAX;
}