diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index cc8acabeb..b2d36ed14 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -99,6 +99,7 @@ import com.jpexs.decompiler.flash.tags.base.RemoveTag; import com.jpexs.decompiler.flash.tags.base.RenderContext; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.base.TextTag; +import com.jpexs.decompiler.flash.timeline.AS2Package; import com.jpexs.decompiler.flash.timeline.Clip; import com.jpexs.decompiler.flash.timeline.DepthState; import com.jpexs.decompiler.flash.timeline.Frame; @@ -1318,6 +1319,14 @@ public final class SWF implements SWFContainerItem, Timelined { for (TreeItem subItem : parentFrame.actions) { getASMs(exportFileNames, getASMWrapToTagScript(subItem), nodesToExport, exportAll || exportNode, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem)); } + } else if (treeItem instanceof AS2Package) { + AS2Package as2Package = (AS2Package) treeItem; + for (TreeItem subItem : as2Package.subPackages.values()) { + getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem)); + } + for (TreeItem subItem : as2Package.scripts.values()) { + getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem)); + } } } diff --git a/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index bf7b2185e..a9e962f56 100644 --- a/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -123,7 +123,7 @@ public class AboutDialog extends AppDialog { dateLabel.setHorizontalAlignment(SwingConstants.CENTER); cp.add(dateLabel); - LinkLabel wwwLabel = new LinkLabel(ApplicationInfo.PROJECT_PAGE,ApplicationInfo.PROJECT_PAGE+"?utm_source=app&utm_medium=about&utm_campaign=app"); + LinkLabel wwwLabel = new LinkLabel(ApplicationInfo.PROJECT_PAGE, ApplicationInfo.PROJECT_PAGE + "?utm_source=app&utm_medium=about&utm_campaign=app"); wwwLabel.setAlignmentX(0.5f); wwwLabel.setForeground(Color.blue); //wwwLabel.setPreferredSize(new Dimension(300, 25)); diff --git a/src/com/jpexs/decompiler/flash/gui/LinkLabel.java b/src/com/jpexs/decompiler/flash/gui/LinkLabel.java index dda4a379f..af0659e3f 100644 --- a/src/com/jpexs/decompiler/flash/gui/LinkLabel.java +++ b/src/com/jpexs/decompiler/flash/gui/LinkLabel.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -32,7 +32,7 @@ public class LinkLabel extends JLabel { * The normal text set by the user. */ private String text; - + private String url; /** @@ -40,16 +40,16 @@ public class LinkLabel extends JLabel { * * @param text */ - public LinkLabel(String text,String url) { + public LinkLabel(String text, String url) { super(text); this.url = url; setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); enableEvents(MouseEvent.MOUSE_EVENT_MASK); } - + public LinkLabel(String text) { - this(text,text); + this(text, text); } /** diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 4ee80b9b3..c84153efd 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -641,7 +641,7 @@ public class Main { return AppStrings.translate("filter.swf"); } }; - + FileFilter exeFilter = new FileFilter() { @Override public boolean accept(File f) { @@ -653,7 +653,7 @@ public class Main { return AppStrings.translate("filter.exe"); } }; - if(mode == SaveFileMode.EXE){ + if (mode == SaveFileMode.EXE) { fc.setFileFilter(exeFilter); } else if (!swf.gfx) { fc.setFileFilter(swfFilter); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 130c846eb..5ec4d9002 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -251,7 +251,7 @@ public abstract class MainFrameMenu { } protected void homePage() { - String homePageURL = ApplicationInfo.PROJECT_PAGE+"?utm_source=app&utm_medium=menu&utm_campaign=app"; + String homePageURL = ApplicationInfo.PROJECT_PAGE + "?utm_source=app&utm_medium=menu&utm_campaign=app"; if (!View.navigateUrl(homePageURL)) { View.showMessageDialog(null, translate("message.homepage").replace("%url%", homePageURL)); } diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index a1424b416..1ed141bdd 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -134,7 +134,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener private static final String ACTION_EXPORT = "EXPORT"; - private static final String ACTION_IMPORT_TEXT = "IMPORTTEXT"; + private static final String ACTION_IMPORT_TEXT = "IMPORTTEXT"; private static final String ACTION_CHECK_UPDATES = "CHECKUPDATES"; @@ -199,7 +199,9 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener private JCommandButton exportSelectionCommandButton; private JCommandButton importTextCommandButton; + private JCommandButton importXmlCommandButton; + private JCommandButton exportXmlCommandButton; private JCommandToggleButton viewModeResourcesToggleButton; @@ -411,7 +413,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16")); assignListener(reloadCommandButton, ACTION_RELOAD); - + saveasexeCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveasexe")), View.getResizableIcon("saveasexe16")); assignListener(saveasexeCommandButton, ACTION_SAVE_AS_EXE); @@ -419,7 +421,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP); editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM); editBand.addCommandButton(saveasexeCommandButton, RibbonElementPriority.MEDIUM); - editBand.addCommandButton(reloadCommandButton, RibbonElementPriority.MEDIUM); + editBand.addCommandButton(reloadCommandButton, RibbonElementPriority.MEDIUM); JRibbonBand exportBand = new JRibbonBand(translate("menu.export"), null); exportBand.setResizePolicies(getResizePolicies(exportBand)); @@ -429,8 +431,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener assignListener(exportAllCommandButton, ACTION_EXPORT); exportSelectionCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.selection")), View.getResizableIcon("exportsel16")); assignListener(exportSelectionCommandButton, ACTION_EXPORT_SEL); - - + exportXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.xml")), View.getResizableIcon("exportxml32")); assignListener(exportXmlCommandButton, ACTION_EXPORT_SWF_XML); @@ -438,18 +439,17 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener exportBand.addCommandButton(exportAllCommandButton, RibbonElementPriority.MEDIUM); exportBand.addCommandButton(exportSelectionCommandButton, RibbonElementPriority.MEDIUM); exportBand.addCommandButton(exportXmlCommandButton, RibbonElementPriority.MEDIUM); - JRibbonBand importBand = new JRibbonBand(translate("menu.import"), null); importBand.setResizePolicies(getResizePolicies(importBand)); importTextCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.text")), View.getResizableIcon("importtext32")); assignListener(importTextCommandButton, ACTION_IMPORT_TEXT); - + importXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.xml")), View.getResizableIcon("importxml32")); assignListener(importXmlCommandButton, ACTION_IMPORT_SWF_XML); importBand.addCommandButton(importXmlCommandButton, RibbonElementPriority.TOP); - importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.TOP); + importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.TOP); JRibbonBand viewBand = new JRibbonBand(translate("menu.view"), null); viewBand.setResizePolicies(getResizePolicies(viewBand)); @@ -948,7 +948,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener case ACTION_IMPORT_TEXT: importText(); break; - + case ACTION_EXPORT_SWF_XML: mainFrame.getPanel().exportSwfXml(); break; diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index fa26e7746..afa02c5b7 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.tags.text.TextAlign; import com.jpexs.decompiler.flash.tags.text.TextParseException; import com.jpexs.decompiler.flash.treeitems.TreeItem; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Insets; @@ -124,74 +123,48 @@ public class TextPanel extends JPanel implements ActionListener { JPanel textButtonsPanel = new JPanel(); textButtonsPanel.setLayout(new FlowLayout(SwingConstants.WEST)); - - textAlignLeftButton = new JButton("", View.getIcon("textalignleft16")); - textAlignLeftButton.setMargin(new Insets(3, 3, 3, 10)); - textAlignLeftButton.setActionCommand(ACTION_TEXT_ALIGN_LEFT); - textAlignLeftButton.addActionListener(this); - textAlignLeftButton.setToolTipText(AppStrings.translate("text.align.left")); + textAlignLeftButton = createButton(null, "textalignleft16", ACTION_TEXT_ALIGN_LEFT, "text.align.left"); + textAlignCenterButton = createButton(null, "textaligncenter16", ACTION_TEXT_ALIGN_CENTER, "text.align.center"); + textAlignRightButton = createButton(null, "textalignright16", ACTION_TEXT_ALIGN_RIGHT, "text.align.right"); + textAlignJustifyButton = createButton(null, "textalignjustify16", ACTION_TEXT_ALIGN_JUSTIFY, "text.align.justify"); + undoChangesButton = createButton(null, "reload16", ACTION_UNDO_CHANGES, "text.undo"); - textAlignCenterButton = new JButton("", View.getIcon("textaligncenter16")); - textAlignCenterButton.setMargin(new Insets(3, 3, 3, 10)); - textAlignCenterButton.setActionCommand(ACTION_TEXT_ALIGN_CENTER); - textAlignCenterButton.addActionListener(this); - textAlignCenterButton.setToolTipText(AppStrings.translate("text.align.center")); - - textAlignRightButton = new JButton("", View.getIcon("textalignright16")); - textAlignRightButton.setMargin(new Insets(3, 3, 3, 10)); - textAlignRightButton.setActionCommand(ACTION_TEXT_ALIGN_RIGHT); - textAlignRightButton.addActionListener(this); - textAlignRightButton.setToolTipText(AppStrings.translate("text.align.right")); - - textAlignJustifyButton = new JButton("", View.getIcon("textalignjustify16")); - textAlignJustifyButton.setMargin(new Insets(3, 3, 3, 10)); - textAlignJustifyButton.setActionCommand(ACTION_TEXT_ALIGN_JUSTIFY); - textAlignJustifyButton.addActionListener(this); - textAlignJustifyButton.setToolTipText(AppStrings.translate("text.align.justify")); - - undoChangesButton = new JButton("", View.getIcon("reload16")); - undoChangesButton.setMargin(new Insets(3, 3, 3, 10)); - undoChangesButton.setActionCommand(ACTION_UNDO_CHANGES); - undoChangesButton.addActionListener(this); - undoChangesButton.setToolTipText(AppStrings.translate("text.undo")); - - textButtonsPanel.add(textAlignLeftButton); textButtonsPanel.add(textAlignCenterButton); textButtonsPanel.add(textAlignRightButton); textButtonsPanel.add(textAlignJustifyButton); textButtonsPanel.add(undoChangesButton); - textButtonsPanel.setAlignmentX(0); topPanel.add(textButtonsPanel); - add(topPanel,BorderLayout.NORTH); - + add(topPanel, BorderLayout.NORTH); + JPanel buttonsPanel = new JPanel(new FlowLayout()); - textSaveButton = new JButton(mainPanel.translate("button.save"), View.getIcon("save16")); - textSaveButton.setMargin(new Insets(3, 3, 3, 10)); - textSaveButton.setActionCommand(ACTION_SAVE_TEXT); - textSaveButton.addActionListener(this); + textSaveButton = createButton("button.save", "save16", ACTION_SAVE_TEXT, null); + textEditButton = createButton("button.edit", "edit16", ACTION_EDIT_TEXT, null); + textCancelButton = createButton("button.cancel", "cancel16", ACTION_CANCEL_TEXT, null); - textEditButton = new JButton(mainPanel.translate("button.edit"), View.getIcon("edit16")); - textEditButton.setMargin(new Insets(3, 3, 3, 10)); - textEditButton.setActionCommand(ACTION_EDIT_TEXT); - textEditButton.addActionListener(this); - - textCancelButton = new JButton(mainPanel.translate("button.cancel"), View.getIcon("cancel16")); - textCancelButton.setMargin(new Insets(3, 3, 3, 10)); - textCancelButton.setActionCommand(ACTION_CANCEL_TEXT); - textCancelButton.addActionListener(this); - textSaveButton.setVisible(false); textCancelButton.setVisible(false); - + buttonsPanel.add(textEditButton); buttonsPanel.add(textSaveButton); buttonsPanel.add(textCancelButton); - add(buttonsPanel,BorderLayout.SOUTH); - + add(buttonsPanel, BorderLayout.SOUTH); + } + + private JButton createButton(String textResource, String iconName, String command, String toolTipResource) { + String text = textResource == null ? "" : mainPanel.translate(textResource); + JButton button = new JButton(text, View.getIcon(iconName)); + button.setMargin(new Insets(3, 3, 3, 10)); + button.setActionCommand(command); + button.addActionListener(this); + if (toolTipResource != null) { + button.setToolTipText(mainPanel.translate(toolTipResource)); + } + + return button; } public SearchPanel getSearchPanel() {