mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
somewhat sort of working clip start drag (GUI edition)
This commit is contained in:
parent
8c0c9cc115
commit
5ef4f8973f
4 changed files with 46 additions and 11 deletions
|
|
@ -70,6 +70,7 @@
|
|||
#include "gui_thread.h"
|
||||
#include "keyboard.h"
|
||||
#include "mergeable_line.h"
|
||||
#include "midi_cue_editor.h"
|
||||
#include "midi_region_view.h"
|
||||
#include "midi_selection.h"
|
||||
#include "midi_time_axis.h"
|
||||
|
|
@ -7541,12 +7542,13 @@ VelocityLineDrag::aborted (bool)
|
|||
vd->end_line_drag (false);
|
||||
}
|
||||
|
||||
ClipStartDrag::ClipStartDrag (EditingContext& ec, ArdourCanvas::Rectangle& r, Temporal::timepos_t const & os)
|
||||
: Drag (ec, &r, os.time_domain(), nullptr, false)
|
||||
ClipStartDrag::ClipStartDrag (EditingContext& ec, ArdourCanvas::Rectangle& r, MidiCueEditor& m)
|
||||
: Drag (ec, &r, Temporal::BeatTime, nullptr, false)
|
||||
, mce (m)
|
||||
, dragging_rect (&r)
|
||||
, original_start (os)
|
||||
, original_rect (r.get())
|
||||
, _cumulative_dx (0)
|
||||
{
|
||||
std::cerr << "CSD!\n";
|
||||
}
|
||||
|
||||
ClipStartDrag::~ClipStartDrag ()
|
||||
|
|
@ -7567,20 +7569,39 @@ ClipStartDrag::end_grab (GdkEvent* ev)
|
|||
}
|
||||
|
||||
void
|
||||
ClipStartDrag::motion (GdkEvent*, bool)
|
||||
ClipStartDrag::motion (GdkEvent* event, bool first_move)
|
||||
{
|
||||
std::cerr << "clip start drag\n";
|
||||
double dx = current_pointer_x () - last_pointer_x ();
|
||||
_cumulative_dx += dx;
|
||||
|
||||
ArdourCanvas::Rect r (original_rect);
|
||||
|
||||
if (_cumulative_dx > r.x1) {
|
||||
r.x1 = r.x1 + _cumulative_dx;
|
||||
} else {
|
||||
r.x1 = r.x0 + 1.;
|
||||
}
|
||||
|
||||
dragging_rect->set (r);
|
||||
}
|
||||
|
||||
void
|
||||
ClipStartDrag::finished (GdkEvent*, bool)
|
||||
ClipStartDrag::finished (GdkEvent* event, bool movement_occured)
|
||||
{
|
||||
std::cerr << "clip start drag ALL DONE\n";
|
||||
if (!movement_occured) {
|
||||
dragging_rect->set (original_rect);
|
||||
return;
|
||||
}
|
||||
|
||||
Temporal::Beats b (random() % 12, 0);
|
||||
std::cerr << "set start @ " << b.str() << std::endl;
|
||||
mce.set_trigger_start (timepos_t (b));
|
||||
}
|
||||
|
||||
void
|
||||
ClipStartDrag::aborted (bool)
|
||||
{
|
||||
dragging_rect->set (original_rect);
|
||||
}
|
||||
|
||||
ClipEndDrag::ClipEndDrag (EditingContext& ec, ArdourCanvas::Rectangle& r, Temporal::timepos_t const & oe)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class EditingContext;
|
|||
class Editor;
|
||||
class EditorCursor;
|
||||
class TimeAxisView;
|
||||
class MidiCueEditor;
|
||||
class MidiTimeAxisView;
|
||||
class Drag;
|
||||
class NoteBase;
|
||||
|
|
@ -1643,7 +1644,7 @@ class VelocityLineDrag : public FreehandLineDrag<Evoral::ControlList::OrderedPoi
|
|||
class ClipStartDrag : public Drag
|
||||
{
|
||||
public:
|
||||
ClipStartDrag (EditingContext&, ArdourCanvas::Rectangle &, Temporal::timepos_t const &);
|
||||
ClipStartDrag (EditingContext&, ArdourCanvas::Rectangle &, MidiCueEditor& m);
|
||||
~ClipStartDrag ();
|
||||
|
||||
void start_grab (GdkEvent*,Gdk::Cursor*);
|
||||
|
|
@ -1653,8 +1654,10 @@ class ClipStartDrag : public Drag
|
|||
void aborted (bool);
|
||||
|
||||
private:
|
||||
MidiCueEditor& mce;
|
||||
ArdourCanvas::Rectangle* dragging_rect;
|
||||
Temporal::timepos_t original_start;
|
||||
ArdourCanvas::Rect original_rect;
|
||||
double _cumulative_dx;
|
||||
};
|
||||
|
||||
class ClipEndDrag : public Drag
|
||||
|
|
|
|||
|
|
@ -507,6 +507,12 @@ MidiCueEditor::canvas_cue_end_event (GdkEvent* event, ArdourCanvas::Item* item)
|
|||
return typed_event (item, event, ClipEndItem);
|
||||
}
|
||||
|
||||
void
|
||||
MidiCueEditor::set_trigger_start (Temporal::timepos_t const & p)
|
||||
{
|
||||
ref.trigger()->the_region()->set_start (p);
|
||||
}
|
||||
|
||||
Gtk::Widget&
|
||||
MidiCueEditor::viewport()
|
||||
{
|
||||
|
|
@ -655,7 +661,7 @@ MidiCueEditor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event
|
|||
case ClipStartItem: {
|
||||
ArdourCanvas::Rectangle* r = dynamic_cast<ArdourCanvas::Rectangle*> (item);
|
||||
if (r) {
|
||||
_drags->set (new ClipStartDrag (*this, *r, timepos_t (BeatTime)), event);
|
||||
_drags->set (new ClipStartDrag (*this, *r, *this), event);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ class MidiCueEditor : public CueEditor
|
|||
|
||||
void set_visible_channel (int chan);
|
||||
|
||||
void set_trigger_start (Temporal::timepos_t const &);
|
||||
void set_trigger_end (Temporal::timepos_t const &);
|
||||
void set_trigger_length (Temporal::timecnt_t const &);
|
||||
void set_trigger_bounds (Temporal::timepos_t const &, Temporal::timepos_t const &);
|
||||
|
||||
protected:
|
||||
void register_actions ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue