+ if (_quarter_note != qn) {
+ _position = _session.tempo_map().sample_at_quarter_note (qn);
+ _quarter_note = qn;
+
+ /* check that the new _position wouldn't make the current
+ length impossible - if so, change the length.
+
+ XXX is this the right thing to do?
+ */
+ if (max_samplepos - _length < _position) {
+ _last_length = _length;
+ _length = max_samplepos - _position;
+ }
+ }
+}
+
+/** A gui may need to create a region, then place it in an initial
+ * position determined by the user.
+ * When this takes place within one gui operation, we have to reset
+ * _last_position to prevent an implied move.
+ */
+void
+Region::set_initial_position (samplepos_t pos)
+{
+ if (!can_move()) {
+ return;
+ }
+