Package de.sciss.app

Examples of de.sciss.app.Application


  public MainFrame()
  {
    super( REGULAR );
   
    final Application  app  = AbstractApplication.getApplication();
//    final WindowHandler wh  = app.getWindowHandler();
//   
//    win  = wh.createWindow( 0 );

    superCollider  = SuperColliderClient.getInstance();
   
    if( app.getWindowHandler().usesInternalFrames() ) {
      setTitle( app.getResourceString( "frameMain" ));
      ((JInternalFrame) getWindow()).setClosable( false );
    } else {
      setTitle( app.getName() + " : " + app.getResourceString( "frameMain" ));
    }
   
    final Container          cp        = getContentPane();
    final Box            boxStatus1    = Box.createHorizontalBox();
    final JPanel          bottomPane    = new JPanel( new BorderLayout( 4, 2 ));
    final JScrollPane        ggScroll;
//    final JButton          ggBoot;
    final AbstractWindow.Listener  winListener;
    final TreeExpanderButton    ggStatusExp;
//    String[]            cfgNames    = null;
    final String[]          fntNames;
 
    lta        = new LogTextArea( 16, 40, false, null );
    ggScroll    = lta.placeMeInAPane();
    lta.makeSystemOutput();
   
    actionBoot    = new ActionBoot();
//    ggBoot      = new JButton( actionBoot );
    ggBoot      = new MultiStateButton();
    ggBoot.setFocusable( false )// prevent user from accidentally starting/stopping server
    ggBoot.setAutoStep( false );
    ggBoot.addActionListener( actionBoot );
   
//    ggDumpOSC    = new JCheckBox( getResourceString( "labelDumpOSC" ));
//    ggDumpOSC.addItemListener( new ItemListener() {
//      public void itemStateChanged( ItemEvent e ) {
//        root.superCollider.dumpOSC( ggDumpOSC.isSelected() ? kDumpText : kDumpOff );
//      }
//    });
    ggDumpOSC    = new MultiStateButton();
    ggDumpOSC.setFocusable( false );
    ggDumpOSC.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ) {
        superCollider.dumpOSC( ggDumpOSC.getSelectedIndex() );
      }
    });
