From aa00dbc40e00aa43caae6bfc188a27be2f23c636 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 19 Sep 2010 15:50:22 +0000 Subject: [PATCH] Fix MIDI streamview grid. Fixes #3460. git-svn-id: svn://localhost/ardour2/branches/3.0@7806 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/lineset.cc | 41 +++++++++++++++++++++++----------- gtk2_ardour/lineset.h | 3 +-- gtk2_ardour/midi_streamview.cc | 2 +- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/gtk2_ardour/lineset.cc b/gtk2_ardour/lineset.cc index 414f29cc0a..ac7ed56714 100644 --- a/gtk2_ardour/lineset.cc +++ b/gtk2_ardour/lineset.cc @@ -108,8 +108,7 @@ LineSet::line_compare(const Line& a, const Line& b) void LineSet::print_lines() { - for (Lines::iterator it = lines.begin(); it != lines.end(); ++it) -{ + for (Lines::iterator it = lines.begin(); it != lines.end(); ++it) { cerr << " " << it->coord << " " << it->width << " " << (int)it->r << " " << (int)it->g << " " << (int)it->b << " " << (int)it->a << endl; } } @@ -323,21 +322,26 @@ LineSet::line_at(double coord) } void -LineSet::redraw_request(ArtIRect& r) -{ - get_canvas()->request_redraw(r.x0, r.y0, r.x1, r.y1); -} - -void -LineSet::redraw_request(ArtDRect& r) +LineSet::redraw_request (ArtDRect const & r) { int x0, y0, x1, y1; Canvas& cv = *get_canvas(); //cerr << "redraw request: " << r.x0 << " " << r.y0 << " " << r.x1 << " " << r.y1 << endl; - cv.w2c(r.x0, r.y0, x0, y0); - cv.w2c(r.x1, r.y1, x1, y1); + double fx0 = r.x0; + if (fx0 > INT_MAX) { + fx0 = INT_MAX; + } + + double fx1 = r.x1; + if (fx1 > INT_MAX) { + fx1 = INT_MAX; + } + + cv.w2c (fx0, r.y0, x0, y0); + cv.w2c (fx1, r.y1, x1, y1); + cv.request_redraw(x0, y0, x1, y1); } @@ -403,8 +407,19 @@ LineSet::update_bounds() item->y2 = new_b.y1; /* Update bounding box used in rendering function */ - cv.w2c(new_b.x0, new_b.y0, bbox.x0, bbox.y0); - cv.w2c(new_b.x1, new_b.y1, bbox.x1, bbox.y1); + + double fx0 = new_b.x0; + if (fx0 > INT_MAX) { + fx0 = INT_MAX; + } + + double fx1 = new_b.x1; + if (fx1 > INT_MAX) { + fx1 = INT_MAX; + } + + cv.w2c (fx0, new_b.y0, bbox.x0, bbox.y0); + cv.w2c (fx1, new_b.y1, bbox.x1, bbox.y1); /* * if the first primary axis property (x1 for Vertical, y1 for Horizontal) changed, we must redraw everything, diff --git a/gtk2_ardour/lineset.h b/gtk2_ardour/lineset.h index e4f836717f..2f9a61d039 100644 --- a/gtk2_ardour/lineset.h +++ b/gtk2_ardour/lineset.h @@ -153,8 +153,7 @@ protected: void region_needs_update(double coord1, double coord2); bool update_bounds(); void update_lines(bool need_redraw); - void redraw_request(ArtIRect&); - void redraw_request(ArtDRect&); + void redraw_request (ArtDRect const &); Lines::iterator line_at(double coord); diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index fad87ee642..0b47e1bb20 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -75,7 +75,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) _note_lines->property_x1() = 0; _note_lines->property_y1() = 0; - _note_lines->property_x2() = trackview().editor().frame_to_pixel (max_framepos); + _note_lines->property_x2() = DBL_MAX; _note_lines->property_y2() = 0; _note_lines->signal_event().connect(sigc::bind(