#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"
ruler_items.push_back (SeparatorElem ());
break;
case RangeMarkerBarItem:
- //ruler_items.push_back (MenuElem (_("New Range")));
+ ruler_items.push_back (MenuElem (_("New range"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_range), where)));
ruler_items.push_back (MenuElem (_("Clear all ranges"), sigc::mem_fun(*this, &Editor::clear_ranges)));
ruler_items.push_back (MenuElem (_("Unhide ranges"), sigc::mem_fun(*this, &Editor::unhide_ranges)));
ruler_items.push_back (SeparatorElem ());
return;
}
+ compute_fixed_ruler_scale ();
+
ruler_metrics[ruler_metric_timecode].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_samples].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_unit;
}
(*marks)[n].label = g_strdup (buf);
(*marks)[n].position = pos;
+
Timecode::increment_minutes( timecode, _session->config.get_subframes_per_frame() );
}
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;
bbt_ruler_scale = bbt_show_ticks_detail;
}
- if ((bbt_ruler_scale == bbt_show_ticks_detail) && (lower_beat.beats == upper_beat.beats) && (upper_beat.ticks - lower_beat.ticks <= Timecode::BBT_Time::ticks_per_bar_division / 4)) {
+ if ((bbt_ruler_scale == bbt_show_ticks_detail) && (lower_beat.beats == upper_beat.beats) && (upper_beat.ticks - lower_beat.ticks <= Timecode::BBT_Time::ticks_per_beat / 4)) {
bbt_ruler_scale = bbt_show_ticks_super_detail;
}
}
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)) {
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
- skip = (uint32_t) (Timecode::BBT_Time::ticks_per_bar_division / bbt_beat_subdivision);
+ skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
pos = (*i).frame + frame_skip;
accumulated_error = frame_skip_error;
tick = skip;
- for (t = 0; (tick < Timecode::BBT_Time::ticks_per_bar_division) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
+ for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
- skip = (uint32_t) (Timecode::BBT_Time::ticks_per_bar_division / bbt_beat_subdivision);
+ skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
pos = (*i).frame + frame_skip;
accumulated_error = frame_skip_error;
tick = skip;
- for (t = 0; (tick < Timecode::BBT_Time::ticks_per_bar_division) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
+ for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
helper_active = true;
} else {
- if ((*i).beat == 1) {
+ if ((*i).is_bar()) {
(*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
frame_skip_error -= frame_skip;
- skip = (uint32_t) (Timecode::BBT_Time::ticks_per_bar_division / bbt_beat_subdivision);
+ skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
pos = (*i).frame + frame_skip;
accumulated_error = frame_skip_error;
tick = skip;
- for (t = 0; (tick < Timecode::BBT_Time::ticks_per_bar_division) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
+ for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
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).beat == 1) {
+ if ((*i).is_bar()) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
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).beat == 1) {
+ if ((*i).is_bar()) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
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).beat == 1) {
+ if ((*i).is_bar()) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
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).beat == 1) {
+ if ((*i).is_bar()) {
if ((*i).bar % 4 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
(*marks)[n].style = GtkCustomRulerMarkMajor;