commit immediately post linking

This commit is contained in:
Paul Davis 2013-04-04 18:45:27 -04:00
parent aaea166135
commit 19bd641915
44 changed files with 504 additions and 406 deletions

View file

@ -39,6 +39,7 @@
#include "canvas/rectangle.h" #include "canvas/rectangle.h"
#include "canvas/polygon.h" #include "canvas/polygon.h"
#include "canvas/poly_line.h"
#include "canvas/pixbuf.h" #include "canvas/pixbuf.h"
#include "streamview.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 = new ArdourCanvas::Rectangle (group);
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0)); 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); fade_out_handle->set_data ("regionview", this);
} }
@ -719,7 +720,7 @@ AudioRegionView::set_frames_per_pixel (gdouble fpp)
if (Config->get_show_waveforms ()) { if (Config->get_show_waveforms ()) {
for (uint32_t n = 0; n < waves.size(); ++n) { 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 /* make sure the zoom level is correct, since we don't update
this when waveforms are hidden. 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(); waves[n]->show();
} }
} else { } else {
@ -889,8 +891,6 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
gdouble yoff = which * ht; gdouble yoff = which * ht;
WaveView *wave = new WaveView(*group);
WaveView *wave = new WaveView (group, audio_region ()); WaveView *wave = new WaveView (group, audio_region ());
wave->set_channel (which); 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_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.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_rectified() = Config->get_waveform_shape() == Rectified;
wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic; wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
@ -1085,7 +1086,7 @@ AudioRegionView::entered (bool internal_editing)
} }
if (fade_in_handle && !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_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_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 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->show ();
canvas_item->set_data ("regionview", this); 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)); 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) { if (!start_xfade_in) {
start_xfade_in = new ArdourCanvas::Line (*group); start_xfade_in = new ArdourCanvas::PolyLine (group);
start_xfade_in->property_width_pixels() = 1; // CAIROCANVAS
start_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get(); // start_xfade_in->set_width_pixels (1);
start_xfade_in->set_outline_color (ARDOUR_UI::config()->canvasvar_GainLine.get());
} }
if (!start_xfade_out) { if (!start_xfade_out) {
start_xfade_out = new ArdourCanvas::Line (*group); start_xfade_out = new ArdourCanvas::PolyLine (group);
start_xfade_out->property_width_pixels() = 1; // CAIROCANVAS
// start_xfade_out->set_width_pixels (1);
uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128); 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) { if (!start_xfade_rect) {
start_xfade_rect = new ArdourCanvas::Rectangle (*group); start_xfade_rect = new ArdourCanvas::Rectangle (group);
start_xfade_rect->property_draw() = true; // CAIROCANVAS
start_xfade_rect->property_fill() = true;; // start_xfade_rect->property_draw() = true;
start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get(); start_xfade_rect->set_fill (true);
start_xfade_rect->property_outline_pixels() = 0; start_xfade_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get());
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->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); 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]); boost::scoped_array<float> vec (new float[npoints]);
double effective_height; 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); ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (i); p.x = i;
p.set_y (1.0 + effective_height - (effective_height * vec.get()[i])); p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
} }
start_xfade_rect->property_x1() = ((*points)[0]).get_x(); start_xfade_rect->set (ArdourCanvas::Rect (((*points)[0]).x, 1.0, ((*points)[npoints-1]).x, effective_height));
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->show (); start_xfade_rect->show ();
start_xfade_in->property_points() = *points; start_xfade_in->set (*points);
start_xfade_in->show (); start_xfade_in->show ();
start_xfade_in->raise_to_top (); start_xfade_in->raise_to_top ();
@ -1422,9 +1423,9 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
if (!inverse) { if (!inverse) {
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (i); p.x = i;
p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]))); p.y = 1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]));
} }
} else { } else {
@ -1432,13 +1433,13 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints); inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints);
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (i); p.x = i;
p.set_y (1.0 + effective_height - (effective_height * vec.get()[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->show ();
start_xfade_out->raise_to_top (); 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) { if (!end_xfade_in) {
end_xfade_in = new ArdourCanvas::Line (*group); end_xfade_in = new ArdourCanvas::PolyLine (group);
end_xfade_in->property_width_pixels() = 1; // CAIROCANVAS
end_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get(); // end_xfade_in->property_width_pixels() = 1;
end_xfade_in->set_outline_color (ARDOUR_UI::config()->canvasvar_GainLine.get());
} }
if (!end_xfade_out) { if (!end_xfade_out) {
end_xfade_out = new ArdourCanvas::Line (*group); end_xfade_out = new ArdourCanvas::PolyLine (group);
end_xfade_out->property_width_pixels() = 1; // CAIROCANVAS
// end_xfade_out->property_width_pixels() = 1;
uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128); 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) { if (!end_xfade_rect) {
end_xfade_rect = new ArdourCanvas::Rectangle (*group); end_xfade_rect = new ArdourCanvas::Rectangle (group);
end_xfade_rect->property_draw() = true; // CAIROCANVAS
end_xfade_rect->property_fill() = true;; // end_xfade_rect->property_draw() = true;
end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get(); end_xfade_rect->set_fill (true);
end_xfade_rect->property_outline_pixels() = 0; end_xfade_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get());
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->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); 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) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (rend + i); p.x = rend + i;
p.set_y (1.0 + effective_height - (effective_height * vec.get()[i])); p.y = 1.0 + effective_height - (effective_height * vec.get()[i]);
} }
end_xfade_rect->property_x1() = ((*points)[0]).get_x(); end_xfade_rect->set (ArdourCanvas::Rect (((*points)[0]).x, 1.0, ((*points)[npoints-1]).x, effective_height));
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->show (); end_xfade_rect->show ();
end_xfade_in->property_points() = *points; end_xfade_in->set (*points);
end_xfade_in->show (); end_xfade_in->show ();
end_xfade_in->raise_to_top (); end_xfade_in->raise_to_top ();
@ -1532,9 +1533,9 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
if (!inverse) { if (!inverse) {
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (rend + i); p.x = rend + i;
p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]))); p.y = 1.0 + effective_height - (effective_height * (1.0 - vec.get()[i]));
} }
} else { } 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); inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]); ArdourCanvas::Duple &p ((*points)[pci++]);
p.set_x (rend + i); p.x = rend + i;
p.set_y (1.0 + effective_height - (effective_height * vec.get()[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->show ();
end_xfade_out->raise_to_top (); end_xfade_out->raise_to_top ();

View file

@ -156,13 +156,13 @@ class AudioRegionView : public RegionView
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0 ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0 ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Line *start_xfade_in; ArdourCanvas::PolyLine *start_xfade_in;
ArdourCanvas::Line *start_xfade_out; ArdourCanvas::PolyLine *start_xfade_out;
ArdourCanvas::Rectangle* start_xfade_rect; ArdourCanvas::Rectangle* start_xfade_rect;
bool _start_xfade_visible; bool _start_xfade_visible;
ArdourCanvas::Line *end_xfade_in; ArdourCanvas::PolyLine *end_xfade_in;
ArdourCanvas::Line *end_xfade_out; ArdourCanvas::PolyLine *end_xfade_out;
ArdourCanvas::Rectangle* end_xfade_rect; ArdourCanvas::Rectangle* end_xfade_rect;
bool _end_xfade_visible; bool _end_xfade_visible;

View file

@ -98,19 +98,19 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
case Normal: case Normal:
if (recording) { if (recording) {
region_view = new AudioRegionView (_canvas_group, _trackview, region, region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility( _frames_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
TimeAxisViewItem::ShowFrame | TimeAxisViewItem::ShowFrame |
TimeAxisViewItem::HideFrameRight | TimeAxisViewItem::HideFrameRight |
TimeAxisViewItem::HideFrameLeft | TimeAxisViewItem::HideFrameLeft |
TimeAxisViewItem::HideFrameTB)); TimeAxisViewItem::HideFrameTB));
} else { } else {
region_view = new AudioRegionView (_canvas_group, _trackview, region, region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color); _frames_per_pixel, region_color);
} }
break; break;
case Destructive: case Destructive:
region_view = new TapeAudioRegionView (_canvas_group, _trackview, region, region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color); _frames_per_pixel, region_color);
break; break;
default: default:
fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg; fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg;

View file

@ -984,8 +984,8 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
} }
for (uint32_t n = 0; n < vp; ++n) { for (uint32_t n = 0; n < vp; ++n) {
line_points[n].x (control_points[n]->get_x()); line_points[n].x = control_points[n]->get_x();
line_points[n].y (control_points[n]->get_y()); line_points[n].y = control_points[n]->get_y();
} }
line->set (line_points); line->set (line_points);

View file

@ -119,7 +119,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
double test_time = (*_events.begin())->note()->time (); double test_time = (*_events.begin())->note()->time ();
double test_length = (*_events.begin())->note()->length (); 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) { if ((*i)->note()->channel() != test_channel) {
_channel_all.set_sensitive (true); _channel_all.set_sensitive (true);
} }
@ -170,7 +170,7 @@ EditNoteDialog::run ()
bool had_change = false; bool had_change = false;
if (!_channel_all.get_sensitive() || _channel_all.get_active ()) { 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()) { if (_channel.get_value_as_int() - 1 != (*i)->note()->channel()) {
_region_view->change_note_channel (*i, _channel.get_value_as_int () - 1); _region_view->change_note_channel (*i, _channel.get_value_as_int () - 1);
had_change = true; had_change = true;
@ -179,7 +179,7 @@ EditNoteDialog::run ()
} }
if (!_pitch_all.get_sensitive() || _pitch_all.get_active ()) { 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()) { if (_pitch.get_value_as_int() != (*i)->note()->note()) {
_region_view->change_note_note (*i, _pitch.get_value_as_int ()); _region_view->change_note_note (*i, _pitch.get_value_as_int ());
had_change = true; had_change = true;
@ -188,7 +188,7 @@ EditNoteDialog::run ()
} }
if (!_velocity_all.get_sensitive() || _velocity_all.get_active ()) { 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()) { if (_velocity.get_value_as_int() != (*i)->note()->velocity()) {
_region_view->change_note_velocity (*i, _velocity.get_value_as_int ()); _region_view->change_note_velocity (*i, _velocity.get_value_as_int ());
had_change = true; had_change = true;
@ -199,7 +199,7 @@ EditNoteDialog::run ()
double const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ()); double const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ());
if (!_time_all.get_sensitive() || _time_all.get_active ()) { 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()) { if (t != (*i)->note()->time()) {
_region_view->change_note_time (*i, t); _region_view->change_note_time (*i, t);
had_change = true; had_change = true;
@ -210,7 +210,7 @@ EditNoteDialog::run ()
double const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ()); double const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ());
if (!_length_all.get_sensitive() || _length_all.get_active ()) { 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()) { if (d != (*i)->note()->length()) {
_region_view->change_note_length (*i, d); _region_view->change_note_length (*i, d);
had_change = true; had_change = true;
@ -224,7 +224,7 @@ EditNoteDialog::run ()
_region_view->apply_diff (); _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 (*i)->set_selected ((*i)->selected()); // change color
} }

View file

@ -496,14 +496,15 @@ Editor::Editor ()
_cursors = new MouseCursors; _cursors = new MouseCursors;
ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::GtkCanvas()); ArdourCanvas::Canvas* time_pad = 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::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->set_outline_color (0xFF0000FF);
pad_line_1->show(); 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, (int)(timebar_height * visible_timebars) + 2);
time_canvas_vbox.set_size_request (-1, -1); 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) { if (pending_visual_change.idle_handler_id < 0) {
pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this); pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
pending_visual_change.executing = false; pending_visual_change.being_handled = false;
} }
} }

View file

@ -25,12 +25,10 @@
#include <set> #include <set>
#include <string> #include <string>
#include <sys/time.h> #include <sys/time.h>
#include <cmath>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <cmath>
#include <gtkmm/comboboxtext.h> #include <gtkmm/comboboxtext.h>
#include <gtkmm/layout.h> #include <gtkmm/layout.h>
@ -48,6 +46,8 @@
#include "ardour/location.h" #include "ardour/location.h"
#include "ardour/types.h" #include "ardour/types.h"
#include "canvas/fwd.h"
#include "gtk-custom-ruler.h" #include "gtk-custom-ruler.h"
#include "ardour_button.h" #include "ardour_button.h"
#include "ardour_dialog.h" #include "ardour_dialog.h"
@ -58,8 +58,6 @@
#include "region_selection.h" #include "region_selection.h"
#include "window_proxy.h" #include "window_proxy.h"
#include "canvas/fwd.h"
namespace Gtkmm2ext { namespace Gtkmm2ext {
class TearOff; class TearOff;
class Bindings; class Bindings;
@ -103,6 +101,7 @@ class GUIObjectState;
class Marker; class Marker;
class MidiRegionView; class MidiRegionView;
class MixerStrip; class MixerStrip;
class NoteBase;
class PlaylistSelector; class PlaylistSelector;
class PluginSelector; class PluginSelector;
class RhythmFerret; class RhythmFerret;
@ -460,6 +459,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return _verbose_cursor; return _verbose_cursor;
} }
double clamp_verbose_cursor_x (double);
double clamp_verbose_cursor_y (double);
void get_pointer_position (double &, double &) const; void get_pointer_position (double &, double &) const;
TimeAxisView* stepping_axis_view () { TimeAxisView* stepping_axis_view () {
@ -711,7 +713,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_canvas_cursor (); void set_canvas_cursor ();
ArdourCanvas::GtkCanvas* _track_canvas; ArdourCanvas::GtkCanvas* _track_canvas;
ArdourCanvas::GtkCanvasViewPort* _track_canvas_viewport; ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport;
Gtk::Adjustment* _track_canvas_hadj; Gtk::Adjustment* _track_canvas_hadj;
Gtk::Adjustment* _track_canvas_vadj; 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_tempo_marker (ArdourCanvas::Item*);
void edit_meter_marker (ArdourCanvas::Item*); void edit_meter_marker (ArdourCanvas::Item*);
void edit_control_point (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_edit ();
void marker_menu_remove (); void marker_menu_remove ();

View file

@ -75,6 +75,6 @@ Editor::toggle_meter_updating()
stop_updating_meters (); stop_updating_meters ();
} }
track_canvas_viewport_allocate (track_canvas->get_allocation()); track_canvas_viewport_allocate (_track_canvas->get_allocation());
} }

View file

@ -95,13 +95,13 @@ Editor::initialize_canvas ()
} }
/* a group to hold time (measure) lines */ /* 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->set_outline_width (1);
transport_loop_range_rect->hide(); 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->set_outline_width (0);
transport_punch_range_rect->hide(); 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)); 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)); 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)); 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 #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()) { 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; videotl_bar->property_outline_pixels() = 1;
} else { } 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_pixels() = 0;
} }
videotl_bar->property_outline_what() = (0x1 | 0x8); videotl_bar->property_outline_what() = (0x1 | 0x8);
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height)); ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height));
#endif #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 = 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->set_outline (false);
cd_marker_bar_drag_rect->hide (); 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->set_outline (false);
range_bar_drag_rect->hide (); 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->set_outline (false);
transport_bar_drag_rect->hide (); transport_bar_drag_rect->hide ();
transport_punchin_line = new ArdourCanvas::Line (_master_group); 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_x1 (0);
transport_punchin_line->set_y1 (0); transport_punchin_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchin_line->set_x2 (0);
transport_punchin_line->set_y2 (ArdourCanvas::COORD_MAX);
transport_punchin_line->hide (); transport_punchin_line->hide ();
transport_punchout_line = new ArdourCanvas::Line (_master_group); 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_x1 (0);
transport_punchout_line->set_y1 (0); transport_punchout_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchout_line->set_x2 (0);
transport_punchout_line->set_y2 (ArdourCanvas::COORD_MAX);
transport_punchout_line->hide(); transport_punchout_line->hide();
// used to show zoom mode active zooming // 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->set_outline_width (1);
zoom_rect->hide(); 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 // used as rubberband rect
rubberband_rect = new ArdourCanvas::Rectangle (_trackview_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0)); 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->set_outline_width (1);
rubberband_rect->hide(); rubberband_rect->hide();
tempo_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_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)); 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)); 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)); cd_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
#ifdef WITH_VIDEOTIMELINE #ifdef WITH_VIDEOTIMELINE
videotl_bar_group->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)); //videotl_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
#endif #endif
range_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_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)); 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); 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 (); 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 */ /* try to put the TimeAxisView roughly central */
if (begin >= _canvas_height/2.0) { if (begin >= _visible_canvas_height/2.0) {
begin -= _canvas_height/2.0; begin -= _visible_canvas_height/2.0;
} }
vertical_adjustment.set_value (begin); vertical_adjustment.set_value (begin);
} }
@ -820,6 +810,8 @@ Editor::set_horizontal_position (double p)
#endif #endif
} }
// CAIROCANVAS
#if 0
void void
Editor::scroll_canvas_vertically () 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 */ /* required to keep the controls_layout in lock step with the canvas group */
update_canvas_now (); update_canvas_now ();
} }
#endif
void void
Editor::color_handler() 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()); _verbose_cursor->set_color (ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get());
meter_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_MeterBar.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_fill_color (ARDOUR_UI::config()->canvasvar_TransportPunchRect.get());
transport_punch_range_rect->set_outline_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_punchin_line->set_outline_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
transport_punchout_line->set_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_fill_color (ARDOUR_UI::config()->canvasvar_ZoomRect.get());
zoom_rect->set_outline_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; current_canvas_cursor = cursor;
} }
Glib::RefPtr<Gdk::Window> win = track_canvas->get_window(); Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
if (win) { 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; 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;
}