//    ggDumpOSC.addItem( getResourceString( "labelDumpOff" ), null, null );
//    ggDumpOSC.addItem( getResourceString( "labelDumpText" ), null, new Color( 0xFF, 0xFA, 0x9D ), new Color( 0xFA, 0xE7, 0x9D ));
//    ggDumpOSC.addItem( getResourceString( "labelDumpHex" ), null, new Color( 0xFA, 0x9D, 0xFF ), new Color( 0xE7, 0x9D, 0xFA ));

        JLabel ggImport = new JLabel("<html><body><i>Drop</i></body>", null, SwingConstants.CENTER);
        ggImport.setForeground(Color.darkGray);
        ggImport.setTransferHandler(new TransferHandler() {
            @Override
            public boolean canImport(TransferSupport support) {
                return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor);
            }

            @Override
            public boolean importData(TransferSupport support) {
                if (support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                    try {
                        java.util.List fs = (java.util.List)
                                support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
                        for (int i = 0; i < fs.size(); i++) {
                            File f = (File) fs.get(i);
                            // System.out.println(f);
                            ((BasicApplication) app).getMenuFactory().openDocument(f);
                        }
                        return true;
                    } catch (IOException e) {
                        return false;
                    } catch (UnsupportedFlavorException e) {
                        return false;
                    }
                } else {
                    return false;
                }
            }
        });
        ggImport.setToolTipText("Drop audio files here to open them");
        ggImport.setBorder(new AbstractBorder() {
            @Override public Insets getBorderInsets(Component c, Insets insets) {
                insets.top  = insets.bottom = 5;
                insets.left = insets.right  = 8;
                return insets;
            }

            private final Stroke strk = new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER,
                    10.0f, new float[] { 3f, 3f }, 0.0f);

            @Override
            public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
                Graphics2D g2 = (Graphics2D) g;
                g2.setColor(Color.darkGray);
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                // g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
                g2.setStroke(strk);
                g2.drawRoundRect(x + 1, y + 1, width - 3, height - 3, 8, 8);
            }
        });
        Dimension importPref = ggImport.getPreferredSize();
        // importPref.width = 100;
        ggImport.setPreferredSize(importPref);
        ggImport.setMaximumSize  (importPref);

    boxStatus2    = Box.createHorizontalBox();
    msgStatus1    = new MessageFormat( getResourceString( "ptrnServerStatus1" ), Locale.US );
    msgStatus2    = new MessageFormat( getResourceString( "ptrnServerStatus2" ), Locale.US );
    unknownStatus  = getResourceString( "labelServerNotRunning" );
    lbStatus1    = new JLabel( unknownStatus );
    lbStatus2    = new JLabel();

    ggStatusExp  = new TreeExpanderButton();
    ggStatusExp.setExpandedToolTip( getResourceString( "buttonExpStatsTT" ));
    ggStatusExp.setCollapsedToolTip( getResourceString( "buttonCollStatsTT" ));
    ggStatusExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final Dimension  d  = getSize();

        if( ggStatusExp.isExpanded() ) {
          boxStatus2.setVisible( true );
          setSize( new Dimension( d.width, d.height + boxStatus2.getPreferredSize().height + 2 ));
        } else {
          boxStatus2.setVisible( false );
          setSize( new Dimension( d.width, d.height - (boxStatus2.getPreferredSize().height + 2) ));
        }
      }
    });
   
    lbStatus1.setPreferredSize( new Dimension( 192, lbStatus1.getPreferredSize().height ));
    lbStatus2.setPreferredSize( new Dimension( 226, lbStatus1.getPreferredSize().height ));
   
    boxStatus1.add( new JLabel( new ImageIcon( getClass().getResource( "sc-icon.png" ))));
    boxStatus1.add( Box.createHorizontalStrut( 2 ));
    boxStatus1.add( ggStatusExp );
    boxStatus1.add( lbStatus1 );
    boxStatus1.add( ggBoot );
        boxStatus1.add( Box.createHorizontalStrut(4));
        boxStatus1.add(ggImport);
    boxStatus1.add( Box.createHorizontalGlue() );

//    boxStatus2.add( Box.createHorizontalStrut( 32 ));
    boxStatus2.add( lbStatus2 );
    boxStatus2.add( ggDumpOSC );
    boxStatus2.add( Box.createHorizontalGlue() );
    boxStatus2.setVisible( false );

    boxStatus1.add( CoverGrowBox.create() );
    boxStatus2.add( CoverGrowBox.create() );
//        if( AbstractApplication.getApplication().getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
//        boxStatus1.add( Box.createHorizontalStrut( 16 ));
//        boxStatus2.add( Box.createHorizontalStrut( 16 ));
//        }
   
    bottomPane.add( boxStatus1, BorderLayout.NORTH );
    bottomPane.add( boxStatus2, BorderLayout.SOUTH );
//    bottomPane.add( ggBoot, BorderLayout.EAST );
    bottomPane.setBorder( BorderFactory.createEmptyBorder( 0, 4, 0, 4 ));
    cp.add( ggScroll, BorderLayout.CENTER );
    cp.add( bottomPane, BorderLayout.SOUTH );

    fntNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    if( contains( fntNames, "Monaco" )) {              // Mac OS
      fntMonoSpaced = new Font( "Monaco", Font.PLAIN, 9 );    // looks bigger than it is
    } else if( contains( fntNames, "Lucida Sans Unicode" )) {    // Windows XP
      fntMonoSpaced = new Font( "Lucida Sans Unicode", Font.PLAIN, 9 );
    } else {
      fntMonoSpaced = new Font( "Monospaced", Font.PLAIN, 10 );
    }
   
    AbstractWindowHandler.setDeepFont( cp );
   
    ggBoot.setNumColumns( 9 );
    ggBoot.addItem( getResourceString( "buttonBoot" ), null, null );
