#1106 New Shapes added to SWF files do not have their images added properly when using the replace function

This commit is contained in:
honfika@gmail.com
2015-12-12 21:15:21 +01:00
parent 5960434c23
commit 2e468252b2
3 changed files with 41 additions and 0 deletions

View File

@@ -2650,6 +2650,36 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
}
public void replaceNoFillButtonActionPerformed(ActionEvent evt) {
TreeItem item = tagTree.getCurrentTreeItem();
if (item == null) {
return;
}
if (item instanceof ShapeTag) {
ShapeTag st = (ShapeTag) item;
File selectedFile = showImportFileChooser("filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp");
if (selectedFile != null) {
File selfile = Helper.fixDialogFile(selectedFile);
byte[] data = Helper.readFile(selfile.getAbsolutePath());
try {
Tag newTag = new ShapeImporter().importImage(st, data, 0, false);
SWF swf = st.getSwf();
if (newTag != null) {
refreshTree(swf);
setTagTreeSelectedNode(newTag);
}
swf.clearImageCache();
} catch (IOException ex) {
logger.log(Level.SEVERE, "Invalid image", ex);
View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
}
reload(true);
}
}
}
public void replaceAlphaButtonActionPerformed(ActionEvent evt) {
TreeItem item = tagTree.getCurrentTreeItem();
if (item == null) {