mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
Allow rubberband selection of MIDI automation points. Fixes
git-svn-id: svn://localhost/ardour2/branches/3.0@7535 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
aa72da4f9f
commit
cc6016400b
9 changed files with 67 additions and 16 deletions
|
|
@ -948,14 +948,14 @@ AutomationLine::remove_point (ControlPoint& cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AutomationLine::get_selectables (nframes_t& start, nframes_t& end,
|
AutomationLine::get_selectables (nframes_t start, nframes_t end,
|
||||||
double botfrac, double topfrac, list<Selectable*>& results)
|
double botfrac, double topfrac, list<Selectable*>& results)
|
||||||
{
|
{
|
||||||
|
|
||||||
double top;
|
double top;
|
||||||
double bot;
|
double bot;
|
||||||
double nstart;
|
sframes_t nstart;
|
||||||
double nend;
|
sframes_t nend;
|
||||||
bool collecting = false;
|
bool collecting = false;
|
||||||
|
|
||||||
/* Curse X11 and its inverted coordinate system! */
|
/* Curse X11 and its inverted coordinate system! */
|
||||||
|
|
@ -967,7 +967,7 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end,
|
||||||
nend = 0;
|
nend = 0;
|
||||||
|
|
||||||
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
||||||
double when = (*(*i)->model())->when;
|
sframes_t const when = _time_converter.to ((*(*i)->model())->when);
|
||||||
|
|
||||||
if (when >= start && when <= end) {
|
if (when >= start && when <= end) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
|
||||||
|
|
||||||
std::list<ControlPoint*> point_selection_to_control_points (PointSelection const &);
|
std::list<ControlPoint*> point_selection_to_control_points (PointSelection const &);
|
||||||
void set_selected_points (PointSelection&);
|
void set_selected_points (PointSelection&);
|
||||||
void get_selectables (nframes_t& start, nframes_t& end,
|
void get_selectables (nframes_t start, nframes_t end,
|
||||||
double botfrac, double topfrac,
|
double botfrac, double topfrac,
|
||||||
std::list<Selectable*>& results);
|
std::list<Selectable*>& results);
|
||||||
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
|
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "midi_automation_line.h"
|
#include "midi_automation_line.h"
|
||||||
|
#include "editor_drag.h"
|
||||||
|
#include "editor.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -89,7 +91,16 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis
|
||||||
bool
|
bool
|
||||||
AutomationRegionView::canvas_event(GdkEvent* ev)
|
AutomationRegionView::canvas_event(GdkEvent* ev)
|
||||||
{
|
{
|
||||||
if (ev->type == GDK_BUTTON_RELEASE) {
|
if (ev->type == GDK_BUTTON_PRESS) {
|
||||||
|
|
||||||
|
/* XXX: icky dcast to Editor */
|
||||||
|
trackview.editor().drags()->set (new RubberbandSelectDrag (dynamic_cast<Editor*> (&trackview.editor()), group), ev);
|
||||||
|
|
||||||
|
} else if (ev->type == GDK_BUTTON_RELEASE) {
|
||||||
|
|
||||||
|
if (trackview.editor().drags()->active() && trackview.editor().drags()->end_grab (ev)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
double x = ev->button.x;
|
double x = ev->button.x;
|
||||||
double y = ev->button.y;
|
double y = ev->button.y;
|
||||||
|
|
|
||||||
|
|
@ -273,3 +273,23 @@ AutomationStreamView::clear ()
|
||||||
arv->line()->clear ();
|
arv->line()->clear ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AutomationStreamView::get_selectables (nframes_t start, nframes_t end, double botfrac, double topfrac, list<Selectable*>& results)
|
||||||
|
{
|
||||||
|
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||||
|
AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i);
|
||||||
|
assert (arv);
|
||||||
|
arv->line()->get_selectables (start - (*i)->region()->position(), end - (*i)->region()->position(), botfrac, topfrac, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AutomationStreamView::set_selected_points (PointSelection& ps)
|
||||||
|
{
|
||||||
|
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||||
|
AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i);
|
||||||
|
assert (arv);
|
||||||
|
arv->line()->set_selected_points (ps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@ class AutomationStreamView : public StreamView
|
||||||
|
|
||||||
void clear ();
|
void clear ();
|
||||||
|
|
||||||
|
void get_selectables (nframes_t, nframes_t, double, double, std::list<Selectable*> &);
|
||||||
|
void set_selected_points (PointSelection &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup_rec_box ();
|
void setup_rec_box ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -783,7 +783,11 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti
|
||||||
void
|
void
|
||||||
AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
|
AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
|
||||||
{
|
{
|
||||||
if (_line && touched (top, bot)) {
|
if (!_line && !_view) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touched (top, bot)) {
|
||||||
double topfrac;
|
double topfrac;
|
||||||
double botfrac;
|
double botfrac;
|
||||||
|
|
||||||
|
|
@ -810,8 +814,11 @@ AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double
|
||||||
botfrac = 1.0 - ((bot - _y_position) / height);
|
botfrac = 1.0 - ((bot - _y_position) / height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_line)
|
if (_line) {
|
||||||
_line->get_selectables (start, end, botfrac, topfrac, results);
|
_line->get_selectables (start, end, botfrac, topfrac, results);
|
||||||
|
} else if (_view) {
|
||||||
|
_view->get_selectables (start, end, botfrac, topfrac, results);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -827,6 +834,8 @@ AutomationTimeAxisView::set_selected_points (PointSelection& points)
|
||||||
{
|
{
|
||||||
if (_line) {
|
if (_line) {
|
||||||
_line->set_selected_points (points);
|
_line->set_selected_points (points);
|
||||||
|
} else if (_view) {
|
||||||
|
_view->set_selected_points (points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3106,6 +3106,8 @@ RubberbandSelectDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
|
|
||||||
_editor->begin_reversible_command (_("rubberband selection"));
|
_editor->begin_reversible_command (_("rubberband selection"));
|
||||||
|
|
||||||
|
cout << "RSD finished, selecting all within <fred>\n";
|
||||||
|
|
||||||
if (grab_frame() < last_pointer_frame()) {
|
if (grab_frame() < last_pointer_frame()) {
|
||||||
committed = _editor->select_all_within (grab_frame(), last_pointer_frame() - 1, y1, y2, _editor->track_views, op);
|
committed = _editor->select_all_within (grab_frame(), last_pointer_frame() - 1, y1, y2, _editor->track_views, op);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
#include "control_point_dialog.h"
|
#include "control_point_dialog.h"
|
||||||
#include "editor_drag.h"
|
#include "editor_drag.h"
|
||||||
|
#include "automation_region_view.h"
|
||||||
|
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
#include "ardour/profile.h"
|
#include "ardour/profile.h"
|
||||||
|
|
@ -525,10 +526,6 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
|
||||||
bool
|
bool
|
||||||
Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
|
Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
|
||||||
{
|
{
|
||||||
if (_drags->active ()) {
|
|
||||||
_drags->abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* single mouse clicks on any of these item types operate
|
/* single mouse clicks on any of these item types operate
|
||||||
independent of mouse mode, mostly because they are
|
independent of mouse mode, mostly because they are
|
||||||
not on the main track canvas or because we want
|
not on the main track canvas or because we want
|
||||||
|
|
@ -751,6 +748,14 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
}
|
}
|
||||||
|
|
||||||
case RegionItem:
|
case RegionItem:
|
||||||
|
if (dynamic_cast<AutomationRegionView*> (clicked_regionview)) {
|
||||||
|
/* click on an automation region view; do nothing here and let the ARV's signal handler
|
||||||
|
sort it out.
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* click on a normal region view */
|
||||||
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier)) {
|
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier)) {
|
||||||
add_region_copy_drag (item, event, clicked_regionview);
|
add_region_copy_drag (item, event, clicked_regionview);
|
||||||
}
|
}
|
||||||
|
|
@ -1926,6 +1931,7 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
|
||||||
if (_drags->active ()) {
|
if (_drags->active ()) {
|
||||||
handled = _drags->motion_handler (event, from_autoscroll);
|
handled = _drags->motion_handler (event, from_autoscroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue