Package de.sciss.app

Examples of de.sciss.app.Application


    super( SUPPORT );
       
    setTitle( getResourceString( "framePrefs" ));

    final Container          cp          = getContentPane();
    final Application        app          = AbstractApplication.getApplication();
//    final ActionListener      lafActionListener;
    final OSCRoot          osc;
    final PrefCacheManager      cm;
    final Flag            haveWarned      = new Flag( false );
    final String          txtWarnLookAndFeel  = getResourceString( "warnLookAndFeelUpdate" );

    final TreeExpanderButton    ggTreeAudio;
    final List            collAudioAdvanced;
    SpringPanel            tab;
    PrefParamField          ggParam;
    BasicPathField          ggPath;
    PrefCheckBox          ggCheckBox;
        PrefComboBox          ggChoice;
    JTabbedPane            ggTabPane;
    JLabel              lb;
    JComboBox            ggCombo;
        UIManager.LookAndFeelInfo[]    lafInfos;
    Box                b;

    Preferences            prefs;
    String              key, key2, title;
    int                row;

    ggTabPane  = new JTabbedPane();

    // ---------- global pane ----------

    tab    = createTab();

    row    = 0;
    prefs   = IOUtil.getUserPrefs();
    key    = IOUtil.KEY_TEMPDIR;
    key2  = "prefsTmpDir";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath  = new BasicPathField( PathField.TYPE_FOLDER, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
    tab.gridAdd( ggPath, 1, row );

    row++;
    cm    = PrefCacheManager.getInstance();
    prefs   = cm.getPreferences();
    key    = PrefCacheManager.KEY_ACTIVE;
    key2  = "prefsCache";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggCheckBox = new PrefCheckBox( getResourceString( "prefsCacheActive" ));
    ggCheckBox.setPreferences( prefs, key );
//    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    b    = Box.createHorizontalBox();
    b.add( ggCheckBox );
//
//    row++;
    key    = PrefCacheManager.KEY_CAPACITY;
    key2  = "prefsCacheCapacity";
    lb    = new JLabel( getResourceString( key2 ) + " [" +
                getResourceString( "labelMegaBytes" ) + "]", TRAILING );
//    tab.gridAdd( lb, 0, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
//    tab.gridAdd( ggParam, 1, row, -1, 1 );
    b.add( ggParam );
    tab.gridAdd( b, 1, row, -1, 1 );

    row++;   
    key    = PrefCacheManager.KEY_FOLDER;
    key2  = "prefsCacheFolder";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath  = new BasicPathField( PathField.TYPE_FOLDER, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
    tab.gridAdd( ggPath, 1, row );

    row++;
    prefs   = app.getUserPrefs();
        key     = PrefsUtil.KEY_LOOKANDFEEL;
    key2  = "prefsLookAndFeel";
    title  = getResourceString( key2 );
    lb    = new JLabel( title, TRAILING );
    tab.gridAdd( lb, 0, row );
    ggChoice = new PrefComboBox();
    lafInfos = UIManager.getInstalledLookAndFeels();
        for( int i = 0; i < lafInfos.length; i++ ) {
            ggChoice.addItem( new StringItem( lafInfos[i].getClassName(), lafInfos[i].getName() ));
        }
    ggChoice.setPreferences( prefs, key );
    ggChoice.addActionListener( new WarnPrefsChange( ggChoice, ggChoice, haveWarned, txtWarnLookAndFeel, title ));
   
    tab.gridAdd( ggChoice, 1, row, -1, 1 );

    row++;
         key    = BasicWindowHandler.KEY_LAFDECORATION;
    key2  = "prefsLAFDecoration";
    title  = getResourceString( key2 );
    ggCheckBox  = new PrefCheckBox( title );
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

    row++;
         key    = BasicWindowHandler.KEY_INTERNALFRAMES;
    key2  = "prefsInternalFrames";
    title  = getResourceString( key2 );
    ggCheckBox  = new PrefCheckBox( title );
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

    row++;
         key    = CoverGrowBox.KEY_INTRUDINGSIZE;
    key2  = "prefsIntrudingSize";
    ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

    row++;
         key    = BasicWindowHandler.KEY_FLOATINGPALETTES;
    key2  = "prefsFloatingPalettes";
    ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

//    row++;
//    prefs   = GUIUtil.getUserPrefs();
//    key2  = "prefsKeyStrokeHelp";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
//    ggKeyStroke = new KeyStrokeTextField();
//    ggKeyStroke.setPreferences( prefs, key );
//    tab.gridAdd( ggKeyStroke, 1, row, -1, 1 );

    addTab( ggTabPane, tab, "prefsGeneral");

    // ---------- audio pane ----------

    prefs   = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    audioPrefs  = prefs;
    abPrefs  = audioPrefs.node( PrefsUtil.NODE_AUDIOBOXES );
    tab    = createTab();

    row    = 0;
    key    = PrefsUtil.KEY_SUPERCOLLIDERAPP;
    key2  = "prefsSuperColliderApp";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath = new BasicPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
//    HelpGlassPane.setHelp( ggPath, key2 );
    tab.gridAdd( ggPath, 1, row );

//    row++;
//    key    = PrefsUtil.KEY_SUPERCOLLIDEROSC;
//    key2  = "prefsSuperColliderOSC";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
//    ggText  = new PrefTextField( 32 );
//    ggText.setPreferences( prefs, key );
//    tab.gridAdd( ggText, 1, row, -1, 1 );

        row++;
        key    = PrefsUtil.KEY_AUTOBOOT;
        key2  = "prefsAutoBoot";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
        ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
        ggCheckBox.setPreferences( prefs, key );
//    HelpGlassPane.setHelp( ggCheckBox, key2 );
        tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

     row++;
        key    = PrefsUtil.KEY_AUTOPLAYFROMFINDER;
    key2  = "prefsAutoPlayFromFinder";
    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
    tab.gridAdd( lb, 0, row );
        ggChoice = new PrefComboBox();
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_NONE, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_NONE )));
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_PLAY, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_PLAY )));
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_LOOP, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_LOOP )));
        ggChoice.setPreferences( prefs, key );
        tab.gridAdd( ggChoice, 1, row, -1, 1 );

    row++;
    lb    = new JLabel( getResourceString( "labelAudioIFs" ), TRAILING );
    tab.gridAdd( lb, 0, row );
    tab.gridAdd( createAudioBoxGUI(), 1, row, 1, -1 );

    row++;
    key    = PrefsUtil.KEY_AUDIORATE;
    key2  = "prefsAudioRate";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( ParamSpace.spcFreqHertz );
    ggCombo = new JComboBox();
    for( int i = 0; i < RATE_ITEMS.length; i++ ) {
      ggCombo.addItem( RATE_ITEMS[ i ]);
    }
    ggParam.setBorder( new ComboBoxEditorBorder() );
    ggCombo.setEditor( ggParam );
    ggCombo.setEditable( true );
    ggParam.setPreferences( prefs, key ); // important to be _afer_ setEditor because otherwise prefs get overwritten!
