add text entry cursor color to dark theme
[ardour.git] / gtk2_ardour / editor_tempodisplay.cc
index c100fbd4c729706f3e2bd8a8b83acc341f9638d4..fa7d22ec8983be55f5d311f5b266b58d4de8c689 100644 (file)
@@ -103,15 +103,28 @@ Editor::draw_metric_marks (const Metrics& metrics)
                        max_tempo = max (max_tempo, ts->beats_per_minute());
                        min_tempo = min (min_tempo, ts->beats_per_minute());
 
-                       tempo_curves.push_back (new TempoCurve (*this, *tempo_group, UIConfiguration::instance().color ("range drag rect"),
+                       tempo_curves.push_back (new TempoCurve (*this, *tempo_group, UIConfiguration::instance().color ("tempo curve"),
                                                                *(const_cast<TempoSection*>(ts)), ts->frame(), false));
-                       metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), buf,
+                       if (ts->position_lock_style() == MusicTime) {
+                               metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker music"), buf,
                                                                 *(const_cast<TempoSection*>(ts))));
+                       } else {
+                               metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), buf,
+                                                                *(const_cast<TempoSection*>(ts))));
+                       }
 
                }
 
        }
 
+       const double min_tempo_range = 5.0;
+       const double tempo_delta = fabs (max_tempo - min_tempo);
+
+       if (tempo_delta < min_tempo_range) {
+               max_tempo += min_tempo_range - tempo_delta;
+               min_tempo += tempo_delta - min_tempo_range;
+       }
+
        for (Curves::iterator x = tempo_curves.begin(); x != tempo_curves.end(); ) {
                Curves::iterator tmp = x;
                (*x)->set_max_tempo (max_tempo);
@@ -203,6 +216,14 @@ Editor::marker_position_changed ()
 
        tempo_curves.sort (CurveComparator());
 
+       const double min_tempo_range = 5.0;
+       const double tempo_delta = fabs (max_tempo - min_tempo);
+
+       if (tempo_delta < min_tempo_range) {
+               max_tempo += min_tempo_range - tempo_delta;
+               min_tempo += tempo_delta - min_tempo_range;
+       }
+
        for (Curves::iterator x = tempo_curves.begin(); x != tempo_curves.end(); ) {
                Curves::iterator tmp = x;
                (*x)->set_max_tempo (max_tempo);
@@ -300,7 +321,7 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
        if (pulse > 0.0) {
                XMLNode &before = map.get_state();
                /* add music-locked ramped (?) tempo using the bpm/note type at frame*/
-               map.add_tempo (map.tempo_at (frame), pulse, 0, TempoSection::Ramp, MusicTime);
+               map.add_tempo (map.tempo_at_frame (frame), pulse, 0, TempoSection::Ramp, MusicTime);
 
                XMLNode &after = map.get_state();
                _session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
@@ -342,7 +363,7 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
        if (meter_dialog.get_lock_style() == MusicTime) {
                map.add_meter (Meter (bpb, note_type), map.beat_at_bbt (requested), requested, 0, MusicTime);
        } else {
-               map.add_meter (Meter (bpb, note_type), map.beat_at_bbt (requested), requested, map.frame_time (requested), AudioTime);
+               map.add_meter (Meter (bpb, note_type), map.beat_at_bbt (requested), requested, map.frame_at_bbt (requested), AudioTime);
        }
 
        _session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
@@ -390,7 +411,7 @@ Editor::edit_meter_section (MeterSection* section)
        double const note_type = meter_dialog.get_note_type ();
        Timecode::BBT_Time when;
        meter_dialog.get_bbt_time (when);
-       framepos_t const frame = _session->tempo_map().frame_time (when);
+       framepos_t const frame = _session->tempo_map().frame_at_bbt (when);
 
        begin_reversible_command (_("replace meter mark"));
         XMLNode &before = _session->tempo_map().get_state();