13
0

ctrl-click when adding automation points no longer adds guard points

This commit is contained in:
Paul Davis 2014-02-19 12:54:00 -05:00
parent d8b3e2932f
commit 1d82f4ca07
5 changed files with 19 additions and 10 deletions

View File

@ -27,6 +27,8 @@
#include "ardour/midi_region.h"
#include "ardour/session.h"
#include "gtkmm2ext/keyboard.h"
#include "automation_region_view.h"
#include "editing.h"
#include "editor.h"
@ -120,7 +122,11 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
y = std::max (y, 0.0);
y = std::min (y, _height - NAME_HIGHLIGHT_SIZE);
add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y);
/* no guard points if primary modifier is used */
bool with_guard_points = !Gtkmm2ext::Keyboard::modifier_state_equals (ev->button.state, Gtkmm2ext::Keyboard::PrimaryModifier);
add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y, with_guard_points);
}
return false;
@ -130,7 +136,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
* @param y y position, relative to our TimeAxisView.
*/
void
AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y)
AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y, bool with_guard_points)
{
if (!_line) {
boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
@ -160,7 +166,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
view->session()->begin_reversible_command (_("add automation event"));
XMLNode& before = _line->the_list()->get_state();
_line->the_list()->add (when_d, y);
_line->the_list()->add (when_d, y, with_guard_points);
XMLNode& after = _line->the_list()->get_state();

View File

@ -66,7 +66,7 @@ protected:
bool set_position(framepos_t pos, void* src, double* ignored);
void region_resized (const PBD::PropertyChange&);
bool canvas_event(GdkEvent* ev);
void add_automation_event (GdkEvent* event, framepos_t when, double y);
void add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points);
void entered (bool);
void exited();

View File

@ -550,7 +550,7 @@ AutomationTimeAxisView::build_display_menu ()
}
void
AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, double y)
AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points)
{
if (!_line) {
return;
@ -583,7 +583,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
_session->begin_reversible_command (_("add automation event"));
XMLNode& before = list->get_state();
list->add (when, y);
list->add (when, y, with_guard_points);
XMLNode& after = list->get_state();
_session->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList> (*list, &before, &after));

View File

@ -72,7 +72,7 @@ class AutomationTimeAxisView : public TimeAxisView {
void set_samples_per_unit (double);
std::string name() const { return _name; }
void add_automation_event (GdkEvent *, framepos_t, double);
void add_automation_event (GdkEvent *, framepos_t, double, bool with_guard_points);
void clear_lines ();

View File

@ -1682,7 +1682,8 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case AutomationTrackItem:
atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
if (atv) {
atv->add_automation_event (event, where, event->button.y);
bool with_guard_points = !Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
atv->add_automation_event (event, where, event->button.y, with_guard_points);
}
return true;
break;
@ -1707,11 +1708,13 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break;
}
case AutomationTrackItem:
case AutomationTrackItem: {
bool with_guard_points = !Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)->
add_automation_event (event, where, event->button.y);
add_automation_event (event, where, event->button.y, with_guard_points);
return true;
break;
}
default:
break;
}