//    ggCombo.setSelectedIndex( 0 ); // DEFAULT_RATE
//ggParam.setPreferredSize( new Dimension( ggParam.getPreferredSize().width, Math.max( 24, ggParam.getPreferredSize().height )));
//ggCombo.setPreferredSize( new Dimension( ggCombo.getPreferredSize().width, Math.max( 24, ggCombo.getPreferredSize().height )));
    tab.gridAdd( ggCombo, 1, row, -1, 1 );

    row++;
    b  = Box.createHorizontalBox();
    b.add( Box.createHorizontalGlue() );
    ggTreeAudio  = new TreeExpanderButton();
    b.add( ggTreeAudio );
    b.add( new JLabel( getResourceString( "prefsAdvanced" )));
    tab.gridAdd( b, 0, row );

    collAudioAdvanced = new ArrayList();

    row++;
    key2  = "prefsSuperColliderOSC";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    key    = PrefsUtil.KEY_SCPROTOCOL;
    key2  = "prefsOSCProtocol";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 2, row );
    b    = Box.createHorizontalBox();
    b.add( Box.createHorizontalStrut( 4 ));
    b.add( lb );
    ggChoice = new PrefComboBox();
    ggChoice.addItem( new StringItem( OSCChannel.TCP, "TCP" ));
    ggChoice.addItem( new StringItem( OSCChannel.UDP, "UDP" ));
    ggChoice.setPreferences( prefs, key );
