if( ggLockLen.isLocked() ) {
n2 = n + span.getLength();
if( n2 > doc.timeline.getLength() ) {
n2 = doc.timeline.getLength();
n = n2 - span.getLength();
ggTimelineStart.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n, n2 );
ggTimelineStop.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
} else {
n2 = span.getStop();
if( n > n2 ) {
n = n2;
ggTimelineStart.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n, n2 );
ggTimelineLen.setValue( new Param( span.getLength(), ParamSpace.spcTimeSmps.unit ));
}
// ----- stop was adjusted -----
} else if( e.getSource() == ggTimelineStop ) {
if( ggLockLen.isLocked() ) {
n2 = n - span.getLength();
if( n2 < 0 ) {
n2 = 0;
n = n2 + span.getLength();
ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
if( n > doc.timeline.getLength() ) {
n = doc.timeline.getLength();
n2 = n - span.getLength();
ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n2, n );
ggTimelineStart.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
} else {
n2 = span.getStart();
if( n < n2 ) {
n = n2;
ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
if( n > doc.timeline.getLength() ) {
n = doc.timeline.getLength();
ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n2, n );
ggTimelineLen.setValue( new Param( span.getLength(), ParamSpace.spcTimeSmps.unit ));
}
// ----- len was adjusted -----
} else {
if( ggLockStop.isLocked() ) {
n2 = span.getStop() - n;
if( n2 < 0 ) {
n2 = 0;
n = span.getStop();
ggTimelineLen.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n2, n2 + n );
ggTimelineStart.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
} else {
n2 = span.getStart() + n;
if( n2 > doc.timeline.getLength() ) {
n2 = doc.timeline.getLength();
n = n2 - span.getStart();
ggTimelineLen.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
}
span = new Span( n2 - n, n2 );
ggTimelineStop.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
}
}
doc.timeline.editSelect( this, span );
}
}