Search in sources :

Example 1 with Method

use of artisynth.core.moviemaker.MovieMaker.Method in project artisynth_core by artisynth.

the class MovieMakerDialog method valueChange.

/**
 * Listens for value change events from the methodSelector and
 * the formatSelector.
 */
public void valueChange(ValueChangeEvent event) {
    if (event.getSource() == methodSelector) {
        String methodName = (String) methodSelector.getValue();
        if (!methodName.equals(myMovieMaker.getMethod())) {
            MovieMaker.Method method = myMovieMaker.getMethodMap().get(methodName);
            myMovieMaker.setMethod(methodName);
            if (!method.frameFileFormat.equals(myMovieMaker.getFormat())) {
                myMovieMaker.setFormat(method.frameFileFormat);
                formatSelector.setValue(method.frameFileFormat);
            }
        }
    } else if (event.getSource() == formatSelector) {
        String format = (String) formatSelector.getValue();
        if (!format.equals(myMovieMaker.getFormat())) {
            myMovieMaker.setFormat(format);
            String methodName = (String) methodSelector.getValue();
            MovieMaker.Method method = myMovieMaker.getMethodMap().get(methodName);
            method.frameFileFormat = format;
        }
    } else if (event.getSource() == frameRateField) {
        myMovieMaker.setFrameRate(frameRateField.getDoubleValue());
    } else if (event.getSource() == speedField) {
        myMovieMaker.setSpeed(speedField.getDoubleValue());
    } else if (event.getSource() == resizeSamples) {
        myMovieMaker.setAntiAliasingSamples(resizeSamples.getIntValue());
    } else {
        throw new InternalErrorException("valueChange event from unknown source " + event.getSource());
    }
    updateMethodSelectors();
}
Also used : Method(artisynth.core.moviemaker.MovieMaker.Method) Method(artisynth.core.moviemaker.MovieMaker.Method) InternalErrorException(maspack.util.InternalErrorException)

Example 2 with Method

use of artisynth.core.moviemaker.MovieMaker.Method in project artisynth_core by artisynth.

the class MovieMakerDialog method updateMethodSelectors.

private void updateMethodSelectors() {
    String methodName = (String) methodSelector.getValue();
    if (MovieMaker.INTERNAL_METHOD.equals(methodName)) {
        Method method = myMovieMaker.getMethodMap().get(methodName);
        if (myMovieMaker.getFormat() != method.frameFileFormat) {
            myMovieMaker.setFormat(method.frameFileFormat);
            formatSelector.setValue(method.frameFileFormat);
        }
        customizeButton.setEnabled(false);
        formatSelector.setEnabledAll(false);
    } else {
        customizeButton.setEnabled(true);
        formatSelector.setEnabledAll(true);
    }
}
Also used : Method(artisynth.core.moviemaker.MovieMaker.Method)

Example 3 with Method

use of artisynth.core.moviemaker.MovieMaker.Method in project artisynth_core by artisynth.

the class MovieMakerDialog method actionPerformed.

