manually applied equivalent of 1d82f4ca07 in master (git could not apply successfully)

This commit is contained in:
Paul Davis 2014-02-19 23:37:46 -05:00
parent a9cdd5f2c8
commit 6e38ecc158
5 changed files with 19 additions and 10 deletions

View file

@ -27,6 +27,8 @@
#include "ardour/midi_region.h" #include "ardour/midi_region.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "gtkmm2ext/keyboard.h"
#include "automation_region_view.h" #include "automation_region_view.h"
#include "editing.h" #include "editing.h"
#include "editor.h" #include "editor.h"
@ -120,7 +122,11 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
y = std::max (y, 0.0); y = std::max (y, 0.0);
y = std::min (y, _height - NAME_HIGHLIGHT_SIZE); y = std::min (y, _height - NAME_HIGHLIGHT_SIZE);
add_automation_event (ev, trackview.editor().pixel_to_sample (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_sample (x) - _region->position() + _region->start(), y, with_guard_points);
} }
return false; return false;
@ -130,7 +136,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
* @param y y position, relative to our TimeAxisView. * @param y y position, relative to our TimeAxisView.
*/ */
void 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) { if (!_line) {
boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true); 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")); view->session()->begin_reversible_command (_("add automation event"));
XMLNode& before = _line->the_list()->get_state(); 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(); XMLNode& after = _line->the_list()->get_state();

View file

@ -65,7 +65,7 @@ protected:
bool set_position(framepos_t pos, void* src, double* ignored); bool set_position(framepos_t pos, void* src, double* ignored);
void region_resized (const PBD::PropertyChange&); void region_resized (const PBD::PropertyChange&);
bool canvas_event(GdkEvent* ev); 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 entered (bool);
void exited(); void exited();

View file

@ -543,7 +543,7 @@ AutomationTimeAxisView::build_display_menu ()
} }
void 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) { if (!_line) {
return; return;
@ -576,7 +576,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
_session->begin_reversible_command (_("add automation event")); _session->begin_reversible_command (_("add automation event"));
XMLNode& before = list->get_state(); XMLNode& before = list->get_state();
list->add (when, y); list->add (when, y, with_guard_points);
XMLNode& after = list->get_state(); XMLNode& after = list->get_state();
_session->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList> (*list, &before, &after)); _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_pixel (double); void set_samples_per_pixel (double);
std::string name() const { return _name; } 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 (); void clear_lines ();

View file

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