mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
click (press-no-drag-release) handled as specific user gesture
This commit is contained in:
parent
ba84a1ccc7
commit
52fcb1d0da
2 changed files with 25 additions and 8 deletions
|
|
@ -59,7 +59,7 @@ using std::endl;
|
||||||
|
|
||||||
const int _nsteps = 32;
|
const int _nsteps = 32;
|
||||||
const int _nrows = 8;
|
const int _nrows = 8;
|
||||||
const double _step_dimen = 25;
|
const double _step_dimen = 32;
|
||||||
|
|
||||||
BBGUI::BBGUI (boost::shared_ptr<BeatBox> bb)
|
BBGUI::BBGUI (boost::shared_ptr<BeatBox> bb)
|
||||||
: ArdourDialog (_("BeatBox"))
|
: ArdourDialog (_("BeatBox"))
|
||||||
|
|
@ -557,10 +557,7 @@ StepView::motion_event (GdkEventMotion* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double xdelta = ev->x - last_motion.first;
|
const double distance = last_motion.second - ev->y;
|
||||||
const double ydelta = last_motion.second - ev->y;
|
|
||||||
//const double distance = sqrt (xdelta * xdelta + ydelta * ydelta);
|
|
||||||
const double distance = ydelta;
|
|
||||||
|
|
||||||
if ((ev->state & GDK_MOD1_MASK) || _seq.mode() == SequencerGrid::Pitch) {
|
if ((ev->state & GDK_MOD1_MASK) || _seq.mode() == SequencerGrid::Pitch) {
|
||||||
cerr << "adjust pitch by " << distance << endl;
|
cerr << "adjust pitch by " << distance << endl;
|
||||||
|
|
@ -577,7 +574,6 @@ StepView::motion_event (GdkEventMotion* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
last_motion = std::make_pair (ev->x, ev->y);
|
last_motion = std::make_pair (ev->x, ev->y);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -588,14 +584,34 @@ StepView::button_press_event (GdkEventButton* ev)
|
||||||
last_motion = grab_at;
|
last_motion = grab_at;
|
||||||
grab ();
|
grab ();
|
||||||
grabbed = true;
|
grabbed = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StepView::button_release_event (GdkEventButton* ev)
|
StepView::button_release_event (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
|
if (grabbed) {
|
||||||
ungrab ();
|
ungrab ();
|
||||||
grabbed = false;
|
grabbed = false;
|
||||||
|
|
||||||
|
if (fabs (last_motion.second - grab_at.second) < 4) {
|
||||||
|
/* just a click */
|
||||||
|
|
||||||
|
cerr << "just a click! " << last_motion.first << " grab at " << grab_at.first << endl;
|
||||||
|
|
||||||
|
if (_seq.mode() == SequencerGrid::Velocity) {
|
||||||
|
_step.set_velocity (1.0);
|
||||||
|
} else if (_seq.mode() == SequencerGrid::Octave) {
|
||||||
|
if (ev->button == 1) {
|
||||||
|
adjust_step_octave (1);
|
||||||
|
} else if (ev->button == 3) {
|
||||||
|
adjust_step_octave (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ class StepView : public ArdourCanvas::Rectangle, public sigc::trackable {
|
||||||
SequencerGrid& _seq;
|
SequencerGrid& _seq;
|
||||||
ArdourCanvas::Text* text;
|
ArdourCanvas::Text* text;
|
||||||
bool grabbed;
|
bool grabbed;
|
||||||
|
bool grab_motion;
|
||||||
|
|
||||||
std::pair<double,double> grab_at;
|
std::pair<double,double> grab_at;
|
||||||
std::pair<double,double> last_motion;
|
std::pair<double,double> last_motion;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue