further adventures in drag-refactoring do that LineDrag can be used in MidiCueEditor also
This commit is contained in:
parent
302337e8fd
commit
01068fe306
@ -509,6 +509,7 @@ public:
|
|||||||
void make_region_markers_global (bool as_cd_markers);
|
void make_region_markers_global (bool as_cd_markers);
|
||||||
|
|
||||||
bool rb_click (GdkEvent*, Temporal::timepos_t const &);
|
bool rb_click (GdkEvent*, Temporal::timepos_t const &);
|
||||||
|
void line_drag_click (GdkEvent*, Temporal::timepos_t const &, double);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void map_transport_state ();
|
void map_transport_state ();
|
||||||
|
@ -4938,8 +4938,8 @@ ControlPointDrag::active (Editing::MouseMode m)
|
|||||||
return dynamic_cast<AutomationLine*> (&(_point->line ())) != 0;
|
return dynamic_cast<AutomationLine*> (&(_point->line ())) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LineDrag::LineDrag (Editor& e, ArdourCanvas::Item* i)
|
LineDrag::LineDrag (EditingContext& e, ArdourCanvas::Item* i, std::function<void(GdkEvent*,timepos_t const &,double)> cf)
|
||||||
: EditorDrag (e, i, e.time_domain (), e.get_trackview_group())
|
: Drag (e, i, e.time_domain (), e.get_trackview_group())
|
||||||
, _line (0)
|
, _line (0)
|
||||||
, _fixed_grab_x (0.0)
|
, _fixed_grab_x (0.0)
|
||||||
, _fixed_grab_y (0.0)
|
, _fixed_grab_y (0.0)
|
||||||
@ -4947,6 +4947,7 @@ LineDrag::LineDrag (Editor& e, ArdourCanvas::Item* i)
|
|||||||
, _before (0)
|
, _before (0)
|
||||||
, _after (0)
|
, _after (0)
|
||||||
, have_command (false)
|
, have_command (false)
|
||||||
|
, click_functor (cf)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Drags, "New LineDrag\n");
|
DEBUG_TRACE (DEBUG::Drags, "New LineDrag\n");
|
||||||
}
|
}
|
||||||
@ -5049,27 +5050,10 @@ LineDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||||||
editing_context.commit_reversible_command ();
|
editing_context.commit_reversible_command ();
|
||||||
have_command = false;
|
have_command = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* add a new control point on the line */
|
|
||||||
|
|
||||||
AutomationTimeAxisView* atv;
|
click_functor (event, grab_time(), _fixed_grab_y);
|
||||||
|
|
||||||
if ((atv = dynamic_cast<AutomationTimeAxisView*> (_editor.clicked_axisview)) != 0) {
|
|
||||||
timepos_t where = grab_time ();
|
|
||||||
|
|
||||||
double cx = 0;
|
|
||||||
double cy = _fixed_grab_y;
|
|
||||||
|
|
||||||
_line->grab_item ().item_to_canvas (cx, cy);
|
|
||||||
|
|
||||||
atv->add_automation_event (event, where, cy, false);
|
|
||||||
} else if (dynamic_cast<AudioTimeAxisView*> (_editor.clicked_axisview) != 0) {
|
|
||||||
AudioRegionView* arv;
|
|
||||||
|
|
||||||
if ((arv = dynamic_cast<AudioRegionView*> (_editor.clicked_regionview)) != 0) {
|
|
||||||
arv->add_gain_point_event (&arv->fx_line ()->grab_item (), event, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1233,10 +1233,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Gain or automation line drag */
|
/** Gain or automation line drag */
|
||||||
class LineDrag : public EditorDrag
|
class LineDrag : public Drag
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LineDrag (Editor&e, ArdourCanvas::Item *i);
|
LineDrag (EditingContext &e, ArdourCanvas::Item *i, std::function<void(GdkEvent*,Temporal::timepos_t const &,double)>);
|
||||||
~LineDrag ();
|
~LineDrag ();
|
||||||
|
|
||||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||||
@ -1257,6 +1257,7 @@ private:
|
|||||||
uint32_t _before;
|
uint32_t _before;
|
||||||
uint32_t _after;
|
uint32_t _after;
|
||||||
bool have_command;
|
bool have_command;
|
||||||
|
std::function<void(GdkEvent*,Temporal::timepos_t const &,double)> click_functor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Transient feature line drags*/
|
/** Transient feature line drags*/
|
||||||
|
@ -848,7 +848,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GainLineItem:
|
case GainLineItem:
|
||||||
_drags->set (new LineDrag (*this, item), event);
|
_drags->set (new LineDrag (*this, item, [&](GdkEvent* ev,timepos_t const & pos, double y) { line_drag_click (ev, pos, y); }), event);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -858,7 +858,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EditorAutomationLineItem:
|
case EditorAutomationLineItem:
|
||||||
_drags->set (new LineDrag (*this, item), event);
|
_drags->set (new LineDrag (*this, item, [&](GdkEvent* ev,timepos_t const & pos, double y) { line_drag_click (ev, pos, y); }), event);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -999,7 +999,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EditorAutomationLineItem:
|
case EditorAutomationLineItem:
|
||||||
_drags->set (new LineDrag (*this, item), event);
|
_drags->set (new LineDrag (*this, item, [&](GdkEvent* ev,timepos_t const & pos, double y) { line_drag_click (ev, pos, y); }), event);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1062,7 +1062,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||||||
case MouseDraw:
|
case MouseDraw:
|
||||||
switch (item_type) {
|
switch (item_type) {
|
||||||
case GainLineItem:
|
case GainLineItem:
|
||||||
_drags->set (new LineDrag (*this, item), event);
|
_drags->set (new LineDrag (*this, item, [&](GdkEvent* ev,timepos_t const & pos, double y) { line_drag_click (ev, pos, y); }), event);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ControlPointItem:
|
case ControlPointItem:
|
||||||
@ -2617,3 +2617,22 @@ Editor::rb_click (GdkEvent* event, timepos_t const & where)
|
|||||||
|
|
||||||
return do_deselect;
|
return do_deselect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::line_drag_click (GdkEvent* event, timepos_t const & where, double y)
|
||||||
|
{
|
||||||
|
AutomationTimeAxisView* atv;
|
||||||
|
|
||||||
|
if ((atv = dynamic_cast<AutomationTimeAxisView*> (clicked_axisview)) != 0) {
|
||||||
|
|
||||||
|
atv->add_automation_event (event, where, y, false);
|
||||||
|
|
||||||
|
} else if (dynamic_cast<AudioTimeAxisView*> (clicked_axisview) != 0) {
|
||||||
|
|
||||||
|
AudioRegionView* arv;
|
||||||
|
|
||||||
|
if ((arv = dynamic_cast<AudioRegionView*> (clicked_regionview)) != 0) {
|
||||||
|
arv->add_gain_point_event (&arv->fx_line ()->grab_item (), event, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -563,6 +563,13 @@ MidiCueEditor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event
|
|||||||
case EditorAutomationLineItem: {
|
case EditorAutomationLineItem: {
|
||||||
ARDOUR::SelectionOperation op = ArdourKeyboard::selection_type (event->button.state);
|
ARDOUR::SelectionOperation op = ArdourKeyboard::selection_type (event->button.state);
|
||||||
select_automation_line (&event->button, item, op);
|
select_automation_line (&event->button, item, op);
|
||||||
|
switch (mouse_mode) {
|
||||||
|
case Editing::MouseContent:
|
||||||
|
_drags->set (new LineDrag (*this, item, [&](GdkEvent* ev,timepos_t const & pos, double) { view->line_drag_click (ev, pos); }), event);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,3 +318,9 @@ MidiCueView::automation_rb_click (GdkEvent* event, Temporal::timepos_t const & p
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiCueView::line_drag_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class MidiCueView : public MidiView
|
|||||||
MergeableLine* make_merger ();
|
MergeableLine* make_merger ();
|
||||||
|
|
||||||
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
||||||
|
void line_drag_click (GdkEvent*, Temporal::timepos_t const &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool scroll (GdkEventScroll* ev);
|
bool scroll (GdkEventScroll* ev);
|
||||||
|
Loading…
Reference in New Issue
Block a user