// NOTE: BUG WITH CUSTOM COMPOSITE ON WIN-XP!!!
//    ggBoot.addItem( getResourceString( "buttonTerminate" ), null, new Color( 0xFF, 0xFA, 0x9D ), new Color( 0xFA, 0xE7, 0x9D ));
ggBoot.addItem( getResourceString( "buttonTerminate" ), null, new Color( 0xFF, 0xFA, 0x9D ));
    ggDumpOSC.setNumColumns( 9 );
    ggDumpOSC.addItem( getResourceString( "labelDumpOff" ), null, null );
//    ggDumpOSC.addItem( getResourceString( "labelDumpText" ), null, new Color( 0xFF, 0xFA, 0x9D ), new Color( 0xFA, 0xE7, 0x9D ));
ggDumpOSC.addItem( getResourceString( "labelDumpText" ), null, new Color( 0xFF, 0xFA, 0x9D ));
//    ggDumpOSC.addItem( getResourceString( "labelDumpHex" ), null, new Color( 0xFF, 0x9D, 0x9D ), new Color( 0xFA, 0x8D, 0x9D ));
ggDumpOSC.addItem( getResourceString( "labelDumpHex" ), null, new Color( 0xFF, 0x9D, 0x9D ));
    final Dimension d = new Dimension( ggDumpOSC.getPreferredSize().width, ggDumpOSC.getMaximumSize().height );
    ggBoot.setMaximumSize( d );
    ggDumpOSC.setMaximumSize( d );
   
    lbStatus1.setFont( fntMonoSpaced );
    lbStatus2.setFont( fntMonoSpaced );
    lta.setFont( fntMonoSpaced );

    // ---- menus and actions ----
   
    ((BasicApplication) app).getMenuBarRoot().putMimic( "edit.clear", this, lta.getClearAction() );

    // ---- listeners -----
   
//    root.getDocumentHandler().addDocumentListener( this );

    winListener = new AbstractWindow.Adapter() {
      public void windowClosing( AbstractWindow.Event e ) {
        app.quit();
      }
    };
    addListener( winListener );
   
    superCollider.addServerListener( this );
   
//        HelpGlassPane.setHelp( getRootPane(), "MainFrame" );

    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
   
    init();
    app.addComponent( Main.COMP_MAIN, this );
    setVisible( true );
//    toFront();
  }
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

    superCollider  = SuperColliderClient.getInstance();
    numChannels    = doc.getAudioTrail().getChannelNum();
   
    doc.getTransport().stop();

    final Application      app        = AbstractApplication.getApplication();
    final SpringPanel      recPane;
    final Container        cp        = getContentPane();
    final JPanel        butPane;
    final WindowAdapter      winListener;
    final String        className    = getClass().getName();
    final AudioFileDescr    displayAFD    = doc.getDisplayDescr();
    final JButton        ggPeakReset;
    final JToolBar        tbMonitoring;
    final TimeLabel        lbTime;
    final MessageFormat      frmtPeak    = new MessageFormat( getResourceString( "msgPeak" ), Locale.US ); // XXX Locale.US
    final Object[]        peakArgs    = new Object[1];
    final JRootPane        rp        = getRootPane();
    final InputMap        imap      = rp.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW );
    final ActionMap        amap      = rp.getActionMap();
    final JButton        ggAbort, ggRecord, ggStop, ggClose;
    final int          myMeta      = BasicMenuFactory.MENU_SHORTCUT == InputEvent.CTRL_MASK ?
      InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK : BasicMenuFactory.MENU_SHORTCUT;  // META on Mac, CTRL+SHIFT on PC

    // use same encoding as parent document
    encodingString = (displayAFD.sampleFormat == AudioFileDescr.FORMAT_INT ? "int" : "float") +
             String.valueOf( displayAFD.bitsPerSample );
//encodingString = "float32";

    audioPrefs  = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    classPrefs  = app.getUserPrefs().node( className.substring( className.lastIndexOf( '.' ) + 1 ));
   
    recPane    = new SpringPanel( 4, 2, 4, 2 );
