highlight the tempo curve that is to be altered, modify text to suit.
authornick_m <mainsbridge@gmail.com>
Sat, 25 Feb 2017 20:03:02 +0000 (07:03 +1100)
committerRobin Gareus <robin@gareus.org>
Mon, 27 Feb 2017 19:16:10 +0000 (20:16 +0100)
gtk2_ardour/editor.h
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_tempodisplay.cc

index bca0bfae2f11fb0c3e68483d8c56545ceaf36dd6..72ee92ed17e81627f4eb67514dda10bf46dca304 100644 (file)
@@ -332,6 +332,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void mixer_strip_width_changed ();
        void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
        void show_track_in_display (TimeAxisView* tv, bool move_into_view = false);
+       void tempo_curve_selected (ARDOUR::TempoSection* ts, bool yn);
 
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
 
index 1ea89a00fe20c7f4b0355c8d7f431bbe700bdc26..815acd3e94ed85f3a6c37d98bd8027fe323f90a8 100644 (file)
@@ -3537,8 +3537,9 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
        Drag::start_grab (event, cursor);
        TempoMap& map (_editor->session()->tempo_map());
        _tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame()));
-       ostringstream sstr;
+       _editor->tempo_curve_selected (_tempo, true);
 
+       ostringstream sstr;
        sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
        sstr << "mouse: " << fixed << setprecision(3) << map.tempo_at_frame (adjusted_current_frame (event)).note_types_per_minute();
        show_verbose_cursor_text (sstr.str());
@@ -3609,6 +3610,7 @@ BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred)
        XMLNode &after = map.get_state();
        _editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
        _editor->commit_reversible_command ();
+       _editor->tempo_curve_selected (_tempo, false);
 }
 
 void
@@ -3692,7 +3694,7 @@ TempoTwistDrag::motion (GdkEvent* event, bool first_move)
        _editor->session()->tempo_map().gui_twist_tempi (_tempo, new_bpm, map.frame_at_quarter_note (_grab_qn), pf);
 
        ostringstream sstr;
-       sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
+       sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute();
        sstr << "end: " << fixed << setprecision(3) << _tempo->end_note_types_per_minute();
        show_verbose_cursor_text (sstr.str());
 }
@@ -3735,10 +3737,10 @@ TempoEndDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
        Drag::start_grab (event, cursor);
        TempoMap& map (_editor->session()->tempo_map());
        _tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame()));
+       _editor->tempo_curve_selected (&map.tempo_section_at_frame (_tempo->frame() - 1), true);
 
        ostringstream sstr;
        sstr << "end: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute() << "\n";
-       sstr << "start: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute();
        show_verbose_cursor_text (sstr.str());
 }
 
@@ -3783,8 +3785,7 @@ TempoEndDrag::motion (GdkEvent* event, bool first_move)
        map.gui_stretch_tempo_end (&map.tempo_section_at_frame (_tempo->frame() - 1), map.frame_at_quarter_note (_grab_qn), pf);
 
        ostringstream sstr;
-       sstr << "end: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute() << "\n";
-       sstr << "start: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).note_types_per_minute();
+       sstr << "end: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute();
        show_verbose_cursor_text (sstr.str());
 }
 
@@ -3800,6 +3801,7 @@ TempoEndDrag::finished (GdkEvent* event, bool movement_occurred)
        XMLNode &after = map.get_state();
        _editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
        _editor->commit_reversible_command ();
+       _editor->tempo_curve_selected (&map.tempo_section_at_frame (_tempo->frame() - 1), false);
 }
 
 void
index 20aa9d2a18ba2e81a2fcff57b4acc01168eb42b6..872912e6de6eddec8b836dbd189e21613e5b54a7 100644 (file)
@@ -737,7 +737,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)
                        && !ArdourKeyboard::indicates_constraint (event->button.state)) {
                        _drags->set (new CursorDrag (this, *playhead_cursor, false), event);
-               } else if (ArdourKeyboard::indicates_constraint (event->button.state)
+               } else if (Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)
                           && Keyboard::modifier_state_contains (event->button.state, Keyboard::SecondaryModifier)) {
                        _drags->set (new TempoTwistDrag (this, item), event);
                } else if (ArdourKeyboard::indicates_constraint (event->button.state)) {
index 35b4783f204d32516a5b19369bf3e17e3d5733bc..86b1b8d65a54c5b4ed5ce12166fd9530f2c07bbf 100644 (file)
@@ -86,7 +86,6 @@ Editor::draw_metric_marks (const Metrics& metrics)
        char buf[64];
        double max_tempo = 0.0;
        double min_tempo = DBL_MAX;
-       const TempoSection *prev_ts = 0;
 
        remove_metric_marks (); // also clears tempo curves
 
@@ -114,11 +113,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
                        max_tempo = max (max_tempo, ts->end_note_types_per_minute());
                        min_tempo = min (min_tempo, ts->note_types_per_minute());
                        min_tempo = min (min_tempo, ts->end_note_types_per_minute());
-                       uint32_t tc_color = UIConfiguration::instance().color ("tempo curve");
-
-                       if (prev_ts &&  abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 2) {
-                               tc_color = UIConfiguration::instance().color ("location loop");
-                       }
+                       uint32_t const tc_color = UIConfiguration::instance().color ("tempo curve");
 
                        tempo_curves.push_back (new TempoCurve (*this, *tempo_group, tc_color,
                                                                *(const_cast<TempoSection*>(ts)), ts->frame(), false));
@@ -130,9 +125,6 @@ Editor::draw_metric_marks (const Metrics& metrics)
                                metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), buf,
                                                                 *(const_cast<TempoSection*>(ts))));
                        }
-
-                       prev_ts = ts;
-
                }
 
        }
@@ -263,11 +255,6 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
                (*x)->set_min_tempo (min_tempo);
                ++tmp;
                if (tmp != tempo_curves.end()) {
-                       if (abs ((*tmp)->tempo().note_types_per_minute() - (*x)->tempo().end_note_types_per_minute()) < 2) {
-                               (*tmp)->set_color_rgba (UIConfiguration::instance().color ("location loop"));
-                       } else {
-                               (*tmp)->set_color_rgba (UIConfiguration::instance().color ("tempo curve"));
-                       }
                        (*x)->set_position ((*x)->tempo().frame(), (*tmp)->tempo().frame());
                } else {
                        (*x)->set_position ((*x)->tempo().frame(), UINT32_MAX);
@@ -322,6 +309,19 @@ Editor::redisplay_tempo (bool immediate_redraw)
                Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_tempo), true), false));
        }
 }
+void
+Editor::tempo_curve_selected (TempoSection* ts, bool yn)
+{
+       for (Curves::iterator x = tempo_curves.begin(); x != tempo_curves.end(); ++x) {
+               if (&(*x)->tempo() == ts && yn) {
+                       (*x)->set_color_rgba (UIConfiguration::instance().color ("location marker"));
+                       break;
+               } else if (&(*x)->tempo() == ts) {
+                       (*x)->set_color_rgba (UIConfiguration::instance().color ("tempo curve"));
+                       break;
+               }
+       }
+}
 
 /* computes a grid starting a beat before and ending a beat after leftmost and rightmost respectively */
 void