Package de.sciss.util

Examples of de.sciss.util.Param


  protected void updateEditMarker()
  {
    final MarkerStake mark = doc.markers.get( editIdx );
    if( mark == null ) return;

    ggMarkPos.setValue( new Param( mark.pos, ParamSpace.TIME | ParamSpace.SMPS ));
    ggMarkName.setText( mark.name );
   
    ggEditPrev.setEnabled( editIdx > 0 );
    ggEditNext.setEnabled( (editIdx + 1) < doc.markers.getNumStakes() );
   
View Full Code Here


  }

  protected void updateButtonText()
  {
//    final Param    p;
    final Param    p    = current.duration;
    final Object  view;
    final String  text;
   
//    p = Param.fromPrefs( prefs, KEY_DURATION, null );
    if( p != null ) {
View Full Code Here

  {
    if( !java.awt.EventQueue.isDispatchThread() ) throw new IllegalMonitorStateException();
    if( !active ) return null;
   
    final long  blendLen;
    final Param  p;

    p = current.duration; // Param.fromPrefs( prefs, KEY_DURATION, null );
    if( p != null ) {
      ut.setLengthAndRate( 0, timeline.getRate() );
      blendLen  = (long) (ut.translate( p, ParamSpace.spcTimeSmps ).val + 0.5);
View Full Code Here

  public void writePrefs()
  {
    if( (prefs != null) && (key != null) ) {
      final String  prefsStr  = prefs.get( key, null );
      final Param    prefsValue  = prefsStr == null ? null : Param.valueOf( prefsStr );
      final Param    guiValue  = getValue();
      if( EventManager.DEBUG_EVENTS ) System.err.println( "@param updatePrefs : "+this.key+"; old = "+prefsValue+" --> "+guiValue );
      if( ((prefsValue == null) && (guiValue != null)) ||
        ((prefsValue != null) && ((guiValue == null) || !guiValue.equals( prefsValue ))) ) {

//System.out.println( "Write to " + prefs.absolutePath() + " key " + key + " value " + guiValue.toString() );
        prefs.put( key, guiValue.toString() );
      }
    }
  }
View Full Code Here

      return;
    }
   
    final int    prefsUnit;
    final int    sepIdx    = prefsStr.indexOf( ' ' );
    final Param    guiValue  = getValue();
    final double  prefsVal;
    Param      prefsValue;
    ParamSpace    newSpace  = null;
    boolean      switchSpace  = false;
   
    try {
      if( sepIdx >= 0 ) {
        prefsVal    = Double.parseDouble( prefsStr.substring( 0, sepIdx ));
        prefsUnit    = ParamSpace.stringToUnit( prefsStr.substring( sepIdx + 1 ));
      } else {
        prefsVal    = Double.parseDouble( prefsStr );
        prefsUnit    = guiValue.unit;  // backward compatibility to number fields
      }
     
      if( prefsUnit != guiValue.unit ) {  // see if there's another space
        for( int i = 0; i < collSpaces.size(); i++ ) {
          newSpace = (ParamSpace) collSpaces.get( i );
          if( newSpace.unit == prefsUnit ) {
            switchSpace = true;
            break;
          }
        }
        if( switchSpace ) {
          prefsValue = new Param( prefsVal, newSpace.unit );
        } else {
          prefsValue = getTranslator().translate( new Param( prefsVal, prefsUnit ), newSpace );
        }
      } else {
        prefsValue = new Param( prefsVal, prefsUnit );
      }
    }
    catch( NumberFormatException e1 ) {
      prefsValue = guiValue;
    }
 
//System.err.println( "lim : "+prefsParam );
    if( !prefsValue.equals( guiValue )) {
      // thow we filter out events when preferences effectively
      // remain unchanged, it's more clean and produces less
      // overhead to temporarily remove our ParamListener
      // so we don't produce potential loops
      if( listening && writePrefs ) this.removeListener( listener );
View Full Code Here

    }
  }
 
  public Param getValue()
  {
    return new Param( ggNumber.getNumber().doubleValue(),
              currentSpace == null ? ParamSpace.NONE : currentSpace.unit );
  }
View Full Code Here

  }
 
  public void setValue( Param newValue )
  {
    final Number oldNum    = ggNumber.getNumber();
    final Param newParam  = ut.translate( newValue, currentSpace );
    final Number newNum;

    if( currentSpace.isInteger() ) {
      newNum        = new Long( (long) newParam.val );
    } else {
View Full Code Here

      final ParamSpace oldSpace = currentSpace;
      currentSpace      = (ParamSpace) collSpaces.get( selectedIdx );

      final Number oldNum    = ggNumber.getNumber();
      final Param oldParam  = new Param( oldNum == null ?
        (oldSpace == null ? 0.0 : oldSpace.reset) : oldNum.doubleValue(),
        oldSpace == null ? ParamSpace.NONE : oldSpace.unit );
      final Param newParam  = ut.translate( oldParam, currentSpace );
      final Number newNum;

      if( currentSpace.isInteger() ) {
        newNum        = new Long( (long) newParam.val );
      } else {
View Full Code Here

    protected ActionGoToTime() { /* empty */ }

    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 );
View Full Code Here

//        if( RATES[ i ] == source.rate ) {
//          ggRate.setSelectedIndex( i );
//          break;
//        }
//      }
      ggRate.setValue( new Param( source.rate, ParamSpace.spcFreqHertz.unit ));
    }
    if( chanGroup != null ) {
      switch( source.channels ) {
      case 1:
        chanGroup.setSelected( ggMono.getModel(), true );
View Full Code Here

TOP

Related Classes of de.sciss.util.Param

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.