View file

@ -1014,7 +1014,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
double px; double px;
double py; 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()) { if (target.empty()) {
return false; return false;
@ -1107,7 +1107,7 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
double px; double px;
double py; 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.type = GDK_MOTION_NOTIFY;
event.button.x = wx; event.button.x = wx;

View file

@ -19,6 +19,10 @@
#include "pbd/signals.h" #include "pbd/signals.h"
#include "canvas/arrow.h"
#include "canvas/line.h"
#include "canvas/types.h"
class Editor; class Editor;
class EditorCursor { class EditorCursor {

View file

@ -202,7 +202,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
} }
void 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->ungrab ();
_item = new_item; _item = new_item;
@ -371,7 +371,7 @@ Drag::show_verbose_cursor_time (framepos_t frame)
_editor->verbose_cursor()->set_time ( _editor->verbose_cursor()->set_time (
frame, frame,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(), _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 (); _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 ( _editor->verbose_cursor()->set_duration (
start, end, start, end,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(), _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 ( _editor->verbose_cursor()->set (
text, text,
_drags->current_pointer_x() + 10 - _editor->horizontal_position(), _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. 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); rv->fake_set_opaque (true);
} }
@ -751,7 +751,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
} }
/* Now move the region view */ /* 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 */ } /* foreach region */
@ -2405,7 +2405,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
{ {
Drag::start_grab (event, 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); framepos_t where = _editor->event_frame (event, 0, 0);
_editor->snap_to_with_modifier (where, event); _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"); DEBUG_TRACE (DEBUG::Drags, "New RangeMarkerBarDrag\n");
_drag_rect = new ArdourCanvas::Rectangle (*_editor->time_line_group, 0.0, 0.0, 0.0, _drag_rect = new ArdourCanvas::Rectangle (_editor->time_line_group,
physical_screen_height (_editor->get_window())); ArdourCanvas::Rect (0.0, 0.0, 0.0,
physical_screen_height (_editor->get_window())));
_drag_rect->hide (); _drag_rect->hide ();
_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeDragRect.get()); _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 void
@ -4819,7 +4820,7 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{ {
Drag::start_grab (event, 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 (); framepos_t pf = _drags->current_pointer_frame ();
framecnt_t const g = grid_frames (pf); 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 x = _editor->frame_to_pixel (_note[0]);
double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y))); double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y)));
_drag_rect->property_x1() = x; _drag_rect->set (ArdourCanvas::Rect (x, y, x, y + floor (_region_view->midi_stream_view()->note_height ())));
_drag_rect->property_y1() = y; _drag_rect->set_outline_what (0xff);
_drag_rect->property_x2() = x; _drag_rect->set_outline_color (0xffffff99);
_drag_rect->property_y2() = y + floor (_region_view->midi_stream_view()->note_height ()); _drag_rect->set_fill_color (0xffffff66);
_drag_rect->property_outline_what() = 0xff;
_drag_rect->property_outline_color_rgba() = 0xffffff99;
_drag_rect->property_fill_color_rgba() = 0xffffff66;
} }
void void
@ -4853,9 +4850,9 @@ NoteCreateDrag::motion (GdkEvent* event, bool)
_note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ()); _note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ());
double const x = _editor->frame_to_pixel (_note[1]); double const x = _editor->frame_to_pixel (_note[1]);
if (_note[1] > _note[0]) { if (_note[1] > _note[0]) {
_drag_rect->property_x2() = x; _drag_rect->set_x1 (x);
} else { } 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)); 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 double
NoteCreateDrag::y_to_region (double y) const NoteCreateDrag::y_to_region (double y) const
{ {
double x = 0; double x = 0;
_region_view->get_canvas_group()->w2i (x, y); _region_view->get_canvas_group()->canvas_to_item (x, y);
return y; return y;
} }