//    tab.gridAdd( ggChoice, 3, row, -1, 1 );
    b.add( ggChoice );

    key    = PrefsUtil.KEY_SCPORT;
    key2  = "prefsOSCPort";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 4, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromZero );
    ggParam.setPreferences( prefs, key );
//    tab.gridAdd( ggParam, 5, row, -1, 1 );
    b.add( ggParam );
    b.setVisible( false );
    collAudioAdvanced.add( b );
    tab.gridAdd( b, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_SCBLOCKSIZE;
    key2  = "prefsSCBlockSize";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_AUDIOBUSSES;
    key2  = "prefsAudioBusses";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );
//    pAudio.makeCompactGrid();
//    pAudio.setVisible( false );

    row++;
    key    = PrefsUtil.KEY_SCMEMSIZE;
    key2  = "prefsSCMemSize";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_SCRENDEZVOUS;
    key2  = "prefsSCRendezvous";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggCheckBox  = new PrefCheckBox();
    ggCheckBox.setPreferences( prefs, key );
    ggCheckBox.setVisible( false );
    collAudioAdvanced.add( ggCheckBox );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

final SpringPanel tabAudio = tab;
    ggTreeAudio.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final int    width  = getWindow().getWidth();
        final int    height  = getWindow().getHeight();
        final boolean  visible  = ggTreeAudio.isExpanded();
        int        delta  = 0;
        int        d2;
       
        for( int i = 0; i < collAudioAdvanced.size(); ) {
          d2 = 0;
          for( int j = i + 2; i < j; i++ ) {
            d2 = Math.max( d2, ((JComponent) collAudioAdvanced.get( i )).getPreferredSize().height );
          }
          delta = delta + d2 + 2;
        }

        for( int i = 0; i < collAudioAdvanced.size(); i++ ) {
          ((JComponent) collAudioAdvanced.get( i )).setVisible( visible );
        }
        tabAudio.makeCompactGrid();
        getWindow().setSize( width, height + (visible ? delta : -delta ));
      }
    });

    addTab( ggTabPane, tab, "prefsAudio" );

    // ---------- osc pane ----------

    tab    = createTab();

    row    = 0;
    osc    = OSCRoot.getInstance();
    prefs   = osc.getPreferences();
    key    = OSCRoot.KEY_ACTIVE;
//    key2  = "prefsOSCActive";
    key2  = "prefsOSCServer";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    b    = Box.createHorizontalBox();
    ggCheckBox = new PrefCheckBox( getResourceString( "prefsOSCActive" ));
    ggCheckBox.setPreferences( prefs, key );
//    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    b.add( ggCheckBox );

    key    = OSCRoot.KEY_PROTOCOL;
    key2  = "prefsOSCProtocol";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 2, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggChoice = new PrefComboBox();
    ggChoice.addItem( new StringItem( OSCChannel.TCP, "TCP" ));
    ggChoice.addItem( new StringItem( OSCChannel.UDP, "UDP" ));
    ggChoice.setPreferences( prefs, key );
//    tab.gridAdd( ggChoice, 3, row, -1, 1 );
    b.add( ggChoice );

    key    = OSCRoot.KEY_PORT;
    key2  = "prefsOSCPort";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 4, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromZero );
    ggParam.setPreferences( prefs, key );
//    tab.gridAdd( ggParam, 5, row, -1, 1 );
    b.add( ggParam );
    tab.gridAdd( b, 1, row, -1, 1 );

    row++;
    key    = OSCGUI.KEY_SWINGAPP;
    key2  = "prefsOSCSwingApp";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath = new BasicPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
    tab.gridAdd( ggPath, 1, row );

    addTab( ggTabPane, tab, "prefsOSC" );

    // ---------- view pane ----------

    prefs   = app.getUserPrefs().node( PrefsUtil.NODE_VIEW );
    tab    = createTab();
   
    row    = 0;
    key    = PrefsUtil.KEY_SONAENABLED;