public void actionPerformed(ActionEvent event) {
    String cmd = event.getActionCommand();
    Object source = event.getSource();
    if (cmd.equals(FULL_WINDOW_CMD)) {
        viewerCapture = false;
        customCapture = false;
        showCaptureFrame.setEnabled(false);
        setAreaSelectionFrame(null);
        setCaptureArea(myFrame);
        viewWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        fullWindowButton.setBorder(new BevelBorder(BevelBorder.LOWERED));
        customWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        originalSize.setEnabled(false);
        constrainSize.setEnabled(false);
        resizeWidth.getTextField().setEnabled(false);
        resizeHeight.getTextField().setEnabled(false);
        resizeSamples.getTextField().setEnabled(false);
        windowWidth.getTextField().setEnabled(false);
        windowHeight.getTextField().setEnabled(false);
        windowXPosition.getTextField().setEnabled(false);
        windowYPosition.getTextField().setEnabled(false);
    } else if (cmd.equals(VIEW_WINDOW_CMD)) {
        viewerCapture = true;
        customCapture = false;
        showCaptureFrame.setEnabled(false);
        setAreaSelectionFrame(null);
        setCaptureArea(myFrame.getViewer().getCanvas().getComponent());
        viewWindowButton.setBorder(new BevelBorder(BevelBorder.LOWERED));
        fullWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        customWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        originalSize.setEnabled(true);
        if (!originalSize.isSelected()) {
            originalSize.doClick();
        }
        constrainSize.setEnabled(false);
        resizeWidth.getTextField().setEnabled(false);
        resizeHeight.getTextField().setEnabled(false);
        resizeSamples.getTextField().setEnabled(false);
        windowWidth.getTextField().setEnabled(false);
        windowHeight.getTextField().setEnabled(false);
        windowXPosition.getTextField().setEnabled(false);
        windowYPosition.getTextField().setEnabled(false);
    } else if (cmd.equals(CUSTOM_WINDOW_CMD)) {
        viewerCapture = false;
        customCapture = true;
        if (!showCaptureFrame.isSelected() || !showCaptureFrame.isEnabled()) {
            showCaptureFrame.setEnabled(true);
            showCaptureFrame.setSelected(true);
            createSelectionFrame();
            showCaptureFrame.setSelected(true);
        }
        viewWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        fullWindowButton.setBorder(new BevelBorder(BevelBorder.RAISED));
        customWindowButton.setBorder(new BevelBorder(BevelBorder.LOWERED));
        originalSize.setEnabled(false);
        constrainSize.setEnabled(false);
        resizeWidth.getTextField().setEnabled(false);
        resizeHeight.getTextField().setEnabled(false);
        resizeSamples.getTextField().setEnabled(false);
        windowWidth.getTextField().setEnabled(true);
        windowHeight.getTextField().setEnabled(true);
        windowXPosition.getTextField().setEnabled(true);
        windowYPosition.getTextField().setEnabled(true);
    } else if (cmd.equals(REC_AUDIO_CMD)) {
        if (recordAudio.isSelected()) {
            System.out.println("rec. audio selected");
            recordAudioTxt.setSelected(false);
        }
        normalizeAudio.setEnabled(recordAudio.isSelected() || recordAudioTxt.isSelected());
    } else if (cmd.equals(REC_AUDIO_TO_TXT_CMD)) {
        if (recordAudioTxt.isSelected()) {
            System.out.println("rec. audio txt selected");
            recordAudio.setSelected(false);
        }
        normalizeAudio.setEnabled(recordAudio.isSelected() || recordAudioTxt.isSelected());
    } else if (cmd.equals(START_CMD)) {
        startMovie();
    } else if (cmd.equals(STOP_CMD)) {
        stopMovie();
    } else if (cmd.equals(CLOSE_CMD)) {
        setVisible(false);
    } else if (cmd.equals(WAYPOINT_CMD)) {
        waypointCapture();
    } else if (cmd.equals(FRAME_CMD)) {
        try {
            myMovieMaker.forceGrab();
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else if (cmd.equals(CUSTOMIZE_CMD)) {
        String methodName = (String) methodSelector.getValue();
        MovieMaker.Method method = myMovieMaker.getMethodMap().get(methodName);
        if (method == null) {
            throw new InternalErrorException("MovieMaker does not know about method " + methodName);
        }
        MethodDialog dialog = new MethodDialog(this, method);
        dialog.setLocationRelativeTo(this);
        dialog.setVisible(true);
    } else if (source == showCaptureFrame) {
        if (showCaptureFrame.isSelected()) {
            createSelectionFrame();
        } else {
            setAreaSelectionFrame(null);
        }
    } else if (source == originalSize) {
        if (originalSize.isSelected()) {
            constrainSize.setEnabled(false);
            resizeWidth.setValue(windowWidth.getIntValue());
            resizeHeight.setValue(windowHeight.getIntValue());
            resizeWidth.getTextField().setEnabled(false);
            resizeHeight.getTextField().setEnabled(false);
            resizeSamples.getTextField().setEnabled(false);
        } else {
            constrainSize.setEnabled(true);
            resizeWidth.getTextField().setEnabled(true);
            resizeHeight.getTextField().setEnabled(true);
            resizeSamples.getTextField().setEnabled(true);
        }
    } else if (cmd.equals("Screenshot")) {
        takeScreenshot();
    } else if (source == constrainSize && constrainSize.isSelected()) {
        double scale = resizeWidth.getDoubleValue() / windowWidth.getDoubleValue();
        resizeHeight.setValue(scale * windowHeight.getIntValue());
        myMovieMaker.setCaptureArea(myMovieMaker.getCaptureArea(), new Dimension((Integer) resizeWidth.getIntValue(), (Integer) resizeHeight.getIntValue()), viewerCapture);
    } else if (source == alwaysOnTop) {
        boolean onTop = alwaysOnTop.isSelected();
        myMovieMaker.setAlwaysOnTop(onTop);
        if (isRecordingStarted) {
            myFrame.setAlwaysOnTop(onTop);
        }
    }
}
Also used : Method(artisynth.core.moviemaker.MovieMaker.Method) BevelBorder(javax.swing.border.BevelBorder) FrameBufferObject(maspack.render.GL.FrameBufferObject) InternalErrorException(maspack.util.InternalErrorException) Dimension(java.awt.Dimension) InternalErrorException(maspack.util.InternalErrorException)

Aggregations

Method (artisynth.core.moviemaker.MovieMaker.Method)3 InternalErrorException (maspack.util.InternalErrorException)2 Dimension (java.awt.Dimension)1 BevelBorder (javax.swing.border.BevelBorder)1 FrameBufferObject (maspack.render.GL.FrameBufferObject)1