commit immediately post linking
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 4 Apr 2013 22:45:27 +0000 (18:45 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 4 Apr 2013 22:45:27 +0000 (18:45 -0400)
44 files changed:
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_region_view.h
gtk2_ardour/audio_streamview.cc
gtk2_ardour/automation_line.cc
gtk2_ardour/edit_note_dialog.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_audiotrack.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_cursors.h
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/editor_summary.cc
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/ghostregion.cc
gtk2_ardour/ghostregion.h
gtk2_ardour/marker.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/midi_streamview.cc
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/patch_change.cc
gtk2_ardour/patch_change.h
gtk2_ardour/public_editor.h
gtk2_ardour/region_view.cc
gtk2_ardour/streamview.cc
gtk2_ardour/tempo_lines.cc
gtk2_ardour/theme_manager.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/verbose_cursor.cc
gtk2_ardour/verbose_cursor.h
gtk2_ardour/wscript
libs/canvas/canvas/item.h
libs/canvas/canvas/text.h
libs/canvas/canvas/types.h
libs/canvas/canvas/wave_view.h
libs/canvas/group.cc
libs/canvas/item.cc
libs/canvas/text.cc
libs/canvas/types.cc

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