use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class IFlamesController method loadIFlameFromClipboardButton_clicked.
public void loadIFlameFromClipboardButton_clicked() {
try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable clipData = clipboard.getContents(clipboard);
if (clipData != null) {
if (clipData.isDataFlavorSupported(DataFlavor.stringFlavor)) {
String xml = (String) (clipData.getTransferData(DataFlavor.stringFlavor));
List<Flame> flames = new FlameReader(prefs).readFlamesfromXML(xml);
Flame flame = flames.get(0);
importFlame(flame);
messageHelper.showStatusMessage(getFlame(), "opened from clipboard");
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class IFlamesController method reloadFlameLibrary.
private void reloadFlameLibrary() {
flameLibrary.clear();
if (prefs.getIflamesFlameLibraryPath() != null && prefs.getIflamesFlameLibraryPath().length() > 0) {
List<String> filenames = new ArrayList<String>();
_scanFiles(prefs.getIflamesFlameLibraryPath(), filenames);
for (String filename : filenames) {
if (filename.endsWith("." + Tools.FILEEXT_FLAME)) {
try {
List<Flame> flames = new FlameReader(prefs).readFlames(filename);
for (int i = flames.size() - 1; i >= 0; i--) {
addFlameToFlameLibrary(flames.get(i), new ThumbnailCacheKey(filename, String.valueOf(i)));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
refreshFlameLibrary();
flameLibraryScrollPane.getParent().repaint();
}
use of org.jwildfire.create.tina.io.FlameReader 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);
}
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class MeshGenController method fromClipboardButton_clicked.
public void fromClipboardButton_clicked() {
Flame newFlame = null;
try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable clipData = clipboard.getContents(clipboard);
if (clipData != null) {
if (clipData.isDataFlavorSupported(DataFlavor.stringFlavor)) {
String xml = (String) (clipData.getTransferData(DataFlavor.stringFlavor));
List<Flame> flames = new FlameReader(prefs).readFlamesfromXML(xml);
if (flames.size() > 0) {
newFlame = flames.get(0);
}
}
}
if (newFlame == null) {
throw new Exception("There is currently no valid flame in the clipboard");
} else {
importFlame(newFlame);
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class TinaSWFAnimatorController method loadFlameButton_clicked.
public void loadFlameButton_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(swfAnimatorPreviewRootPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
Flame newFlame = flames.get(0);
prefs.setLastInputFlameFile(file);
addFlame(newFlame);
enableControls();
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
Aggregations