New file dialog: ActionScript type selection

New file - fixed gfx, framecount.
This commit is contained in:
Jindra Petřík
2022-11-06 11:13:37 +01:00
parent 40ea9175b1
commit 5d20a2a17c
3 changed files with 39 additions and 7 deletions

View File

@@ -1476,7 +1476,8 @@ public class Main {
mainFrame.setVisible(false);
Helper.freeMem();
}
String fileTitle = AppStrings.translate("new.filename") + ".swf";
String ext = newFileDialog.isGfx() ? "gfx" : "swf";
String fileTitle = AppStrings.translate("new.filename") + "." + ext;
SWFSourceInfo sourceInfo = new SWFSourceInfo(new ByteArrayInputStream(new byte[0]), null, fileTitle);
sourceInfos.add(sourceInfo);
SWFList list = new SWFList();
@@ -1494,9 +1495,13 @@ public class Main {
swf.compression = newFileDialog.getCompression();
swf.version = newFileDialog.getVersionNumber();
swf.frameRate = newFileDialog.getFrameRate();
swf.gfx = newFileDialog.isGfx();
swf.setHeaderModified(true);
Tag t;
t = new FileAttributesTag(swf);
FileAttributesTag f = new FileAttributesTag(swf);
if (newFileDialog.isAs3()) {
f.actionScript3 = true;
}
Tag t = f;
t.setTimelined(swf);
swf.addTag(t);
t = new SetBackgroundColorTag(swf, new RGB(newFileDialog.getBackgroundColor()));
@@ -1504,7 +1509,8 @@ public class Main {
swf.addTag(t);
t = new ShowFrameTag(swf);
t.setTimelined(swf);
swf.addTag(t);
swf.addTag(t);
swf.frameCount = 1;
swf.hasEndTag = true;
list.add(swf);
swf.swfList = list;

View File

@@ -28,6 +28,7 @@ import java.awt.Graphics;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
@@ -35,6 +36,7 @@ import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
@@ -81,6 +83,10 @@ public class NewFileDialog extends AppDialog {
private final JLabel warningLabel = new JLabel();
private final JRadioButton actionScript12RadioButton = new JRadioButton(translate("script.type.actionscript1_2"));
private final JRadioButton actionScript3RadioButton = new JRadioButton(translate("script.type.actionscript3"));
private JButton backgroundColorButton;
private int result = ERROR_OPTION;
@@ -175,7 +181,17 @@ public class NewFileDialog extends AppDialog {
JPanel backgroundColorPanel = new JPanel(new BorderLayout());
backgroundColorPanel.add(backgroundColorButton, BorderLayout.WEST);
actionScript3RadioButton.setSelected(true);
ButtonGroup actionScriptTypeGroup = new ButtonGroup();
actionScriptTypeGroup.add(actionScript12RadioButton);
actionScriptTypeGroup.add(actionScript3RadioButton);
JPanel actionScriptTypePanel = new JPanel(new FlowLayout());
actionScriptTypePanel.add(actionScript12RadioButton);
actionScriptTypePanel.add(actionScript3RadioButton);
propertiesPanel.add(new JLabel(AppStrings.translate("header.compression")), "0,0");
propertiesPanel.add(compressionEditorPanel, "1,0");
propertiesPanel.add(new JLabel(AppStrings.translate("header.version")), "0,1");
@@ -187,10 +203,12 @@ public class NewFileDialog extends AppDialog {
propertiesPanel.add(new JLabel(translate("canvas.size")), "0,4");
propertiesPanel.add(displayRectEditorPanel, "1,4");
propertiesPanel.add(warningPanel, "0,5,1,5");
propertiesPanel.add(new JLabel(translate("background.color")), "0,6");
propertiesPanel.add(new JLabel(translate("background.color")), "0,6");
propertiesPanel.add(backgroundColorPanel, "1,6");
propertiesPanel.add(new JLabel(translate("script.type")), "0,7");
propertiesPanel.add(actionScriptTypePanel, "1,7");
cnt.add(propertiesPanel, BorderLayout.CENTER);
@@ -309,4 +327,8 @@ public class NewFileDialog extends AppDialog {
public Color getBackgroundColor() {
return backgroundColorButton.getBackground();
}
public boolean isAs3() {
return actionScript3RadioButton.isSelected();
}
}

View File

@@ -23,3 +23,7 @@ unit.pixels = Pixels
unit.twips = Twips
canvas.size = Canvas size:
script.type = Script type:
script.type.actionscript1_2 = ActionScript 1/2
script.type.actionscript3 = ActionScript 3