Various fixes and improvements to editor summary widget.
git-svn-id: svn://localhost/ardour2/branches/3.0@5179 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b2d5840efb
commit
804da56531
|
@ -277,8 +277,8 @@ Editor::Editor ()
|
|||
|
||||
snap_threshold = 5.0;
|
||||
bbt_beat_subdivision = 4;
|
||||
canvas_width = 0;
|
||||
canvas_height = 0;
|
||||
_canvas_width = 0;
|
||||
_canvas_height = 0;
|
||||
last_autoscroll_x = 0;
|
||||
last_autoscroll_y = 0;
|
||||
autoscroll_active = false;
|
||||
|
@ -510,14 +510,14 @@ Editor::Editor ()
|
|||
edit_packer.set_border_width (0);
|
||||
edit_packer.set_name ("EditorWindow");
|
||||
|
||||
edit_packer.attach (ruler_label_event_box, 0, 1, 0, 1, FILL, SHRINK, 0, 0);
|
||||
edit_packer.attach (*_summary, 1, 2, 0, 1, FILL|EXPAND, SHRINK, 0, 0);
|
||||
edit_packer.attach (ruler_label_event_box, 0, 1, 1, 2, FILL, SHRINK, 0, 0);
|
||||
|
||||
edit_packer.attach (time_button_event_box, 0, 1, 1, 2, FILL, SHRINK, 0, 0);
|
||||
edit_packer.attach (*_summary , 1, 2, 2, 3, FILL|EXPAND, SHRINK, 0, 0);
|
||||
edit_packer.attach (time_canvas_event_box, 1, 2, 0, 1, FILL|EXPAND, FILL, 0, 0);
|
||||
edit_packer.attach (time_button_event_box, 0, 1, 2, 3, FILL, SHRINK, 0, 0);
|
||||
edit_packer.attach (time_canvas_event_box, 1, 2, 1, 2, FILL|EXPAND, FILL, 0, 0);
|
||||
|
||||
edit_packer.attach (controls_layout, 0, 1, 3, 4, FILL, FILL|EXPAND, 0, 0);
|
||||
edit_packer.attach (track_canvas_event_box, 1, 2, 1, 4, FILL|EXPAND, FILL|EXPAND, 0, 0);
|
||||
edit_packer.attach (track_canvas_event_box, 1, 2, 2, 4, FILL|EXPAND, FILL|EXPAND, 0, 0);
|
||||
|
||||
edit_packer.attach (zoom_box, 0, 1, 4, 5, FILL, FILL, 0, 0);
|
||||
edit_packer.attach (edit_hscrollbar, 1, 2, 4, 5, FILL|EXPAND, FILL, 0, 0);
|
||||
|
@ -993,14 +993,14 @@ Editor::zoom_adjustment_changed ()
|
|||
return;
|
||||
}
|
||||
|
||||
double fpu = zoom_range_clock.current_duration() / canvas_width;
|
||||
double fpu = zoom_range_clock.current_duration() / _canvas_width;
|
||||
|
||||
if (fpu < 1.0) {
|
||||
fpu = 1.0;
|
||||
zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
|
||||
} else if (fpu > session->current_end_frame() / canvas_width) {
|
||||
fpu = session->current_end_frame() / canvas_width;
|
||||
zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
|
||||
zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
|
||||
} else if (fpu > session->current_end_frame() / _canvas_width) {
|
||||
fpu = session->current_end_frame() / _canvas_width;
|
||||
zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
|
||||
}
|
||||
|
||||
temporal_zoom (fpu);
|
||||
|
@ -1134,7 +1134,7 @@ Editor::map_position_change (nframes64_t frame)
|
|||
void
|
||||
Editor::center_screen (nframes64_t frame)
|
||||
{
|
||||
double page = canvas_width * frames_per_unit;
|
||||
double page = _canvas_width * frames_per_unit;
|
||||
|
||||
/* if we're off the page, then scroll.
|
||||
*/
|
||||
|
@ -1171,8 +1171,8 @@ Editor::handle_new_duration ()
|
|||
horizontal_adjustment.set_upper (new_end / frames_per_unit);
|
||||
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
|
||||
|
||||
if (horizontal_adjustment.get_value() + canvas_width > horizontal_adjustment.get_upper()) {
|
||||
horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - canvas_width);
|
||||
if (horizontal_adjustment.get_value() + _canvas_width > horizontal_adjustment.get_upper()) {
|
||||
horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - _canvas_width);
|
||||
}
|
||||
//cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
|
||||
}
|
||||
|
@ -3645,7 +3645,7 @@ Editor::clamp_verbose_cursor_x (double x)
|
|||
if (x < 0) {
|
||||
x = 0;
|
||||
} else {
|
||||
x = min (canvas_width - 200.0, x);
|
||||
x = min (_canvas_width - 200.0, x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
@ -3656,7 +3656,7 @@ Editor::clamp_verbose_cursor_y (double y)
|
|||
if (y < canvas_timebars_vsize) {
|
||||
y = canvas_timebars_vsize;
|
||||
} else {
|
||||
y = min (canvas_height - 50, y);
|
||||
y = min (_canvas_height - 50, y);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
@ -4518,6 +4518,12 @@ Editor::reset_x_origin (nframes64_t frame)
|
|||
queue_visual_change (frame);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::reset_y_origin (double y)
|
||||
{
|
||||
queue_visual_change_y (y);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::reset_zoom (double fpu)
|
||||
{
|
||||
|
@ -4662,7 +4668,7 @@ Editor::post_zoom ()
|
|||
|
||||
// convert fpu to frame count
|
||||
|
||||
nframes64_t frames = (nframes64_t) floor (frames_per_unit * canvas_width);
|
||||
nframes64_t frames = (nframes64_t) floor (frames_per_unit * _canvas_width);
|
||||
|
||||
if (frames_per_unit != zoom_range_clock.current_duration()) {
|
||||
zoom_range_clock.set (frames);
|
||||
|
@ -4734,6 +4740,17 @@ Editor::queue_visual_change (double fpu)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
Editor::queue_visual_change_y (double y)
|
||||
{
|
||||
pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::YOrigin);
|
||||
pending_visual_change.y_origin = y;
|
||||
|
||||
if (pending_visual_change.idle_handler_id < 0) {
|
||||
pending_visual_change.idle_handler_id = g_idle_add ( _idle_visual_changer, this);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Editor::_idle_visual_changer (void* arg)
|
||||
{
|
||||
|
@ -4761,7 +4778,10 @@ Editor::idle_visual_changer ()
|
|||
if (p & VisualChange::TimeOrigin) {
|
||||
horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
|
||||
}
|
||||
|
||||
if (p & VisualChange::YOrigin) {
|
||||
vertical_adjustment.set_value (pending_visual_change.y_origin);
|
||||
}
|
||||
|
||||
nframes64_t csf=0, cef=0;
|
||||
nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
|
||||
|
||||
|
@ -4788,6 +4808,9 @@ Editor::idle_visual_changer ()
|
|||
update_fixed_rulers();
|
||||
redisplay_tempo (true);
|
||||
}
|
||||
|
||||
_summary->set_bounds_dirty ();
|
||||
|
||||
//cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
|
||||
pending_visual_change.idle_handler_id = -1;
|
||||
return 0; /* this is always a one-shot call */
|
||||
|
@ -5154,7 +5177,7 @@ Editor::end_resize_line_ops ()
|
|||
need_resize_line = false;
|
||||
|
||||
if (old_resize_line_y >= 0) {
|
||||
Gdk::Rectangle r (0, old_resize_line_y, (int) canvas_width, 3);
|
||||
Gdk::Rectangle r (0, old_resize_line_y, (int) _canvas_width, 3);
|
||||
Glib::RefPtr<Gdk::Window> win = get_window();
|
||||
cerr << "Final invalidation at " << old_resize_line_y << endl;
|
||||
win->invalidate_rect (r, false);
|
||||
|
@ -5170,7 +5193,7 @@ Editor::queue_draw_resize_line (int at)
|
|||
|
||||
resize_line_y = at;
|
||||
|
||||
if (win && canvas_width) {
|
||||
if (win && _canvas_width) {
|
||||
|
||||
int controls_width = controls_layout.get_width();
|
||||
int xroot, discard;
|
||||
|
@ -5182,15 +5205,15 @@ Editor::queue_draw_resize_line (int at)
|
|||
/* redraw where it used to be */
|
||||
|
||||
|
||||
Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) canvas_width, 3);
|
||||
Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) _canvas_width, 3);
|
||||
win->invalidate_rect (r, true);
|
||||
cerr << "invalidate " << xroot << "," << old_resize_line_y - 1 << ' '
|
||||
<< controls_width + canvas_width << " x 3\n";
|
||||
<< controls_width + _canvas_width << " x 3\n";
|
||||
}
|
||||
|
||||
/* draw where it is */
|
||||
|
||||
Gdk::Rectangle r (0, at - 1, controls_width + (int) canvas_width, 3);
|
||||
Gdk::Rectangle r (0, at - 1, controls_width + (int) _canvas_width, 3);
|
||||
win->invalidate_rect (r, true);
|
||||
}
|
||||
#endif
|
||||
|
@ -5227,7 +5250,7 @@ Editor::on_expose_event (GdkEventExpose* ev)
|
|||
|
||||
lr.x = 0;
|
||||
lr.y = resize_line_y;
|
||||
lr.width = controls_width + (int) canvas_width;
|
||||
lr.width = controls_width + (int) _canvas_width;
|
||||
lr.height = 3;
|
||||
|
||||
if (gdk_rectangle_intersect (&lr, &ev->area, &intersection)) {
|
||||
|
@ -5248,11 +5271,11 @@ Editor::on_expose_event (GdkEventExpose* ev)
|
|||
gdk_draw_line (win, gc->gobj(),
|
||||
0,
|
||||
resize_line_y,
|
||||
(int) canvas_width + controls_width,
|
||||
(int) _canvas_width + controls_width,
|
||||
resize_line_y);
|
||||
#if 0
|
||||
cerr << "drew line @ " << xroot << ", " << yroot + resize_line_y
|
||||
<< " to " << xroot + (int) canvas_width + controls_width
|
||||
<< " to " << xroot + (int) _canvas_width + controls_width
|
||||
<< ", " << yroot + resize_line_y
|
||||
<< endl;
|
||||
#endif
|
||||
|
@ -5320,3 +5343,9 @@ Editor::region_view_added (RegionView *)
|
|||
{
|
||||
_summary->set_dirty ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::streamview_height_changed ()
|
||||
{
|
||||
_summary->set_dirty ();
|
||||
}
|
||||
|
|
|
@ -152,8 +152,13 @@ class Editor : public PublicEditor
|
|||
virtual bool have_idled () const { return _have_idled; }
|
||||
|
||||
nframes64_t leftmost_position() const { return leftmost_frame; }
|
||||
|
||||
nframes64_t current_page_frames() const {
|
||||
return (nframes64_t) floor (canvas_width * frames_per_unit);
|
||||
return (nframes64_t) floor (_canvas_width * frames_per_unit);
|
||||
}
|
||||
|
||||
double canvas_height () const {
|
||||
return _canvas_height;
|
||||
}
|
||||
|
||||
void cycle_snap_mode ();
|
||||
|
@ -373,6 +378,7 @@ class Editor : public PublicEditor
|
|||
void restore_editing_space();
|
||||
|
||||
void reset_x_origin (nframes64_t);
|
||||
void reset_y_origin (double);
|
||||
void reset_zoom (double);
|
||||
void reposition_and_zoom (nframes64_t, double);
|
||||
|
||||
|
@ -863,8 +869,8 @@ class Editor : public PublicEditor
|
|||
bool hscrollbar_button_release (GdkEventButton*);
|
||||
void hscrollbar_allocate (Gtk::Allocation &alloc);
|
||||
|
||||
double canvas_width;
|
||||
double canvas_height;
|
||||
double _canvas_width;
|
||||
double _canvas_height;
|
||||
double full_canvas_height;
|
||||
|
||||
bool track_canvas_map_handler (GdkEventAny*);
|
||||
|
@ -896,12 +902,14 @@ class Editor : public PublicEditor
|
|||
struct VisualChange {
|
||||
enum Type {
|
||||
TimeOrigin = 0x1,
|
||||
ZoomLevel = 0x2
|
||||
ZoomLevel = 0x2,
|
||||
YOrigin = 0x4
|
||||
};
|
||||
|
||||
Type pending;
|
||||
nframes64_t time_origin;
|
||||
double frames_per_unit;
|
||||
double y_origin;
|
||||
|
||||
int idle_handler_id;
|
||||
|
||||
|
@ -916,6 +924,7 @@ class Editor : public PublicEditor
|
|||
|
||||
void queue_visual_change (nframes64_t);
|
||||
void queue_visual_change (double);
|
||||
void queue_visual_change_y (double);
|
||||
|
||||
void end_location_changed (ARDOUR::Location*);
|
||||
|
||||
|
@ -1048,7 +1057,7 @@ class Editor : public PublicEditor
|
|||
void named_selection_display_selection_changed ();
|
||||
|
||||
/* track views */
|
||||
TrackViewList track_views;
|
||||
TrackViewList track_views;
|
||||
std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
|
||||
|
||||
static Gdk::Cursor* cross_hair_cursor;
|
||||
|
@ -2220,6 +2229,7 @@ public:
|
|||
void region_view_added (RegionView *);
|
||||
|
||||
void update_canvas_now ();
|
||||
void streamview_height_changed ();
|
||||
|
||||
friend class Drag;
|
||||
friend class RegionDrag;
|
||||
|
|
|
@ -321,10 +321,10 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
|
|||
bool
|
||||
Editor::track_canvas_size_allocated ()
|
||||
{
|
||||
bool height_changed = canvas_height != canvas_allocation.get_height();
|
||||
bool height_changed = _canvas_height != canvas_allocation.get_height();
|
||||
|
||||
canvas_width = canvas_allocation.get_width();
|
||||
canvas_height = canvas_allocation.get_height();
|
||||
_canvas_width = canvas_allocation.get_width();
|
||||
_canvas_height = canvas_allocation.get_height();
|
||||
|
||||
if (session) {
|
||||
TrackViewList::iterator i;
|
||||
|
@ -340,21 +340,21 @@ Editor::track_canvas_size_allocated ()
|
|||
|
||||
if (height_changed) {
|
||||
if (playhead_cursor) {
|
||||
playhead_cursor->set_length (canvas_height);
|
||||
playhead_cursor->set_length (_canvas_height);
|
||||
}
|
||||
|
||||
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
|
||||
(*x)->set_line_vpos (0, canvas_height);
|
||||
(*x)->set_line_vpos (0, _canvas_height);
|
||||
}
|
||||
|
||||
vertical_adjustment.set_page_size (canvas_height);
|
||||
vertical_adjustment.set_page_size (_canvas_height);
|
||||
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
|
||||
if ((vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) {
|
||||
if ((vertical_adjustment.get_value() + _canvas_height) >= vertical_adjustment.get_upper()) {
|
||||
/*
|
||||
We're increasing the size of the canvas while the bottom is visible.
|
||||
We scroll down to keep in step with the controls layout.
|
||||
*/
|
||||
vertical_adjustment.set_value (full_canvas_height - canvas_height);
|
||||
vertical_adjustment.set_value (full_canvas_height - _canvas_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ Editor::maybe_autoscroll (GdkEventMotion* event)
|
|||
if (event->y < canvas_timebars_vsize) {
|
||||
autoscroll_y = -1;
|
||||
startit = true;
|
||||
} else if (event->y > canvas_height) {
|
||||
} else if (event->y > _canvas_height) {
|
||||
autoscroll_y = 1;
|
||||
startit = true;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ Editor::autoscroll_canvas ()
|
|||
|
||||
if (autoscroll_y_distance != 0) {
|
||||
if (autoscroll_y > 0) {
|
||||
autoscroll_y_distance = (_drag->current_pointer_y() - (get_trackview_group_vertical_offset() + canvas_height)) / 3;
|
||||
autoscroll_y_distance = (_drag->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
|
||||
} else if (autoscroll_y < 0) {
|
||||
|
||||
autoscroll_y_distance = (vertical_adjustment.get_value () - _drag->current_pointer_y()) / 3;
|
||||
|
@ -651,7 +651,7 @@ Editor::autoscroll_canvas ()
|
|||
|
||||
} else if (autoscroll_y > 0) {
|
||||
|
||||
double top_of_bottom_of_canvas = full_canvas_height - canvas_height;
|
||||
double top_of_bottom_of_canvas = full_canvas_height - _canvas_height;
|
||||
|
||||
if (vertical_pos > full_canvas_height - autoscroll_y_distance) {
|
||||
new_pixel = full_canvas_height;
|
||||
|
@ -769,6 +769,10 @@ Editor::tie_vertical_scrolling ()
|
|||
/* this will do an immediate redraw */
|
||||
|
||||
controls_layout.get_vadjustment()->set_value (vertical_adjustment.get_value());
|
||||
|
||||
if (pending_visual_change.idle_handler_id < 0) {
|
||||
_summary->set_bounds_dirty ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -790,7 +794,9 @@ Editor::scroll_canvas_horizontally ()
|
|||
update_fixed_rulers ();
|
||||
redisplay_tempo (true);
|
||||
|
||||
_summary->set_bounds_dirty ();
|
||||
if (pending_visual_change.idle_handler_id < 0) {
|
||||
_summary->set_bounds_dirty ();
|
||||
}
|
||||
|
||||
#ifndef GTKOSX
|
||||
if (!autoscroll_active) {
|
||||
|
|
|
@ -2994,7 +2994,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->canvas_width) {
|
||||
if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) {
|
||||
_editor->start_canvas_autoscroll (1, 0);
|
||||
}
|
||||
|
||||
|
@ -3149,7 +3149,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->canvas_width) {
|
||||
if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) {
|
||||
_editor->start_canvas_autoscroll (1, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1188,7 +1188,7 @@ Editor::marker_selection_changed ()
|
|||
}
|
||||
|
||||
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
|
||||
(*x)->add_line (cursor_group, 0, canvas_height);
|
||||
(*x)->add_line (cursor_group, 0, _canvas_height);
|
||||
(*x)->show_line ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1416,7 +1416,7 @@ void
|
|||
Editor::scroll_backward (float pages)
|
||||
{
|
||||
nframes64_t frame;
|
||||
nframes64_t one_page = (nframes64_t) rint (canvas_width * frames_per_unit);
|
||||
nframes64_t one_page = (nframes64_t) rint (_canvas_width * frames_per_unit);
|
||||
bool was_floating;
|
||||
float prefix;
|
||||
nframes64_t cnt;
|
||||
|
@ -1444,7 +1444,7 @@ void
|
|||
Editor::scroll_forward (float pages)
|
||||
{
|
||||
nframes64_t frame;
|
||||
nframes64_t one_page = (nframes64_t) rint (canvas_width * frames_per_unit);
|
||||
nframes64_t one_page = (nframes64_t) rint (_canvas_width * frames_per_unit);
|
||||
bool was_floating;
|
||||
float prefix;
|
||||
nframes64_t cnt;
|
||||
|
@ -1483,8 +1483,8 @@ Editor::scroll_tracks_down ()
|
|||
|
||||
double vert_value = vertical_adjustment.get_value() + (cnt *
|
||||
vertical_adjustment.get_page_size());
|
||||
if (vert_value > vertical_adjustment.get_upper() - canvas_height) {
|
||||
vert_value = vertical_adjustment.get_upper() - canvas_height;
|
||||
if (vert_value > vertical_adjustment.get_upper() - _canvas_height) {
|
||||
vert_value = vertical_adjustment.get_upper() - _canvas_height;
|
||||
}
|
||||
vertical_adjustment.set_value (vert_value);
|
||||
}
|
||||
|
@ -1512,8 +1512,8 @@ Editor::scroll_tracks_down_line ()
|
|||
Gtk::Adjustment* adj = edit_vscrollbar.get_adjustment();
|
||||
double vert_value = adj->get_value() + 60;
|
||||
|
||||
if (vert_value>adj->get_upper() - canvas_height) {
|
||||
vert_value = adj->get_upper() - canvas_height;
|
||||
if (vert_value>adj->get_upper() - _canvas_height) {
|
||||
vert_value = adj->get_upper() - _canvas_height;
|
||||
}
|
||||
adj->set_value (vert_value);
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ Editor::temporal_zoom (gdouble fpu)
|
|||
|
||||
nfpu = fpu;
|
||||
|
||||
new_page_size = (nframes64_t) floor (canvas_width * nfpu);
|
||||
new_page_size = (nframes64_t) floor (_canvas_width * nfpu);
|
||||
half_page_size = new_page_size / 2;
|
||||
|
||||
switch (zoom_focus) {
|
||||
|
@ -1713,7 +1713,7 @@ Editor::temporal_zoom_region (bool both_axes)
|
|||
}
|
||||
|
||||
nframes64_t range = end - start;
|
||||
double new_fpu = (double)range / (double)canvas_width;
|
||||
double new_fpu = (double)range / (double)_canvas_width;
|
||||
nframes64_t extra_samples = (nframes64_t) floor (one_centimeter_in_pixels * new_fpu);
|
||||
|
||||
if (start > extra_samples) {
|
||||
|
@ -1739,7 +1739,7 @@ Editor::temporal_zoom_region (bool both_axes)
|
|||
temporal_zoom_by_frame (start, end, "zoom to region");
|
||||
|
||||
if (both_axes) {
|
||||
uint32_t per_track_height = (uint32_t) floor ((canvas_height - canvas_timebars_vsize - 10.0) / tracks.size());
|
||||
uint32_t per_track_height = (uint32_t) floor ((_canvas_height - canvas_timebars_vsize - 10.0) / tracks.size());
|
||||
|
||||
/* set visible track heights appropriately */
|
||||
|
||||
|
@ -1814,9 +1814,9 @@ Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string
|
|||
|
||||
nframes64_t range = end - start;
|
||||
|
||||
double new_fpu = (double)range / (double)canvas_width;
|
||||
double new_fpu = (double)range / (double)_canvas_width;
|
||||
|
||||
nframes64_t new_page = (nframes64_t) floor (canvas_width * new_fpu);
|
||||
nframes64_t new_page = (nframes64_t) floor (_canvas_width * new_fpu);
|
||||
nframes64_t middle = (nframes64_t) floor( (double)start + ((double)range / 2.0f ));
|
||||
nframes64_t new_leftmost = (nframes64_t) floor( (double)middle - ((double)new_page/2.0f));
|
||||
|
||||
|
@ -4483,14 +4483,14 @@ Editor::reset_point_selection ()
|
|||
void
|
||||
Editor::center_playhead ()
|
||||
{
|
||||
float page = canvas_width * frames_per_unit;
|
||||
float page = _canvas_width * frames_per_unit;
|
||||
center_screen_internal (playhead_cursor->current_frame, page);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::center_edit_point ()
|
||||
{
|
||||
float page = canvas_width * frames_per_unit;
|
||||
float page = _canvas_width * frames_per_unit;
|
||||
center_screen_internal (get_preferred_edit_position(), page);
|
||||
}
|
||||
|
||||
|
@ -6329,7 +6329,7 @@ Editor::fit_tracks ()
|
|||
child_heights += (*t)->effective_height() - (*t)->current_height();
|
||||
}
|
||||
|
||||
uint32_t h = (uint32_t) floor ((canvas_height - child_heights - canvas_timebars_vsize)/selection->tracks.size());
|
||||
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize)/selection->tracks.size());
|
||||
double first_y_pos = DBL_MAX;
|
||||
|
||||
if (h < TimeAxisView::hSmall) {
|
||||
|
|
|
@ -131,6 +131,7 @@ Editor::handle_new_route (RouteList& routes)
|
|||
|
||||
route->gui_changed.connect (mem_fun(*this, &Editor::handle_gui_changes));
|
||||
tv->view()->RegionViewAdded.connect (mem_fun (*this, &Editor::region_view_added));
|
||||
tv->view()->HeightChanged.connect (mem_fun (*this, &Editor::streamview_height_changed));
|
||||
|
||||
tv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), tv));
|
||||
}
|
||||
|
@ -394,12 +395,12 @@ Editor::redisplay_route_list ()
|
|||
|
||||
full_canvas_height = position + canvas_timebars_vsize;
|
||||
vertical_adjustment.set_upper (full_canvas_height);
|
||||
if ((vertical_adjustment.get_value() + canvas_height) > vertical_adjustment.get_upper()) {
|
||||
if ((vertical_adjustment.get_value() + _canvas_height) > vertical_adjustment.get_upper()) {
|
||||
/*
|
||||
We're increasing the size of the canvas while the bottom is visible.
|
||||
We scroll down to keep in step with the controls layout.
|
||||
*/
|
||||
vertical_adjustment.set_value (full_canvas_height - canvas_height);
|
||||
vertical_adjustment.set_value (full_canvas_height - _canvas_height);
|
||||
}
|
||||
|
||||
if (!route_redisplay_does_not_reset_order_keys && !route_redisplay_does_not_sync_order_keys) {
|
||||
|
|
|
@ -831,9 +831,9 @@ Editor::update_ruler_visibility ()
|
|||
vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
|
||||
full_canvas_height += vertical_pos_delta;
|
||||
|
||||
if (vertical_adjustment.get_value() != 0 && (vertical_adjustment.get_value() + canvas_height >= full_canvas_height)) {
|
||||
if (vertical_adjustment.get_value() != 0 && (vertical_adjustment.get_value() + _canvas_height >= full_canvas_height)) {
|
||||
/*if we're at the bottom of the canvas, don't move the _trackview_group*/
|
||||
vertical_adjustment.set_value (full_canvas_height - canvas_height + 1);
|
||||
vertical_adjustment.set_value (full_canvas_height - _canvas_height + 1);
|
||||
} else {
|
||||
_trackview_group->property_y () = - get_trackview_group_vertical_offset ();
|
||||
_background_group->property_y () = - get_trackview_group_vertical_offset ();
|
||||
|
@ -842,7 +842,7 @@ Editor::update_ruler_visibility ()
|
|||
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
|
||||
}
|
||||
|
||||
gdouble bottom_track_pos = vertical_adjustment.get_value() + canvas_height - canvas_timebars_vsize;
|
||||
gdouble bottom_track_pos = vertical_adjustment.get_value() + _canvas_height - canvas_timebars_vsize;
|
||||
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (bottom_track_pos);
|
||||
if (p.first) {
|
||||
p.first->clip_to_viewport ();
|
||||
|
|
|
@ -255,7 +255,7 @@ void
|
|||
Editor::get_onscreen_tracks (TrackViewList& tvl)
|
||||
{
|
||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
if ((*i)->y_position() < canvas_height) {
|
||||
if ((*i)->y_position() < _canvas_height) {
|
||||
tvl.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,10 @@ EditorSummary::EditorSummary (Editor* e)
|
|||
_regions_dirty (true),
|
||||
_width (512),
|
||||
_height (64),
|
||||
_pixels_per_frame (1)
|
||||
_pixels_per_frame (1),
|
||||
_vertical_scale (1),
|
||||
_dragging (false)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -84,23 +87,23 @@ EditorSummary::on_expose_event (GdkEventExpose* event)
|
|||
);
|
||||
}
|
||||
|
||||
/* Render the view beginning and end markers */
|
||||
/* Render the view rectangle */
|
||||
|
||||
pair<double, double> x;
|
||||
pair<double, double> y;
|
||||
editor_view (&x, &y);
|
||||
|
||||
cairo_t* cr = gdk_cairo_create (get_window()->gobj());
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 1, 0);
|
||||
cairo_set_line_width (cr, 2);
|
||||
cairo_set_source_rgba (cr, 0, 1, 0, 0.5);
|
||||
|
||||
double const s = (_editor->leftmost_position () - _session->current_start_frame ()) * _pixels_per_frame;
|
||||
cairo_move_to (cr, s, 0);
|
||||
cairo_line_to (cr, s, _height);
|
||||
cairo_move_to (cr, x.first, y.first);
|
||||
cairo_line_to (cr, x.second, y.first);
|
||||
cairo_line_to (cr, x.second, y.second);
|
||||
cairo_line_to (cr, x.first, y.second);
|
||||
cairo_line_to (cr, x.first, y.first);
|
||||
cairo_stroke (cr);
|
||||
|
||||
double const e = s + _editor->current_page_frames() * _pixels_per_frame;
|
||||
cairo_move_to (cr, e, 0);
|
||||
cairo_line_to (cr, e, _height);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return true;
|
||||
|
@ -147,36 +150,37 @@ EditorSummary::render (cairo_t* cr)
|
|||
|
||||
int N = 0;
|
||||
|
||||
/* count tracks to render */
|
||||
/* compute total height of all tracks */
|
||||
for (PublicEditor::TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) {
|
||||
if ((*i)->view()) {
|
||||
++N;
|
||||
}
|
||||
N += (*i)->effective_height ();
|
||||
}
|
||||
|
||||
nframes_t const start = _session->current_start_frame ();
|
||||
_pixels_per_frame = static_cast<double> (_width) / (_session->current_end_frame() - start);
|
||||
double const track_height = static_cast<double> (_height) / N;
|
||||
|
||||
cairo_set_line_width (cr, track_height);
|
||||
_vertical_scale = static_cast<double> (_height) / N;
|
||||
|
||||
/* render regions */
|
||||
|
||||
|
||||
int n = 0;
|
||||
double y = 0;
|
||||
for (PublicEditor::TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) {
|
||||
StreamView* s = (*i)->view ();
|
||||
if (s) {
|
||||
|
||||
if (s) {
|
||||
double const h = (*i)->effective_height () * _vertical_scale;
|
||||
cairo_set_line_width (cr, h);
|
||||
|
||||
double const v = ((n % 2) == 0) ? 1 : 0.5;
|
||||
cairo_set_source_rgb (cr, v, v, v);
|
||||
|
||||
|
||||
s->foreach_regionview (bind (
|
||||
mem_fun (*this, &EditorSummary::render_region),
|
||||
cr,
|
||||
start,
|
||||
track_height * (n + 0.5)
|
||||
y + h / 2
|
||||
));
|
||||
++n;
|
||||
y += h;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,19 +251,71 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
|
|||
{
|
||||
if (ev->button == 1) {
|
||||
|
||||
/* centre the editor view around the mouse click */
|
||||
|
||||
nframes_t f = (ev->x / _pixels_per_frame) + _session->current_start_frame();
|
||||
pair<double, double> xr;
|
||||
pair<double, double> yr;
|
||||
editor_view (&xr, &yr);
|
||||
|
||||
nframes_t const h = _editor->current_page_frames () / 2;
|
||||
if (f > h) {
|
||||
f -= h;
|
||||
if (xr.first <= ev->x && ev->x <= xr.second && yr.first <= ev->y && ev->y <= yr.second) {
|
||||
|
||||
/* click inside the view rectangle: drag it */
|
||||
_dragging = true;
|
||||
_x_offset = ev->x - xr.first;
|
||||
_y_offset = ev->y - yr.first;
|
||||
|
||||
} else {
|
||||
f = 0;
|
||||
/* click outside the view rectangle: centre the view around the mouse click */
|
||||
|
||||
nframes_t x = (ev->x / _pixels_per_frame) + _session->current_start_frame();
|
||||
nframes_t const xh = _editor->current_page_frames () / 2;
|
||||
if (x > xh) {
|
||||
x -= xh;
|
||||
} else {
|
||||
x = 0;
|
||||
}
|
||||
|
||||
_editor->reset_x_origin (x);
|
||||
|
||||
double y = ev->y / _vertical_scale;
|
||||
double const yh = _editor->canvas_height () / 2;
|
||||
if (y > yh) {
|
||||
y -= yh;
|
||||
} else {
|
||||
y = 0;
|
||||
}
|
||||
|
||||
_editor->reset_y_origin (y);
|
||||
}
|
||||
|
||||
_editor->reset_x_origin (f);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
EditorSummary::editor_view (pair<double, double>* x, pair<double, double>* y) const
|
||||
{
|
||||
x->first = (_editor->leftmost_position () - _session->current_start_frame ()) * _pixels_per_frame;
|
||||
x->second = x->first + _editor->current_page_frames() * _pixels_per_frame;
|
||||
|
||||
y->first = _editor->get_trackview_group_vertical_offset () * _vertical_scale;
|
||||
y->second = y->first + _editor->canvas_height () * _vertical_scale;
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
|
||||
{
|
||||
if (!_dragging) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_editor->reset_x_origin (((ev->x - _x_offset) / _pixels_per_frame) + _session->current_start_frame ());
|
||||
_editor->reset_y_origin ((ev->y - _y_offset) / _vertical_scale);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSummary::on_button_release_event (GdkEventButton* ev)
|
||||
{
|
||||
_dragging = false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,10 +27,13 @@ private:
|
|||
void on_size_request (Gtk::Requisition *);
|
||||
void on_size_allocate (Gtk::Allocation &);
|
||||
bool on_button_press_event (GdkEventButton *);
|
||||
bool on_button_release_event (GdkEventButton *);
|
||||
bool on_motion_notify_event (GdkEventMotion *);
|
||||
|
||||
void render (cairo_t *);
|
||||
GdkPixmap* get_pixmap (GdkDrawable *);
|
||||
void render_region (RegionView*, cairo_t*, nframes_t, double) const;
|
||||
void editor_view (std::pair<double, double> *, std::pair<double, double> *) const;
|
||||
|
||||
Editor* _editor; ///< our editor
|
||||
ARDOUR::Session* _session; ///< our session
|
||||
|
@ -39,6 +42,10 @@ private:
|
|||
int _width; ///< pixmap width
|
||||
int _height; ///< pixmap height
|
||||
double _pixels_per_frame; ///< pixels per frame for the x axis of the pixmap
|
||||
double _vertical_scale;
|
||||
bool _dragging;
|
||||
double _x_offset;
|
||||
double _y_offset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -135,6 +135,9 @@ StreamView::set_height (double h)
|
|||
height = h;
|
||||
canvas_rect->property_y2() = height;
|
||||
update_contents_height ();
|
||||
|
||||
HeightChanged ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -540,7 +543,6 @@ StreamView::child_height () const
|
|||
void
|
||||
StreamView::update_contents_height ()
|
||||
{
|
||||
|
||||
const double h = child_height ();
|
||||
|
||||
for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
|
|
|
@ -109,6 +109,7 @@ public:
|
|||
}
|
||||
|
||||
sigc::signal<void,RegionView*> RegionViewAdded;
|
||||
sigc::signal<void> HeightChanged;
|
||||
|
||||
protected:
|
||||
StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL);
|
||||
|
|
Loading…
Reference in New Issue