{
final int result;
final Param positionSmps;
final Box msgPane;
final DefaultUnitTranslator timeTrans;
final ParamField ggPosition;
// final JComboBox ggPosCombo;
final Application app = AbstractApplication.getApplication();
msgPane = Box.createVerticalBox();
// XXX sync
timeTrans = new DefaultUnitTranslator();
ggPosition = new ParamField( timeTrans );
ggPosition.addSpace( ParamSpace.spcTimeHHMMSS );
ggPosition.addSpace( ParamSpace.spcTimeSmps );
ggPosition.addSpace( ParamSpace.spcTimeMillis );
ggPosition.addSpace( ParamSpace.spcTimePercentF );
timeTrans.setLengthAndRate( doc.timeline.getLength(), doc.timeline.getRate() ); // XXX sync
if( value != null ) {
ggPosition.setSpace( space );
ggPosition.setValue( value );
}
// ggPosition.setValue( position );
// lbCurrentTime = new TimeLabel( new Color( 0xE0, 0xE0, 0xE0 ));
// ggPosition.setBorder( new ComboBoxEditorBorder() );
// ggPosCombo = new JComboBox();
// ggPosCombo.setEditor( ggPosition );
// ggPosCombo.setEditable( true );
// msgPane.gridAdd( ggPosCombo, 0, 1, -1, 1 );
msgPane.add( Box.createVerticalGlue() );
// msgPane.add( ggPosCombo );
JButton ggCurrent = new JButton( app.getResourceString( "buttonSetCurrent" )); // "Current"
ggCurrent.setFocusable( false );
//JLabel lbArrow = new JLabel( "\u2193" ); // "\u2939"
//Box b = Box.createHorizontalBox();
//b.add( lbArrow );
//b.add( ggCurrent );
ggCurrent.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ae )
{
final long pos = transport.isRunning() ? transport.getCurrentFrame() : doc.timeline.getPosition();
ggPosition.setValue( new Param( pos, ParamSpace.TIME | ParamSpace.SMPS )); // XXX sync
ggPosition.requestFocusInWindow();
}
});
//msgPane.add( b );
msgPane.add( ggCurrent );
msgPane.add( ggPosition );
msgPane.add( Box.createVerticalGlue() );
GUIUtil.setInitialDialogFocus( ggPosition );
// ggPosCombo.removeAllItems();
// // XXX sync
// ggPosCombo.addItem( new StringItem( new Param( doc.timeline.getPosition() / doc.timeline.getRate(), ParamSpace.TIME | ParamSpace.SECS | ParamSpace.HHMMSS ).toString(), "Current" ));
final JOptionPane op = new JOptionPane( msgPane, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION );
// result = JOptionPane.showOptionDialog( BasicWindowHandler.getWindowAncestor( lbTime ), msgPane,
// app.getResourceString( "inputDlgGoToTime" ),
// JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null );
result = BasicWindowHandler.showDialog( op, BasicWindowHandler.getWindowAncestor( lbTime ), app.getResourceString( "inputDlgGoToTime" ));
if( result == JOptionPane.OK_OPTION ) {
value = ggPosition.getValue();
space = ggPosition.getSpace();
positionSmps = timeTrans.translate( value, ParamSpace.spcTimeSmps );
doc.timeline.editPosition( this,
Math.max( 0, Math.min( doc.timeline.getLength(),
(long) positionSmps.val )));
}