13
0

back to using shift-ctrl for pinch drag. set colours of affected curves.

This commit is contained in:
nick_m 2017-02-27 02:26:08 +11:00 committed by Robin Gareus
parent d06e710402
commit f8a6f8918d
4 changed files with 41 additions and 12 deletions

View File

@ -3626,6 +3626,8 @@ TempoTwistDrag::TempoTwistDrag (Editor* e, ArdourCanvas::Item* i)
, _grab_qn (0.0)
, _grab_tempo (0.0)
, _tempo (0)
, _next_tempo (0)
, _drag_valid (true)
, before_state (0)
{
DEBUG_TRACE (DEBUG::Drags, "New TempoTwistDrag\n");
@ -3638,12 +3640,28 @@ TempoTwistDrag::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()));
_grab_tempo = Tempo (_tempo->note_types_per_minute(), _tempo->note_type());
ostringstream sstr;
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
sstr << "end: " << fixed << setprecision(3) << _tempo->end_note_types_per_minute();
show_verbose_cursor_text (sstr.str());
_next_tempo = map.next_tempo_section (_tempo);
if (_next_tempo) {
if (!map.next_tempo_section (_next_tempo)) {
_drag_valid = false;
finished (event, false);
return;
}
_editor->tempo_curve_selected (_tempo, true);
_editor->tempo_curve_selected (_next_tempo, true);
ostringstream sstr;
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
sstr << "end: " << fixed << setprecision(3) << _tempo->end_note_types_per_minute() << "\n";
sstr << "start: " << fixed << setprecision(3) << _next_tempo->note_types_per_minute();
show_verbose_cursor_text (sstr.str());
} else {
_drag_valid = false;
}
_grab_tempo = Tempo (_tempo->note_types_per_minute(), _tempo->note_type());
}
void
@ -3673,6 +3691,11 @@ TempoTwistDrag::setup_pointer_frame_offset ()
void
TempoTwistDrag::motion (GdkEvent* event, bool first_move)
{
if (!_next_tempo || !_drag_valid) {
return;
}
TempoMap& map (_editor->session()->tempo_map());
if (first_move) {
@ -3694,19 +3717,23 @@ 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();
sstr << "end: " << fixed << setprecision(3) << _tempo->end_note_types_per_minute();
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
sstr << "end: " << fixed << setprecision(3) << _tempo->end_note_types_per_minute() << "\n";
sstr << "start: " << fixed << setprecision(3) << _next_tempo->note_types_per_minute();
show_verbose_cursor_text (sstr.str());
}
void
TempoTwistDrag::finished (GdkEvent* event, bool movement_occurred)
{
if (!movement_occurred) {
TempoMap& map (_editor->session()->tempo_map());
if (!movement_occurred || !_drag_valid) {
return;
}
TempoMap& map (_editor->session()->tempo_map());
_editor->tempo_curve_selected (_tempo, false);
_editor->tempo_curve_selected (_next_tempo, false);
XMLNode &after = map.get_state();
_editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));

View File

@ -849,6 +849,8 @@ private:
double _grab_qn;
ARDOUR::Tempo _grab_tempo;
ARDOUR::TempoSection* _tempo;
ARDOUR::TempoSection* _next_tempo;
bool _drag_valid;
XMLNode* before_state;
};

View File

@ -737,8 +737,8 @@ 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 (Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)
&& Keyboard::modifier_state_contains (event->button.state, Keyboard::SecondaryModifier)) {
} else if (ArdourKeyboard::indicates_constraint (event->button.state)
&& Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new TempoTwistDrag (this, item), event);
} else if (ArdourKeyboard::indicates_constraint (event->button.state)) {
_drags->set (new BBTRulerDrag (this, item), event);

View File

@ -175,7 +175,7 @@ void
TempoCurve::set_color_rgba (uint32_t c)
{
_color = c;
_curve->set_fill_color (UIConfiguration::instance().color_mod (c, "selection rect"));
_curve->set_fill_color (UIConfiguration::instance().color_mod (_color, "selection rect"));
_curve->set_outline_color (_color);
}