diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b95405d..ef01c853c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. (major = uncompatible change) - [#2070] forceWriteAsLong Tag internal attribute is now visible and editable (including XML export), allows decide whether to write length in tag header as long +- [#2073] Editing of frame count in SWF header (with warning that it won't update ShowFrame count) ### Fixed - [#2043] StartSound2 tag handling diff --git a/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java b/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java index 3d983aeb7..153d5710b 100644 --- a/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java @@ -22,19 +22,25 @@ import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.helpers.TableLayoutHelper; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; import javax.swing.border.BevelBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -59,6 +65,10 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { private final JLabel frameRateLabel = new JLabel(); private final JLabel frameCountLabel = new JLabel(); + + private final JSpinner frameCountEditor = new JSpinner(); + + private final JPanel frameCountEditorPanel = new JPanel(); private final JLabel displayRectTwipsLabel = new JLabel(); @@ -153,6 +163,26 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { frameRateEditorPanel.setLayout(layout); frameRateEditor.setPreferredSize(new Dimension(80, frameRateEditor.getPreferredSize().height)); frameRateEditorPanel.add(frameRateEditor); + + frameCountEditorPanel.setLayout(layout); + frameCountEditor.setPreferredSize(new Dimension(80, frameCountEditor.getPreferredSize().height)); + frameCountEditorPanel.add(frameCountEditor); + + JLabel frameCountWarningIcon = new JLabel(View.getIcon("warning16")); + frameCountWarningIcon.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + frameCountWarningIcon.setCursor(new Cursor(Cursor.HAND_CURSOR)); + frameCountWarningIcon.setToolTipText(AppStrings.translate("warning.icon")); + frameCountWarningIcon.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (SwingUtilities.isLeftMouseButton(e)) { + ViewMessages.showMessageDialog(HeaderInfoPanel.this, + AppStrings.translate("warning.edit.headerframecount"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE); + } + } + }); + frameCountEditorPanel.add(frameCountWarningIcon); + displayRectEditorPanel.setLayout(layout); displayRectEditorPanel.setMinimumSize(new Dimension(10, displayRectEditorPanel.getMinimumSize().height)); @@ -220,6 +250,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { propertiesPanel.add(frameRateEditorPanel, "1,5"); propertiesPanel.add(new JLabel(AppStrings.translate("header.framecount")), "0,6"); propertiesPanel.add(frameCountLabel, "1,6"); + propertiesPanel.add(frameCountEditorPanel, "1,6"); propertiesPanel.add(new JLabel(AppStrings.translate("header.displayrect")), "0,7"); propertiesPanel.add(displayRectTwipsLabel, "1,7"); propertiesPanel.add(displayRectEditorPanel, "1,7"); @@ -278,6 +309,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { swf.version = getVersionNumber(); swf.gfx = gfxCheckBox.isSelected(); swf.frameRate = ((Number) (frameRateEditor.getModel().getValue())).floatValue(); + swf.frameCount = ((Number) (frameCountEditor.getModel().getValue())).intValue(); double multiplier = 1.0; if (unit == UNIT_PIXELS) { multiplier = 20.0; @@ -330,6 +362,9 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { frameRateEditor.setModel(new SpinnerNumberModel(swf.frameRate, -0x80000000, 0x7fffffff, 1)); frameCountLabel.setText("" + swf.frameCount); + frameCountEditor.setModel(new SpinnerNumberModel(swf.frameCount, -0x80000000, 0x7fffffff, 1)); + + displayRectTwipsLabel.setText(AppStrings.translate("header.displayrect.value.twips") .replace("%xmin%", Integer.toString(swf.displayRect.Xmin)) .replace("%ymin%", Integer.toString(swf.displayRect.Ymin)) @@ -414,6 +449,8 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel { gfxCheckBox.setVisible(edit); frameRateLabel.setVisible(!edit); frameRateEditorPanel.setVisible(edit); + frameCountLabel.setVisible(!edit); + frameCountEditorPanel.setVisible(edit); displayRectTwipsLabel.setVisible(!edit); displayRectPixelsLabel.setVisible(!edit); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index fa0353420..631985a97 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -1139,3 +1139,10 @@ contextmenu.addScript.doinitaction = Add sprite init script - DoInitAction #after 18.4.1 warning.cannotencrypt = WARNING: The file %file% was encrypted using HARMAN Air encryption.\r\nIt was successfully decrypted to be loaded, but if you want to save modified file later,\r\nthe encryption will be stripped ( = not encrypted). + +#after 18.5.0 +warning.edit.headerframecount = WARNING: Editing frame count in the header does not update \ + neccessary number of ShowFrame tags on SWF timeline.\r\nTo add new frames, you should better use right click context menu on SWF -> Add frames,\r\n\ + which will update the frame count in the header accordingly. + +warning.icon = Click to show related warning \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index c2c4f6ebf..dec6b00ea 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -1124,3 +1124,10 @@ contextmenu.addScript.doinitaction = P\u0159idat inicializa\u010dn\u00ed skript #after 18.4.1 warning.cannotencrypt = VAROV\u00c1N\u00cd: Soubor %file% byl za\u0161ifrov\u00e1n pomoc\u00ed HARMAN Air \u0161ifrov\u00e1n\u00ed.\r\nByl \u00fasp\u011b\u0161n\u011b roz\u0161ifrov\u00e1n pro na\u010dten\u00ed, ale pokud budete cht\u00edt soubor ulo\u017eit,\r\n\u0161ifrov\u00e1n\u00ed se ztrat\u00ed ( = nebude za\u0161ifrov\u00e1n). + +#after 18.5.0 +warning.edit.headerframecount = VAROV\u00c1N\u00cd: Editace po\u010dtu sn\u00edmk\u016f v hlavi\u010dce neaktualizuje \ + pot\u0159ebn\u00fd po\u010det ShowFrame tag\u016f na SWF \u010dasov\u00e9 ose.\r\nPro p\u0159id\u00e1n\u00ed nov\u00fdch sn\u00edmk\u016f byste m\u011bl rad\u011bji pou\u017e\u00edt kontextov\u00e9 menu o prav\u00e9m kliknu na SWF -> P\u0159idat sn\u00edmky,\r\n\ + co\u017e aktualizuje podle toho i po\u010det sn\u00edmk\u016f v hlavi\u010dce. + +warning.icon = Klikn\u011bte pro zobrazen\u00ed souvisej\u00edc\u00edho varov\u00e1n\u00ed \ No newline at end of file