display active peak-builds
[ardour.git] / gtk2_ardour / editor_tempodisplay.cc
index b997d3bb5d94714ece8beb2b89007162f5c4880a..dea576a16c0c25954a82c2ca3d77695b55ba03a5 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "canvas/canvas.h"
 #include "canvas/item.h"
+#include "canvas/line_set.h"
 
 #include "editor.h"
 #include "marker.h"
@@ -49,7 +50,6 @@
 #include "time_axis_view.h"
 #include "ardour_ui.h"
 #include "tempo_lines.h"
-#include "utils.h"
 
 #include "i18n.h"
 
@@ -85,15 +85,15 @@ Editor::draw_metric_marks (const Metrics& metrics)
 
                if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
                        snprintf (buf, sizeof(buf), "%g/%g", ms->divisions_per_bar(), ms->note_divisor ());
-                       metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->get_canvasvar_MeterMarker(), buf,
+                       metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->color ("meter marker"), buf,
                                                                 *(const_cast<MeterSection*>(ms))));
                } else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) {
-                       if (Config->get_allow_non_quarter_pulse()) {
+                       if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) {
                                snprintf (buf, sizeof (buf), "%.2f/%.0f", ts->beats_per_minute(), ts->note_type());
                        } else {
                                snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute());
                        }
-                       metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->get_canvasvar_TempoMarker(), buf,
+                       metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->color ("tempo marker"), buf,
                                                                 *(const_cast<TempoSection*>(ts))));
                }
 
@@ -176,10 +176,11 @@ Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
        }
 
        if (tempo_lines == 0) {
-               tempo_lines = new TempoLines (*_track_canvas, time_line_group, ArdourCanvas::COORD_MAX);
+               tempo_lines = new TempoLines (time_line_group, ArdourCanvas::LineSet::Vertical);
        }
-       
-       tempo_lines->draw (begin, end, samples_per_pixel);
+
+       const unsigned divisions = get_grid_beat_divisions(leftmost_frame);
+       tempo_lines->draw (begin, end, divisions, leftmost_frame, _session->frame_rate());
 }
 
 void
@@ -195,8 +196,6 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
        //this causes compiz to display no border.
        //tempo_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
 
-       ensure_float (tempo_dialog);
-
        switch (tempo_dialog.run()) {
        case RESPONSE_ACCEPT:
                break;
@@ -237,8 +236,6 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
        //this causes compiz to display no border..
        //meter_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
 
-       ensure_float (meter_dialog);
-
        switch (meter_dialog.run ()) {
        case RESPONSE_ACCEPT:
                break;
@@ -266,17 +263,17 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
 void
 Editor::remove_tempo_marker (ArdourCanvas::Item* item)
 {
-       Marker* marker;
+       ArdourMarker* marker;
        TempoMarker* tempo_marker;
 
-       if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+       if ((marker = reinterpret_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
                fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) {
                fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        if (tempo_marker->tempo().movable()) {
@@ -289,8 +286,6 @@ Editor::edit_meter_section (MeterSection* section)
 {
        MeterDialog meter_dialog (*section, _("done"));
 
-       ensure_float (meter_dialog);
-
        switch (meter_dialog.run()) {
        case RESPONSE_ACCEPT:
                break;
@@ -319,8 +314,6 @@ Editor::edit_tempo_section (TempoSection* section)
 {
        TempoDialog tempo_dialog (*section, _("done"));
 
-       ensure_float (tempo_dialog);
-
        switch (tempo_dialog.run ()) {
        case RESPONSE_ACCEPT:
                break;
@@ -343,41 +336,15 @@ Editor::edit_tempo_section (TempoSection* section)
 }
 
 void
-Editor::edit_tempo_marker (ArdourCanvas::Item *item)
+Editor::edit_tempo_marker (TempoMarker& tm)
 {
-       Marker* marker;
-       TempoMarker* tempo_marker;
-
-       if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
-               fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
-               /*NOTREACHED*/
-       }
-
-       if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) {
-               fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg;
-               /*NOTREACHED*/
-       }
-
-       edit_tempo_section (&tempo_marker->tempo());
+       edit_tempo_section (&tm.tempo());
 }
 
 void
-Editor::edit_meter_marker (ArdourCanvas::Item *item)
+Editor::edit_meter_marker (MeterMarker& mm)
 {
-       Marker* marker;
-       MeterMarker* meter_marker;
-
-       if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
-               fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
-               /*NOTREACHED*/
-       }
-
-       if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) {
-               fatal << _("programming error: marker for meter is not a meter marker!") << endmsg;
-               /*NOTREACHED*/
-       }
-
-       edit_meter_section (&meter_marker->meter());
+       edit_meter_section (&mm.meter());
 }
 
 gint
@@ -396,17 +363,17 @@ Editor::real_remove_tempo_marker (TempoSection *section)
 void
 Editor::remove_meter_marker (ArdourCanvas::Item* item)
 {
-       Marker* marker;
+       ArdourMarker* marker;
        MeterMarker* meter_marker;
 
-       if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+       if ((marker = reinterpret_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
                fatal << _("programming error: meter marker canvas item has no marker object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) {
                fatal << _("programming error: marker for meter is not a meter marker!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        if (meter_marker->meter().movable()) {