View file

@ -310,14 +310,21 @@ Editor::set_canvas_cursor ()
if (!_internal_editing && get_smart_mode() ) { if (!_internal_editing && get_smart_mode() ) {
double x, y; double x, y;
get_pointer_position (x, y); get_pointer_position (x, y);
ArdourCanvas::Item* i = track_canvas->get_item_at (x, y); vector<ArdourCanvas::Item const *> items;
if (i && i->property_parent() && (*i->property_parent()).get_data (X_("timeselection"))) { _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()); pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value());
if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) { if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
current_canvas_cursor = _cursors->up_down; current_canvas_cursor = _cursors->up_down;
} }
} }
} }
}
set_canvas_cursor (current_canvas_cursor, true); set_canvas_cursor (current_canvas_cursor, true);
} }
@ -892,7 +899,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case NoteItem: case NoteItem:
if (internal_editing()) { if (internal_editing()) {
/* trim notes if we're in internal edit mode and near the ends of the note */ /* 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); assert (cn);
if (cn && cn->big_enough_to_trim() && cn->mouse_near_ends()) { if (cn && cn->big_enough_to_trim() && cn->mouse_near_ends()) {
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor); _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; 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) { if (canvas_window) {
Glib::RefPtr<const Gdk::Window> pointer_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); pointer_window = canvas_window->get_pointer (x, y, mask);
if (pointer_window == track_canvas->get_bin_window()) { if (pointer_window == _track_canvas->get_window()) {
track_canvas->window_to_world (x, y, wx, wy); _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) { if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item); ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line) { 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()) { if (is_drawable()) {
set_canvas_cursor (_cursors->fader); 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 x2 = frame_to_pixel (end);
double y2 = _full_canvas_height - 1.0; 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); assert (rv);
ArdourCanvas::Group* g = rv->get_parent_group (); ArdourCanvas::Group* g = rv->get_canvas_group ();
ArdourCanvas::Group* p = g->parent (); ArdourCanvas::Group* p = g->parent ();
/* Compute x in region view parent coordinates */ /* 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 void
Editor::get_pointer_position (double& x, double& y) const Editor::get_pointer_position (double& x, double& y) const
{ {
int px, py; int px, py;
track_canvas->get_pointer (px, py); _track_canvas->get_pointer (px, py);
track_canvas->window_to_world (px, py, x, y); _track_canvas_viewport->window_to_canvas (px, py, x, y);
} }

View file

@ -1397,7 +1397,7 @@ Editor::temporal_zoom (double fpp)
nfpp = 8e+08; 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; half_page_size = new_page_size / 2;
switch (zoom_focus) { switch (zoom_focus) {

View file

@ -1305,8 +1305,8 @@ EditorRoutes::button_press (GdkEventButton* ev)
int y_pos = tv->y_position(); int y_pos = tv->y_position();
//Clamp the y pos so that we do not extend beyond the canvas full height. //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){ if (_editor->_full_canvas_height - y_pos < _editor->_visible_canvas_height){
y_pos = _editor->full_canvas_height - _editor->_visible_canvas_height; y_pos = _editor->_full_canvas_height - _editor->_visible_canvas_height;
} }
//Only scroll to if the track is visible //Only scroll to if the track is visible

View file

@ -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; x->second = x->first + _editor->current_page_frames() * _x_scale;
y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ()); 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) EditorSummary::set_editor (double const x, double const y)
{ {
ArdourCanvas::checkpoint ("editor", "-> set editor"); 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 /* As a side-effect, the Editor's visual change idle handler processes
pending GTK events. Hence this motion notify handler can be called pending GTK events. Hence this motion notify handler can be called
@ -796,7 +796,7 @@ void
EditorSummary::set_editor_y (double const y) EditorSummary::set_editor_y (double const y)
{ {
double y1 = summary_y_to_editor (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 y2 = y1 + eh;
double const full_editor_height = _editor->_full_canvas_height; double const full_editor_height = _editor->_full_canvas_height;

View file

@ -191,7 +191,7 @@ Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
} }
if (tempo_lines == 0) { 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 // CAIROCANVAS

View file

@ -107,7 +107,7 @@ AudioGhostRegion::AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, do
} }
ovoid void
AudioGhostRegion::set_frames_per_pixel (double fpp) AudioGhostRegion::set_frames_per_pixel (double fpp)
{ {
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
@ -187,13 +187,13 @@ MidiGhostRegion::~MidiGhostRegion()
clear_events (); clear_events ();
} }
MidiGhostRegion::Event::Event (NoteBase* e, ArdourCanvas::Group* g) MidiGhostRegion::GhostEvent::GhostEvent (NoteBase* e, ArdourCanvas::Group* g)
: event (e) : 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 */ /* event is not ours to delete */
delete rect; delete rect;
@ -231,8 +231,8 @@ MidiGhostRegion::set_colors()
GhostRegion::set_colors(); GhostRegion::set_colors();
for (EventList::iterator it = events.begin(); it != events.end(); ++it) { for (EventList::iterator it = events.begin(); it != events.end(); ++it) {
(*it)->rect->property_fill_color_rgba() = fill; (*it)->rect->set_fill_color (fill);
(*it)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get(); (*it)->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get());
} }
} }
@ -255,8 +255,8 @@ MidiGhostRegion::update_range ()
} else { } else {
(*it)->rect->show(); (*it)->rect->show();
double const y = trackview.current_height() - (note_num + 1 - mv->lowest_note()) * h + 1; double const y = trackview.current_height() - (note_num + 1 - mv->lowest_note()) * h + 1;
(*it)->rect->property_y1() = y; (*it)->rect->set_y0 (y);
(*it)->rect->property_y2() = y + h; (*it)->rect->set_y1 (y + h);
} }
} }
} }
@ -264,11 +264,11 @@ MidiGhostRegion::update_range ()
void 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); events.push_back (event);
event->rect->property_fill_color_rgba() = source_track_color(200); event->rect->set_fill_color (source_track_color(200));
event->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get(); event->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get());
MidiStreamView* mv = midi_view(); MidiStreamView* mv = midi_view();
@ -279,8 +279,8 @@ MidiGhostRegion::add_note(NoteBase* n)
event->rect->hide(); event->rect->hide();
} else { } else {
const double y = mv->note_to_y(note_num); const double y = mv->note_to_y(note_num);
event->rect->property_y1() = y; event->rect->set_y0 (y);
event->rect->property_y2() = y + mv->note_height(); event->rect->set_y1 (y + mv->note_height());
} }
} }
} }
@ -300,9 +300,9 @@ MidiGhostRegion::clear_events()
* @param parent The CanvasNote from the parent MidiRegionView. * @param parent The CanvasNote from the parent MidiRegionView.
*/ */
void void
MidiGhostRegion::update_note (Note* parent) MidiGhostRegion::update_note (NoteBase* parent)
{ {
Event* ev = find_event (parent); GhostEvent* ev = find_event (parent);
if (!ev) { if (!ev) {
return; return;
} }
@ -314,9 +314,9 @@ MidiGhostRegion::update_note (Note* parent)
} }
void void
MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note) MidiGhostRegion::remove_note (NoteBase* note)
{ {
Event* ev = find_event (note); GhostEvent* ev = find_event (note);
if (!ev) { if (!ev) {
return; return;
} }
@ -331,8 +331,8 @@ MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
* @return Our Event, or 0 if not found. * @return Our Event, or 0 if not found.
*/ */
MidiGhostRegion::Event * MidiGhostRegion::GhostEvent *
MidiGhostRegion::find_event (Note* parent) MidiGhostRegion::find_event (NoteBase* parent)
{ {
/* we are using _optimization_iterator to speed up the common case where a caller /* we are using _optimization_iterator to speed up the common case where a caller
is going through our notes in order. is going through our notes in order.

View file

@ -74,7 +74,7 @@ public:
class GhostEvent : public sigc::trackable { class GhostEvent : public sigc::trackable {
public: public:
GhostEvent(::NoteBase *, ArdourCanvas::Group *); GhostEvent(::NoteBase *, ArdourCanvas::Group *);
virtual ~GhostEvent () {} virtual ~GhostEvent ();
NoteBase* event; NoteBase* event;
ArdourCanvas::Rectangle* rect; ArdourCanvas::Rectangle* rect;
@ -92,15 +92,15 @@ public:
void update_range(); void update_range();
void add_note(Note*); void add_note(NoteBase*);
void update_note (Note*); void update_note (NoteBase*);
void remove_note (Note*); void remove_note (NoteBase*);
void clear_events(); void clear_events();
private: private:
MidiGhostRegion::Event* find_event (Note*); MidiGhostRegion::GhostEvent* find_event (NoteBase*);
typedef std::list<MidiGhostRegion::GhostEvent*> EventList; typedef std::list<MidiGhostRegion::GhostEvent*> EventList;
EventList events; EventList events;

View file

@ -324,10 +324,10 @@ Marker::setup_line ()
if (_line == 0) { if (_line == 0) {
_line = new ArdourCanvas::Line (*group); _line = new ArdourCanvas::Line (group);
_line->set_outline_color (ARDOUR_UI::config()->canvasvar_EditPoint.get()); _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 */ /* 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 ()) { if (label_on_left ()) {
_name_background->set_x0 (name_pixbuf->position().x - 2); _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 { } else {
_name_background->x0 (name_pixbuf->position().x - _label_offset + 2); _name_background->set_x0 (name_pixbuf->position().x - _label_offset + 2);
_name_background->property_x1() = name_pixbuf->position().x + name_width; _name_background->set_x1 (name_pixbuf->position().x + name_width);
} }
_name_background->set_y0 (0); _name_background->set_y0 (0);

View file

@ -82,7 +82,6 @@
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD; using namespace PBD;
using namespace Editing; using namespace Editing;
using namespace ArdourCanvas;
using Gtkmm2ext::Keyboard; using Gtkmm2ext::Keyboard;
PBD::Signal1<void, MidiRegionView *> MidiRegionView::SelectionCleared; PBD::Signal1<void, MidiRegionView *> MidiRegionView::SelectionCleared;
@ -243,7 +242,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
{ {
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys)); PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
NoteBase::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR, NoteBase::NoteBaseDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1), boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
gui_context()); gui_context());
@ -1005,7 +1004,7 @@ MidiRegionView::note_diff_remove_note (NoteBase* ev)
} }
void void
MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property, MidiModel::NoteDiffCommand::Property property,
uint8_t val) uint8_t val)
{ {
@ -1015,7 +1014,7 @@ MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
} }
void void
MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property, MidiModel::NoteDiffCommand::Property property,
Evoral::MusicalTime val) 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); _model->get_notes (notes, op, val, chan_mask);
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) { 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) { if (cne) {
e.push_back (cne); e.push_back (cne);
} }
@ -1295,8 +1294,11 @@ MidiRegionView::display_sysexes()
double height = midi_stream_view()->contents_height(); double height = midi_stream_view()->contents_height();
boost::shared_ptr<CanvasSysEx> sysex = boost::shared_ptr<CanvasSysEx>( // CAIROCANVAS: no longer passing *i (the sysex event) to the
new CanvasSysEx(*this, *_note_group, text, height, x, 1.0, (*i))); // 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 // Show unless message is beyond the region bounds
if (time - _region->start() >= _region->length() || time < _region->start()) { if (time - _region->start() >= _region->length() || time < _region->start()) {
@ -1358,6 +1360,8 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
redisplay_model(); redisplay_model();
} }
// CAIROCANVAS
#if 0
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) { for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
if ((*x)->width() >= _pixel_width) { if ((*x)->width() >= _pixel_width) {
(*x)->hide(); (*x)->hide();
@ -1365,6 +1369,7 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
(*x)->show(); (*x)->show();
} }
} }
#endif
move_step_edit_cursor (_step_edit_cursor_position); move_step_edit_cursor (_step_edit_cursor_position);
set_step_edit_cursor_width (_step_edit_cursor_width); 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; 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); 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. * @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
*/ */
void 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()); framecnt_t region_frames = source_beats_to_region_frames (patch->time());
const double x = trackview.editor().frame_to_pixel (region_frames); const double x = trackview.editor().frame_to_pixel (region_frames);
double const height = midi_stream_view()->contents_height(); double const height = midi_stream_view()->contents_height();
boost::shared_ptr<CanvasPatchChange> patch_change = boost::shared_ptr<CanvasPatchChange>( // CAIROCANVAS: active_channel info removed from PatcChange constructor
new CanvasPatchChange(*this, group, // 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, displaytext,
height, height,
x, 1.0, x, 1.0,
instrument_info(), instrument_info(),
patch, patch));
active_channel));
if (patch_change->width() < _pixel_width) { if (patch_change->item().width() < _pixel_width) {
// Show unless patch change is beyond the region bounds // Show unless patch change is beyond the region bounds
if (region_frames < 0 || region_frames >= _region->length()) { if (region_frames < 0 || region_frames >= _region->length()) {
patch_change->hide(); patch_change->hide();
@ -1981,7 +1990,7 @@ MidiRegionView::next_patch (PatchChange& patch)
} }
void void
MidiRegionView::next_bank (CanvasPatchChange& patch) MidiRegionView::next_bank (PatchChange& patch)
{ {
if (patch.patch()->program() < 127) { if (patch.patch()->program() < 127) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch()); MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@ -1993,7 +2002,7 @@ MidiRegionView::next_bank (CanvasPatchChange& patch)
} }
void void
MidiRegionView::previous_bank (CanvasPatchChange& patch) MidiRegionView::previous_bank (PatchChange& patch)
{ {
if (patch.patch()->program() > 0) { if (patch.patch()->program() > 0) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch()); MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@ -2271,14 +2280,14 @@ MidiRegionView::note_deselected(NoteBase* ev)
} }
void 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 // TODO: Make this faster by storing the last updated selection rect, and only
// adjusting things that are in the area that appears/disappeared. // 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. // 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) { 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 // Rectangles intersect
if (!(*i)->selected()) { if (!(*i)->selected()) {
add_to_selection (*i); add_to_selection (*i);
@ -2531,7 +2540,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
_resize_data.clear(); _resize_data.clear();
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { 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 // only insert CanvasNotes into the map
if (note) { if (note) {
@ -2539,7 +2548,8 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
resize_data->note = note; resize_data->note = note;
// create a new SimpleRect from the note which will be the resize preview // 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 // calculate the colors: get the color settings
uint32_t fill_color = UINT_RGBA_CHANGE_A( uint32_t fill_color = UINT_RGBA_CHANGE_A(
@ -2551,7 +2561,7 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
// calculate color based on note velocity // calculate color based on note velocity
resize_rect->set_fill_color (UINT_INTERPOLATE( 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, fill_color,
0.85)); 0.85));
@ -2579,19 +2589,19 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
bool cursor_set = false; bool cursor_set = false;
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) { 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; Note* canvas_note = (*i)->note;
double current_x; double current_x;
if (at_front) { if (at_front) {
if (relative) { if (relative) {
current_x = note->x0() + delta_x; current_x = canvas_note->x0() + delta_x;
} else { } else {
current_x = primary->x0() + delta_x; current_x = primary->x0() + delta_x;
} }
} else { } else {
if (relative) { if (relative) {
current_x = note->x1() + delta_x; current_x = canvas_note->x1() + delta_x;
} else { } else {
current_x = primary->x1() + delta_x; 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) { for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
Note* canvas_note = (*i)->note; 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 /* Get the new x position for this resize, which is in pixels relative
* to the region position. * to the region position.
@ -2659,13 +2669,13 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
if (at_front) { if (at_front) {
if (relative) { if (relative) {
current_x = note->x0() + delta_x; current_x = canvas_note->x0() + delta_x;
} else { } else {
current_x = primary->x0() + delta_x; current_x = primary->x0() + delta_x;
} }
} else { } else {
if (relative) { if (relative) {
current_x = note->x1() + delta_x; current_x = canvas_note->x1() + delta_x;
} else { } else {
current_x = primary->x1() + delta_x; current_x = primary->x1() + delta_x;
} }
@ -2822,7 +2832,7 @@ MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evo
} }
void 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; uint8_t new_channel;
@ -3132,7 +3142,7 @@ MidiRegionView::patch_entered (PatchChange* p)
<< _("Program ") << ((int) p->patch()->program()) + MIDI_BP_ZERO << '\n' << _("Program ") << ((int) p->patch()->program()) + MIDI_BP_ZERO << '\n'
<< _("Channel ") << ((int) p->patch()->channel() + 1); << _("Channel ") << ((int) p->patch()->channel() + 1);
show_verbose_cursor (s.str(), 10, 20); show_verbose_cursor (s.str(), 10, 20);
p->grab_focus(); p->item().grab_focus();
} }
void void
@ -3145,16 +3155,18 @@ MidiRegionView::patch_left (PatchChange *)
} }
void void
MidiRegionView::sysex_entered (ArdourCanvas::CanvasSysEx* p) MidiRegionView::sysex_entered (SysEx* p)
{ {
ostringstream s; ostringstream s;
s << p->text(); // CAIROCANVAS
show_verbose_cursor (s.str(), 10, 20); // need a way to extract text from p->_flag->_text
p->grab_focus(); // s << p->text();
// show_verbose_cursor (s.str(), 10, 20);
p->item().grab_focus();
} }
void void
MidiRegionView::sysex_left (ArdourCanvas::CanvasSysEx *) MidiRegionView::sysex_left (SysEx *)
{ {
trackview.editor().verbose_cursor()->hide (); trackview.editor().verbose_cursor()->hide ();
/* focus will transfer back via the enter-notify event sent to this /* 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 { struct EventNoteTimeEarlyFirstComparator {
bool operator() (CanvasNoteEvent* a, CanvasNoteEvent* b) { bool operator() (NoteBase* a, NoteBase* b) {
return a->note()->time() < b->note()->time(); return a->note()->time() < b->note()->time();
} }
}; };
@ -3606,7 +3618,7 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos)
if (_step_edit_cursor == 0) { if (_step_edit_cursor == 0) {
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group(); 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_y0 (0);
_step_edit_cursor->set_y1 (midi_stream_view()->contents_height()); _step_edit_cursor->set_y1 (midi_stream_view()->contents_height());
_step_edit_cursor->set_fill_color (RGBA_TO_UINT (45,0,0,90)); _step_edit_cursor->set_fill_color (RGBA_TO_UINT (45,0,0,90));
@ -3760,14 +3772,16 @@ MidiRegionView::edit_patch_change (PatchChange* pc)
} }
void void
MidiRegionView::delete_sysex (CanvasSysEx* sysex) MidiRegionView::delete_sysex (SysEx* /*sysex*/)
{ {
MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex")); // CAIROCANVAS
c->remove (sysex->sysex()); // sysyex object doesn't have a pointer to a sysex event
_model->apply_command (*trackview.session(), c); // MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
// c->remove (sysex->sysex());
// _model->apply_command (*trackview.session(), c);
_sys_exes.clear (); //_sys_exes.clear ();
display_sysexes(); // display_sysexes();
} }
void 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 */ /* Flip the cursor above the mouse pointer if it would overlap the bottom of the canvas */
double x1, y1, x2, y2; ArdourCanvas::Rect bb = trackview.editor().verbose_cursor()->item().bounding_box().get();
trackview.editor().verbose_cursor()->canvas_item()->get_bounds (x1, y1, x2, y2);
if ((wy + y2 - y1) > trackview.editor().canvas_height()) { if ((wy + bb.y1 - bb.y0) > trackview.editor().visible_canvas_height()) {
wy -= (y2 - y1) + 2 * yoffset; wy -= (bb.y1 - bb.y0) + 2 * yoffset;
} }
trackview.editor().verbose_cursor()->set (text, wx, wy); trackview.editor().verbose_cursor()->set (text, wx, wy);

View file

@ -59,6 +59,7 @@ class MidiCutBuffer;
class MidiListEditor; class MidiListEditor;
class EditNoteDialog; class EditNoteDialog;
class NotePlayer; class NotePlayer;
class PatchChange;
class MidiRegionView : public RegionView class MidiRegionView : public RegionView
{ {
@ -139,7 +140,7 @@ public:
void delete_patch_change (PatchChange *); void delete_patch_change (PatchChange *);
void edit_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. /** 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 display_model(boost::shared_ptr<ARDOUR::MidiModel> model);
void start_note_diff_command (std::string name = "midi edit"); 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 (NoteBase* 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, Evoral::MusicalTime val);
void note_diff_add_note (const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity = false); 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 apply_diff (bool as_subcommand = false);
void abort_command(); void abort_command();
void note_entered(ArdourCanvas::CanvasNoteEvent* ev); void note_entered(NoteBase* ev);
void note_left(ArdourCanvas::CanvasNoteEvent* ev); void note_left(NoteBase* ev);
void patch_entered (PatchChange *); void patch_entered (PatchChange *);
void patch_left (PatchChange *); void patch_left (PatchChange *);
void sysex_entered (ArdourCanvas::CanvasSysEx* p); void sysex_entered (SysEx* p);
void sysex_left (ArdourCanvas::CanvasSysEx* p); void sysex_left (SysEx* p);
void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true); void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
void unique_select(ArdourCanvas::CanvasNoteEvent* ev); void unique_select(NoteBase* ev);
void note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool extend=false); void note_selected(NoteBase* ev, bool add, bool extend=false);
void note_deselected(ArdourCanvas::CanvasNoteEvent* ev); void note_deselected(NoteBase* ev);
void delete_selection(); void delete_selection();
void delete_note (boost::shared_ptr<NoteType>); void delete_note (boost::shared_ptr<NoteType>);
size_t selection_size() { return _selection.size(); } size_t selection_size() { return _selection.size(); }
@ -193,7 +194,7 @@ public:
void invert_selection (); void invert_selection ();
void move_selection(double dx, double dy, double cumulative_dy); 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 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); void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
@ -215,8 +216,8 @@ public:
*/ */
void begin_resizing(bool at_front); void begin_resizing(bool at_front);
void update_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool); void update_resizing (NoteBase*, bool, double, bool);
void commit_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool); void commit_resizing (NoteBase*, bool, double, bool);
void abort_resizing (); void abort_resizing ();
/** Change the channel of the selection. /** Change the channel of the selection.
@ -283,7 +284,7 @@ public:
void show_list_editor (); void show_list_editor ();
typedef std::set<ArdourCanvas::CanvasNoteEvent*> Selection; typedef std::set<NoteBase*> Selection;
Selection selection () const { Selection selection () const {
return _selection; return _selection;
} }
@ -292,8 +293,8 @@ public:
void enable_display (bool); void enable_display (bool);
void set_channel_selector_scoped_note(ArdourCanvas::CanvasNoteEvent* note){ _channel_selection_scoped_note = note; } void set_channel_selector_scoped_note(NoteBase* note){ _channel_selection_scoped_note = note; }
ArdourCanvas::CanvasNoteEvent* channel_selector_scoped_note(){ return _channel_selection_scoped_note; } NoteBase* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
void trim_front_starting (); void trim_front_starting ();
void trim_front_ending (); void trim_front_ending ();
@ -356,20 +357,20 @@ private:
void instrument_settings_changed (); void instrument_settings_changed ();
PBD::ScopedConnection _instrument_changed_connection; PBD::ScopedConnection _instrument_changed_connection;
void change_note_channel (ArdourCanvas::CanvasNoteEvent *, int8_t, bool relative=false); void change_note_channel (NoteBase *, int8_t, bool relative=false);
void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false); void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
void change_note_note(ArdourCanvas::CanvasNoteEvent* ev, int8_t note, bool relative=false); void change_note_note(NoteBase* ev, int8_t note, bool relative=false);
void change_note_time(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType, bool relative=false); void change_note_time(NoteBase* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
void change_note_length (ArdourCanvas::CanvasNoteEvent *, ARDOUR::MidiModel::TimeType); void change_note_length (NoteBase *, ARDOUR::MidiModel::TimeType);
void trim_note(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType start_delta, void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_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_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 update_vertical_drag_selection (double last_y, double y, bool extend);
void add_to_selection (ArdourCanvas::CanvasNoteEvent*); void add_to_selection (NoteBase*);
void remove_from_selection (ArdourCanvas::CanvasNoteEvent*); void remove_from_selection (NoteBase*);
void show_verbose_cursor (std::string const &, double, double) const; void show_verbose_cursor (std::string const &, double, double) const;
void show_verbose_cursor (boost::shared_ptr<NoteType>) const; void show_verbose_cursor (boost::shared_ptr<NoteType>) const;
@ -377,24 +378,24 @@ private:
uint8_t _current_range_min; uint8_t _current_range_min;
uint8_t _current_range_max; 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<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; boost::shared_ptr<ARDOUR::MidiModel> _model;
Events _events; Events _events;
PatchChanges _patch_changes; PatchChanges _patch_changes;
SysExes _sys_exes; SysExes _sys_exes;
ArdourCanvas::CanvasNote** _active_notes; Note** _active_notes;
ArdourCanvas::Group* _note_group; ArdourCanvas::Group* _note_group;
ARDOUR::MidiModel::NoteDiffCommand* _note_diff_command; ARDOUR::MidiModel::NoteDiffCommand* _note_diff_command;
ArdourCanvas::CanvasNote* _ghost_note; Note* _ghost_note;
double _last_ghost_x; double _last_ghost_x;
double _last_ghost_y; double _last_ghost_y;
ArdourCanvas::Rectangle* _step_edit_cursor; ArdourCanvas::Rectangle* _step_edit_cursor;
Evoral::MusicalTime _step_edit_cursor_width; Evoral::MusicalTime _step_edit_cursor_width;
Evoral::MusicalTime _step_edit_cursor_position; 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 /** A group used to temporarily reparent _note_group to during start trims, so
@ -405,7 +406,7 @@ private:
MouseState _mouse_state; MouseState _mouse_state;
int _pressed_button; int _pressed_button;
/** Currently selected CanvasNoteEvents */ /** Currently selected NoteBase objects */
Selection _selection; Selection _selection;
bool _sort_needed; bool _sort_needed;

View file

@ -76,7 +76,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
*/ */
_note_lines = new ArdourCanvas::LineSet (_canvas_group); _note_lines = new ArdourCanvas::LineSet (_canvas_group);
_note_lines->Event().connect( _note_lines->Event.connect(
sigc::bind(sigc::mem_fun(_trackview.editor(), sigc::bind(sigc::mem_fun(_trackview.editor(),
&PublicEditor::canvas_stream_view_event), &PublicEditor::canvas_stream_view_event),
_note_lines, &_trackview)); _note_lines, &_trackview));

View file

@ -1034,7 +1034,7 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo
if (_channel_selector) { if (_channel_selector) {
if (mode == ChannelColors) { if (mode == ChannelColors) {
_channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors); _channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
} else { } else {
_channel_selector->set_default_channel_color(); _channel_selector->set_default_channel_color();
} }

View file

@ -19,6 +19,8 @@
#include <iostream> #include <iostream>
#include <boost/algorithm/string.hpp>
#include <glibmm/regex.h> #include <glibmm/regex.h>
#include "gtkmm2ext/keyboard.h" #include "gtkmm2ext/keyboard.h"
@ -41,12 +43,10 @@ PatchChange::PatchChange(
double height, double height,
double x, double x,
double y, double y,
string& model_name, ARDOUR::InstrumentInfo& info,
string& custom_device_mode,
ARDOUR::MidiModel::PatchChangePtr patch) ARDOUR::MidiModel::PatchChangePtr patch)
: _region (region) : _region (region)
, _model_name(model_name) , _info (info)
, _custom_device_mode(custom_device_mode)
, _patch (patch) , _patch (patch)
, _popup_initialized(false) , _popup_initialized(false)
{ {
@ -69,9 +69,9 @@ PatchChange::~PatchChange()
void void
PatchChange::initialize_popup_menus() PatchChange::initialize_popup_menus()
{ {
boost::shared_ptr<ChannelNameSet> channel_name_set = using namespace MIDI::Name;
MidiPatchManager::instance()
.find_channel_name_set(_model_name, _custom_device_mode, _patch->channel()); boost::shared_ptr<ChannelNameSet> channel_name_set = _info.get_patches (_patch->channel());
if (!channel_name_set) { if (!channel_name_set) {
return; return;
@ -79,6 +79,8 @@ PatchChange::initialize_popup_menus()
const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks(); const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks();
if (patch_banks.size() > 1) {
// fill popup menu: // fill popup menu:
Gtk::Menu::MenuList& patch_bank_menus = _popup.items(); Gtk::Menu::MenuList& patch_bank_menus = _popup.items();
@ -90,10 +92,10 @@ PatchChange::initialize_popup_menus()
Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu()); Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu());
const PatchBank::PatchNameList& patches = (*bank)->patch_name_list(); const PatchNameList& patches = (*bank)->patch_name_list();
Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items(); Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items();
for (PatchBank::PatchNameList::const_iterator patch = patches.begin(); for (PatchNameList::const_iterator patch = patches.begin();
patch != patches.end(); patch != patches.end();
++patch) { ++patch) {
std::string name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement); std::string name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement);
@ -114,6 +116,26 @@ PatchChange::initialize_popup_menus()
name, name,
patch_bank_menu) ); patch_bank_menu) );
} }
} else {
/* only one patch bank, so make it the initial 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())));
}
}
} }
void void

View file

@ -40,15 +40,12 @@ public:
double height, double height,
double x, double x,
double y, double y,
string& model_name, ARDOUR::InstrumentInfo& info,
string& custom_device_mode,
ARDOUR::MidiModel::PatchChangePtr patch ARDOUR::MidiModel::PatchChangePtr patch
); );
~PatchChange(); ~PatchChange();
string model_name () const { return _model_name; }
string custom_device_mode () const { return _custom_device_mode; }
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; } ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
void initialize_popup_menus(); void initialize_popup_menus();
@ -64,12 +61,13 @@ public:
void hide (); void hide ();
void show (); void show ();
ArdourCanvas::Item& item() const { return *_flag; }
private: private:
bool event_handler (GdkEvent *); bool event_handler (GdkEvent *);
MidiRegionView& _region; MidiRegionView& _region;
string _model_name; ARDOUR::InstrumentInfo& _info;
string _custom_device_mode;
ARDOUR::MidiModel::PatchChangePtr _patch; ARDOUR::MidiModel::PatchChangePtr _patch;
Gtk::Menu _popup; Gtk::Menu _popup;
bool _popup_initialized; bool _popup_initialized;

View file

@ -270,7 +270,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void show_window () = 0; virtual void show_window () = 0;
virtual framepos_t leftmost_position() const = 0; virtual framepos_t leftmost_position() const = 0;
virtual framecnt_t current_page_frames() 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 temporal_zoom_step (bool coarser) = 0;
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0; virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
virtual void scroll_tracks_down_line () = 0; virtual void scroll_tracks_down_line () = 0;

View file

@ -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()); _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 (); 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) { 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); _silent_frames.push_back (cr);
/* coordinates for the rect are relative to the regionview origin */ /* 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 = new ArdourCanvas::Text (group);
_silence_text->set_ignore_events (true); _silence_text->set_ignore_events (true);
_silence_text->set_font_description() = get_font_for_style (N_("SilenceText")); _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_color (ARDOUR_UI::config()->canvasvar_SilenceText.get());
/* both positions are relative to the region start offset in source */ /* 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); text += string_compose (_("\n (shortest audible segment = %1 %2)"), ma, aunits);
} }
_silence_text->set_text (text.c_str ()); _silence_text->set (text);
} }
void void
@ -634,10 +635,10 @@ RegionView::region_sync_changed ()
/* points set below */ /* points set below */
sync_mark = new ArdourCanvas::Polygon (group); 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 = 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); sync_line->set_outline_width (1);
} }
@ -800,7 +801,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* finish off any old rect, if required */ /* finish off any old rect, if required */
if (cr && me != new_me) { 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 */ /* start off any new rect, if required */

View file

@ -609,7 +609,7 @@ StreamView::update_contents_height ()
case Expanded: case Expanded:
/* In stacked displays, the recregion is always at the top */ /* In stacked displays, the recregion is always at the top */
i->rectangle->set_y0 (0); i->rectangle->set_y0 (0);
i->rectangle->set_y1 (h) i->rectangle->set_y1 (h);
break; break;
} }
} }

View file

@ -80,8 +80,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator i; ARDOUR::TempoMap::BBTPointList::const_iterator i;
ArdourCanvas::Line *line = 0; ArdourCanvas::Line *line = 0;
gdouble xpos; gdouble xpos;
double who_cares; double beat_density;
double x1, x2, y1, beat_density;
uint32_t beats = 0; uint32_t beats = 0;
uint32_t bars = 0; uint32_t bars = 0;
@ -216,7 +215,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
//cout << "*** CREATING LINE" << endl; //cout << "*** CREATING LINE" << endl;
/* if we already have a line there ... don't sweat it */ /* if we already have a line there ... don't sweat it */
if (_lines.find (xpos) == _lines.end()) { if (_lines.find (xpos) == _lines.end()) {
line = new ArdourCanvas::Line (*_group); line = new ArdourCanvas::Line (_group);
line->set_x0 (xpos); line->set_x0 (xpos);
line->set_x1 (xpos); line->set_x1 (xpos);
line->set_y0 (0.0); line->set_y0 (0.0);

View file

@ -35,7 +35,6 @@
#include "ardour/filesystem_paths.h" #include "ardour/filesystem_paths.h"
#include "ardour_button.h" #include "ardour_button.h"
#include "canvas-waveview.h"
#include "theme_manager.h" #include "theme_manager.h"
#include "rgb_macros.h" #include "rgb_macros.h"
#include "ardour_ui.h" #include "ardour_ui.h"
@ -248,6 +247,8 @@ ThemeManager::on_flat_buttons_toggled ()
void void
ThemeManager::on_gradient_waveforms_toggled () ThemeManager::on_gradient_waveforms_toggled ()
{ {
// CAIROCANVAS
#if 0
ARDOUR_UI::config()->gradient_waveforms.set (gradient_waveforms.get_active()); ARDOUR_UI::config()->gradient_waveforms.set (gradient_waveforms.get_active());
ARDOUR_UI::config()->set_dirty (); ARDOUR_UI::config()->set_dirty ();
@ -255,6 +256,7 @@ ThemeManager::on_gradient_waveforms_toggled ()
/* force a redraw */ /* force a redraw */
gtk_rc_reset_styles (gtk_settings_get_default()); gtk_rc_reset_styles (gtk_settings_get_default());
#endif
} }
void void

View file

@ -289,7 +289,7 @@ TimeAxisView::clip_to_viewport ()
{ {
if (marked_for_display()) { if (marked_for_display()) {
if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () || 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_background->hide ();
_canvas_display->hide (); _canvas_display->hide ();
return; return;
@ -967,21 +967,21 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect = new SelectionRect; 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_outline_what (0);
rect->rect->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectionRect.get()); 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->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); rect->end_trim->set_outline_what (0);
free_selection_rects.push_front (rect); 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->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->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->end_trim->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
} }
rect = free_selection_rects.front(); rect = free_selection_rects.front();

View file

@ -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) 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; item_name = it_name;
frame_per_pixel = fpp; frames_per_pixel = fpp;
frame_position = start; frame_position = start;
item_duration = duration; item_duration = duration;
name_connected = false; 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()); vestigial_frame->set_fill_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
if (visibility & ShowFrame) { 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); frame->set_outline_what (0xF);
if (_recregion) { 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->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 { } else {
frame = 0; frame = 0;
@ -522,7 +525,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
last_item_width = trackview.editor().frame_to_pixel(item_duration); last_item_width = trackview.editor().frame_to_pixel(item_duration);
name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2; 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")));
} }

View file

@ -41,9 +41,11 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0) , _xoffset (0)
, _yoffset (0) , _yoffset (0)
{ {
_canvas_item = new ArdourCanvas::Text (*_editor->track_canvas->root()); _canvas_item = new ArdourCanvas::Text (_editor->_track_canvas->root());
_canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor")); _canvas_item->set_ignore_events (true);
_canvas_item->property_anchor() = Gtk::ANCHOR_NW; _canvas_item->set_font_description (get_font_for_style (N_("VerboseCanvasCursor")));
// CAIROCANVAS
// _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
} }
ArdourCanvas::Item * ArdourCanvas::Item *
@ -62,7 +64,7 @@ VerboseCursor::set (string const & text, double x, double y)
void void
VerboseCursor::set_text (string const & text) 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 /** @param xoffset x offset to be applied on top of any set_position() call
@ -94,22 +96,14 @@ VerboseCursor::hide ()
double double
VerboseCursor::clamp_x (double x) VerboseCursor::clamp_x (double x)
{ {
if (x < 0) { _editor->clamp_verbose_cursor_x (x);
x = 0;
} else {
x = min (_editor->_canvas_width - 200.0, x);
}
return x; return x;
} }
double double
VerboseCursor::clamp_y (double y) VerboseCursor::clamp_y (double y)
{ {
if (y < _editor->canvas_timebars_vsize) { _editor->clamp_verbose_cursor_y (y);
y = _editor->canvas_timebars_vsize;
} else {
y = min (_editor->_canvas_height - 50, y);
}
return y; return y;
} }
@ -254,7 +248,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double
void void
VerboseCursor::set_color (uint32_t color) 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 /** Set the position of the verbose cursor. Any x/y offsets

View file

@ -19,7 +19,7 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "canvas/text.h" #include "canvas/text.h"
#include "canvas.h" #include "canvas/canvas.h"
class Editor; class Editor;
@ -42,12 +42,14 @@ public:
void show (double xoffset = 0, double yoffset = 0); void show (double xoffset = 0, double yoffset = 0);
void hide (); void hide ();
ArdourCanvas::Item& item() { return *_canvas_item; }
private: private:
double clamp_x (double); double clamp_x (double);
double clamp_y (double); double clamp_y (double);
Editor* _editor; Editor* _editor;
ArdourCanvas::NoEventText* _canvas_item; ArdourCanvas::Text* _canvas_item;
bool _visible; bool _visible;
double _xoffset; double _xoffset;
double _yoffset; double _yoffset;

View file

@ -151,6 +151,7 @@ gtk2_ardour_sources = [
'new_plugin_preset_dialog.cc', 'new_plugin_preset_dialog.cc',
'normalize_dialog.cc', 'normalize_dialog.cc',
'note.cc', 'note.cc',
'note_base.cc',
'note_player.cc', 'note_player.cc',
'nsm.cc', 'nsm.cc',
'nsmclient.cc', 'nsmclient.cc',

View file

@ -79,6 +79,8 @@ public:
} }
boost::optional<Rect> bounding_box () const; boost::optional<Rect> bounding_box () const;
Coord height() const;
Coord width() const;
Duple item_to_parent (Duple const &) const; Duple item_to_parent (Duple const &) const;
Rect item_to_parent (Rect const &) const; Rect item_to_parent (Rect const &) const;
@ -118,7 +120,9 @@ public:
void set_data (std::string const &, void *); void set_data (std::string const &, void *);
void* get_data (std::string const &) const; 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> template <class T>
struct EventAccumulator { 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 #ifdef CANVAS_DEBUG
std::string name; std::string name;

View file

@ -1,3 +1,6 @@
#ifndef __ardour_canvas_text_h__
#define __ardour_canvas_text_h__
#include <pangomm/fontdescription.h> #include <pangomm/fontdescription.h>
#include <pangomm/layout.h> #include <pangomm/layout.h>
@ -9,6 +12,7 @@ class Text : public Item
{ {
public: public:
Text (Group *); Text (Group *);
~Text();
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const; void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const; void compute_bounding_box () const;
@ -17,7 +21,7 @@ public:
void set (std::string const &); void set (std::string const &);
void set_color (uint32_t); void set_color (uint32_t);
void set_font_description (Pango::FontDescription *); void set_font_description (Pango::FontDescription);
void set_alignment (Pango::Alignment); void set_alignment (Pango::Alignment);
private: private:
@ -30,3 +34,5 @@ private:
}; };
} }
#endif /* __ardour_canvas_text_h__ */

View file

@ -12,11 +12,10 @@ namespace ArdourCanvas
typedef double Coord; typedef double Coord;
typedef double Distance; typedef double Distance;
typedef uint32_t Color; typedef uint32_t Color;
extern Coord const COORD_MAX; extern Coord const COORD_MAX;
extern Coord const CAIRO_MAX; extern Coord const CAIRO_MAX;
extern Coord safe_add (Coord, Coord);
struct Duple struct Duple
{ {
Duple () Duple ()

View file

@ -1,6 +1,11 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "pbd/properties.h" #include "pbd/properties.h"
#include "ardour/types.h" #include "ardour/types.h"
#include <glibmm/refptr.h>
#include "canvas/item.h" #include "canvas/item.h"
#include "canvas/fill.h" #include "canvas/fill.h"
#include "canvas/outline.h" #include "canvas/outline.h"
@ -9,6 +14,10 @@ namespace ARDOUR {
class AudioRegion; class AudioRegion;
} }
namespace Gdk {
class Pixbuf;
}
class WaveViewTest; class WaveViewTest;
namespace ArdourCanvas { namespace ArdourCanvas {

View file

@ -192,6 +192,7 @@ void
Group::add_items_at_point (Duple const point, vector<Item const *>& items) const Group::add_items_at_point (Duple const point, vector<Item const *>& items) const
{ {
boost::optional<Rect> const bbox = bounding_box (); boost::optional<Rect> const bbox = bounding_box ();
if (!bbox || !bbox.get().contains (point)) { if (!bbox || !bbox.get().contains (point)) {
return; return;
} }

View file

@ -192,6 +192,20 @@ Item::bounding_box () const
return _bounding_box; 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 */ /* XXX may be called even if bbox is not changing ... bit grotty */
void void
Item::begin_change () Item::begin_change ()

View file

@ -16,6 +16,11 @@ Text::Text (Group* parent)
} }
Text::~Text ()
{
delete _font_description;
}
void void
Text::set (string const & text) Text::set (string const & text)
{ {
@ -97,11 +102,11 @@ Text::set_alignment (Pango::Alignment alignment)
} }
void void
Text::set_font_description (Pango::FontDescription* font_description) Text::set_font_description (Pango::FontDescription font_description)
{ {
begin_change (); begin_change ();
_font_description = font_description; _font_description = new Pango::FontDescription (font_description);
_bounding_box_dirty = true; _bounding_box_dirty = true;
end_change (); end_change ();

View file

@ -10,10 +10,10 @@ Coord const ArdourCanvas::COORD_MAX = DBL_MAX;
/* XXX: empirically arrived at */ /* XXX: empirically arrived at */
Coord const ArdourCanvas::CAIRO_MAX = 65536; Coord const ArdourCanvas::CAIRO_MAX = 65536;
Coord static inline Coord
ArdourCanvas::safe_add (Coord a, Coord b) 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; return COORD_MAX;
} }