//    affp    = new AudioFileFormatPane( AudioFileFormatPane.ENCODING );
//    recPane.gridAdd( new JLabel( getResourceString( "labelFormat" ), SwingConstants.RIGHT ), 0, 1 );
//    recPane.gridAdd( affp, 1, 1 );
    ggRecordConfig  = new PrefComboBox();
    ggRecordConfig.setFocusable( false );
    lbPeak      = new JLabel();
    actionPeakReset  = new ActionPeakReset();
    ggPeakReset    = new JButton( actionPeakReset );
    ggPeakReset.setFocusable( false );
    lbTime      = new TimeLabel();
    tbMonitoring  = new JToolBar();
    tbMonitoring.setFloatable( false );
    ggMonitoring  = new JToggleButton( new ActionMonitoring() );
    ggMonitoring.setFocusable( false );
    tbMonitoring.add( ggMonitoring );
    recPane.gridAdd( lbTime, 1, 0, -2, 1 );
    recPane.gridAdd( new JLabel( getResourceString( "labelRecInputs" ), SwingConstants.RIGHT ), 0, 1 );
    recPane.gridAdd( ggRecordConfig, 1, 1, -1, 1 );
    recPane.gridAdd( tbMonitoring, 2, 1 );
    recPane.gridAdd( new JLabel( getResourceString( "labelHeadroom" ) + " :", SwingConstants.RIGHT ), 0, 2 );
    recPane.gridAdd( lbPeak, 1, 2 );
//    recPane.gridAdd( new JLabel( getResourceString( "labelDB" ), SwingConstants.RIGHT ), 2, 1 );
    recPane.gridAdd( ggPeakReset, 2, 2, -1, 1 );
   
    refillConfigs();

//    affp.setPreferences( classPrefs );
    ggRecordConfig.setPreferences( classPrefs, KEY_CONFIG );

    recPane.makeCompactGrid();

    butPane        = new JPanel(); // new FlowLayout( FlowLayout.TRAILING ));
    butPane.setLayout( new BoxLayout( butPane, BoxLayout.X_AXIS ));
    actionRecord    = new ActionRecord();
    actionStop      = new ActionStop();
    actionAbort      = new ActionAbort();
    actionClose      = new ActionClose();
    butPane.add( new HelpButton( "RecorderDialog" ));
    butPane.add( Box.createHorizontalGlue() );
    ggAbort        = new JButton( actionAbort );
    ggAbort.setFocusable( false );
    butPane.add( ggAbort );
    ggRecord      = new JButton( actionRecord );
    ggRecord.setFocusable( false );
    butPane.add( ggRecord );
    ggStop        = new JButton( actionStop );
    ggStop.setFocusable( false );
    butPane.add( ggStop );
    ggClose        = new JButton( actionClose );
    ggClose.setFocusable( false );
    butPane.add( ggClose );
    butPane.add( CoverGrowBox.create() );
       
    cp.add( recPane, BorderLayout.NORTH );
    cp.add( butPane, BorderLayout.SOUTH );

    GUIUtil.setDeepFont( cp, app.getGraphicsHandler().getFont( GraphicsHandler.FONT_SYSTEM | GraphicsHandler.FONT_SMALL ));