//    lb    = new JLabel( "Enable Sonagramme Option (Experimental!)", TRAILING );
//    tab.gridAdd( lb, 0, row );
    ggCheckBox = new PrefCheckBox( "Enable Sonagramme Option (Experimental!)" );
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 0, row, 2, 1 );

    row++;
    tab.gridAdd( new JLabel( " " ), 0, row );

    row++;
    key    = PrefsUtil.NODE_SONAGRAM;
    key2  = "prefsSonaSettings";
    lb    = new JLabel( getResourceString( key2 ), CENTER );
    tab.gridAdd( lb, 0, row, 2, 1 );
    row++;
    final ConstQPane prefConstQ = new ConstQPane();
    prefConstQ.setPreferences( prefs.node( key ));
    tab.gridAdd( prefConstQ, 0, row, -1, 1 );
   
    addTab( ggTabPane, tab, "prefsView" );

    // ---------- generic gadgets ----------

    cp.add( ggTabPane, BorderLayout.CENTER );
    AbstractWindowHandler.setDeepFont( cp );

    // ---------- listeners ----------

    addListener( new AbstractWindow.Adapter() {
      public void windowClosing( AbstractWindow.Event e )
      {
        setVisible( false );
        dispose();
      }
    });

    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
    init();
    app.addComponent( Main.COMP_PREFS, this );
    }
View Full Code Here


 
  private boolean                listening    = false;

  public AudioTrackPanorama( final AudioTrack t, SessionCollection tracks )
  {
    final Application  app      = AbstractApplication.getApplication();
   
    audioPrefs  = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );

    this.t    = t;
//    this.lm    = lm;
//    this.doors  = doors;
    this.tracks  = tracks;
View Full Code Here

  private void createPalette()
  {
    if( palette != null ) return;
    if( popup != null ) destroyPopup();

    final Application  app      = AbstractApplication.getApplication();
 
    palette = new AppWindow( AbstractWindow.PALETTE );
    palette.setTitle( app.getResourceString( "palettePanorama" ) + " : " + t.getName() );
    createPanPan();
       palette.getContentPane().add( CoverGrowBox.create(), BorderLayout.SOUTH );
    palette.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
    palette.addListener( new AbstractWindow.Adapter() {
      public void windowClosing( AbstractWindow.Event e )
View Full Code Here

  public ControlRoomFrame()
  {
    super( PALETTE );
   
    final Application app = AbstractApplication.getApplication();
 
    superCollider    = SuperColliderClient.getInstance();
    lmm          = new PeakMeterManager( superCollider.getMeterManager() );
 
    setTitle( app.getResourceString( "paletteCtrlRoom" ));
    setResizable( false );

    final Container      cp        = getContentPane();
    final JPanel      b2        = new JPanel( new BorderLayout() ); // Box.createHorizontalBox();
    final MultiStateButton  ggLimiter;
    audioPrefs                = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    final Object      comboProto    = "XXXXXXXX";

    b1        = new SpringPanel( 2, 4, 2, 4 );
    lmm.setDynamicComponent( b1 );
    ggVolume    = new VolumeFader();
    ggOutputConfig  = new PrefComboBox();
    ggOutputConfig.putClientProperty( "JComboBox.isSquare", Boolean.TRUE );
    ggAudioBox    = new PrefComboBox();
    ggAudioBox.putClientProperty( "JComboBox.isSquare", Boolean.TRUE );
    ggOutputConfig.setPrototypeDisplayValue( comboProto );
    ggAudioBox.setPrototypeDisplayValue( comboProto );
    refillConfigs();
    ggOutputConfig.setPreferences( audioPrefs, PrefsUtil.KEY_OUTPUTCONFIG );
    ggAudioBox.setPreferences( audioPrefs, PrefsUtil.KEY_AUDIOBOX );
    audioBoxListener = new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final Server server = superCollider.getServer();
        if( (server != null) && server.isRunning() ) {
          final JOptionPane op = new JOptionPane( getResourceString( "optionDlgAudioBoxReboot" ), JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION );
          if( BasicWindowHandler.showDialog( op, getWindow(), null ) == 0 ) {
            superCollider.reboot();
          }
        }
      }
    };
   
    ggVolume.addChangeListener( new ChangeListener() {
      public void stateChanged( ChangeEvent e ) {
        superCollider.setVolume( ControlRoomFrame.this, ggVolume.getVolumeLinear() );
      }
    });
   
    ggLimiter = new MultiStateButton();
    ggLimiter.setNumColumns( 8 );
    ggLimiter.addItem( "Limiter" );
// NOTE: BUG WITH CUSTOM COMPOSITE ON WIN-XP!!!
//    ggLimiter.addItem( "Limiter", null, new Color( 0xFF, 0xFA, 0x9D ), new Color( 0xFA, 0xE7, 0x9D ));
ggLimiter.addItem( "Limiter", null, new Color( 0xFF, 0xFA, 0x9D ));
    ggLimiter.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ) {
        superCollider.setLimiter( ggLimiter.getSelectedIndex() == 1 );
      }
    });
    if( superCollider.getLimiter() ) ggLimiter.setSelectedIndex( 1 );
   
    pmg  = new PeakMeterPanel();
    pmg.setBorder( true );
    pmg.setCaption( true );
    oCfg = superCollider.getOutputConfig();
    rebuildMeters();
   
    b2.add( pmg, BorderLayout.WEST );
    b2.add( ggVolume, BorderLayout.EAST );
   
    b1.gridAdd( ggLimiter, 0, 0, -1, 1 );
    b1.gridAdd( b2, 0, 1, -1, 1 );
    b1.gridAdd( ggOutputConfig, 0, 2, -1, 1 );
    b1.gridAdd( ggAudioBox, 0, 3, -1, 1 );
    b1.makeCompactGrid();

    cp.add( b1, BorderLayout.CENTER );

    AbstractWindowHandler.setDeepFont( b1 );

    // ---- listeners -----

    addListener( new AbstractWindow.Adapter() {
      public void windowOpened( AbstractWindow.Event e )
      {
        startListening();
      }

      public void windowClosing( AbstractWindow.Event e )
      {
        setVisible( false );
        dispose();
      }
    });

