packaging tweaks for OS X
[ardour.git] / gtk2_ardour / editor_rulers.cc
index d97debbc66f31ca99aa35122cafb0f1363c7813d..ea5622e4c963c77404e3ea0a02c725f7a5e36c88 100644 (file)
@@ -32,7 +32,8 @@
 #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"
@@ -1220,6 +1221,14 @@ Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
                 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;
@@ -1261,7 +1270,7 @@ Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
                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;
        }
 }
@@ -1316,7 +1325,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                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)) {
@@ -1353,7 +1362,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                helper_active = true;
                        } else {
 
-                               if ((*i).beat == 1) {
+                               if ((*i).is_bar()) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
                                        snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
                                } else {
@@ -1386,14 +1395,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
 
                        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;
@@ -1443,7 +1452,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                helper_active = true;
                        } else {
 
-                               if ((*i).beat == 1) {
+                               if ((*i).is_bar()) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
                                        snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
                                } else {
@@ -1476,14 +1485,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
 
                        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;
@@ -1538,7 +1547,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                  helper_active = true;
                        } else {
 
-                                 if ((*i).beat == 1) {
+                                 if ((*i).is_bar()) {
                                          (*marks)[n].style = GtkCustomRulerMarkMajor;
                                          snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
                                  } else {
@@ -1571,14 +1580,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
 
                        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;
@@ -1628,7 +1637,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                        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);
@@ -1653,7 +1662,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                        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);
@@ -1678,7 +1687,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                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);
@@ -1704,7 +1713,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                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;