//    runPeakUpdate = new Runnable() {
//      public void run()
//      {
//        peakArgs[0] = new Double( MathUtil.linearToDB( 1.0 / maxPeak ));
View Full Code Here

   */
  public AudioFileInfoPalette()
  {
    super( PALETTE );
   
    final Application  app      = AbstractApplication.getApplication();
 
    setTitle( app.getResourceString( "paletteAudioInfo" ));
   
    final Container    cp      = getContentPane();
//    final JRootPane    rp      = getRootPane();
    final JScrollPane  ggScroll;
    final JPanel    p2      = new JPanel( new BorderLayout() );
    final SpringPanel  p3      = new SpringPanel( 4, 2, 4, 2 );
    JLabel        lb;

    p      = new SpringPanel( 4, 2, 4, 2 );
   
    p3.gridAdd( new JLabel( getResourceString( "labelName" )), 0, 0 );
    lbName    = new JLabel();
    p3.gridAdd( lbName, 1, 0 );
   
    p3.gridAdd( new JLabel( getResourceString( "labelSampleRate" )), 0, 1 );
    ggRate    = new ParamField();
    ggRate.addSpace( ParamSpace.spcFreqHertz.reshape( 0.01, Double.POSITIVE_INFINITY, 44100.0 ));
    ggRate.addListener( this );
    p3.gridAdd( ggRate, 1, 1 );
   
    ggComment  = new JTextArea( 4, 24 );
    new LooseFocusAction( ggComment );
    ggComment.addFocusListener( new FocusAdapter() {
      public void focusLost( FocusEvent e )
      {
        if( doc != null ) {
          final AudioFileDescr  displayAFD  = doc.getDisplayDescr();
          final String      newText    = ggComment.getText();
          final String      oldText    = (String) displayAFD.getProperty( AudioFileDescr.KEY_COMMENT );
         
          if( !newText.equals( oldText )) {
            doc.getUndoManager().addEdit( new EditChangeAudioFileDescr( this, displayAFD,
              AudioFileDescr.KEY_COMMENT, newText, getResourceString( "editChangeComment" )).perform() );
          }
        }
      }
    });
    ggScroll  = new JScrollPane( ggComment, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                                         ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER );
    lb      = new JLabel( getResourceString( "labelComment" ));
    lb.setVerticalAlignment( SwingConstants.TOP );
    p.gridAdd( lb, 0, 2 );
    ggComment.setLineWrap( true );
    ggComment.setWrapStyleWord( true );
    p.gridAdd( ggScroll, 1, 2, 1, 2 );
   
    p.makeCompactGrid();
    p3.makeCompactGrid();
    p2.add( p3, BorderLayout.NORTH );
    p2.add( p, BorderLayout.CENTER );
   
    cp.add( p2, BorderLayout.CENTER );
//        if( AbstractApplication.getApplication().getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
//      cp.add( Box.createVerticalStrut( 16 ), BorderLayout.SOUTH );
//        }
    GUIUtil.setDeepFont( p2, app.getGraphicsHandler().getFont( GraphicsHandler.FONT_SYSTEM | GraphicsHandler.FONT_SMALL ));
   
    // --- Listener ---
//    new DynamicAncestorAdapter( this ).addTo( rp );
        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!

    init();
    app.addComponent( Main.COMP_AUDIOINFO, this );
  }
View Full Code Here

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

    final Container          cp      = getContentPane();
    final Application        app      = AbstractApplication.getApplication();
//    final JPanel          buttonPanel;
    final Box            buttonPanel;
    final JTabbedPane        ggTabPane;
    final String          abCfgID;
    final AudioBoxConfig      abCfg;
    JButton              ggButton;
//    Param              p;

    audioPrefs      = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    abCfgID        = audioPrefs.get( PrefsUtil.KEY_AUDIOBOX, AudioBoxConfig.ID_DEFAULT );
    abCfg        = new AudioBoxConfig( audioPrefs.node( PrefsUtil.NODE_AUDIOBOXES ).node( abCfgID ));

    audioHwChannels[0= abCfg.numInputChannels;
    audioHwChannels[1= abCfg.numOutputChannels;

    ggTabPane      = new JTabbedPane();

    // ---------- tabs ----------

    for( int i = 0; i < NUM_TABS; i++ ) {  // input + output tabs
      fromPrefs( i );
      ggTabPane.addTab( app.getResourceString( i == 0 ? "labelInputs" : "labelOutputs" ), null,
        createTab( i ), null );
    }

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

        buttonPanel = Box.createHorizontalBox(); // new JPanel( new FlowLayout( FlowLayout.RIGHT, 4, 4 ));
    buttonPanel.setBorder( BorderFactory.createEmptyBorder( 0, 0, 2, 0 ));
    buttonPanel.add( new HelpButton( "IOSetup" ));
    buttonPanel.add( Box.createHorizontalGlue() );
        ggButton  = new JButton( app.getResourceString( "buttonOk" ));
        ggButton.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final ControlRoomFrame f;
       
        for( int i = 0; i < NUM_TABS; i++ ) {
          if( !toPrefs( i )) return;
        }
        disposeAndClose();
// XXX ControlRoomFrame cannot rely on prefs since childAdded is
// never fired (probably bug in java or spi)
        f = (ControlRoomFrame) app.getComponent( Main.COMP_CTRLROOM );
        if( f != null ) f.refillIOConfigs();
     
    });
        buttonPanel.add( ggButton );
        ggButton  = new JButton( app.getResourceString( "buttonCancel" ));
        buttonPanel.add( ggButton );
        ggButton.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        disposeAndClose();
      }
    });
    buttonPanel.add( CoverGrowBox.create() );
