#include "ardour/session.h"
#include "ardour/tempo.h"
#include "ardour/profile.h"
-#include <gtkmm2ext/gtk_ui.h>
+
+#include "gtkmm2ext/gtk_ui.h"
#include "editor.h"
#include "editing.h"
switch (direction) {
case GDK_SCROLL_UP:
- temporal_zoom_step (true);
+ temporal_zoom_step (false);
handled = true;
break;
case GDK_SCROLL_DOWN:
- temporal_zoom_step (false);
+ temporal_zoom_step (true);
handled = true;
break;
return false;
}
- // jlc: grab ev->window ?
- //Gtk::Main::grab_add (*minsec_ruler);
Widget * grab_widget = 0;
if (timecode_ruler->is_realized() && ev->window == timecode_ruler->get_window()->gobj()) {
if (_session == 0) {
return;
}
- TempoMap::BBTPointList::iterator i;
+
+ TempoMap::BBTPointList::const_iterator i;
Timecode::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
_session->bbt_time (lower, lower_beat);
bbt_beat_subdivision = 32;
bbt_accent_modulo = 8;
break;
+ case SnapToBeatDiv64:
+ bbt_beat_subdivision = 64;
+ bbt_accent_modulo = 8;
+ break;
+ case SnapToBeatDiv128:
+ bbt_beat_subdivision = 128;
+ bbt_accent_modulo = 8;
+ break;
default:
bbt_beat_subdivision = 4;
break;
}
- if (current_bbt_points == 0 || current_bbt_points->empty()) {
+ if (distance (current_bbt_points_begin, current_bbt_points_end) == 0) {
return;
}
- i = current_bbt_points->end();
+ i = current_bbt_points_end;
i--;
- if ((*i).beat >= (*current_bbt_points->begin()).beat) {
- bbt_bars = (*i).bar - (*current_bbt_points->begin()).bar;
+ if ((*i).beat >= (*current_bbt_points_begin).beat) {
+ bbt_bars = (*i).bar - (*current_bbt_points_begin).bar;
} else {
- bbt_bars = (*i).bar - (*current_bbt_points->begin()).bar - 1;
+ bbt_bars = (*i).bar - (*current_bbt_points_begin).bar - 1;
}
- beats = current_bbt_points->size() - bbt_bars;
+ beats = distance (current_bbt_points_begin, current_bbt_points_end) - bbt_bars;
/* Only show the bar helper if there aren't many bars on the screen */
if ((bbt_bars < 2) || (beats < 5)) {
return 0;
}
- TempoMap::BBTPointList::iterator i;
+ TempoMap::BBTPointList::const_iterator i;
char buf[64];
gint n = 0;
bool i_am_accented = false;
bool helper_active = false;
- if (current_bbt_points == 0 || current_bbt_points->empty()) {
+ if (distance (current_bbt_points_begin, current_bbt_points_end) == 0) {
return 0;
}
switch (bbt_ruler_scale) {
case bbt_show_beats:
- beats = current_bbt_points->size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = beats + 2;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
(*marks)[0].label = g_strdup(" ");
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
+
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
- for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
- if ((*i).type != TempoMap::Beat) {
- continue;
- }
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
(*marks)[0].label = g_strdup (buf);
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else if (((*i).beat % 2 == 1)) {
case bbt_show_ticks:
- beats = current_bbt_points->size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
- if ((*i).type != TempoMap::Beat) {
- continue;
- }
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
+
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
(*marks)[0].label = g_strdup (buf);
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
next_beat.bars = (*i).bar;
next_beat.ticks = 0;
- if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
+ if ((*i).meter->divisions_per_bar() > (next_beat.beats + 1)) {
next_beat.beats += 1;
} else {
next_beat.bars += 1;
case bbt_show_ticks_detail:
- beats = current_bbt_points->size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
- if ((*i).type != TempoMap::Beat) {
- continue;
- }
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
+
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
(*marks)[0].label = g_strdup (buf);
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
- if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
+ if ((*i).meter->divisions_per_bar() > (next_beat.beats + 1)) {
next_beat.beats += 1;
} else {
next_beat.bars += 1;
case bbt_show_ticks_super_detail:
- beats = current_bbt_points->size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
- if ((*i).type != TempoMap::Beat) {
- continue;
- }
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
+
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
(*marks)[0].label = g_strdup (buf);
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
- if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
+ if ((*i).meter->divisions_per_bar() > (next_beat.beats + 1)) {
next_beat.beats += 1;
} else {
next_beat.bars += 1;
case bbt_show_64:
bbt_nmarks = (gint) (bbt_bars / 64) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
+ if ((*i).is_bar()) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
case bbt_show_16:
bbt_nmarks = (bbt_bars / 16) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
+ if ((*i).is_bar()) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
case bbt_show_4:
bbt_nmarks = (bbt_bars / 4) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; ++i) {
- if ((*i).type == TempoMap::Bar) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; ++i) {
+ if ((*i).is_bar()) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
// default:
bbt_nmarks = bbt_bars + 2;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks );
- for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
+ if ((*i).is_bar()) {
if ((*i).bar % 4 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
(*marks)[n].style = GtkCustomRulerMarkMajor;
}
gint
-Editor::metric_get_samples (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint /*maxchars*/)
+Editor::metric_get_samples (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
{
framepos_t pos;
framepos_t const ilower = (framepos_t) floor (lower);