+/*
+ Copyright (C) 2012 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#include "ardour/midi_track.h"
#include "ardour/midi_region.h"
#include "ardour/tempo.h"
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
- step_editor->set_position (WIN_POS_MOUSE);
step_editor->present ();
}
frames_from_start = 0;
}
- step_edit_beat_pos = step_edit_region_view->frames_to_beats (frames_from_start);
+ step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (frames_from_start);
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
StepEditor::step_editor_hidden (GdkEventAny*)
{
step_editor_hide ();
- return true;
+ return true; // XXX remember position ?!
}
void
{
if (beats > 0.0) {
step_edit_beat_pos = min (step_edit_beat_pos + beats,
- step_edit_region_view->frames_to_beats (step_edit_region->length()));
+ step_edit_region_view->region_frames_to_region_beats (step_edit_region->length()));
} else if (beats < 0.0) {
- if (beats < step_edit_beat_pos) {
+ if (-beats < step_edit_beat_pos) {
step_edit_beat_pos += beats; // its negative, remember
} else {
step_edit_beat_pos = 0;
assert (step_edit_region);
assert (step_edit_region_view);
- if (beat_duration == 0.0) {
+ if (beat_duration == 0.0 && step_editor) {
+ beat_duration = step_editor->note_length();
+ } else if (beat_duration == 0.0) {
bool success;
beat_duration = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
/* make sure its visible on the horizontal axis */
- framepos_t fpos = step_edit_region->position() +
- step_edit_region_view->beats_to_frames (step_edit_beat_pos + beat_duration);
+ framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
- if (fpos >= (_editor.leftmost_position() + _editor.current_page_frames())) {
- _editor.reset_x_origin (fpos - (_editor.current_page_frames()/4));
+ if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
+ _editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
}
Evoral::MusicalTime at = step_edit_beat_pos;
return;
}
- framepos_t fpos = step_edit_region->position() +
- step_edit_region_view->beats_to_frames (step_edit_beat_pos);
+ framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos);
fpos = _session->tempo_map().round_to_bar (fpos, 1);
- step_edit_beat_pos = ceil (step_edit_region_view->frames_to_beats (fpos - step_edit_region->position()));
+ step_edit_beat_pos = ceil (step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()));
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
{
step_edit_region_connection.disconnect ();
_track->playlist()->RegionRemoved.connect (step_edit_region_connection, invalidator (*this),
- ui_bind (&StepEditor::region_removed, this, _1),
+ boost::bind (&StepEditor::region_removed, this, _1),
gui_context());
}