mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 13:16:27 +01:00
more fiddling about with placing bits of the scroll/zoom operation in the idle callback. fix some ruler bugs. overall this should be smoother.
git-svn-id: svn://localhost/ardour2/trunk@912 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3c45ab0846
commit
dc9484d144
6 changed files with 69 additions and 92 deletions
|
|
@ -882,6 +882,9 @@ Editor::reposition_x_origin (jack_nframes_t frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
horizontal_adjustment.set_value (frame/frames_per_unit);
|
horizontal_adjustment.set_value (frame/frames_per_unit);
|
||||||
|
} else {
|
||||||
|
update_fixed_rulers();
|
||||||
|
tempo_map_changed (Change (0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -963,21 +966,12 @@ Editor::deferred_control_scroll (jack_nframes_t target)
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::canvas_horizontally_scrolled ()
|
Editor::canvas_horizontally_scrolled ()
|
||||||
{
|
|
||||||
|
|
||||||
Glib::signal_idle().connect (mem_fun(*this, &Editor::lazy_canvas_horizontally_scrolled));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
Editor::lazy_canvas_horizontally_scrolled ()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
|
leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
|
||||||
|
|
||||||
update_fixed_rulers ();
|
update_fixed_rulers ();
|
||||||
tempo_map_changed (Change (0));
|
tempo_map_changed (Change (0));
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -995,7 +989,6 @@ Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu)
|
||||||
|
|
||||||
set_frames_per_unit (nfpu);
|
set_frames_per_unit (nfpu);
|
||||||
reposition_x_origin (frame);
|
reposition_x_origin (frame);
|
||||||
tempo_map_changed (Change (0));
|
|
||||||
repos_zoom_queued = false;
|
repos_zoom_queued = false;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -1291,7 +1284,7 @@ Editor::connect_to_session (Session *t)
|
||||||
horizontal_adjustment.set_value (0);
|
horizontal_adjustment.set_value (0);
|
||||||
|
|
||||||
restore_ruler_visibility ();
|
restore_ruler_visibility ();
|
||||||
tempo_map_changed (Change (0));
|
//tempo_map_changed (Change (0));
|
||||||
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
|
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
|
||||||
|
|
||||||
edit_cursor->set_position (0);
|
edit_cursor->set_position (0);
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ class Editor : public PublicEditor
|
||||||
|
|
||||||
void set_show_measures (bool yn);
|
void set_show_measures (bool yn);
|
||||||
bool show_measures () const { return _show_measures; }
|
bool show_measures () const { return _show_measures; }
|
||||||
|
bool initial_ruler_update_required;
|
||||||
|
|
||||||
#ifdef FFT_ANALYSIS
|
#ifdef FFT_ANALYSIS
|
||||||
/* analysis window */
|
/* analysis window */
|
||||||
|
|
@ -679,7 +680,6 @@ class Editor : public PublicEditor
|
||||||
|
|
||||||
void tie_vertical_scrolling ();
|
void tie_vertical_scrolling ();
|
||||||
void canvas_horizontally_scrolled ();
|
void canvas_horizontally_scrolled ();
|
||||||
bool lazy_canvas_horizontally_scrolled ();
|
|
||||||
|
|
||||||
void reposition_and_zoom (jack_nframes_t sample, double fpu);
|
void reposition_and_zoom (jack_nframes_t sample, double fpu);
|
||||||
gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
|
gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
|
||||||
|
|
@ -1191,7 +1191,8 @@ class Editor : public PublicEditor
|
||||||
ArdourCanvas::Group* time_line_group;
|
ArdourCanvas::Group* time_line_group;
|
||||||
ArdourCanvas::SimpleLine* get_time_line ();
|
ArdourCanvas::SimpleLine* get_time_line ();
|
||||||
void hide_measures ();
|
void hide_measures ();
|
||||||
bool draw_measures ();
|
void draw_measures ();
|
||||||
|
bool lazy_hide_and_draw_measures ();
|
||||||
|
|
||||||
void new_tempo_section ();
|
void new_tempo_section ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,9 @@ Editor::initialize_canvas ()
|
||||||
edit_cursor = new Cursor (*this, "blue", &Editor::canvas_edit_cursor_event);
|
edit_cursor = new Cursor (*this, "blue", &Editor::canvas_edit_cursor_event);
|
||||||
playhead_cursor = new Cursor (*this, "red", &Editor::canvas_playhead_cursor_event);
|
playhead_cursor = new Cursor (*this, "red", &Editor::canvas_playhead_cursor_event);
|
||||||
|
|
||||||
|
initial_ruler_update_required = true;
|
||||||
track_canvas.signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate));
|
track_canvas.signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -317,10 +319,15 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
|
||||||
transport_punchout_line->property_y2() = canvas_height;
|
transport_punchout_line->property_y2() = canvas_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_visible() && initial_ruler_update_required) {
|
||||||
|
/*
|
||||||
|
this is really dumb, but signal_size_allocate() gets emitted intermittently
|
||||||
|
depending on whether the canvas contents are visible or not.
|
||||||
|
we only want to do this once
|
||||||
|
*/
|
||||||
update_fixed_rulers();
|
update_fixed_rulers();
|
||||||
|
|
||||||
if (is_visible()) {
|
|
||||||
tempo_map_changed (Change (0));
|
tempo_map_changed (Change (0));
|
||||||
|
initial_ruler_update_required = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Resized (); /* EMIT_SIGNAL */
|
Resized (); /* EMIT_SIGNAL */
|
||||||
|
|
|
||||||
|
|
@ -818,9 +818,9 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
|
||||||
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
|
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
|
||||||
lower = lower - spacer;
|
lower = lower - spacer;
|
||||||
} else {
|
} else {
|
||||||
upper = upper + spacer - lower;
|
|
||||||
lower = 0;
|
lower = 0;
|
||||||
}
|
}
|
||||||
|
upper = upper + spacer;
|
||||||
range = (jack_nframes_t) floor (upper - lower);
|
range = (jack_nframes_t) floor (upper - lower);
|
||||||
|
|
||||||
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
|
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
|
||||||
|
|
@ -1110,8 +1110,8 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
|
||||||
|
|
||||||
position_of_helper = ilower + (30 * Editor::get_current_zoom ());
|
position_of_helper = ilower + (30 * Editor::get_current_zoom ());
|
||||||
|
|
||||||
if (desirable_marks >= (beats / 2)) {
|
if (desirable_marks >= (beats)) {
|
||||||
nmarks = ((beats + 4) * bbt_beat_subdivision) + 1;
|
nmarks = ((beats + 1) * bbt_beat_subdivision) + 1;
|
||||||
we_need_ticks = true;
|
we_need_ticks = true;
|
||||||
} else {
|
} else {
|
||||||
nmarks = beats + 1;
|
nmarks = beats + 1;
|
||||||
|
|
@ -1156,7 +1156,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
|
||||||
|
|
||||||
/* Add the tick marks */
|
/* Add the tick marks */
|
||||||
|
|
||||||
if (we_need_ticks) {
|
if (we_need_ticks && (*i).type != TempoMap::Bar) {
|
||||||
|
|
||||||
/* Find the next beat */
|
/* Find the next beat */
|
||||||
|
|
||||||
|
|
@ -1417,9 +1417,9 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble up
|
||||||
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
|
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
|
||||||
lower = lower - spacer;
|
lower = lower - spacer;
|
||||||
} else {
|
} else {
|
||||||
upper = upper + spacer;
|
|
||||||
lower = 0;
|
lower = 0;
|
||||||
}
|
}
|
||||||
|
upper = upper + spacer;
|
||||||
range = iupper - ilower;
|
range = iupper - ilower;
|
||||||
|
|
||||||
if (range < (fr / 50)) {
|
if (range < (fr / 50)) {
|
||||||
|
|
|
||||||
|
|
@ -100,25 +100,23 @@ Editor::tempo_map_changed (Change ignored)
|
||||||
BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
|
BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
|
||||||
|
|
||||||
session->bbt_time(leftmost_frame, previous_beat);
|
session->bbt_time(leftmost_frame, previous_beat);
|
||||||
|
session->bbt_time(leftmost_frame + current_page_frames(), next_beat);
|
||||||
|
|
||||||
previous_beat.ticks = 0;
|
|
||||||
if (previous_beat.beats > 1) {
|
if (previous_beat.beats > 1) {
|
||||||
previous_beat.beats -= 1;
|
previous_beat.beats -= 1;
|
||||||
} else if (previous_beat.bars > 1) {
|
} else if (previous_beat.bars > 1) {
|
||||||
previous_beat.bars--;
|
previous_beat.bars--;
|
||||||
previous_beat.beats += 1;
|
previous_beat.beats += 1;
|
||||||
}
|
}
|
||||||
|
previous_beat.ticks = 0;
|
||||||
session->bbt_time(leftmost_frame + current_page_frames(), next_beat);
|
|
||||||
|
|
||||||
if (session->tempo_map().meter_at(leftmost_frame + current_page_frames()).beats_per_bar () > next_beat.beats + 1) {
|
if (session->tempo_map().meter_at(leftmost_frame + current_page_frames()).beats_per_bar () > next_beat.beats + 1) {
|
||||||
next_beat.beats += 1;
|
next_beat.beats += 1;
|
||||||
next_beat.ticks = 0;
|
|
||||||
} else {
|
} else {
|
||||||
next_beat.bars += 1;
|
next_beat.bars += 1;
|
||||||
next_beat.beats = 1;
|
next_beat.beats = 1;
|
||||||
next_beat.ticks = 0;
|
|
||||||
}
|
}
|
||||||
|
next_beat.ticks = 0;
|
||||||
|
|
||||||
if (current_bbt_points) {
|
if (current_bbt_points) {
|
||||||
delete current_bbt_points;
|
delete current_bbt_points;
|
||||||
|
|
@ -127,16 +125,7 @@ Editor::tempo_map_changed (Change ignored)
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat));
|
current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat));
|
||||||
|
update_tempo_based_rulers ();
|
||||||
/*
|
|
||||||
TempoMap::BBTPointList::iterator i;
|
|
||||||
cerr << "******************" << endl << "current bbt points dump: " << endl;
|
|
||||||
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); i++) {
|
|
||||||
cerr << (*i).bar << " : " << (*i).beat << endl;
|
|
||||||
}
|
|
||||||
cerr << "******************" << endl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
current_bbt_points = 0;
|
current_bbt_points = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -148,11 +137,10 @@ void
|
||||||
Editor::redisplay_tempo ()
|
Editor::redisplay_tempo ()
|
||||||
{
|
{
|
||||||
|
|
||||||
hide_measures ();
|
|
||||||
|
|
||||||
if (session && current_bbt_points) {
|
if (session && current_bbt_points) {
|
||||||
Glib::signal_idle().connect (mem_fun (*this, &Editor::draw_measures));
|
Glib::signal_idle().connect (mem_fun (*this, &Editor::lazy_hide_and_draw_measures));
|
||||||
update_tempo_based_rulers ();
|
} else {
|
||||||
|
hide_measures ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,69 +172,61 @@ Editor::get_time_line ()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Editor::lazy_hide_and_draw_measures ()
|
||||||
|
{
|
||||||
|
hide_measures ();
|
||||||
|
draw_measures ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
Editor::draw_measures ()
|
Editor::draw_measures ()
|
||||||
{
|
{
|
||||||
if (session == 0 || _show_measures == false) {
|
if (session == 0 || _show_measures == false) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempoMap::BBTPointList::iterator i;
|
TempoMap::BBTPointList::iterator i;
|
||||||
ArdourCanvas::SimpleLine *line;
|
ArdourCanvas::SimpleLine *line;
|
||||||
gdouble xpos, last_xpos;
|
gdouble xpos;
|
||||||
uint32_t cnt;
|
double x1, x2, y1, y2, beat_density;
|
||||||
|
|
||||||
|
uint32_t beats = 0;
|
||||||
|
uint32_t bars = 0;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
|
|
||||||
if (current_bbt_points == 0 || current_bbt_points->empty()) {
|
if (current_bbt_points == 0 || current_bbt_points->empty()) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt = 0;
|
track_canvas.get_scroll_region (x1, y1, x2, y2);
|
||||||
last_xpos = 0;
|
|
||||||
|
|
||||||
/* get the first bar spacing */
|
/* get the first bar spacing */
|
||||||
|
|
||||||
gdouble last_beat = DBL_MAX;
|
i = current_bbt_points->end();
|
||||||
gdouble beat_spacing = 0;
|
i--;
|
||||||
|
bars = (*i).bar - (*current_bbt_points->begin()).bar;
|
||||||
|
beats = current_bbt_points->size() - bars;
|
||||||
|
|
||||||
for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) {
|
beat_density = (beats * 10.0f) / track_canvas.get_width ();
|
||||||
TempoMap::BBTPoint& p = (*i);
|
|
||||||
|
|
||||||
switch (p.type) {
|
if (beat_density > 2.0f) {
|
||||||
case TempoMap::Bar:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TempoMap::Beat:
|
|
||||||
xpos = frame_to_unit (p.frame);
|
|
||||||
if (last_beat < xpos) {
|
|
||||||
beat_spacing = xpos - last_beat;
|
|
||||||
}
|
|
||||||
last_beat = xpos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beat_spacing < 12.0) {
|
|
||||||
/*
|
/*
|
||||||
if the lines are too close together,
|
if the lines are too close together,
|
||||||
they become useless
|
they become useless
|
||||||
*/
|
*/
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x1, x2, y1, y2;
|
|
||||||
track_canvas.get_scroll_region (x1, y1, x2, y2);
|
|
||||||
|
|
||||||
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
|
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
|
||||||
|
|
||||||
TempoMap::BBTPoint& p = (*i);
|
switch ((*i).type) {
|
||||||
|
|
||||||
switch (p.type) {
|
|
||||||
case TempoMap::Bar:
|
case TempoMap::Bar:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TempoMap::Beat:
|
case TempoMap::Beat:
|
||||||
xpos = frame_to_unit (p.frame);
|
|
||||||
|
|
||||||
if (p.beat == 1) {
|
if ((*i).beat == 1) {
|
||||||
color = color_map[cMeasureLineBeat];
|
color = color_map[cMeasureLineBeat];
|
||||||
} else {
|
} else {
|
||||||
color = color_map[cMeasureLineBar];
|
color = color_map[cMeasureLineBar];
|
||||||
|
|
@ -255,22 +235,19 @@ Editor::draw_measures ()
|
||||||
are large.
|
are large.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (beat_spacing < 25.0) {
|
if (beat_density > 0.25) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt == 0 || xpos - last_xpos > 4.0) {
|
xpos = frame_to_unit ((*i).frame);
|
||||||
line = get_time_line ();
|
line = get_time_line ();
|
||||||
line->property_x1() = xpos;
|
line->property_x1() = xpos;
|
||||||
line->property_x2() = xpos;
|
line->property_x2() = xpos;
|
||||||
line->property_y2() = y2;
|
line->property_y2() = y2;
|
||||||
line->property_color_rgba() = color;
|
line->property_color_rgba() = color;
|
||||||
line->raise_to_top();
|
//line->raise_to_top();
|
||||||
line->show();
|
line->show();
|
||||||
last_xpos = xpos;
|
|
||||||
++cnt;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -279,7 +256,7 @@ Editor::draw_measures ()
|
||||||
|
|
||||||
cursor_group->raise_to_top();
|
cursor_group->raise_to_top();
|
||||||
time_line_group->lower_to_bottom();
|
time_line_group->lower_to_bottom();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
||||||
if (is_track()) {
|
if (is_track()) {
|
||||||
rec_enable_button->set_active (false);
|
rec_enable_button->set_active (false);
|
||||||
rec_enable_button->set_name ("TrackRecordEnableButton");
|
rec_enable_button->set_name ("TrackRecordEnableButton");
|
||||||
//rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
|
|
||||||
rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
|
rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
|
||||||
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
|
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue