mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 16:50:46 +00:00
Issue #292 Change background color in SWF preview
This commit is contained in:
@@ -158,6 +158,7 @@ import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
@@ -1239,6 +1240,17 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
//paramsLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
|
||||
pan.add(prevLabel, BorderLayout.NORTH);
|
||||
pan.add(leftComponent, BorderLayout.CENTER);
|
||||
if (flashPanel != null) {
|
||||
JPanel bottomPanel = new JPanel(new BorderLayout());
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
selectColorButton.addActionListener(this);
|
||||
selectColorButton.setActionCommand("SELECTCOLOR");
|
||||
selectColorButton.setToolTipText(AppStrings.translate("button.selectcolor.hint"));
|
||||
buttonsPanel.add(selectColorButton);
|
||||
bottomPanel.add(buttonsPanel, BorderLayout.EAST);
|
||||
pan.add(bottomPanel, BorderLayout.SOUTH);
|
||||
}
|
||||
previewSplitPane.setLeftComponent(pan);
|
||||
|
||||
parametersPanel = new JPanel(new BorderLayout());
|
||||
@@ -1278,6 +1290,16 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
shapesCard.add(previewPanel, BorderLayout.CENTER);
|
||||
displayPanel.add(shapesCard, CARDDRAWPREVIEWPANEL);
|
||||
|
||||
Color backgroundColor = Color.white;
|
||||
if (swf != null) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof SetBackgroundColorTag) {
|
||||
backgroundColor = ((SetBackgroundColorTag) t).backgroundColor.toColor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
View.swfBackgroundColor = backgroundColor;
|
||||
swfPreviewPanel = new SWFPreviwPanel();
|
||||
displayPanel.add(swfPreviewPanel, CARDSWFPREVIEWPANEL);
|
||||
|
||||
@@ -2197,8 +2219,15 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case "SELECTCOLOR":
|
||||
Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectcolor.title"), View.swfBackgroundColor);
|
||||
if (newColor != null) {
|
||||
View.swfBackgroundColor = newColor;
|
||||
reload(true);
|
||||
}
|
||||
break;
|
||||
case "RELOAD":
|
||||
if(View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"),JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)==JOptionPane.YES_OPTION){
|
||||
if (View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||
Main.reloadSWF();
|
||||
}
|
||||
break;
|
||||
@@ -2945,7 +2974,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
sos2.writeUI8(0);
|
||||
sos2.writeUI8(swf.frameRate);
|
||||
sos2.writeUI16(100); //framecnt
|
||||
sos2.writeTag(new SetBackgroundColorTag(null, new RGB(255, 255, 255)));
|
||||
sos2.writeTag(new SetBackgroundColorTag(null, new RGB(View.swfBackgroundColor)));
|
||||
|
||||
if (tagObj instanceof FrameNode) {
|
||||
FrameNode fn = (FrameNode) tagObj;
|
||||
|
||||
Reference in New Issue
Block a user