From 97ac81c05c866a33b92908d1919b9b353519d4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 10 Oct 2024 22:24:19 +0200 Subject: [PATCH] Timeline header, button to go to main timeline. --- .../flash/easygui/EasySwfPanel.java | 28 +++++++++++++++++++ .../flash/gui/locales/EasyPanel.properties | 4 +++ 2 files changed, 32 insertions(+) diff --git a/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java b/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java index 81db0a6fe..20a084261 100644 --- a/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java +++ b/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java @@ -56,7 +56,9 @@ import java.awt.event.ActionListener; import java.awt.geom.Point2D; import java.io.IOException; import java.util.List; +import javax.swing.Box; import javax.swing.JButton; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; @@ -87,6 +89,8 @@ public class EasySwfPanel extends JPanel { private JTabbedPane rightTabbedPane; private TransformPanel transformPanel; private Timelined timelined; + private JLabel timelineLabel; + private JButton closeTimelineButton; public EasySwfPanel() { setLayout(new BorderLayout()); @@ -332,6 +336,20 @@ public class EasySwfPanel extends JPanel { JPanel leftToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); leftToolbar.add(undoButton); leftToolbar.add(redoButton); + leftToolbar.add(Box.createHorizontalStrut(10)); + timelineLabel = new JLabel(""); + leftToolbar.add(timelineLabel); + leftToolbar.add(Box.createHorizontalStrut(5)); + closeTimelineButton = new JButton(View.getIcon("cancel16")); + closeTimelineButton.setMargin(new Insets(5, 5, 5, 5)); + leftToolbar.add(closeTimelineButton); + closeTimelineButton.setToolTipText(EasyStrings.translate("timeline.item.cancel")); + closeTimelineButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setTimelined(timelined.getSwf()); + } + }); toolbarPanel.add(leftToolbar, BorderLayout.WEST); @@ -466,6 +484,8 @@ public class EasySwfPanel extends JPanel { timelinePanel.setTimelined(null); libraryTreeTable.setSwf(null); libraryPreviewPanel.clearAll(); + closeTimelineButton.setVisible(false); + timelineLabel.setText(""); } else { SWF swf = timelined.getSwf(); libraryTreeTable.setSwf(swf); @@ -474,6 +494,14 @@ public class EasySwfPanel extends JPanel { stagePanel.pause(); stagePanel.gotoFrame(0); timelinePanel.setTimelined(timelined); + if (timelined instanceof SWF) { + timelineLabel.setText(EasyStrings.translate("timeline.main")); + closeTimelineButton.setVisible(false); + } else { + EasyTagNameResolver nameResolver = new EasyTagNameResolver(); + timelineLabel.setText(EasyStrings.translate("timeline.item").replace("%item%", nameResolver.getTagName((Tag) timelined))); + closeTimelineButton.setVisible(true); + } } updateUndos(); } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/EasyPanel.properties b/src/com/jpexs/decompiler/flash/gui/locales/EasyPanel.properties index bc48e7b0e..858dfef55 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/EasyPanel.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/EasyPanel.properties @@ -53,3 +53,7 @@ action.removeFrame = Remove frame action.transform = Transform action.move = Move action.addToStage = Add to stage + +timeline.main = Main timeline +timeline.item = Timeline of %item% +timeline.item.cancel = Cancel - Click to go to main timeline \ No newline at end of file