Search in sources :

Example 6 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class DancingFractalsController method stopRender.

public void stopRender() throws Exception {
    if (renderThread != null) {
        if (doRecordCBx.isSelected()) {
            actionRecorder.recordStop();
        }
        renderThread.setForceAbort(true);
        if (doRecordCBx.isSelected()) {
            JFileChooser chooser = new FlameFileChooser(prefs);
            if (prefs.getOutputFlamePath() != null) {
                try {
                    chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if (chooser.showSaveDialog(flameRootPanel) == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                prefs.setLastOutputFlameFile(file);
                PostRecordFlameGenerator generator = new PostRecordFlameGenerator(Prefs.getPrefs(), project, actionRecorder, renderThread, project.getFFT());
                generator.createRecordedFlameFiles(file.getAbsolutePath());
            }
        }
        renderThread = null;
        actionRecorder = null;
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) PostRecordFlameGenerator(org.jwildfire.create.tina.dance.action.PostRecordFlameGenerator) File(java.io.File)

Example 7 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class IFlamesController method loadIFlameButton_clicked.

public void loadIFlameButton_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
            Flame flame = flames.get(0);
            prefs.setLastInputFlameFile(file);
            importFlame(flame);
            getFlame().setLastFilename(file.getName());
            messageHelper.showStatusMessage(getFlame(), "opened from disc");
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 8 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class IFlamesController method loadFlamesButton_clicked.

public void loadFlamesButton_clicked() {
    JFileChooser chooser = new FlameFileChooser(prefs);
    if (prefs.getInputFlamePath() != null) {
        try {
            chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    chooser.setMultiSelectionEnabled(true);
    if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
        Throwable lastError = null;
        for (File file : chooser.getSelectedFiles()) {
            try {
                List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
                prefs.setLastInputFlameFile(file);
                for (int i = flames.size() - 1; i >= 0; i--) {
                    addFlameToFlameLibrary(flames.get(i), new ThumbnailCacheKey(file.getAbsolutePath(), String.valueOf(i)));
                }
            } catch (Throwable ex) {
                lastError = ex;
            }
        }
        refreshFlameLibrary();
        if (lastError != null) {
            errorHandler.handleError(lastError);
        }
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) ThumbnailCacheKey(org.jwildfire.create.tina.swing.ThumbnailCacheKey) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 9 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class MutaGenController method saveFlameBtn_clicked.

public void saveFlameBtn_clicked() {
    if (selectedGenerationIdx >= 0 && selectedGenerationIdx < mutationList.size() && selRow >= 0 && selCol >= 0) {
        MutationSet selectedSet = mutationList.get(selectedGenerationIdx);
        Flame currFlame = selectedSet.getFlame(selRow, selCol);
        try {
            if (currFlame != null) {
                JFileChooser chooser = new FlameFileChooser(prefs);
                if (prefs.getOutputFlamePath() != null) {
                    try {
                        chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                if (chooser.showSaveDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
                    File file = chooser.getSelectedFile();
                    new FlameWriter().writeFlame(currFlame, file.getAbsolutePath());
                    currFlame.setLastFilename(file.getName());
                    prefs.setLastOutputFlameFile(file);
                }
            }
        } catch (Throwable ex) {
            errorHandler.handleError(ex);
        }
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JFileChooser(javax.swing.JFileChooser) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Aggregations

File (java.io.File)9 JFileChooser (javax.swing.JFileChooser)9 FlameFileChooser (org.jwildfire.create.tina.swing.FlameFileChooser)9 Flame (org.jwildfire.create.tina.base.Flame)6 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)6 FlameReader (org.jwildfire.create.tina.io.FlameReader)5 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)2 PostRecordFlameGenerator (org.jwildfire.create.tina.dance.action.PostRecordFlameGenerator)1 ThumbnailCacheKey (org.jwildfire.create.tina.swing.ThumbnailCacheKey)1