Package de.sciss.util

Examples of de.sciss.util.DefaultUnitTranslator


    public void actionPerformed( ActionEvent e )
    {
      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 )));
      }
        }
View Full Code Here


  throws IOException
  {
    prTotalSpan    = source.context.getTimeSpan();

    if( ut == null ) {
      ut = new DefaultUnitTranslator();
      ut.setLengthAndRate( prTotalSpan.getLength(), source.context.getSourceRate() );
    }
 
    final String  filterType    = prefs.get( KEY_FILTER, FILTER_MEDIAN );
    final double  threshAmp    = ut.translate( Param.fromPrefs( prefs, KEY_THRESH, paraDefThresh ), spcAmp ).val;
View Full Code Here

      lbCursorInfo[i] = lb;
    }
    ggTabPane.addTab( app.getResourceString( "observerCursor" ), null, c, null );
       
    // ----- timeline tab ------
    timeTrans    = new DefaultUnitTranslator();
   
    p        = new SpringPanel( 4, 2, 4, 2 );
    lb        = new JLabel( app.getResourceString( "observerStart" ), RIGHT );
    p.gridAdd( lb, 1, 0 );
    ggTimelineStart  = new ParamField( timeTrans );
View Full Code Here

    {
      final SpringPanel      msgPane;
      final int          result;
      final ParamField      ggDuration;
      final Param          durationSmps;
      final DefaultUnitTranslator  timeTrans;
     
      msgPane      = new SpringPanel( 4, 2, 4, 2 );
      timeTrans    = new DefaultUnitTranslator();
      ggDuration    = new ParamField( timeTrans );
      ggDuration.addSpace( ParamSpace.spcTimeHHMMSS );
      ggDuration.addSpace( ParamSpace.spcTimeSmps );
      ggDuration.addSpace( ParamSpace.spcTimeMillis );
      ggDuration.addSpace( ParamSpace.spcTimePercentF );
      msgPane.gridAdd( ggDuration, 0, 0 );
      msgPane.makeCompactGrid();
      GUIUtil.setInitialDialogFocus( ggDuration );

      timeTrans.setLengthAndRate( timeline.getLength(), timeline.getRate() );

      if( value == null ) {
        ggDuration.setValue( new Param( 1.0, ParamSpace.TIME | ParamSpace.SECS ));
      } else {
        ggDuration.setSpace( space );
        ggDuration.setValue( value );
      }

      final JOptionPane op = new JOptionPane( msgPane, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION );
//      result = JOptionPane.showOptionDialog( getFrame() == null ? null : getFrame().getWindow(), msgPane, getValue( NAME ).toString(),
//        JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null );
      result = BasicWindowHandler.showDialog( op, getFrame() == null ? null : getFrame().getWindow(), getValue( NAME ).toString() );

      if( result == JOptionPane.OK_OPTION ) {
        value      = ggDuration.getValue();
        space      = ggDuration.getSpace();
        durationSmps  = timeTrans.translate( value, ParamSpace.spcTimeSmps );
        if( durationSmps.val > 0.0 ) {
          final ProcessingThread proc;
         
          proc = initiate( timeline.getPosition(), (long) durationSmps.val );
          if( proc != null ) start( proc );
View Full Code Here

//          c.removeAncestorListener( this );
        }
      });

      // XXX sync
      timeTrans    = new DefaultUnitTranslator();
      ggMarkPos    = new ParamField( timeTrans );
      ggMarkPos.addSpace( ParamSpace.spcTimeHHMMSS );
      ggMarkPos.addSpace( ParamSpace.spcTimeSmps );
      ggMarkPos.addSpace( ParamSpace.spcTimeMillis );
      ggMarkPos.addSpace( ParamSpace.spcTimePercentF );
View Full Code Here

//     
//      new SessionCollectionListener( scSel, scAll, i + 1, ggName, ggTable, getMyRooty() );
    }

    // ----- timeline tab ------
    timeTrans    = new DefaultUnitTranslator();
   
    p        = new SpringPanel( 4, 2, 4, 2 );
    lb        = new JLabel( app.getResourceString( "observerStart" ), RIGHT );
    p.gridAdd( lb, 1, 0 );
    ggTimelineStart  = new ParamField( timeTrans );
View Full Code Here

    {
      final SpringPanel      msgPane;
      final int          result;
      final ParamField      ggDuration;
      final Param          durationSmps;
      final DefaultUnitTranslator  timeTrans;
     
      msgPane      = new SpringPanel( 4, 2, 4, 2 );
      timeTrans    = new DefaultUnitTranslator();
      ggDuration    = new ParamField( timeTrans );
      ggDuration.addSpace( ParamSpace.spcTimeHHMMSS );
      ggDuration.addSpace( ParamSpace.spcTimeSmps );
      ggDuration.addSpace( ParamSpace.spcTimeMillis );
      ggDuration.addSpace( ParamSpace.spcTimePercentF );
      msgPane.gridAdd( ggDuration, 0, 0 );
      msgPane.makeCompactGrid();
      GUIUtil.setInitialDialogFocus( ggDuration );

      timeTrans.setLengthAndRate( timeline.getLength(), timeline.getRate() );

      if( value == null ) {
        ggDuration.setValue( new Param( 60.0, ParamSpace.TIME | ParamSpace.SECS ));
      } else {
        ggDuration.setSpace( space );
        ggDuration.setValue( value );
      }

      final JOptionPane op = new JOptionPane( msgPane, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION );
//      result = JOptionPane.showOptionDialog( getFrame() == null ? null : getFrame().getWindow(), msgPane, getValue( NAME ).toString(),
//        JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null );
      result = BasicWindowHandler.showDialog( op, getTimelineFrame() == null ? null : getTimelineFrame().getWindow(), getValue( NAME ).toString() );

      if( result == JOptionPane.OK_OPTION ) {
        value      = ggDuration.getValue();
        space      = ggDuration.getSpace();
        durationSmps  = timeTrans.translate( value, ParamSpace.spcTimeSmps );
        if( durationSmps.val > 0.0 ) {
          final ProcessingThread proc;
         
          proc = initiate( timeline.getPosition(), (long) durationSmps.val );
          if( proc != null ) start( proc );
View Full Code Here

//          c.removeAncestorListener( this );
        }
      });

      // XXX sync
      timeTrans    = new DefaultUnitTranslator();
      ggMarkPos    = new ParamField( timeTrans );
      ggMarkPos.addSpace( ParamSpace.spcTimeHHMMSS );
      ggMarkPos.addSpace( ParamSpace.spcTimeSmps );
      ggMarkPos.addSpace( ParamSpace.spcTimeMillis );
      ggMarkPos.addSpace( ParamSpace.spcTimePercentF );
View Full Code Here

 
  private boolean              comboGate    = true;

  public ParamField()
  {
    this( new DefaultUnitTranslator() );
  }
View Full Code Here

    public void actionPerformed( ActionEvent e )
    {
      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 )));
      }
        }
View Full Code Here

TOP

Related Classes of de.sciss.util.DefaultUnitTranslator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.