//    if( app.getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
//        buttonPanel.add( Box.createHorizontalStrut( 16 ));
//        }

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

    // ---------- ----------

    ggTabPane.setSelectedIndex( NUM_TABS - 1 );
    setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );

    init();
    app.addComponent( Main.COMP_IOSETUP, this );
    }
View Full Code Here

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

   *  instance of the plug-in class and initializes it.
   */
  private boolean switchPlugIn( String className )
  {
    boolean        success  = false;
    final Application  app    = AbstractApplication.getApplication();

    plugIn = null;
    if( className != null ) {
      try {
        plugIn  = (RenderPlugIn) Class.forName( className ).newInstance();
//        plugIn.init( root, doc );
        plugIn.init( app.getUserPrefs().node( PrefsUtil.NODE_PLUGINS ).node(
          className.substring( className.lastIndexOf( '.' ) + 1 )));
        success  = true;
      }
      catch( InstantiationException e1 ) {
        GUIUtil.displayError( getWindow(), e1, app.getResourceString( "errInitPlugIn" ));
      }
      catch( IllegalAccessException e2 ) {
        BasicWindowHandler.showErrorDialog( getWindow(), e2, app.getResourceString( "errInitPlugIn" ));
      }
      catch( ClassNotFoundException e3 ) {
        BasicWindowHandler.showErrorDialog( getWindow(), e3, app.getResourceString( "errInitPlugIn" ));
      }
      catch( ClassCastException e4 ) {
        BasicWindowHandler.showErrorDialog( getWindow(), e4, app.getResourceString( "errInitPlugIn" ));
      }
    }
    return success;
  }
View Full Code Here

    super();

    if( instance != null ) throw new IllegalStateException( "Only one instance allowed" );
    instance  = this;
 
    final Application        app      = AbstractApplication.getApplication();
    final Preferences        userPrefs  = app.getUserPrefs();
    final PreferenceChangeListener  oCfgListener;

    audioPrefs        = userPrefs.node( PrefsUtil.NODE_AUDIO );
    so            = new ServerOptions();
    so.setBlockAllocFactory( new ContiguousBlockAllocator.Factory() )// deals better with fragmentation
View Full Code Here

   */
  public ObserverPalette()
  {
    super( PALETTE );
 
    final Application app = AbstractApplication.getApplication();
 
    setTitle( app.getResourceString( "paletteObserver" ));
    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 );
       
    // ----- 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 JComponent getSettingsView( RenderContext context )
  {
    final JPanel      p      = new JPanel( new BorderLayout() );
    final PrefParamField  ggNimRod  = new PrefParamField();
    final Application    app      = AbstractApplication.getApplication();
   
    ggNimRod.addSpace( new ParamSpace( Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1, 0, 0, 1 ));
    ggNimRod.setValueAndSpace( DEFAULT_NUMROT );
    ggNimRod.setPreferences( prefs, KEY_NUMROT );

    p.add( new JLabel( app.getResourceString( "plugInChanShift" ), SwingConstants.RIGHT ), BorderLayout.WEST );
    p.add( ggNimRod, BorderLayout.CENTER );
    return p;
  }
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.