//    DISPOSE_ON_CLOSE doesn't work: the BasicFrame doesn't catch
//    the visible preferences. instead we hide and then dispose the window!
//    setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );

    updateVolume();

    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); // window listener see above!
    init();
    app.addComponent( Main.COMP_CTRLROOM, this );
  }
View Full Code Here

   */
  public ObserverPalette()
  {
    super( PALETTE );
   
    final Application app = AbstractApplication.getApplication();
 
    setTitle( app.getResourceString( "paletteObserver" ));
// EEE
//    setResizable( false );
   
    final Container    cp    = getContentPane();
    JPanel        c;
    SpringPanel      p;
    JLabel        lb;
    GridBagLayout    lay;
    GridBagConstraints  con;

    ggTabPane = new JTabbedPane();
        ggTabPane.setTabLayoutPolicy( JTabbedPane.WRAP_TAB_LAYOUT );

    // ----- cursor tab ------
    c        = new JPanel();
    lay        = new GridBagLayout();
    con        = new GridBagConstraints();
    con.insets    = new Insets( 2, 2, 2, 2 );
    c.setLayout( lay );
    con.weightx    = 1.0;
    con.gridwidth   = GridBagConstraints.REMAINDER;
    lbCursorInfo  = new JLabel[ NUM_CURSOR_ROWS ];
    for( int i = 0; i < NUM_CURSOR_ROWS; i++ ) {
      lb      = new JLabel();
      lay.setConstraints( lb, con );
      c.add( lb );
      lbCursorInfo[i] = lb;
    }
    ggTabPane.addTab( app.getResourceString( "observerCursor" ), null, c, null );
       
    // ----- session objects tab ------
    for( int i = 0; i < 3; i++ ) {
      c        = new JPanel();
      lay        = new GridBagLayout();
      con        = new GridBagConstraints();
      con.insets    = new Insets( 2, 2, 2, 2 );
      c.setLayout( lay );
      lb        = new JLabel( app.getResourceString( "labelName" ), JLabel.RIGHT );
      con.weightx    = 0.0;
      con.gridwidth   = 1;
      lay.setConstraints( lb, con );
      c.add( lb );
      ggNames[ i = new JTextField( 12 );
      con.weightx    = 1.0;
      con.gridwidth   = GridBagConstraints.REMAINDER;
      lay.setConstraints( ggNames[ i ], con );
      lb.setLabelFor( ggNames[ i ]);
      c.add( ggNames[ i ]);
      con.fill    = GridBagConstraints.BOTH;
      con.weighty    = 1.0;
      ggTables[ i = new SessionObjectTable();
      lay.setConstraints( ggTables[ i ], con );
      c.add( ggTables[ i ]);
      ggTabPane.addTab( app.getResourceString( TAB_NAMES[ i ]), null, c, null );
//      HelpGlassPane.setHelp( c, HELP_NAMES[ i ]);  // EEE
     
//      switch( i ) {
//      case 0:
//        scSel  = doc.selectedReceivers;
//        scAll  = doc.receivers;
//        break;
//      case 1:
//        scSel  = doc.selectedTransmitters;
//        scAll  = doc.transmitters;
//        break;
//      case 2:
//        scSel  = doc.selectedGroups;
//        scAll  = doc.groups;
//        break;
//      default:
//        assert false : i;
//        scSel  = null;
//        scAll  = null;
//        break;
//      }
//     
//      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 );
    ggTimelineStart.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineStart.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineStart.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineStart.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineStart.addListener( this );
    p.gridAdd( ggTimelineStart, 2, 0 );
    lb.setLabelFor( ggTimelineStart );
   
    ggLockStop    = new LockButton( true );
    ggLockStop.addActionListener( this );
    p.gridAdd( ggLockStop, 0, 1 );
    lb        = new JLabel( app.getResourceString( "observerStop" ), RIGHT );
    p.gridAdd( lb, 1, 1 );
    ggTimelineStop  = new ParamField( timeTrans );
    ggTimelineStop.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineStop.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineStop.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineStop.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineStop.addListener( this );
    p.gridAdd( ggTimelineStop, 2, 1 );
    lb.setLabelFor( ggTimelineStop );

    ggLockLen    = new LockButton( true );
    ggLockLen.addActionListener( this );
    p.gridAdd( ggLockLen, 0, 2 );
    lb        = new JLabel( app.getResourceString( "observerLen" ), RIGHT );
    p.gridAdd( lb, 1, 2 );
    ggTimelineLen  = new ParamField( timeTrans );
    ggTimelineLen.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineLen.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineLen.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineLen.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineLen.addListener( this );
    p.gridAdd( ggTimelineLen, 2, 2 );
    lb.setLabelFor( ggTimelineLen );
   
    p.makeCompactGrid( false, false );
    ggTabPane.addTab( app.getResourceString( "observerTimeline" ), null, p, null );
    cp.add( BorderLayout.CENTER, ggTabPane );
   
    AbstractWindowHandler.setDeepFont( ggTabPane );
   
    // --- Listener ---
        addDynamicListening( this );
   
    app.getDocumentHandler().addDocumentListener( this );

    addListener( new AbstractWindow.Adapter() {
      public void windowClosing( AbstractWindow.Event e )
      {
        dispose();
      }
    });
    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); // window listener see above!
   
    setPreferredSize( new Dimension( 272, 180 ));
   
    init();
    app.addComponent( Main.COMP_OBSERVER, this );
  }
View Full Code Here

  public TableLookupReceiverEditor( Session doc )
  {
    super( doc );
   
    final Application  app  = AbstractApplication.getApplication();
    JPopupMenu      distancePopup, rotationPopup;
    Box          box;
    VectorSpace      distanceSpace, rotationSpace;

    msgCursorDist  = new MessageFormat( app.getResourceString( "rcvEditDistMsg" ), Locale.US );   // XXX
    msgCursorRot  = new MessageFormat( app.getResourceString( "rcvEditRotMsg" ), Locale.US );   // XXX
    msgCursorSense  = new MessageFormat( app.getResourceString( "rcvEditSenseMsg" ), Locale.US );   // XXX

    distanceSpace  = VectorSpace.createLinSpace( 0.0, 1.0, 0.0, 2.0,
                     app.getResourceString( "rcvEditDistance" ), null, null, null );

    distHAxis    = new Axis( Axis.HORIZONTAL, Axis.FIXEDBOUNDS );
    distHAxis.setSpace( distanceSpace );
    distVAxis    = new Axis( Axis.VERTICAL, Axis.FIXEDBOUNDS );
    distVAxis.setSpace( distanceSpace );
    box        = Box.createHorizontalBox();
    box.add( Box.createHorizontalStrut( distVAxis.getPreferredSize().width ));
    box.add( distHAxis );
   
    distanceEditor = new VectorEditor();
    distanceEditor.setSpace( null, distanceSpace );
    distancePopup  = VectorTransformer.createPopupMenu( distanceEditor );

    padPanel1 = new JPanel( new BorderLayout() );
    padPanel1.add( BorderLayout.CENTER, distanceEditor );
    padPanel1.add( box, BorderLayout.NORTH );
    padPanel1.add( distVAxis, BorderLayout.WEST );
//    padPanel1.setBorder( BorderFactory.createMatteBorder( 4, 4, 2, 4, Color.white ));

    rotationSpace  = VectorSpace.createLinSpace( 0.0, 360.0, 0.0, 2.0,
                     app.getResourceString( "rcvEditRotation" ), null, null, null );

    rotHAxis    = new Axis( Axis.HORIZONTAL, Axis.FIXEDBOUNDS );
    rotHAxis.setSpace( rotationSpace );
    rotVAxis    = new Axis( Axis.VERTICAL, Axis.FIXEDBOUNDS );
    rotVAxis.setSpace( rotationSpace );
View Full Code Here

    final JSplitPane    split2  = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
    final JPanel      sp    = new JPanel( new BorderLayout() );
//    final VectorSpace    space  = VectorSpace.createLinSpace( 0.0, 1.0, 0.0, 1.0, null, null, null, null );  // XXX
    final VectorSpace    space  = VectorSpace.createLinSpace( -1.0, 1.0, -1.0, 1.0, null, null, null, null )// XXX
    final SurfaceToolBar  stb    = new SurfaceToolBar( doc );
    final Application    app    = AbstractApplication.getApplication();
    final JPanel      gp    = GUIUtil.createGradientPanel();

    setTitle( app.getResourceString( "frameSurface" ));

    stb.setOpaque( false );
    gp.add( stb );
    haxisBox  = Box.createHorizontalBox();
    haxis    = new Axis( Axis.HORIZONTAL, Axis.FIXEDBOUNDS );
    vaxis    = new Axis( Axis.VERTICAL, /* Axis.MIRROIR | */ Axis.FIXEDBOUNDS );
    surface    = new SurfacePane( root, doc );
    surface.addComponentListener( new ComponentAdapter() {
      public void componentResized( ComponentEvent e )
      {
        Dimension d = surface.getSize();
        if( d.width != d.height ) {
          int diam = Math.min( d.width, d.height );
          surface.setSize( diam, diam );
        }
        haxis.setSize( d.width, haxis.getHeight() );
        vaxis.setSize( vaxis.getWidth(), d.height );
      }
    });
    stb.addToolActionListener( surface );

    cp.setLayout( new BorderLayout() );
//    split.setLeftComponent( new JScrollPane( new SessionGroupTable( root, doc, doc,
//      SessionGroupTable.VIEW_RECEIVERS )));
    split2.setTopComponent( new SessionGroupTable( doc, doc,
      SessionGroupTable.VIEW_RECEIVERS | SessionGroupTable.VIEW_FLAGS ));
    split2.setBottomComponent( new SessionGroupTable( doc, doc, SessionGroupTable.VIEW_GROUPS | SessionGroupTable.VIEW_FLAGS ));
//        HelpGlassPane.setHelp( split2, "SurfaceObjectTables" );  // EEE

    haxis.setSpace( space );
    vaxis.setSpace( space );
//    haxis.setVisible( false );
//    vaxis.setVisible( false );
//    strut.setVisible( false );
    haxisBox.add( Box.createHorizontalStrut( vaxis.getPreferredSize().width ));
    haxisBox.add( haxis );
    sp.add( haxisBox, BorderLayout.NORTH );
    sp.add( vaxis, BorderLayout.WEST );
    sp.add( surface, BorderLayout.CENTER );

    split.setLeftComponent( split2 );
    split.setRightComponent( sp );
    split.setOneTouchExpandable( true );
    split.setContinuousLayout( false );
//    split.setLastDividerLocation( 120 );
    split.setDividerLocation( 80 );    // this will be the size when using one-touch-expansion
    split.setDividerLocation( 0 );    // when showing up, the group component is hidden
//    split.setDividerSize( 4 );
    cp.add( split, BorderLayout.CENTER );
    cp.add( gp, BorderLayout.NORTH );
        if( app.getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
            cp.add( Box.createVerticalStrut( 16 ), BorderLayout.SOUTH );
        }

    // -------

//        addListener( new AbstractWindow.Adapter() {
//      public void windowClosing( AbstractWindow.Event e )
//      {
//        dispose();
//      }
//    });
//    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); // window listener see above!

//        HelpGlassPane.setHelp( getRootPane(), "SurfaceFrame" ); // EEE
    AbstractWindowHandler.setDeepFont( cp );
       
        addDynamicListening( new DynamicPrefChangeManager( app.getUserPrefs().node( PrefsUtil.NODE_SHARED ),
      new String[] { PrefsUtil.KEY_VIEWRULERS }, this ));
   
        init();
    app.addComponent( Main.COMP_SURFACE, this );
  }
View Full Code Here

   @synchronization  waitShared on DOOR_RCV
   */
  private boolean editCopy()
  {
    final List      v    = new ArrayList();
    final Application  app    = AbstractApplication.getApplication();
    Object        o;
    Receiver      rcv;
    List        collSelection;
    boolean        success = false;

    try {
      doc.bird.waitShared( Session.DOOR_RCV );
      collSelection   = doc.getSelectedReceivers().getAll();
      for( int i = 0; i < collSelection.size(); i++ ) {
        o = collSelection.get( i );
        if( o instanceof Transferable ) {
          if( ((Transferable) o).isDataFlavorSupported( Receiver.receiverFlavor )) {
            rcv = (Receiver) ((Transferable) o).getTransferData( Receiver.receiverFlavor );
            v.add( rcv );
          }
        }
      }
      if( !v.isEmpty() ) {
        app.getClipboard().setContents( new TransferableCollection( v ), this );
      }
      success = true;
    }
    catch( IllegalStateException e1 ) {
      System.err.println( AbstractApplication.getApplication().getResourceString( "errClipboard" ));
View Full Code Here

    Point2D              pt, pt2;
    boolean              success  = false;
    boolean              retry;
    AbstractCompoundEdit      edit;
    Object[]            args;
    final Application        app    = AbstractApplication.getApplication();
 
    try {
      t = app.getClipboard().getContents( this );
      if( t == null ) return false;
     
      if( t.isDataFlavorSupported( TransferableCollection.collectionFlavor )) {
        coll = (java.util.List) t.getTransferData( TransferableCollection.collectionFlavor );
      } else if( t.isDataFlavorSupported( Receiver.receiverFlavor )) {
View Full Code Here

  private void createPalette()
  {
    if( palette != null ) return;
    if( popup != null ) destroyPopup();

    final Application  app      = AbstractApplication.getApplication();
 
    palette = new AppWindow( AbstractWindow.PALETTE );
    palette.setTitle( app.getResourceString( "inputDlgSetBlendSpan" ));
    createBlendPan( false );
       palette.getContentPane().add( CoverGrowBox.create(), BorderLayout.SOUTH );
    palette.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
    palette.addListener( new AbstractWindow.Adapter() {
      public void windowClosing( AbstractWindow.Event e )
View Full Code Here

TOP

Related Classes of de.sciss.app.Application

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.