mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
GUI manipulation of note timing with horiz drag
Unfinished and may change
This commit is contained in:
parent
eb139acab6
commit
5dfc061792
2 changed files with 45 additions and 3 deletions
|
|
@ -872,7 +872,18 @@ StepView::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
||||||
}
|
}
|
||||||
} else if (_seq.mode() == SequencerGrid::Timing) {
|
} else if (_seq.mode() == SequencerGrid::Timing) {
|
||||||
if (_step.velocity()) {
|
if (_step.velocity()) {
|
||||||
|
Temporal::Beats offset = _step.offset ();
|
||||||
|
const double fract = offset.to_ticks() / (double) _seq.sequencer().step_size().to_ticks();
|
||||||
|
const double width = ((_step_dimen - 4.0)/2.0) * fract;
|
||||||
|
const Duple origin = item_to_window (Duple (_step_dimen / 2.0, 0.0));
|
||||||
|
|
||||||
|
/* draw sideways "bars" from center" to indicate extent
|
||||||
|
* of time displacement from nominal time for this step
|
||||||
|
*/
|
||||||
|
|
||||||
|
set_source_rgba (context, outline_color());
|
||||||
|
context->rectangle (origin.x + 2.0, origin.y + 2.0, width, _step_dimen - 4.0);
|
||||||
|
context->fill ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -913,7 +924,16 @@ StepView::motion_event (GdkEventMotion* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double distance = last_motion.second - ev->y;
|
double distance;
|
||||||
|
|
||||||
|
switch (_seq.mode()) {
|
||||||
|
case SequencerGrid::Timing:
|
||||||
|
distance = ev->x - last_motion.first;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
distance = last_motion.second - ev->y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ev->state & GDK_MOD1_MASK) || _seq.mode() == SequencerGrid::Pitch) {
|
if ((ev->state & GDK_MOD1_MASK) || _seq.mode() == SequencerGrid::Pitch) {
|
||||||
adjust_step_pitch (distance);
|
adjust_step_pitch (distance);
|
||||||
|
|
@ -923,6 +943,8 @@ StepView::motion_event (GdkEventMotion* ev)
|
||||||
adjust_step_duration (Step::DurationRatio (distance, 32)); /* adjust by 1/32 of the sequencer step size */
|
adjust_step_duration (Step::DurationRatio (distance, 32)); /* adjust by 1/32 of the sequencer step size */
|
||||||
} else if (_seq.mode() == SequencerGrid::Octave) {
|
} else if (_seq.mode() == SequencerGrid::Octave) {
|
||||||
adjust_step_octave (distance);
|
adjust_step_octave (distance);
|
||||||
|
} else if (_seq.mode() == SequencerGrid::Timing) {
|
||||||
|
adjust_step_timing (distance/(_step_dimen / 2.0));
|
||||||
} else if (_seq.mode() == SequencerGrid::Group) {
|
} else if (_seq.mode() == SequencerGrid::Group) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -948,7 +970,18 @@ StepView::button_release_event (GdkEventButton* ev)
|
||||||
ungrab ();
|
ungrab ();
|
||||||
grabbed = false;
|
grabbed = false;
|
||||||
|
|
||||||
if (fabs (last_motion.second - grab_at.second) < 4) {
|
int distance_moved;
|
||||||
|
|
||||||
|
switch (_seq.mode()) {
|
||||||
|
case SequencerGrid::Timing:
|
||||||
|
distance_moved = grab_at.first - last_motion.first;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
distance_moved = last_motion.second - grab_at.second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (::abs (distance_moved) < 4) {
|
||||||
/* just a click */
|
/* just a click */
|
||||||
|
|
||||||
/* in all modes except octave, turn step on if it is off */
|
/* in all modes except octave, turn step on if it is off */
|
||||||
|
|
@ -1001,12 +1034,20 @@ StepView::scroll_event (GdkEventScroll* ev)
|
||||||
adjust_step_duration (Step::DurationRatio (amt, 32));
|
adjust_step_duration (Step::DurationRatio (amt, 32));
|
||||||
} else if (_seq.mode() == SequencerGrid::Octave) {
|
} else if (_seq.mode() == SequencerGrid::Octave) {
|
||||||
adjust_step_octave (amt);
|
adjust_step_octave (amt);
|
||||||
|
} else if (_seq.mode() == SequencerGrid::Timing) {
|
||||||
|
adjust_step_timing (amt);
|
||||||
} else if (_seq.mode() == SequencerGrid::Group) {
|
} else if (_seq.mode() == SequencerGrid::Group) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StepView::adjust_step_timing (double fract)
|
||||||
|
{
|
||||||
|
_step.adjust_offset (fract);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepView::adjust_step_pitch (int amt)
|
StepView::adjust_step_pitch (int amt)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ class StepView : public ArdourCanvas::Rectangle, public sigc::trackable {
|
||||||
void adjust_step_velocity (int amt);
|
void adjust_step_velocity (int amt);
|
||||||
void adjust_step_duration (ARDOUR::Step::DurationRatio const &);
|
void adjust_step_duration (ARDOUR::Step::DurationRatio const &);
|
||||||
void adjust_step_octave (int amt);
|
void adjust_step_octave (int amt);
|
||||||
|
void adjust_step_timing (double fract);
|
||||||
|
|
||||||
void step_changed (PBD::PropertyChange const &);
|
void step_changed (PBD::PropertyChange const &);
|
||||||
PBD::ScopedConnection step_connection;
|
PBD::ScopedConnection step_connection;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue